Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

chore: update enum type

Steven606e574e191b
diff --git a/proto/buf.gen.yaml b/proto/buf.gen.yaml
index 4ef25d4c9..f5c4ca98a 100644
--- a/proto/buf.gen.yaml
+++ b/proto/buf.gen.yaml
@@ -32,6 +32,7 @@ plugins:
- outputJsonMethods=false
- useExactTypes=false
- esModuleInterop=true
+ - stringEnums=true
- plugin: buf.build/community/pseudomuto-doc:v1.5.1
out: gen
opt:
diff --git a/web/src/components/MemoActionMenu.tsx b/web/src/components/MemoActionMenu.tsx
index 673f049c3..ca51cc4d3 100644
--- a/web/src/components/MemoActionMenu.tsx
+++ b/web/src/components/MemoActionMenu.tsx
@@ -87,7 +87,7 @@ const MemoActionMenu = (props: Props) => {
<Dropdown>
<MenuButton slots={{ root: "div" }}>
<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>
</MenuButton>
<Menu className="text-sm" size="sm" placement="bottom-end">
diff --git a/web/src/components/ReactionView.tsx b/web/src/components/ReactionView.tsx
index 41551eb45..143d99dde 100644
--- a/web/src/components/ReactionView.tsx
+++ b/web/src/components/ReactionView.tsx
@@ -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) {
return "";
}
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
- .slice(0, 4)
- .map((user) => user.nickname || user.username)
- .join(", ")} and ${users.length - 4} others`;
+ return (
+ `${users
+ .slice(0, 4)
+ .map((user) => user.nickname || user.username)
+ .join(", ")} and ${users.length - 4} more reacted with ` + reactionType.toLowerCase()
+ );
};
const ReactionView = (props: Props) => {
@@ -93,7 +95,7 @@ const ReactionView = (props: Props) => {
};
return (
- <Tooltip title={stringifyUsers(users)} placement="top">
+ <Tooltip title={stringifyUsers(users, reactionType)} placement="top">
<div
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",
diff --git a/web/src/components/Settings/MemberSection.tsx b/web/src/components/Settings/MemberSection.tsx
index 2bdc2824a..1b69bb2ab 100644
--- a/web/src/components/Settings/MemberSection.tsx
+++ b/web/src/components/Settings/MemberSection.tsx
@@ -64,7 +64,7 @@ const MemberSection = () => {
...state,
creatingUser: {
...state.creatingUser,
- role: Number(event.target.value) as User_Role,
+ role: event.target.value as User_Role,
},
});
};
diff --git a/web/src/pages/Inboxes.tsx b/web/src/pages/Inboxes.tsx
index 63984ada9..3b742d89b 100644
--- a/web/src/pages/Inboxes.tsx
+++ b/web/src/pages/Inboxes.tsx
@@ -5,14 +5,17 @@ import MemoCommentMessage from "@/components/Inbox/MemoCommentMessage";
import VersionUpdateMessage from "@/components/Inbox/VersionUpdateMessage";
import MobileHeader from "@/components/MobileHeader";
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";
const Inboxes = () => {
const t = useTranslate();
const inboxStore = useInboxStore();
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(() => {