diff --git a/web/src/components/CreateShortcutDialog.tsx b/web/src/components/CreateShortcutDialog.tsx index bbbc156..8099a25 100644 --- a/web/src/components/CreateShortcutDialog.tsx +++ b/web/src/components/CreateShortcutDialog.tsx @@ -1,4 +1,4 @@ -import { Button, Input, Modal, ModalDialog, Radio, RadioGroup } from "@mui/joy"; +import { Button, Divider, Input, Modal, ModalDialog, Radio, RadioGroup } from "@mui/joy"; import { isUndefined } from "lodash-es"; import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; @@ -31,24 +31,28 @@ const CreateShortcutDialog: React.FC = (props: Props) => { tags: [], }, }); + const [showDescriptionAndTag, setShowDescriptionAndTag] = useState(false); const [tag, setTag] = useState(""); const requestState = useLoading(false); const isCreating = isUndefined(shortcutId); useEffect(() => { if (shortcutId) { - const shortcutTemp = shortcutService.getShortcutById(shortcutId); - if (shortcutTemp) { + const shortcut = shortcutService.getShortcutById(shortcutId); + if (shortcut) { setState({ ...state, shortcutCreate: Object.assign(state.shortcutCreate, { - name: shortcutTemp.name, - link: shortcutTemp.link, - description: shortcutTemp.description, - visibility: shortcutTemp.visibility, + name: shortcut.name, + link: shortcut.link, + description: shortcut.description, + visibility: shortcut.visibility, }), }); - setTag(shortcutTemp.tags.join(" ")); + setTag(shortcut.tags.join(" ")); + if (shortcut.description !== "" || shortcut.tags.length > 0) { + setShowDescriptionAndTag(true); + } } } }, [shortcutId]); @@ -157,30 +161,16 @@ const CreateShortcutDialog: React.FC = (props: Props) => {
- Link * + Destination URL *
-
- Description - -
-
- Tags - -
Visibility * @@ -196,6 +186,35 @@ const CreateShortcutDialog: React.FC = (props: Props) => { {t(`shortcut.visibility.${state.shortcutCreate.visibility.toLowerCase()}.description`)}

+ Optional +
setShowDescriptionAndTag(!showDescriptionAndTag)} + > + Description and tags + +
+ {showDescriptionAndTag && ( + <> +
+ Description + +
+
+ Tags + +
+ + )} +