refactor: rename all page query to doc (#10019)

This commit is contained in:
forehalo
2025-02-07 11:40:59 +00:00
parent 4e00ddd5f1
commit 0b9d30b55a
34 changed files with 658 additions and 643 deletions
@@ -14,7 +14,7 @@ import { GlobalContextService } from '@affine/core/modules/global-context';
import { ShareDocsListService } from '@affine/core/modules/share-doc';
import type { AffineDNDData } from '@affine/core/types/dnd';
import type { Collection } from '@affine/env/filter';
import { PublicPageMode } from '@affine/graphql';
import { PublicDocMode } from '@affine/graphql';
import { useI18n } from '@affine/i18n';
import { track } from '@affine/track';
import type { DocMeta } from '@blocksuite/affine/store';
@@ -283,9 +283,9 @@ const ExplorerCollectionNodeChildren = ({
const pageData = {
meta: meta as DocMeta,
publicMode:
publicMode === PublicPageMode.Edgeless
publicMode === PublicDocMode.Edgeless
? ('edgeless' as const)
: publicMode === PublicPageMode.Page
: publicMode === PublicDocMode.Page
? ('page' as const)
: undefined,
favorite: favourites.some(fav => fav.id === meta.id),
@@ -18,8 +18,7 @@ import type { GlobalCache } from '../../storage';
import type { WorkspaceService } from '../../workspace';
import type { ShareDocsStore } from '../stores/share-docs';
type ShareDocListType =
GetWorkspacePublicPagesQuery['workspace']['publicPages'];
type ShareDocListType = GetWorkspacePublicPagesQuery['workspace']['publicDocs'];
export const logger = new DebugLogger('affine:share-doc-list');
@@ -1,6 +1,6 @@
import type {
GetWorkspacePublicPageByIdQuery,
PublicPageMode,
PublicDocMode,
} from '@affine/graphql';
import {
backoffRetry,
@@ -20,7 +20,7 @@ import type { DocService } from '../../doc';
import type { WorkspaceService } from '../../workspace';
import type { ShareStore } from '../stores/share';
type ShareInfoType = GetWorkspacePublicPageByIdQuery['workspace']['publicPage'];
type ShareInfoType = GetWorkspacePublicPageByIdQuery['workspace']['publicDoc'];
export class ShareInfo extends Entity {
info$ = new LiveData<ShareInfoType | undefined | null>(null);
@@ -70,7 +70,7 @@ export class ShareInfo extends Entity {
return this.isRevalidating$.waitFor(v => v === false, signal);
}
async enableShare(mode: PublicPageMode) {
async enableShare(mode: PublicDocMode) {
await this.store.enableSharePage(
this.workspaceService.workspace.id,
this.docService.doc.id,
@@ -79,7 +79,7 @@ export class ShareInfo extends Entity {
await this.waitForRevalidation();
}
async changeShare(mode: PublicPageMode) {
async changeShare(mode: PublicDocMode) {
await this.enableShare(mode);
}
@@ -20,6 +20,6 @@ export class ShareDocsStore extends Store {
signal,
},
});
return data.workspace.publicPages;
return data.workspace.publicDocs;
}
}
@@ -1,4 +1,4 @@
import type { PublicPageMode } from '@affine/graphql';
import type { PublicDocMode } from '@affine/graphql';
import {
getWorkspacePublicPageByIdQuery,
publishPageMutation,
@@ -31,13 +31,13 @@ export class ShareStore extends Store {
signal,
},
});
return data.workspace.publicPage ?? undefined;
return data.workspace.publicDoc ?? undefined;
}
async enableSharePage(
workspaceId: string,
pageId: string,
docMode?: PublicPageMode,
docMode?: PublicDocMode,
signal?: AbortSignal
) {
if (!this.workspaceServerService.server) {