mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
chore: tweak memo detail styles
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
import { Divider } from "@mui/joy";
|
import { Divider, IconButton } from "@mui/joy";
|
||||||
import { useGlobalStore } from "@/store/module";
|
import { useGlobalStore } from "@/store/module";
|
||||||
import { useTranslate } from "@/utils/i18n";
|
import { useTranslate } from "@/utils/i18n";
|
||||||
import { generateDialog } from "./Dialog";
|
import { generateDialog } from "./Dialog";
|
||||||
@ -22,9 +22,9 @@ const AboutSiteDialog: React.FC<Props> = ({ destroy }: Props) => {
|
|||||||
<p className="title-text flex items-center">
|
<p className="title-text flex items-center">
|
||||||
{t("common.about")} {customizedProfile.name}
|
{t("common.about")} {customizedProfile.name}
|
||||||
</p>
|
</p>
|
||||||
<button className="btn close-btn" onClick={handleCloseBtnClick}>
|
<IconButton size="sm" onClick={handleCloseBtnClick}>
|
||||||
<Icon.X />
|
<Icon.X className="opacity-70" />
|
||||||
</button>
|
</IconButton>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col justify-start items-start max-w-full w-96">
|
<div className="flex flex-col justify-start items-start max-w-full w-96">
|
||||||
<p className="text-xs">{t("about.memos-description")}</p>
|
<p className="text-xs">{t("about.memos-description")}</p>
|
||||||
|
@ -36,6 +36,7 @@ const VersionUpdateMessage = ({ inbox }: Props) => {
|
|||||||
if (!activity?.payload?.versionUpdate?.version) {
|
if (!activity?.payload?.versionUpdate?.version) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
window.open(`https://github.com/usememos/memos/releases/tag/v${activity?.payload?.versionUpdate?.version}`);
|
window.open(`https://github.com/usememos/memos/releases/tag/v${activity?.payload?.versionUpdate?.version}`);
|
||||||
if (inbox.status === Inbox_Status.UNREAD) {
|
if (inbox.status === Inbox_Status.UNREAD) {
|
||||||
handleArchiveMessage(true);
|
handleArchiveMessage(true);
|
||||||
|
@ -46,7 +46,6 @@ const MemoView: React.FC<Props> = (props: Props) => {
|
|||||||
const user = useCurrentUser();
|
const user = useCurrentUser();
|
||||||
const [displayTime, setDisplayTime] = useState<string>(getRelativeTimeString(getTimeStampByDate(memo.displayTime)));
|
const [displayTime, setDisplayTime] = useState<string>(getRelativeTimeString(getTimeStampByDate(memo.displayTime)));
|
||||||
const [creator, setCreator] = useState(userStore.getUserByUsername(extractUsernameFromName(memo.creator)));
|
const [creator, setCreator] = useState(userStore.getUserByUsername(extractUsernameFromName(memo.creator)));
|
||||||
const [parentMemo, setParentMemo] = useState<Memo | undefined>(undefined);
|
|
||||||
const memoContainerRef = useRef<HTMLDivElement>(null);
|
const memoContainerRef = useRef<HTMLDivElement>(null);
|
||||||
const referenceRelations = memo.relations.filter((relation) => relation.type === MemoRelation_Type.REFERENCE);
|
const referenceRelations = memo.relations.filter((relation) => relation.type === MemoRelation_Type.REFERENCE);
|
||||||
const readonly = memo.creator !== user?.name;
|
const readonly = memo.creator !== user?.name;
|
||||||
@ -56,15 +55,6 @@ const MemoView: React.FC<Props> = (props: Props) => {
|
|||||||
const user = await userStore.getOrFetchUserByUsername(extractUsernameFromName(memo.creator));
|
const user = await userStore.getOrFetchUserByUsername(extractUsernameFromName(memo.creator));
|
||||||
setCreator(user);
|
setCreator(user);
|
||||||
})();
|
})();
|
||||||
|
|
||||||
const parentMemoId = memo.relations.find(
|
|
||||||
(relation) => relation.memoId === memo.id && relation.type === MemoRelation_Type.COMMENT
|
|
||||||
)?.relatedMemoId;
|
|
||||||
if (parentMemoId) {
|
|
||||||
memoStore.getOrFetchMemoById(parentMemoId, { skipStore: true }).then((memo: Memo) => {
|
|
||||||
setParentMemo(memo);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// Update display time string.
|
// Update display time string.
|
||||||
@ -210,16 +200,11 @@ const MemoView: React.FC<Props> = (props: Props) => {
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
</div>
|
||||||
|
<div className="btns-container space-x-2">
|
||||||
<div className="w-auto hidden group-hover:flex flex-row justify-between items-center">
|
<div className="w-auto hidden group-hover:flex flex-row justify-between items-center">
|
||||||
<Icon.Dot className="w-4 h-auto text-gray-400 dark:text-zinc-400" />
|
|
||||||
<Link className="flex flex-row justify-start items-center" to={`/m/${memo.id}`} unstable_viewTransition>
|
|
||||||
<Tooltip title={"Identifier"} placement="top">
|
|
||||||
<span className="text-sm text-gray-500 dark:text-gray-400">#{memo.id}</span>
|
|
||||||
</Tooltip>
|
|
||||||
</Link>
|
|
||||||
{props.showVisibility && memo.visibility !== Visibility.PRIVATE && (
|
{props.showVisibility && memo.visibility !== Visibility.PRIVATE && (
|
||||||
<>
|
<>
|
||||||
<Icon.Dot className="w-4 h-auto text-gray-400 dark:text-zinc-400" />
|
|
||||||
<Tooltip title={t(`memo.visibility.${convertVisibilityToString(memo.visibility)}` as any)} placement="top">
|
<Tooltip title={t(`memo.visibility.${convertVisibilityToString(memo.visibility)}` as any)} placement="top">
|
||||||
<span>
|
<span>
|
||||||
<VisibilityIcon visibility={memo.visibility} />
|
<VisibilityIcon visibility={memo.visibility} />
|
||||||
@ -228,8 +213,6 @@ const MemoView: React.FC<Props> = (props: Props) => {
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div className="btns-container space-x-2">
|
|
||||||
{!readonly && (
|
{!readonly && (
|
||||||
<>
|
<>
|
||||||
<span className="btn more-action-btn">
|
<span className="btn more-action-btn">
|
||||||
@ -237,22 +220,18 @@ const MemoView: React.FC<Props> = (props: Props) => {
|
|||||||
</span>
|
</span>
|
||||||
<div className="more-action-btns-wrapper">
|
<div className="more-action-btns-wrapper">
|
||||||
<div className="more-action-btns-container min-w-[6em]">
|
<div className="more-action-btns-container min-w-[6em]">
|
||||||
{!parentMemo && (
|
|
||||||
<span className="btn" onClick={handleTogglePinMemoBtnClick}>
|
<span className="btn" onClick={handleTogglePinMemoBtnClick}>
|
||||||
{memo.pinned ? <Icon.BookmarkMinus className="w-4 h-auto mr-2" /> : <Icon.BookmarkPlus className="w-4 h-auto mr-2" />}
|
{memo.pinned ? <Icon.BookmarkMinus className="w-4 h-auto mr-2" /> : <Icon.BookmarkPlus className="w-4 h-auto mr-2" />}
|
||||||
{memo.pinned ? t("common.unpin") : t("common.pin")}
|
{memo.pinned ? t("common.unpin") : t("common.pin")}
|
||||||
</span>
|
</span>
|
||||||
)}
|
|
||||||
<span className="btn" onClick={handleEditMemoClick}>
|
<span className="btn" onClick={handleEditMemoClick}>
|
||||||
<Icon.Edit3 className="w-4 h-auto mr-2" />
|
<Icon.Edit3 className="w-4 h-auto mr-2" />
|
||||||
{t("common.edit")}
|
{t("common.edit")}
|
||||||
</span>
|
</span>
|
||||||
{!parentMemo && (
|
|
||||||
<span className="btn" onClick={handleMarkMemoClick}>
|
<span className="btn" onClick={handleMarkMemoClick}>
|
||||||
<Icon.Link className="w-4 h-auto mr-2" />
|
<Icon.Link className="w-4 h-auto mr-2" />
|
||||||
{t("common.mark")}
|
{t("common.mark")}
|
||||||
</span>
|
</span>
|
||||||
)}
|
|
||||||
<span className="btn" onClick={() => showShareMemoDialog(memo)}>
|
<span className="btn" onClick={() => showShareMemoDialog(memo)}>
|
||||||
<Icon.Share className="w-4 h-auto mr-2" />
|
<Icon.Share className="w-4 h-auto mr-2" />
|
||||||
{t("common.share")}
|
{t("common.share")}
|
||||||
@ -272,19 +251,6 @@ const MemoView: React.FC<Props> = (props: Props) => {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{props.showParent && parentMemo && (
|
|
||||||
<div className="w-auto max-w-full mb-1">
|
|
||||||
<Link
|
|
||||||
className="px-2 py-0.5 border rounded-full max-w-xs w-auto text-xs flex flex-row justify-start items-center flex-nowrap text-gray-600 dark:text-gray-400 dark:border-gray-500 hover:shadow hover:opacity-80"
|
|
||||||
to={`/m/${parentMemo.id}`}
|
|
||||||
unstable_viewTransition
|
|
||||||
>
|
|
||||||
<Icon.ArrowUpRightFromCircle className="w-3 h-auto shrink-0 opacity-60" />
|
|
||||||
<span className="mx-1 opacity-60">#{parentMemo.id}</span>
|
|
||||||
<span className="truncate">{parentMemo.content}</span>
|
|
||||||
</Link>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
<MemoContent content={memo.content} nodes={memo.nodes} onMemoContentClick={handleMemoContentClick} />
|
<MemoContent content={memo.content} nodes={memo.nodes} onMemoContentClick={handleMemoContentClick} />
|
||||||
<MemoResourceListView resourceList={memo.resources} />
|
<MemoResourceListView resourceList={memo.resources} />
|
||||||
<MemoRelationListView memo={memo} relationList={referenceRelations} />
|
<MemoRelationListView memo={memo} relationList={referenceRelations} />
|
||||||
|
@ -2,7 +2,6 @@ import * as api from "@/helpers/api";
|
|||||||
import useCurrentUser from "@/hooks/useCurrentUser";
|
import useCurrentUser from "@/hooks/useCurrentUser";
|
||||||
import useNavigateTo from "@/hooks/useNavigateTo";
|
import useNavigateTo from "@/hooks/useNavigateTo";
|
||||||
import { useGlobalStore } from "@/store/module";
|
import { useGlobalStore } from "@/store/module";
|
||||||
import { User_Role } from "@/types/proto/api/v2/user_service";
|
|
||||||
import { useTranslate } from "@/utils/i18n";
|
import { useTranslate } from "@/utils/i18n";
|
||||||
import showAboutSiteDialog from "./AboutSiteDialog";
|
import showAboutSiteDialog from "./AboutSiteDialog";
|
||||||
import Icon from "./Icon";
|
import Icon from "./Icon";
|
||||||
@ -36,12 +35,9 @@ const UserBanner = () => {
|
|||||||
<Dropdown
|
<Dropdown
|
||||||
className="w-auto"
|
className="w-auto"
|
||||||
trigger={
|
trigger={
|
||||||
<div className="px-4 py-2 max-w-full flex flex-row justify-start items-center cursor-pointer rounded-2xl hover:shadow hover:bg-white dark:hover:bg-zinc-700">
|
<div className="px-3 py-2 max-w-full flex flex-row justify-start items-center cursor-pointer rounded-2xl hover:shadow hover:bg-white dark:hover:bg-zinc-700">
|
||||||
<UserAvatar className="shadow shrink-0" avatarUrl={user?.avatarUrl} />
|
<UserAvatar className="shadow shrink-0 mr-2" avatarUrl={user?.avatarUrl} />
|
||||||
<span className="px-1 text-lg font-medium text-slate-800 dark:text-gray-200 shrink truncate">{title}</span>
|
<span className="text-lg font-medium text-slate-800 dark:text-gray-200 shrink truncate">{title}</span>
|
||||||
{user?.role === User_Role.HOST ? (
|
|
||||||
<span className="text-xs px-1 bg-blue-600 dark:bg-blue-800 rounded text-white dark:text-gray-200 shadow">MOD</span>
|
|
||||||
) : null}
|
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
actionsClassName="min-w-[128px] max-w-full"
|
actionsClassName="min-w-[128px] max-w-full"
|
||||||
|
@ -74,6 +74,8 @@ const MemoDetail = () => {
|
|||||||
memoStore.getOrFetchMemoById(parentMemoId).then((memo: Memo) => {
|
memoStore.getOrFetchMemoById(parentMemoId).then((memo: Memo) => {
|
||||||
setParentMemo(memo);
|
setParentMemo(memo);
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
setParentMemo(undefined);
|
||||||
}
|
}
|
||||||
await Promise.all(commentRelations.map((relation) => memoStore.getOrFetchMemoById(relation.memoId)));
|
await Promise.all(commentRelations.map((relation) => memoStore.getOrFetchMemoById(relation.memoId)));
|
||||||
})();
|
})();
|
||||||
@ -114,42 +116,35 @@ const MemoDetail = () => {
|
|||||||
<MobileHeader />
|
<MobileHeader />
|
||||||
<div className="w-full px-4 sm:px-6">
|
<div className="w-full px-4 sm:px-6">
|
||||||
<div className="relative flex-grow w-full min-h-full flex flex-col justify-start items-start border dark:border-zinc-700 bg-white dark:bg-zinc-700 shadow hover:shadow-xl transition-all p-4 pb-3 rounded-lg">
|
<div className="relative flex-grow w-full min-h-full flex flex-col justify-start items-start border dark:border-zinc-700 bg-white dark:bg-zinc-700 shadow hover:shadow-xl transition-all p-4 pb-3 rounded-lg">
|
||||||
|
<div className="mb-3">
|
||||||
|
<Link to={`/u/${encodeURIComponent(extractUsernameFromName(memo.creator))}`} unstable_viewTransition>
|
||||||
|
<span className="w-full flex flex-row justify-start items-center">
|
||||||
|
<UserAvatar className="!w-10 !h-10 mr-2" avatarUrl={creator?.avatarUrl} />
|
||||||
|
<div className="flex flex-col justify-start items-start gap-1">
|
||||||
|
<span className="text-lg leading-none text-gray-600 max-w-[8em] truncate dark:text-gray-400">{creator?.nickname}</span>
|
||||||
|
<span className="text-sm leading-none text-gray-400 select-none">{getDateTimeString(memo.displayTime)}</span>
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
{parentMemo && (
|
{parentMemo && (
|
||||||
<div className="w-auto mb-2">
|
<div className="w-auto mb-2">
|
||||||
<Link
|
<Link
|
||||||
className="px-3 py-1 border rounded-full max-w-xs w-auto text-sm flex flex-row justify-start items-center flex-nowrap text-gray-600 dark:text-gray-400 dark:border-gray-500 hover:shadow hover:opacity-80"
|
className="px-3 py-1 border rounded-lg max-w-xs w-auto text-sm flex flex-row justify-start items-center flex-nowrap text-gray-600 dark:text-gray-400 dark:border-gray-500 hover:shadow hover:opacity-80"
|
||||||
to={`/m/${parentMemo.id}`}
|
to={`/m/${parentMemo.id}`}
|
||||||
unstable_viewTransition
|
unstable_viewTransition
|
||||||
>
|
>
|
||||||
<Icon.ArrowUpLeftFromCircle className="w-4 h-auto shrink-0 opacity-60" />
|
<Icon.ArrowUpLeftFromCircle className="w-4 h-auto shrink-0 opacity-60 mr-2" />
|
||||||
<span className="mx-1 opacity-60">#{parentMemo.id}</span>
|
|
||||||
<span className="truncate">{parentMemo.content}</span>
|
<span className="truncate">{parentMemo.content}</span>
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className="w-full mb-2 flex flex-row justify-start items-center">
|
|
||||||
<span className="text-gray-400 select-none">{getDateTimeString(memo.displayTime)}</span>
|
|
||||||
</div>
|
|
||||||
<MemoContent content={memo.content} />
|
<MemoContent content={memo.content} />
|
||||||
<MemoResourceListView resourceList={memo.resources} />
|
<MemoResourceListView resourceList={memo.resources} />
|
||||||
<MemoRelationListView memo={memo} relationList={referenceRelations} />
|
<MemoRelationListView memo={memo} relationList={referenceRelations} />
|
||||||
<div className="w-full mt-4 flex flex-col sm:flex-row justify-start sm:justify-between sm:items-center gap-2">
|
<div className="w-full mt-3 flex flex-row justify-between items-center gap-2">
|
||||||
<div className="flex flex-row justify-start items-center">
|
<div className="flex flex-row justify-start items-center">
|
||||||
<Tooltip title={"Identifier"} placement="top">
|
|
||||||
<span className="text-sm text-gray-500 dark:text-gray-400">#{memo.id}</span>
|
|
||||||
</Tooltip>
|
|
||||||
<Icon.Dot className="w-4 h-auto text-gray-400 dark:text-zinc-400" />
|
|
||||||
<Link to={`/u/${encodeURIComponent(memo.creator)}`} unstable_viewTransition>
|
|
||||||
<Tooltip title={"Creator"} placement="top">
|
|
||||||
<span className="flex flex-row justify-start items-center">
|
|
||||||
<UserAvatar className="!w-5 !h-5 mr-1" avatarUrl={creator?.avatarUrl} />
|
|
||||||
<span className="text-sm text-gray-600 max-w-[8em] truncate dark:text-gray-400">{creator?.nickname}</span>
|
|
||||||
</span>
|
|
||||||
</Tooltip>
|
|
||||||
</Link>
|
|
||||||
{allowEdit && (
|
{allowEdit && (
|
||||||
<>
|
|
||||||
<Icon.Dot className="w-4 h-auto text-gray-400 dark:text-zinc-400" />
|
|
||||||
<Select
|
<Select
|
||||||
className="w-auto text-sm"
|
className="w-auto text-sm"
|
||||||
variant="plain"
|
variant="plain"
|
||||||
@ -167,7 +162,6 @@ const MemoDetail = () => {
|
|||||||
</Option>
|
</Option>
|
||||||
))}
|
))}
|
||||||
</Select>
|
</Select>
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-row sm:justify-end items-center">
|
<div className="flex flex-row sm:justify-end items-center">
|
||||||
|
@ -77,7 +77,6 @@ const Resources = () => {
|
|||||||
<div>
|
<div>
|
||||||
<Input
|
<Input
|
||||||
className="max-w-[8rem]"
|
className="max-w-[8rem]"
|
||||||
variant="plain"
|
|
||||||
placeholder={t("common.search")}
|
placeholder={t("common.search")}
|
||||||
startDecorator={<Icon.Search className="w-4 h-auto" />}
|
startDecorator={<Icon.Search className="w-4 h-auto" />}
|
||||||
value={state.searchQuery}
|
value={state.searchQuery}
|
||||||
|
Reference in New Issue
Block a user