diff --git a/web/src/App.tsx b/web/src/App.tsx index 457456bb..4a6e30d9 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -5,7 +5,7 @@ import { useTranslation } from "react-i18next"; import { RouterProvider } from "react-router-dom"; import router from "./router"; import { useGlobalStore } from "./store/module"; -import * as storage from "./helpers/storage"; +import storage from "./helpers/storage"; import { getSystemColorScheme } from "./helpers/utils"; import Loading from "./pages/Loading"; diff --git a/web/src/components/MemoEditor/ActionButton/MemoVisibilitySelector.tsx b/web/src/components/MemoEditor/ActionButton/MemoVisibilitySelector.tsx new file mode 100644 index 00000000..695248d5 --- /dev/null +++ b/web/src/components/MemoEditor/ActionButton/MemoVisibilitySelector.tsx @@ -0,0 +1,45 @@ +import { toLower } from "lodash-es"; +import { useEffect } from "react"; +import { useTranslation } from "react-i18next"; +import { VISIBILITY_SELECTOR_ITEMS } from "@/helpers/consts"; +import { useEditorStore, useGlobalStore } from "@/store/module"; +import Selector from "@/components/kit/Selector"; + +const MemoVisibilitySelector = () => { + const { t } = useTranslation(); + const editorStore = useEditorStore(); + const { + state: { systemStatus }, + } = useGlobalStore(); + const editorState = editorStore.state; + const memoVisibilityOptionSelectorItems = VISIBILITY_SELECTOR_ITEMS.map((item) => { + return { + value: item.value, + text: t(`memo.visibility.${toLower(item.value)}`), + }; + }); + + useEffect(() => { + if (systemStatus.disablePublicMemos) { + editorStore.setMemoVisibility("PRIVATE"); + } + }, [systemStatus.disablePublicMemos]); + + const handleMemoVisibilityOptionChanged = async (value: string) => { + const visibilityValue = value as Visibility; + editorStore.setMemoVisibility(visibilityValue); + }; + + return ( + + ); +}; + +export default MemoVisibilitySelector; diff --git a/web/src/components/MemoEditor/ActionButton/ResourceSelector.tsx b/web/src/components/MemoEditor/ActionButton/ResourceSelector.tsx new file mode 100644 index 00000000..62ea6db5 --- /dev/null +++ b/web/src/components/MemoEditor/ActionButton/ResourceSelector.tsx @@ -0,0 +1,41 @@ +import { useTranslation } from "react-i18next"; +import { useEditorStore } from "@/store/module"; +import Icon from "@/components/Icon"; +import showCreateResourceDialog from "@/components/CreateResourceDialog"; +import showResourcesSelectorDialog from "@/components/ResourcesSelectorDialog"; + +const ResourceSelector = () => { + const { t } = useTranslation(); + const editorStore = useEditorStore(); + + const handleUploadFileBtnClick = () => { + showCreateResourceDialog({ + onConfirm: (resourceList) => { + editorStore.setResourceList([...editorStore.state.resourceList, ...resourceList]); + }, + }); + }; + + return ( +
e.stopPropagation()}> + No tags found +
e.stopPropagation()}> - No tags found -