From 98dc1f3b0660a98d7193c2858a4e8c7113358d80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Hatcher?= Date: Sat, 14 Dec 2024 22:26:15 +0100 Subject: [PATCH] FIX[WebApp]: Rename navigation => SheetTabBar Also rename all widgets in that folder to more standard names --- .../{navigation => SheetTabBar}/SheetListMenu.tsx | 0 .../{navigation => SheetTabBar}/SheetRenameDialog.tsx | 10 +++++----- .../{navigation/sheet.tsx => SheetTabBar/SheetTab.tsx} | 10 +++++----- .../navigation.tsx => SheetTabBar/SheetTabBar.tsx} | 10 +++++----- webapp/src/components/SheetTabBar/index.ts | 1 + .../components/{navigation => SheetTabBar}/types.ts | 0 webapp/src/components/navigation/index.ts | 2 -- webapp/src/components/workbook.tsx | 4 ++-- 8 files changed, 18 insertions(+), 19 deletions(-) rename webapp/src/components/{navigation => SheetTabBar}/SheetListMenu.tsx (100%) rename webapp/src/components/{navigation => SheetTabBar}/SheetRenameDialog.tsx (95%) rename webapp/src/components/{navigation/sheet.tsx => SheetTabBar/SheetTab.tsx} (95%) rename webapp/src/components/{navigation/navigation.tsx => SheetTabBar/SheetTabBar.tsx} (95%) create mode 100644 webapp/src/components/SheetTabBar/index.ts rename webapp/src/components/{navigation => SheetTabBar}/types.ts (100%) delete mode 100644 webapp/src/components/navigation/index.ts diff --git a/webapp/src/components/navigation/SheetListMenu.tsx b/webapp/src/components/SheetTabBar/SheetListMenu.tsx similarity index 100% rename from webapp/src/components/navigation/SheetListMenu.tsx rename to webapp/src/components/SheetTabBar/SheetListMenu.tsx diff --git a/webapp/src/components/navigation/SheetRenameDialog.tsx b/webapp/src/components/SheetTabBar/SheetRenameDialog.tsx similarity index 95% rename from webapp/src/components/navigation/SheetRenameDialog.tsx rename to webapp/src/components/SheetTabBar/SheetRenameDialog.tsx index f8a4215..b6657d9 100644 --- a/webapp/src/components/navigation/SheetRenameDialog.tsx +++ b/webapp/src/components/SheetTabBar/SheetRenameDialog.tsx @@ -4,8 +4,8 @@ import { useTranslation } from "react-i18next"; import { theme } from "../../theme"; interface SheetRenameDialogProps { - isOpen: boolean; - close: () => void; + open: boolean; + onClose: () => void; onNameChanged: (name: string) => void; defaultName: string; } @@ -14,10 +14,10 @@ const SheetRenameDialog = (properties: SheetRenameDialogProps) => { const { t } = useTranslation(); const [name, setName] = useState(properties.defaultName); const handleClose = () => { - properties.close(); + properties.onClose(); }; return ( - + {t("sheet_rename.title")} {}}> @@ -53,7 +53,7 @@ const SheetRenameDialog = (properties: SheetRenameDialogProps) => { event.stopPropagation(); if (event.key === "Enter") { properties.onNameChanged(name); - properties.close(); + properties.onClose(); } }} onChange={(event) => { diff --git a/webapp/src/components/navigation/sheet.tsx b/webapp/src/components/SheetTabBar/SheetTab.tsx similarity index 95% rename from webapp/src/components/navigation/sheet.tsx rename to webapp/src/components/SheetTabBar/SheetTab.tsx index 31b3a82..51dcb95 100644 --- a/webapp/src/components/navigation/sheet.tsx +++ b/webapp/src/components/SheetTabBar/SheetTab.tsx @@ -6,7 +6,7 @@ import { isInReferenceMode } from "../editor/util"; import type { WorkbookState } from "../workbookState"; import SheetRenameDialog from "./SheetRenameDialog"; -interface SheetProps { +interface SheetTabProps { name: string; color: string; selected: boolean; @@ -17,7 +17,7 @@ interface SheetProps { workbookState: WorkbookState; } -function Sheet(props: SheetProps) { +function SheetTab(props: SheetTabProps) { const { name, color, selected, workbookState, onSelected } = props; const [anchorEl, setAnchorEl] = useState(null); const [colorPickerOpen, setColorPickerOpen] = useState(false); @@ -100,8 +100,8 @@ function Sheet(props: SheetProps) { { props.onRenamed(newName); @@ -159,4 +159,4 @@ const Name = styled("div")` text-wrap: nowrap; `; -export default Sheet; +export default SheetTab; diff --git a/webapp/src/components/navigation/navigation.tsx b/webapp/src/components/SheetTabBar/SheetTabBar.tsx similarity index 95% rename from webapp/src/components/navigation/navigation.tsx rename to webapp/src/components/SheetTabBar/SheetTabBar.tsx index 184ab7c..25fb057 100644 --- a/webapp/src/components/navigation/navigation.tsx +++ b/webapp/src/components/SheetTabBar/SheetTabBar.tsx @@ -7,10 +7,10 @@ import { NAVIGATION_HEIGHT } from "../constants"; import { StyledButton } from "../toolbar"; import type { WorkbookState } from "../workbookState"; import SheetListMenu from "./SheetListMenu"; -import Sheet from "./sheet"; +import SheetTab from "./SheetTab"; import type { SheetOptions } from "./types"; -export interface NavigationProps { +export interface SheetTabBarProps { sheets: SheetOptions[]; selectedIndex: number; workbookState: WorkbookState; @@ -21,7 +21,7 @@ export interface NavigationProps { onSheetDeleted: () => void; } -function Navigation(props: NavigationProps) { +function SheetTabBar(props: SheetTabBarProps) { const { t } = useTranslation(); const { workbookState, onSheetSelected, sheets, selectedIndex } = props; const [anchorEl, setAnchorEl] = useState(null); @@ -52,7 +52,7 @@ function Navigation(props: NavigationProps) { {sheets.map((tab, index) => ( - { }} /> -