mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
chore: remove component v1 suffix
This commit is contained in:
@ -11,7 +11,7 @@ interface Props {
|
||||
onMemoContentClick?: (e: React.MouseEvent) => void;
|
||||
}
|
||||
|
||||
const MemoContentV1: React.FC<Props> = (props: Props) => {
|
||||
const MemoContent: React.FC<Props> = (props: Props) => {
|
||||
const { className, content, onMemoContentClick } = props;
|
||||
const [nodes, setNodes] = useState<Node[]>(props.nodes ?? []);
|
||||
const memoContentContainerRef = useRef<HTMLDivElement>(null);
|
||||
@ -51,4 +51,4 @@ const MemoContentV1: React.FC<Props> = (props: Props) => {
|
||||
);
|
||||
};
|
||||
|
||||
export default MemoContentV1;
|
||||
export default MemoContent;
|
@ -17,7 +17,7 @@ import { convertVisibilityFromString, convertVisibilityToString } from "@/utils/
|
||||
import showCreateMemoRelationDialog from "../CreateMemoRelationDialog";
|
||||
import showCreateResourceDialog from "../CreateResourceDialog";
|
||||
import Icon from "../Icon";
|
||||
import VisibilityIconV1 from "../VisibilityIconV1";
|
||||
import VisibilityIcon from "../VisibilityIcon";
|
||||
import TagSelector from "./ActionButton/TagSelector";
|
||||
import Editor, { EditorRefActions } from "./Editor";
|
||||
import RelationListView from "./RelationListView";
|
||||
@ -427,7 +427,7 @@ const MemoEditor = (props: Props) => {
|
||||
<Select
|
||||
variant="plain"
|
||||
value={state.memoVisibility}
|
||||
startDecorator={<VisibilityIconV1 visibility={state.memoVisibility} />}
|
||||
startDecorator={<VisibilityIcon visibility={state.memoVisibility} />}
|
||||
onChange={(_, visibility) => {
|
||||
if (visibility) {
|
||||
handleMemoVisibilityChange(visibility);
|
@ -11,7 +11,7 @@ interface Props {
|
||||
relationList: MemoRelation[];
|
||||
}
|
||||
|
||||
const MemoRelationListViewV1 = (props: Props) => {
|
||||
const MemoRelationListView = (props: Props) => {
|
||||
const { memo, relationList } = props;
|
||||
const memoStore = useMemoV1Store();
|
||||
const [referencingMemoList, setReferencingMemoList] = useState<Memo[]>([]);
|
||||
@ -80,4 +80,4 @@ const MemoRelationListViewV1 = (props: Props) => {
|
||||
);
|
||||
};
|
||||
|
||||
export default MemoRelationListViewV1;
|
||||
export default MemoRelationListView;
|
@ -18,14 +18,14 @@ import { convertVisibilityToString } from "@/utils/memo";
|
||||
import showChangeMemoCreatedTsDialog from "./ChangeMemoCreatedTsDialog";
|
||||
import { showCommonDialog } from "./Dialog/CommonDialog";
|
||||
import Icon from "./Icon";
|
||||
import MemoContentV1 from "./MemoContentV1";
|
||||
import showMemoEditorDialog from "./MemoEditorV1/MemoEditorDialog";
|
||||
import MemoRelationListViewV1 from "./MemoRelationListViewV1";
|
||||
import MemoContent from "./MemoContent";
|
||||
import showMemoEditorDialog from "./MemoEditor/MemoEditorDialog";
|
||||
import MemoRelationListView from "./MemoRelationListView";
|
||||
import MemoResourceListView from "./MemoResourceListView";
|
||||
import showPreviewImageDialog from "./PreviewImageDialog";
|
||||
import showShareMemoDialogV1 from "./ShareMemoDialogV1";
|
||||
import showShareMemoDialog from "./ShareMemoDialog";
|
||||
import UserAvatar from "./UserAvatar";
|
||||
import VisibilityIconV1 from "./VisibilityIconV1";
|
||||
import VisibilityIcon from "./VisibilityIcon";
|
||||
import "@/less/memo.less";
|
||||
|
||||
interface Props {
|
||||
@ -37,7 +37,7 @@ interface Props {
|
||||
lazyRendering?: boolean;
|
||||
}
|
||||
|
||||
const MemoViewV1: React.FC<Props> = (props: Props) => {
|
||||
const MemoView: React.FC<Props> = (props: Props) => {
|
||||
const { memo, lazyRendering } = props;
|
||||
const t = useTranslate();
|
||||
const navigateTo = useNavigateTo();
|
||||
@ -263,7 +263,7 @@ const MemoViewV1: React.FC<Props> = (props: Props) => {
|
||||
<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">
|
||||
<span>
|
||||
<VisibilityIconV1 visibility={memo.visibility} />
|
||||
<VisibilityIcon visibility={memo.visibility} />
|
||||
</span>
|
||||
</Tooltip>
|
||||
</>
|
||||
@ -294,7 +294,7 @@ const MemoViewV1: React.FC<Props> = (props: Props) => {
|
||||
{t("common.mark")}
|
||||
</span>
|
||||
)}
|
||||
<span className="btn" onClick={() => showShareMemoDialogV1(memo)}>
|
||||
<span className="btn" onClick={() => showShareMemoDialog(memo)}>
|
||||
<Icon.Share className="w-4 h-auto mr-2" />
|
||||
{t("common.share")}
|
||||
</span>
|
||||
@ -325,11 +325,11 @@ const MemoViewV1: React.FC<Props> = (props: Props) => {
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
<MemoContentV1 content={memo.content} nodes={memo.nodes} onMemoContentClick={handleMemoContentClick} />
|
||||
<MemoContent content={memo.content} nodes={memo.nodes} onMemoContentClick={handleMemoContentClick} />
|
||||
<MemoResourceListView resourceList={resources} />
|
||||
<MemoRelationListViewV1 memo={memo} relationList={referenceRelations} />
|
||||
<MemoRelationListView memo={memo} relationList={referenceRelations} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default memo(MemoViewV1);
|
||||
export default memo(MemoView);
|
@ -2,11 +2,12 @@ import { Button, Divider, Input, Option, Select } from "@mui/joy";
|
||||
import { useState } from "react";
|
||||
import { toast } from "react-hot-toast";
|
||||
import { Link } from "react-router-dom";
|
||||
import { VISIBILITY_SELECTOR_ITEMS } from "@/helpers/consts";
|
||||
import { useGlobalStore } from "@/store/module";
|
||||
import { useUserV1Store } from "@/store/v1";
|
||||
import { Visibility } from "@/types/proto/api/v2/memo_service";
|
||||
import { UserSetting } from "@/types/proto/api/v2/user_service";
|
||||
import { useTranslate } from "@/utils/i18n";
|
||||
import { convertVisibilityFromString, convertVisibilityToString } from "@/utils/memo";
|
||||
import AppearanceSelect from "../AppearanceSelect";
|
||||
import Icon from "../Icon";
|
||||
import LocaleSelect from "../LocaleSelect";
|
||||
@ -87,18 +88,20 @@ const PreferencesSection = () => {
|
||||
<Select
|
||||
className="!min-w-fit"
|
||||
value={setting.memoVisibility}
|
||||
startDecorator={<VisibilityIcon visibility={setting.memoVisibility as Visibility} />}
|
||||
startDecorator={<VisibilityIcon visibility={convertVisibilityFromString(setting.memoVisibility)} />}
|
||||
onChange={(_, visibility) => {
|
||||
if (visibility) {
|
||||
handleDefaultMemoVisibilityChanged(visibility);
|
||||
}
|
||||
}}
|
||||
>
|
||||
{VISIBILITY_SELECTOR_ITEMS.map((item) => (
|
||||
<Option key={item} value={item} className="whitespace-nowrap">
|
||||
{t(`memo.visibility.${item.toLowerCase() as Lowercase<typeof item>}`)}
|
||||
</Option>
|
||||
))}
|
||||
{[Visibility.PRIVATE, Visibility.PROTECTED, Visibility.PUBLIC]
|
||||
.map((v) => convertVisibilityToString(v))
|
||||
.map((item) => (
|
||||
<Option key={item} value={item} className="whitespace-nowrap">
|
||||
{t(`memo.visibility.${item.toLowerCase() as Lowercase<typeof item>}`)}
|
||||
</Option>
|
||||
))}
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
|
@ -11,7 +11,7 @@ import { Resource } from "@/types/proto/api/v2/resource_service";
|
||||
import { useTranslate } from "@/utils/i18n";
|
||||
import { generateDialog } from "./Dialog";
|
||||
import Icon from "./Icon";
|
||||
import MemoContentV1 from "./MemoContentV1";
|
||||
import MemoContent from "./MemoContent";
|
||||
import MemoResourceListView from "./MemoResourceListView";
|
||||
import UserAvatar from "./UserAvatar";
|
||||
import "@/less/share-memo-dialog.less";
|
||||
@ -20,7 +20,7 @@ interface Props extends DialogProps {
|
||||
memo: Memo;
|
||||
}
|
||||
|
||||
const ShareMemoDialogV1: React.FC<Props> = (props: Props) => {
|
||||
const ShareMemoDialog: React.FC<Props> = (props: Props) => {
|
||||
const { memo, destroy } = props;
|
||||
const t = useTranslate();
|
||||
const userV1Store = useUserV1Store();
|
||||
@ -104,7 +104,7 @@ const ShareMemoDialogV1: React.FC<Props> = (props: Props) => {
|
||||
>
|
||||
<span className="w-full px-6 pt-5 pb-2 text-sm text-gray-500">{getTimeString(memo.displayTime)}</span>
|
||||
<div className="w-full px-6 text-base pb-4">
|
||||
<MemoContentV1 content={memo.content} />
|
||||
<MemoContent content={memo.content} />
|
||||
<MemoResourceListView resourceList={resources} />
|
||||
</div>
|
||||
<div className="flex flex-row justify-between items-center w-full bg-gray-100 dark:bg-zinc-700 py-4 px-6">
|
||||
@ -125,13 +125,13 @@ const ShareMemoDialogV1: React.FC<Props> = (props: Props) => {
|
||||
);
|
||||
};
|
||||
|
||||
export default function showShareMemoDialogV1(memo: Memo): void {
|
||||
export default function showShareMemoDialog(memo: Memo): void {
|
||||
generateDialog(
|
||||
{
|
||||
className: "share-memo-dialog-v1",
|
||||
dialogName: "share-memo-dialog-v1",
|
||||
className: "share-memo-dialog",
|
||||
dialogName: "share-memo-dialog",
|
||||
},
|
||||
ShareMemoDialogV1,
|
||||
ShareMemoDialog,
|
||||
{ memo }
|
||||
);
|
||||
}
|
@ -1,13 +1,13 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import Icon from "@/components/Icon";
|
||||
import MemoContentV1 from "@/components/MemoContentV1";
|
||||
import MemoContent from "@/components/MemoContent";
|
||||
import MemoResourceListView from "@/components/MemoResourceListView";
|
||||
import { getTimeString } from "@/helpers/datetime";
|
||||
import { useMemoV1Store } from "@/store/v1";
|
||||
import { MemoRelation, MemoRelation_Type } from "@/types/proto/api/v2/memo_relation_service";
|
||||
import { Memo } from "@/types/proto/api/v2/memo_service";
|
||||
import { Resource } from "@/types/proto/api/v2/resource_service";
|
||||
import MemoRelationListViewV1 from "./MemoRelationListViewV1";
|
||||
import MemoRelationListView from "./MemoRelationListView";
|
||||
|
||||
interface Props {
|
||||
memo: Memo;
|
||||
@ -35,9 +35,9 @@ const TimelineMemo = (props: Props) => {
|
||||
<Icon.Dot className="w-5 h-auto opacity-60" />
|
||||
<span className="opacity-60">#{memo.id}</span>
|
||||
</div>
|
||||
<MemoContentV1 content={memo.content} nodes={memo.nodes} />
|
||||
<MemoContent content={memo.content} nodes={memo.nodes} />
|
||||
<MemoResourceListView resourceList={resources} />
|
||||
<MemoRelationListViewV1 memo={memo} relationList={relations} />
|
||||
<MemoRelationListView memo={memo} relationList={relations} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
@ -1,4 +1,5 @@
|
||||
import classNames from "classnames";
|
||||
import { Visibility } from "@/types/proto/api/v2/memo_service";
|
||||
import Icon from "./Icon";
|
||||
|
||||
interface Props {
|
||||
@ -9,11 +10,11 @@ const VisibilityIcon = (props: Props) => {
|
||||
const { visibility } = props;
|
||||
|
||||
let VIcon = null;
|
||||
if (visibility === "PRIVATE") {
|
||||
if (visibility === Visibility.PRIVATE) {
|
||||
VIcon = Icon.Lock;
|
||||
} else if (visibility === "PROTECTED") {
|
||||
} else if (visibility === Visibility.PROTECTED) {
|
||||
VIcon = Icon.Users;
|
||||
} else if (visibility === "PUBLIC") {
|
||||
} else if (visibility === Visibility.PUBLIC) {
|
||||
VIcon = Icon.Globe2;
|
||||
}
|
||||
if (!VIcon) {
|
||||
|
@ -1,27 +0,0 @@
|
||||
import classNames from "classnames";
|
||||
import { Visibility } from "@/types/proto/api/v2/memo_service";
|
||||
import Icon from "./Icon";
|
||||
|
||||
interface Props {
|
||||
visibility: Visibility;
|
||||
}
|
||||
|
||||
const VisibilityIcon = (props: Props) => {
|
||||
const { visibility } = props;
|
||||
|
||||
let VIcon = null;
|
||||
if (visibility === Visibility.PRIVATE) {
|
||||
VIcon = Icon.Lock;
|
||||
} else if (visibility === Visibility.PROTECTED) {
|
||||
VIcon = Icon.Users;
|
||||
} else if (visibility === Visibility.PUBLIC) {
|
||||
VIcon = Icon.Globe2;
|
||||
}
|
||||
if (!VIcon) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return <VIcon className={classNames("w-4 h-auto text-gray-400")} />;
|
||||
};
|
||||
|
||||
export default VisibilityIcon;
|
Reference in New Issue
Block a user