Add OpenTTD and Terraria support, improve config editors
- Add OpenTTD server integration (config editor, server card, API) - Add Terraria server integration (config editor, API) - Add legends to all config editors for syntax highlighting - Simplify UserManagement: remove edit/delete buttons, add Discord avatars - Add auto-logout on 401/403 API errors - Update save button styling with visible borders 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { useState, useEffect } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import { getServers } from '../api'
|
||||
import { getServers, getAllDisplaySettings } from '../api'
|
||||
import { useUser } from '../context/UserContext'
|
||||
import ServerCard from '../components/ServerCard'
|
||||
import UserManagement from '../components/UserManagement'
|
||||
@@ -11,6 +11,7 @@ export default function Dashboard({ onLogin, onLogout }) {
|
||||
const navigate = useNavigate()
|
||||
const { user, token, loading: userLoading, isSuperadmin, role } = useUser()
|
||||
const [servers, setServers] = useState([])
|
||||
const [displaySettings, setDisplaySettings] = useState({})
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [error, setError] = useState('')
|
||||
const [showUserMgmt, setShowUserMgmt] = useState(false)
|
||||
@@ -22,8 +23,12 @@ export default function Dashboard({ onLogin, onLogout }) {
|
||||
|
||||
const fetchServers = async () => {
|
||||
try {
|
||||
const data = await getServers(token)
|
||||
const [data, settings] = await Promise.all([
|
||||
getServers(token),
|
||||
getAllDisplaySettings(token)
|
||||
])
|
||||
setServers(data)
|
||||
setDisplaySettings(settings)
|
||||
setError('')
|
||||
} catch (err) {
|
||||
if (err.message.includes('401') || err.message.includes('403')) {
|
||||
@@ -225,6 +230,7 @@ export default function Dashboard({ onLogin, onLogout }) {
|
||||
server={server}
|
||||
onClick={() => navigate('/server/' + server.id)}
|
||||
isAuthenticated={isAuthenticated}
|
||||
displaySettings={displaySettings[server.id]}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user