mirror of
https://github.com/usememos/memos.git
synced 2025-04-13 00:52:07 +02:00
chore: update type definitions
This commit is contained in:
parent
861a1e4c9b
commit
1d83c68cb5
@ -1,7 +1,7 @@
|
|||||||
import { Autocomplete, Button, IconButton, Input, List, ListItem, Option, Select, Typography } from "@mui/joy";
|
import { Autocomplete, Button, IconButton, Input, List, ListItem, Option, Select, Typography } from "@mui/joy";
|
||||||
import React, { useRef, useState } from "react";
|
import React, { useRef, useState } from "react";
|
||||||
import { toast } from "react-hot-toast";
|
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 { useTranslate } from "@/utils/i18n";
|
||||||
import { useResourceStore } from "../store/module";
|
import { useResourceStore } from "../store/module";
|
||||||
import { generateDialog } from "./Dialog";
|
import { generateDialog } from "./Dialog";
|
||||||
@ -29,11 +29,13 @@ const CreateResourceDialog: React.FC<Props> = (props: Props) => {
|
|||||||
selectedMode: "local-file",
|
selectedMode: "local-file",
|
||||||
uploadingFlag: false,
|
uploadingFlag: false,
|
||||||
});
|
});
|
||||||
const [resourceCreate, setResourceCreate] = useState<ResourceCreate>({
|
const [resourceCreate, setResourceCreate] = useState<CreateResourceRequest>(
|
||||||
|
CreateResourceRequest.fromPartial({
|
||||||
filename: "",
|
filename: "",
|
||||||
externalLink: "",
|
externalLink: "",
|
||||||
type: "",
|
type: "",
|
||||||
});
|
}),
|
||||||
|
);
|
||||||
const [fileList, setFileList] = useState<File[]>([]);
|
const [fileList, setFileList] = useState<File[]>([]);
|
||||||
const fileInputRef = useRef<HTMLInputElement>(null);
|
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||||
|
|
||||||
|
@ -9,6 +9,10 @@ import { showCommonDialog } from "./Dialog/CommonDialog";
|
|||||||
import Icon from "./Icon";
|
import Icon from "./Icon";
|
||||||
import showRenameTagDialog from "./RenameTagDialog";
|
import showRenameTagDialog from "./RenameTagDialog";
|
||||||
|
|
||||||
|
interface KVObject<T = any> {
|
||||||
|
[key: string]: T;
|
||||||
|
}
|
||||||
|
|
||||||
interface Tag {
|
interface Tag {
|
||||||
key: string;
|
key: string;
|
||||||
text: string;
|
text: string;
|
||||||
|
@ -6,8 +6,6 @@ interface StorageData {
|
|||||||
locale: Locale;
|
locale: Locale;
|
||||||
// appearance
|
// appearance
|
||||||
appearance: Appearance;
|
appearance: Appearance;
|
||||||
// local setting
|
|
||||||
localSetting: LocalSetting;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type StorageKey = keyof StorageData;
|
type StorageKey = keyof StorageData;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { Visibility } from "@/types/proto/api/v2/memo_service";
|
||||||
import store, { useAppSelector } from "..";
|
import store, { useAppSelector } from "..";
|
||||||
import { setFilter } from "../reducer/filter";
|
import { setFilter } from "../reducer/filter";
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
||||||
|
import { Visibility } from "@/types/proto/api/v2/memo_service";
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
tag?: string;
|
tag?: string;
|
||||||
|
8
web/src/types/common.d.ts
vendored
8
web/src/types/common.d.ts
vendored
@ -1,9 +1 @@
|
|||||||
type BasicType = undefined | null | boolean | number | string | Record<string, unknown> | Array<BasicType>;
|
|
||||||
|
|
||||||
type FunctionType = (...args: unknown[]) => unknown;
|
type FunctionType = (...args: unknown[]) => unknown;
|
||||||
|
|
||||||
interface KVObject<T = any> {
|
|
||||||
[key: string]: T;
|
|
||||||
}
|
|
||||||
|
|
||||||
type Option<T> = T | undefined;
|
|
||||||
|
3
web/src/types/modules/common.d.ts
vendored
3
web/src/types/modules/common.d.ts
vendored
@ -1,3 +0,0 @@
|
|||||||
type RowStatus = "NORMAL" | "ARCHIVED";
|
|
||||||
|
|
||||||
type Visibility = "PUBLIC" | "PROTECTED" | "PRIVATE";
|
|
5
web/src/types/modules/resource.d.ts
vendored
5
web/src/types/modules/resource.d.ts
vendored
@ -1,5 +0,0 @@
|
|||||||
interface ResourceCreate {
|
|
||||||
filename: string;
|
|
||||||
externalLink: string;
|
|
||||||
type: string;
|
|
||||||
}
|
|
42
web/src/types/modules/setting.d.ts
vendored
42
web/src/types/modules/setting.d.ts
vendored
@ -1,43 +1 @@
|
|||||||
type Appearance = "system" | "light" | "dark";
|
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;
|
|
||||||
}
|
|
||||||
|
5
web/src/types/modules/user.d.ts
vendored
5
web/src/types/modules/user.d.ts
vendored
@ -5,15 +5,10 @@ interface User {
|
|||||||
|
|
||||||
createdTs: number;
|
createdTs: number;
|
||||||
updatedTs: number;
|
updatedTs: number;
|
||||||
rowStatus: RowStatus;
|
|
||||||
|
|
||||||
username: string;
|
username: string;
|
||||||
role: UserRole;
|
role: UserRole;
|
||||||
email: string;
|
email: string;
|
||||||
nickname: string;
|
nickname: string;
|
||||||
avatarUrl: string;
|
avatarUrl: string;
|
||||||
userSettingList: UserSetting[];
|
|
||||||
|
|
||||||
setting: Setting;
|
|
||||||
localSetting: LocalSetting;
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user