diff --git a/client-app/package.json b/client-app/package.json index 8198ed96c7..e001e22160 100644 --- a/client-app/package.json +++ b/client-app/package.json @@ -9,14 +9,11 @@ "dev:app": "pnpm build:preload && cross-env NODE_ENV=development tauri dev", "dev:prerequisite": "concurrently \"cd ../packages/data-center && pnpm dev\" \"cd ../packages/app && pnpm dev\"", "build:prerequisite": "pnpm build:submodules && pnpm build:rs-types && pnpm build:affine && pnpm build:preload", - "dev:web": "vite", "build:rs-types": "zx scripts/generateTsTypingsFromJsonSchema.mjs", - "build:web": "tsc && vite build", "build:submodules": "zx scripts/buildSubModules.mjs", "build:affine": "zx scripts/buildAffine.mjs", "build:preload": "esbuild src/preload/index.ts --outdir=public/preload", - "build:app": "tauri build", - "preview": "vite preview" + "build:app": "tauri build" }, "dependencies": { "@blocksuite/store": "^0.3.1", diff --git a/client-app/src/components/TitleBar.tsx b/client-app/src/components/TitleBar.tsx deleted file mode 100644 index f7ef61abd7..0000000000 --- a/client-app/src/components/TitleBar.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import { useNavigate } from 'react-router-dom'; -import styled from '@emotion/styled'; -import { routes } from '../pages/routes.js'; - -const Container = styled.nav` - height: var(--title-bar-height); - background: #329ea3; - user-select: none; - display: flex; - justify-content: flex-start; - align-items: center; - position: fixed; - top: 0; - left: 0; - right: 0; -`; -const RouteSelect = styled.select` - margin-left: 100px; -`; - -export function TitleBar() { - const navigate = useNavigate(); - return ( - - { - navigate(event?.target?.value); - }} - > - {routes.map(route => ( - - ))} - - - ); -} diff --git a/client-app/src/main.css b/client-app/src/main.css deleted file mode 100644 index b133f36b30..0000000000 --- a/client-app/src/main.css +++ /dev/null @@ -1,16 +0,0 @@ -:root { - --title-bar-height: 30px; -} - -body { - margin: 0; - margin-top: var(--title-bar-height); - height: calc(100vh - var(--title-bar-height)); - width: 100%; - overflow: hidden; -} - -#react-root { - height: 100%; - width: 100%; -} diff --git a/client-app/src/main.tsx b/client-app/src/main.tsx deleted file mode 100644 index c0d5c1f7e2..0000000000 --- a/client-app/src/main.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import '@emotion/react'; -import { StrictMode } from 'react'; -import ReactDOM from 'react-dom/client'; -import { RouterProvider } from 'react-router-dom'; -import { router } from './pages/routes.js'; -import './main.css'; - -const root = document.querySelector('#react-root'); -if (root !== null) { - ReactDOM.createRoot(root).render( - - - - ); -} diff --git a/client-app/src/pages/AFFiNE/index.tsx b/client-app/src/pages/AFFiNE/index.tsx deleted file mode 100644 index 1020c7e0f5..0000000000 --- a/client-app/src/pages/AFFiNE/index.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { redirect } from 'react-router-dom'; -import { useEffect } from 'react'; - -export function AffineBasicPage() { - useEffect(() => { - location.href = '/affine-out/index.html'; - redirect('/affine-out/index.html'); - }, []); - return null; -} - -export function AffineDevPage() { - useEffect(() => { - location.href = 'http://localhost:8080'; - redirect('http://localhost:8080'); - }, []); - return null; -} diff --git a/client-app/src/pages/Landing/index.tsx b/client-app/src/pages/Landing/index.tsx deleted file mode 100644 index ed52a5ba59..0000000000 --- a/client-app/src/pages/Landing/index.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import styled from '@emotion/styled'; -import { Link } from 'react-router-dom'; - -const Container = styled.div` - display: flex; - flex-direction: column; - - & > a { - color: #333; - padding: 10px; - &:hover { - opacity: 0.7; - } - } -`; - -export function LandingPage() { - return ( - - Affine Dev Build - Affine Dist Bundle - - ); -} diff --git a/client-app/src/pages/Root.tsx b/client-app/src/pages/Root.tsx deleted file mode 100644 index 67e08e8041..0000000000 --- a/client-app/src/pages/Root.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { Outlet } from 'react-router-dom'; -import { TitleBar } from '../components/TitleBar.js'; - -export function RootLayout() { - return ( - <> - - - - ); -} diff --git a/client-app/src/pages/routes.tsx b/client-app/src/pages/routes.tsx deleted file mode 100644 index 2ff0f4ccd1..0000000000 --- a/client-app/src/pages/routes.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { createBrowserRouter } from 'react-router-dom'; -import { AffineBasicPage, AffineDevPage } from './AFFiNE/index.js'; -import { LandingPage } from './Landing/index.js'; -import { RootLayout } from './Root.js'; - -export const routes = [ - { - path: '/', - name: 'Landing Page', - element: , - }, - { - path: '/affine', - name: 'AFFiNE Basic', - element: , - }, - { - path: '/affine-dev', - name: 'AFFiNE Dev', - element: , - }, -]; -export const router = createBrowserRouter([ - { path: '/', element: , children: routes }, -]); diff --git a/client-app/src/utils/getAvatar.ts b/client-app/src/utils/getAvatar.ts deleted file mode 100644 index b4bc7b040b..0000000000 --- a/client-app/src/utils/getAvatar.ts +++ /dev/null @@ -1,38 +0,0 @@ -const DefaultHeadImgColors = [ - ['#C6F2F3', '#0C6066'], - ['#FFF5AB', '#896406'], - ['#FFCCA7', '#8F4500'], - ['#FFCECE', '#AF1212'], - ['#E3DEFF', '#511AAB'], -]; - -// TODO: move this back to AFFiNE repo -export async function createDefaultUserAvatar( - workspaceName: string -): Promise { - const canvas = document.createElement('canvas'); - canvas.height = 100; - canvas.width = 100; - const context = canvas.getContext('2d'); - if (context === null) { - throw new Error('Failed to create avatar canvas'); - } - const randomNumber = Math.floor(Math.random() * 5); - const randomColor = DefaultHeadImgColors[randomNumber]; - context.fillStyle = randomColor[0]; - context.fillRect(0, 0, 100, 100); - context.font = "600 50px 'PingFang SC', 'Microsoft Yahei'"; - context.fillStyle = randomColor[1]; - context.textAlign = 'center'; - context.textBaseline = 'middle'; - context.fillText(workspaceName[0], 50, 50); - return await new Promise((resolve, reject) => { - canvas.toBlob(blob => { - if (blob === null) { - reject(new Error('Failed to convert avatar canvas to blob')); - } else { - resolve(blob); - } - }, 'image/png'); - }); -}