mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
refactor(core): rename doc property component name (#8500)
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
import { Button, Menu } from '@affine/component';
|
import { Button, Menu } from '@affine/component';
|
||||||
import { SettingHeader } from '@affine/component/setting-components';
|
import { SettingHeader } from '@affine/component/setting-components';
|
||||||
|
import { DocPropertyManager } from '@affine/core/components/doc-properties/manager';
|
||||||
|
import { CreatePropertyMenuItems } from '@affine/core/components/doc-properties/menu/create-doc-property';
|
||||||
import { useWorkspaceInfo } from '@affine/core/components/hooks/use-workspace-info';
|
import { useWorkspaceInfo } from '@affine/core/components/hooks/use-workspace-info';
|
||||||
import { Trans, useI18n } from '@affine/i18n';
|
import { Trans, useI18n } from '@affine/i18n';
|
||||||
import { FrameworkScope, type WorkspaceMetadata } from '@toeverything/infra';
|
import { FrameworkScope, type WorkspaceMetadata } from '@toeverything/infra';
|
||||||
|
|
||||||
import { useWorkspace } from '../../../../../components/hooks/use-workspace';
|
import { useWorkspace } from '../../../../../components/hooks/use-workspace';
|
||||||
import { DocPropertyManager } from '../../../page-properties/manager';
|
|
||||||
import { CreatePropertyMenuItems } from '../../../page-properties/menu/create-doc-property';
|
|
||||||
import * as styles from './styles.css';
|
import * as styles from './styles.css';
|
||||||
|
|
||||||
const WorkspaceSettingPropertiesMain = () => {
|
const WorkspaceSettingPropertiesMain = () => {
|
||||||
|
|||||||
@@ -34,11 +34,11 @@ import React, {
|
|||||||
useRef,
|
useRef,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
|
|
||||||
import { DocPropertiesTable } from '../../affine/page-properties';
|
|
||||||
import {
|
import {
|
||||||
AffinePageReference,
|
AffinePageReference,
|
||||||
AffineSharedPageReference,
|
AffineSharedPageReference,
|
||||||
} from '../../affine/reference-link';
|
} from '../../affine/reference-link';
|
||||||
|
import { DocPropertiesTable } from '../../doc-properties';
|
||||||
import { BiDirectionalLinkPanel } from './bi-directional-link-panel';
|
import { BiDirectionalLinkPanel } from './bi-directional-link-panel';
|
||||||
import { BlocksuiteEditorJournalDocTitle } from './journal-doc-title';
|
import { BlocksuiteEditorJournalDocTitle } from './journal-doc-title';
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -22,9 +22,9 @@ import {
|
|||||||
} from '@toeverything/infra';
|
} from '@toeverything/infra';
|
||||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
|
|
||||||
import { BlocksuiteHeaderTitle } from '../../../blocksuite/block-suite-header/title';
|
import { BlocksuiteHeaderTitle } from '../../blocksuite/block-suite-header/title';
|
||||||
import { CreatePropertyMenuItems } from '../menu/create-doc-property';
|
import { CreatePropertyMenuItems } from '../menu/create-doc-property';
|
||||||
import { PagePropertyRow } from '../table';
|
import { DocPropertyRow } from '../table';
|
||||||
import * as styles from './info-modal.css';
|
import * as styles from './info-modal.css';
|
||||||
import { LinksRow } from './links-row';
|
import { LinksRow } from './links-row';
|
||||||
import { TimeRow } from './time-row';
|
import { TimeRow } from './time-row';
|
||||||
@@ -163,7 +163,7 @@ export const InfoTable = ({
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
{properties.map(property => (
|
{properties.map(property => (
|
||||||
<PagePropertyRow
|
<DocPropertyRow
|
||||||
key={property.id}
|
key={property.id}
|
||||||
propertyInfo={property}
|
propertyInfo={property}
|
||||||
defaultOpenEditMenu={newPropertyId === property.id}
|
defaultOpenEditMenu={newPropertyId === property.id}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { Backlink, Link } from '@affine/core/modules/doc-link';
|
import type { Backlink, Link } from '@affine/core/modules/doc-link';
|
||||||
|
|
||||||
import { AffinePageReference } from '../../reference-link';
|
import { AffinePageReference } from '../../affine/reference-link';
|
||||||
import * as styles from './links-row.css';
|
import * as styles from './links-row.css';
|
||||||
|
|
||||||
export const LinksRow = ({
|
export const LinksRow = ({
|
||||||
@@ -34,21 +34,21 @@ import type React from 'react';
|
|||||||
import type { HTMLProps, PropsWithChildren } from 'react';
|
import type { HTMLProps, PropsWithChildren } from 'react';
|
||||||
import { forwardRef, useCallback, useMemo, useState } from 'react';
|
import { forwardRef, useCallback, useMemo, useState } from 'react';
|
||||||
|
|
||||||
import { AffinePageReference } from '../reference-link';
|
import { AffinePageReference } from '../affine/reference-link';
|
||||||
import { DocPropertyIcon } from './icons/doc-property-icon';
|
import { DocPropertyIcon } from './icons/doc-property-icon';
|
||||||
import { CreatePropertyMenuItems } from './menu/create-doc-property';
|
import { CreatePropertyMenuItems } from './menu/create-doc-property';
|
||||||
import { EditDocPropertyMenuItems } from './menu/edit-doc-property';
|
import { EditDocPropertyMenuItems } from './menu/edit-doc-property';
|
||||||
import * as styles from './table.css';
|
import * as styles from './table.css';
|
||||||
import { DocPropertyTypes, isSupportedDocPropertyType } from './types/constant';
|
import { DocPropertyTypes, isSupportedDocPropertyType } from './types/constant';
|
||||||
|
|
||||||
type PageBacklinksPopupProps = PropsWithChildren<{
|
type DocBacklinksPopupProps = PropsWithChildren<{
|
||||||
backlinks: { docId: string; blockId: string; title: string }[];
|
backlinks: { docId: string; blockId: string; title: string }[];
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export const PageBacklinksPopup = ({
|
export const DocBacklinksPopup = ({
|
||||||
backlinks,
|
backlinks,
|
||||||
children,
|
children,
|
||||||
}: PageBacklinksPopupProps) => {
|
}: DocBacklinksPopupProps) => {
|
||||||
return (
|
return (
|
||||||
<Menu
|
<Menu
|
||||||
contentOptions={{
|
contentOptions={{
|
||||||
@@ -74,7 +74,7 @@ export const PageBacklinksPopup = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
interface PagePropertiesTableHeaderProps {
|
interface DocPropertiesTableHeaderProps {
|
||||||
className?: string;
|
className?: string;
|
||||||
style?: React.CSSProperties;
|
style?: React.CSSProperties;
|
||||||
open: boolean;
|
open: boolean;
|
||||||
@@ -84,25 +84,25 @@ interface PagePropertiesTableHeaderProps {
|
|||||||
// backlinks - #no Updated yyyy-mm-dd
|
// backlinks - #no Updated yyyy-mm-dd
|
||||||
// ─────────────────────────────────────────────────
|
// ─────────────────────────────────────────────────
|
||||||
// Page Info ...
|
// Page Info ...
|
||||||
export const PagePropertiesTableHeader = ({
|
export const DocPropertiesTableHeader = ({
|
||||||
className,
|
className,
|
||||||
style,
|
style,
|
||||||
open,
|
open,
|
||||||
onOpenChange,
|
onOpenChange,
|
||||||
}: PagePropertiesTableHeaderProps) => {
|
}: DocPropertiesTableHeaderProps) => {
|
||||||
const t = useI18n();
|
const t = useI18n();
|
||||||
const {
|
const {
|
||||||
docLinksServices,
|
docLinksService,
|
||||||
docService,
|
docService,
|
||||||
workspaceService,
|
workspaceService,
|
||||||
editorSettingService,
|
editorSettingService,
|
||||||
} = useServices({
|
} = useServices({
|
||||||
DocLinksServices: DocLinksService,
|
DocLinksService,
|
||||||
DocService,
|
DocService,
|
||||||
WorkspaceService,
|
WorkspaceService,
|
||||||
EditorSettingService,
|
EditorSettingService,
|
||||||
});
|
});
|
||||||
const docBacklinks = docLinksServices.backlinks;
|
const docBacklinks = docLinksService.backlinks;
|
||||||
const backlinks = useLiveData(docBacklinks.backlinks$);
|
const backlinks = useLiveData(docBacklinks.backlinks$);
|
||||||
|
|
||||||
const displayDocInfo = useLiveData(
|
const displayDocInfo = useLiveData(
|
||||||
@@ -187,11 +187,11 @@ export const PagePropertiesTableHeader = ({
|
|||||||
{/* TODO(@Peng): add click handler to backlinks */}
|
{/* TODO(@Peng): add click handler to backlinks */}
|
||||||
<div className={styles.tableHeaderInfoRow}>
|
<div className={styles.tableHeaderInfoRow}>
|
||||||
{backlinks.length > 0 ? (
|
{backlinks.length > 0 ? (
|
||||||
<PageBacklinksPopup backlinks={backlinks}>
|
<DocBacklinksPopup backlinks={backlinks}>
|
||||||
<div className={styles.tableHeaderBacklinksHint}>
|
<div className={styles.tableHeaderBacklinksHint}>
|
||||||
{t['com.affine.page-properties.backlinks']()} · {backlinks.length}
|
{t['com.affine.page-properties.backlinks']()} · {backlinks.length}
|
||||||
</div>
|
</div>
|
||||||
</PageBacklinksPopup>
|
</DocBacklinksPopup>
|
||||||
) : null}
|
) : null}
|
||||||
{dTimestampElement}
|
{dTimestampElement}
|
||||||
</div>
|
</div>
|
||||||
@@ -220,16 +220,16 @@ export const PagePropertiesTableHeader = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
interface PagePropertyRowProps {
|
interface DocPropertyRowProps {
|
||||||
propertyInfo: DocCustomPropertyInfo;
|
propertyInfo: DocCustomPropertyInfo;
|
||||||
showAll?: boolean;
|
showAll?: boolean;
|
||||||
defaultOpenEditMenu?: boolean;
|
defaultOpenEditMenu?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const PagePropertyRow = ({
|
export const DocPropertyRow = ({
|
||||||
propertyInfo,
|
propertyInfo,
|
||||||
defaultOpenEditMenu,
|
defaultOpenEditMenu,
|
||||||
}: PagePropertyRowProps) => {
|
}: DocPropertyRowProps) => {
|
||||||
const t = useI18n();
|
const t = useI18n();
|
||||||
const docService = useService(DocService);
|
const docService = useService(DocService);
|
||||||
const docsService = useService(DocsService);
|
const docsService = useService(DocsService);
|
||||||
@@ -338,7 +338,7 @@ export const PagePropertyRow = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
interface PagePropertiesTableBodyProps {
|
interface DocPropertiesTableBodyProps {
|
||||||
className?: string;
|
className?: string;
|
||||||
style?: React.CSSProperties;
|
style?: React.CSSProperties;
|
||||||
}
|
}
|
||||||
@@ -346,9 +346,9 @@ interface PagePropertiesTableBodyProps {
|
|||||||
// 🏷️ Tags (⋅ xxx) (⋅ yyy)
|
// 🏷️ Tags (⋅ xxx) (⋅ yyy)
|
||||||
// #️⃣ Number 123456
|
// #️⃣ Number 123456
|
||||||
// + Add a property
|
// + Add a property
|
||||||
export const PagePropertiesTableBody = forwardRef<
|
export const DocPropertiesTableBody = forwardRef<
|
||||||
HTMLDivElement,
|
HTMLDivElement,
|
||||||
PagePropertiesTableBodyProps & HTMLProps<HTMLDivElement>
|
DocPropertiesTableBodyProps & HTMLProps<HTMLDivElement>
|
||||||
>(({ className, style, ...props }, ref) => {
|
>(({ className, style, ...props }, ref) => {
|
||||||
const t = useI18n();
|
const t = useI18n();
|
||||||
const docsService = useService(DocsService);
|
const docsService = useService(DocsService);
|
||||||
@@ -390,7 +390,7 @@ export const PagePropertiesTableBody = forwardRef<
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
{properties.map(property => (
|
{properties.map(property => (
|
||||||
<PagePropertyRow
|
<DocPropertyRow
|
||||||
key={property.id}
|
key={property.id}
|
||||||
propertyInfo={property}
|
propertyInfo={property}
|
||||||
defaultOpenEditMenu={newPropertyId === property.id}
|
defaultOpenEditMenu={newPropertyId === property.id}
|
||||||
@@ -438,7 +438,7 @@ export const PagePropertiesTableBody = forwardRef<
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
PagePropertiesTableBody.displayName = 'PagePropertiesTableBody';
|
DocPropertiesTableBody.displayName = 'PagePropertiesTableBody';
|
||||||
|
|
||||||
const DocPropertiesTableInner = () => {
|
const DocPropertiesTableInner = () => {
|
||||||
const [expanded, setExpanded] = useState(false);
|
const [expanded, setExpanded] = useState(false);
|
||||||
@@ -449,9 +449,9 @@ const DocPropertiesTableInner = () => {
|
|||||||
onOpenChange={setExpanded}
|
onOpenChange={setExpanded}
|
||||||
className={styles.rootCentered}
|
className={styles.rootCentered}
|
||||||
>
|
>
|
||||||
<PagePropertiesTableHeader open={expanded} onOpenChange={setExpanded} />
|
<DocPropertiesTableHeader open={expanded} onOpenChange={setExpanded} />
|
||||||
<Collapsible.Content asChild>
|
<Collapsible.Content asChild>
|
||||||
<PagePropertiesTableBody />
|
<DocPropertiesTableBody />
|
||||||
</Collapsible.Content>
|
</Collapsible.Content>
|
||||||
</Collapsible.Root>
|
</Collapsible.Root>
|
||||||
</div>
|
</div>
|
||||||
@@ -20,7 +20,7 @@ import { clamp } from 'lodash-es';
|
|||||||
import type { HTMLAttributes, PropsWithChildren } from 'react';
|
import type { HTMLAttributes, PropsWithChildren } from 'react';
|
||||||
import { useCallback, useMemo, useReducer, useRef, useState } from 'react';
|
import { useCallback, useMemo, useReducer, useRef, useState } from 'react';
|
||||||
|
|
||||||
import { TagItem, TempTagItem } from '../../page-list';
|
import { TagItem, TempTagItem } from '../page-list';
|
||||||
import * as styles from './tags-inline-editor.css';
|
import * as styles from './tags-inline-editor.css';
|
||||||
|
|
||||||
interface TagsEditorProps {
|
interface TagsEditorProps {
|
||||||
@@ -21,7 +21,6 @@ import { AuthModal } from '../affine/auth';
|
|||||||
import { AiLoginRequiredModal } from '../affine/auth/ai-login-required';
|
import { AiLoginRequiredModal } from '../affine/auth/ai-login-required';
|
||||||
import { HistoryTipsModal } from '../affine/history-tips-modal';
|
import { HistoryTipsModal } from '../affine/history-tips-modal';
|
||||||
import { IssueFeedbackModal } from '../affine/issue-feedback-modal';
|
import { IssueFeedbackModal } from '../affine/issue-feedback-modal';
|
||||||
import { InfoModal } from '../affine/page-properties/info-modal/info-modal';
|
|
||||||
import {
|
import {
|
||||||
CloudQuotaModal,
|
CloudQuotaModal,
|
||||||
LocalQuotaModal,
|
LocalQuotaModal,
|
||||||
@@ -31,6 +30,7 @@ import { SignOutModal } from '../affine/sign-out-modal';
|
|||||||
import { StarAFFiNEModal } from '../affine/star-affine-modal';
|
import { StarAFFiNEModal } from '../affine/star-affine-modal';
|
||||||
import type { SettingAtom } from '../atoms';
|
import type { SettingAtom } from '../atoms';
|
||||||
import { openSettingModalAtom, openSignOutModalAtom } from '../atoms';
|
import { openSettingModalAtom, openSignOutModalAtom } from '../atoms';
|
||||||
|
import { InfoModal } from '../doc-properties/info-modal/info-modal';
|
||||||
import { useTrashModalHelper } from '../hooks/affine/use-trash-modal-helper';
|
import { useTrashModalHelper } from '../hooks/affine/use-trash-modal-helper';
|
||||||
import { useAsyncCallback } from '../hooks/affine-async-hooks';
|
import { useAsyncCallback } from '../hooks/affine-async-hooks';
|
||||||
import { useNavigateHelper } from '../hooks/use-navigate-helper';
|
import { useNavigateHelper } from '../hooks/use-navigate-helper';
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import { PageDetailSkeleton } from '@affine/component/page-detail-skeleton';
|
|||||||
import type { ChatPanel } from '@affine/core/blocksuite/presets/ai';
|
import type { ChatPanel } from '@affine/core/blocksuite/presets/ai';
|
||||||
import { AIProvider } from '@affine/core/blocksuite/presets/ai';
|
import { AIProvider } from '@affine/core/blocksuite/presets/ai';
|
||||||
import { PageAIOnboarding } from '@affine/core/components/affine/ai-onboarding';
|
import { PageAIOnboarding } from '@affine/core/components/affine/ai-onboarding';
|
||||||
import { DocPropertySidebar } from '@affine/core/components/affine/page-properties/sidebar';
|
|
||||||
import { EditorOutlineViewer } from '@affine/core/components/blocksuite/outline-viewer';
|
import { EditorOutlineViewer } from '@affine/core/components/blocksuite/outline-viewer';
|
||||||
|
import { DocPropertySidebar } from '@affine/core/components/doc-properties/sidebar';
|
||||||
import { useAppSettingHelper } from '@affine/core/components/hooks/affine/use-app-setting-helper';
|
import { useAppSettingHelper } from '@affine/core/components/hooks/affine/use-app-setting-helper';
|
||||||
import { useDocMetaHelper } from '@affine/core/components/hooks/use-block-suite-page-meta';
|
import { useDocMetaHelper } from '@affine/core/components/hooks/use-block-suite-page-meta';
|
||||||
import { EditorService } from '@affine/core/modules/editor';
|
import { EditorService } from '@affine/core/modules/editor';
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Divider, Scrollable } from '@affine/component';
|
import { Divider, Scrollable } from '@affine/component';
|
||||||
import { DocPropertiesTable } from '@affine/core/components/affine/page-properties';
|
import { DocPropertiesTable } from '@affine/core/components/doc-properties';
|
||||||
import { LinksRow } from '@affine/core/components/affine/page-properties/info-modal/links-row';
|
import { LinksRow } from '@affine/core/components/doc-properties/info-modal/links-row';
|
||||||
import { TimeRow } from '@affine/core/components/affine/page-properties/info-modal/time-row';
|
import { TimeRow } from '@affine/core/components/doc-properties/info-modal/time-row';
|
||||||
import { DocsSearchService } from '@affine/core/modules/docs-search';
|
import { DocsSearchService } from '@affine/core/modules/docs-search';
|
||||||
import { useI18n } from '@affine/i18n';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { LiveData, useLiveData, useService } from '@toeverything/infra';
|
import { LiveData, useLiveData, useService } from '@toeverything/infra';
|
||||||
|
|||||||
@@ -2,12 +2,12 @@ import { NotificationCenter } from '@affine/component';
|
|||||||
import { AiLoginRequiredModal } from '@affine/core/components/affine/auth/ai-login-required';
|
import { AiLoginRequiredModal } from '@affine/core/components/affine/auth/ai-login-required';
|
||||||
import { HistoryTipsModal } from '@affine/core/components/affine/history-tips-modal';
|
import { HistoryTipsModal } from '@affine/core/components/affine/history-tips-modal';
|
||||||
import { IssueFeedbackModal } from '@affine/core/components/affine/issue-feedback-modal';
|
import { IssueFeedbackModal } from '@affine/core/components/affine/issue-feedback-modal';
|
||||||
import { InfoModal } from '@affine/core/components/affine/page-properties';
|
|
||||||
import {
|
import {
|
||||||
CloudQuotaModal,
|
CloudQuotaModal,
|
||||||
LocalQuotaModal,
|
LocalQuotaModal,
|
||||||
} from '@affine/core/components/affine/quota-reached-modal';
|
} from '@affine/core/components/affine/quota-reached-modal';
|
||||||
import { StarAFFiNEModal } from '@affine/core/components/affine/star-affine-modal';
|
import { StarAFFiNEModal } from '@affine/core/components/affine/star-affine-modal';
|
||||||
|
import { InfoModal } from '@affine/core/components/doc-properties';
|
||||||
import { useTrashModalHelper } from '@affine/core/components/hooks/affine/use-trash-modal-helper';
|
import { useTrashModalHelper } from '@affine/core/components/hooks/affine/use-trash-modal-helper';
|
||||||
import { MoveToTrash } from '@affine/core/components/page-list';
|
import { MoveToTrash } from '@affine/core/components/page-list';
|
||||||
import { SignOutConfirmModal } from '@affine/core/components/providers/modal-provider';
|
import { SignOutConfirmModal } from '@affine/core/components/providers/modal-provider';
|
||||||
|
|||||||
Reference in New Issue
Block a user