mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
Merge branch 'master' into payment-system
This commit is contained in:
30
packages/common/env/src/filter.ts
vendored
30
packages/common/env/src/filter.ts
vendored
@@ -14,7 +14,9 @@ export type LiteralValue =
|
||||
| number
|
||||
| string
|
||||
| boolean
|
||||
| { [K: string]: LiteralValue }
|
||||
| {
|
||||
[K: string]: LiteralValue;
|
||||
}
|
||||
| Array<LiteralValue>;
|
||||
|
||||
export const refSchema: z.ZodType<Ref, z.ZodTypeDef> = z.object({
|
||||
@@ -48,15 +50,31 @@ export type Filter = z.input<typeof filterSchema>;
|
||||
|
||||
export const collectionSchema = z.object({
|
||||
id: z.string(),
|
||||
workspaceId: z.string(),
|
||||
name: z.string(),
|
||||
pinned: z.boolean().optional(),
|
||||
mode: z.union([z.literal('page'), z.literal('rule')]),
|
||||
filterList: z.array(filterSchema),
|
||||
allowList: z.array(z.string()).optional(),
|
||||
excludeList: z.array(z.string()).optional(),
|
||||
allowList: z.array(z.string()),
|
||||
// page id list
|
||||
pages: z.array(z.string()),
|
||||
});
|
||||
|
||||
export const deletedCollectionSchema = z.object({
|
||||
userId: z.string().optional(),
|
||||
userName: z.string(),
|
||||
collection: collectionSchema,
|
||||
});
|
||||
export type DeprecatedCollection = {
|
||||
id: string;
|
||||
name: string;
|
||||
workspaceId: string;
|
||||
filterList: z.infer<typeof filterSchema>[];
|
||||
allowList?: string[];
|
||||
};
|
||||
export type Collection = z.input<typeof collectionSchema>;
|
||||
export type DeleteCollectionInfo = {
|
||||
userId: string;
|
||||
userName: string;
|
||||
} | null;
|
||||
export type DeletedCollection = z.input<typeof deletedCollectionSchema>;
|
||||
|
||||
export const tagSchema = z.object({
|
||||
id: z.string(),
|
||||
|
||||
12
packages/common/env/src/workspace.ts
vendored
12
packages/common/env/src/workspace.ts
vendored
@@ -8,10 +8,9 @@ import type {
|
||||
import type { PropsWithChildren, ReactNode } from 'react';
|
||||
import type { DataSourceAdapter } from 'y-provider';
|
||||
|
||||
import type { Collection } from './filter.js';
|
||||
|
||||
export enum WorkspaceSubPath {
|
||||
ALL = 'all',
|
||||
Collection = 'collection',
|
||||
SETTING = 'setting',
|
||||
TRASH = 'trash',
|
||||
SHARED = 'shared',
|
||||
@@ -137,6 +136,7 @@ type UIBaseProps<_Flavour extends keyof WorkspaceRegistry> = {
|
||||
|
||||
export type WorkspaceHeaderProps<Flavour extends keyof WorkspaceRegistry> =
|
||||
UIBaseProps<Flavour> & {
|
||||
rightSlot?: ReactNode;
|
||||
currentEntry:
|
||||
| {
|
||||
subPath: WorkspaceSubPath;
|
||||
@@ -167,20 +167,12 @@ type PageDetailProps<Flavour extends keyof WorkspaceRegistry> =
|
||||
onLoadEditor: (page: Page, editor: EditorContainer) => () => void;
|
||||
};
|
||||
|
||||
type PageListProps<_Flavour extends keyof WorkspaceRegistry> = {
|
||||
blockSuiteWorkspace: BlockSuiteWorkspace;
|
||||
onOpenPage: (pageId: string, newTab?: boolean) => void;
|
||||
collection: Collection;
|
||||
};
|
||||
|
||||
interface FC<P> {
|
||||
(props: P): ReactNode;
|
||||
}
|
||||
|
||||
export interface WorkspaceUISchema<Flavour extends keyof WorkspaceRegistry> {
|
||||
Header: FC<WorkspaceHeaderProps<Flavour>>;
|
||||
PageDetail: FC<PageDetailProps<Flavour>>;
|
||||
PageList: FC<PageListProps<Flavour>>;
|
||||
NewSettingsDetail: FC<NewSettingProps<Flavour>>;
|
||||
Provider: FC<PropsWithChildren>;
|
||||
LoginCard?: FC<object>;
|
||||
|
||||
Reference in New Issue
Block a user