chore: update image displays (#2093)

This commit is contained in:
boojack
2023-08-06 10:42:30 +08:00
committed by GitHub
parent 726300394b
commit 843850675f
4 changed files with 142 additions and 368 deletions

View File

@ -66,6 +66,7 @@ const Memo: React.FC<Props> = (props: Props) => {
);
}, [memo.relationList]);
// Update display time string.
useEffect(() => {
let intervalFlag: any = -1;
if (Date.now() - memo.displayTs < 1000 * 60 * 60 * 24) {
@ -102,6 +103,11 @@ const Memo: React.FC<Props> = (props: Props) => {
}
}, [lazyRendering]);
if (!shouldRender) {
// Render a placeholder to occupy the space.
return <div className={`memo-wrapper min-h-[128px] ${"memos-" + memo.id}`} ref={memoContainerRef}></div>;
}
const handleTogglePinMemoBtnClick = async () => {
try {
if (memo.pinned) {
@ -246,15 +252,6 @@ const Memo: React.FC<Props> = (props: Props) => {
}
};
if (!shouldRender) {
return (
<div
className={`memo-wrapper min-h-[128px] ${"memos-" + memo.id} ${memo.pinned && !readonly ? "pinned" : ""}`}
ref={memoContainerRef}
></div>
);
}
return (
<>
<div className={`memo-wrapper ${"memos-" + memo.id} ${memo.pinned && !readonly ? "pinned" : ""}`} ref={memoContainerRef}>