mirror of
https://github.com/usememos/memos.git
synced 2025-02-21 05:40:57 +01:00
chore: update inbox props
This commit is contained in:
parent
4aa4417d91
commit
f1ec5775a7
@ -57,20 +57,20 @@ const DisablePasswordLoginDialog: React.FC<Props> = ({ destroy }: Props) => {
|
|||||||
|
|
||||||
return (
|
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>
|
<p className="title-text">{t("setting.system-section.disable-password-login")}</p>
|
||||||
<IconButton size="sm" onClick={handleCloseBtnClick}>
|
<IconButton size="sm" onClick={handleCloseBtnClick}>
|
||||||
<Icon.X className="w-5 h-auto" />
|
<Icon.X className="w-5 h-auto" />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</div>
|
</div>
|
||||||
<div className="dialog-content-container !w-64">
|
<div className="dialog-content-container !w-72">
|
||||||
{confirmedOnce ? (
|
{confirmedOnce ? (
|
||||||
<>
|
<>
|
||||||
<p className="content-text">{t("setting.system-section.disable-password-login-final-warning")}</p>
|
<p className="">{t("setting.system-section.disable-password-login-final-warning")}</p>
|
||||||
<Input value={typingConfirmation} onChange={handleTypingConfirmationChanged} />
|
<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">
|
<div className="mt-4 w-full flex flex-row justify-end items-center space-x-2">
|
||||||
<Button variant="plain" color="neutral" onClick={handleCloseBtnClick}>
|
<Button variant="plain" color="neutral" onClick={handleCloseBtnClick}>
|
||||||
|
@ -5,8 +5,8 @@ import toast from "react-hot-toast";
|
|||||||
import { activityServiceClient } from "@/grpcweb";
|
import { activityServiceClient } from "@/grpcweb";
|
||||||
import useNavigateTo from "@/hooks/useNavigateTo";
|
import useNavigateTo from "@/hooks/useNavigateTo";
|
||||||
import { useInboxStore, extractUsernameFromName, useMemoStore } from "@/store/v1";
|
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 { 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 { useTranslate } from "@/utils/i18n";
|
||||||
import Icon from "../Icon";
|
import Icon from "../Icon";
|
||||||
|
|
||||||
@ -19,35 +19,35 @@ const MemoCommentMessage = ({ inbox }: Props) => {
|
|||||||
const navigateTo = useNavigateTo();
|
const navigateTo = useNavigateTo();
|
||||||
const inboxStore = useInboxStore();
|
const inboxStore = useInboxStore();
|
||||||
const memoStore = useMemoStore();
|
const memoStore = useMemoStore();
|
||||||
const [activity, setActivity] = useState<Activity | undefined>(undefined);
|
const [relatedMemo, setRelatedMemo] = useState<Memo | undefined>(undefined);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!inbox.activityId) {
|
if (!inbox.activityId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
activityServiceClient
|
(async () => {
|
||||||
.getActivity({
|
const { activity } = await activityServiceClient.getActivity({
|
||||||
id: inbox.activityId,
|
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]);
|
}, [inbox.activityId]);
|
||||||
|
|
||||||
const handleNavigateToMemo = async () => {
|
const handleNavigateToMemo = async () => {
|
||||||
const relatedMemoId = activity?.payload?.memoComment?.relatedMemoId;
|
if (!relatedMemo) {
|
||||||
if (!relatedMemoId) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const memo = await memoStore.getOrFetchMemoById(relatedMemoId);
|
navigateTo(`/m/${relatedMemo.name}`);
|
||||||
if (!memo) {
|
|
||||||
toast.error("Memo not found");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
navigateTo(`/m/${memo.name}`);
|
|
||||||
if (inbox.status === Inbox_Status.UNREAD) {
|
if (inbox.status === Inbox_Status.UNREAD) {
|
||||||
handleArchiveMessage(true);
|
handleArchiveMessage(true);
|
||||||
}
|
}
|
||||||
@ -105,7 +105,7 @@ const MemoCommentMessage = ({ inbox }: Props) => {
|
|||||||
>
|
>
|
||||||
{t("inbox.memo-comment", {
|
{t("inbox.memo-comment", {
|
||||||
user: extractUsernameFromName(inbox.sender),
|
user: extractUsernameFromName(inbox.sender),
|
||||||
memo: `memo#${activity?.payload?.memoComment?.relatedMemoId}`,
|
memo: `memos#${relatedMemo?.name}`,
|
||||||
})}
|
})}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -23,13 +23,16 @@ const VersionUpdateMessage = ({ inbox }: Props) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
activityServiceClient
|
(async () => {
|
||||||
.getActivity({
|
const { activity } = await activityServiceClient.getActivity({
|
||||||
id: inbox.activityId,
|
id: inbox.activityId,
|
||||||
})
|
|
||||||
.then(({ activity }) => {
|
|
||||||
setActivity(activity);
|
|
||||||
});
|
});
|
||||||
|
if (!activity) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setActivity(activity);
|
||||||
|
})();
|
||||||
}, [inbox.activityId]);
|
}, [inbox.activityId]);
|
||||||
|
|
||||||
const handleNavigate = () => {
|
const handleNavigate = () => {
|
||||||
|
@ -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("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")}>
|
<div className={classNames(md ? "w-[calc(100%-15rem)]" : "w-full")}>
|
||||||
<MemoEditor className="mb-2" cacheKey="home-memo-editor" />
|
<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" />
|
<MemoFilter className="px-2 pb-2" />
|
||||||
{sortedMemos.map((memo) => (
|
{sortedMemos.map((memo) => (
|
||||||
<MemoView key={`${memo.id}-${memo.updateTime}`} memo={memo} showVisibility showPinned />
|
<MemoView key={`${memo.id}-${memo.updateTime}`} memo={memo} showVisibility showPinned />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user