From 20f83c9864355b5c72e69adc37fa8c0145a5257c Mon Sep 17 00:00:00 2001 From: Ynng <44907675+Ynng@users.noreply.github.com> Date: Tue, 21 Feb 2023 22:43:31 -0500 Subject: [PATCH] Quick patch up for the new design - set different width for each tab - fixed some text wrapping --- src/components/DashboardCard.tsx | 3 +- src/components/DashboardLayout/LeftNav.tsx | 1 + .../Minecraft/MinecraftGeneralCard.tsx | 2 +- .../Minecraft/MinecraftSettingCard.tsx | 8 +- src/data/InstanceTabListMap.tsx | 25 ++++-- src/pages/InstanceTabs/InstanceTabs.tsx | 87 +++++++++++++------ src/pages/dashboard.tsx | 2 +- src/pages/settings.tsx | 2 +- 8 files changed, 88 insertions(+), 42 deletions(-) diff --git a/src/components/DashboardCard.tsx b/src/components/DashboardCard.tsx index 2b099b2a..e2480eac 100644 --- a/src/components/DashboardCard.tsx +++ b/src/components/DashboardCard.tsx @@ -1,4 +1,5 @@ import { ReactNode } from 'react'; +import { cn } from 'utils/util'; export default function DashboardCard({ children, @@ -9,7 +10,7 @@ export default function DashboardCard({ }) { return (
{children}
diff --git a/src/components/DashboardLayout/LeftNav.tsx b/src/components/DashboardLayout/LeftNav.tsx index f1dac6e7..2137e468 100644 --- a/src/components/DashboardLayout/LeftNav.tsx +++ b/src/components/DashboardLayout/LeftNav.tsx @@ -63,6 +63,7 @@ export default function LeftNav({ className }: { className?: string }) { icon={faSquarePlus} disabled={!canCreateInstance} onClick={() => setShowCreateInstance(true)} + align="start" /> diff --git a/src/components/Minecraft/MinecraftGeneralCard.tsx b/src/components/Minecraft/MinecraftGeneralCard.tsx index 7f363edb..c0865eff 100644 --- a/src/components/Minecraft/MinecraftGeneralCard.tsx +++ b/src/components/Minecraft/MinecraftGeneralCard.tsx @@ -133,7 +133,7 @@ export default function MinecraftGeneralCard() { return (
-
+

Server Settings

Technical settings for the server diff --git a/src/components/Minecraft/MinecraftSettingCard.tsx b/src/components/Minecraft/MinecraftSettingCard.tsx index 57698493..48b2641b 100644 --- a/src/components/Minecraft/MinecraftSettingCard.tsx +++ b/src/components/Minecraft/MinecraftSettingCard.tsx @@ -224,7 +224,7 @@ export default function MinecraftSettingCard() { Please backup any important data before proceeding.
-
+

General Game Settings

@@ -261,12 +261,12 @@ export default function MinecraftSettingCard() {
-
+

Advanced Game Settings

- Less commoningly used Minecraft world settings + Less commonly used Minecraft world settings

@@ -298,7 +298,7 @@ export default function MinecraftSettingCard() {
-
+

Danger Zone

These settings can cause irreversible damage to your server! diff --git a/src/data/InstanceTabListMap.tsx b/src/data/InstanceTabListMap.tsx index 9e656f6d..f90bde40 100644 --- a/src/data/InstanceTabListMap.tsx +++ b/src/data/InstanceTabListMap.tsx @@ -20,44 +20,54 @@ const InstanceTabListMap = { { title: 'Overview', path: 'overview', + width: 'max-w-4xl', icon: , - content: , + content: ( + <> +

Work in Progress

+ + + ), }, { title: 'Settings', path: 'settings', + width: 'max-w-2xl', icon: , content: ( - <> +
- +
), }, { title: 'Console', path: 'console', + width: 'max-w-6xl', icon: , content: , }, { title: 'Files', path: 'files', + width: 'max-w-6xl', icon: , content: , }, { title: 'Tasks', path: 'tasks', + width: 'max-w-4xl', icon: , content: ( - + placeholder -

+

Coming soon to a dashboard near you!

@@ -66,15 +76,16 @@ const InstanceTabListMap = { { title: 'Event Logs', path: 'logs', + width: 'max-w-4xl', icon: , content: ( - + placeholder -

+

Coming soon to a dashboard near you!

diff --git a/src/pages/InstanceTabs/InstanceTabs.tsx b/src/pages/InstanceTabs/InstanceTabs.tsx index 319662c1..694a062c 100644 --- a/src/pages/InstanceTabs/InstanceTabs.tsx +++ b/src/pages/InstanceTabs/InstanceTabs.tsx @@ -4,7 +4,7 @@ import { useDocumentTitle } from 'usehooks-ts'; import { useLocation } from 'react-router-dom'; import InstanceTabListMap from '../../data/InstanceTabListMap'; import Label from 'components/Atoms/Label'; -import { stateToLabelColor } from 'utils/util'; +import { cn, stateToLabelColor } from 'utils/util'; import Spinner from 'components/DashboardLayout/Spinner'; const InstanceTabs = () => { useDocumentTitle('Dashboard - Lodestone'); @@ -44,36 +44,69 @@ const InstanceTabs = () => { ); } } + + const tabs = InstanceTabListMap[instance.game_type]; + if (!tabs) { + return ( +
+
+
+

+ Unknown game type {instance.game_type} +

+
+
+
+ ); + } + + const tab = tabs.find((tab) => tab.path === path); + + if (!tab) { + return ( +
+
+
+

+ Unknown tab {path} +

+
+
+
+ ); + } + return (
- {InstanceTabListMap[instance.game_type].map( - (tab) => - tab.path === path && ( -
-
-
- {tab.title} - {tab.title === 'Console' && ( - - )} -
- {tab.content} -
-
- ) - )} +
+
+
+ {tab.title} + {tab.title === 'Console' && ( + + )} +
+ {tab.content} +
+
); }; diff --git a/src/pages/dashboard.tsx b/src/pages/dashboard.tsx index f6eeb4c5..fe8a3112 100644 --- a/src/pages/dashboard.tsx +++ b/src/pages/dashboard.tsx @@ -200,7 +200,7 @@ const Dashboard = () => { {tabList[instance.game_type].map((tab) => ( {tab.content} diff --git a/src/pages/settings.tsx b/src/pages/settings.tsx index 7b443ac1..b0b463ad 100644 --- a/src/pages/settings.tsx +++ b/src/pages/settings.tsx @@ -56,7 +56,7 @@ const SettingsPage = () => { {tabList.map((tab) => ( {tab.content}