mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
chore: update enum type
This commit is contained in:
@ -32,6 +32,7 @@ plugins:
|
|||||||
- outputJsonMethods=false
|
- outputJsonMethods=false
|
||||||
- useExactTypes=false
|
- useExactTypes=false
|
||||||
- esModuleInterop=true
|
- esModuleInterop=true
|
||||||
|
- stringEnums=true
|
||||||
- plugin: buf.build/community/pseudomuto-doc:v1.5.1
|
- plugin: buf.build/community/pseudomuto-doc:v1.5.1
|
||||||
out: gen
|
out: gen
|
||||||
opt:
|
opt:
|
||||||
|
@ -87,7 +87,7 @@ const MemoActionMenu = (props: Props) => {
|
|||||||
<Dropdown>
|
<Dropdown>
|
||||||
<MenuButton slots={{ root: "div" }}>
|
<MenuButton slots={{ root: "div" }}>
|
||||||
<span className="h-7 w-7 flex justify-center items-center rounded-full hover:opacity-70">
|
<span className="h-7 w-7 flex justify-center items-center rounded-full hover:opacity-70">
|
||||||
<Icon.MoreHorizontal className="w-4 h-4 mx-auto text-gray-500 dark:text-gray-400" />
|
<Icon.MoreVertical className="w-4 h-4 mx-auto text-gray-500 dark:text-gray-400" />
|
||||||
</span>
|
</span>
|
||||||
</MenuButton>
|
</MenuButton>
|
||||||
<Menu className="text-sm" size="sm" placement="bottom-end">
|
<Menu className="text-sm" size="sm" placement="bottom-end">
|
||||||
|
@ -44,17 +44,19 @@ export const stringifyReactionType = (reactionType: Reaction_Type): string => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const stringifyUsers = (users: User[]): string => {
|
const stringifyUsers = (users: User[], reactionType: Reaction_Type): string => {
|
||||||
if (users.length === 0) {
|
if (users.length === 0) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
if (users.length < 5) {
|
if (users.length < 5) {
|
||||||
return users.map((user) => user.nickname || user.username).join(", ");
|
return users.map((user) => user.nickname || user.username).join(", ") + " reacted with " + reactionType.toLowerCase();
|
||||||
}
|
}
|
||||||
return `${users
|
return (
|
||||||
|
`${users
|
||||||
.slice(0, 4)
|
.slice(0, 4)
|
||||||
.map((user) => user.nickname || user.username)
|
.map((user) => user.nickname || user.username)
|
||||||
.join(", ")} and ${users.length - 4} others`;
|
.join(", ")} and ${users.length - 4} more reacted with ` + reactionType.toLowerCase()
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const ReactionView = (props: Props) => {
|
const ReactionView = (props: Props) => {
|
||||||
@ -93,7 +95,7 @@ const ReactionView = (props: Props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tooltip title={stringifyUsers(users)} placement="top">
|
<Tooltip title={stringifyUsers(users, reactionType)} placement="top">
|
||||||
<div
|
<div
|
||||||
className={classNames(
|
className={classNames(
|
||||||
"h-7 border px-2 py-0.5 rounded-full font-memo flex flex-row justify-center items-center gap-1 dark:border-zinc-700",
|
"h-7 border px-2 py-0.5 rounded-full font-memo flex flex-row justify-center items-center gap-1 dark:border-zinc-700",
|
||||||
|
@ -64,7 +64,7 @@ const MemberSection = () => {
|
|||||||
...state,
|
...state,
|
||||||
creatingUser: {
|
creatingUser: {
|
||||||
...state.creatingUser,
|
...state.creatingUser,
|
||||||
role: Number(event.target.value) as User_Role,
|
role: event.target.value as User_Role,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -5,14 +5,17 @@ import MemoCommentMessage from "@/components/Inbox/MemoCommentMessage";
|
|||||||
import VersionUpdateMessage from "@/components/Inbox/VersionUpdateMessage";
|
import VersionUpdateMessage from "@/components/Inbox/VersionUpdateMessage";
|
||||||
import MobileHeader from "@/components/MobileHeader";
|
import MobileHeader from "@/components/MobileHeader";
|
||||||
import { useInboxStore } from "@/store/v1";
|
import { useInboxStore } from "@/store/v1";
|
||||||
import { Inbox_Type } from "@/types/proto/api/v2/inbox_service";
|
import { Inbox_Status, Inbox_Type } from "@/types/proto/api/v2/inbox_service";
|
||||||
import { useTranslate } from "@/utils/i18n";
|
import { useTranslate } from "@/utils/i18n";
|
||||||
|
|
||||||
const Inboxes = () => {
|
const Inboxes = () => {
|
||||||
const t = useTranslate();
|
const t = useTranslate();
|
||||||
const inboxStore = useInboxStore();
|
const inboxStore = useInboxStore();
|
||||||
const inboxes = inboxStore.inboxes.sort((a, b) => {
|
const inboxes = inboxStore.inboxes.sort((a, b) => {
|
||||||
return a.status - b.status;
|
if (a.status === b.status) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return a.status === Inbox_Status.UNREAD ? -1 : 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
Reference in New Issue
Block a user