diff --git a/web/src/components/CreateResourceDialog.tsx b/web/src/components/CreateResourceDialog.tsx index e3e92a87..5e540729 100644 --- a/web/src/components/CreateResourceDialog.tsx +++ b/web/src/components/CreateResourceDialog.tsx @@ -1,7 +1,7 @@ import { Autocomplete, Button, IconButton, Input, List, ListItem, Option, Select, Typography } from "@mui/joy"; import React, { useRef, useState } from "react"; import { toast } from "react-hot-toast"; -import { Resource } from "@/types/proto/api/v2/resource_service"; +import { CreateResourceRequest, Resource } from "@/types/proto/api/v2/resource_service"; import { useTranslate } from "@/utils/i18n"; import { useResourceStore } from "../store/module"; import { generateDialog } from "./Dialog"; @@ -29,11 +29,13 @@ const CreateResourceDialog: React.FC = (props: Props) => { selectedMode: "local-file", uploadingFlag: false, }); - const [resourceCreate, setResourceCreate] = useState({ - filename: "", - externalLink: "", - type: "", - }); + const [resourceCreate, setResourceCreate] = useState( + CreateResourceRequest.fromPartial({ + filename: "", + externalLink: "", + type: "", + }), + ); const [fileList, setFileList] = useState([]); const fileInputRef = useRef(null); diff --git a/web/src/components/TagList.tsx b/web/src/components/TagList.tsx index 36ce22ae..7f10c5b1 100644 --- a/web/src/components/TagList.tsx +++ b/web/src/components/TagList.tsx @@ -9,6 +9,10 @@ import { showCommonDialog } from "./Dialog/CommonDialog"; import Icon from "./Icon"; import showRenameTagDialog from "./RenameTagDialog"; +interface KVObject { + [key: string]: T; +} + interface Tag { key: string; text: string; diff --git a/web/src/helpers/storage.ts b/web/src/helpers/storage.ts index 90de6441..7807a06d 100644 --- a/web/src/helpers/storage.ts +++ b/web/src/helpers/storage.ts @@ -6,8 +6,6 @@ interface StorageData { locale: Locale; // appearance appearance: Appearance; - // local setting - localSetting: LocalSetting; } type StorageKey = keyof StorageData; diff --git a/web/src/store/module/filter.ts b/web/src/store/module/filter.ts index e07d3ab0..00f116fc 100644 --- a/web/src/store/module/filter.ts +++ b/web/src/store/module/filter.ts @@ -1,3 +1,4 @@ +import { Visibility } from "@/types/proto/api/v2/memo_service"; import store, { useAppSelector } from ".."; import { setFilter } from "../reducer/filter"; diff --git a/web/src/store/reducer/filter.ts b/web/src/store/reducer/filter.ts index af8c2323..287a1dda 100644 --- a/web/src/store/reducer/filter.ts +++ b/web/src/store/reducer/filter.ts @@ -1,4 +1,5 @@ import { createSlice, PayloadAction } from "@reduxjs/toolkit"; +import { Visibility } from "@/types/proto/api/v2/memo_service"; interface State { tag?: string; diff --git a/web/src/types/common.d.ts b/web/src/types/common.d.ts index f1d2f106..03ae447b 100644 --- a/web/src/types/common.d.ts +++ b/web/src/types/common.d.ts @@ -1,9 +1 @@ -type BasicType = undefined | null | boolean | number | string | Record | Array; - type FunctionType = (...args: unknown[]) => unknown; - -interface KVObject { - [key: string]: T; -} - -type Option = T | undefined; diff --git a/web/src/types/modules/common.d.ts b/web/src/types/modules/common.d.ts deleted file mode 100644 index 1d6373bc..00000000 --- a/web/src/types/modules/common.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -type RowStatus = "NORMAL" | "ARCHIVED"; - -type Visibility = "PUBLIC" | "PROTECTED" | "PRIVATE"; diff --git a/web/src/types/modules/resource.d.ts b/web/src/types/modules/resource.d.ts deleted file mode 100644 index 8b649d7e..00000000 --- a/web/src/types/modules/resource.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -interface ResourceCreate { - filename: string; - externalLink: string; - type: string; -} diff --git a/web/src/types/modules/setting.d.ts b/web/src/types/modules/setting.d.ts index 02542400..784b92c1 100644 --- a/web/src/types/modules/setting.d.ts +++ b/web/src/types/modules/setting.d.ts @@ -1,43 +1 @@ type Appearance = "system" | "light" | "dark"; - -interface BasicSetting { - locale: Locale; - appearance: Appearance; -} -interface Setting { - locale: Locale; - appearance: Appearance; - memoVisibility: Visibility; - telegramUserId: string; -} - -interface LocalSetting { - enableDoubleClickEditing: boolean; -} - -interface UserLocaleSetting { - key: "locale"; - value: Locale; -} - -interface UserAppearanceSetting { - key: "appearance"; - value: Appearance; -} - -interface UserMemoVisibilitySetting { - key: "memo-visibility"; - value: Visibility; -} - -interface UserTelegramUserIdSetting { - key: "telegram-user-id"; - value: string; -} - -type UserSetting = UserLocaleSetting | UserAppearanceSetting | UserMemoVisibilitySetting | UserTelegramUserIdSetting; - -interface UserSettingUpsert { - key: keyof Setting; - value: string; -} diff --git a/web/src/types/modules/user.d.ts b/web/src/types/modules/user.d.ts index 48e855cd..96ec5588 100644 --- a/web/src/types/modules/user.d.ts +++ b/web/src/types/modules/user.d.ts @@ -5,15 +5,10 @@ interface User { createdTs: number; updatedTs: number; - rowStatus: RowStatus; username: string; role: UserRole; email: string; nickname: string; avatarUrl: string; - userSettingList: UserSetting[]; - - setting: Setting; - localSetting: LocalSetting; }