Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

fix: support redirect to default page (#6593)

Kilu.He497fcf3bbbf4
diff --git a/frontend/appflowy_web_app/deploy/server.ts b/frontend/appflowy_web_app/deploy/server.ts
index 46d81102ba..35d5e09570 100644
--- a/frontend/appflowy_web_app/deploy/server.ts
+++ b/frontend/appflowy_web_app/deploy/server.ts
@@ -43,7 +43,13 @@ const logRequestTimer = (req: Request) => {
};
};
-const fetchMetaData = async (url: string) => {
+const fetchMetaData = async (namespace: string, publishName?: string) => {
+ let url = `${baseURL}/api/workspace/published/${namespace}`;
+
+ if (publishName) {
+ url += `/${publishName}`;
+ }
+
logger.info(`Fetching meta data from ${url}`);
try {
const response = await fetch(url, {
@@ -108,7 +114,7 @@ const createServer = async (req: Request) => {
logger.info(`Namespace: ${namespace}, Publish Name: ${publishName}`);
if (req.method === 'GET') {
- if (namespace === '' || !publishName) {
+ if (namespace === '') {
timer();
return new Response(null, {
status: 302,
@@ -121,7 +127,27 @@ const createServer = async (req: Request) => {
let metaData;
try {
- metaData = await fetchMetaData(`${baseURL}/api/workspace/published/${namespace}/${publishName}`);
+ const data = await fetchMetaData(namespace, publishName);
+
+ if (publishName) {
+ metaData = data;
+ } else {
+
+ const publishInfo = data?.data?.info;
+
+ if (publishInfo) {
+ const newURL = `/${publishInfo.namespace}/${publishInfo.publish_name}`;
+
+ logger.info('Redirecting to default page: ', newURL);
+ timer();
+ return new Response(null, {
+ status: 302,
+ headers: {
+ Location: newURL,
+ },
+ });
+ }
+ }
} catch (error) {
logger.error(`Error fetching meta data: ${error}`);
}
diff --git a/frontend/appflowy_web_app/public/og-image.png b/frontend/appflowy_web_app/public/og-image.png
index 8b5996608a..a43f64a46e 100644
Binary files a/frontend/appflowy_web_app/public/og-image.png and b/frontend/appflowy_web_app/public/og-image.png differ
diff --git a/frontend/appflowy_web_app/src/application/database-yjs/context.ts b/frontend/appflowy_web_app/src/application/database-yjs/context.ts
index a5c873c92d..41ca237493 100644
--- a/frontend/appflowy_web_app/src/application/database-yjs/context.ts
+++ b/frontend/appflowy_web_app/src/application/database-yjs/context.ts
@@ -21,7 +21,7 @@ export interface DatabaseContextState {
loadView?: LoadView;
createRowDoc?: CreateRowDoc;
loadViewMeta?: LoadViewMeta;
- navigateToView?: (viewId: string) => Promise<void>;
+ navigateToView?: (viewId: string, blockId?: string) => Promise<void>;
}
export const DatabaseContext = createContext<DatabaseContextState | null>(null);
diff --git a/frontend/appflowy_web_app/src/application/publish/context.tsx b/frontend/appflowy_web_app/src/application/publish/context.tsx
index b80dccb2f3..a3c05f629e 100644
--- a/frontend/appflowy_web_app/src/application/publish/context.tsx
+++ b/frontend/appflowy_web_app/src/application/publish/context.tsx
@@ -21,7 +21,7 @@ export interface PublishContextType {
isTemplate?: boolean;
isTemplateThumb?: boolean;
viewMeta?: ViewMeta;
- toView: (viewId: string) => Promise<void>;
+ toView: (viewId: string, blockId?: string) => Promise<void>;
loadViewMeta: LoadViewMeta;
createRowDoc?: CreateRowDoc;
loadView: LoadView;
@@ -176,7 +176,7 @@ export const PublishProvider = ({
}, [service, publishName]);
const navigate = useNavigate();
const toView = useCallback(
- async (viewId: string) => {
+ async (viewId: string, blockId?: string) => {
try {
const res = await service?.getPublishInfo(viewId);
@@ -187,7 +187,23 @@ export const PublishProvider = ({
const { namespace: viewNamespace, publishName } = res;
prevViewMeta.current = undefined;
- navigate(`/${viewNamespace}/${publishName}${isTemplate ? '?template=true' : ''}`, {
+ const searchParams = new URLSearchParams('');
+
+ if (blockId) {
+ searchParams.set('blockId', blockId);
+ }
+
+ if (isTemplate) {
+ searchParams.set('template', 'true');
+ }
+
+ let url = `/${viewNamespace}/${publishName}`;
+
+ if (searchParams.toString()) {
+ url += `?${searchParams.toString()}`;
+ }
+
+ navigate(url, {
replace: true,
});
return;
diff --git a/frontend/appflowy_web_app/src/application/services/js-services/http/http_api.ts b/frontend/appflowy_web_app/src/application/services/js-services/http/http_api.ts
index ecb67a3676..9cdc21507f 100644
--- a/frontend/appflowy_web_app/src/application/services/js-services/http/http_api.ts
+++ b/frontend/appflowy_web_app/src/application/services/js-services/http/http_api.ts
@@ -14,7 +14,7 @@ import {
Subscriptions,
SubscriptionPlan,
SubscriptionInterval,
- RequestAccessInfoStatus,
+ RequestAccessInfoStatus, ViewInfo,
} from '@/application/types';
import { GlobalComment, Reaction } from '@/application/comment.type';
import { initGrantService, refreshToken } from '@/application/services/js-services/http/gotrue';
@@ -274,10 +274,22 @@ export async function getUserWorkspaceInfo (): Promise<{
}
export async function getPublishViewMeta (namespace: string, publishName: string) {
- const url = `/api/workspace/published/${namespace}/${publishName}`;
- const response = await axiosInstance?.get(url);
+ const url = `/api/workspace/v1/published/${namespace}/${publishName}`;
+ const response = await axiosInstance?.get<{
+ code: number;
+ data: {
+ view: ViewInfo;
+ child_views: ViewInfo[];
+ ancestor_views: ViewInfo[];
+ };
+ message: string;
+ }>(url);
- return response?.data;
+ if (response?.data.code !== 0) {
+ return Promise.reject(response?.data);
+ }
+
+ return response?.data.data;
}
export async function getPublishViewBlob (namespace: string, publishName: string) {
@@ -289,7 +301,7 @@ export async function getPublishViewBlob (namespace: string, publishName: string
return blobToBytes(response?.data);
}
-export async function updateCollab (workspaceId: string, objectId: string, docState: Uint8Array, context: {
+export async function updateCollab (workspaceId: string, objectId: string, collabType: Types, docState: Uint8Array, context: {
version_vector: number;
}) {
const url = `/api/workspace/v1/${workspaceId}/collab/${objectId}/web-update`;
@@ -298,6 +310,7 @@ export async function updateCollab (workspaceId: string, objectId: string, docSt
message: string;
}>(url, {
doc_state: Array.from(docState),
+ collab_type: collabType,
});
if (response?.data.code !== 0) {
@@ -1269,3 +1282,4 @@ export async function uploadFile (file: File, onProgress: (progress: number) =>
return Promise.reject(response?.data);
}
+
diff --git a/frontend/appflowy_web_app/src/application/services/js-services/index.ts b/frontend/appflowy_web_app/src/application/services/js-services/index.ts
index 9a28db7f7e..3d612f7574 100644
--- a/frontend/appflowy_web_app/src/application/services/js-services/index.ts
+++ b/frontend/appflowy_web_app/src/application/services/js-services/index.ts
@@ -459,7 +459,9 @@ export class AFClientService implements AFService {
return APIService.getActiveSubscription(workspaceId);
}
- registerDocUpdate (doc: Y.Doc, workspaceId: string, objectId: string) {
+ registerDocUpdate (doc: Y.Doc, context: {
+ workspaceId: string, objectId: string, collabType: Types
+ }) {
const token = getTokenParsed();
const userId = token?.user.id;
@@ -467,7 +469,7 @@ export class AFClientService implements AFService {
throw new Error('User not found');
}
- const sync = new SyncManager(doc, userId, workspaceId, objectId);
+ const sync = new SyncManager(doc, { userId, ...context });
sync.initialize();
}
diff --git a/frontend/appflowy_web_app/src/application/services/js-services/sync.ts b/frontend/appflowy_web_app/src/application/services/js-services/sync.ts
index d39d2640fb..231d560581 100644
--- a/frontend/appflowy_web_app/src/application/services/js-services/sync.ts
+++ b/frontend/appflowy_web_app/src/application/services/js-services/sync.ts
@@ -1,5 +1,5 @@
import { updateCollab } from '@/application/services/js-services/http/http_api';
-import { CollabOrigin } from '@/application/types';
+import { CollabOrigin, Types } from '@/application/types';
import { debounce } from 'lodash-es';
import * as Y from 'yjs';
@@ -17,7 +17,9 @@ export class SyncManager {
private isSending = false;
- constructor (private doc: Y.Doc, private uuid: string, private workspaceId: string, private objectId: string) {
+ constructor (private doc: Y.Doc, private context: {
+ userId: string, workspaceId: string, objectId: string, collabType: Types
+ }) {
this.versionVector = this.loadVersionVector();
this.hasUnsyncedChanges = this.loadUnsyncedFlag();
this.lastSyncedAt = this.loadLastSyncedAt();
@@ -33,7 +35,7 @@ export class SyncManager {
}
private getStorageKey (baseKey: string): string {
- return `${this.uuid}_${baseKey}_${this.workspaceId}_${this.objectId}`;
+ return `${this.context.userId}_${baseKey}_${this.context.workspaceId}_${this.context.objectId}`;
}
private loadVersionVector (): number {
@@ -81,7 +83,7 @@ export class SyncManager {
const update = Y.encodeStateAsUpdate(this.doc);
const context = { version_vector: this.versionVector };
- const response = await updateCollab(this.workspaceId, this.objectId, update, context);
+ const response = await updateCollab(this.context.workspaceId, this.context.objectId, this.context.collabType, update, context);
if (response) {
console.log(`Update sent successfully. Server version: ${response.version_vector}`);
diff --git a/frontend/appflowy_web_app/src/application/services/services.type.ts b/frontend/appflowy_web_app/src/application/services/services.type.ts
index dd4fcd8399..7a1e7b567f 100644
--- a/frontend/appflowy_web_app/src/application/services/services.type.ts
+++ b/frontend/appflowy_web_app/src/application/services/services.type.ts
@@ -6,7 +6,7 @@ import {
UserWorkspaceInfo,
View,
Workspace,
- YDoc, DatabaseRelations, GetRequestAccessInfoResponse, Subscriptions, SubscriptionPlan, SubscriptionInterval,
+ YDoc, DatabaseRelations, GetRequestAccessInfoResponse, Subscriptions, SubscriptionPlan, SubscriptionInterval, Types,
} from '@/application/types';
import { GlobalComment, Reaction } from '@/application/comment.type';
import { ViewMeta } from '@/application/db/tables/view_metas';
@@ -64,7 +64,9 @@ export interface AppService {
getSubscriptionLink: (workspaceId: string, plan: SubscriptionPlan, interval: SubscriptionInterval) => Promise<string>;
getSubscriptions: () => Promise<Subscriptions>;
getActiveSubscription: (workspaceId: string) => Promise<SubscriptionPlan[]>;
- registerDocUpdate: (doc: YDoc, workspaceId: string, objectId: string) => void;
+ registerDocUpdate: (doc: YDoc, context: {
+ workspaceId: string, objectId: string, collabType: Types
+ }) => void;
uploadFile: (file: File, onProgress: (progress: number) => void) => Promise<void>;
importFile: (file: File, onProgress: (progress: number) => void) => Promise<void>;
}
diff --git a/frontend/appflowy_web_app/src/application/services/tauri-services/index.ts b/frontend/appflowy_web_app/src/application/services/tauri-services/index.ts
index 1f6816588c..8787987dbc 100644
--- a/frontend/appflowy_web_app/src/application/services/tauri-services/index.ts
+++ b/frontend/appflowy_web_app/src/application/services/tauri-services/index.ts
@@ -258,7 +258,7 @@ export class AFClientService implements AFService {
return Promise.reject('Method not implemented');
}
- registerDocUpdate (_doc: YDoc, _workspaceId: string, _objectId: string): void {
+ registerDocUpdate (): void {
throw new Error('Method not implemented.');
}
diff --git a/frontend/appflowy_web_app/src/application/slate-yjs/__tests__/convert.test.ts b/frontend/appflowy_web_app/src/application/slate-yjs/__tests__/convert.test.ts
index 1d80680ec3..21c43a1c5f 100644
--- a/frontend/appflowy_web_app/src/application/slate-yjs/__tests__/convert.test.ts
+++ b/frontend/appflowy_web_app/src/application/slate-yjs/__tests__/convert.test.ts
@@ -1,3 +1,4 @@
+import { YjsEditorKey, YSharedRoot } from '@/application/types';
import { generateId, getTestingDocData, insertBlock, withTestingYDoc } from './withTestingYjsEditor';
import { yDocToSlateContent, deltaInsertToSlateNode, yDataToSlateContent } from '@/application/slate-yjs/utils/convert';
import { expect } from '@jest/globals';
@@ -9,15 +10,16 @@ describe('convert yjs data to slate content', () => {
it('should return undefined if root block is not exist', () => {
const doc = new Y.Doc();
+ const sharedRoot = doc.getMap(YjsEditorKey.data_section) as YSharedRoot;
expect(yDocToSlateContent(doc)).toBeUndefined();
const doc2 = withTestingYDoc('1');
- const { blocks, childrenMap, textMap, pageId } = getTestingDocData(doc2);
- expect(yDataToSlateContent({ blocks, rootId: '2', childrenMap, textMap })).toBeUndefined();
+ const { blocks, pageId } = getTestingDocData(doc2);
+ expect(yDataToSlateContent(sharedRoot)).toBeUndefined();
blocks.delete(pageId);
- expect(yDataToSlateContent({ blocks, rootId: pageId, childrenMap, textMap })).toBeUndefined();
+ expect(yDataToSlateContent(sharedRoot)).toBeUndefined();
});
it('should match empty array', () => {
const doc = withTestingYDoc('1');
diff --git a/frontend/appflowy_web_app/src/application/slate-yjs/command/index.ts b/frontend/appflowy_web_app/src/application/slate-yjs/command/index.ts
index 2c62b80e54..ea7e8c07d8 100644
--- a/frontend/appflowy_web_app/src/application/slate-yjs/command/index.ts
+++ b/frontend/appflowy_web_app/src/application/slate-yjs/command/index.ts
@@ -33,8 +33,21 @@ import { BasePoint, BaseRange, Editor, Element, Node, NodeEntry, Path, Range, Te
import { ReactEditor } from 'slate-react';
export const CustomEditor = {
+ // find entry from blockId
+ getBlockEntry (editor: YjsEditor, blockId: string): NodeEntry<Element> | undefined {
+ const [entry] = editor.nodes({
+ at: [],
+ match: (n) => !Editor.isEditor(n) && Element.isElement(n) && n.blockId === blockId,
+ });
+
+ if (!entry) {
+ return;
+ }
+
+ return entry as NodeEntry<Element>;
+ },
// Get the text content of a block node, including the text content of its children and formula nodes
- getBlockTextContent (node: Node): string {
+ getBlockTextContent (node: Node, depth: number = Infinity): string {
if (Text.isText(node)) {
if (node.formula) {
return node.formula;
@@ -56,7 +69,13 @@ export const CustomEditor = {
return node.text || '';
}
- return node.children.map((n) => CustomEditor.getBlockTextContent(n)).join('');
+ if (depth <= 0) {
+ return ''; // Prevent infinite recursion
+ }
+
+ return node.children
+ .map((n) => CustomEditor.getBlockTextContent(n, depth - 1))
+ .join('');
},
setBlockData<T = BlockData> (editor: YjsEditor, blockId: string, updateData: T, select?: boolean) {
@@ -75,10 +94,7 @@ export const CustomEditor = {
const newProperties = {
data: newData,
} as Partial<Element>;
- const [entry] = editor.nodes({
- at: [],
- match: (n) => !Editor.isEditor(n) && Element.isElement(n) && n.blockId === blockId,
- });
+ const entry = CustomEditor.getBlockEntry(editor, blockId);
if (!entry) {
console.error('Block not found');
diff --git a/frontend/appflowy_web_app/src/application/slate-yjs/utils/convert.ts b/frontend/appflowy_web_app/src/application/slate-yjs/utils/convert.ts
index b92ac70fd2..ba85652611 100644
--- a/frontend/appflowy_web_app/src/application/slate-yjs/utils/convert.ts
+++ b/frontend/appflowy_web_app/src/application/slate-yjs/utils/convert.ts
@@ -5,139 +5,126 @@ import {
getBlock,
getText,
updateBlockParent,
+ getTextMap,
+ getChildrenMap,
+ getBlocks, getPageId,
} from '@/application/slate-yjs/utils/yjsOperations';
import {
BlockData,
BlockType,
- YBlocks,
- YChildrenMap,
YDoc,
YjsEditorKey,
- YMeta,
YSharedRoot,
- YTextMap,
} from '@/application/types';
import { TableCellNode } from '@/components/editor/editor.type';
import { Element, Text, Node } from 'slate';
-export function yDataToSlateContent ({
- blocks,
- rootId,
- childrenMap,
- textMap,
-}: {
- blocks: YBlocks;
- childrenMap: YChildrenMap;
- textMap: YTextMap;
- rootId: string;
-}): Element | undefined {
- function traverse (id: string) {
- const block = blocks.get(id)?.toJSON() as BlockJson;
-
- if (!block) {
- console.error('Block not found', id);
- return;
- }
+export function traverseBlock (id: string, sharedRoot: YSharedRoot): Element | undefined {
+ const textMap = getTextMap(sharedRoot);
+ const childrenMap = getChildrenMap(sharedRoot);
+ const blocks = getBlocks(sharedRoot);
+ const block = blocks.get(id)?.toJSON() as BlockJson;
- const childrenId = block.children as string;
+ if (!block) {
+ console.error('Block not found', id);
+ return;
+ }
- const children = (childrenMap.get(childrenId)?.toJSON() ?? []).map(traverse).filter(Boolean) as (Element | Text)[];
+ const childrenId = block.children as string;
- const slateNode = blockToSlateNode(block);
+ const children = (childrenMap.get(childrenId)?.toJSON() ?? []).map((childId: string) => {
+ return traverseBlock(childId, sharedRoot);
+ }).filter(Boolean) as (Element | Text)[];
- if (slateNode.type === BlockType.TableBlock) {
- slateNode.children = sortTableCells(children as TableCellNode[]);
- } else if (slateNode.type === BlockType.TableCell) {
- slateNode.children = children.slice(0, 1);
- } else {
- slateNode.children = children;
- }
+ const slateNode = blockToSlateNode(block);
- if (slateNode.type === BlockType.Page) {
- return slateNode;
- }
+ if (slateNode.type === BlockType.TableBlock) {
+ slateNode.children = sortTableCells(children as TableCellNode[]);
+ } else if (slateNode.type === BlockType.TableCell) {
+ slateNode.children = children.slice(0, 1);
+ } else {
+ slateNode.children = children;
+ }
- let textId = block.external_id as string;
+ if (slateNode.type === BlockType.Page) {
+ return slateNode;
+ }
- let delta;
+ let textId = block.external_id as string;
- const yText = textId ? textMap.get(textId) : undefined;
+ let delta;
- if (!yText) {
+ const yText = textId ? textMap.get(textId) : undefined;
- if (children.length === 0) {
- children.push({
- text: '',
- });
- }
+ if (!yText) {
- // Compatible data
- // The old version of delta data is fully covered through the data field
- if (slateNode.data) {
- const data = slateNode.data as BlockData;
-
- if (YjsEditorKey.delta in data) {
- textId = block.id;
- delta = data.delta;
- } else {
- return slateNode;
- }
- }
- } else {
- delta = yText.toDelta();
+ if (children.length === 0) {
+ children.push({
+ text: '',
+ });
}
- try {
- const slateDelta = delta.flatMap(deltaInsertToSlateNode);
+ // Compatible data
+ // The old version of delta data is fully covered through the data field
+ if (slateNode.data) {
+ const data = slateNode.data as BlockData;
- if (slateDelta.length === 0) {
- slateDelta.push({
- text: '',
- });
+ if (YjsEditorKey.delta in data) {
+ textId = block.id;
+ delta = data.delta;
+ } else {
+ return slateNode;
}
+ }
+ } else {
+ delta = yText.toDelta();
+ }
- const textNode: Element = {
- textId,
- type: YjsEditorKey.text,
- children: slateDelta,
- };
+ try {
+ const slateDelta = delta.flatMap(deltaInsertToSlateNode);
- children.unshift(textNode);
- return slateNode;
- } catch (e) {
- return;
+ if (slateDelta.length === 0) {
+ slateDelta.push({
+ text: '',
+ });
}
+
+ const textNode: Element = {
+ textId,
+ type: YjsEditorKey.text,
+ children: slateDelta,
+ };
+
+ children.unshift(textNode);
+ return slateNode;
+ } catch (e) {
+ return;
}
+}
- const root = blocks.get(rootId);
+export function yDataToSlateContent (sharedRoot: YSharedRoot): Element | undefined {
+ try {
+ const rootId = getPageId(sharedRoot);
+ const blocks = getBlocks(sharedRoot);
+ const root = blocks.get(rootId);
- if (!root) return;
+ if (!root) return;
- const result = traverse(rootId);
+ const result = traverseBlock(rootId, sharedRoot);
- if (!result) return;
+ if (!result) return;
- return result;
+ return result;
+ } catch (e) {
+ return;
+ }
}
export function yDocToSlateContent (doc: YDoc): Element | undefined {
const sharedRoot = doc.getMap(YjsEditorKey.data_section) as YSharedRoot;
if (!sharedRoot || sharedRoot.size === 0) return;
- const document = sharedRoot.get(YjsEditorKey.document);
- const pageId = document.get(YjsEditorKey.page_id) as string;
- const blocks = document.get(YjsEditorKey.blocks) as YBlocks;
-
- const meta = document.get(YjsEditorKey.meta) as YMeta;
- const childrenMap = meta.get(YjsEditorKey.children_map) as YChildrenMap;
- const textMap = meta.get(YjsEditorKey.text_map) as YTextMap;
-
- return yDataToSlateContent({
- blocks,
- rootId: pageId,
- childrenMap,
- textMap,
- });
+ return yDataToSlateContent(sharedRoot);
}
export function blockToSlateNode (block: BlockJson): Element {
diff --git a/frontend/appflowy_web_app/src/application/slate-yjs/utils/yjsOperations.ts b/frontend/appflowy_web_app/src/application/slate-yjs/utils/yjsOperations.ts
index 903f2a0a67..ccc238a280 100644
--- a/frontend/appflowy_web_app/src/application/slate-yjs/utils/yjsOperations.ts
+++ b/frontend/appflowy_web_app/src/application/slate-yjs/utils/yjsOperations.ts
@@ -1176,6 +1176,11 @@ export function getBlocks (sharedRoot: YSharedRoot) {
export function getPageId (sharedRoot: YSharedRoot) {
const document = getDocument(sharedRoot);
+
+ if (!document) {
+ throw new Error('Document not found');
+ }
+
const pageId = document.get(YjsEditorKey.page_id) as string;
return pageId;
diff --git a/frontend/appflowy_web_app/src/application/types.ts b/frontend/appflowy_web_app/src/application/types.ts
index 3527213049..8784d3f445 100644
--- a/frontend/appflowy_web_app/src/application/types.ts
+++ b/frontend/appflowy_web_app/src/application/types.ts
@@ -35,6 +35,7 @@ export enum BlockType {
LinkPreview = 'link_preview',
FileBlock = 'file',
GalleryBlock = 'multi_image',
+ SubpageBlock = 'sub_page',
}
export enum InlineBlockType {
@@ -151,14 +152,20 @@ export interface DatabaseNodeData extends BlockData {
view_id: ViewId;
}
+export interface SubpageNodeData extends BlockData {
+ view_id: string;
+}
+
export enum MentionType {
PageRef = 'page',
Date = 'date',
+ childPage = 'childPage'
}
export interface Mention {
// inline page ref id
page_id?: string;
+ block_id?: string;
// reminder date ref id
date?: string;
reminder_id?: string;
@@ -294,6 +301,7 @@ export enum YjsDatabaseKey {
show_week_numbers = 'show_week_numbers',
show_weekends = 'show_weekends',
layout_ty = 'layout_ty',
+ icon = 'icon',
}
export interface YDoc extends Y.Doc {
@@ -596,6 +604,9 @@ export interface YDatabaseField extends Y.Map<unknown> {
get (key: YjsDatabaseKey.id): FieldId;
+ // eslint-disable-next-line @typescript-eslint/unified-signatures
+ get (key: YjsDatabaseKey.icon): string;
+
// eslint-disable-next-line @typescript-eslint/unified-signatures
get (key: YjsDatabaseKey.type): string;
@@ -644,7 +655,7 @@ export enum CollabOrigin {
Local = 'local',
// from remote changes and never sync to remote.
Remote = 'remote',
-
+
}
export const layoutMap = {
@@ -790,6 +801,8 @@ export interface View {
is_published: boolean;
is_private: boolean;
last_edited_time?: string;
+ favorited_at?: string;
+ last_viewed_at?: string;
created_at?: string;
database_relations?: DatabaseRelations;
}
diff --git a/frontend/appflowy_web_app/src/assets/debug.svg b/frontend/appflowy_web_app/src/assets/debug.svg
index 643edfbd23..5d3c014583 100644
--- a/frontend/appflowy_web_app/src/assets/debug.svg
+++ b/frontend/appflowy_web_app/src/assets/debug.svg
@@ -1,20 +1,22 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
-<g clip-path="url(#clip0_51_8)">
-<path d="M12.7861 10.0512V7.95725C12.7861 6.47044 11.5807 5.26513 10.0939 5.26513H5.90618C4.4193 5.26513 3.21399 6.47044 3.21399 7.95725V10.0512C3.21399 12.6944 5.3568 14.8372 8.00005 14.8372C10.6433 14.8372 12.7861 12.6944 12.7861 10.0512Z" stroke="black"/>
-<path d="M11.0767 5.607V4.92325C11.0767 3.224 9.69922 1.8465 7.99997 1.8465C6.30072 1.8465 4.92322 3.224 4.92322 4.92325V5.607" stroke="black"/>
-<path d="M12.786 9.36744H14.8371" stroke="black" stroke-linecap="round"/>
-<path d="M3.21397 9.36744H1.16284" stroke="black" stroke-linecap="round"/>
-<path d="M9.70935 2.18837L11.4187 1.16281" stroke="black" stroke-linecap="round"/>
-<path d="M6.29073 2.18837L4.58142 1.16281" stroke="black" stroke-linecap="round"/>
-<path d="M13.8117 13.4699L12.4442 12.9229" stroke="black" stroke-linecap="round"/>
-<path d="M13.8117 5.265L12.4442 5.81194" stroke="black" stroke-linecap="round"/>
-<path d="M2.18835 13.4699L3.55579 12.9229" stroke="black" stroke-linecap="round"/>
-<path d="M2.18835 5.265L3.55579 5.81194" stroke="black" stroke-linecap="round"/>
-<path d="M8 14.4954V10.0512" stroke="black" stroke-linecap="round"/>
-</g>
-<defs>
-<clipPath id="clip0_51_8">
-<rect width="16" height="16" fill="white"/>
-</clipPath>
-</defs>
+ <g clip-path="url(#clip0_51_8)">
+ <path d="M12.7861 10.0512V7.95725C12.7861 6.47044 11.5807 5.26513 10.0939 5.26513H5.90618C4.4193 5.26513 3.21399 6.47044 3.21399 7.95725V10.0512C3.21399 12.6944 5.3568 14.8372 8.00005 14.8372C10.6433 14.8372 12.7861 12.6944 12.7861 10.0512Z"
+ stroke="currentColor"/>
+ <path d="M11.0767 5.607V4.92325C11.0767 3.224 9.69922 1.8465 7.99997 1.8465C6.30072 1.8465 4.92322 3.224 4.92322 4.92325V5.607"
+ stroke="currentColor"/>
+ <path d="M12.786 9.36744H14.8371" stroke="currentColor" stroke-linecap="round"/>
+ <path d="M3.21397 9.36744H1.16284" stroke="currentColor" stroke-linecap="round"/>
+ <path d="M9.70935 2.18837L11.4187 1.16281" stroke="currentColor" stroke-linecap="round"/>
+ <path d="M6.29073 2.18837L4.58142 1.16281" stroke="currentColor" stroke-linecap="round"/>
+ <path d="M13.8117 13.4699L12.4442 12.9229" stroke="currentColor" stroke-linecap="round"/>
+ <path d="M13.8117 5.265L12.4442 5.81194" stroke="currentColor" stroke-linecap="round"/>
+ <path d="M2.18835 13.4699L3.55579 12.9229" stroke="currentColor" stroke-linecap="round"/>
+ <path d="M2.18835 5.265L3.55579 5.81194" stroke="currentColor" stroke-linecap="round"/>
+ <path d="M8 14.4954V10.0512" stroke="currentColor" stroke-linecap="round"/>
+ </g>
+ <defs>
+ <clipPath id="clip0_51_8">
+ <rect width="16" height="16" fill="white"/>
+ </clipPath>
+ </defs>
</svg>
diff --git a/frontend/appflowy_web_app/src/assets/message_support.svg b/frontend/appflowy_web_app/src/assets/message_support.svg
index 03e72384d7..15a2871eaf 100644
--- a/frontend/appflowy_web_app/src/assets/message_support.svg
+++ b/frontend/appflowy_web_app/src/assets/message_support.svg
@@ -1,12 +1,14 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
-<g clip-path="url(#clip0_51_4)">
-<path d="M5.47817 13.2508C9.79161 15.4635 14.8829 12.177 14.6424 7.33506C14.4019 2.49313 9.01011 -0.272812 4.93711 2.35644C2.21798 4.11169 1.27198 7.64219 2.74917 10.5218L1.34973 14.6503L5.47817 13.2508Z" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M6.31091 5.55369C6.84716 4.02931 8.83254 3.65706 9.88454 4.88369C10.2117 5.265 10.3911 5.75106 10.3904 6.25344C10.3904 7.65294 8.29116 8.35262 8.29116 8.35262" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M8.34705 11.1516H8.35405" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
-</g>
-<defs>
-<clipPath id="clip0_51_4">
-<rect width="16" height="16" fill="white"/>
-</clipPath>
-</defs>
+ <g clip-path="url(#clip0_51_4)">
+ <path d="M5.47817 13.2508C9.79161 15.4635 14.8829 12.177 14.6424 7.33506C14.4019 2.49313 9.01011 -0.272812 4.93711 2.35644C2.21798 4.11169 1.27198 7.64219 2.74917 10.5218L1.34973 14.6503L5.47817 13.2508Z"
+ stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
+ <path d="M6.31091 5.55369C6.84716 4.02931 8.83254 3.65706 9.88454 4.88369C10.2117 5.265 10.3911 5.75106 10.3904 6.25344C10.3904 7.65294 8.29116 8.35262 8.29116 8.35262"
+ stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
+ <path d="M8.34705 11.1516H8.35405" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
+ </g>
+ <defs>
+ <clipPath id="clip0_51_4">
+ <rect width="16" height="16" fill="white"/>
+ </clipPath>
+ </defs>
</svg>
diff --git a/frontend/appflowy_web_app/src/assets/north_east.svg b/frontend/appflowy_web_app/src/assets/north_east.svg
new file mode 100644
index 0000000000..c41ad93878
--- /dev/null
+++ b/frontend/appflowy_web_app/src/assets/north_east.svg
@@ -0,0 +1,6 @@
+<svg role="graphics-symbol" viewBox="0 0 13 13"
+ style="width:0.7em;height:0.7em;display:block;fill:rgba(55, 53, 47, 1);flex-shrink:0;position:absolute;right:-0.2em;bottom:0;stroke:white;stroke-width:1.5"
+ class="pageLinkIndicator">
+ <path d="M6.30826 4.43292L1.76184 8.98454C1.76176 8.98462 1.76169 8.9847 1.76161 8.98477C1.76158 8.9848 1.76156 8.98482 1.76154 8.98484C1.46068 9.28584 1.25 9.6914 1.25 10.1565C1.25 10.6117 1.45865 11.0119 1.73417 11.2886C2.01014 11.5658 2.41107 11.7773 2.87078 11.7773C3.34169 11.7773 3.73758 11.5617 4.03477 11.2733L4.03482 11.2734L4.04244 11.2657L8.58864 6.72474V8.667C8.58864 9.51956 9.22729 10.2935 10.1521 10.2935C11.0528 10.2935 11.75 9.54534 11.75 8.66127V2.92671C11.75 2.48722 11.5981 2.06381 11.2838 1.74808C10.9689 1.43182 10.5446 1.27728 10.1006 1.27728H4.36028C3.46161 1.27728 2.72804 1.97749 2.72804 2.86942C2.72804 3.79734 3.51104 4.43292 4.35455 4.43292H6.30826Z"
+ fill="currentColor" stroke="white" stroke-width="1.5"></path>
+</svg>
\ No newline at end of file
diff --git a/frontend/appflowy_web_app/src/assets/paragraph_mark.svg b/frontend/appflowy_web_app/src/assets/paragraph_mark.svg
new file mode 100644
index 0000000000..f239fac179
--- /dev/null
+++ b/frontend/appflowy_web_app/src/assets/paragraph_mark.svg
@@ -0,0 +1,4 @@
+<svg width="9" height="10" viewBox="0 0 9 10" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <path d="M4.05969 10C3.92616 10 3.81509 9.95506 3.72656 9.86516C3.63803 9.77537 3.59375 9.66406 3.59375 9.53125V5.9375H2.96875C2.14741 5.9375 1.44725 5.64788 0.868281 5.06859C0.289428 4.48944 0 3.78891 0 2.96703C0 2.14525 0.289428 1.44531 0.868281 0.867188C1.44725 0.289062 2.14741 0 2.96875 0H8.28125C8.41406 0 8.52541 0.0452093 8.61531 0.135625C8.70509 0.225937 8.75 0.337916 8.75 0.471562C8.75 0.605103 8.70509 0.716156 8.61531 0.804688C8.52541 0.893219 8.41406 0.9375 8.28125 0.9375H7.03125V9.53125C7.03125 9.66406 6.98603 9.77537 6.89563 9.86516C6.80531 9.95506 6.69334 10 6.55969 10C6.42616 10 6.31509 9.95506 6.22656 9.86516C6.13803 9.77537 6.09375 9.66406 6.09375 9.53125V0.9375H4.53125V9.53125C4.53125 9.66406 4.48603 9.77537 4.39563 9.86516C4.30531 9.95506 4.19334 10 4.05969 10Z"
+ fill="currentColor"/>
+</svg>
diff --git a/frontend/appflowy_web_app/src/assets/settings_more.svg b/frontend/appflowy_web_app/src/assets/settings_more.svg
new file mode 100644
index 0000000000..294ec4850b
--- /dev/null
+++ b/frontend/appflowy_web_app/src/assets/settings_more.svg
@@ -0,0 +1,10 @@
+<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <path d="M10.964 20.1331C16.0057 20.1331 20.1307 16.0081 20.1307 10.9665C20.1307 5.9248 16.0057 1.7998 10.964 1.7998C5.92236 1.7998 1.79736 5.9248 1.79736 10.9665C1.79736 16.0081 5.92236 20.1331 10.964 20.1331Z"
+ stroke="currentColor" stroke-width="1.375" stroke-linecap="round" stroke-linejoin="round"/>
+ <path d="M6.7606 11.4167H6.77707" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"
+ stroke-linejoin="round"/>
+ <path d="M10.9906 11.4167H11.007" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"
+ stroke-linejoin="round"/>
+ <path d="M15.2201 11.4167H15.2365" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"
+ stroke-linejoin="round"/>
+</svg>
diff --git a/frontend/appflowy_web_app/src/assets/space_icon/space_icon_1.svg b/frontend/appflowy_web_app/src/assets/space_icon/space_icon_1.svg
index bfb045fedc..113117df71 100644
--- a/frontend/appflowy_web_app/src/assets/space_icon/space_icon_1.svg
+++ b/frontend/appflowy_web_app/src/assets/space_icon/space_icon_1.svg
@@ -1,11 +1,12 @@
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
-<rect width="28" height="28" rx="8" fill="none"/>
-<g clip-path="url(#clip0_474_78597)">
-<path d="M19.7487 11.6337C19.0487 8.55366 16.362 7.16699 14.002 7.16699C14.002 7.16699 14.002 7.16699 13.9953 7.16699C11.642 7.16699 8.94868 8.54699 8.24868 11.627C7.46868 15.067 9.57535 17.9803 11.482 19.8137C12.1887 20.4937 13.0954 20.8337 14.002 20.8337C14.9087 20.8337 15.8154 20.4937 16.5154 19.8137C18.422 17.9803 20.5287 15.0737 19.7487 11.6337ZM14.002 14.9737C12.842 14.9737 11.902 14.0337 11.902 12.8737C11.902 11.7137 12.842 10.7737 14.002 10.7737C15.162 10.7737 16.102 11.7137 16.102 12.8737C16.102 14.0337 15.162 14.9737 14.002 14.9737Z" fill="white"/>
-</g>
-<defs>
-<clipPath id="clip0_474_78597">
-<rect width="16" height="16" fill="white" transform="translate(6 6)"/>
-</clipPath>
-</defs>
+ <rect width="28" height="28" rx="8" fill="none"/>
+ <g clip-path="url(#clip0_474_78597)">
+ <path d="M19.7487 11.6337C19.0487 8.55366 16.362 7.16699 14.002 7.16699C14.002 7.16699 14.002 7.16699 13.9953 7.16699C11.642 7.16699 8.94868 8.54699 8.24868 11.627C7.46868 15.067 9.57535 17.9803 11.482 19.8137C12.1887 20.4937 13.0954 20.8337 14.002 20.8337C14.9087 20.8337 15.8154 20.4937 16.5154 19.8137C18.422 17.9803 20.5287 15.0737 19.7487 11.6337ZM14.002 14.9737C12.842 14.9737 11.902 14.0337 11.902 12.8737C11.902 11.7137 12.842 10.7737 14.002 10.7737C15.162 10.7737 16.102 11.7137 16.102 12.8737C16.102 14.0337 15.162 14.9737 14.002 14.9737Z"
+ fill="var(--content-on-fill)"/>
+ </g>
+ <defs>
+ <clipPath id="clip0_474_78597">
+ <rect width="16" height="16" fill="var(--content-on-fill)" transform="translate(6 6)"/>
+ </clipPath>
+ </defs>
</svg>
diff --git a/frontend/appflowy_web_app/src/assets/space_icon/space_icon_11.svg b/frontend/appflowy_web_app/src/assets/space_icon/space_icon_11.svg
index bb6ec9dea9..1df59007ce 100644
--- a/frontend/appflowy_web_app/src/assets/space_icon/space_icon_11.svg
+++ b/frontend/appflowy_web_app/src/assets/space_icon/space_icon_11.svg
@@ -1,4 +1,5 @@
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
-<rect width="28" height="28" rx="8" fill="#none"/>
-<path d="M16.762 7.97336L10.742 9.97336C6.69536 11.3267 6.69536 13.5334 10.742 14.88L12.5287 15.4734L13.122 17.26C14.4687 21.3067 16.682 21.3067 18.0287 17.26L20.0354 11.2467C20.9287 8.5467 19.462 7.07336 16.762 7.97336ZM16.9754 11.56L14.442 14.1067C14.342 14.2067 14.2154 14.2534 14.0887 14.2534C13.962 14.2534 13.8354 14.2067 13.7354 14.1067C13.542 13.9134 13.542 13.5934 13.7354 13.4L16.2687 10.8534C16.462 10.66 16.782 10.66 16.9754 10.8534C17.1687 11.0467 17.1687 11.3667 16.9754 11.56Z" fill="white"/>
+ <rect width="28" height="28" rx="8" fill="#none"/>
+ <path d="M16.762 7.97336L10.742 9.97336C6.69536 11.3267 6.69536 13.5334 10.742 14.88L12.5287 15.4734L13.122 17.26C14.4687 21.3067 16.682 21.3067 18.0287 17.26L20.0354 11.2467C20.9287 8.5467 19.462 7.07336 16.762 7.97336ZM16.9754 11.56L14.442 14.1067C14.342 14.2067 14.2154 14.2534 14.0887 14.2534C13.962 14.2534 13.8354 14.2067 13.7354 14.1067C13.542 13.9134 13.542 13.5934 13.7354 13.4L16.2687 10.8534C16.462 10.66 16.782 10.66 16.9754 10.8534C17.1687 11.0467 17.1687 11.3667 16.9754 11.56Z"
+ fill="var(--content-on-fill)"/>
</svg>
diff --git a/frontend/appflowy_web_app/src/assets/space_icon/space_icon_12.svg b/frontend/appflowy_web_app/src/assets/space_icon/space_icon_12.svg
index a10232d2f0..6ad8b6465c 100644
--- a/frontend/appflowy_web_app/src/assets/space_icon/space_icon_12.svg
+++ b/frontend/appflowy_web_app/src/assets/space_icon/space_icon_12.svg
@@ -1,6 +1,9 @@
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
-<rect width="28" height="28" rx="8" fill="#none"/>
-<path d="M15.811 18.6651C16.0762 18.5617 16.3826 18.7877 16.3257 19.0667C15.9991 20.3333 15.2657 20.6667 14.3657 20.6667H13.6391C12.7391 20.6667 11.9991 20.3333 11.6791 19.06C11.6242 18.7806 11.9291 18.5565 12.1942 18.6603C12.7639 18.8835 13.3729 19 13.9991 19C14.6282 19 15.2403 18.8876 15.811 18.6651Z" fill="white"/>
-<path d="M16.3285 8.93301C16.3874 9.21481 16.0768 9.44428 15.8089 9.33882C15.2504 9.11895 14.641 8.99967 14.0018 8.99967C13.3634 8.99967 12.7552 9.12043 12.1963 9.34052C11.931 9.44496 11.6249 9.21901 11.6818 8.93967C12.0018 7.66634 12.7418 7.33301 13.6418 7.33301H14.3685C15.2685 7.33301 16.0018 7.66634 16.3285 8.93301Z" fill="white"/>
-<path d="M14.0013 9.66699C11.608 9.66699 9.66797 11.607 9.66797 14.0003C9.66797 15.4003 10.328 16.6403 11.3546 17.4337H11.3613C12.0946 18.0003 13.008 18.3337 14.0013 18.3337C15.008 18.3337 15.928 17.9937 16.6613 17.4203H16.668C17.6813 16.627 18.3346 15.387 18.3346 14.0003C18.3346 11.607 16.3946 9.66699 14.0013 9.66699ZM15.288 15.587C15.188 15.687 15.0613 15.7337 14.9346 15.7337C14.808 15.7337 14.6813 15.687 14.5813 15.587L13.648 14.6537C13.5546 14.5603 13.5013 14.4337 13.5013 14.3003V12.4403C13.5013 12.167 13.728 11.9403 14.0013 11.9403C14.2746 11.9403 14.5013 12.167 14.5013 12.4403V14.0937L15.288 14.8803C15.4813 15.0737 15.4813 15.3937 15.288 15.587Z" fill="white"/>
+ <rect width="28" height="28" rx="8" fill="#none"/>
+ <path d="M15.811 18.6651C16.0762 18.5617 16.3826 18.7877 16.3257 19.0667C15.9991 20.3333 15.2657 20.6667 14.3657 20.6667H13.6391C12.7391 20.6667 11.9991 20.3333 11.6791 19.06C11.6242 18.7806 11.9291 18.5565 12.1942 18.6603C12.7639 18.8835 13.3729 19 13.9991 19C14.6282 19 15.2403 18.8876 15.811 18.6651Z"
+ fill="var(--content-on-fill)"/>
+ <path d="M16.3285 8.93301C16.3874 9.21481 16.0768 9.44428 15.8089 9.33882C15.2504 9.11895 14.641 8.99967 14.0018 8.99967C13.3634 8.99967 12.7552 9.12043 12.1963 9.34052C11.931 9.44496 11.6249 9.21901 11.6818 8.93967C12.0018 7.66634 12.7418 7.33301 13.6418 7.33301H14.3685C15.2685 7.33301 16.0018 7.66634 16.3285 8.93301Z"
+ fill="var(--content-on-fill)"/>
+ <path d="M14.0013 9.66699C11.608 9.66699 9.66797 11.607 9.66797 14.0003C9.66797 15.4003 10.328 16.6403 11.3546 17.4337H11.3613C12.0946 18.0003 13.008 18.3337 14.0013 18.3337C15.008 18.3337 15.928 17.9937 16.6613 17.4203H16.668C17.6813 16.627 18.3346 15.387 18.3346 14.0003C18.3346 11.607 16.3946 9.66699 14.0013 9.66699ZM15.288 15.587C15.188 15.687 15.0613 15.7337 14.9346 15.7337C14.808 15.7337 14.6813 15.687 14.5813 15.587L13.648 14.6537C13.5546 14.5603 13.5013 14.4337 13.5013 14.3003V12.4403C13.5013 12.167 13.728 11.9403 14.0013 11.9403C14.2746 11.9403 14.5013 12.167 14.5013 12.4403V14.0937L15.288 14.8803C15.4813 15.0737 15.4813 15.3937 15.288 15.587Z"
+ fill="var(--content-on-fill)"/>
</svg>
diff --git a/frontend/appflowy_web_app/src/assets/space_icon/space_icon_13.svg b/frontend/appflowy_web_app/src/assets/space_icon/space_icon_13.svg
index da0007d043..bddb6d29c2 100644
--- a/frontend/appflowy_web_app/src/assets/space_icon/space_icon_13.svg
+++ b/frontend/appflowy_web_app/src/assets/space_icon/space_icon_13.svg
@@ -1,5 +1,7 @@
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
-<rect width="28" height="28" rx="8" fill="#none"/>
-<path d="M17.0987 9.81348H10.8987C8.93203 9.81348 7.33203 11.4135 7.33203 13.3801V17.1001C7.33203 19.0668 8.93203 20.6668 10.8987 20.6668H17.0987C19.0654 20.6668 20.6654 19.0668 20.6654 17.1001V13.3801C20.6654 11.4135 19.0654 9.81348 17.0987 9.81348ZM15.6654 14.0135C15.6654 13.6468 15.9654 13.3468 16.332 13.3468C16.6987 13.3468 16.9987 13.6468 16.9987 14.0135C16.9987 14.3801 16.6987 14.6868 16.332 14.6868C15.9654 14.6868 15.6654 14.3935 15.6654 14.0268V14.0135ZM12.752 16.7135C12.652 16.8135 12.5254 16.8601 12.3987 16.8601C12.272 16.8601 12.1454 16.8135 12.0454 16.7135L11.3587 16.0268L10.6987 16.6868C10.5987 16.7868 10.472 16.8335 10.3454 16.8335C10.2187 16.8335 10.092 16.7868 9.99203 16.6868C9.7987 16.4935 9.7987 16.1735 9.99203 15.9801L10.652 15.3201L10.012 14.6801C9.8187 14.4868 9.8187 14.1668 10.012 13.9735C10.2054 13.7801 10.5254 13.7801 10.7187 13.9735L11.3587 14.6135L12.0187 13.9535C12.212 13.7601 12.532 13.7601 12.7254 13.9535C12.9187 14.1468 12.9187 14.4668 12.7254 14.6601L12.0654 15.3201L12.752 16.0068C12.9454 16.2001 12.9454 16.5201 12.752 16.7135ZM15.0254 16.0001C14.6587 16.0001 14.352 15.7001 14.352 15.3335C14.352 14.9668 14.6454 14.6668 15.012 14.6668H15.0254C15.392 14.6668 15.692 14.9668 15.692 15.3335C15.692 15.7001 15.3987 16.0001 15.0254 16.0001ZM16.332 17.3135C15.9654 17.3135 15.6654 17.0201 15.6654 16.6535V16.6401C15.6654 16.2735 15.9654 15.9735 16.332 15.9735C16.6987 15.9735 16.9987 16.2735 16.9987 16.6401C16.9987 17.0068 16.7054 17.3135 16.332 17.3135ZM17.652 16.0001C17.2854 16.0001 16.9787 15.7001 16.9787 15.3335C16.9787 14.9668 17.272 14.6668 17.6387 14.6668H17.652C18.0187 14.6668 18.3187 14.9668 18.3187 15.3335C18.3187 15.7001 18.0254 16.0001 17.652 16.0001Z" fill="white"/>
-<path d="M15.0929 7.80634L15.0863 8.43301C15.0796 9.01967 14.5929 9.50634 13.9996 9.50634C13.8996 9.50634 13.8396 9.57301 13.8396 9.65967C13.8396 9.74634 13.9063 9.81301 13.9929 9.81301H12.9196C12.9129 9.76634 12.9062 9.71301 12.9062 9.65967C12.9062 9.05967 13.3929 8.57301 13.9862 8.57301C14.0862 8.57301 14.1529 8.50634 14.1529 8.41967L14.1596 7.79301C14.1663 7.53967 14.3729 7.33301 14.6263 7.33301H14.6329C14.8929 7.33301 15.0929 7.54634 15.0929 7.80634Z" fill="white"/>
+ <rect width="28" height="28" rx="8" fill="#none"/>
+ <path d="M17.0987 9.81348H10.8987C8.93203 9.81348 7.33203 11.4135 7.33203 13.3801V17.1001C7.33203 19.0668 8.93203 20.6668 10.8987 20.6668H17.0987C19.0654 20.6668 20.6654 19.0668 20.6654 17.1001V13.3801C20.6654 11.4135 19.0654 9.81348 17.0987 9.81348ZM15.6654 14.0135C15.6654 13.6468 15.9654 13.3468 16.332 13.3468C16.6987 13.3468 16.9987 13.6468 16.9987 14.0135C16.9987 14.3801 16.6987 14.6868 16.332 14.6868C15.9654 14.6868 15.6654 14.3935 15.6654 14.0268V14.0135ZM12.752 16.7135C12.652 16.8135 12.5254 16.8601 12.3987 16.8601C12.272 16.8601 12.1454 16.8135 12.0454 16.7135L11.3587 16.0268L10.6987 16.6868C10.5987 16.7868 10.472 16.8335 10.3454 16.8335C10.2187 16.8335 10.092 16.7868 9.99203 16.6868C9.7987 16.4935 9.7987 16.1735 9.99203 15.9801L10.652 15.3201L10.012 14.6801C9.8187 14.4868 9.8187 14.1668 10.012 13.9735C10.2054 13.7801 10.5254 13.7801 10.7187 13.9735L11.3587 14.6135L12.0187 13.9535C12.212 13.7601 12.532 13.7601 12.7254 13.9535C12.9187 14.1468 12.9187 14.4668 12.7254 14.6601L12.0654 15.3201L12.752 16.0068C12.9454 16.2001 12.9454 16.5201 12.752 16.7135ZM15.0254 16.0001C14.6587 16.0001 14.352 15.7001 14.352 15.3335C14.352 14.9668 14.6454 14.6668 15.012 14.6668H15.0254C15.392 14.6668 15.692 14.9668 15.692 15.3335C15.692 15.7001 15.3987 16.0001 15.0254 16.0001ZM16.332 17.3135C15.9654 17.3135 15.6654 17.0201 15.6654 16.6535V16.6401C15.6654 16.2735 15.9654 15.9735 16.332 15.9735C16.6987 15.9735 16.9987 16.2735 16.9987 16.6401C16.9987 17.0068 16.7054 17.3135 16.332 17.3135ZM17.652 16.0001C17.2854 16.0001 16.9787 15.7001 16.9787 15.3335C16.9787 14.9668 17.272 14.6668 17.6387 14.6668H17.652C18.0187 14.6668 18.3187 14.9668 18.3187 15.3335C18.3187 15.7001 18.0254 16.0001 17.652 16.0001Z"
+ fill="var(--content-on-fill)"/>
+ <path d="M15.0929 7.80634L15.0863 8.43301C15.0796 9.01967 14.5929 9.50634 13.9996 9.50634C13.8996 9.50634 13.8396 9.57301 13.8396 9.65967C13.8396 9.74634 13.9063 9.81301 13.9929 9.81301H12.9196C12.9129 9.76634 12.9062 9.71301 12.9062 9.65967C12.9062 9.05967 13.3929 8.57301 13.9862 8.57301C14.0862 8.57301 14.1529 8.50634 14.1529 8.41967L14.1596 7.79301C14.1663 7.53967 14.3729 7.33301 14.6263 7.33301H14.6329C14.8929 7.33301 15.0929 7.54634 15.0929 7.80634Z"
+ fill="var(--content-on-fill)"/>
</svg>
diff --git a/frontend/appflowy_web_app/src/assets/space_icon/space_icon_14.svg b/frontend/appflowy_web_app/src/assets/space_icon/space_icon_14.svg
index 80e00912bd..f7fe5fd682 100644
--- a/frontend/appflowy_web_app/src/assets/space_icon/space_icon_14.svg
+++ b/frontend/appflowy_web_app/src/assets/space_icon/space_icon_14.svg
@@ -1,4 +1,5 @@
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
-<rect width="28" height="28" rx="8" fill="#none"/>
-<path d="M19.3644 13.087L16.2511 11.747L15.5578 11.4537C15.4511 11.4004 15.3578 11.2604 15.3578 11.1404V9.10036C15.3578 8.46036 14.8844 7.70036 14.3111 7.40703C14.1111 7.30703 13.8711 7.30703 13.6711 7.40703C13.1044 7.70036 12.6311 8.46703 12.6311 9.10703V11.147C12.6311 11.267 12.5378 11.407 12.4311 11.4604L8.63109 13.0937C8.21109 13.267 7.87109 13.7937 7.87109 14.247V15.127C7.87109 15.6937 8.29776 15.9737 8.82443 15.747L12.1644 14.307C12.4244 14.1937 12.6378 14.3337 12.6378 14.6204V15.3604V16.5604C12.6378 16.7137 12.5511 16.9337 12.4444 17.0404L10.8978 18.5937C10.7378 18.7537 10.6644 19.067 10.7378 19.2937L11.0378 20.2004C11.1578 20.5937 11.6044 20.7804 11.9711 20.5937L13.5578 19.2604C13.7978 19.0537 14.1911 19.0537 14.4311 19.2604L16.0178 20.5937C16.3844 20.7737 16.8311 20.5937 16.9644 20.2004L17.2644 19.2937C17.3378 19.0737 17.2644 18.7537 17.1044 18.5937L15.5578 17.0404C15.4444 16.9337 15.3578 16.7137 15.3578 16.5604V14.6204C15.3578 14.3337 15.5644 14.2004 15.8311 14.307L19.1711 15.747C19.6978 15.9737 20.1244 15.6937 20.1244 15.127V14.247C20.1244 13.7937 19.7844 13.267 19.3644 13.087Z" fill="white"/>
+ <rect width="28" height="28" rx="8" fill="#none"/>
+ <path d="M19.3644 13.087L16.2511 11.747L15.5578 11.4537C15.4511 11.4004 15.3578 11.2604 15.3578 11.1404V9.10036C15.3578 8.46036 14.8844 7.70036 14.3111 7.40703C14.1111 7.30703 13.8711 7.30703 13.6711 7.40703C13.1044 7.70036 12.6311 8.46703 12.6311 9.10703V11.147C12.6311 11.267 12.5378 11.407 12.4311 11.4604L8.63109 13.0937C8.21109 13.267 7.87109 13.7937 7.87109 14.247V15.127C7.87109 15.6937 8.29776 15.9737 8.82443 15.747L12.1644 14.307C12.4244 14.1937 12.6378 14.3337 12.6378 14.6204V15.3604V16.5604C12.6378 16.7137 12.5511 16.9337 12.4444 17.0404L10.8978 18.5937C10.7378 18.7537 10.6644 19.067 10.7378 19.2937L11.0378 20.2004C11.1578 20.5937 11.6044 20.7804 11.9711 20.5937L13.5578 19.2604C13.7978 19.0537 14.1911 19.0537 14.4311 19.2604L16.0178 20.5937C16.3844 20.7737 16.8311 20.5937 16.9644 20.2004L17.2644 19.2937C17.3378 19.0737 17.2644 18.7537 17.1044 18.5937L15.5578 17.0404C15.4444 16.9337 15.3578 16.7137 15.3578 16.5604V14.6204C15.3578 14.3337 15.5644 14.2004 15.8311 14.307L19.1711 15.747C19.6978 15.9737 20.1244 15.6937 20.1244 15.127V14.247C20.1244 13.7937 19.7844 13.267 19.3644 13.087Z"
+ fill="var(--content-on-fill)"/>
</svg>
diff --git a/frontend/appflowy_web_app/src/assets/space_icon/space_icon_15.svg b/frontend/appflowy_web_app/src/assets/space_icon/space_icon_15.svg
index dcd06dc4b4..825dffefb9 100644
--- a/frontend/appflowy_web_app/src/assets/space_icon/space_icon_15.svg
+++ b/frontend/appflowy_web_app/src/assets/space_icon/space_icon_15.svg
@@ -1,5 +1,7 @@
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
-<rect width="28" height="28" rx="8" fill="#none"/>
-<path d="M19.6875 11.6672C19.6875 11.9064 19.4892 12.1047 19.25 12.1047H8.75C8.51083 12.1047 8.3125 11.9064 8.3125 11.6672C8.3125 11.428 8.51083 11.2297 8.75 11.2297H9.345L9.56667 10.1739C9.77667 9.15303 10.2142 8.21387 11.9525 8.21387H16.0475C17.7858 8.21387 18.2233 9.15303 18.4333 10.1739L18.655 11.2297H19.25C19.4892 11.2297 19.6875 11.428 19.6875 11.6672Z" fill="white"/>
-<path d="M19.9405 14.9687C19.853 14.0062 19.5964 12.9795 17.7239 12.9795H10.2805C8.40804 12.9795 8.15721 14.0062 8.06387 14.9687L7.73721 18.5212C7.69637 18.9645 7.84221 19.4078 8.14554 19.7403C8.45471 20.0787 8.89221 20.2712 9.35887 20.2712H10.4555C11.4005 20.2712 11.5814 19.7287 11.698 19.3728L11.8147 19.0228C11.9489 18.6203 11.9839 18.5212 12.5089 18.5212H15.4955C16.0205 18.5212 16.038 18.5795 16.1897 19.0228L16.3064 19.3728C16.423 19.7287 16.6039 20.2712 17.5489 20.2712H18.6455C19.1064 20.2712 19.5497 20.0787 19.8589 19.7403C20.1622 19.4078 20.308 18.9645 20.2672 18.5212L19.9405 14.9687ZM12.2522 16.1878H10.5022C10.263 16.1878 10.0647 15.9895 10.0647 15.7503C10.0647 15.5112 10.263 15.3128 10.5022 15.3128H12.2522C12.4914 15.3128 12.6897 15.5112 12.6897 15.7503C12.6897 15.9895 12.4914 16.1878 12.2522 16.1878ZM17.5022 16.1878H15.7522C15.513 16.1878 15.3147 15.9895 15.3147 15.7503C15.3147 15.5112 15.513 15.3128 15.7522 15.3128H17.5022C17.7414 15.3128 17.9397 15.5112 17.9397 15.7503C17.9397 15.9895 17.7414 16.1878 17.5022 16.1878Z" fill="white"/>
+ <rect width="28" height="28" rx="8" fill="#none"/>
+ <path d="M19.6875 11.6672C19.6875 11.9064 19.4892 12.1047 19.25 12.1047H8.75C8.51083 12.1047 8.3125 11.9064 8.3125 11.6672C8.3125 11.428 8.51083 11.2297 8.75 11.2297H9.345L9.56667 10.1739C9.77667 9.15303 10.2142 8.21387 11.9525 8.21387H16.0475C17.7858 8.21387 18.2233 9.15303 18.4333 10.1739L18.655 11.2297H19.25C19.4892 11.2297 19.6875 11.428 19.6875 11.6672Z"
+ fill="var(--content-on-fill)"/>
+ <path d="M19.9405 14.9687C19.853 14.0062 19.5964 12.9795 17.7239 12.9795H10.2805C8.40804 12.9795 8.15721 14.0062 8.06387 14.9687L7.73721 18.5212C7.69637 18.9645 7.84221 19.4078 8.14554 19.7403C8.45471 20.0787 8.89221 20.2712 9.35887 20.2712H10.4555C11.4005 20.2712 11.5814 19.7287 11.698 19.3728L11.8147 19.0228C11.9489 18.6203 11.9839 18.5212 12.5089 18.5212H15.4955C16.0205 18.5212 16.038 18.5795 16.1897 19.0228L16.3064 19.3728C16.423 19.7287 16.6039 20.2712 17.5489 20.2712H18.6455C19.1064 20.2712 19.5497 20.0787 19.8589 19.7403C20.1622 19.4078 20.308 18.9645 20.2672 18.5212L19.9405 14.9687ZM12.2522 16.1878H10.5022C10.263 16.1878 10.0647 15.9895 10.0647 15.7503C10.0647 15.5112 10.263 15.3128 10.5022 15.3128H12.2522C12.4914 15.3128 12.6897 15.5112 12.6897 15.7503C12.6897 15.9895 12.4914 16.1878 12.2522 16.1878ZM17.5022 16.1878H15.7522C15.513 16.1878 15.3147 15.9895 15.3147 15.7503C15.3147 15.5112 15.513 15.3128 15.7522 15.3128H17.5022C17.7414 15.3128 17.9397 15.5112 17.9397 15.7503C17.9397 15.9895 17.7414 16.1878 17.5022 16.1878Z"
+ fill="var(--content-on-fill)"/>
</svg>
diff --git a/frontend/appflowy_web_app/src/assets/space_icon/space_icon_2.svg b/frontend/appflowy_web_app/src/assets/space_icon/space_icon_2.svg
index ecfd797076..3ca8e499ab 100644
--- a/frontend/appflowy_web_app/src/assets/space_icon/space_icon_2.svg
+++ b/frontend/appflowy_web_app/src/assets/space_icon/space_icon_2.svg
@@ -1,4 +1,6 @@
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
-<path d="M18.5352 12.6064C17.7818 12.6064 17.1085 12.9731 16.6885 13.5331C16.2685 12.9731 15.5952 12.6064 14.8418 12.6064C13.5685 12.6064 12.5352 13.6464 12.5352 14.9264C12.5352 15.4198 12.6152 15.8798 12.7485 16.2998C13.4018 18.3731 15.4285 19.6198 16.4285 19.9598C16.5685 20.0064 16.8018 20.0064 16.9418 19.9598C17.9418 19.6198 19.9685 18.3798 20.6218 16.2998C20.7618 15.8731 20.8352 15.4198 20.8352 14.9264C20.8418 13.6464 19.8085 12.6064 18.5352 12.6064Z" fill="white"/>
-<path d="M19.832 11.5597C19.832 11.7131 19.6787 11.8131 19.532 11.7731C18.632 11.5397 17.6454 11.7331 16.8987 12.2664C16.752 12.3731 16.552 12.3731 16.412 12.2664C15.8854 11.8797 15.2454 11.6664 14.572 11.6664C12.852 11.6664 11.452 13.0731 11.452 14.8064C11.452 16.6864 12.352 18.0931 13.2587 19.0331C13.3054 19.0797 13.2654 19.1597 13.2054 19.1331C11.3854 18.5131 7.33203 15.9397 7.33203 11.5597C7.33203 9.62641 8.88536 8.06641 10.8054 8.06641C11.9454 8.06641 12.952 8.61307 13.5854 9.45974C14.2254 8.61307 15.232 8.06641 16.3654 8.06641C18.2787 8.06641 19.832 9.62641 19.832 11.5597Z" fill="white"/>
+ <path d="M18.5352 12.6064C17.7818 12.6064 17.1085 12.9731 16.6885 13.5331C16.2685 12.9731 15.5952 12.6064 14.8418 12.6064C13.5685 12.6064 12.5352 13.6464 12.5352 14.9264C12.5352 15.4198 12.6152 15.8798 12.7485 16.2998C13.4018 18.3731 15.4285 19.6198 16.4285 19.9598C16.5685 20.0064 16.8018 20.0064 16.9418 19.9598C17.9418 19.6198 19.9685 18.3798 20.6218 16.2998C20.7618 15.8731 20.8352 15.4198 20.8352 14.9264C20.8418 13.6464 19.8085 12.6064 18.5352 12.6064Z"
+ fill="var(--content-on-fill)"/>
+ <path d="M19.832 11.5597C19.832 11.7131 19.6787 11.8131 19.532 11.7731C18.632 11.5397 17.6454 11.7331 16.8987 12.2664C16.752 12.3731 16.552 12.3731 16.412 12.2664C15.8854 11.8797 15.2454 11.6664 14.572 11.6664C12.852 11.6664 11.452 13.0731 11.452 14.8064C11.452 16.6864 12.352 18.0931 13.2587 19.0331C13.3054 19.0797 13.2654 19.1597 13.2054 19.1331C11.3854 18.5131 7.33203 15.9397 7.33203 11.5597C7.33203 9.62641 8.88536 8.06641 10.8054 8.06641C11.9454 8.06641 12.952 8.61307 13.5854 9.45974C14.2254 8.61307 15.232 8.06641 16.3654 8.06641C18.2787 8.06641 19.832 9.62641 19.832 11.5597Z"
+ fill="var(--content-on-fill)"/>
</svg>
diff --git a/frontend/appflowy_web_app/src/assets/space_icon/space_icon_3.svg b/frontend/appflowy_web_app/src/assets/space_icon/space_icon_3.svg
index cef3794152..27677d16d6 100644
--- a/frontend/appflowy_web_app/src/assets/space_icon/space_icon_3.svg
+++ b/frontend/appflowy_web_app/src/assets/space_icon/space_icon_3.svg
@@ -1,4 +1,5 @@
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
-<rect width="28" height="28" rx="8" fill="#none"/>
-<path d="M16.392 9.33301H16.1654V7.33301C16.1654 7.05967 15.9387 6.83301 15.6654 6.83301C15.392 6.83301 15.1654 7.05967 15.1654 7.33301V9.33301H12.832V7.33301C12.832 7.05967 12.6054 6.83301 12.332 6.83301C12.0587 6.83301 11.832 7.05967 11.832 7.33301V9.33301H11.6054C10.9054 9.33301 10.332 9.90634 10.332 10.6063V13.9997C10.332 15.4663 11.332 16.6663 12.9987 16.6663H13.4987V20.6663C13.4987 20.9397 13.7254 21.1663 13.9987 21.1663C14.272 21.1663 14.4987 20.9397 14.4987 20.6663V16.6663H14.9987C16.6654 16.6663 17.6654 15.4663 17.6654 13.9997V10.6063C17.6654 9.90634 17.092 9.33301 16.392 9.33301Z" fill="white"/>
+ <rect width="28" height="28" rx="8" fill="#none"/>
+ <path d="M16.392 9.33301H16.1654V7.33301C16.1654 7.05967 15.9387 6.83301 15.6654 6.83301C15.392 6.83301 15.1654 7.05967 15.1654 7.33301V9.33301H12.832V7.33301C12.832 7.05967 12.6054 6.83301 12.332 6.83301C12.0587 6.83301 11.832 7.05967 11.832 7.33301V9.33301H11.6054C10.9054 9.33301 10.332 9.90634 10.332 10.6063V13.9997C10.332 15.4663 11.332 16.6663 12.9987 16.6663H13.4987V20.6663C13.4987 20.9397 13.7254 21.1663 13.9987 21.1663C14.272 21.1663 14.4987 20.9397 14.4987 20.6663V16.6663H14.9987C16.6654 16.6663 17.6654 15.4663 17.6654 13.9997V10.6063C17.6654 9.90634 17.092 9.33301 16.392 9.33301Z"
+ fill="var(--content-on-fill)"/>
</svg>
diff --git a/frontend/appflowy_web_app/src/assets/space_icon/space_icon_4.svg b/frontend/appflowy_web_app/src/assets/space_icon/space_icon_4.svg
index 244db0745e..41f7c4f78e 100644
--- a/frontend/appflowy_web_app/src/assets/space_icon/space_icon_4.svg
+++ b/frontend/appflowy_web_app/src/assets/space_icon/space_icon_4.svg
@@ -1,5 +1,7 @@
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
-<rect width="28" height="28" rx="8" fill="#none"/>
-<path d="M17.5363 21.0612H10.4749C10.1854 21.0612 9.94531 20.8211 9.94531 20.5316C9.94531 20.242 10.1854 20.002 10.4749 20.002H17.5363C17.8258 20.002 18.0659 20.242 18.0659 20.5316C18.0659 20.8211 17.8258 21.0612 17.5363 21.0612Z" fill="white"/>
-<path d="M19.8978 9.42458L17.0733 11.4441C16.699 11.7125 16.1624 11.5501 15.9999 11.1193L14.6653 7.56037C14.4394 6.94602 13.5708 6.94602 13.3449 7.56037L12.0032 11.1123C11.8408 11.5501 11.3112 11.7125 10.9369 11.4371L8.11236 9.41752C7.54745 9.02208 6.79894 9.57993 7.03196 10.2366L9.96951 18.4632C10.0684 18.7456 10.3367 18.9292 10.6333 18.9292H17.3628C17.6594 18.9292 17.9277 18.7386 18.0266 18.4632L20.9641 10.2366C21.2042 9.57993 20.4557 9.02208 19.8978 9.42458ZM15.7669 15.9423H12.2362C11.9467 15.9423 11.7066 15.7022 11.7066 15.4126C11.7066 15.1231 11.9467 14.883 12.2362 14.883H15.7669C16.0564 14.883 16.2965 15.1231 16.2965 15.4126C16.2965 15.7022 16.0564 15.9423 15.7669 15.9423Z" fill="white"/>
+ <rect width="28" height="28" rx="8" fill="#none"/>
+ <path d="M17.5363 21.0612H10.4749C10.1854 21.0612 9.94531 20.8211 9.94531 20.5316C9.94531 20.242 10.1854 20.002 10.4749 20.002H17.5363C17.8258 20.002 18.0659 20.242 18.0659 20.5316C18.0659 20.8211 17.8258 21.0612 17.5363 21.0612Z"
+ fill="var(--content-on-fill)"/>
+ <path d="M19.8978 9.42458L17.0733 11.4441C16.699 11.7125 16.1624 11.5501 15.9999 11.1193L14.6653 7.56037C14.4394 6.94602 13.5708 6.94602 13.3449 7.56037L12.0032 11.1123C11.8408 11.5501 11.3112 11.7125 10.9369 11.4371L8.11236 9.41752C7.54745 9.02208 6.79894 9.57993 7.03196 10.2366L9.96951 18.4632C10.0684 18.7456 10.3367 18.9292 10.6333 18.9292H17.3628C17.6594 18.9292 17.9277 18.7386 18.0266 18.4632L20.9641 10.2366C21.2042 9.57993 20.4557 9.02208 19.8978 9.42458ZM15.7669 15.9423H12.2362C11.9467 15.9423 11.7066 15.7022 11.7066 15.4126C11.7066 15.1231 11.9467 14.883 12.2362 14.883H15.7669C16.0564 14.883 16.2965 15.1231 16.2965 15.4126C16.2965 15.7022 16.0564 15.9423 15.7669 15.9423Z"
+ fill="var(--content-on-fill)"/>
</svg>
diff --git a/frontend/appflowy_web_app/src/assets/space_icon/space_icon_5.svg b/frontend/appflowy_web_app/src/assets/space_icon/space_icon_5.svg
index 0ee1709993..3c1ed3a59b 100644
--- a/frontend/appflowy_web_app/src/assets/space_icon/space_icon_5.svg
+++ b/frontend/appflowy_web_app/src/assets/space_icon/space_icon_5.svg
@@ -1,6 +1,9 @@
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
-<rect width="28" height="28" rx="8" fill="#none"/>
-<path d="M20.1668 18.3137L19.0668 18.5737C18.8202 18.6337 18.6268 18.8204 18.5735 19.0671L18.3402 20.0471C18.2135 20.5804 17.5335 20.7471 17.1802 20.3271L15.1868 18.0337C15.0268 17.8471 15.1135 17.5537 15.3535 17.4937C16.5335 17.2071 17.5935 16.5471 18.3735 15.6071C18.5002 15.4537 18.7268 15.4337 18.8668 15.5737L20.3468 17.0537C20.8535 17.5604 20.6735 18.1937 20.1668 18.3137Z" fill="white"/>
-<path d="M7.79816 18.3137L8.89816 18.5737C9.14482 18.6337 9.33816 18.8204 9.39149 19.0671L9.62482 20.0471C9.75149 20.5804 10.4315 20.7471 10.7848 20.3271L12.7782 18.0337C12.9382 17.8471 12.8515 17.5537 12.6115 17.4937C11.4315 17.2071 10.3715 16.5471 9.59149 15.6071C9.46482 15.4537 9.23816 15.4337 9.09816 15.5737L7.61816 17.0537C7.11149 17.5604 7.29149 18.1937 7.79816 18.3137Z" fill="white"/>
-<path d="M13.9987 7.33301C11.4187 7.33301 9.33203 9.41967 9.33203 11.9997C9.33203 12.9663 9.6187 13.853 10.112 14.593C10.832 15.6597 11.972 16.413 13.2987 16.6063C13.5254 16.6463 13.7587 16.6663 13.9987 16.6663C14.2387 16.6663 14.472 16.6463 14.6987 16.6063C16.0254 16.413 17.1654 15.6597 17.8854 14.593C18.3787 13.853 18.6654 12.9663 18.6654 11.9997C18.6654 9.41967 16.5787 7.33301 13.9987 7.33301ZM16.0387 11.853L15.4854 12.4063C15.392 12.4997 15.3387 12.6797 15.372 12.813L15.532 13.4997C15.6587 14.0397 15.372 14.253 14.892 13.9663L14.2254 13.573C14.1054 13.4997 13.9054 13.4997 13.7854 13.573L13.1187 13.9663C12.6387 14.2463 12.352 14.0397 12.4787 13.4997L12.6387 12.813C12.6654 12.6863 12.6187 12.4997 12.5254 12.4063L11.9587 11.853C11.632 11.5263 11.7387 11.1997 12.192 11.1263L12.9054 11.0063C13.0254 10.9863 13.1654 10.8797 13.2187 10.773L13.612 9.98634C13.8254 9.55967 14.172 9.55967 14.3854 9.98634L14.7787 10.773C14.832 10.8797 14.972 10.9863 15.0987 11.0063L15.812 11.1263C16.2587 11.1997 16.3654 11.5263 16.0387 11.853Z" fill="white"/>
+ <rect width="28" height="28" rx="8" fill="#none"/>
+ <path d="M20.1668 18.3137L19.0668 18.5737C18.8202 18.6337 18.6268 18.8204 18.5735 19.0671L18.3402 20.0471C18.2135 20.5804 17.5335 20.7471 17.1802 20.3271L15.1868 18.0337C15.0268 17.8471 15.1135 17.5537 15.3535 17.4937C16.5335 17.2071 17.5935 16.5471 18.3735 15.6071C18.5002 15.4537 18.7268 15.4337 18.8668 15.5737L20.3468 17.0537C20.8535 17.5604 20.6735 18.1937 20.1668 18.3137Z"
+ fill="var(--content-on-fill)"/>
+ <path d="M7.79816 18.3137L8.89816 18.5737C9.14482 18.6337 9.33816 18.8204 9.39149 19.0671L9.62482 20.0471C9.75149 20.5804 10.4315 20.7471 10.7848 20.3271L12.7782 18.0337C12.9382 17.8471 12.8515 17.5537 12.6115 17.4937C11.4315 17.2071 10.3715 16.5471 9.59149 15.6071C9.46482 15.4537 9.23816 15.4337 9.09816 15.5737L7.61816 17.0537C7.11149 17.5604 7.29149 18.1937 7.79816 18.3137Z"
+ fill="var(--content-on-fill)"/>
+ <path d="M13.9987 7.33301C11.4187 7.33301 9.33203 9.41967 9.33203 11.9997C9.33203 12.9663 9.6187 13.853 10.112 14.593C10.832 15.6597 11.972 16.413 13.2987 16.6063C13.5254 16.6463 13.7587 16.6663 13.9987 16.6663C14.2387 16.6663 14.472 16.6463 14.6987 16.6063C16.0254 16.413 17.1654 15.6597 17.8854 14.593C18.3787 13.853 18.6654 12.9663 18.6654 11.9997C18.6654 9.41967 16.5787 7.33301 13.9987 7.33301ZM16.0387 11.853L15.4854 12.4063C15.392 12.4997 15.3387 12.6797 15.372 12.813L15.532 13.4997C15.6587 14.0397 15.372 14.253 14.892 13.9663L14.2254 13.573C14.1054 13.4997 13.9054 13.4997 13.7854 13.573L13.1187 13.9663C12.6387 14.2463 12.352 14.0397 12.4787 13.4997L12.6387 12.813C12.6654 12.6863 12.6187 12.4997 12.5254 12.4063L11.9587 11.853C11.632 11.5263 11.7387 11.1997 12.192 11.1263L12.9054 11.0063C13.0254 10.9863 13.1654 10.8797 13.2187 10.773L13.612 9.98634C13.8254 9.55967 14.172 9.55967 14.3854 9.98634L14.7787 10.773C14.832 10.8797 14.972 10.9863 15.0987 11.0063L15.812 11.1263C16.2587 11.1997 16.3654 11.5263 16.0387 11.853Z"
+ fill="var(--content-on-fill)"/>
</svg>
diff --git a/frontend/appflowy_web_app/src/assets/space_icon/space_icon_6.svg b/frontend/appflowy_web_app/src/assets/space_icon/space_icon_6.svg
index 66dafd1e7f..f11e6c79c1 100644
--- a/frontend/appflowy_web_app/src/assets/space_icon/space_icon_6.svg
+++ b/frontend/appflowy_web_app/src/assets/space_icon/space_icon_6.svg
@@ -1,5 +1,7 @@
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
-<rect width="28" height="28" rx="8" fill="#none"/>
-<path d="M16.7742 12.667C16.7742 12.667 16.6742 13.3337 14.6076 16.0003C12.6676 18.5137 15.4743 20.427 15.8076 20.647C15.8276 20.6603 15.8476 20.6603 15.8743 20.647C16.3276 20.367 21.3742 17.1203 16.7742 12.667Z" fill="white"/>
-<path d="M15.1732 11.1934C15.1732 9.66004 14.5732 8.26004 13.9732 7.46004C13.7732 7.26004 13.4398 7.32671 13.3732 7.59337C13.1065 8.59337 12.3065 10.7267 10.3732 13.26C7.90651 16.46 10.1732 19.9267 12.5065 20.5934C13.7732 20.9267 12.1732 19.9267 11.9732 17.86C11.7732 15.26 15.1732 13.3267 15.1732 11.1934Z" fill="white"/>
+ <rect width="28" height="28" rx="8" fill="#none"/>
+ <path d="M16.7742 12.667C16.7742 12.667 16.6742 13.3337 14.6076 16.0003C12.6676 18.5137 15.4743 20.427 15.8076 20.647C15.8276 20.6603 15.8476 20.6603 15.8743 20.647C16.3276 20.367 21.3742 17.1203 16.7742 12.667Z"
+ fill="var(--content-on-fill)"/>
+ <path d="M15.1732 11.1934C15.1732 9.66004 14.5732 8.26004 13.9732 7.46004C13.7732 7.26004 13.4398 7.32671 13.3732 7.59337C13.1065 8.59337 12.3065 10.7267 10.3732 13.26C7.90651 16.46 10.1732 19.9267 12.5065 20.5934C13.7732 20.9267 12.1732 19.9267 11.9732 17.86C11.7732 15.26 15.1732 13.3267 15.1732 11.1934Z"
+ fill="var(--content-on-fill)"/>
</svg>
diff --git a/frontend/appflowy_web_app/src/assets/space_icon/space_icon_7.svg b/frontend/appflowy_web_app/src/assets/space_icon/space_icon_7.svg
index 4d7910296b..6213e15975 100644
--- a/frontend/appflowy_web_app/src/assets/space_icon/space_icon_7.svg
+++ b/frontend/appflowy_web_app/src/assets/space_icon/space_icon_7.svg
@@ -1,5 +1,7 @@
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
-<rect width="28" height="28" rx="8" fill="#none"/>
-<path d="M14.3312 9.65319C14.3845 9.65319 14.4379 9.65319 14.4979 9.65986V7.68652C14.4979 7.41319 14.2712 7.18652 13.9979 7.18652C13.7245 7.18652 13.4979 7.41319 13.4979 7.68652V9.65986C13.5512 9.65319 13.6045 9.65319 13.6645 9.65319C10.5912 9.80652 8.14453 12.3399 8.14453 15.4532V16.7465C8.14453 17.4799 8.74453 18.0799 9.47786 18.0799H18.5179C19.2512 18.0799 19.8512 17.4799 19.8512 16.7465V15.4532C19.8512 12.3399 17.4045 9.80652 14.3312 9.65319Z" fill="white"/>
-<path d="M15.8207 18.7402C16.0407 18.7402 16.2007 18.9469 16.1474 19.1602C15.8941 20.1136 15.0274 20.8136 14.0007 20.8136C12.9741 20.8136 12.1074 20.1136 11.8541 19.1602C11.8007 18.9469 11.9607 18.7402 12.1807 18.7402H15.8207Z" fill="white"/>
+ <rect width="28" height="28" rx="8" fill="#none"/>
+ <path d="M14.3312 9.65319C14.3845 9.65319 14.4379 9.65319 14.4979 9.65986V7.68652C14.4979 7.41319 14.2712 7.18652 13.9979 7.18652C13.7245 7.18652 13.4979 7.41319 13.4979 7.68652V9.65986C13.5512 9.65319 13.6045 9.65319 13.6645 9.65319C10.5912 9.80652 8.14453 12.3399 8.14453 15.4532V16.7465C8.14453 17.4799 8.74453 18.0799 9.47786 18.0799H18.5179C19.2512 18.0799 19.8512 17.4799 19.8512 16.7465V15.4532C19.8512 12.3399 17.4045 9.80652 14.3312 9.65319Z"
+ fill="var(--content-on-fill)"/>
+ <path d="M15.8207 18.7402C16.0407 18.7402 16.2007 18.9469 16.1474 19.1602C15.8941 20.1136 15.0274 20.8136 14.0007 20.8136C12.9741 20.8136 12.1074 20.1136 11.8541 19.1602C11.8007 18.9469 11.9607 18.7402 12.1807 18.7402H15.8207Z"
+ fill="var(--content-on-fill)"/>
</svg>
diff --git a/frontend/appflowy_web_app/src/assets/space_icon/space_icon_8.svg b/frontend/appflowy_web_app/src/assets/space_icon/space_icon_8.svg
index 275bb3ae07..8fba4f014d 100644
--- a/frontend/appflowy_web_app/src/assets/space_icon/space_icon_8.svg
+++ b/frontend/appflowy_web_app/src/assets/space_icon/space_icon_8.svg
@@ -1,6 +1,9 @@
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
-<rect width="28" height="28" rx="8" fill="#none"/>
-<path d="M16.7783 12.7069H11.2183C10.4316 12.7069 10.1583 12.1802 10.6183 11.5402L13.3983 7.64687C13.7249 7.18021 14.2716 7.18021 14.5983 7.64687L17.3783 11.5402C17.8383 12.1802 17.5649 12.7069 16.7783 12.7069Z" fill="white"/>
-<path d="M17.7264 18.0004H10.2731C9.21973 18.0004 8.85973 17.3004 9.47973 16.447L12.1397 12.707H15.8597L18.5197 16.447C19.1397 17.3004 18.7797 18.0004 17.7264 18.0004Z" fill="white"/>
-<path d="M14.5 18V20.6667C14.5 20.94 14.2733 21.1667 14 21.1667C13.7267 21.1667 13.5 20.94 13.5 20.6667V18H14.5Z" fill="white"/>
+ <rect width="28" height="28" rx="8" fill="#none"/>
+ <path d="M16.7783 12.7069H11.2183C10.4316 12.7069 10.1583 12.1802 10.6183 11.5402L13.3983 7.64687C13.7249 7.18021 14.2716 7.18021 14.5983 7.64687L17.3783 11.5402C17.8383 12.1802 17.5649 12.7069 16.7783 12.7069Z"
+ fill="var(--content-on-fill)"/>
+ <path d="M17.7264 18.0004H10.2731C9.21973 18.0004 8.85973 17.3004 9.47973 16.447L12.1397 12.707H15.8597L18.5197 16.447C19.1397 17.3004 18.7797 18.0004 17.7264 18.0004Z"
+ fill="var(--content-on-fill)"/>
+ <path d="M14.5 18V20.6667C14.5 20.94 14.2733 21.1667 14 21.1667C13.7267 21.1667 13.5 20.94 13.5 20.6667V18H14.5Z"
+ fill="var(--content-on-fill)"/>
</svg>
diff --git a/frontend/appflowy_web_app/src/assets/space_icon/space_icon_9.svg b/frontend/appflowy_web_app/src/assets/space_icon/space_icon_9.svg
index c2cc63c35a..daf4ca4301 100644
--- a/frontend/appflowy_web_app/src/assets/space_icon/space_icon_9.svg
+++ b/frontend/appflowy_web_app/src/assets/space_icon/space_icon_9.svg
@@ -1,9 +1,15 @@
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
-<rect width="28" height="28" rx="8" fill="#none"/>
-<path d="M19.9276 14.667V15.3337H19.3476C18.8542 15.3337 18.4542 15.7337 18.4542 16.2337V16.4337C18.4542 16.9337 18.0542 17.3337 17.5542 17.3337C17.0609 17.3337 16.6609 16.9337 16.6609 16.4337V16.2337C16.6609 15.7337 16.2542 15.3337 15.7609 15.3337C15.2676 15.3337 14.8676 15.7337 14.8676 16.2337V16.4337C14.8676 16.9337 14.4609 17.3337 13.9676 17.3337C13.4742 17.3337 13.0676 16.9337 13.0676 16.4337V16.2337C13.0676 15.7337 12.6676 15.3337 12.1742 15.3337C11.6809 15.3337 11.2742 15.7337 11.2742 16.2337V16.4337C11.2742 16.9337 10.8742 17.3337 10.3809 17.3337C9.88089 17.3337 9.48089 16.9337 9.48089 16.4337V16.2203C9.48089 15.727 9.08755 15.327 8.60089 15.3203H8.07422V14.667C8.07422 13.747 8.76755 12.967 9.70755 12.7403C9.89422 12.6937 10.0876 12.667 10.2942 12.667H17.7076C17.9142 12.667 18.1076 12.6937 18.2942 12.7403C19.2342 12.967 19.9276 13.747 19.9276 14.667Z" fill="white"/>
-<path d="M18.2937 10.7797V11.7197C18.1004 11.6797 17.907 11.6663 17.707 11.6663H10.2937C10.0937 11.6663 9.90036 11.6863 9.70703 11.7263V10.7797C9.70703 9.97967 10.427 9.33301 11.3204 9.33301H16.6804C17.5737 9.33301 18.2937 9.97967 18.2937 10.7797Z" fill="white"/>
-<path d="M11.832 8.36693V9.34026H11.3187C11.1454 9.34026 10.9854 9.36026 10.832 9.40026V8.36693C10.832 8.13359 11.0587 7.93359 11.332 7.93359C11.6054 7.93359 11.832 8.13359 11.832 8.36693Z" fill="white"/>
-<path d="M17.168 8.21973V9.39973C17.0146 9.35306 16.8546 9.33306 16.6813 9.33306H16.168V8.21973C16.168 7.94639 16.3946 7.71973 16.668 7.71973C16.9413 7.71973 17.168 7.94639 17.168 8.21973Z" fill="white"/>
-<path d="M14.5 7.87967V9.33301H13.5V7.87967C13.5 7.57967 13.7267 7.33301 14 7.33301C14.2733 7.33301 14.5 7.57967 14.5 7.87967Z" fill="white"/>
-<path d="M20.6654 20.167C20.6654 20.4403 20.4387 20.667 20.1654 20.667H7.83203C7.5587 20.667 7.33203 20.4403 7.33203 20.167C7.33203 19.8936 7.5587 19.667 7.83203 19.667H8.07203V16.3203H8.4787V16.367C8.4787 17.2603 9.06536 18.087 9.9387 18.2803C10.6187 18.4403 11.2654 18.2203 11.7054 17.787C11.9587 17.5336 12.372 17.527 12.6254 17.7803C12.972 18.1203 13.4454 18.3336 13.9654 18.3336C14.4854 18.3336 14.9587 18.127 15.3054 17.7803C15.5587 17.5336 15.9654 17.5336 16.2254 17.787C16.6587 18.2203 17.3054 18.4403 17.992 18.2803C18.8654 18.087 19.452 17.2603 19.452 16.367V16.3336H19.9254V19.667H20.1654C20.4387 19.667 20.6654 19.8936 20.6654 20.167Z" fill="white"/>
+ <rect width="28" height="28" rx="8" fill="#none"/>
+ <path d="M19.9276 14.667V15.3337H19.3476C18.8542 15.3337 18.4542 15.7337 18.4542 16.2337V16.4337C18.4542 16.9337 18.0542 17.3337 17.5542 17.3337C17.0609 17.3337 16.6609 16.9337 16.6609 16.4337V16.2337C16.6609 15.7337 16.2542 15.3337 15.7609 15.3337C15.2676 15.3337 14.8676 15.7337 14.8676 16.2337V16.4337C14.8676 16.9337 14.4609 17.3337 13.9676 17.3337C13.4742 17.3337 13.0676 16.9337 13.0676 16.4337V16.2337C13.0676 15.7337 12.6676 15.3337 12.1742 15.3337C11.6809 15.3337 11.2742 15.7337 11.2742 16.2337V16.4337C11.2742 16.9337 10.8742 17.3337 10.3809 17.3337C9.88089 17.3337 9.48089 16.9337 9.48089 16.4337V16.2203C9.48089 15.727 9.08755 15.327 8.60089 15.3203H8.07422V14.667C8.07422 13.747 8.76755 12.967 9.70755 12.7403C9.89422 12.6937 10.0876 12.667 10.2942 12.667H17.7076C17.9142 12.667 18.1076 12.6937 18.2942 12.7403C19.2342 12.967 19.9276 13.747 19.9276 14.667Z"
+ fill="var(--content-on-fill)"/>
+ <path d="M18.2937 10.7797V11.7197C18.1004 11.6797 17.907 11.6663 17.707 11.6663H10.2937C10.0937 11.6663 9.90036 11.6863 9.70703 11.7263V10.7797C9.70703 9.97967 10.427 9.33301 11.3204 9.33301H16.6804C17.5737 9.33301 18.2937 9.97967 18.2937 10.7797Z"
+ fill="var(--content-on-fill)"/>
+ <path d="M11.832 8.36693V9.34026H11.3187C11.1454 9.34026 10.9854 9.36026 10.832 9.40026V8.36693C10.832 8.13359 11.0587 7.93359 11.332 7.93359C11.6054 7.93359 11.832 8.13359 11.832 8.36693Z"
+ fill="var(--content-on-fill)"/>
+ <path d="M17.168 8.21973V9.39973C17.0146 9.35306 16.8546 9.33306 16.6813 9.33306H16.168V8.21973C16.168 7.94639 16.3946 7.71973 16.668 7.71973C16.9413 7.71973 17.168 7.94639 17.168 8.21973Z"
+ fill="var(--content-on-fill)"/>
+ <path d="M14.5 7.87967V9.33301H13.5V7.87967C13.5 7.57967 13.7267 7.33301 14 7.33301C14.2733 7.33301 14.5 7.57967 14.5 7.87967Z"
+ fill="var(--content-on-fill)"/>
+ <path d="M20.6654 20.167C20.6654 20.4403 20.4387 20.667 20.1654 20.667H7.83203C7.5587 20.667 7.33203 20.4403 7.33203 20.167C7.33203 19.8936 7.5587 19.667 7.83203 19.667H8.07203V16.3203H8.4787V16.367C8.4787 17.2603 9.06536 18.087 9.9387 18.2803C10.6187 18.4403 11.2654 18.2203 11.7054 17.787C11.9587 17.5336 12.372 17.527 12.6254 17.7803C12.972 18.1203 13.4454 18.3336 13.9654 18.3336C14.4854 18.3336 14.9587 18.127 15.3054 17.7803C15.5587 17.5336 15.9654 17.5336 16.2254 17.787C16.6587 18.2203 17.3054 18.4403 17.992 18.2803C18.8654 18.087 19.452 17.2603 19.452 16.367V16.3336H19.9254V19.667H20.1654C20.4387 19.667 20.6654 19.8936 20.6654 20.167Z"
+ fill="var(--content-on-fill)"/>
</svg>
diff --git a/frontend/appflowy_web_app/src/assets/star.svg b/frontend/appflowy_web_app/src/assets/star.svg
index f4d6f7ae3c..532abf0e26 100644
--- a/frontend/appflowy_web_app/src/assets/star.svg
+++ b/frontend/appflowy_web_app/src/assets/star.svg
@@ -1,10 +1,11 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
-<g clip-path="url(#clip0_51_2)">
-<path d="M6.0536 3.49319C6.9196 1.93962 7.3526 1.16281 8.00004 1.16281C8.64748 1.16281 9.08048 1.93956 9.94648 3.49319L10.1705 3.89512C10.4167 4.33656 10.5397 4.55731 10.7315 4.703C10.9234 4.84862 11.1623 4.90269 11.6402 5.01081L12.0754 5.10925C13.757 5.48975 14.5979 5.68 14.798 6.32331C14.998 6.96662 14.4248 7.637 13.2783 8.97762L12.9817 9.3245C12.6559 9.7055 12.493 9.89594 12.4197 10.1316C12.3464 10.3673 12.371 10.6214 12.4203 11.1298L12.4651 11.5926C12.6385 13.3813 12.7252 14.2757 12.2014 14.6732C11.6776 15.0708 10.8903 14.7083 9.31573 13.9834L8.90835 13.7957C8.46092 13.5897 8.23723 13.4867 8.00004 13.4867C7.76285 13.4867 7.5391 13.5897 7.09173 13.7957L6.68435 13.9834C5.10973 14.7083 4.32242 15.0708 3.79867 14.6732C3.27492 14.2757 3.3616 13.3813 3.53492 11.5926L3.57973 11.1298C3.62904 10.6214 3.65367 10.3673 3.58035 10.1316C3.5071 9.89594 3.34417 9.7055 3.01835 9.3245L2.72179 8.97762C1.57529 7.637 1.00204 6.96662 1.2021 6.32331C1.4021 5.68 2.24298 5.48975 3.92473 5.10925L4.35979 5.01081C4.83773 4.90269 5.07667 4.84862 5.26854 4.703C5.46042 4.55737 5.58342 4.33656 5.82954 3.89512L6.0536 3.49319Z" stroke="black"/>
-</g>
-<defs>
-<clipPath id="clip0_51_2">
-<rect width="16" height="16" fill="white"/>
-</clipPath>
-</defs>
+ <g clip-path="url(#clip0_51_2)">
+ <path d="M6.0536 3.49319C6.9196 1.93962 7.3526 1.16281 8.00004 1.16281C8.64748 1.16281 9.08048 1.93956 9.94648 3.49319L10.1705 3.89512C10.4167 4.33656 10.5397 4.55731 10.7315 4.703C10.9234 4.84862 11.1623 4.90269 11.6402 5.01081L12.0754 5.10925C13.757 5.48975 14.5979 5.68 14.798 6.32331C14.998 6.96662 14.4248 7.637 13.2783 8.97762L12.9817 9.3245C12.6559 9.7055 12.493 9.89594 12.4197 10.1316C12.3464 10.3673 12.371 10.6214 12.4203 11.1298L12.4651 11.5926C12.6385 13.3813 12.7252 14.2757 12.2014 14.6732C11.6776 15.0708 10.8903 14.7083 9.31573 13.9834L8.90835 13.7957C8.46092 13.5897 8.23723 13.4867 8.00004 13.4867C7.76285 13.4867 7.5391 13.5897 7.09173 13.7957L6.68435 13.9834C5.10973 14.7083 4.32242 15.0708 3.79867 14.6732C3.27492 14.2757 3.3616 13.3813 3.53492 11.5926L3.57973 11.1298C3.62904 10.6214 3.65367 10.3673 3.58035 10.1316C3.5071 9.89594 3.34417 9.7055 3.01835 9.3245L2.72179 8.97762C1.57529 7.637 1.00204 6.96662 1.2021 6.32331C1.4021 5.68 2.24298 5.48975 3.92473 5.10925L4.35979 5.01081C4.83773 4.90269 5.07667 4.84862 5.26854 4.703C5.46042 4.55737 5.58342 4.33656 5.82954 3.89512L6.0536 3.49319Z"
+ stroke="currentColor"/>
+ </g>
+ <defs>
+ <clipPath id="clip0_51_2">
+ <rect width="16" height="16" fill="white"/>
+ </clipPath>
+ </defs>
</svg>
diff --git a/frontend/appflowy_web_app/src/components/_shared/breadcrumb/Breadcrumb.tsx b/frontend/appflowy_web_app/src/components/_shared/breadcrumb/Breadcrumb.tsx
index 332de0c457..21c74ccfdb 100644
--- a/frontend/appflowy_web_app/src/components/_shared/breadcrumb/Breadcrumb.tsx
+++ b/frontend/appflowy_web_app/src/components/_shared/breadcrumb/Breadcrumb.tsx
@@ -1,34 +1,100 @@
import { UIVariant, View } from '@/application/types';
-import { AFScroller } from '@/components/_shared/scroller';
import BreadcrumbItem from '@/components/_shared/breadcrumb/BreadcrumbItem';
+import BreadcrumbMoreModal from '@/components/_shared/breadcrumb/BreadcrumbMoreModal';
+import { getPlatform } from '@/utils/platform';
+import { IconButton } from '@mui/material';
import React, { memo, useMemo } from 'react';
import { ReactComponent as RightIcon } from '@/assets/arrow_right.svg';
+import { ReactComponent as MoreIcon } from '@/assets/more.svg';
-export function Breadcrumb ({ crumbs, toView, variant }: {
+export interface BreadcrumbProps {
crumbs: View[];
toView?: (viewId: string) => Promise<void>;
variant?: UIVariant;
-}) {
+}
+
+export function Breadcrumb ({ crumbs, toView, variant }: BreadcrumbProps) {
+ const [openMore, setOpenMore] = React.useState(false);
const renderCrumb = useMemo(() => {
+ const tailCount = getPlatform().isMobile ? 1 : 2;
+
+ if (crumbs.length > tailCount + 1) {
+ const firstCrumb = crumbs[0];
+ const lastCrumbs = crumbs.slice(-tailCount);
+
+ return <>
+ <div className={'text-text-title flex max-w-[160px] min-w-0 truncate items-center gap-2'}>
+ <BreadcrumbItem
+ variant={variant}
+ toView={toView}
+ crumb={firstCrumb}
+ disableClick={true}
+ />
+ <RightIcon className={'h-4 shrink-0 w-4'} />
+ </div>
+ <div className={'text-text-title flex shrink-0 max-w-[160px] min-w-0 truncate items-center gap-2'}>
+ <IconButton
+ onClick={() => {
+ setOpenMore(true);
+ }}
+ >
+ <MoreIcon className={'h-5 shrink-0 w-5'} />
+ </IconButton>
+
+ <RightIcon className={'h-4 shrink-0 w-4'} />
+ </div>
+ {lastCrumbs.map((crumb, index) => {
+ const key = `${crumb.view_id}-${index}`;
+
+ return (
+ <div
+ className={'text-text-title flex max-w-[160px] min-w-0 truncate items-center gap-2'}
+ key={key}
+ >
+ <BreadcrumbItem
+ variant={variant}
+ toView={toView}
+ crumb={crumb}
+ disableClick={false}
+ />
+ {index === lastCrumbs.length - 1 ? null : <RightIcon className={'h-4 shrink-0 w-4'} />}
+ </div>
+ );
+ })}
+
+ </>;
+ }
return crumbs?.map((crumb, index) => {
const isLast = index === crumbs.length - 1;
const key = `${crumb.view_id}-${index}`;
return (
- <div className={`${isLast ? 'text-text-title' : 'text-text-caption'} flex items-center gap-2`} key={key}>
- <BreadcrumbItem variant={variant} toView={toView} crumb={crumb} disableClick={isLast} />
- {!isLast && <RightIcon className={'h-4 w-4'} />}
+ <div
+ className={`${isLast ? 'text-text-title' : 'text-text-caption'} flex max-w-[160px] min-w-0 truncate items-center gap-2`}
+ key={key}
+ >
+ <BreadcrumbItem
+ variant={variant}
+ toView={toView}
+ crumb={crumb}
+ disableClick={isLast}
+ />
+ {!isLast && <RightIcon className={'h-4 shrink-0 w-4'} />}
</div>
);
});
}, [crumbs, toView, variant]);
return (
- <div className={'relative h-full w-full flex-1 overflow-hidden'}>
- <AFScroller overflowYHidden className={'flex w-full items-center gap-2'}>
- {renderCrumb}{' '}
- </AFScroller>
+ <div className={'relative h-full w-full flex-1 overflow-hidden flex items-center gap-2'}>
+ {renderCrumb}
+ <BreadcrumbMoreModal
+ open={openMore}
+ onClose={() => setOpenMore(false)}
+ crumbs={crumbs}
+ toView={toView}
+ />
</div>
);
}
diff --git a/frontend/appflowy_web_app/src/components/_shared/breadcrumb/BreadcrumbItem.tsx b/frontend/appflowy_web_app/src/components/_shared/breadcrumb/BreadcrumbItem.tsx
index 789cba4cfa..fe21caa3bd 100644
--- a/frontend/appflowy_web_app/src/components/_shared/breadcrumb/BreadcrumbItem.tsx
+++ b/frontend/appflowy_web_app/src/components/_shared/breadcrumb/BreadcrumbItem.tsx
@@ -23,13 +23,13 @@ function BreadcrumbItem ({ crumb, disableClick = false, toView, variant }: {
}, [icon]);
const className = useMemo(() => {
- const classList = ['flex', 'items-center', 'gap-1.5', 'text-sm'];
+ const classList = ['flex', 'items-center', 'gap-1.5', 'text-sm', 'overflow-hidden', 'max-sm:text-base'];
if (!disableClick && !extra?.is_space) {
if ((is_published && variant === 'publish') || variant === 'app') {
classList.push('cursor-pointer hover:text-text-title hover:underline');
} else {
- classList.push('flex-1', 'overflow-hidden');
+ classList.push('flex-1');
}
}
@@ -52,29 +52,43 @@ function BreadcrumbItem ({ crumb, disableClick = false, toView, variant }: {
>
{extra && extra.is_space ? (
<span
- className={'icon h-4 w-4'}
+ className={'icon h-4 w-4 shrink-0'}
style={{
backgroundColor: extra.space_icon_color ? renderColor(extra.space_icon_color) : 'rgb(163, 74, 253)',
borderRadius: '4px',
}}
>
- <SpaceIcon value={extra.space_icon || ''} char={extra.space_icon ? undefined : name.slice(0, 1)} />
+ <SpaceIcon
+ value={extra.space_icon || ''}
+ char={extra.space_icon ? undefined : name.slice(0, 1)}
+ />
</span>
) : (
- <span className={`${isFlag ? 'icon' : ''} flex h-5 w-5 items-center justify-center`}>
- {icon?.value || <ViewIcon layout={layout} size={'small'} />}
+ <span className={`${isFlag ? 'icon' : ''} flex h-5 w-5 min-w-5 items-center justify-center`}>
+ {icon?.value || <ViewIcon
+ layout={layout}
+ size={'small'}
+ />}
</span>
)}
- <Tooltip title={name} placement={'bottom'} enterDelay={1000} enterNextDelay={1000}>
+ <Tooltip
+ title={name}
+ placement={'bottom'}
+ enterDelay={1000}
+ enterNextDelay={1000}
+ >
<span
className={
- 'max-w-[250px] overflow-hidden truncate '
+ 'max-w-[250px] min-w-[2.5rem] flex-1 overflow-hidden truncate '
}
>
{name || t('menuAppHeader.defaultNewPageName')}
</span>
</Tooltip>
- <PublishIcon variant={variant} view={crumb} />
+ <PublishIcon
+ variant={variant}
+ view={crumb}
+ />
</div>
);
}
diff --git a/frontend/appflowy_web_app/src/components/_shared/breadcrumb/BreadcrumbMoreModal.tsx b/frontend/appflowy_web_app/src/components/_shared/breadcrumb/BreadcrumbMoreModal.tsx
new file mode 100644
index 0000000000..c3d545327d
--- /dev/null
+++ b/frontend/appflowy_web_app/src/components/_shared/breadcrumb/BreadcrumbMoreModal.tsx
@@ -0,0 +1,57 @@
+import { View } from '@/application/types';
+import BreadcrumbItem from '@/components/_shared/breadcrumb/BreadcrumbItem';
+import { NormalModal } from '@/components/_shared/modal';
+import React, { useMemo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+function BreadcrumbMoreModal ({ open, onClose, crumbs, toView }: {
+ open: boolean;
+ onClose: () => void;
+ crumbs: View[];
+ toView?: (viewId: string) => Promise<void>;
+}) {
+ const { t } = useTranslation();
+ const title = useMemo(() => {
+ return <div className={'flex items-center gap-2'}>
+ <div className={'flex-1 font-semibold text-center'}>{t('breadcrumbs.label')}</div>
+ </div>;
+ }, [t]);
+
+ return (
+ <NormalModal
+ title={title}
+ okButtonProps={{
+ className: 'hidden',
+ }}
+ cancelButtonProps={{
+ className: 'hidden',
+ }}
+ open={open}
+ onClose={onClose}
+ >
+ <div className={'flex flex-col justify-start gap-2 min-w-[350px] max-sm:min-w-full'}>
+ {crumbs.map((crumb, index) => (
+ <div
+ key={crumb.view_id}
+ onClick={() => {
+ if (index === 0) return;
+ onClose();
+ }}
+ className={`flex items-center gap-2 ${index !== 0 ? 'hover:bg-fill-list-hover cursor-pointer' : ''} rounded-[8px] py-1.5`}
+ style={{
+ paddingLeft: (index + 1) * 16,
+ }}
+ >
+ {index !== 0 && <div className={'text-text-caption'}> {'-'} </div>}
+ <BreadcrumbItem
+ crumb={crumb}
+ toView={toView}
+ />
+ </div>
+ ))}
+ </div>
+ </NormalModal>
+ );
+}
+
+export default BreadcrumbMoreModal;
\ No newline at end of file
diff --git a/frontend/appflowy_web_app/src/components/_shared/breadcrumb/SpaceIcon.tsx b/frontend/appflowy_web_app/src/components/_shared/breadcrumb/SpaceIcon.tsx
index c1f91d8779..acac395ed9 100644
--- a/frontend/appflowy_web_app/src/components/_shared/breadcrumb/SpaceIcon.tsx
+++ b/frontend/appflowy_web_app/src/components/_shared/breadcrumb/SpaceIcon.tsx
@@ -1,5 +1,6 @@
+import { ThemeModeContext } from '@/components/main/useAppThemeMode';
import { getIconSvgEncodedContent } from '@/utils/emoji';
-import React, { useEffect, useMemo, useState } from 'react';
+import React, { useContext, useEffect, useMemo, useState } from 'react';
import { ReactComponent as SpaceIcon1 } from '@/assets/space_icon/space_icon_1.svg';
import { ReactComponent as SpaceIcon2 } from '@/assets/space_icon/space_icon_2.svg';
import { ReactComponent as SpaceIcon3 } from '@/assets/space_icon/space_icon_3.svg';
@@ -58,14 +59,15 @@ export const getIconComponent = (icon: string) => {
function SpaceIcon ({ value, char }: { value: string, char?: string }) {
const IconComponent = getIconComponent(value);
const [iconEncodeContent, setIconEncodeContent] = useState<string | null>(null);
+ const isDark = useContext(ThemeModeContext)?.isDark || false;
useEffect(() => {
if (!char && value && !IconComponent) {
- void getIconSvgEncodedContent(value, 'white').then((res) => {
+ void getIconSvgEncodedContent(value, isDark ? 'black' : 'white').then((res) => {
setIconEncodeContent(res);
});
}
- }, [IconComponent, value, char]);
+ }, [isDark, IconComponent, value, char]);
const customIcon = useMemo(() => {
if (!iconEncodeContent) {
@@ -75,7 +77,11 @@ function SpaceIcon ({ value, char }: { value: string, char?: string }) {
/**
* value eg: 'artificial_intelligence/ai-cloud-spark';
*/
- return <img src={iconEncodeContent} className={'h-full w-full p-1 text-white'} alt={value} />;
+ return <img
+ src={iconEncodeContent}
+ className={'h-full w-full p-1 text-white'}
+ alt={value}
+ />;
}, [iconEncodeContent, value]);
if (char) {
diff --git a/frontend/appflowy_web_app/src/components/_shared/breadcrumb/withAppBreadcrumb.tsx b/frontend/appflowy_web_app/src/components/_shared/breadcrumb/withAppBreadcrumb.tsx
new file mode 100644
index 0000000000..43f4ed1331
--- /dev/null
+++ b/frontend/appflowy_web_app/src/components/_shared/breadcrumb/withAppBreadcrumb.tsx
@@ -0,0 +1,26 @@
+import { UIVariant } from '@/application/types';
+import { BreadcrumbProps } from '@/components/_shared/breadcrumb/Breadcrumb';
+import BreadcrumbSkeleton from '@/components/_shared/skeleton/BreadcrumbSkeleton';
+import { useAppHandlers, useBreadcrumb } from '@/components/app/app.hooks';
+import React from 'react';
+
+export function withAppBreadcrumb (Component: React.ComponentType<BreadcrumbProps>) {
+ return function PublishBreadcrumbComponent () {
+ const isTrash = window.location.pathname === '/app/trash';
+
+ const crumbs = useBreadcrumb();
+ const toView = useAppHandlers().toView;
+
+ return (
+ <div className={'h-full flex-1 overflow-hidden'}>
+ {!crumbs ? <BreadcrumbSkeleton /> :
+ !isTrash && <Component
+ toView={toView}
+ variant={UIVariant.App}
+ crumbs={crumbs}
+ />
+ }
+ </div>
+ );
+ };
+}
\ No newline at end of file
diff --git a/frontend/appflowy_web_app/src/components/_shared/breadcrumb/withPublishBreadcrumb.tsx b/frontend/appflowy_web_app/src/components/_shared/breadcrumb/withPublishBreadcrumb.tsx
new file mode 100644
index 0000000000..dc2ec5d644
--- /dev/null
+++ b/frontend/appflowy_web_app/src/components/_shared/breadcrumb/withPublishBreadcrumb.tsx
@@ -0,0 +1,24 @@
+import { usePublishContext } from '@/application/publish';
+import { UIVariant } from '@/application/types';
+import { BreadcrumbProps } from '@/components/_shared/breadcrumb/Breadcrumb';
+import BreadcrumbSkeleton from '@/components/_shared/skeleton/BreadcrumbSkeleton';
+import React from 'react';
+
+export function withPublishBreadcrumb (Component: React.ComponentType<BreadcrumbProps>) {
+ return function PublishBreadcrumbComponent () {
+ const toView = usePublishContext()?.toView;
+ const crumbs = usePublishContext()?.breadcrumbs;
+
+ return (
+ <div className={'h-full flex-1 overflow-hidden'}>
+ {!crumbs ? <BreadcrumbSkeleton /> :
+ <Component
+ toView={toView}
+ variant={UIVariant.Publish}
+ crumbs={crumbs}
+ />
+ }
+ </div>
+ );
+ };
+}
\ No newline at end of file
diff --git a/frontend/appflowy_web_app/src/components/_shared/mobile-drawer/MobileDrawer.tsx b/frontend/appflowy_web_app/src/components/_shared/mobile-drawer/MobileDrawer.tsx
new file mode 100644
index 0000000000..8aa3c6de35
--- /dev/null
+++ b/frontend/appflowy_web_app/src/components/_shared/mobile-drawer/MobileDrawer.tsx
@@ -0,0 +1,148 @@
+import React, { ReactElement, useCallback } from 'react';
+import SwipeableDrawer from '@mui/material/SwipeableDrawer';
+
+import { styled } from '@mui/material/styles';
+
+const BasePuller = styled('div')(({ theme }) => ({
+ backgroundColor: theme.palette.mode === 'light' ? '#dadada' : '#666',
+ borderRadius: 3,
+}));
+
+const VerticalTopPuller = styled(BasePuller)(() => ({
+ width: 50,
+ height: 6,
+ top: 0,
+}));
+
+const VerticalBottomPuller = styled(BasePuller)(() => ({
+ width: 50,
+ height: 6,
+ bottom: 0,
+}));
+
+const HorizontalLeftPuller = styled(BasePuller)(() => ({
+ width: 6,
+ height: 50,
+ left: 0,
+}));
+
+const HorizontalRightPuller = styled(BasePuller)(() => ({
+ width: 6,
+ height: 50,
+ right: 0,
+}));
+
+const PullerWrapper = styled('div')<{ anchor: 'top' | 'left' | 'bottom' | 'right' }>(
+ ({ anchor }) => ({
+ position: 'absolute',
+ display: 'flex',
+ justifyContent: 'center',
+ alignItems: 'center',
+ zIndex: 11,
+ ...(anchor === 'top' && {
+ bottom: 8,
+ height: 6,
+ left: 0,
+ right: 0,
+ }),
+ ...(anchor === 'bottom' && {
+ top: 8,
+ left: 0,
+ right: 0,
+ height: 6,
+ }),
+ ...(anchor === 'left' && {
+ right: 8,
+ top: 0,
+ bottom: 0,
+ width: 6,
+ }),
+ ...(anchor === 'right' && {
+ left: 8,
+ top: 0,
+ bottom: 0,
+ width: 6,
+ }),
+ }),
+);
+
+export function MobileDrawer ({
+ children,
+ triggerNode,
+ anchor = 'bottom',
+ open,
+ onOpen,
+ onClose,
+ swipeAreaWidth,
+ swipeAreaHeight,
+ maxHeight,
+ showPuller = true,
+}: {
+ children: React.ReactNode;
+ triggerNode: ReactElement;
+ anchor?: 'top' | 'left' | 'bottom' | 'right';
+ open: boolean;
+ onOpen?: () => void;
+ onClose?: () => void;
+ swipeAreaWidth?: number | undefined;
+ swipeAreaHeight?: number | undefined;
+ maxHeight?: number | undefined;
+ showPuller?: boolean;
+}) {
+
+ const toggleDrawer = useCallback((open: boolean) => {
+ return (event: React.KeyboardEvent | React.MouseEvent) => {
+ if (event && event.type === 'keydown' && ((event as React.KeyboardEvent).key === 'Tab' || (event as React.KeyboardEvent).key === 'Shift')) {
+ return;
+ }
+
+ if (open) {
+ onOpen?.();
+ } else {
+ onClose?.();
+ }
+ };
+ }, [onClose, onOpen]);
+
+ const drawerContent = (
+ <>
+ {showPuller && (
+ <PullerWrapper anchor={anchor}>
+ {anchor === 'top' && <VerticalTopPuller />}
+ {anchor === 'bottom' && <VerticalBottomPuller />}
+ {anchor === 'left' && <HorizontalLeftPuller />}
+ {anchor === 'right' && <HorizontalRightPuller />}
+ </PullerWrapper>
+ )}
+ {children}
+ </>
+ );
+
+ return (
+ <>
+ {React.cloneElement(triggerNode, { ...triggerNode.props, onClick: toggleDrawer(true) })}
+ <SwipeableDrawer
+ anchor={anchor}
+ open={open}
+ onClose={toggleDrawer(false)}
+ onOpen={toggleDrawer(true)}
+ slotProps={{
+ root: {
+ className: 'text-lg',
+ },
+ }}
+ PaperProps={{
+ style: {
+ width: swipeAreaWidth,
+ height: swipeAreaHeight,
+ maxHeight: maxHeight,
+ },
+ }}
+ >
+ {drawerContent}
+ </SwipeableDrawer>
+ </>
+ );
+}
+
+export default MobileDrawer;
\ No newline at end of file
diff --git a/frontend/appflowy_web_app/src/components/_shared/mobile-drawer/index.ts b/frontend/appflowy_web_app/src/components/_shared/mobile-drawer/index.ts
new file mode 100644
index 0000000000..b0c0a97685
--- /dev/null
+++ b/frontend/appflowy_web_app/src/components/_shared/mobile-drawer/index.ts
@@ -0,0 +1 @@
+export * from './MobileDrawer';
diff --git a/frontend/appflowy_web_app/src/components/_shared/mobile-outline/MobileOutline.tsx b/frontend/appflowy_web_app/src/components/_shared/mobile-outline/MobileOutline.tsx
new file mode 100644
index 0000000000..aa18ac1c63
--- /dev/null
+++ b/frontend/appflowy_web_app/src/components/_shared/mobile-outline/MobileOutline.tsx
@@ -0,0 +1,36 @@
+import { UIVariant, View } from '@/application/types';
+import OutlineItem from './OutlineItem';
+import React from 'react';
+
+export function MobileOutline ({
+ outline,
+ variant,
+ selectedViewId,
+ navigateToView,
+ onClose,
+}: {
+ outline: View[];
+ variant?: UIVariant;
+ selectedViewId?: string;
+ navigateToView?: (viewId: string) => Promise<void>;
+ onClose: () => void;
+}) {
+ return (
+ <div className={'flex w-full flex-1 flex-col gap-2 py-[10px]'}>
+ {outline.map((view) =>
+ <OutlineItem
+ variant={variant}
+ key={view.view_id}
+ selectedViewId={selectedViewId}
+ view={view}
+ navigateToView={async (viewId: string) => {
+ await navigateToView?.(viewId);
+ onClose();
+ }}
+ />,
+ )}
+ </div>
+ );
+}
+
+export default MobileOutline;
\ No newline at end of file
diff --git a/frontend/appflowy_web_app/src/components/_shared/mobile-outline/MobileOutlineWithCover.tsx b/frontend/appflowy_web_app/src/components/_shared/mobile-outline/MobileOutlineWithCover.tsx
new file mode 100644
index 0000000000..270e962a23
--- /dev/null
+++ b/frontend/appflowy_web_app/src/components/_shared/mobile-outline/MobileOutlineWithCover.tsx
@@ -0,0 +1,118 @@
+import { View, ViewLayout } from '@/application/types';
+import { ViewIcon } from '@/components/_shared/view-icon';
+import MobileRecentViewCover from '@/components/app/recent/MobileRecentViewCover';
+import { ThemeModeContext } from '@/components/main/useAppThemeMode';
+import { isFlagEmoji } from '@/utils/emoji';
+import { Divider } from '@mui/material';
+import dayjs from 'dayjs';
+import React, { useCallback, useContext, useMemo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+function MobileOutlineWithCover ({ view, navigateToView, timePrefix, time }: {
+ view: View;
+ navigateToView: (viewId: string) => void;
+ timePrefix?: string;
+ time?: string;
+}) {
+ const { t } = useTranslation();
+ const isDark = useContext(ThemeModeContext)?.isDark;
+
+ const getRelativeTime = useCallback((time: string) => {
+ const justNow = dayjs().diff(dayjs(time), 'minute') < 1;
+ const isToday = dayjs().isSame(dayjs(time), 'day');
+ const isYesterday = dayjs().isSame(dayjs(time), 'day');
+
+ if (justNow) {
+ return t('time.justNow');
+ }
+
+ if (isToday) {
+ return dayjs(time).format('HH:mm');
+ }
+
+ if (isYesterday) {
+ return t('time.yesterday');
+ }
+
+ return dayjs(time).format('MMM d, YYYY');
+ }, [t]);
+
+ const viewIconProps = useMemo(() => {
+ switch (view.layout) {
+ case ViewLayout.Document:
+ return {
+ iconClassName: 'text-[#00C2FF]',
+ bgColor: isDark ? '#658B9033' : '#EDFBFFCC',
+ };
+ case ViewLayout.Board:
+ return {
+ iconClassName: 'text-[#49CD57]',
+ bgColor: isDark ? '#72936B33' : '#E0FDD97F',
+ };
+ case ViewLayout.Grid:
+ return {
+ iconClassName: 'text-[#8263FF]',
+ bgColor: isDark ? '#8B80AD33' : '#F5F4FFFF',
+ };
+ case ViewLayout.Calendar:
+ return {
+ iconClassName: 'text-[#FD9D44]',
+ bgColor: isDark ? '#A68B7733' : '#FFF7F0FF',
+ };
+ case ViewLayout.AIChat:
+ return {
+ iconClassName: 'text-[#FF53C5]',
+ bgColor: isDark ? '#98719533' : '#FFE6FD66',
+ };
+ default:
+ return {
+ iconClassName: 'text-[#00C2FF]',
+ bgColor: isDark ? '#658B9033' : '#EDFBFFCC',
+ };
+
+ }
+ }, [view.layout, isDark]);
+
+ return (
+ <>
+ <div
+ key={view.view_id}
+ className={'flex items-center gap-2 justify-between px-3'}
+ onClick={() => {
+ void navigateToView(view.view_id);
+ }}
+ >
+ <div className={'flex flex-col flex-1 gap-4'}>
+ <div className={'flex gap-2 text-base '}>
+ {view.icon && <span className={`${isFlagEmoji(view.icon.value) ? 'icon' : ''}`}>{view.icon.value}</span>}
+ <div className={'font-medium'}>
+ {view.name}
+ </div>
+ </div>
+ {view.last_edited_time && <div className={'text-text-caption font-normal text-sm'}>
+ {timePrefix || ''}
+ {getRelativeTime(time || view.last_edited_time)}
+ </div>}
+
+ </div>
+ {view.extra?.cover && view.extra?.cover.type !== 'none' ? <MobileRecentViewCover
+ cover={view.extra.cover}
+ /> : <div
+ style={{
+ backgroundColor: viewIconProps.bgColor,
+ }}
+ className={'w-[78px] border border-fill-list-hover flex items-center justify-center rounded-[8px] overflow-hidden h-[54px]'}
+ >
+ <ViewIcon
+ className={`${viewIconProps.iconClassName} text-2xl`}
+ layout={view.layout || ViewLayout.Document}
+ size={'unset'}
+ />
+ </div>}
+ </div>
+ <Divider className={'w-full opacity-50'} />
+ </>
+ );
+}
+
+export default MobileOutlineWithCover;
\ No newline at end of file
diff --git a/frontend/appflowy_web_app/src/components/_shared/mobile-outline/OutlineItem.tsx b/frontend/appflowy_web_app/src/components/_shared/mobile-outline/OutlineItem.tsx
new file mode 100644
index 0000000000..6a05eb9489
--- /dev/null
+++ b/frontend/appflowy_web_app/src/components/_shared/mobile-outline/OutlineItem.tsx
@@ -0,0 +1,86 @@
+import { UIVariant, View } from '@/application/types';
+import OutlineIcon from '@/components/_shared/outline/OutlineIcon';
+import OutlineItemContent from '@/components/_shared/outline/OutlineItemContent';
+import React, { useCallback, useMemo } from 'react';
+import { ReactComponent as PrivateIcon } from '@/assets/lock.svg';
+
+function OutlineItem ({
+ view,
+ level = 0,
+ selectedViewId,
+ navigateToView,
+ variant,
+}: {
+ view: View;
+ level?: number;
+ selectedViewId?: string;
+ navigateToView?: (viewId: string) => Promise<void>
+ variant?: UIVariant;
+}) {
+ const selected = selectedViewId === view.view_id;
+ const [isExpanded, setIsExpanded] = React.useState(false);
+ const getIcon = useCallback(() => {
+ return <span className={'text-[1em] pt-1.5'}><OutlineIcon
+ level={level}
+ isExpanded={isExpanded}
+ setIsExpanded={setIsExpanded}
+ /></span>;
+ }, [isExpanded, level]);
+ const renderItem = useCallback((item: View) => {
+ return (
+ <div className={'flex h-fit w-full flex-col gap-2'}>
+ <div
+ style={{
+ backgroundColor: selected ? 'var(--fill-list-hover)' : undefined,
+ }}
+ className={
+ 'flex items-center w-full gap-1 py-2 px-1 text-lg focus:bg-content-blue-50 rounded-[8px] focus:outline-none'
+ }
+ >
+ {item.children?.length ? getIcon() : null}
+
+ <OutlineItemContent
+ variant={variant}
+ item={item}
+ navigateToView={navigateToView}
+ level={level}
+ setIsExpanded={setIsExpanded}
+ />
+ {item.is_private && <PrivateIcon className={'h-4 w-4 text-text-caption'} />}
+ </div>
+ </div>
+ );
+ }, [getIcon, level, navigateToView, variant, selected]);
+
+ const children = useMemo(() => view.children || [], [view.children]);
+
+ const renderChildren = useMemo(() => {
+ return <div
+ className={'flex transform flex-col gap-2 transition-all'}
+ style={{
+ display: isExpanded ? 'block' : 'none',
+ }}
+ >
+ {children
+ .map((item, index) => (
+ <OutlineItem
+ selectedViewId={selectedViewId}
+ navigateToView={navigateToView}
+ level={level + 1}
+ key={index}
+ view={item}
+ variant={variant}
+ />
+ ))}
+ </div>;
+ }, [children, isExpanded, level, navigateToView, selectedViewId, variant]);
+
+ return (
+ <div className={'flex h-fit w-full flex-col'}>
+ {renderItem(view)}
+ {renderChildren}
+ </div>
+ );
+}
+
+export default OutlineItem;
\ No newline at end of file
diff --git a/frontend/appflowy_web_app/src/components/_shared/mobile-outline/index.ts b/frontend/appflowy_web_app/src/components/_shared/mobile-outline/index.ts
new file mode 100644
index 0000000000..ae8297cfdd
--- /dev/null
+++ b/frontend/appflowy_web_app/src/components/_shared/mobile-outline/index.ts
@@ -0,0 +1 @@
+export * from './MobileOutline';
\ No newline at end of file
diff --git a/frontend/appflowy_web_app/src/components/_shared/mobile-topbar/MobileFolder.tsx b/frontend/appflowy_web_app/src/components/_shared/mobile-topbar/MobileFolder.tsx
new file mode 100644
index 0000000000..489012a2d9
--- /dev/null
+++ b/frontend/appflowy_web_app/src/components/_shared/mobile-topbar/MobileFolder.tsx
@@ -0,0 +1,102 @@
+import MobileMore from '@/components/_shared/mobile-topbar/MobileMore';
+import { AFScroller } from '@/components/_shared/scroller';
+import { ViewTab, ViewTabs } from '@/components/_shared/tabs/ViewTabs';
+import { AppContext, useAppOutline, useAppViewId } from '@/components/app/app.hooks';
+import MobileFavorite from '@/components/app/favorite/MobileFavorite';
+import MobileRecent from '@/components/app/recent/MobileRecent';
+import MobileWorkspaces from '@/components/app/workspaces/MobileWorkspaces';
+import React, { useContext } from 'react';
+import { useTranslation } from 'react-i18next';
+import MobileOutline from 'src/components/_shared/mobile-outline/MobileOutline';
+import SwipeableViews from 'react-swipeable-views';
+
+enum ViewTabsKey {
+ Space,
+ Recent,
+ Favorite,
+}
+
+function MobileFolder ({
+ onClose,
+}: {
+ onClose: () => void;
+}) {
+ const outline = useAppOutline();
+ const viewId = useAppViewId();
+ const navigateToView = useContext(AppContext)?.toView;
+ const [selectedTab, setSelectedTab] = React.useState<ViewTabsKey>(ViewTabsKey.Space);
+ const { t } = useTranslation();
+
+ console.log('MobileFolder', selectedTab);
+ return (
+ <AFScroller
+ overflowXHidden
+ className={'flex w-full flex-1 flex-col gap-2'}
+ >
+ <div className={'sticky top-0 w-full bg-bg-body z-[10] p-2 pb-0'}>
+ <div className={'flex items-center mb-2 justify-between'}>
+ <div className={'flex-1 p-2'}>
+ <MobileWorkspaces onClose={onClose} />
+ </div>
+ <MobileMore onClose={onClose} />
+ </div>
+ <ViewTabs
+ value={selectedTab}
+ sx={{
+ '& .MuiTabs-indicator': {
+ transform: 'scaleX(0.4)',
+ },
+ }}
+ onChange={(_, value) => setSelectedTab(value)}
+ >
+ <ViewTab
+ value={ViewTabsKey.Space}
+ label={t('sideBar.Spaces')}
+ />
+ <ViewTab
+ value={ViewTabsKey.Recent}
+ label={t('sideBar.recent')}
+ />
+ <ViewTab
+ value={ViewTabsKey.Favorite}
+ label={t('sideBar.favorites')}
+ />
+ </ViewTabs>
+ </div>
+
+ <SwipeableViews
+ index={selectedTab}
+ onChangeIndex={setSelectedTab}
+ className={'h-full'}
+ containerStyle={{
+ height: '100%',
+ }}
+ >
+ <div
+ className={'transform-gpu pb-[60px] px-2'}
+ >
+
+ {outline && <MobileOutline
+ outline={outline}
+ onClose={onClose}
+ selectedViewId={viewId}
+ navigateToView={navigateToView}
+ />}
+ </div>
+ <div
+ className={'transform-gpu pb-[60px] px-2'}
+ >
+ <MobileRecent onClose={onClose} />
+ </div>
+ <div
+ className={'transform-gpu pb-[60px] px-2'}
+ >
+ <MobileFavorite onClose={onClose} />
+ </div>
+ </SwipeableViews>
+
+ </AFScroller>
+ );
+}
+
+export default MobileFolder;
\ No newline at end of file
diff --git a/frontend/appflowy_web_app/src/components/_shared/mobile-topbar/MobileMore.tsx b/frontend/appflowy_web_app/src/components/_shared/mobile-topbar/MobileMore.tsx
new file mode 100644
index 0000000000..12418f3026
--- /dev/null
+++ b/frontend/appflowy_web_app/src/components/_shared/mobile-topbar/MobileMore.tsx
@@ -0,0 +1,91 @@
+import { Popover } from '@/components/_shared/popover';
+import React, { useMemo } from 'react';
+import { ReactComponent as MoreIcon } from '@/assets/settings_more.svg';
+import { Button, Divider, IconButton } from '@mui/material';
+import { ReactComponent as TemplateIcon } from '@/assets/template.svg';
+import { ReactComponent as TrashIcon } from '@/assets/trash.svg';
+import { useTranslation } from 'react-i18next';
+import { useNavigate } from 'react-router-dom';
+import { ReactComponent as SupportIcon } from '@/assets/message_support.svg';
+
+function MobileMore ({
+ onClose,
+}: {
+ onClose: () => void;
+}) {
+ const [openMore, setOpenMore] = React.useState(false);
+ const ref = React.useRef<HTMLButtonElement | null>(null);
+ const { t } = useTranslation();
+ const navigate = useNavigate();
+ const actions = useMemo(() => {
+ return [
+ {
+ label: t('template.label'),
+ icon: <TemplateIcon />,
+ onClick: () => {
+ window.open('https://appflowy.io/templates', '_blank');
+ },
+ },
+ {
+ label: t('trash.text'),
+ icon: <TrashIcon />,
+ onClick: () => {
+ navigate('/app/trash');
+ },
+ }, {
+ label: t('questionBubble.help'),
+ onClick: () => {
+ window.open('https://discord.gg/9Q2xaN37tV', '_blank');
+ },
+ icon: <SupportIcon />,
+ },
+ ];
+ }, [navigate, t]);
+
+ return (
+ <>
+ <IconButton
+ ref={ref}
+ onClick={() => setOpenMore(true)}
+ size={'large'}
+ className={'p-2'}
+ >
+ <MoreIcon className={'h-5 w-5 text-text-title'} />
+ </IconButton>
+ <Popover
+ open={openMore}
+ anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}
+ transformOrigin={{ vertical: 'top', horizontal: 'right' }}
+ anchorEl={ref.current}
+ onClose={() => setOpenMore(false)}
+ >
+ <div className={'flex flex-col w-[200px] justify-start gap-3 py-3'}>
+ {actions.map((action, index) => (
+ <div
+ key={index}
+ >
+ <Button
+ startIcon={action.icon}
+ onClick={() => {
+ action.onClick();
+ setOpenMore(false);
+ onClose();
+ }}
+ variant={'text'}
+ className={'flex-1 gap-2 font-normal px-4 justify-start py-1 text-base'}
+ color={'inherit'}
+ >
+ {action.label}
+ </Button>
+ {index !== actions.length - 1 && <Divider className={'w-full mt-2 opacity-50'} />}
+
+ </div>
+
+ ))}
+ </div>
+ </Popover>
+ </>
+ );
+}
+
+export default MobileMore;
\ No newline at end of file
diff --git a/frontend/appflowy_web_app/src/components/_shared/mobile-topbar/MobileTopBar.tsx b/frontend/appflowy_web_app/src/components/_shared/mobile-topbar/MobileTopBar.tsx
new file mode 100644
index 0000000000..d11493a0db
--- /dev/null
+++ b/frontend/appflowy_web_app/src/components/_shared/mobile-topbar/MobileTopBar.tsx
@@ -0,0 +1,87 @@
+import { HEADER_HEIGHT } from '@/application/constants';
+import { UIVariant } from '@/application/types';
+import { Breadcrumb } from '@/components/_shared/breadcrumb';
+import { withAppBreadcrumb } from '@/components/_shared/breadcrumb/withAppBreadcrumb';
+import { withPublishBreadcrumb } from '@/components/_shared/breadcrumb/withPublishBreadcrumb';
+import { MobileDrawer } from '@/components/_shared/mobile-drawer';
+import MobileFolder from '@/components/_shared/mobile-topbar/MobileFolder';
+import PublishMobileFolder from '@/components/_shared/mobile-topbar/PublishMobileFolder';
+import MoreActionsContent from '@/components/_shared/more-actions/MoreActionsContent';
+import { openOrDownload } from '@/utils/open_schema';
+import { IconButton } from '@mui/material';
+import React, { useCallback } from 'react';
+import { ReactComponent as MenuIcon } from '@/assets/side_outlined.svg';
+import { ReactComponent as Logo } from '@/assets/logo.svg';
+import { ReactComponent as MoreIcon } from '@/assets/more.svg';
+
+const PublishBreadcrumb = withPublishBreadcrumb(Breadcrumb);
+const AppBreadcrumb = withAppBreadcrumb(Breadcrumb);
+
+function MobileTopBar ({ variant }: { variant?: UIVariant }) {
+ const [openFolder, setOpenFolder] = React.useState(false);
+ const [openMore, setOpenMore] = React.useState(false);
+
+ const handleOpenFolder = useCallback(() => {
+ setOpenFolder(true);
+ }, []);
+
+ const handleCloseFolder = useCallback(() => {
+ setOpenFolder(false);
+ }, []);
+
+ const handleOpenMore = useCallback(() => {
+ setOpenMore(true);
+ }, []);
+ const handleCloseMore = useCallback(() => {
+ setOpenMore(false);
+ }, []);
+
+ return (
+ <div
+ style={{
+ backdropFilter: 'saturate(180%) blur(16px)',
+ background: 'var(--bg-header)',
+ height: HEADER_HEIGHT,
+ minHeight: HEADER_HEIGHT,
+ }}
+ className={'flex appflowy-top-bar transform-gpu sticky top-0 z-10 items-center justify-between w-full h-[48px] min-h-[48px] px-4 gap-2'}
+ >
+ <MobileDrawer
+ swipeAreaWidth={window.innerWidth - 56}
+ onOpen={handleOpenFolder}
+ onClose={handleCloseFolder}
+ open={openFolder}
+ anchor={'left'}
+ showPuller={false}
+ triggerNode={<IconButton><MenuIcon /></IconButton>}
+ >
+ {variant === UIVariant.App ? <MobileFolder onClose={handleCloseFolder} /> :
+ <PublishMobileFolder onClose={handleCloseFolder} />}
+
+ </MobileDrawer>
+
+ {variant === UIVariant.Publish ? <PublishBreadcrumb /> : <AppBreadcrumb />}
+ <div className={'flex items-center gap-4'}>
+ <button
+ onClick={() => openOrDownload()}
+ >
+ <Logo className={'h-6 w-6'} />
+ </button>
+ <MobileDrawer
+ onOpen={handleOpenMore}
+ onClose={handleCloseMore}
+ open={openMore}
+ anchor={'bottom'}
+ triggerNode={<IconButton className={'opacity-70'}><MoreIcon /></IconButton>}
+ >
+ <div className={'h-full w-full pt-10 px-2'}>
+ <MoreActionsContent itemClicked={handleCloseMore} />
+
+ </div>
+ </MobileDrawer>
+ </div>
+ </div>
+ );
+}
+
+export default MobileTopBar;
\ No newline at end of file
diff --git a/frontend/appflowy_web_app/src/components/_shared/mobile-topbar/PublishMobileFolder.tsx b/frontend/appflowy_web_app/src/components/_shared/mobile-topbar/PublishMobileFolder.tsx
new file mode 100644
index 0000000000..38c5322bf4
--- /dev/null
+++ b/frontend/appflowy_web_app/src/components/_shared/mobile-topbar/PublishMobileFolder.tsx
@@ -0,0 +1,42 @@
+import { usePublishContext } from '@/application/publish';
+import { AFScroller } from '@/components/_shared/scroller';
+import React from 'react';
+import { ReactComponent as AppFlowyLogo } from '@/assets/appflowy.svg';
+import { useNavigate } from 'react-router-dom';
+import MobileOutline from 'src/components/_shared/mobile-outline/MobileOutline';
+
+function PublishMobileFolder ({
+ onClose,
+}: {
+ onClose: () => void;
+}) {
+ const outline = usePublishContext()?.outline;
+ const viewId = usePublishContext()?.viewMeta?.view_id;
+ const navigateToView = usePublishContext()?.toView;
+ const navigate = useNavigate();
+
+ return (
+ <AFScroller
+ overflowXHidden
+ className={'flex w-full flex-1 flex-col px-4'}
+ >
+ <div
+ onClick={() => {
+ navigate('/');
+ }}
+ className={'sticky top-0 w-full bg-bg-body z-[10] py-2 pb-0'}
+ >
+ <AppFlowyLogo className={'w-[100px] h-[48px]'} />
+ </div>
+ {outline && <MobileOutline
+ outline={outline}
+ onClose={onClose}
+ selectedViewId={viewId}
+ navigateToView={navigateToView}
+ />}
+ </AFScroller>
+
+ );
+}
+
+export default PublishMobileFolder;
\ No newline at end of file
diff --git a/frontend/appflowy_web_app/src/components/_shared/mobile-topbar/index.tsx b/frontend/appflowy_web_app/src/components/_shared/mobile-topbar/index.tsx
new file mode 100644
index 0000000000..9e01163284
--- /dev/null
+++ b/frontend/appflowy_web_app/src/components/_shared/mobile-topbar/index.tsx
@@ -0,0 +1 @@
+export * from './MobileTopBar';
\ No newline at end of file
diff --git a/frontend/appflowy_web_app/src/components/_shared/more-actions/MoreActions.tsx b/frontend/appflowy_web_app/src/components/_shared/more-actions/MoreActions.tsx
index 39f6d8de65..55a617849d 100644
--- a/frontend/appflowy_web_app/src/components/_shared/more-actions/MoreActions.tsx
+++ b/frontend/appflowy_web_app/src/components/_shared/more-actions/MoreActions.tsx
@@ -1,88 +1,21 @@
-import { invalidToken } from '@/application/session/token';
-import CacheClearingDialog from '@/components/_shared/modal/CacheClearingDialog';
+import MoreActionsContent from '@/components/_shared/more-actions/MoreActionsContent';
import { Popover } from '@/components/_shared/popover';
-import { AFConfigContext } from '@/components/main/app.hooks';
-import { ThemeModeContext } from '@/components/main/useAppThemeMode';
-import { openUrl } from '@/utils/url';
import { IconButton } from '@mui/material';
-import React, { useCallback, useContext, useMemo } from 'react';
+import React from 'react';
import { ReactComponent as MoreIcon } from '@/assets/more.svg';
-import { ReactComponent as MoonIcon } from '@/assets/moon.svg';
-import { ReactComponent as SunIcon } from '@/assets/sun.svg';
-import { ReactComponent as LoginIcon } from '@/assets/login.svg';
-import { ReactComponent as ReportIcon } from '@/assets/report.svg';
-import { ReactComponent as TrashIcon } from '@/assets/trash.svg';
-import { useTranslation } from 'react-i18next';
-import { useNavigate } from 'react-router-dom';
function MoreActions () {
- const { isDark, setDark } = useContext(ThemeModeContext) || {};
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
setAnchorEl(event.currentTarget);
};
- const [openConfirm, setOpenConfirm] = React.useState(false);
-
const handleClose = () => {
setAnchorEl(null);
};
const open = Boolean(anchorEl);
- const { t } = useTranslation();
-
- const navigate = useNavigate();
-
- const isAuthenticated = useContext(AFConfigContext)?.isAuthenticated || false;
-
- const handleLogin = useCallback(() => {
- invalidToken();
- navigate('/login?redirectTo=' + encodeURIComponent(window.location.href));
- }, [navigate]);
- const actions = useMemo(() => {
- const items = [
-
- {
- Icon: LoginIcon,
- label: isAuthenticated ? t('button.logout') : t('web.login'),
- onClick: handleLogin,
- },
-
- isDark
- ? {
- Icon: SunIcon,
- label: t('settings.appearance.themeMode.light'),
- onClick: () => {
- setDark?.(false);
- },
- }
- : {
- Icon: MoonIcon,
- label: t('settings.appearance.themeMode.dark'),
- onClick: () => {
- setDark?.(true);
- },
- },
- {
- Icon: ReportIcon,
- label: t('publish.reportPage'),
- onClick: () => {
- void openUrl('https://report.appflowy.io/', '_blank');
- },
- },
- {
- Icon: TrashIcon,
- label: t('settings.files.clearCache'),
- onClick: () => {
- setOpenConfirm(true);
- },
- },
- ];
-
- return items;
- }, [t, isAuthenticated, handleLogin, isDark, setDark]);
-
return (
<>
<IconButton onClick={handleClick}>
@@ -101,32 +34,15 @@ function MoreActions () {
open={open}
anchorEl={anchorEl}
onClose={handleClose}
+ slotProps={{ root: { className: 'text-sm' } }}
>
- <div className={'flex w-[240px] flex-col gap-2 px-2 py-2'}>
-
- {actions.map((action, index) => (
- <button
- onClick={() => {
- action.onClick();
- handleClose();
- }}
- key={index}
- className={
- 'flex items-center gap-2 rounded-[8px] p-1.5 text-sm hover:bg-content-blue-50 focus:bg-content-blue-50 focus:outline-none'
- }
- >
- <action.Icon className={'w-4 h-4'} />
- <span>{action.label}</span>
- </button>
- ))}
-
- </div>
+ <MoreActionsContent
+ itemClicked={() => {
+ handleClose();
+ }}
+ />
</Popover>
)}
- <CacheClearingDialog
- open={openConfirm}
- onClose={() => setOpenConfirm(false)}
- />
</>
);
}
diff --git a/frontend/appflowy_web_app/src/components/_shared/more-actions/MoreActionsContent.tsx b/frontend/appflowy_web_app/src/components/_shared/more-actions/MoreActionsContent.tsx
new file mode 100644
index 0000000000..38d8711daa
--- /dev/null
+++ b/frontend/appflowy_web_app/src/components/_shared/more-actions/MoreActionsContent.tsx
@@ -0,0 +1,112 @@
+import { invalidToken } from '@/application/session/token';
+import CacheClearingDialog from '@/components/_shared/modal/CacheClearingDialog';
+import { AFConfigContext } from '@/components/main/app.hooks';
+import { ThemeModeContext } from '@/components/main/useAppThemeMode';
+import { openUrl } from '@/utils/url';
+import React, { useCallback, useContext, useMemo } from 'react';
+import { ReactComponent as MoonIcon } from '@/assets/moon.svg';
+import { ReactComponent as SunIcon } from '@/assets/sun.svg';
+import { ReactComponent as LoginIcon } from '@/assets/login.svg';
+import { ReactComponent as ReportIcon } from '@/assets/report.svg';
+import { ReactComponent as TrashIcon } from '@/assets/trash.svg';
+import { useTranslation } from 'react-i18next';
+import { useNavigate } from 'react-router-dom';
+
+function MoreActionsContent ({
+ itemClicked,
+}: {
+ itemClicked: (item: {
+ Icon: React.ElementType;
+ label: string;
+ onClick: () => void;
+ }) => void;
+
+}) {
+ const { isDark, setDark } = useContext(ThemeModeContext) || {};
+ const isAuthenticated = useContext(AFConfigContext)?.isAuthenticated || false;
+ const { t } = useTranslation();
+ const navigate = useNavigate();
+
+ const handleLogin = useCallback(() => {
+ invalidToken();
+ navigate('/login?redirectTo=' + encodeURIComponent(window.location.href));
+ }, [navigate]);
+ const [openConfirm, setOpenConfirm] = React.useState(false);
+
+ const actions = useMemo(() => {
+ const items = [
+
+ {
+ Icon: LoginIcon,
+ label: isAuthenticated ? t('button.logout') : t('web.login'),
+ onClick: handleLogin,
+ },
+
+ isDark
+ ? {
+ Icon: SunIcon,
+ label: t('settings.appearance.themeMode.light'),
+ onClick: () => {
+ setDark?.(false);
+ },
+ }
+ : {
+ Icon: MoonIcon,
+ label: t('settings.appearance.themeMode.dark'),
+ onClick: () => {
+ setDark?.(true);
+ },
+ },
+ {
+ Icon: ReportIcon,
+ label: t('publish.reportPage'),
+ onClick: () => {
+ void openUrl('https://report.appflowy.io/', '_blank');
+ },
+ },
+ {
+ Icon: TrashIcon,
+ label: t('settings.files.clearCache'),
+ onClick: () => {
+ setOpenConfirm(true);
+ },
+ },
+ ];
+
+ return items;
+ }, [t, isAuthenticated, handleLogin, isDark, setDark]);
+
+ const actionsContent = useMemo(() => {
+ return <div className={'flex w-[240px] flex-col gap-2 px-2 py-2 max-md:w-full'}>
+
+ {actions.map((action, index) => (
+ <button
+ onClick={() => {
+ action.onClick();
+ itemClicked(action);
+ }}
+ key={index}
+ className={
+ 'flex items-center gap-2 rounded-[8px] p-1.5 hover:bg-fill-list-hover focus:bg-fill-list-hover focus:outline-none'
+ }
+ >
+ <action.Icon className={'w-[1.25em] h-[1.25em]'} />
+ <span>{action.label}</span>
+ </button>
+ ))}
+
+ </div>;
+ }, [actions, itemClicked]);
+
+ return (
+ <>
+ {actionsContent}
+ <CacheClearingDialog
+ open={openConfirm}
+ onClose={() => setOpenConfirm(false)}
+ />
+ </>
+ );
+}
+
+export default MoreActionsContent;
\ No newline at end of file
diff --git a/frontend/appflowy_web_app/src/components/_shared/more-actions/importer/Import.tsx b/frontend/appflowy_web_app/src/components/_shared/more-actions/importer/Import.tsx
index 6fc667ee9d..2d11b41793 100644
--- a/frontend/appflowy_web_app/src/components/_shared/more-actions/importer/Import.tsx
+++ b/frontend/appflowy_web_app/src/components/_shared/more-actions/importer/Import.tsx
@@ -10,7 +10,7 @@ function Import ({
disableClose,
onSuccessfulImport,
}: {
- disableClose: boolean;
+ disableClose?: boolean;
onSuccessfulImport?: () => void;
}) {
const {
diff --git a/frontend/appflowy_web_app/src/components/_shared/more-actions/importer/ImporterModal.tsx b/frontend/appflowy_web_app/src/components/_shared/more-actions/importer/ImporterModal.tsx
index 90a7f1544c..0f34d9467b 100644
--- a/frontend/appflowy_web_app/src/components/_shared/more-actions/importer/ImporterModal.tsx
+++ b/frontend/appflowy_web_app/src/components/_shared/more-actions/importer/ImporterModal.tsx
@@ -16,7 +16,7 @@ export function ImporterModal ({
onClose: () => void,
source?: string,
onSuccess: () => void,
- disableClose: boolean
+ disableClose?: boolean
}) {
const { t } = useTranslation();
diff --git a/frontend/appflowy_web_app/src/components/_shared/outline/OutlineIcon.tsx b/frontend/appflowy_web_app/src/components/_shared/outline/OutlineIcon.tsx
new file mode 100644
index 0000000000..4b96217ed3
--- /dev/null
+++ b/frontend/appflowy_web_app/src/components/_shared/outline/OutlineIcon.tsx
@@ -0,0 +1,40 @@
+import React from 'react';
+import { ReactComponent as ChevronDownIcon } from '@/assets/chevron_down.svg';
+
+function OutlineIcon ({ isExpanded, setIsExpanded, level }: {
+ isExpanded: boolean;
+ setIsExpanded: (isExpanded: boolean) => void;
+ level: number;
+}) {
+ if (isExpanded) {
+ return (
+ <button
+ style={{
+ paddingLeft: 1.125 * level + 'em',
+ }}
+ onClick={() => {
+ setIsExpanded(false);
+ }}
+ className={'opacity-50 hover:opacity-100'}
+ >
+ <ChevronDownIcon className={'h-[1em] w-[1em]'} />
+ </button>
+ );
+ }
+
+ return (
+ <button
+ style={{
+ paddingLeft: 1.125 * level + 'em',
+ }}
+ className={'opacity-50 hover:opacity-100'}
+ onClick={() => {
+ setIsExpanded(true);
+ }}
+ >
+ <ChevronDownIcon className={'h-[1em] w-[1em] -rotate-90 transform'} />
+ </button>
+ );
+}
+
+export default OutlineIcon;
\ No newline at end of file
diff --git a/frontend/appflowy_web_app/src/components/_shared/outline/OutlineItem.tsx b/frontend/appflowy_web_app/src/components/_shared/outline/OutlineItem.tsx
index 78b10b771b..3b7c7914c2 100644
--- a/frontend/appflowy_web_app/src/components/_shared/outline/OutlineItem.tsx
+++ b/frontend/appflowy_web_app/src/components/_shared/outline/OutlineItem.tsx
@@ -1,7 +1,7 @@
import { UIVariant, View } from '@/application/types';
+import OutlineIcon from '@/components/_shared/outline/OutlineIcon';
import OutlineItemContent from '@/components/_shared/outline/OutlineItemContent';
import React, { useCallback, useEffect, useMemo } from 'react';
-import { ReactComponent as ChevronDownIcon } from '@/assets/chevron_down.svg';
import { ReactComponent as PrivateIcon } from '@/assets/lock.svg';
function getOutlineExpands () {
@@ -45,35 +45,11 @@ function OutlineItem ({ view, level = 0, width, navigateToView, selectedViewId,
}, [isExpanded, view.view_id]);
const getIcon = useCallback(() => {
- if (isExpanded) {
- return (
- <button
- style={{
- paddingLeft: 1.125 * level + 'rem',
- }}
- onClick={() => {
- setIsExpanded(false);
- }}
- className={'opacity-50 hover:opacity-100'}
- >
- <ChevronDownIcon className={'h-4 w-4'} />
- </button>
- );
- }
-
- return (
- <button
- style={{
- paddingLeft: 1.125 * level + 'rem',
- }}
- className={'opacity-50 hover:opacity-100'}
- onClick={() => {
- setIsExpanded(true);
- }}
- >
- <ChevronDownIcon className={'h-4 w-4 -rotate-90 transform'} />
- </button>
- );
+ return <span className={'text-sm'}><OutlineIcon
+ level={level}
+ isExpanded={isExpanded}
+ setIsExpanded={setIsExpanded}
+ /></span>;
}, [isExpanded, level]);
const renderItem = useCallback((item: View) => {
diff --git a/frontend/appflowy_web_app/src/components/_shared/outline/OutlineItemContent.tsx b/frontend/appflowy_web_app/src/components/_shared/outline/OutlineItemContent.tsx
index 7f8364a5fc..cf1ce29ffb 100644
--- a/frontend/appflowy_web_app/src/components/_shared/outline/OutlineItemContent.tsx
+++ b/frontend/appflowy_web_app/src/components/_shared/outline/OutlineItemContent.tsx
@@ -43,13 +43,13 @@ function OutlineItemContent ({
onMouseLeave={() => setHovered(false)}
style={{
cursor: item.layout === ViewLayout.AIChat ? 'not-allowed' : 'pointer',
- paddingLeft: variant === 'favorite' || variant === 'recent' ? '8px' : item.children?.length ? 0 : 1.125 * (level + 1) + 'rem',
+ paddingLeft: variant === 'favorite' || variant === 'recent' ? '8px' : item.children?.length ? 0 : 1.125 * (level + 1) + 'em',
}}
className={`flex flex-1 select-none items-center gap-1.5 overflow-hidden`}
>
{isSpace && extra ?
<span
- className={'icon h-4 w-4'}
+ className={'icon h-[1.2em] w-[1.2em]'}
style={{
backgroundColor: extra.space_icon_color ? renderColor(extra.space_icon_color) : 'rgb(163, 74, 253)',
borderRadius: '4px',
@@ -63,14 +63,24 @@ function OutlineItemContent ({
<div
className={`${icon && isFlagEmoji(icon.value) ? 'icon' : ''}`}
>
- {icon?.value || <ViewIcon layout={layout} size={'medium'} />}
+ {icon?.value || <ViewIcon
+ layout={layout}
+ size={'medium'}
+ />}
</div>
}
- <Tooltip title={name} enterDelay={1000} enterNextDelay={1000}>
+ <Tooltip
+ title={name}
+ enterDelay={1000}
+ enterNextDelay={1000}
+ >
<div className={'flex-1 truncate'}>{name}</div>
</Tooltip>
- {hovered && variant === UIVariant.Publish && <PublishIcon variant={variant} view={item} />}
+ {hovered && variant === UIVariant.Publish && <PublishIcon
+ variant={variant}
+ view={item}
+ />}
</div>
);
}
diff --git a/frontend/appflowy_web_app/src/components/_shared/outline/OutlinePopover.tsx b/frontend/appflowy_web_app/src/components/_shared/outline/OutlinePopover.tsx
index 7afe9c204e..d38a2a20f7 100644
--- a/frontend/appflowy_web_app/src/components/_shared/outline/OutlinePopover.tsx
+++ b/frontend/appflowy_web_app/src/components/_shared/outline/OutlinePopover.tsx
@@ -28,7 +28,7 @@ export function OutlinePopover ({
<div
onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave}
- className={'flex h-fit max-h-[590px] flex-col overflow-y-auto overflow-x-hidden appflowy-scroller'}
+ className={'flex h-fit max-h-[590px] w-[268px] flex-col overflow-y-auto overflow-x-hidden appflowy-scroller'}
>
{content}
{variant === 'publish' && <AppFlowyPower />}
@@ -41,7 +41,11 @@ export function OutlinePopover ({
<RichTooltip
PaperProps={{
className: 'rounded-[14px] border border-tint-purple bg-bg-body m-2 overflow-hidden',
- }} open={open} onClose={onClose} content={popoverContent} placement={placement}
+ }}
+ open={open}
+ onClose={onClose}
+ content={popoverContent}
+ placement={placement}
>
{children}
</RichTooltip>
diff --git a/frontend/appflowy_web_app/src/components/_shared/view-icon/PublishIcon.tsx b/frontend/appflowy_web_app/src/components/_shared/view-icon/PublishIcon.tsx
index 4d5bb23bab..14d9bbd7c3 100644
--- a/frontend/appflowy_web_app/src/components/_shared/view-icon/PublishIcon.tsx
+++ b/frontend/appflowy_web_app/src/components/_shared/view-icon/PublishIcon.tsx
@@ -20,7 +20,7 @@ function PublishIcon ({
if (is_published && variant === 'app') {
return (
- <PublishSvg className="h-5 w-5 text-function-success" />
+ <PublishSvg className="h-5 w-5 shrink-0 text-function-success" />
);
}
diff --git a/frontend/appflowy_web_app/src/components/_shared/view-icon/ViewIcon.tsx b/frontend/appflowy_web_app/src/components/_shared/view-icon/ViewIcon.tsx
index 58a8bbdab9..5ec081de30 100644
--- a/frontend/appflowy_web_app/src/components/_shared/view-icon/ViewIcon.tsx
+++ b/frontend/appflowy_web_app/src/components/_shared/view-icon/ViewIcon.tsx
@@ -6,9 +6,10 @@ import { ReactComponent as DocumentSvg } from '@/assets/document.svg';
import { ReactComponent as GridSvg } from '@/assets/grid.svg';
import { ReactComponent as ChatSvg } from '@/assets/chat_ai.svg';
-export function ViewIcon ({ layout, size }: {
+export function ViewIcon ({ layout, size, className }: {
layout: ViewLayout;
- size: number | 'small' | 'medium' | 'large' | 'unset'
+ size: number | 'small' | 'medium' | 'large' | 'unset',
+ className?: string;
}) {
const iconSize = useMemo(() => {
if (size === 'small') {
@@ -27,20 +28,24 @@ export function ViewIcon ({ layout, size }: {
return '';
}
- return `h-${size} w-${size}`;
+ return `h-[${size}px] w-[${size}px]`;
}, [size]);
+ const iconClassName = useMemo(() => {
+ return `${iconSize} ${className || ''}`;
+ }, [iconSize, className]);
+
switch (layout) {
case ViewLayout.AIChat:
- return <ChatSvg className={iconSize} />;
+ return <ChatSvg className={iconClassName} />;
case ViewLayout.Grid:
- return <GridSvg className={iconSize} />;
+ return <GridSvg className={iconClassName} />;
case ViewLayout.Board:
- return <BoardSvg className={iconSize} />;
+ return <BoardSvg className={iconClassName} />;
case ViewLayout.Calendar:
- return <CalendarSvg className={iconSize} />;
+ return <CalendarSvg className={iconClassName} />;
case ViewLayout.Document:
- return <DocumentSvg className={iconSize} />;
+ return <DocumentSvg className={iconClassName} />;
default:
return null;
}
diff --git a/frontend/appflowy_web_app/src/components/app/AuthLayout.tsx b/frontend/appflowy_web_app/src/components/app/AuthLayout.tsx
index a22375dd0e..4668c821fc 100644
--- a/frontend/appflowy_web_app/src/components/app/AuthLayout.tsx
+++ b/frontend/appflowy_web_app/src/components/app/AuthLayout.tsx
@@ -1,11 +1,16 @@
import { AppProvider } from '@/components/app/app.hooks';
import MainLayout from '@/components/app/MainLayout';
-import React, { memo } from 'react';
+import { getPlatform } from '@/utils/platform';
+import React, { memo, Suspense } from 'react';
+
+const MobileMainLayout = React.lazy(() => import('@/components/app/MobileMainLayout'));
export function AuthLayout () {
+ const isMobile = getPlatform().isMobile;
+
return (
<AppProvider>
- <MainLayout />
+ {isMobile ? <Suspense><MobileMainLayout /></Suspense> : <MainLayout />}
</AppProvider>
);
}
diff --git a/frontend/appflowy_web_app/src/components/app/DatabaseView.tsx b/frontend/appflowy_web_app/src/components/app/DatabaseView.tsx
index 46d2ab7f95..d32f9c5106 100644
--- a/frontend/appflowy_web_app/src/components/app/DatabaseView.tsx
+++ b/frontend/appflowy_web_app/src/components/app/DatabaseView.tsx
@@ -22,7 +22,7 @@ import { useSearchParams } from 'react-router-dom';
function DatabaseView ({ viewMeta, ...props }: {
doc: YDoc;
- navigateToView?: (viewId: string) => Promise<void>;
+ navigateToView?: (viewId: string, blockId?: string) => Promise<void>;
loadViewMeta?: LoadViewMeta;
createRowDoc?: CreateRowDoc;
loadView?: LoadView;
diff --git a/frontend/appflowy_web_app/src/components/app/MainLayout.tsx b/frontend/appflowy_web_app/src/components/app/MainLayout.tsx
index 2ac32f89d7..231f416868 100644
--- a/frontend/appflowy_web_app/src/components/app/MainLayout.tsx
+++ b/frontend/appflowy_web_app/src/components/app/MainLayout.tsx
@@ -50,6 +50,8 @@ function MainLayout () {
}}
openDrawer={drawerOpened}
/>
+
+
<ErrorBoundary FallbackComponent={SomethingError}>
{main}
</ErrorBoundary>
@@ -58,7 +60,8 @@ function MainLayout () {
{drawerOpened &&
<SideBar
onResizeDrawerWidth={setDrawerWidth}
- drawerWidth={drawerWidth} drawerOpened={drawerOpened}
+ drawerWidth={drawerWidth}
+ drawerOpened={drawerOpened}
toggleOpenDrawer={toggleOpenDrawer}
/>
}
diff --git a/frontend/appflowy_web_app/src/components/app/MobileMainLayout.tsx b/frontend/appflowy_web_app/src/components/app/MobileMainLayout.tsx
new file mode 100644
index 0000000000..16ca3ecc94
--- /dev/null
+++ b/frontend/appflowy_web_app/src/components/app/MobileMainLayout.tsx
@@ -0,0 +1,42 @@
+import { UIVariant } from '@/application/types';
+import MobileTopBar from '@/components/_shared/mobile-topbar/MobileTopBar';
+import { AFScroller } from '@/components/_shared/scroller';
+import { useViewErrorStatus } from '@/components/app/app.hooks';
+import Main from '@/components/app/Main';
+import DeletedPageComponent from '@/components/error/PageHasBeenDeleted';
+import RecordNotFound from '@/components/error/RecordNotFound';
+import SomethingError from '@/components/error/SomethingError';
+import React, { useMemo } from 'react';
+import { ErrorBoundary } from 'react-error-boundary';
+
+function MobileMainLayout () {
+ const { notFound, deleted } = useViewErrorStatus();
+
+ const main = useMemo(() => {
+ if (deleted) {
+ return <DeletedPageComponent />;
+ }
+
+ return notFound ? <RecordNotFound isViewNotFound /> : <Main />;
+ }, [deleted, notFound]);
+
+ return (
+ <div className={'h-screen w-screen'}>
+ <AFScroller
+ overflowXHidden
+ overflowYHidden={false}
+ className={'appflowy-layout appflowy-mobile-layout flex flex-col appflowy-scroll-container h-full'}
+ >
+ <MobileTopBar variant={UIVariant.App} />
+
+ <ErrorBoundary FallbackComponent={SomethingError}>
+ {main}
+ </ErrorBoundary>
+
+ </AFScroller>
+
+ </div>
+ );
+}
+
+export default MobileMainLayout;
\ No newline at end of file
diff --git a/frontend/appflowy_web_app/src/components/app/app.hooks.tsx b/frontend/appflowy_web_app/src/components/app/app.hooks.tsx
index 0de618f491..08a40cd65b 100644
--- a/frontend/appflowy_web_app/src/components/app/app.hooks.tsx
+++ b/frontend/appflowy_web_app/src/components/app/app.hooks.tsx
@@ -4,7 +4,7 @@ import {
CreateRowDoc,
DatabaseRelations,
LoadView,
- LoadViewMeta,
+ LoadViewMeta, Types,
UserWorkspaceInfo,
View,
ViewLayout, YjsDatabaseKey, YjsEditorKey, YSharedRoot,
@@ -18,7 +18,7 @@ import { useNavigate, useParams } from 'react-router-dom';
import { validate as uuidValidate } from 'uuid';
export interface AppContextType {
- toView: (viewId: string) => Promise<void>;
+ toView: (viewId: string, blockId?: string, keepSearch?: boolean) => Promise<void>;
loadViewMeta: LoadViewMeta;
createRowDoc?: CreateRowDoc;
loadView: LoadView;
@@ -135,11 +135,17 @@ export const AppProvider = ({ children }: { children: React.ReactNode }) => {
});
}, []);
- const toView = useCallback(async (viewId: string, keepSearch?: boolean) => {
+ const toView = useCallback(async (viewId: string, blockId?: string, keepSearch?: boolean) => {
let url = `/app/${currentWorkspaceId}/${viewId}`;
- if (keepSearch) {
- url += window.location.search;
+ const searchParams = new URLSearchParams(keepSearch ? window.location.search : undefined);
+
+ if (blockId) {
+ searchParams.set('blockId', blockId);
+ }
+
+ if (searchParams.toString()) {
+ url += `?${searchParams.toString()}`;
}
navigate(url);
@@ -188,14 +194,20 @@ export const AppProvider = ({ children }: { children: React.ReactNode }) => {
const sharedRoot = res.get(YjsEditorKey.data_section) as YSharedRoot;
let objectId = id;
+ let collabType = Types.Document;
if (sharedRoot.has(YjsEditorKey.database)) {
const database = sharedRoot.get(YjsEditorKey.database);
objectId = database?.get(YjsDatabaseKey.id);
+ collabType = Types.Database;
}
- service.registerDocUpdate(res, currentWorkspaceId, objectId);
+ service.registerDocUpdate(res, {
+ workspaceId: currentWorkspaceId,
+ objectId,
+ collabType,
+ });
return res;
// eslint-disable-next-line
@@ -219,7 +231,11 @@ export const AppProvider = ({ children }: { children: React.ReactNode }) => {
throw new Error('Failed to create row doc');
}
- service.registerDocUpdate(doc, currentWorkspaceId, rowKey);
+ service.registerDocUpdate(doc, {
+ workspaceId: currentWorkspaceId,
+ objectId: rowKey,
+ collabType: Types.DatabaseRow,
+ });
createdRowKeys.current.push(rowKey);
return doc;
@@ -381,12 +397,17 @@ export const AppProvider = ({ children }: { children: React.ReactNode }) => {
const onChangeWorkspace = useCallback(async (workspaceId: string) => {
if (!service) return;
+ if (userWorkspaceInfo && !userWorkspaceInfo.workspaces.some((w) => w.id === workspaceId)) {
+ window.location.href = `/app/${workspaceId}`;
+ return;
+ }
+
await service.openWorkspace(workspaceId);
localStorage.removeItem('last_view_id');
setOutline(undefined);
navigate(`/app/${workspaceId}`);
- }, [navigate, service]);
+ }, [navigate, service, userWorkspaceInfo]);
return <AppContext.Provider
value={{
diff --git a/frontend/appflowy_web_app/src/components/app/favorite/Favorite.tsx b/frontend/appflowy_web_app/src/components/app/favorite/Favorite.tsx
index f5dcc159eb..7e6a4f6f84 100644
--- a/frontend/appflowy_web_app/src/components/app/favorite/Favorite.tsx
+++ b/frontend/appflowy_web_app/src/components/app/favorite/Favorite.tsx
@@ -59,7 +59,7 @@ export function Favorite () {
const groupByViewsWithDay = useMemo(() => {
return groupBy(favoriteViews, (view) => {
- const date = dayjs(view.last_edited_time);
+ const date = dayjs(view.favorited_at);
const today = date.isSame(dayjs(), 'day');
const yesterday = date.isSame(dayjs().subtract(1, 'day'), 'day');
const thisWeek = date.isSame(dayjs(), 'week');
@@ -82,7 +82,10 @@ export function Favorite () {
[FavoriteGroup.Others]: t('sideBar.others'),
};
- return <div className={'flex flex-col gap-2'} key={key}>
+ return <div
+ className={'flex flex-col gap-2'}
+ key={key}
+ >
<div className={'text-xs text-text-caption py-1 px-1'}>{timeLabel[key]}</div>
<div className={'px-1'}>
{value.map((view) =>
@@ -101,7 +104,10 @@ export function Favorite () {
return (
<div className={'flex w-full flex-col py-[10px] px-[10px]'}>
- <div onClick={handleToggleExpand} className={'flex h-fit my-0.5 w-full flex-col gap-2 cursor-pointer'}>
+ <div
+ onClick={handleToggleExpand}
+ className={'flex h-fit my-0.5 w-full flex-col gap-2 cursor-pointer'}
+ >
<div
className={
'flex items-center w-full gap-2 rounded-[8px] py-1.5 px-0.5 text-sm hover:bg-content-blue-50 focus:bg-content-blue-50 focus:outline-none'
@@ -145,7 +151,8 @@ export function Favorite () {
sx={{
maxHeight: '50vh',
}}
- open={moreOpened} anchorEl={moreButtonRef.current}
+ open={moreOpened}
+ anchorEl={moreButtonRef.current}
onClose={() => setMoreOpened(false)}
>
<div className={'flex w-[240px] flex-col gap-2 px-2 py-2'}>
diff --git a/frontend/appflowy_web_app/src/components/app/favorite/MobileFavorite.tsx b/frontend/appflowy_web_app/src/components/app/favorite/MobileFavorite.tsx
new file mode 100644
index 0000000000..f7ecaf9819
--- /dev/null
+++ b/frontend/appflowy_web_app/src/components/app/favorite/MobileFavorite.tsx
@@ -0,0 +1,45 @@
+import MobileOutlineWithCover from '@/components/_shared/mobile-outline/MobileOutlineWithCover';
+import { useAppFavorites, useAppHandlers } from '@/components/app/app.hooks';
+import { orderBy } from 'lodash-es';
+import React, { useEffect, useMemo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+function MobileFavorite ({
+ onClose,
+}: {
+ onClose: () => void;
+}) {
+ const {
+ favoriteViews,
+ loadFavoriteViews,
+ } = useAppFavorites();
+
+ useEffect(() => {
+ void loadFavoriteViews?.();
+ }, [loadFavoriteViews]);
+
+ const navigateToView = useAppHandlers().toView;
+ const { t } = useTranslation();
+ const sortedViews = useMemo(() => {
+ return orderBy(favoriteViews, ['favorited_at'], ['desc']);
+ }, [favoriteViews]);
+
+ return (
+ <div className={'flex flex-col gap-5 py-2'}>
+ {sortedViews?.map((view) => (
+ <MobileOutlineWithCover
+ timePrefix={t('sideBar.favoriteAt') + ' '}
+ key={view.view_id}
+ time={view.favorited_at}
+ view={view}
+ navigateToView={async (viewId: string) => {
+ await navigateToView(viewId);
+ onClose();
+ }}
+ />
+ ))}
+ </div>
+ );
+}
+
+export default MobileFavorite;
\ No newline at end of file
diff --git a/frontend/appflowy_web_app/src/components/app/header/RightMenu.tsx b/frontend/appflowy_web_app/src/components/app/header/RightMenu.tsx
index 27c8d495f0..14e2cb4a21 100644
--- a/frontend/appflowy_web_app/src/components/app/header/RightMenu.tsx
+++ b/frontend/appflowy_web_app/src/components/app/header/RightMenu.tsx
@@ -17,11 +17,15 @@ function RightMenu () {
<MoreActions />
<ShareButton />
<Button
- size={'small'} startIcon={<EditOutlined />} variant={'outlined'} color={'inherit'}
+ size={'small'}
+ startIcon={<EditOutlined />}
+ variant={'outlined'}
+ color={'inherit'}
onClick={() => setComingSoon(true)}
>
{t('button.editing')}
</Button>
+
<Divider
orientation={'vertical'}
className={'mx-2'}
@@ -34,10 +38,13 @@ function RightMenu () {
</Tooltip>
<NormalModal
- onOk={() => setComingSoon(false)} okText={t('button.gotIt')}
+ onOk={() => setComingSoon(false)}
+ okText={t('button.gotIt')}
title={
<div className={'text-left font-semibold'}>{'❤️ Coming Soon'}</div>
- } open={comingSoon} onClose={() => setComingSoon(false)}
+ }
+ open={comingSoon}
+ onClose={() => setComingSoon(false)}
>
<div className={'text-text-caption'}>
🌟 This feature is coming soon. Stay tuned!
diff --git a/frontend/appflowy_web_app/src/components/app/recent/MobileRecent.tsx b/frontend/appflowy_web_app/src/components/app/recent/MobileRecent.tsx
new file mode 100644
index 0000000000..cc173a405f
--- /dev/null
+++ b/frontend/appflowy_web_app/src/components/app/recent/MobileRecent.tsx
@@ -0,0 +1,41 @@
+import MobileOutlineWithCover from '@/components/_shared/mobile-outline/MobileOutlineWithCover';
+import { useAppHandlers } from '@/components/app/app.hooks';
+import { useRecent } from '@/components/app/recent/useRecent';
+import { orderBy } from 'lodash-es';
+import React, { useMemo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+function MobileRecent ({
+ onClose,
+}: {
+ onClose: () => void;
+}) {
+ const {
+ views,
+ } = useRecent();
+
+ const navigateToView = useAppHandlers().toView;
+ const { t } = useTranslation();
+ const sortedViews = useMemo(() => {
+ return orderBy(views, ['last_viewed_at'], ['desc']);
+ }, [views]);
+
+ return (
+ <div className={'flex flex-col gap-5 py-2'}>
+ {sortedViews?.map((view) => (
+ <MobileOutlineWithCover
+ key={view.view_id}
+ timePrefix={t('sideBar.lastViewed') + ' '}
+ time={view.last_viewed_at}
+ view={view}
+ navigateToView={async (viewId: string) => {
+ await navigateToView(viewId);
+ onClose();
+ }}
+ />
+ ))}
+ </div>
+ );
+}
+
+export default MobileRecent;
\ No newline at end of file
diff --git a/frontend/appflowy_web_app/src/components/app/recent/MobileRecentViewCover.tsx b/frontend/appflowy_web_app/src/components/app/recent/MobileRecentViewCover.tsx
new file mode 100644
index 0000000000..6a69059a33
--- /dev/null
+++ b/frontend/appflowy_web_app/src/components/app/recent/MobileRecentViewCover.tsx
@@ -0,0 +1,78 @@
+import { CoverType } from '@/application/types';
+import BuiltInImage1 from '@/assets/cover/m_cover_image_1.png';
+import BuiltInImage2 from '@/assets/cover/m_cover_image_2.png';
+import BuiltInImage3 from '@/assets/cover/m_cover_image_3.png';
+import BuiltInImage4 from '@/assets/cover/m_cover_image_4.png';
+import BuiltInImage5 from '@/assets/cover/m_cover_image_5.png';
+import BuiltInImage6 from '@/assets/cover/m_cover_image_6.png';
+import ImageRender from '@/components/_shared/image-render/ImageRender';
+import { renderColor } from '@/utils/color';
+import React, { useCallback, useMemo } from 'react';
+
+function MobileRecentViewCover ({ cover }: { cover: { type: string; value: string } }) {
+ const renderCoverColor = useCallback((color: string) => {
+ return (
+ <div
+ style={{
+ background: renderColor(color),
+ }}
+ className={`h-full w-full`}
+ />
+ );
+ }, []);
+
+ const renderCoverImage = useCallback((url: string) => {
+ return (
+ <>
+ <ImageRender
+ draggable={false}
+ src={url}
+ alt={''}
+ className={'h-full w-full object-cover'}
+ />
+ </>
+ );
+ }, []);
+
+ const coverType = useMemo(() => {
+ if (cover && [CoverType.NormalColor, CoverType.GradientColor].includes(cover.type as CoverType)) {
+ return 'color';
+ }
+
+ if (CoverType.BuildInImage === cover?.type) {
+ return 'built_in';
+ }
+
+ if (cover && [CoverType.CustomImage, CoverType.UpsplashImage].includes(cover.type as CoverType)) {
+ return 'custom';
+ }
+ }, [cover]);
+
+ const coverValue = useMemo(() => {
+ if (coverType === 'built_in') {
+ return {
+ 1: BuiltInImage1,
+ 2: BuiltInImage2,
+ 3: BuiltInImage3,
+ 4: BuiltInImage4,
+ 5: BuiltInImage5,
+ 6: BuiltInImage6,
+ }[cover.value];
+ }
+
+ return cover.value;
+ }, [coverType, cover.value]);
+
+ if (!coverType || !coverValue) {
+ return null;
+ }
+
+ return (
+ <div className={'w-[78px] rounded-[8px] overflow-hidden h-[54px]'}>
+ {coverType === 'color' && renderCoverColor(coverValue)}
+ {(coverType === 'custom' || coverType === 'built_in') && renderCoverImage(coverValue)}
+ </div>
+ );
+}
+
+export default MobileRecentViewCover;
\ No newline at end of file
diff --git a/frontend/appflowy_web_app/src/components/app/recent/Recent.tsx b/frontend/appflowy_web_app/src/components/app/recent/Recent.tsx
index cbb5e642e9..24c3854b6d 100644
--- a/frontend/appflowy_web_app/src/components/app/recent/Recent.tsx
+++ b/frontend/appflowy_web_app/src/components/app/recent/Recent.tsx
@@ -1,10 +1,11 @@
import { UIVariant } from '@/application/types';
import OutlineItem from '@/components/_shared/outline/OutlineItem';
import RecentListSkeleton from '@/components/_shared/skeleton/RecentListSkeleton';
-import { useAppHandlers, useAppRecent } from '@/components/app/app.hooks';
+import { useAppHandlers } from '@/components/app/app.hooks';
+import { useRecent } from '@/components/app/recent/useRecent';
import dayjs from 'dayjs';
import { groupBy, sortBy } from 'lodash-es';
-import React, { useEffect, useMemo } from 'react';
+import React, { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
enum RecentGroup {
@@ -15,19 +16,15 @@ enum RecentGroup {
export function Recent () {
const {
- recentViews,
- loadRecentViews,
- } = useAppRecent();
+ views: recentViews,
+ } = useRecent();
+
const navigateToView = useAppHandlers().toView;
const { t } = useTranslation();
- useEffect(() => {
- void loadRecentViews?.();
- }, [loadRecentViews]);
-
const groupByViewsWithDay = useMemo(() => {
return groupBy(recentViews, (view) => {
- const date = dayjs(view.last_edited_time);
+ const date = dayjs(view.last_viewed_at);
const today = date.isSame(dayjs(), 'day');
const thisWeek = date.isSame(dayjs(), 'week');
@@ -38,6 +35,12 @@ export function Recent () {
}, [recentViews]);
const groupByViews = useMemo(() => {
+ if (!recentViews?.length) {
+ return <div className={'text-text-caption w-full text-center text-sm font-medium'}>
+ {t('findAndReplace.noResult')}
+ </div>;
+ }
+
return sortBy(Object.entries(groupByViewsWithDay), ([key]) => {
return key === RecentGroup.today ? 0 : key === RecentGroup.thisWeek ? 1 : 2;
}).map(([key, value]) => {
@@ -47,7 +50,10 @@ export function Recent () {
[RecentGroup.Others]: t('sideBar.earlier'),
};
- return <div className={'flex flex-col gap-2'} key={key}>
+ return <div
+ className={'flex flex-col gap-2'}
+ key={key}
+ >
<div className={'text-xs text-text-caption py-1 px-1'}>{timeLabel[key]}</div>
<div className={'px-1'}>
{value.map((view) =>
@@ -62,7 +68,7 @@ export function Recent () {
</div>;
});
- }, [groupByViewsWithDay, navigateToView, t]);
+ }, [groupByViewsWithDay, navigateToView, recentViews?.length, t]);
return (
<div className={'flex w-[268px] flex-col gap-1 py-[10px] px-[10px]'}>
@@ -76,9 +82,7 @@ export function Recent () {
</div>
</div>
- {recentViews && recentViews.length > 0 ?
- groupByViews : <RecentListSkeleton />
- }
+ {recentViews ? groupByViews : <RecentListSkeleton />}
</div>
);
diff --git a/frontend/appflowy_web_app/src/components/app/recent/useRecent.ts b/frontend/appflowy_web_app/src/components/app/recent/useRecent.ts
new file mode 100644
index 0000000000..7771091409
--- /dev/null
+++ b/frontend/appflowy_web_app/src/components/app/recent/useRecent.ts
@@ -0,0 +1,17 @@
+import { useAppRecent } from '@/components/app/app.hooks';
+import { useEffect } from 'react';
+
+export function useRecent () {
+ const {
+ recentViews,
+ loadRecentViews,
+ } = useAppRecent();
+
+ useEffect(() => {
+ void loadRecentViews?.();
+ }, [loadRecentViews]);
+
+ return {
+ views: recentViews,
+ };
+}
\ No newline at end of file
diff --git a/frontend/appflowy_web_app/src/components/app/workspaces/CurrentWorkspace.tsx b/frontend/appflowy_web_app/src/components/app/workspaces/CurrentWorkspace.tsx
new file mode 100644
index 0000000000..69077232e2
--- /dev/null
+++ b/frontend/appflowy_web_app/src/components/app/workspaces/CurrentWorkspace.tsx
@@ -0,0 +1,42 @@
+import { UserWorkspaceInfo, Workspace } from '@/application/types';
+import { getAvatarProps } from '@/components/app/workspaces/utils';
+import { Avatar } from '@mui/material';
+import React from 'react';
+import { ReactComponent as AppFlowyLogo } from '@/assets/appflowy.svg';
+
+function CurrentWorkspace ({
+ userWorkspaceInfo,
+ selectedWorkspace,
+ onChangeWorkspace,
+}: {
+ userWorkspaceInfo?: UserWorkspaceInfo;
+ selectedWorkspace?: Workspace;
+ onChangeWorkspace: (selectedId: string) => void;
+}) {
+
+ if (!userWorkspaceInfo || !selectedWorkspace) {
+ return <div
+ className={'flex p-2 cursor-pointer items-center gap-1 text-text-title'}
+ onClick={async () => {
+ const selectedId = userWorkspaceInfo?.selectedWorkspace?.id || userWorkspaceInfo?.workspaces[0]?.id;
+
+ if (!selectedId) return;
+
+ void onChangeWorkspace(selectedId);
+ }}
+ >
+ <AppFlowyLogo className={'w-[88px]'} />
+ </div>;
+ }
+
+ return <div className={'flex items-center gap-2'}>
+ <Avatar
+ variant={'rounded'}
+ className={`w-8 h-8 flex items-center justify-center border p-1 border-line-divider rounded-[8px] ${selectedWorkspace.icon ? 'bg-transparent' : ''}`}
+ {...getAvatarProps(selectedWorkspace)}
+ />
+ <div className={'text-text-title flex-1 truncate font-semibold'}>{selectedWorkspace.name}</div>
+ </div>;
+}
+
+export default CurrentWorkspace;
\ No newline at end of file
diff --git a/frontend/appflowy_web_app/src/components/app/workspaces/MobileWorkspaces.tsx b/frontend/appflowy_web_app/src/components/app/workspaces/MobileWorkspaces.tsx
new file mode 100644
index 0000000000..f42b1ee2be
--- /dev/null
+++ b/frontend/appflowy_web_app/src/components/app/workspaces/MobileWorkspaces.tsx
@@ -0,0 +1,115 @@
+import { MobileDrawer } from '@/components/_shared/mobile-drawer';
+import { notify } from '@/components/_shared/notify';
+import { useAppHandlers, useCurrentWorkspaceId, useUserWorkspaceInfo } from '@/components/app/app.hooks';
+import CurrentWorkspace from '@/components/app/workspaces/CurrentWorkspace';
+import WorkspaceList from '@/components/app/workspaces/WorkspaceList';
+import { useCurrentUser } from '@/components/main/app.hooks';
+import { Divider, IconButton } from '@mui/material';
+import React, { useCallback, useMemo, useRef } from 'react';
+import { useTranslation } from 'react-i18next';
+import { ReactComponent as CloseIcon } from '@/assets/close.svg';
+
+function MobileWorkspaces ({
+ onClose,
+}: {
+ onClose: () => void;
+}) {
+ const [open, setOpen] = React.useState(false);
+ const { t } = useTranslation();
+ const userWorkspaceInfo = useUserWorkspaceInfo();
+ const currentWorkspaceId = useCurrentWorkspaceId();
+ const currentUser = useCurrentUser();
+ const [changeLoading, setChangeLoading] = React.useState<string | null>(null);
+ const {
+ onChangeWorkspace: handleSelectedWorkspace,
+ } = useAppHandlers();
+ const selectedWorkspace = useMemo(() => {
+ return userWorkspaceInfo?.workspaces.find((workspace) => workspace.id === currentWorkspaceId);
+ }, [currentWorkspaceId, userWorkspaceInfo]);
+
+ const handleOpen = () => {
+ setOpen(true);
+ };
+
+ const handleClose = useCallback(() => {
+ setOpen(false);
+ }, []);
+
+ const handleChange = useCallback(async (selectedId: string) => {
+ setChangeLoading(selectedId);
+ try {
+ await handleSelectedWorkspace?.(selectedId);
+ } catch (e) {
+ notify.error('Failed to change workspace');
+ }
+
+ onClose();
+ handleClose();
+ setChangeLoading(null);
+ }, [handleClose, handleSelectedWorkspace, onClose]);
+
+ const triggerNode = useMemo(() => {
+ return <div><CurrentWorkspace
+ userWorkspaceInfo={userWorkspaceInfo}
+ selectedWorkspace={selectedWorkspace}
+ onChangeWorkspace={handleChange}
+ /></div>;
+ }, [handleChange, selectedWorkspace, userWorkspaceInfo]);
+
+ const ref = useRef<HTMLDivElement>(null);
+
+ return (
+ <MobileDrawer
+ maxHeight={window.innerHeight - 56}
+ onOpen={handleOpen}
+ onClose={handleClose}
+ open={open}
+ anchor={'bottom'}
+ triggerNode={triggerNode}
+ >
+ <div
+ ref={ref}
+ className={'flex flex-col gap-2 w-full overflow-x-hidden pb-[60px] overflow-y-auto appflowy-scroller'}
+ >
+ <div className={'flex pt-10 flex-col sticky top-0 bg-bg-body z-[10]'}>
+ <div className={'relative p-4'}>
+ <IconButton
+ color={'inherit'}
+ className={'h-6 w-6 absolute font-semibold left-4'}
+ onClick={handleClose}
+ >
+ <CloseIcon className={'h-4 w-4'} />
+ </IconButton>
+ <div className={'w-full text-center font-medium '}>{t('workspace.menuTitle')}</div>
+ </div>
+ <div className={'font-medium flex-1 text-base text-text-caption p-4 underline-none'}>{currentUser?.email}</div>
+ <Divider className={'w-full'} />
+ </div>
+
+ <div
+ onTouchMove={e => {
+ const el = ref.current as HTMLDivElement;
+
+ if (!el) return;
+ if (el.scrollHeight > el.clientHeight) {
+ e.stopPropagation();
+
+ }
+ }}
+ className={'flex flex-col text-lg gap-4 p-2'}
+ >
+ {open && <WorkspaceList
+ defaultWorkspaces={userWorkspaceInfo?.workspaces}
+ currentWorkspaceId={currentWorkspaceId}
+ onChange={handleChange}
+ changeLoading={changeLoading || undefined}
+ />}
+
+ </div>
+ <Divider className={'w-full'} />
+ </div>
+ </MobileDrawer>
+ );
+}
+
+export default MobileWorkspaces;
\ No newline at end of file
diff --git a/frontend/appflowy_web_app/src/components/app/workspaces/WorkspaceList.tsx b/frontend/appflowy_web_app/src/components/app/workspaces/WorkspaceList.tsx
new file mode 100644
index 0000000000..e4b749fa7e
--- /dev/null
+++ b/frontend/appflowy_web_app/src/components/app/workspaces/WorkspaceList.tsx
@@ -0,0 +1,75 @@
+import { Workspace } from '@/application/types';
+import { getAvatarProps } from '@/components/app/workspaces/utils';
+import { useService } from '@/components/main/app.hooks';
+import { Avatar, Button, Tooltip } from '@mui/material';
+import CircularProgress from '@mui/material/CircularProgress';
+import React, { useCallback, useEffect } from 'react';
+import { useTranslation } from 'react-i18next';
+import { ReactComponent as SelectedSvg } from '@/assets/selected.svg';
+
+function WorkspaceList ({
+ defaultWorkspaces,
+ currentWorkspaceId,
+ onChange,
+ changeLoading,
+}: {
+ currentWorkspaceId?: string;
+ changeLoading?: string;
+ onChange: (selectedId: string) => void;
+ defaultWorkspaces?: Workspace[];
+}) {
+ const service = useService();
+ const { t } = useTranslation();
+ const [workspaces, setWorkspaces] = React.useState<Workspace[]>(defaultWorkspaces || []);
+ const fetchWorkspaces = useCallback(async () => {
+ if (!service) return;
+ try {
+ const workspaces = await service.getWorkspaces();
+
+ setWorkspaces(workspaces);
+ } catch (e) {
+ console.error(e);
+ }
+ }, [service]);
+
+ useEffect(() => {
+ void fetchWorkspaces();
+ }, [fetchWorkspaces]);
+
+ return (
+ <>
+ {workspaces.map((workspace) => {
+ return <Button
+ key={workspace.id}
+ className={'flex relative text-[1em] items-center justify-between gap-4 p-2 cursor-pointer'}
+ onClick={async () => {
+ if (workspace.id === currentWorkspaceId) return;
+
+ void onChange(workspace.id);
+ }}
+ >
+ <Avatar
+ variant={'rounded'}
+ className={'rounded-[8px] text-[1.2em] w-[2em] h-[2em] border border-line-divider'} {...getAvatarProps(workspace)} />
+ <div className={'flex-1 overflow-hidden flex flex-col items-start'}>
+ <Tooltip
+ title={workspace.name}
+ enterDelay={1000}
+ enterNextDelay={1000}
+ >
+ <div className={'text-text-title font-medium truncate flex-1 text-left'}>{workspace.name}</div>
+ </Tooltip>
+ <div className={'text-text-caption text-[0.85em]'}>
+ {t('members', { count: workspace.memberCount || 0 })}
+ </div>
+ </div>
+ {changeLoading === workspace.id ?
+ <CircularProgress size={16} /> : workspace.id === currentWorkspaceId &&
+ <SelectedSvg className={'w-6 text-fill-default h-6'} />}
+ </Button>;
+ })}
+ </>
+ );
+}
+
+export default WorkspaceList;
\ No newline at end of file
diff --git a/frontend/appflowy_web_app/src/components/app/workspaces/Workspaces.tsx b/frontend/appflowy_web_app/src/components/app/workspaces/Workspaces.tsx
index cb8fc7e7ae..884568cf50 100644
--- a/frontend/appflowy_web_app/src/components/app/workspaces/Workspaces.tsx
+++ b/frontend/appflowy_web_app/src/components/app/workspaces/Workspaces.tsx
@@ -1,28 +1,29 @@
import { invalidToken } from '@/application/session/token';
-import { Workspace } from '@/application/types';
+import Import from '@/components/_shared/more-actions/importer/Import';
import { notify } from '@/components/_shared/notify';
import { Popover, RichTooltip } from '@/components/_shared/popover';
-import { getAvatar } from '@/components/_shared/view-icon/utils';
import { useAppHandlers, useCurrentWorkspaceId, useUserWorkspaceInfo } from '@/components/app/app.hooks';
+import CurrentWorkspace from '@/components/app/workspaces/CurrentWorkspace';
+import WorkspaceList from '@/components/app/workspaces/WorkspaceList';
import { useCurrentUser } from '@/components/main/app.hooks';
-import { Avatar, Button, Divider, IconButton, Tooltip } from '@mui/material';
-import CircularProgress from '@mui/material/CircularProgress';
+import { openUrl } from '@/utils/url';
+import { Button, Divider, IconButton, Tooltip } from '@mui/material';
import React, { useCallback, useMemo } from 'react';
import { ReactComponent as ArrowRightSvg } from '@/assets/arrow_right.svg';
-import { ReactComponent as AppFlowyLogo } from '@/assets/appflowy.svg';
-import { ReactComponent as SelectedSvg } from '@/assets/selected.svg';
+import { ReactComponent as AddIcon } from '@/assets/add.svg';
import { ReactComponent as MoreSvg } from '@/assets/more.svg';
+import { ReactComponent as TipIcon } from '@/assets/warning.svg';
import { useTranslation } from 'react-i18next';
import { ReactComponent as LoginIcon } from '@/assets/login.svg';
-import { useNavigate } from 'react-router-dom';
+import { useNavigate, useSearchParams } from 'react-router-dom';
export function Workspaces () {
const { t } = useTranslation();
const userWorkspaceInfo = useUserWorkspaceInfo();
const currentWorkspaceId = useCurrentWorkspaceId();
const currentUser = useCurrentUser();
- const [hoveredHeader, setHoveredHeader] = React.useState<boolean>(false);
const [open, setOpen] = React.useState(false);
+ const [hoveredHeader, setHoveredHeader] = React.useState<boolean>(false);
const ref = React.useRef<HTMLButtonElement | null>(null);
const navigate = useNavigate();
const [moreOpen, setMoreOpen] = React.useState(false);
@@ -40,14 +41,6 @@ export function Workspaces () {
return userWorkspaceInfo?.workspaces.find((workspace) => workspace.id === currentWorkspaceId);
}, [currentWorkspaceId, userWorkspaceInfo]);
- const getAvatarProps = useCallback((workspace: Workspace) => {
- return getAvatar({
- icon: workspace.icon,
- name: workspace.name,
- });
-
- }, []);
-
const handleChange = useCallback(async (selectedId: string) => {
setChangeLoading(selectedId);
try {
@@ -58,6 +51,15 @@ export function Workspaces () {
setChangeLoading(null);
}, [handleSelectedWorkspace]);
+ const [, setSearchParams] = useSearchParams();
+
+ const handleOpenImport = useCallback(() => {
+ setSearchParams(prev => {
+ prev.set('action', 'import');
+ prev.set('source', 'notion');
+ return prev;
+ });
+ }, [setSearchParams]);
return <>
<Button
@@ -68,27 +70,11 @@ export function Workspaces () {
className={'flex px-1 w-full cursor-pointer justify-start py-1 items-center gap-1 mx-2 text-text-title'}
>
<div className={'flex items-center gap-1.5 text-text-title overflow-hidden'}>
- {!userWorkspaceInfo || !selectedWorkspace ?
- <div
- className={'flex p-2 cursor-pointer items-center gap-1 text-text-title'}
- onClick={async () => {
- const selectedId = userWorkspaceInfo?.selectedWorkspace?.id || userWorkspaceInfo?.workspaces[0]?.id;
-
- if (!selectedId) return;
-
- void handleChange(selectedId);
- }}
- >
- <AppFlowyLogo className={'w-[88px]'} />
- </div> : <>
- <Avatar
- variant={'rounded'}
- className={`w-6 h-6 border border-line-divider rounded-[8px] p-1 ${selectedWorkspace.icon ? 'bg-transparent' : ''}`}
- {...getAvatarProps(selectedWorkspace)}
- />
- <div className={'text-text-title flex-1 truncate font-semibold'}>{selectedWorkspace.name}</div>
- </>
- }
+ <CurrentWorkspace
+ userWorkspaceInfo={userWorkspaceInfo}
+ selectedWorkspace={selectedWorkspace}
+ onChangeWorkspace={handleChange}
+ />
{hoveredHeader && <ArrowRightSvg className={'w-4 h-4 transform rotate-90'} />}
</div>
@@ -99,7 +85,7 @@ export function Workspaces () {
onClose={() => setOpen(false)}
>
<div
- className={'flex min-w-[260px] flex-col gap-1 p-2 w-full max-h-[560px] overflow-y-auto overflow-x-hidden appflowy-scroller'}
+ className={'flex text-[14px] min-w-[260px] max-w-[300px] flex-col gap-1 p-2 w-full max-h-[560px] overflow-y-auto overflow-x-hidden appflowy-scroller'}
>
<div className={'flex px-1 text-text-caption items-center justify-between'}>
<span className={'font-medium flex-1 text-sm'}>{currentUser?.email}</span>
@@ -117,7 +103,6 @@ export function Workspaces () {
{t('button.logout')}
</Button>
</div>
-
}
open={moreOpen}
onClose={() => setMoreOpen(false)}
@@ -129,31 +114,44 @@ export function Workspaces () {
</div>
<Divider className={'w-full mt-1'} />
- {userWorkspaceInfo?.workspaces.map((workspace) => (
- <Button
- key={workspace.id}
- onClick={() => {
- void handleChange(workspace.id);
- }}
- className={'flex px-1.5 w-full cursor-pointer justify-start py-2 items-center gap-1.5 overflow-hidden text-text-title'}
- >
- <Avatar
- variant={'rounded'}
- className={'rounded-[8px] w-7 h-7 border border-line-divider'} {...getAvatarProps(workspace)} />
+ {open && <WorkspaceList
+ defaultWorkspaces={userWorkspaceInfo?.workspaces}
+ currentWorkspaceId={currentWorkspaceId}
+ onChange={handleChange}
+ changeLoading={changeLoading || undefined}
+ />}
- <Tooltip
- title={workspace.name}
- enterDelay={1000}
- enterNextDelay={1000}
+ </div>
+ <Divider className={'w-full'} />
+ <div className={'p-1.5 w-full'}>
+ <Button
+ size={'small'}
+ startIcon={<AddIcon />}
+ color={'inherit'}
+ className={'justify-start px-4 w-full overflow-hidden'}
+ onClick={handleOpenImport}
+ >
+ <div className={'flex-1 text-left'}>{t('web.importNotion')}</div>
+ <Tooltip
+ title={t('workspace.learnMore')}
+ enterDelay={1000}
+ enterNextDelay={1000}
+ >
+ <IconButton
+ onClick={(e) => {
+ e.stopPropagation();
+ void openUrl('https://docs.appflowy.io/docs/guides/import-from-notion', '_blank');
+ }}
+ size={'small'}
>
- <div className={'text-text-title font-medium truncate flex-1 text-left'}>{workspace.name}</div>
- </Tooltip>
- {changeLoading === workspace.id ? <CircularProgress size={16} /> : workspace.id === selectedWorkspace?.id &&
- <SelectedSvg className={'w-4 text-function-success h-4'} />}
- </Button>
- ))}
+ <TipIcon className={'w-4 h-4'} />
+ </IconButton>
+ </Tooltip>
+ </Button>
</div>
+
</Popover>
+ <Import />
</>;
}
diff --git a/frontend/appflowy_web_app/src/components/app/workspaces/utils.ts b/frontend/appflowy_web_app/src/components/app/workspaces/utils.ts
new file mode 100644
index 0000000000..21f5a2ebb3
--- /dev/null
+++ b/frontend/appflowy_web_app/src/components/app/workspaces/utils.ts
@@ -0,0 +1,9 @@
+import { Workspace } from '@/application/types';
+import { getAvatar } from '@/components/_shared/view-icon/utils';
+
+export function getAvatarProps (workspace: Workspace) {
+ return getAvatar({
+ icon: workspace.icon,
+ name: workspace.name,
+ });
+}
\ No newline at end of file
diff --git a/frontend/appflowy_web_app/src/components/database/Database.tsx b/frontend/appflowy_web_app/src/components/database/Database.tsx
index 7eef83b803..b5c443a5b8 100644
--- a/frontend/appflowy_web_app/src/components/database/Database.tsx
+++ b/frontend/appflowy_web_app/src/components/database/Database.tsx
@@ -20,7 +20,7 @@ export interface Database2Props {
doc: YDoc;
createRowDoc?: CreateRowDoc;
loadView?: LoadView;
- navigateToView?: (viewId: string) => Promise<void>;
+ navigateToView?: (viewId: string, blockId?: string) => Promise<void>;
loadViewMeta?: LoadViewMeta;
viewId: string;
iidName: string;
@@ -108,7 +108,6 @@ function Database ({
useEffect(() => {
onRendered?.();
}, [onRendered]);
-
if (!rowDocMap || !viewId) {
return null;
}
@@ -129,7 +128,10 @@ function Database ({
createRowDoc={createRowDoc}
>
{rowId ? (
- <DatabaseRow appendBreadcrumb={appendBreadcrumb} rowId={rowId} />
+ <DatabaseRow
+ appendBreadcrumb={appendBreadcrumb}
+ rowId={rowId}
+ />
) : (
<div className="appflowy-database relative flex w-full flex-1 select-text flex-col overflow-y-hidden">
<DatabaseViews
diff --git a/frontend/appflowy_web_app/src/components/database/DatabaseViews.tsx b/frontend/appflowy_web_app/src/components/database/DatabaseViews.tsx
index 90976ed273..0f10b49c0d 100644
--- a/frontend/appflowy_web_app/src/components/database/DatabaseViews.tsx
+++ b/frontend/appflowy_web_app/src/components/database/DatabaseViews.tsx
@@ -65,11 +65,20 @@ function DatabaseViews ({
const skeleton = useMemo(() => {
switch (layout) {
case DatabaseViewLayout.Grid:
- return <GridSkeleton includeTitle={false} includeTabs={false} />;
+ return <GridSkeleton
+ includeTitle={false}
+ includeTabs={false}
+ />;
case DatabaseViewLayout.Board:
- return <KanbanSkeleton includeTitle={false} includeTabs={false} />;
+ return <KanbanSkeleton
+ includeTitle={false}
+ includeTabs={false}
+ />;
case DatabaseViewLayout.Calendar:
- return <CalendarSkeleton includeTitle={false} includeTabs={false} />;
+ return <CalendarSkeleton
+ includeTitle={false}
+ includeTabs={false}
+ />;
default:
return null;
}
diff --git a/frontend/appflowy_web_app/src/components/database/components/database-row/DatabaseRowSubDocument.tsx b/frontend/appflowy_web_app/src/components/database/components/database-row/DatabaseRowSubDocument.tsx
index c5d662ec7a..2d4ef3a416 100644
--- a/frontend/appflowy_web_app/src/components/database/components/database-row/DatabaseRowSubDocument.tsx
+++ b/frontend/appflowy_web_app/src/components/database/components/database-row/DatabaseRowSubDocument.tsx
@@ -39,10 +39,10 @@ export function DatabaseRowSubDocument ({ rowId }: { rowId: string }) {
);
}
- if (!doc) return null;
+ if (!doc || !documentId) return null;
return (
-
<Editor
+ viewId={documentId}
doc={doc}
loadViewMeta={loadViewMeta}
navigateToView={navigateToView}
diff --git a/frontend/appflowy_web_app/src/components/database/components/grid/grid-column/GridColumn.tsx b/frontend/appflowy_web_app/src/components/database/components/grid/grid-column/GridColumn.tsx
index 76a8fbc236..da1316003a 100644
--- a/frontend/appflowy_web_app/src/components/database/components/grid/grid-column/GridColumn.tsx
+++ b/frontend/appflowy_web_app/src/components/database/components/grid/grid-column/GridColumn.tsx
@@ -2,12 +2,17 @@ import { YjsDatabaseKey } from '@/application/types';
import { FieldType } from '@/application/database-yjs/database.type';
import { Column, useFieldSelector } from '@/application/database-yjs/selector';
import { FieldTypeIcon } from '@/components/database/components/field';
+import { ThemeModeContext } from '@/components/main/useAppThemeMode';
+import { getIconSvgEncodedContent } from '@/utils/emoji';
import { Tooltip } from '@mui/material';
-import React, { useMemo } from 'react';
+import React, { useContext, useEffect, useMemo, useState } from 'react';
import { ReactComponent as AIIndicatorSvg } from '@/assets/ai_indicator.svg';
export function GridColumn ({ column, index }: { column: Column; index: number }) {
const { field } = useFieldSelector(column.fieldId);
+ const [iconEncodeContent, setIconEncodeContent] = useState<string | null>(null);
+
+ const isDark = useContext(ThemeModeContext)?.isDark;
const name = field?.get(YjsDatabaseKey.name);
const type = useMemo(() => {
const type = field?.get(YjsDatabaseKey.type);
@@ -16,11 +21,24 @@ export function GridColumn ({ column, index }: { column: Column; index: number }
return parseInt(type) as FieldType;
}, [field]);
+ const icon = field?.get(YjsDatabaseKey.icon);
+
+ useEffect(() => {
+ if (icon) {
+ void getIconSvgEncodedContent(icon, isDark ? 'white' : 'black').then((res) => {
+ setIconEncodeContent(res);
+ });
+ }
+ }, [icon, isDark]);
const isAIField = [FieldType.AISummaries, FieldType.AITranslations].includes(type);
return (
- <Tooltip title={name} enterNextDelay={1000} placement={'right'}>
+ <Tooltip
+ title={name}
+ enterNextDelay={1000}
+ placement={'right'}
+ >
<div
style={{
borderLeftWidth: index === 0 ? 0 : 1,
@@ -30,7 +48,15 @@ export function GridColumn ({ column, index }: { column: Column; index: number }
}
>
<div>
- <FieldTypeIcon type={type} className={'mr-1 w-4 h-4 icon'} />
+ {iconEncodeContent ? <img
+ src={iconEncodeContent}
+ className={'h-full w-full p-1 opacity-40'}
+ alt={icon}
+ /> : <FieldTypeIcon
+ type={type}
+ className={'mr-1 w-4 h-4 icon'}
+ />}
+
</div>
<div className={'flex-1'}>{name}</div>
{isAIField && <AIIndicatorSvg className={'text-xl w-4 h-4'} />}
diff --git a/frontend/appflowy_web_app/src/components/database/components/grid/grid-header/GridHeader.tsx b/frontend/appflowy_web_app/src/components/database/components/grid/grid-header/GridHeader.tsx
index d08b060d2d..875249dd9a 100644
--- a/frontend/appflowy_web_app/src/components/database/components/grid/grid-header/GridHeader.tsx
+++ b/frontend/appflowy_web_app/src/components/database/components/grid/grid-header/GridHeader.tsx
@@ -20,12 +20,18 @@ const Cell = memo(({ columnIndex, style, data }: GridChildComponentProps) => {
if (column.type === GridColumnType.Field) {
return (
<div style={style}>
- <GridColumn column={column} index={columnIndex} />
+ <GridColumn
+ column={column}
+ index={columnIndex}
+ />
</div>
);
}
- return <div style={style} className={'border-t border-b border-line-divider'} />;
+ return <div
+ style={style}
+ className={'border-t border-b border-line-divider'}
+ />;
}, areEqual);
export const GridHeader = ({ scrollLeft, onScrollLeft, columnWidth, columns }: GridHeaderProps) => {
diff --git a/frontend/appflowy_web_app/src/components/database/grid/Grid.tsx b/frontend/appflowy_web_app/src/components/database/grid/Grid.tsx
index 2f7b0dc56c..94cdedef92 100644
--- a/frontend/appflowy_web_app/src/components/database/grid/Grid.tsx
+++ b/frontend/appflowy_web_app/src/components/database/grid/Grid.tsx
@@ -24,7 +24,12 @@ export function Grid () {
return (
<div className={'database-grid flex w-full flex-1 flex-col'}>
- <GridHeader scrollLeft={scrollLeft} columnWidth={columnWidth} columns={fields} onScrollLeft={setScrollLeft} />
+ <GridHeader
+ scrollLeft={scrollLeft}
+ columnWidth={columnWidth}
+ columns={fields}
+ onScrollLeft={setScrollLeft}
+ />
<div className={'grid-scroll-table w-full flex-1'}>
<GridTable
viewId={viewId}
diff --git a/frontend/appflowy_web_app/src/components/document/Document.tsx b/frontend/appflowy_web_app/src/components/document/Document.tsx
index d4912214ca..0dd3bc7622 100644
--- a/frontend/appflowy_web_app/src/components/document/Document.tsx
+++ b/frontend/appflowy_web_app/src/components/document/Document.tsx
@@ -9,7 +9,7 @@ import { useSearchParams } from 'react-router-dom';
export interface DocumentProps {
doc: YDoc;
readOnly: boolean;
- navigateToView?: (viewId: string) => Promise<void>;
+ navigateToView?: (viewId: string, blockId?: string) => Promise<void>;
loadViewMeta?: LoadViewMeta;
loadView?: LoadView;
createRowDoc?: CreateRowDoc;
@@ -42,18 +42,20 @@ export const Document = ({
}, [setSearch]);
const document = doc?.getMap(YjsEditorKey.data_section)?.get(YjsEditorKey.document);
- if (!document) return null;
+ if (!document || !viewMeta.viewId) return null;
return (
<div
style={{
minHeight: `calc(100vh - 48px)`,
- }} className={'flex h-full w-full flex-col items-center'}
+ }}
+ className={'flex h-full w-full flex-col items-center'}
>
<ViewMetaPreview {...viewMeta} />
<Suspense fallback={<EditorSkeleton />}>
<div className={'flex justify-center w-full'}>
<Editor
+ viewId={viewMeta.viewId}
loadView={loadView}
loadViewMeta={loadViewMeta}
navigateToView={navigateToView}
diff --git a/frontend/appflowy_web_app/src/components/editor/Editor.cy.tsx b/frontend/appflowy_web_app/src/components/editor/Editor.cy.tsx
index ddcf720750..01de8f4f7c 100644
--- a/frontend/appflowy_web_app/src/components/editor/Editor.cy.tsx
+++ b/frontend/appflowy_web_app/src/components/editor/Editor.cy.tsx
@@ -35,7 +35,11 @@ function renderEditor (doc: YDoc) {
const AppWrapper = withAppWrapper(() => {
return (
<div className={'h-screen w-screen overflow-y-auto'}>
- <Editor doc={doc} readOnly />
+ <Editor
+ doc={doc}
+ readOnly
+ viewId={''}
+ />
</div>
);
});
diff --git a/frontend/appflowy_web_app/src/components/editor/EditorContext.tsx b/frontend/appflowy_web_app/src/components/editor/EditorContext.tsx
index 6a4bd4d524..de592fd326 100644
--- a/frontend/appflowy_web_app/src/components/editor/EditorContext.tsx
+++ b/frontend/appflowy_web_app/src/components/editor/EditorContext.tsx
@@ -31,11 +31,12 @@ interface Decorate {
}
export interface EditorContextState {
+ viewId: string;
readOnly: boolean;
layoutStyle?: EditorLayoutStyle;
codeGrammars?: Record<string, string>;
addCodeGrammars?: (blockId: string, grammar: string) => void;
- navigateToView?: (viewId: string) => Promise<void>;
+ navigateToView?: (viewId: string, blockId?: string) => Promise<void>;
loadViewMeta?: LoadViewMeta;
loadView?: LoadView;
createRowDoc?: CreateRowDoc;
@@ -53,6 +54,7 @@ export const EditorContext = createContext<EditorContextState>({
readOnly: true,
layoutStyle: defaultLayoutStyle,
codeGrammars: {},
+ viewId: '',
});
export const EditorContextProvider = ({ children, ...props }: EditorContextState & { children: React.ReactNode }) => {
diff --git a/frontend/appflowy_web_app/src/components/editor/__tests__/blocks/Paragraph.cy.tsx b/frontend/appflowy_web_app/src/components/editor/__tests__/blocks/Paragraph.cy.tsx
index 6fec1402bf..07a01cc7c6 100644
--- a/frontend/appflowy_web_app/src/components/editor/__tests__/blocks/Paragraph.cy.tsx
+++ b/frontend/appflowy_web_app/src/components/editor/__tests__/blocks/Paragraph.cy.tsx
@@ -12,7 +12,7 @@ describe('<Paragraph />', () => {
const documentTest = new DocumentTest();
documentTest.fromJSON(data);
- mountEditor({ readOnly: true, doc: documentTest.doc });
+ mountEditor({ readOnly: true, doc: documentTest.doc, viewId: '' });
}).as('render');
cy.get('[role="textbox"]').should('exist');
cy.get('[data-block-type="paragraph"]').should('have.length', 7);
@@ -59,7 +59,7 @@ describe('<Paragraph />', () => {
cy.get('[role="textbox"]').selectMultipleText(['bold']);
cy.wait(50);
-
+
cy.get('[role="textbox"]').type('{backspace}');
const expectJSON = [{
diff --git a/frontend/appflowy_web_app/src/components/editor/__tests__/mount.tsx b/frontend/appflowy_web_app/src/components/editor/__tests__/mount.tsx
index dac04098ca..6ebe9030ad 100644
--- a/frontend/appflowy_web_app/src/components/editor/__tests__/mount.tsx
+++ b/frontend/appflowy_web_app/src/components/editor/__tests__/mount.tsx
@@ -58,7 +58,7 @@ export const initialEditorTest = () => {
const initializeEditor = (data: FromBlockJSON[]) => {
documentTest = new DocumentTest();
documentTest.fromJSON(data);
- mountEditor({ readOnly: false, doc: documentTest.doc });
+ mountEditor({ readOnly: false, doc: documentTest.doc, viewId: 'test' });
cy.get('[role="textbox"]').should('exist');
};
diff --git a/frontend/appflowy_web_app/src/components/editor/components/blocks/code/Code.tsx b/frontend/appflowy_web_app/src/components/editor/components/blocks/code/Code.tsx
index b26d735db5..d74cc5c8f8 100644
--- a/frontend/appflowy_web_app/src/components/editor/components/blocks/code/Code.tsx
+++ b/frontend/appflowy_web_app/src/components/editor/components/blocks/code/Code.tsx
@@ -23,13 +23,22 @@ export const CodeBlock = memo(
}}
onMouseLeave={() => setShowToolbar(false)}
>
- <div contentEditable={false} className={'absolute mt-2 flex h-20 w-full select-none items-center px-6'}>
- <LanguageSelect readOnly language={language} onChangeLanguage={handleChangeLanguage} />
+ <div
+ contentEditable={false}
+ className={'absolute mt-2 flex h-20 w-full select-none items-center px-6'}
+ >
+ <LanguageSelect
+ readOnly
+ language={language}
+ onChangeLanguage={handleChangeLanguage}
+ />
</div>
- <div {...attributes} ref={ref} className={`${attributes.className ?? ''} flex w-full bg-bg-body py-2`}>
+ <div {...attributes} ref={ref}
+ className={`${attributes.className ?? ''} flex w-full bg-bg-body py-2`}
+ >
<pre
spellCheck={false}
- className={`flex w-full overflow-hidden rounded border border-line-divider bg-fill-list-active p-5 pt-20`}
+ className={`flex w-full overflow-hidden rounded-[8px] border border-line-divider bg-fill-list-active p-5 pt-20`}
>
<code>{children}</code>
</pre>
@@ -55,6 +64,6 @@ export const CodeBlock = memo(
</div>
);
}),
- (prevProps, nextProps) => JSON.stringify(prevProps.node) === JSON.stringify(nextProps.node)
+ (prevProps, nextProps) => JSON.stringify(prevProps.node) === JSON.stringify(nextProps.node),
);
export default CodeBlock;
diff --git a/frontend/appflowy_web_app/src/components/editor/components/blocks/link-preview/LinkPreview.tsx b/frontend/appflowy_web_app/src/components/editor/components/blocks/link-preview/LinkPreview.tsx
index 00d3c927a3..4de2b248a2 100644
--- a/frontend/appflowy_web_app/src/components/editor/components/blocks/link-preview/LinkPreview.tsx
+++ b/frontend/appflowy_web_app/src/components/editor/components/blocks/link-preview/LinkPreview.tsx
@@ -46,7 +46,7 @@ export const LinkPreview = memo(
>
<div
className={
- 'container-bg flex w-full cursor-pointer select-none items-center gap-4 overflow-hidden rounded border border-line-divider bg-fill-list-active p-3'
+ 'container-bg flex w-full cursor-pointer select-none items-center gap-4 overflow-hidden rounded-[8px] border border-line-divider bg-fill-list-active p-3'
}
>
{notFound ? (
diff --git a/frontend/appflowy_web_app/src/components/editor/components/blocks/sub-page/SubPage.tsx b/frontend/appflowy_web_app/src/components/editor/components/blocks/sub-page/SubPage.tsx
new file mode 100644
index 0000000000..f1f5cfd705
--- /dev/null
+++ b/frontend/appflowy_web_app/src/components/editor/components/blocks/sub-page/SubPage.tsx
@@ -0,0 +1,33 @@
+import MentionPage from '@/components/editor/components/leaf/mention/MentionPage';
+import { EditorElementProps, SubpageNode } from '@/components/editor/editor.type';
+import React, { forwardRef, memo, useMemo } from 'react';
+
+export const SubPage = memo(
+ forwardRef<HTMLDivElement, EditorElementProps<SubpageNode>>(({ node, children, ...attributes }, ref) => {
+ const className = useMemo(() => {
+ const classList = ['subpage', attributes.className ?? '', 'relative', 'w-full', 'h-full', 'overflow-hidden', 'hover:bg-fill-list-hover', 'rounded-[8px] p-1 cursor-pointer'];
+
+ return classList.join(' ');
+ }, [attributes.className]);
+
+ const pageId = node.data.view_id;
+
+ return (
+ <div
+ {...attributes}
+ contentEditable={false}
+ className={className}
+ >
+ <div
+ ref={ref}
+ className={'absolute left-0 top-0 h-full w-full select-none caret-transparent'}
+ >
+ {children}
+ </div>
+ <MentionPage pageId={pageId} />
+ </div>
+ );
+ }),
+);
+
+export default SubPage;
\ No newline at end of file
diff --git a/frontend/appflowy_web_app/src/components/editor/components/blocks/sub-page/index.ts b/frontend/appflowy_web_app/src/components/editor/components/blocks/sub-page/index.ts
new file mode 100644
index 0000000000..ca17f9b10e
--- /dev/null
+++ b/frontend/appflowy_web_app/src/components/editor/components/blocks/sub-page/index.ts
@@ -0,0 +1 @@
+export * from './SubPage';
\ No newline at end of file
diff --git a/frontend/appflowy_web_app/src/components/editor/components/element/Element.tsx b/frontend/appflowy_web_app/src/components/editor/components/element/Element.tsx
index 83db4a296c..32c772b8e2 100644
--- a/frontend/appflowy_web_app/src/components/editor/components/element/Element.tsx
+++ b/frontend/appflowy_web_app/src/components/editor/components/element/Element.tsx
@@ -20,6 +20,7 @@ import { useEditorContext } from '@/components/editor/EditorContext';
import { ElementFallbackRender } from '@/components/error/ElementFallbackRender';
import { ErrorBoundary } from 'react-error-boundary';
import smoothScrollIntoViewIfNeeded from 'smooth-scroll-into-view-if-needed';
+import SubPage from 'src/components/editor/components/blocks/sub-page/SubPage';
import { TodoList } from 'src/components/editor/components/blocks/todo-list';
import { ToggleList } from 'src/components/editor/components/blocks/toggle-list';
import { UnSupportedBlock } from '@/components/editor/components/element/UnSupportedBlock';
@@ -42,6 +43,7 @@ export const Element = ({
} = useEditorContext();
const editor = useSlateStatic();
+ const highlightTimeoutRef = React.useRef<NodeJS.Timeout>();
useEffect(() => {
if (!jumpBlockId) return;
@@ -57,10 +59,23 @@ export const Element = ({
behavior: 'smooth',
scrollMode: 'if-needed',
});
+ element.className += ' highlight-block';
+ highlightTimeoutRef.current = setTimeout(() => {
+ element.className = element.className.replace('highlight-block', '');
+ }, 5000);
+
onJumpedBlockId?.();
})();
}, [editor, jumpBlockId, node, onJumpedBlockId]);
+
+ useEffect(() => {
+ return () => {
+ if (highlightTimeoutRef.current) {
+ clearTimeout(highlightTimeoutRef.current);
+ }
+ };
+ }, []);
const Component = useMemo(() => {
switch (node.type) {
case BlockType.HeadingBlock:
@@ -105,6 +120,8 @@ export const Element = ({
return FileBlock;
case BlockType.GalleryBlock:
return GalleryBlock;
+ case BlockType.SubpageBlock:
+ return SubPage;
default:
return UnSupportedBlock;
}
@@ -114,7 +131,7 @@ export const Element = ({
const data = (node.data as BlockData) || {};
const align = data.align;
- return `block-element relative flex rounded ${align ? `block-align-${align}` : ''}`;
+ return `block-element relative flex rounded-[8px] ${align ? `block-align-${align}` : ''}`;
}, [node.data]);
const style = useMemo(() => {
@@ -136,8 +153,14 @@ export const Element = ({
return (
<ErrorBoundary fallbackRender={ElementFallbackRender}>
- <div {...attributes} data-block-type={node.type} className={className}>
- <Component style={style} className={`flex w-full flex-col`} node={node}>
+ <div {...attributes} data-block-type={node.type}
+ className={className}
+ >
+ <Component
+ style={style}
+ className={`flex w-full flex-col`}
+ node={node}
+ >
{children}
</Component>
</div>
diff --git a/frontend/appflowy_web_app/src/components/editor/components/element/UnSupportedBlock.tsx b/frontend/appflowy_web_app/src/components/editor/components/element/UnSupportedBlock.tsx
index 99c299bc64..c97dbfb283 100644
--- a/frontend/appflowy_web_app/src/components/editor/components/element/UnSupportedBlock.tsx
+++ b/frontend/appflowy_web_app/src/components/editor/components/element/UnSupportedBlock.tsx
@@ -4,9 +4,28 @@ import { Alert } from '@mui/material';
export const UnSupportedBlock = forwardRef<HTMLDivElement, EditorElementProps>(({ node }, ref) => {
return (
- <div className={'w-full'} ref={ref}>
- <Alert className={'h-[48px] w-full'} severity={'error'}>
- {`Unsupported block: ${node.type}`}
+ <div
+ className={'w-full'}
+ ref={ref}
+ >
+ <Alert
+ className={'h-fit w-full'}
+ severity={'warning'}
+ >
+ <div className={'text-base font-semibold'}>{`Unsupported Block: ${node.type}`}</div>
+
+ <div className={'whitespace-pre my-4 font-medium'}>
+ {`We're sorry for inconvenience \n`}
+ Submit an issue on our{' '}<a
+ className={'underline text-fill-default'}
+ href={'https://github.com/AppFlowy-IO/AppFlowy/issues/new?template=bug_report.yaml'}
+ >Github</a>{' '}page that describes your error
+ </div>
+
+ <span className={'text-sm'}>
+ <pre><code>{JSON.stringify(node, null, 2)}</code></pre>
+ </span>
+
</Alert>
</div>
);
diff --git a/frontend/appflowy_web_app/src/components/editor/components/leaf/Leaf.tsx b/frontend/appflowy_web_app/src/components/editor/components/leaf/Leaf.tsx
index c430a9575a..165fb43a4f 100644
--- a/frontend/appflowy_web_app/src/components/editor/components/leaf/Leaf.tsx
+++ b/frontend/appflowy_web_app/src/components/editor/components/leaf/Leaf.tsx
@@ -55,12 +55,15 @@ export function Leaf ({ attributes, children, leaf, text }: RenderLeafProps) {
const node = leaf.mention ? <MentionLeaf
text={text}
mention={leaf.mention as Mention}
- /> : leaf.formula ? <FormulaLeaf formula={leaf.formula} text={text} /> : null;
+ /> : leaf.formula ? <FormulaLeaf
+ formula={leaf.formula}
+ text={text}
+ /> : null;
newChildren = <>
{node}
<span
- className={'absolute opacity-0 left-0'}
+ className={'absolute opacity-0 left-0 w-0 overflow-hidden'}
>
{newChildren}
</span>
@@ -68,7 +71,9 @@ export function Leaf ({ attributes, children, leaf, text }: RenderLeafProps) {
}
return (
- <span {...attributes} style={style} className={`${classList.join(' ')}`}>
+ <span {...attributes} style={style}
+ className={`${classList.join(' ')}`}
+ >
{newChildren}
</span>
);
diff --git a/frontend/appflowy_web_app/src/components/editor/components/leaf/mention/MentionLeaf.tsx b/frontend/appflowy_web_app/src/components/editor/components/leaf/mention/MentionLeaf.tsx
index 2e07a4eadb..efe7d225a3 100644
--- a/frontend/appflowy_web_app/src/components/editor/components/leaf/mention/MentionLeaf.tsx
+++ b/frontend/appflowy_web_app/src/components/editor/components/leaf/mention/MentionLeaf.tsx
@@ -11,26 +11,33 @@ export function MentionLeaf ({ mention, text }: {
text: Text;
}) {
const readonly = useReadOnly();
- const { type, date, page_id, reminder_id, reminder_option } = mention;
+ const { type, date, page_id, reminder_id, reminder_option, block_id } = mention;
const reminder = useMemo(() => {
return reminder_id ? { id: reminder_id ?? '', option: reminder_option ?? '' } : undefined;
}, [reminder_id, reminder_option]);
const content = useMemo(() => {
- if (type === MentionType.PageRef && page_id) {
- return <MentionPage pageId={page_id} />;
+ if ([MentionType.PageRef, MentionType.childPage].includes(type) && page_id) {
+ return <MentionPage
+ type={type}
+ pageId={page_id}
+ blockId={block_id}
+ />;
}
if (type === MentionType.Date && date) {
- return <MentionDate date={date} reminder={reminder} />;
+ return <MentionDate
+ date={date}
+ reminder={reminder}
+ />;
}
- }, [date, page_id, reminder, type]);
+ }, [date, page_id, reminder, type, block_id]);
// check if the mention is selected
const { isSelected, select, isCursorAfter, isCursorBefore } = useLeafSelected(text);
const className = useMemo(() => {
- const classList = ['w-fit mention', 'relative', 'rounded', 'p-0.5'];
+ const classList = ['w-fit mention', 'relative', 'rounded', 'py-0.5'];
if (readonly) classList.push('cursor-default');
else classList.push('cursor-pointer');
@@ -43,7 +50,8 @@ export function MentionLeaf ({ mention, text }: {
return <span
onClick={select}
- contentEditable={false} className={className}
+ contentEditable={false}
+ className={className}
>
{content}
</span>;
diff --git a/frontend/appflowy_web_app/src/components/editor/components/leaf/mention/MentionPage.tsx b/frontend/appflowy_web_app/src/components/editor/components/leaf/mention/MentionPage.tsx
index 52ea133502..e13ab5a4f1 100644
--- a/frontend/appflowy_web_app/src/components/editor/components/leaf/mention/MentionPage.tsx
+++ b/frontend/appflowy_web_app/src/components/editor/components/leaf/mention/MentionPage.tsx
@@ -1,15 +1,25 @@
-import { ViewLayout, View } from '@/application/types';
+import { YjsEditor } from '@/application/slate-yjs';
+import { CustomEditor } from '@/application/slate-yjs/command';
+import { traverseBlock } from '@/application/slate-yjs/utils/convert';
+import { MentionType, View, ViewLayout, YjsEditorKey, YSharedRoot } from '@/application/types';
+import { ReactComponent as NorthEast } from '@/assets/north_east.svg';
+import { ReactComponent as MarkIcon } from '@/assets/paragraph_mark.svg';
+
import { ViewIcon } from '@/components/_shared/view-icon';
import { useEditorContext } from '@/components/editor/EditorContext';
import { isFlagEmoji } from '@/utils/emoji';
import React, { useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
+import { useSlateStatic } from 'slate-react';
-function MentionPage ({ pageId }: { pageId: string }) {
+function MentionPage ({ pageId, blockId, type }: { pageId: string; blockId?: string; type?: MentionType }) {
const context = useEditorContext();
- const { navigateToView, loadViewMeta } = context;
+ const editor = useSlateStatic();
+ const currentViewId = context.viewId;
+ const { navigateToView, loadViewMeta, loadView } = context;
const [noAccess, setNoAccess] = useState(false);
const [meta, setMeta] = useState<View | null>(null);
+ const [content, setContent] = useState<string>('');
useEffect(() => {
void (async () => {
@@ -36,12 +46,75 @@ function MentionPage ({ pageId }: { pageId: string }) {
return icon ? isFlagEmoji(icon.value) : false;
}, [icon]);
+ useEffect(() => {
+ void (
+ async () => {
+ const pageName = meta?.name || t('menuAppHeader.defaultNewPageName');
+
+ if (blockId) {
+ if (currentViewId === pageId) {
+ const entry = CustomEditor.getBlockEntry(editor as YjsEditor, blockId);
+
+ if (entry) {
+ const [node] = entry;
+
+ setContent(CustomEditor.getBlockTextContent(node, 2));
+ return;
+ }
+
+ } else {
+ try {
+ const otherDoc = await loadView?.(pageId);
+
+ if (!otherDoc) return;
+
+ const sharedRoot = otherDoc.getMap(YjsEditorKey.data_section) as YSharedRoot;
+
+ const node = traverseBlock(blockId, sharedRoot);
+
+ if (!node) return;
+
+ setContent(`${pageName} - ${CustomEditor.getBlockTextContent(node, 2)}`);
+ return;
+
+ } catch (e) {
+ // do nothing
+ }
+ }
+
+ }
+
+ setContent(pageName);
+ }
+ )();
+ }, [blockId, currentViewId, editor, loadView, meta?.name, pageId, t]);
+
+ const mentionIcon = useMemo(() => {
+ if (pageId === currentViewId && blockId) {
+ return <MarkIcon className={'text-icon-secondary ml-0.5'} />;
+ }
+
+ return <>
+ {icon?.value || <ViewIcon
+ layout={meta?.layout || ViewLayout.Document}
+ size={'unset'}
+ className={'text-text-title ml-0.5'}
+ />}
+ {type === MentionType.PageRef &&
+ <span className={`absolute ${icon?.value ? 'right-1 bottom-1' : 'right-0 bottom-0'}`}>
+ <NorthEast className={'w-3 h-3 text-content-blue-700'} />
+ </span>
+ }
+ </>;
+ }, [blockId, currentViewId, icon?.value, meta?.layout, pageId, type]);
+
return (
<span
- onClick={() => {
- void navigateToView?.(pageId);
+ onClick={(e) => {
+ e.stopPropagation();
+ void navigateToView?.(pageId, blockId);
}}
- className={`mention-inline cursor-pointer px-1 underline`}
+ className={`mention-inline cursor-pointer pr-1 underline`}
contentEditable={false}
data-mention-id={pageId}
>
@@ -50,13 +123,12 @@ function MentionPage ({ pageId }: { pageId: string }) {
) : (
<>
<span className={`mention-icon ${isFlag ? 'icon' : ''}`}>
- {icon?.value || <ViewIcon
- layout={meta?.layout || ViewLayout.Document}
- size={'unset'}
- />}
+ {mentionIcon}
</span>
- <span className={'mention-content'}>{meta?.name || t('menuAppHeader.defaultNewPageName')}</span>
+ <span className={'mention-content opacity-80 hover:opacity-100'}>
+ {content}
+ </span>
</>
)}
</span>
diff --git a/frontend/appflowy_web_app/src/components/editor/editor.scss b/frontend/appflowy_web_app/src/components/editor/editor.scss
index f505b5104d..69de74b9ab 100644
--- a/frontend/appflowy_web_app/src/components/editor/editor.scss
+++ b/frontend/appflowy_web_app/src/components/editor/editor.scss
@@ -246,30 +246,13 @@ span[data-slate-placeholder="true"]:not(.inline-block-content) {
@apply bg-transparent;
}
- //&:hover {
- // .container-bg {
- // background: var(--fill-list-hover) !important;
- // }
- //}
}
-[data-block-type='heading'] {
- .mention-inline .mention-content {
- @apply ml-7;
- }
-
- .level-1, .level-2 {
- .mention-inline .mention-content {
- @apply ml-8;
- }
- }
-
-}
.mention-inline {
height: inherit;
overflow: hidden;
- @apply inline-flex gap-1 relative;
+ @apply inline-flex gap-1 relative truncate max-w-full;
.mention-icon {
@apply absolute top-1/2 transform -translate-y-1/2;
@@ -277,7 +260,7 @@ span[data-slate-placeholder="true"]:not(.inline-block-content) {
}
.mention-content {
- @apply ml-7;
+ @apply ml-[1.5em] truncate max-w-full flex-1;
}
}
@@ -347,4 +330,18 @@ span[data-slate-placeholder="true"]:not(.inline-block-content) {
50% {
opacity: 1;
}
+}
+
+.highlight-block {
+ animation: blink-bg 1s ease-in-out infinite;
+
+}
+
+@keyframes blink-bg {
+ from, to {
+ background-color: unset;
+ }
+ 50% {
+ background-color: var(--content-blue-100);
+ }
}
\ No newline at end of file
diff --git a/frontend/appflowy_web_app/src/components/editor/editor.type.ts b/frontend/appflowy_web_app/src/components/editor/editor.type.ts
index 3ed1228985..2d7af49765 100644
--- a/frontend/appflowy_web_app/src/components/editor/editor.type.ts
+++ b/frontend/appflowy_web_app/src/components/editor/editor.type.ts
@@ -9,15 +9,13 @@ import {
TodoListBlockData,
ToggleListBlockData,
YjsEditorKey,
- InlineBlockType,
- Mention,
OutlineBlockData,
TableBlockData,
TableCellBlockData,
BlockId,
BlockData,
DatabaseNodeData,
- LinkPreviewBlockData, FileBlockData, GalleryBlockData,
+ LinkPreviewBlockData, FileBlockData, GalleryBlockData, SubpageNodeData,
} from '@/application/types';
import { HTMLAttributes } from 'react';
import { Element } from 'slate';
@@ -146,18 +144,14 @@ export interface DatabaseNode extends BlockNode {
data: DatabaseNodeData;
}
+export interface SubpageNode extends BlockNode {
+ type: BlockType.SubpageBlock;
+ blockId: string;
+ data: SubpageNodeData;
+}
+
export interface EditorElementProps<T = Element> extends HTMLAttributes<HTMLDivElement> {
node: T;
}
-type FormulaValue = string;
-export interface FormulaNode extends Element {
- type: InlineBlockType.Formula;
- data: FormulaValue;
-}
-
-export interface MentionNode extends Element {
- type: InlineBlockType.Mention;
- data: Mention;
-}
diff --git a/frontend/appflowy_web_app/src/components/error/RecordNotFound.tsx b/frontend/appflowy_web_app/src/components/error/RecordNotFound.tsx
index c8b9feeef8..18623d68d6 100644
--- a/frontend/appflowy_web_app/src/components/error/RecordNotFound.tsx
+++ b/frontend/appflowy_web_app/src/components/error/RecordNotFound.tsx
@@ -10,23 +10,26 @@ function RecordNotFound ({
isViewNotFound?: boolean;
}) {
return (
- <div className={'flex h-full w-full flex-col items-center justify-center'}>
+ <div className={'flex h-full w-full flex-col items-center justify-center px-4'}>
{!noContent && <>
<div className={'text-2xl font-bold text-text-title opacity-70 flex items-center gap-4'}>
<WarningIcon className={'w-12 h-12'} />
{isViewNotFound ? 'Page Not Found' :
'Record Not Found'}
</div>
- <div className={'text-lg text-center text-text-title opacity-50 mt-4 whitespace-pre'}>
+ <div className={'text-lg text-center break-words text-text-title opacity-50 mt-4 whitespace-pre-wrap'}>
{`We're sorry for inconvenience\n`}
Submit an issue on our{' '}<a
- className={'underline text-fill-default'}
+ className={'underline text-fill-default'}
href={'https://github.com/AppFlowy-IO/AppFlowy/issues/new?template=bug_report.yaml'}
>Github</a>{' '}page that describes your error
</div>
</>}
- <img src={emptyImageSrc} alt={'AppFlowy'} />
+ <img
+ src={emptyImageSrc}
+ alt={'AppFlowy'}
+ />
</div>
);
}
diff --git a/frontend/appflowy_web_app/src/components/main/AppConfig.tsx b/frontend/appflowy_web_app/src/components/main/AppConfig.tsx
index b87ede6988..541c2d4176 100644
--- a/frontend/appflowy_web_app/src/components/main/AppConfig.tsx
+++ b/frontend/appflowy_web_app/src/components/main/AppConfig.tsx
@@ -131,6 +131,7 @@ function AppConfig ({ children }: { children: React.ReactNode }) {
isAuthenticated,
currentUser,
openLoginModal,
+
}}
>
{children}
diff --git a/frontend/appflowy_web_app/src/components/main/AppTheme.tsx b/frontend/appflowy_web_app/src/components/main/AppTheme.tsx
index 98ef60f0af..3330c09204 100644
--- a/frontend/appflowy_web_app/src/components/main/AppTheme.tsx
+++ b/frontend/appflowy_web_app/src/components/main/AppTheme.tsx
@@ -29,7 +29,7 @@ function AppTheme ({ children }: { children: React.ReactNode; }) {
notchedOutline: {
borderColor: 'var(--line-divider)',
},
-
+
},
},
MuiMenuItem: {
@@ -124,6 +124,20 @@ function AppTheme ({ children }: { children: React.ReactNode; }) {
},
},
},
+ MuiDrawer: {
+ styleOverrides: {
+ paper: {
+ borderRadius: 0,
+ },
+
+ paperAnchorBottom: {
+ borderTopRightRadius: 16,
+ borderTopLeftRadius: 16,
+ borderBottomLeftRadius: 0,
+ borderBottomRightRadius: 0,
+ },
+ },
+ },
MuiDialog: {
styleOverrides: {
paper: {
diff --git a/frontend/appflowy_web_app/src/components/publish/CollabView.tsx b/frontend/appflowy_web_app/src/components/publish/CollabView.tsx
index d6a9a8fbdb..d0fa2fc639 100644
--- a/frontend/appflowy_web_app/src/components/publish/CollabView.tsx
+++ b/frontend/appflowy_web_app/src/components/publish/CollabView.tsx
@@ -40,7 +40,7 @@ function CollabView ({ doc }: CollabViewProps) {
}, [layout]) as React.FC<{
doc: YDoc;
readOnly: boolean;
- navigateToView?: (viewId: string) => Promise<void>;
+ navigateToView?: (viewId: string, blockId?: string) => Promise<void>;
loadViewMeta?: LoadViewMeta;
createRowDoc?: CreateRowDoc;
loadView?: LoadView;
@@ -98,7 +98,10 @@ function CollabView ({ doc }: CollabViewProps) {
return (
<>
{rendered && <Suspense>
- <ViewHelmet icon={icon} name={name} />
+ <ViewHelmet
+ icon={icon}
+ name={name}
+ />
</Suspense>}
<div
diff --git a/frontend/appflowy_web_app/src/components/publish/DatabaseView.tsx b/frontend/appflowy_web_app/src/components/publish/DatabaseView.tsx
index 131660978e..1d75037e5e 100644
--- a/frontend/appflowy_web_app/src/components/publish/DatabaseView.tsx
+++ b/frontend/appflowy_web_app/src/components/publish/DatabaseView.tsx
@@ -24,7 +24,7 @@ export interface DatabaseProps {
doc: YDoc;
createRowDoc?: CreateRowDoc;
loadView?: LoadView;
- navigateToView?: (viewId: string) => Promise<void>;
+ navigateToView?: (viewId: string, blockId?: string) => Promise<void>;
loadViewMeta?: LoadViewMeta;
viewMeta: ViewMetaProps;
appendBreadcrumb?: AppendBreadcrumb;
diff --git a/frontend/appflowy_web_app/src/components/publish/PublishLayout.tsx b/frontend/appflowy_web_app/src/components/publish/PublishLayout.tsx
new file mode 100644
index 0000000000..07a8a6a6f8
--- /dev/null
+++ b/frontend/appflowy_web_app/src/components/publish/PublishLayout.tsx
@@ -0,0 +1,72 @@
+import { YDoc } from '@/application/types';
+import { useOutlineDrawer } from '@/components/_shared/outline/outline.hooks';
+import { AFScroller } from '@/components/_shared/scroller';
+import { PublishViewHeader } from '@/components/publish/header';
+import PublishMain from '@/components/publish/PublishMain';
+import SideBar from '@/components/publish/SideBar';
+import React from 'react';
+
+function PublishLayout ({ isTemplateThumb, isTemplate, doc }: {
+ isTemplateThumb: boolean;
+ isTemplate: boolean;
+ doc?: YDoc;
+}) {
+ const {
+ drawerOpened,
+ drawerWidth,
+ setDrawerWidth,
+ toggleOpenDrawer,
+ } = useOutlineDrawer();
+
+ return (
+ <div
+ className={'h-screen w-screen'}
+ style={isTemplateThumb ? {
+ pointerEvents: 'none',
+ transform: 'scale(0.333)',
+ transformOrigin: '0 0',
+ width: '300vw',
+ height: '400vh',
+ overflow: 'hidden',
+ } : undefined}
+ >
+ <AFScroller
+ overflowXHidden
+ overflowYHidden={isTemplateThumb}
+ style={{
+ transform: drawerOpened ? `translateX(${drawerWidth}px)` : 'none',
+ width: drawerOpened ? `calc(100% - ${drawerWidth}px)` : '100%',
+ transition: 'width 0.2s ease-in-out, transform 0.2s ease-in-out',
+ }}
+ className={'appflowy-layout appflowy-scroll-container h-full'}
+ >
+ {!isTemplate && <PublishViewHeader
+ onOpenDrawer={() => {
+ toggleOpenDrawer(true);
+ }}
+ drawerWidth={drawerWidth}
+ onCloseDrawer={() => {
+ toggleOpenDrawer(false);
+ }}
+ openDrawer={drawerOpened}
+ />}
+
+ <PublishMain
+ doc={doc}
+ isTemplate={isTemplate}
+ />
+
+ </AFScroller>
+ {drawerOpened &&
+ <SideBar
+ onResizeDrawerWidth={setDrawerWidth}
+ drawerWidth={drawerWidth}
+ drawerOpened={drawerOpened}
+ toggleOpenDrawer={toggleOpenDrawer}
+ />
+ }
+ </div>
+ );
+}
+
+export default PublishLayout;
\ No newline at end of file
diff --git a/frontend/appflowy_web_app/src/components/publish/PublishMain.tsx b/frontend/appflowy_web_app/src/components/publish/PublishMain.tsx
new file mode 100644
index 0000000000..6b92843bef
--- /dev/null
+++ b/frontend/appflowy_web_app/src/components/publish/PublishMain.tsx
@@ -0,0 +1,23 @@
+import { YDoc } from '@/application/types';
+import ComponentLoading from '@/components/_shared/progress/ComponentLoading';
+import { GlobalCommentProvider } from '@/components/global-comment';
+import CollabView from '@/components/publish/CollabView';
+import React, { Suspense } from 'react';
+
+function PublishMain ({ doc, isTemplate }: {
+ doc?: YDoc;
+ isTemplate: boolean;
+}) {
+ return (
+ <>
+ <CollabView doc={doc} />
+ {doc && !isTemplate && (
+ <Suspense fallback={<ComponentLoading />}>
+ <GlobalCommentProvider />
+ </Suspense>
+ )}
+ </>
+ );
+}
+
+export default PublishMain;
\ No newline at end of file
diff --git a/frontend/appflowy_web_app/src/components/publish/PublishMobileLayout.tsx b/frontend/appflowy_web_app/src/components/publish/PublishMobileLayout.tsx
new file mode 100644
index 0000000000..2db203b2f8
--- /dev/null
+++ b/frontend/appflowy_web_app/src/components/publish/PublishMobileLayout.tsx
@@ -0,0 +1,36 @@
+import { UIVariant, YDoc } from '@/application/types';
+import { AFScroller } from '@/components/_shared/scroller';
+import PublishMain from '@/components/publish/PublishMain';
+import React, { Suspense } from 'react';
+
+const MobileTopBar = React.lazy(() => import('@/components/_shared/mobile-topbar/MobileTopBar'));
+
+function PublishMobileLayout ({
+ doc,
+}: {
+ doc?: YDoc;
+}) {
+ return (
+ <div
+ className={'h-screen w-screen'}
+ >
+ <AFScroller
+ overflowXHidden
+ className={'appflowy-layout appflowy-mobile-layout appflowy-scroll-container h-full'}
+ >
+ <Suspense
+ fallback={
+ <div className={'flex items-center justify-between w-full h-[48px] min-h-[48px] px-4 gap-2'} />}
+ >
+ <MobileTopBar variant={UIVariant.Publish} />
+ </Suspense>
+ <PublishMain
+ doc={doc}
+ isTemplate={false}
+ />
+ </AFScroller>
+ </div>
+ );
+}
+
+export default PublishMobileLayout;
\ No newline at end of file
diff --git a/frontend/appflowy_web_app/src/components/publish/PublishView.tsx b/frontend/appflowy_web_app/src/components/publish/PublishView.tsx
index 4bbee0bad7..5364aa558b 100644
--- a/frontend/appflowy_web_app/src/components/publish/PublishView.tsx
+++ b/frontend/appflowy_web_app/src/components/publish/PublishView.tsx
@@ -1,14 +1,12 @@
import { YDoc } from '@/application/types';
import { PublishProvider } from '@/application/publish';
-import { useOutlineDrawer } from '@/components/_shared/outline/outline.hooks';
-import ComponentLoading from '@/components/_shared/progress/ComponentLoading';
-import { AFScroller } from '@/components/_shared/scroller';
+
import { AFConfigContext } from '@/components/main/app.hooks';
-import { GlobalCommentProvider } from '@/components/global-comment';
-import CollabView from '@/components/publish/CollabView';
-import SideBar from '@/components/publish/SideBar';
-import React, { Suspense, useCallback, useContext, useEffect, useState } from 'react';
-import { PublishViewHeader } from '@/components/publish/header';
+
+import PublishLayout from '@/components/publish/PublishLayout';
+import PublishMobileLayout from '@/components/publish/PublishMobileLayout';
+import { getPlatform } from '@/utils/platform';
+import React, { useCallback, useContext, useEffect, useState } from 'react';
import NotFound from '@/components/error/NotFound';
import { useSearchParams } from 'react-router-dom';
@@ -50,68 +48,23 @@ export function PublishView ({ namespace, publishName }: PublishViewProps) {
document.documentElement.setAttribute('thumbnail', 'true');
}, [isTemplateThumb]);
- const {
- drawerOpened,
- drawerWidth,
- setDrawerWidth,
- toggleOpenDrawer,
- } = useOutlineDrawer();
-
if (notFound && !doc) {
return <NotFound />;
}
return (
<PublishProvider
- isTemplateThumb={isTemplateThumb} isTemplate={isTemplate} namespace={namespace}
+ isTemplateThumb={isTemplateThumb}
+ isTemplate={isTemplate}
+ namespace={namespace}
publishName={publishName}
>
- <div
- className={'h-screen w-screen'} style={isTemplateThumb ? {
- pointerEvents: 'none',
- transform: 'scale(0.333)',
- transformOrigin: '0 0',
- width: '300vw',
- height: '400vh',
- overflow: 'hidden',
- } : undefined}
- >
- <AFScroller
- overflowXHidden
- overflowYHidden={isTemplateThumb}
- style={{
- transform: drawerOpened ? `translateX(${drawerWidth}px)` : 'none',
- width: drawerOpened ? `calc(100% - ${drawerWidth}px)` : '100%',
- transition: 'width 0.2s ease-in-out, transform 0.2s ease-in-out',
- }}
- className={'appflowy-layout appflowy-scroll-container h-full'}
- >
- {!isTemplate && <PublishViewHeader
- onOpenDrawer={() => {
- toggleOpenDrawer(true);
- }}
- drawerWidth={drawerWidth}
- onCloseDrawer={() => {
- toggleOpenDrawer(false);
- }}
- openDrawer={drawerOpened}
- />}
-
- <CollabView doc={doc} />
- {doc && !isTemplate && (
- <Suspense fallback={<ComponentLoading />}>
- <GlobalCommentProvider />
- </Suspense>
- )}
+ {getPlatform().isMobile ? <PublishMobileLayout doc={doc} /> : <PublishLayout
+ isTemplateThumb={isTemplateThumb}
+ isTemplate={isTemplate}
+ doc={doc}
+ />}
- </AFScroller>
- {drawerOpened &&
- <SideBar
- onResizeDrawerWidth={setDrawerWidth} drawerWidth={drawerWidth} drawerOpened={drawerOpened}
- toggleOpenDrawer={toggleOpenDrawer}
- />
- }
- </div>
</PublishProvider>
);
}
diff --git a/frontend/appflowy_web_app/src/pages/AppPage.tsx b/frontend/appflowy_web_app/src/pages/AppPage.tsx
index 33b45d3a0b..0bc32ee304 100644
--- a/frontend/appflowy_web_app/src/pages/AppPage.tsx
+++ b/frontend/appflowy_web_app/src/pages/AppPage.tsx
@@ -77,7 +77,7 @@ function AppPage () {
}, [view?.layout]) as React.FC<{
doc: YDoc;
readOnly: boolean;
- navigateToView?: (viewId: string) => Promise<void>;
+ navigateToView?: (viewId: string, blockId?: string) => Promise<void>;
loadViewMeta?: LoadViewMeta;
createRowDoc?: CreateRowDoc;
loadView?: LoadView;
diff --git a/frontend/appflowy_web_app/src/styles/app.scss b/frontend/appflowy_web_app/src/styles/app.scss
index 33fca75827..bae4980db3 100644
--- a/frontend/appflowy_web_app/src/styles/app.scss
+++ b/frontend/appflowy_web_app/src/styles/app.scss
@@ -1,5 +1,10 @@
@use "src/styles/mixin.scss";
+* {
+ -webkit-tap-highlight-color: transparent;
+ -webkit-touch-callout: none;
+}
+
.sketch-picker {
background-color: var(--bg-body) !important;
border-color: transparent !important;
diff --git a/frontend/appflowy_web_app/src/styles/variables/dark.variables.css b/frontend/appflowy_web_app/src/styles/variables/dark.variables.css
index 54191a7376..67ac292421 100644
--- a/frontend/appflowy_web_app/src/styles/variables/dark.variables.css
+++ b/frontend/appflowy_web_app/src/styles/variables/dark.variables.css
@@ -25,6 +25,9 @@
--content-blue-600: #009fd1;
--content-blue-100: #005174;
--content-blue-50: #024562;
+ --content-blue-700: #0079a5;
+ --content-blue-800: #00597a;
+ --content-blue-900: #003d4d;
--content-on-fill: #1a202c;
--content-on-tag: #99a6b8;
diff --git a/frontend/appflowy_web_app/src/styles/variables/light.variables.css b/frontend/appflowy_web_app/src/styles/variables/light.variables.css
index 81ada54cf5..3d1bc63969 100644
--- a/frontend/appflowy_web_app/src/styles/variables/light.variables.css
+++ b/frontend/appflowy_web_app/src/styles/variables/light.variables.css
@@ -25,6 +25,9 @@
--content-blue-400: #00bcf0;
--content-blue-300: #52d1f4;
--content-blue-600: #009fd1;
+ --content-blue-700: #0079a5;
+ --content-blue-800: #00597a;
+ --content-blue-900: #003d4d;
--content-blue-100: #e0f8ff;
--content-blue-50: #f2fcff;
--content-on-fill-hover: #00bcf0;
diff --git a/frontend/appflowy_web_app/tailwind/box-shadow.cjs b/frontend/appflowy_web_app/tailwind/box-shadow.cjs
index 89d02e180c..13984c1d12 100644
--- a/frontend/appflowy_web_app/tailwind/box-shadow.cjs
+++ b/frontend/appflowy_web_app/tailwind/box-shadow.cjs
@@ -1,7 +1,7 @@
/**
* Do not edit directly
-* Generated on Mon, 16 Sep 2024 06:19:26 GMT
+* Generated on Tue, 22 Oct 2024 09:59:50 GMT
* Generated from $pnpm css:variables
*/
diff --git a/frontend/appflowy_web_app/tailwind/colors.cjs b/frontend/appflowy_web_app/tailwind/colors.cjs
index aece3df56d..15c4fbe9a5 100644
--- a/frontend/appflowy_web_app/tailwind/colors.cjs
+++ b/frontend/appflowy_web_app/tailwind/colors.cjs
@@ -1,7 +1,7 @@
/**
* Do not edit directly
-* Generated on Mon, 16 Sep 2024 06:19:26 GMT
+* Generated on Tue, 22 Oct 2024 09:59:50 GMT
* Generated from $pnpm css:variables
*/
@@ -41,6 +41,9 @@ module.exports = {
"blue-400": "var(--content-blue-400)",
"blue-300": "var(--content-blue-300)",
"blue-600": "var(--content-blue-600)",
+ "blue-700": "var(--content-blue-700)",
+ "blue-800": "var(--content-blue-800)",
+ "blue-900": "var(--content-blue-900)",
"blue-100": "var(--content-blue-100)",
"blue-50": "var(--content-blue-50)",
"on-fill-hover": "var(--content-on-fill-hover)",
diff --git a/frontend/resources/translations/en.json b/frontend/resources/translations/en.json
index 5e1932526b..932427895c 100644
--- a/frontend/resources/translations/en.json
+++ b/frontend/resources/translations/en.json
@@ -2718,5 +2718,48 @@
"laterButton": "Later",
"refreshNote": "After successful upgrade, click <refresh/> to activate your new features.",
"refresh": "here"
+ },
+ "breadcrumbs": {
+ "label": "Breadcrumbs"
+ },
+ "time": {
+ "justNow": "Just now",
+ "seconds": {
+ "one": "1 second",
+ "other": "{count} seconds"
+ },
+ "minutes": {
+ "one": "1 minute",
+ "other": "{count} minutes"
+ },
+ "hours": {
+ "one": "1 hour",
+ "other": "{count} hours"
+ },
+ "days": {
+ "one": "1 day",
+ "other": "{count} days"
+ },
+ "weeks": {
+ "one": "1 week",
+ "other": "{count} weeks"
+ },
+ "months": {
+ "one": "1 month",
+ "other": "{count} months"
+ },
+ "years": {
+ "one": "1 year",
+ "other": "{count} years"
+ },
+ "ago": "ago",
+ "yesterday": "Yesterday",
+ "today": "Today"
+ },
+ "members": {
+ "zero": "No members",
+ "one": "1 member",
+ "many": "{count} members",
+ "other": "{count} members"
}
}