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 inbox props

Stevenf1ec5775a727
diff --git a/web/src/components/DisablePasswordLoginDialog.tsx b/web/src/components/DisablePasswordLoginDialog.tsx
index 511f86bef..85827eb83 100644
--- a/web/src/components/DisablePasswordLoginDialog.tsx
+++ b/web/src/components/DisablePasswordLoginDialog.tsx
@@ -57,20 +57,20 @@ const DisablePasswordLoginDialog: React.FC<Props> = ({ destroy }: Props) => {
return (
<>
- <div className="dialog-header-container !w-64">
+ <div className="dialog-header-container">
<p className="title-text">{t("setting.system-section.disable-password-login")}</p>
<IconButton size="sm" onClick={handleCloseBtnClick}>
<Icon.X className="w-5 h-auto" />
</IconButton>
</div>
- <div className="dialog-content-container !w-64">
+ <div className="dialog-content-container !w-72">
{confirmedOnce ? (
<>
- <p className="content-text">{t("setting.system-section.disable-password-login-final-warning")}</p>
- <Input value={typingConfirmation} onChange={handleTypingConfirmationChanged} />
+ <p className="">{t("setting.system-section.disable-password-login-final-warning")}</p>
+ <Input className="w-full mt-2" value={typingConfirmation} onChange={handleTypingConfirmationChanged} />
</>
) : (
- <p className="content-text">{t("setting.system-section.disable-password-login-warning")}</p>
+ <p className="">{t("setting.system-section.disable-password-login-warning")}</p>
)}
<div className="mt-4 w-full flex flex-row justify-end items-center space-x-2">
<Button variant="plain" color="neutral" onClick={handleCloseBtnClick}>
diff --git a/web/src/components/Inbox/MemoCommentMessage.tsx b/web/src/components/Inbox/MemoCommentMessage.tsx
index b5e86cac9..e6cfbf13a 100644
--- a/web/src/components/Inbox/MemoCommentMessage.tsx
+++ b/web/src/components/Inbox/MemoCommentMessage.tsx
@@ -5,8 +5,8 @@ import toast from "react-hot-toast";
import { activityServiceClient } from "@/grpcweb";
import useNavigateTo from "@/hooks/useNavigateTo";
import { useInboxStore, extractUsernameFromName, useMemoStore } from "@/store/v1";
-import { Activity } from "@/types/proto/api/v2/activity_service";
import { Inbox, Inbox_Status } from "@/types/proto/api/v2/inbox_service";
+import { Memo } from "@/types/proto/api/v2/memo_service";
import { useTranslate } from "@/utils/i18n";
import Icon from "../Icon";
@@ -19,35 +19,35 @@ const MemoCommentMessage = ({ inbox }: Props) => {
const navigateTo = useNavigateTo();
const inboxStore = useInboxStore();
const memoStore = useMemoStore();
- const [activity, setActivity] = useState<Activity | undefined>(undefined);
+ const [relatedMemo, setRelatedMemo] = useState<Memo | undefined>(undefined);
useEffect(() => {
if (!inbox.activityId) {
return;
}
- activityServiceClient
- .getActivity({
+ (async () => {
+ const { activity } = await activityServiceClient.getActivity({
id: inbox.activityId,
- })
- .then(({ activity }) => {
- setActivity(activity);
});
+ if (!activity) {
+ return;
+ }
+ if (activity.payload?.memoComment?.relatedMemoId) {
+ const memo = await memoStore.getOrFetchMemoById(activity.payload?.memoComment?.relatedMemoId, {
+ skipStore: true,
+ });
+ setRelatedMemo(memo);
+ }
+ })();
}, [inbox.activityId]);
const handleNavigateToMemo = async () => {
- const relatedMemoId = activity?.payload?.memoComment?.relatedMemoId;
- if (!relatedMemoId) {
+ if (!relatedMemo) {
return;
}
- const memo = await memoStore.getOrFetchMemoById(relatedMemoId);
- if (!memo) {
- toast.error("Memo not found");
- return;
- }
-
- navigateTo(`/m/${memo.name}`);
+ navigateTo(`/m/${relatedMemo.name}`);
if (inbox.status === Inbox_Status.UNREAD) {
handleArchiveMessage(true);
}
@@ -105,7 +105,7 @@ const MemoCommentMessage = ({ inbox }: Props) => {
>
{t("inbox.memo-comment", {
user: extractUsernameFromName(inbox.sender),
- memo: `memo#${activity?.payload?.memoComment?.relatedMemoId}`,
+ memo: `memos#${relatedMemo?.name}`,
})}
</p>
</div>
diff --git a/web/src/components/Inbox/VersionUpdateMessage.tsx b/web/src/components/Inbox/VersionUpdateMessage.tsx
index 0cd5a611c..f0f3d3cd7 100644
--- a/web/src/components/Inbox/VersionUpdateMessage.tsx
+++ b/web/src/components/Inbox/VersionUpdateMessage.tsx
@@ -23,13 +23,16 @@ const VersionUpdateMessage = ({ inbox }: Props) => {
return;
}
- activityServiceClient
- .getActivity({
+ (async () => {
+ const { activity } = await activityServiceClient.getActivity({
id: inbox.activityId,
- })
- .then(({ activity }) => {
- setActivity(activity);
});
+ if (!activity) {
+ return;
+ }
+
+ setActivity(activity);
+ })();
}, [inbox.activityId]);
const handleNavigate = () => {
diff --git a/web/src/pages/Home.tsx b/web/src/pages/Home.tsx
index 71ba6b694..4a7704018 100644
--- a/web/src/pages/Home.tsx
+++ b/web/src/pages/Home.tsx
@@ -70,7 +70,7 @@ const Home = () => {
<div className={classNames("w-full flex flex-row justify-start items-start px-4 sm:px-6 gap-4")}>
<div className={classNames(md ? "w-[calc(100%-15rem)]" : "w-full")}>
<MemoEditor className="mb-2" cacheKey="home-memo-editor" />
- <div className="flex flex-col justify-start items-start w-full max-w-full pb-28">
+ <div className="flex flex-col justify-start items-start w-full max-w-full">
<MemoFilter className="px-2 pb-2" />
{sortedMemos.map((memo) => (
<MemoView key={`${memo.id}-${memo.updateTime}`} memo={memo} showVisibility showPinned />