diff --git a/frontend/src/app-components/dialogs/DeleteDialog.tsx b/frontend/src/app-components/dialogs/DeleteDialog.tsx deleted file mode 100644 index a2196ed0..00000000 --- a/frontend/src/app-components/dialogs/DeleteDialog.tsx +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright © 2024 Hexastack. All rights reserved. - * - * Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms: - * 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission. - * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). - */ - -import ErrorIcon from "@mui/icons-material/Error"; -import { - Button, - Dialog, - DialogActions, - DialogContent, - Grid, - Typography, -} from "@mui/material"; - -import { DialogTitle } from "@/app-components/dialogs/DialogTitle"; -import { DialogControl } from "@/hooks/useDialog"; -import { useTranslate } from "@/hooks/useTranslate"; - -export type DeleteDialogProps = DialogControl; -export const DeleteDialog = ({ - open, - callback, - closeDialog: closeFunction, -}: DeleteDialogProps) => { - const { t } = useTranslate(); - - return ( - - {t("title.warning")} - - - - - - - {t("message.item_delete_confirm")} - - - - - - - - - ); -}; diff --git a/frontend/src/app-components/dialogs/MoveDialog.tsx b/frontend/src/app-components/dialogs/MoveDialog.tsx deleted file mode 100644 index ea92aa42..00000000 --- a/frontend/src/app-components/dialogs/MoveDialog.tsx +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright © 2024 Hexastack. All rights reserved. - * - * Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms: - * 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission. - * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). - */ - -import { - Button, - Dialog, - DialogActions, - DialogContent, - Grid, - MenuItem, - Select, -} from "@mui/material"; -import { FC, useState } from "react"; - -import { DialogTitle } from "@/app-components/dialogs/DialogTitle"; -import { DialogControl } from "@/hooks/useDialog"; -import { useTranslate } from "@/hooks/useTranslate"; -import { ICategory } from "@/types/category.types"; - -export interface MoveDialogProps extends DialogControl { - categories: ICategory[]; - callback?: (newCategoryId?: string) => Promise; - openDialog: (data?: string) => void; -} - -export const MoveDialog: FC = ({ - open, - callback, - closeDialog, - categories, -}: MoveDialogProps) => { - const { t } = useTranslate(); - const [selectedCategoryId, setSelectedCategoryId] = useState(""); - const handleMove = async () => { - if (selectedCategoryId && callback) { - await callback(selectedCategoryId); - closeDialog(); - } - }; - - return ( - - - {t("message.select_category")} - - - - - - - - - - - - - - ); -}; diff --git a/frontend/src/app-components/dialogs/index.ts b/frontend/src/app-components/dialogs/index.ts index b9b7d5ac..711f9ced 100644 --- a/frontend/src/app-components/dialogs/index.ts +++ b/frontend/src/app-components/dialogs/index.ts @@ -8,7 +8,6 @@ export * from "./confirm/ConfirmDialog"; export * from "./confirm/ConfirmDialogBody"; -export * from "./DeleteDialog"; export * from "./DialogTitle"; export * from "./FormDialog"; export * from "./GenericFormDialog"; diff --git a/frontend/src/hooks/useDialog.tsx b/frontend/src/hooks/useDialog.tsx deleted file mode 100644 index 5eb53434..00000000 --- a/frontend/src/hooks/useDialog.tsx +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright © 2024 Hexastack. All rights reserved. - * - * Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms: - * 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission. - * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). - */ - -import { DialogProps } from "@mui/material"; -import { useState } from "react"; - -export type DialogControlProps = Omit< - DialogControl, - "openDialog" ->; -export type DialogControl = DialogProps & { - data?: T; - callback?: (data?: C) => void; - openDialog: (data?: T) => void; - closeDialog: () => void; -}; - -export const useDialog = (initialState: boolean): DialogControl => { - const [open, setOpen] = useState(initialState); - const [data, setData] = useState(undefined); - const openDialog = (data?: T) => { - if (data) setData(data); - setOpen(true); - }; - const closeDialog = (event?: React.MouseEvent | Event, reason?: string) => { - if (reason !== "backdropClick") { - setOpen(false); - } - }; - - return { open, openDialog, closeDialog, data }; -}; - -export const getDisplayDialogs = ({ - open, - closeDialog, - data, -}: DialogControl): DialogControlProps => ({ open, closeDialog, data });