diff --git a/web/src/components/CreateTagDialog.tsx b/web/src/components/CreateTagDialog.tsx index 94a070fa..ea2ab685 100644 --- a/web/src/components/CreateTagDialog.tsx +++ b/web/src/components/CreateTagDialog.tsx @@ -22,6 +22,7 @@ const CreateTagDialog: React.FC = (props: Props) => { const tagStore = useTagStore(); const [tagName, setTagName] = useState(""); const [suggestTagNameList, setSuggestTagNameList] = useState([]); + const [showTagSuggestions, setShowTagSuggestions] = useState(false); const tagNameList = tagStore.state.tags; const shownSuggestTagNameList = suggestTagNameList.filter((tag) => !tagNameList.includes(tag)); @@ -42,10 +43,14 @@ const CreateTagDialog: React.FC = (props: Props) => { setTagName(tagName.trim()); }; - const handleUpsertSuggestTag = async (tagName: string) => { + const handleUpsertTag = async (tagName: string) => { await tagStore.upsertTag(tagName); }; + const handleToggleShowSuggestionTags = () => { + setShowTagSuggestions((state) => !state); + }; + const handleSaveBtnClick = async () => { if (!validateTagName(tagName)) { toastHelper.error("Invalid tag name"); @@ -111,24 +116,30 @@ const CreateTagDialog: React.FC = (props: Props) => { {shownSuggestTagNameList.length > 0 && ( <> -

Tag suggestions

-
- {shownSuggestTagNameList.map((tag) => ( - handleUpsertSuggestTag(tag)} - > - #{tag} - - ))} +
+ Tag suggestions +
- + {showTagSuggestions && ( + <> +
+ {shownSuggestTagNameList.map((tag) => ( + handleUpsertTag(tag)} + > + #{tag} + + ))} +
+ + + )} )}
diff --git a/web/src/components/UpdateCustomizedProfileDialog.tsx b/web/src/components/UpdateCustomizedProfileDialog.tsx index 836af271..b2bfd176 100644 --- a/web/src/components/UpdateCustomizedProfileDialog.tsx +++ b/web/src/components/UpdateCustomizedProfileDialog.tsx @@ -1,4 +1,4 @@ -import { useEffect, useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { useGlobalStore } from "../store/module"; import * as api from "../helpers/api"; @@ -15,11 +15,7 @@ const UpdateCustomizedProfileDialog: React.FC = ({ destroy }: Props) => { const globalStore = useGlobalStore(); const [state, setState] = useState(globalStore.state.systemStatus.customizedProfile); - useEffect(() => { - // do nth - }, []); - - const handleCloseBtnClick = () => { + const handleCloseButtonClick = () => { destroy(); }; @@ -68,9 +64,20 @@ const UpdateCustomizedProfileDialog: React.FC = ({ destroy }: Props) => { }); }; - const handleSaveBtnClick = async () => { - if (state.name === "" || state.logoUrl === "") { - toastHelper.error(t("message.fill-all")); + const handleRestoreButtonClick = () => { + setState({ + name: "memos", + logoUrl: "/logo.png", + description: "", + locale: "en", + appearance: "system", + externalUrl: "", + }); + }; + + const handleSaveButtonClick = async () => { + if (state.name === "") { + toastHelper.error("Please fill server name"); return; } @@ -92,7 +99,7 @@ const UpdateCustomizedProfileDialog: React.FC = ({ destroy }: Props) => { <>

{t("setting.system-section.customize-server.title")}

-
@@ -110,13 +117,20 @@ const UpdateCustomizedProfileDialog: React.FC = ({ destroy }: Props) => {

Server appearance

-
- - {t("common.cancel")} - - - {t("common.save")} - +
+
+ +
+
+ + +