improve server tabs by type and viewport
Build and publish Docker image / build-and-publish (push) Successful in 14s
Build and publish Docker image / build-and-publish (push) Successful in 14s
This commit is contained in:
1 parent
afc69d61a9
commit
b539a38f26
2 files changed
+41
-13
No files matched your search
@@ -427,6 +427,15 @@ function DashboardPage({ setIsLoginOpen, setIsRegisterOpen, onCurrencyChange, pr
|
||||
const [userCredits, setUserCredits] = useState(user?.credits || 0);
|
||||
const [isMobileSidebarOpen, setIsMobileSidebarOpen] = useState(false);
|
||||
const [activeServerDetailTab, setActiveServerDetailTab] = useState('overview');
|
||||
|
||||
useEffect(() => {
|
||||
const terminalUnavailable = ['vps', 'website', 'game'].includes(selectedServer?.type);
|
||||
const logsUnavailable = selectedServer?.type === 'vps';
|
||||
if ((activeServerDetailTab === 'terminal' && terminalUnavailable) ||
|
||||
(activeServerDetailTab === 'logs' && logsUnavailable)) {
|
||||
setActiveServerDetailTab('overview');
|
||||
}
|
||||
}, [selectedServer?.id, selectedServer?.type, activeServerDetailTab]);
|
||||
|
||||
// Ref for sendMessage to break circular dependency
|
||||
const sendMessageRef = useRef(null);
|
||||
@@ -2935,7 +2944,7 @@ const handleWebSocketMessage = useCallback((data) => {
|
||||
</div>
|
||||
|
||||
<div className="border-b border-dash-border bg-black/5 shrink-0">
|
||||
<div role="tablist" aria-label="Server sections" className="flex space-x-1 px-6 overflow-x-auto custom-scrollbar">
|
||||
<div role="tablist" aria-label="Server sections" className="grid grid-cols-2 min-[480px]:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-1 p-2 sm:p-3">
|
||||
{[
|
||||
{ id: 'overview', label: 'Overview', icon: Info },
|
||||
...(selectedServer.type === 'game'
|
||||
@@ -2952,8 +2961,10 @@ const handleWebSocketMessage = useCallback((data) => {
|
||||
...(selectedServer.type !== 'database' && selectedServer.type !== 'vps'
|
||||
? [{ id: 'files', label: 'Files', icon: Folder }]
|
||||
: []),
|
||||
{ id: 'terminal', label: 'Terminal', icon: Terminal },
|
||||
{ id: 'logs', label: 'Logs', icon: FileText },
|
||||
...(['vps', 'website', 'game'].includes(selectedServer.type)
|
||||
? []
|
||||
: [{ id: 'terminal', label: 'Terminal', icon: Terminal }]),
|
||||
...(selectedServer.type === 'vps' ? [] : [{ id: 'logs', label: 'Logs', icon: FileText }]),
|
||||
{ id: 'network', label: 'Network', icon: NetworkIcon },
|
||||
{ id: 'backups', label: 'Backups', icon: Database },
|
||||
].map((tab) => {
|
||||
@@ -2970,14 +2981,15 @@ const handleWebSocketMessage = useCallback((data) => {
|
||||
setActiveServerDetailTab(tab.id);
|
||||
if (tab.id !== 'network') setShowPortMappingGuide(false);
|
||||
}}
|
||||
className={`flex items-center space-x-2 px-5 py-4 text-xs font-bold uppercase tracking-widest border-b-2 transition-all duration-200 ${
|
||||
aria-controls="server-detail-panel"
|
||||
className={`flex min-w-0 min-h-11 items-center justify-center sm:justify-start gap-2 rounded px-2 sm:px-3 py-2 text-[10px] sm:text-xs font-bold uppercase tracking-wide sm:tracking-wider border-b-2 transition-colors duration-200 ${
|
||||
active
|
||||
? 'border-primary text-primary bg-primary/5'
|
||||
: 'border-transparent text-dash-textMuted hover:text-dash-text hover:bg-white/5'
|
||||
}`}
|
||||
>
|
||||
<Icon className="w-3.5 h-3.5" />
|
||||
<span>{tab.label}</span>
|
||||
<Icon className="w-4 h-4 shrink-0" />
|
||||
<span className="min-w-0 truncate">{tab.label}</span>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
|
||||
Reference in new issue
Block a user