Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

feat(routes): clear unused routes

tzhangchi54f3cd037395
diff --git a/apps/ligo-virgo/src/pages/AppRoutes.tsx b/apps/ligo-virgo/src/pages/AppRoutes.tsx
index c27ae6a76f..855f717b28 100644
--- a/apps/ligo-virgo/src/pages/AppRoutes.tsx
+++ b/apps/ligo-virgo/src/pages/AppRoutes.tsx
@@ -1,15 +1,9 @@
import { Navigate, Route, Routes } from 'react-router-dom';
import { Login } from './account';
-import Agenda from './agenda';
import { LigoVirgoRootContainer } from './AppContainer';
-import Recent from './recent';
import { RoutePrivate } from './RoutePrivate';
import { RoutePublicAutoLogin } from './RoutePublicAutoLogin';
-import Search from './search';
-import Settings from './settings';
-import Shared from './shared';
-import Starred from './starred';
import { PageNotFound } from './status/page-not-found';
import { WorkspaceNotFound } from './status/workspace-not-found';
import { Tools } from './tools';
@@ -25,13 +19,6 @@ export function LigoVirgoRoutes() {
path="/error/workspace"
element={<WorkspaceNotFound />}
/>
-
- <Route path="/agenda/*" element={<Agenda />} />
- <Route path="/recent" element={<Recent />} />
- <Route path="/search" element={<Search />} />
- <Route path="/settings" element={<Settings />} />
- <Route path="/shared" element={<Shared />} />
- <Route path="/started" element={<Starred />} />
<Route path="/ui" element={<UIPage />} />
<Route
path="/:workspace_id/*"
diff --git a/apps/ligo-virgo/src/pages/recent/index.tsx b/apps/ligo-virgo/src/pages/recent/index.tsx
deleted file mode 100644
index 9cf390d1ee..0000000000
--- a/apps/ligo-virgo/src/pages/recent/index.tsx
+++ /dev/null
@@ -1,3 +0,0 @@
-export default function Recent() {
- return <span>Recent</span>;
-}
diff --git a/apps/ligo-virgo/src/pages/search/index.tsx b/apps/ligo-virgo/src/pages/search/index.tsx
deleted file mode 100644
index 135fd58187..0000000000
--- a/apps/ligo-virgo/src/pages/search/index.tsx
+++ /dev/null
@@ -1,3 +0,0 @@
-export default function Search() {
- return <span>Search</span>;
-}
diff --git a/apps/ligo-virgo/src/pages/settings/index.tsx b/apps/ligo-virgo/src/pages/settings/index.tsx
deleted file mode 100644
index 803a6e29c8..0000000000
--- a/apps/ligo-virgo/src/pages/settings/index.tsx
+++ /dev/null
@@ -1,3 +0,0 @@
-export default function Settings() {
- return <span>Settings</span>;
-}
diff --git a/apps/ligo-virgo/src/pages/shared/index.tsx b/apps/ligo-virgo/src/pages/shared/index.tsx
deleted file mode 100644
index 051e879ca0..0000000000
--- a/apps/ligo-virgo/src/pages/shared/index.tsx
+++ /dev/null
@@ -1,3 +0,0 @@
-export default function Shared() {
- return <span>Shared</span>;
-}
diff --git a/apps/ligo-virgo/src/pages/starred/index.tsx b/apps/ligo-virgo/src/pages/starred/index.tsx
deleted file mode 100644
index d2f36fe762..0000000000
--- a/apps/ligo-virgo/src/pages/starred/index.tsx
+++ /dev/null
@@ -1,3 +0,0 @@
-export default function Starred() {
- return <span>Starred</span>;
-}
diff --git a/apps/ligo-virgo/src/pages/workspace/Home.tsx b/apps/ligo-virgo/src/pages/workspace/Home.tsx
index d0ac1f3872..3ae0da1da5 100644
--- a/apps/ligo-virgo/src/pages/workspace/Home.tsx
+++ b/apps/ligo-virgo/src/pages/workspace/Home.tsx
@@ -31,6 +31,7 @@ export function WorkspaceHome() {
})
);
}
+
navigate(`/${workspace_id}/${user_initial_page_id}`);
};
navigate_to_user_initial_page();
diff --git a/apps/ligo-virgo/src/pages/workspace/WorkspaceContainer.tsx b/apps/ligo-virgo/src/pages/workspace/WorkspaceContainer.tsx
index d1b3f3444f..eb424f88c7 100644
--- a/apps/ligo-virgo/src/pages/workspace/WorkspaceContainer.tsx
+++ b/apps/ligo-virgo/src/pages/workspace/WorkspaceContainer.tsx
@@ -4,7 +4,6 @@ import { WorkspaceRootContainer } from './Container';
import { Page } from './docs';
import { Edgeless } from './Edgeless';
import { WorkspaceHome } from './Home';
-import Labels from './labels';
import Pages from './pages';
export function WorkspaceContainer() {
@@ -21,7 +20,6 @@ export function WorkspaceContainer() {
return (
<Routes>
<Route path="/" element={<WorkspaceRootContainer />}>
- <Route path="/labels" element={<Labels />} />
<Route path="/pages" element={<Pages />} />
<Route
path="/:page_id/edgeless"
diff --git a/libs/components/editor-plugins/src/placeholder/PlaceholderPanel.tsx b/libs/components/editor-plugins/src/placeholder/PlaceholderPanel.tsx
index 89b66256f7..16c483f5a5 100644
--- a/libs/components/editor-plugins/src/placeholder/PlaceholderPanel.tsx
+++ b/libs/components/editor-plugins/src/placeholder/PlaceholderPanel.tsx
@@ -1,14 +1,12 @@
+import { Virgo } from '@toeverything/framework/virgo';
import { useCallback, useEffect, useState } from 'react';
-import { useNavigate, useParams } from 'react-router';
-import { Virgo, BlockEditor } from '@toeverything/framework/virgo';
-import { debounce } from '@toeverything/utils';
-import { MuiBox as Box, styled, BaseButton } from '@toeverything/components/ui';
+import { BaseButton, styled } from '@toeverything/components/ui';
import {
services,
- type ReturnUnobserve,
TemplateFactory,
TemplateMeta,
+ type ReturnUnobserve,
} from '@toeverything/datasource/db-service';
const PlaceholderPanelContainer = styled('div')({
@@ -48,7 +46,6 @@ export const PlaceholderPanel = (props: PlaceholderPanelProps) => {
y: 0,
});
const [open, setOpen] = useState(false);
- // const navigate = useNavigate();
const ifPageChildrenExist = useCallback(async () => {
const rootId = await editor.getRootBlockId();
diff --git a/libs/components/layout/src/workspace-sidebar/page-tree/block-page.ts b/libs/components/layout/src/workspace-sidebar/page-tree/block-page.ts
deleted file mode 100644
index e74dd6eb42..0000000000
--- a/libs/components/layout/src/workspace-sidebar/page-tree/block-page.ts
+++ /dev/null
@@ -1,170 +0,0 @@
-// import type {
-// ArrayOperation,
-// BlockClientInstance,
-// BlockImplInstance,
-// MapOperation,
-// } from '@toeverything/datasource/jwt';
-// import { getDateIsoStringWithTimezone } from '@toeverything/utils';
-
-// export async function getRecentPages(
-// db: BlockClientInstance,
-// userId: string
-// ): Promise<string[]> {
-// try {
-// const config = await db.getWorkspaceConfig<MapOperation<string>>();
-// const recent_pages = config.get('recent_pages');
-// if (recent_pages?.get(userId)) {
-// return [recent_pages.get(userId) as string];
-// }
-// } catch (e) {
-// console.error(e);
-// }
-
-// return [''];
-// }
-
-// /** Mark the article corresponding to pageId as the most recently accessed article */
-// export async function setRecentPages(
-// db: BlockClientInstance,
-// userId: string,
-// pageId: string
-// ): Promise<void> {
-// try {
-// const config = await db.getWorkspaceConfig<MapOperation<string>>();
-// const recent_pages = config.get('recent_pages');
-// if (recent_pages && recent_pages.get(userId)) {
-// recent_pages.set(userId, pageId);
-// } else {
-// const map = config.createMap<string>();
-// map.set(userId, pageId);
-// config.set('recent_pages', map);
-// }
-// } catch (e) {
-// console.error(e);
-// }
-// }
-
-// export async function setPageTree<TreeItem>(
-// db: BlockClientInstance,
-// treeData: TreeItem[]
-// ): Promise<void> {
-// try {
-// const config = await db.getWorkspaceConfig();
-// const array = config.createArray<TreeItem>();
-// array.push((treeData as any[]) || []);
-// config.set('page_tree', array);
-// } catch (e) {
-// console.error(e);
-// }
-// }
-
-// async function update_tree_items_title<
-// TreeItem extends { id: string; title: string; children: TreeItem[] }
-// >(
-// db: BlockClientInstance,
-// items: TreeItem[],
-// cache: Record<string, string>
-// ): Promise<TreeItem[]> {
-// for (const item of items) {
-// if (cache[item.id]) {
-// item.title = cache[item.id];
-// } else {
-// const page = await db.get(item.id as 'page');
-// item.title =
-// page.getDecoration<Array<{ text: string }>>('text')?.[0]
-// ?.text ||
-// 'Untitled ' +
-// getDateIsoStringWithTimezone(page.created)
-// .slice(11)
-// .replace('T', ' ');
-// cache[item.id] = item.title;
-// }
-
-// if (item.children.length) {
-// item.children = await update_tree_items_title(
-// db,
-// item.children,
-// cache
-// );
-// }
-// }
-
-// return [...items];
-// }
-
-// export async function getPageTree<TreeItem>(
-// db: BlockClientInstance
-// ): Promise<TreeItem[]> {
-// try {
-// const config = await db.getWorkspaceConfig();
-// const page_tree = config.get('page_tree') as ArrayOperation<TreeItem>;
-// const page_tree_items = page_tree?.slice();
-// if (page_tree && page_tree_items?.length) {
-// const pages = await update_tree_items_title(
-// db,
-// page_tree_items as [],
-// {}
-// );
-// return pages;
-// }
-// } catch (e) {
-// console.error(e);
-// }
-
-// return [];
-// }
-
-// export async function getWorkspaceConfig(
-// db: BlockClientInstance,
-// userId: string,
-// name: string
-// ): Promise<string> {
-// try {
-// // const config = await db.getWorkspaceConfig();
-// // const map = config.get_map<string>(name);
-// // if (map && map.get(userId)) {
-// // return map.get(userId)!;
-// // }
-// } catch (e) {
-// console.error(e);
-// }
-
-// return '';
-// }
-
-// export async function setWorkspaceConfig(
-// db: BlockClientInstance,
-// userId: string,
-// name: string,
-// value: string
-// ): Promise<void> {
-// try {
-// // const config = await db.getWorkspaceConfig();
-// // const map = config.get_map<string>(name);
-// // map.set(userId, value === undefined || value === null ? '' : value);
-// } catch (e) {
-// console.error(e);
-// }
-// }
-
-// export async function createPage(
-// db: BlockClientInstance,
-// title?: string,
-// content?: string,
-// metadata?: Record<string, string>
-// ): Promise<BlockImplInstance | undefined> {
-// if (db) {
-// const page: BlockImplInstance = await db.get('page');
-// if (title) {
-// page.getContent<string>().set('title', title);
-// }
-// if (metadata) {
-// Object.keys(metadata).forEach(property =>
-// page.getContent<string>().set(property, metadata[property])
-// );
-// }
-// return page;
-// }
-
-// return undefined;
-// }
diff --git a/libs/components/layout/src/workspace-sidebar/page-tree/index.ts b/libs/components/layout/src/workspace-sidebar/page-tree/index.ts
index 836e68fa95..c6ddcedd64 100644
--- a/libs/components/layout/src/workspace-sidebar/page-tree/index.ts
+++ b/libs/components/layout/src/workspace-sidebar/page-tree/index.ts
@@ -1,5 +1,3 @@
export { PageTree } from './PageTree';
export * from './types';
export { usePageTree } from './use-page-tree';
-
-// export { getRecentPages, setRecentPages } from './block-page';