@@ -4,7 +4,7 @@ import { useDocumentTitle } from 'usehooks-ts';
44import { useLocation } from 'react-router-dom' ;
55import InstanceTabListMap from '../../data/InstanceTabListMap' ;
66import Label from 'components/Atoms/Label' ;
7- import { stateToLabelColor } from 'utils/util' ;
7+ import { cn , stateToLabelColor } from 'utils/util' ;
88import Spinner from 'components/DashboardLayout/Spinner' ;
99const InstanceTabs = ( ) => {
1010 useDocumentTitle ( 'Dashboard - Lodestone' ) ;
@@ -44,36 +44,69 @@ const InstanceTabs = () => {
4444 ) ;
4545 }
4646 }
47+
48+ const tabs = InstanceTabListMap [ instance . game_type ] ;
49+ if ( ! tabs ) {
50+ return (
51+ < div
52+ className = "relative flex h-full w-full flex-row justify-center overflow-y-auto px-4 pt-8 pb-10 @container"
53+ key = { uuid }
54+ >
55+ < div className = "flex h-fit min-h-full w-full grow flex-col items-start gap-2" >
56+ < div className = "flex min-w-0 flex-row items-center gap-4" >
57+ < h1 className = "dashboard-instance-heading truncate whitespace-pre" >
58+ Unknown game type { instance . game_type }
59+ </ h1 >
60+ </ div >
61+ </ div >
62+ </ div >
63+ ) ;
64+ }
65+
66+ const tab = tabs . find ( ( tab ) => tab . path === path ) ;
67+
68+ if ( ! tab ) {
69+ return (
70+ < div
71+ className = "relative flex h-full w-full flex-row justify-center overflow-y-auto px-4 pt-8 pb-10 @container"
72+ key = { uuid }
73+ >
74+ < div className = "flex h-fit min-h-full w-full grow flex-col items-start gap-2" >
75+ < div className = "flex min-w-0 flex-row items-center gap-4" >
76+ < h1 className = "dashboard-instance-heading truncate whitespace-pre" >
77+ Unknown tab { path }
78+ </ h1 >
79+ </ div >
80+ </ div >
81+ </ div >
82+ ) ;
83+ }
84+
4785 return (
4886 < div
49- className = "relative mx-auto flex h-full w-full max-w-4xl flex-row justify-center @container"
87+ className = { cn ( "relative mx-auto flex h-full w-full flex-row justify-center @container" , tab . width ) }
5088 key = { uuid }
5189 >
52- { InstanceTabListMap [ instance . game_type ] . map (
53- ( tab ) =>
54- tab . path === path && (
55- < div
56- className = "gutter-stable -mx-3 flex grow flex-row items-stretch overflow-y-auto pl-4 pr-2"
57- key = { `${ instance . name } -${ tab . title } ` }
58- >
59- < div className = "flex h-fit min-h-full w-full flex-col gap-16 pt-6 pb-10 focus:outline-none" >
60- < div className = "flex font-title text-h1 font-bold leading-tight text-gray-300" >
61- { tab . title }
62- { tab . title === 'Console' && (
63- < Label
64- size = "medium"
65- className = "ml-2 mt-[6px]"
66- color = { stateToLabelColor [ instance . state ] }
67- >
68- { instance . state }
69- </ Label >
70- ) }
71- </ div >
72- { tab . content }
73- </ div >
74- </ div >
75- )
76- ) }
90+ < div
91+ className = "gutter-stable -mx-3 flex grow flex-row items-stretch overflow-y-auto pl-4 pr-2"
92+ key = { `${ instance . name } -${ tab . title } ` }
93+ >
94+ < div className = "flex h-fit min-h-full w-full flex-col gap-8 pt-10 pb-8 focus:outline-none" >
95+ < div className = "flex font-title text-h1 font-bold leading-tight text-gray-300" >
96+ { tab . title }
97+ { tab . title === 'Console' && (
98+ < Label
99+ size = "medium"
100+ className = "ml-2 mt-[6px]"
101+ color = { stateToLabelColor [ instance . state ] }
102+ >
103+ { instance . state }
104+ </ Label >
105+ ) }
106+ </ div >
107+ { tab . content }
108+ </ div >
109+ </ div >
77110 </ div >
78111 ) ;
79112} ;
0 commit comments