improve server tabs by type and viewport
Build and publish Docker image / build-and-publish (push) Successful in 14s

This commit is contained in:
wfalkowski committed 2026-10-23 21:50:53 +00:00
1 parent afc69d61a9
commit b539a38f26
2 files changed
+41 -13

No files matched your search

+23 -7
View File
@@ -70,6 +70,15 @@ const ServerDetailsModal = ({ server, onClose, onServerAction, showAlert }) => {
const [mcSettings, setMcSettings] = useState(null);
const [isMcSettingsLoading, setIsMcSettingsLoading] = useState(false);
useEffect(() => {
const terminalUnavailable = ['vps', 'website', 'game'].includes(server?.type);
const logsUnavailable = server?.type === 'vps';
if ((activeTab === 'terminal' && terminalUnavailable) ||
(activeTab === 'logs' && logsUnavailable)) {
setActiveTab('overview');
}
}, [server?.id, server?.type, activeTab]);
// Initialize version, loader and java version state when server loads or edit mode opens
useEffect(() => {
if (server) {
@@ -531,7 +540,7 @@ const ServerDetailsModal = ({ server, onClose, onServerAction, showAlert }) => {
</div>
<div className="border-b bg-black/10" style={{ borderColor: colors.brightBlack }}>
<div className="flex space-x-1 px-6">
<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 },
...(server.type === 'game' ?
@@ -553,16 +562,23 @@ const ServerDetailsModal = ({ server, onClose, onServerAction, showAlert }) => {
] : []),
{ id: 'network', label: 'Network', icon: NetworkIcon },
{ id: 'backups', label: 'Backups', icon: Database, important: true },
{ id: 'terminal', label: 'Terminal', icon: Terminal },
{ id: 'logs', label: 'Logs', icon: FileText }
...(['vps', 'website', 'game'].includes(server.type)
? []
: [{ id: 'terminal', label: 'Terminal', icon: Terminal }]),
...(server.type === 'vps' ? [] : [{ id: 'logs', label: 'Logs', icon: FileText }])
].map((tab) => {
const Icon = tab.icon;
const isActive = activeTab === tab.id;
return (
<button
key={tab.id}
type="button"
role="tab"
aria-selected={isActive}
aria-controls="server-details-content"
id={`server-details-tab-${tab.id}`}
onClick={() => setActiveTab(tab.id)}
className={`flex items-center space-x-2 px-5 py-4 text-sm font-bold border-b-2 transition-all duration-200 ${
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 ${
isActive ? '' : 'border-transparent opacity-50 hover:opacity-100 hover:bg-white/5'
} ${tab.important && !isActive ? 'text-primary' : ''}`}
style={{
@@ -570,15 +586,15 @@ const ServerDetailsModal = ({ server, onClose, onServerAction, showAlert }) => {
color: isActive ? colors.blue : (tab.important ? colors.primary : colors.foreground)
}}
>
<Icon className={`w-4 h-4 ${tab.important && !isActive ? 'animate-pulse' : ''}`} />
<span className="tracking-tight">{tab.label}</span>
<Icon className={`w-4 h-4 shrink-0 ${tab.important && !isActive ? 'animate-pulse' : ''}`} />
<span className="min-w-0 truncate">{tab.label}</span>
</button>
)
})}
</div>
</div>
<div className="flex-1 overflow-y-auto p-4 sm:p-8 custom-scrollbar bg-black/5 w-full">
<div id="server-details-content" role="tabpanel" aria-labelledby={`server-details-tab-${activeTab}`} className="flex-1 overflow-y-auto p-4 sm:p-8 custom-scrollbar bg-black/5 w-full">
{activeTab === 'overview' && (
<div className="space-y-8 w-full max-w-full animate-in fade-in slide-in-from-bottom-2 duration-300">