From 9d350059d94fecd1029837b5319389961b081321 Mon Sep 17 00:00:00 2001 From: zuomeng wang Date: Thu, 9 Feb 2023 10:15:30 +0800 Subject: [PATCH 01/24] fix: add collabration name (#879) --- packages/data-center/src/provider/affine/affine.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/data-center/src/provider/affine/affine.ts b/packages/data-center/src/provider/affine/affine.ts index 8749db5fa..a4a25e4ee 100644 --- a/packages/data-center/src/provider/affine/affine.ts +++ b/packages/data-center/src/provider/affine/affine.ts @@ -176,6 +176,12 @@ export class AffineProvider extends BaseProvider { // @ts-expect-error ignore the type awareness: workspace.awarenessStore.awareness, }); + workspace.awarenessStore.awareness.setLocalStateField('user', { + name: token.user?.name ?? 'other', + id: Number(token.user?.id ?? -1), + color: '#ffa500', + }); + this._wsMap.set(workspace, ws); } return ws; From 8297259f7ed9755a0439d911741e0344b1fc87dd Mon Sep 17 00:00:00 2001 From: Himself65 Date: Wed, 8 Feb 2023 20:51:10 -0600 Subject: [PATCH 02/24] refactor: remove babel (#911) --- package.json | 1 - packages/app/.babelrc.js | 28 ------------------------- packages/app/package.json | 1 - pnpm-lock.yaml | 44 +++++++++++++-------------------------- 4 files changed, 14 insertions(+), 60 deletions(-) delete mode 100644 packages/app/.babelrc.js diff --git a/package.json b/package.json index 3a1297e07..fb611d824 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,6 @@ "@types/node": "^18.11.17", "@typescript-eslint/eslint-plugin": "^5.47.0", "@typescript-eslint/parser": "^5.47.0", - "babel-plugin-istanbul": "^6.1.1", "cross-env": "^7.0.3", "eslint": "^8.30.0", "eslint-config-next": "12.3.1", diff --git a/packages/app/.babelrc.js b/packages/app/.babelrc.js deleted file mode 100644 index e98989a64..000000000 --- a/packages/app/.babelrc.js +++ /dev/null @@ -1,28 +0,0 @@ -const plugins = []; - -if (process.env.NODE_ENV === 'development' || process.env.COVERAGE === 'true') { - console.log( - 'Detected development environment. Instrumenting code for coverage.' - ); - plugins.push('istanbul'); -} - -plugins.push([ - '@emotion', - { - // See https://emotion.sh/docs/@emotion/babel-plugin - importMap: { - '@/styles': { - styled: { - canonicalImport: ['@emotion/styled', 'default'], - styledBaseImport: ['@/styles', 'styled'], - }, - }, - }, - }, -]); - -module.exports = { - presets: ['next/babel'], - plugins, -}; diff --git a/packages/app/package.json b/packages/app/package.json index cf19c695c..1b47cf1e3 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -39,7 +39,6 @@ "yjs": "^13.5.45" }, "devDependencies": { - "@emotion/babel-plugin": "^11.10.5", "@types/node": "18.7.18", "@types/react": "18.0.20", "@types/react-dom": "18.0.6", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 59402862e..9c6b36b13 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -10,7 +10,6 @@ importers: '@types/node': ^18.11.17 '@typescript-eslint/eslint-plugin': ^5.47.0 '@typescript-eslint/parser': ^5.47.0 - babel-plugin-istanbul: ^6.1.1 cross-env: ^7.0.3 eslint: ^8.30.0 eslint-config-next: 12.3.1 @@ -30,7 +29,6 @@ importers: '@types/node': 18.11.18 '@typescript-eslint/eslint-plugin': 5.48.0_vqm4js66qtp4h6afqe3btrngbi '@typescript-eslint/parser': 5.48.0_ifw3q4r6iq3gw7cspzs2siycvu - babel-plugin-istanbul: 6.1.1 cross-env: 7.0.3 eslint: 8.31.0 eslint-config-next: 12.3.1_ifw3q4r6iq3gw7cspzs2siycvu @@ -52,7 +50,6 @@ importers: '@blocksuite/editor': 0.4.0-alpha.2 '@blocksuite/icons': ^2.0.2 '@blocksuite/store': 0.4.0-alpha.2 - '@emotion/babel-plugin': ^11.10.5 '@emotion/css': ^11.10.0 '@emotion/react': ^11.10.4 '@emotion/server': ^11.10.0 @@ -117,7 +114,6 @@ importers: react-dom: 18.2.0_react@18.2.0 yjs: 13.5.45 devDependencies: - '@emotion/babel-plugin': 11.10.5 '@types/node': 18.7.18 '@types/react': 18.0.20 '@types/react-dom': 18.0.6 @@ -841,6 +837,7 @@ packages: '@babel/core': ^7.0.0-0 dependencies: '@babel/helper-plugin-utils': 7.20.2 + dev: false /@babel/plugin-syntax-logical-assignment-operators/7.10.4_@babel+core@7.20.5: resolution: {integrity: sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==} @@ -1787,6 +1784,7 @@ packages: find-root: 1.1.0 source-map: 0.5.7 stylis: 4.1.3 + dev: false /@emotion/cache/11.10.3: resolution: {integrity: sha512-Psmp/7ovAa8appWh3g51goxu/z3iVms7JXOreq136D8Bbn6dYraPnmL6mdM8GThEx9vwSn92Fz+mGSjBzN8UPQ==} @@ -1825,6 +1823,7 @@ packages: /@emotion/hash/0.9.0: resolution: {integrity: sha512-14FtKiHhy2QoPIzdTcvh//8OyBlknNs2nXRwIhG904opCby3l+9Xaf/wuPvICBF0rc1ZCNBd3nKe9cd2mecVkQ==} + dev: false /@emotion/is-prop-valid/1.2.0: resolution: {integrity: sha512-3aDpDprjM0AwaxGE09bOPkNxHpBd+kA6jty3RnaEXdweX1DF1U3VQpPYb0g1IStAuK7SVQ1cy+bNBBKp4W3Fjg==} @@ -1834,6 +1833,7 @@ packages: /@emotion/memoize/0.8.0: resolution: {integrity: sha512-G/YwXTkv7Den9mXDO7AhLWkE3q+I92B+VqAE+dYG4NGPaHZGvt3G8Q0p9vmE+sq7rTGphUbAvmQ9YpbfMQGGlA==} + dev: false /@emotion/react/11.10.4_w5j4k42lgipnm43s3brx6h3c34: resolution: {integrity: sha512-j0AkMpr6BL8gldJZ6XQsQ8DnS9TxEQu1R+OGmDZiWjBAJtCcbt0tS3I/YffoqHXxH6MjgI7KdMbYKw3MEiU9eA==} @@ -1877,6 +1877,7 @@ packages: '@emotion/unitless': 0.8.0 '@emotion/utils': 1.2.0 csstype: 3.1.1 + dev: false /@emotion/server/11.10.0_@emotion+css@11.10.0: resolution: {integrity: sha512-MTvJ21JPo9aS02GdjFW4nhdwOi2tNNpMmAM/YED0pkxzjDNi5WbiTwXqaCnvLc2Lr8NFtjhT0az1vTJyLIHYcw==} @@ -1927,6 +1928,7 @@ packages: /@emotion/unitless/0.8.0: resolution: {integrity: sha512-VINS5vEYAscRl2ZUDiT3uMPlrFQupiKgHz5AA4bCH1miKBg4qtwkim1qPmJj/4WG6TreYMY111rEFsjupcOKHw==} + dev: false /@emotion/use-insertion-effect-with-fallbacks/1.0.0_react@18.2.0: resolution: {integrity: sha512-1eEgUGmkaljiBnRMTdksDV1W4kUnmwgp7X9G8B++9GYwl1lUdqSndSriIrTJ0N7LQaoauY9JJ2yhiOYK5+NI4A==} @@ -1938,6 +1940,7 @@ packages: /@emotion/utils/1.2.0: resolution: {integrity: sha512-sn3WH53Kzpw8oQ5mgMmIzzyAaH2ZqFEbozVVBSYp538E06OSE6ytOp7pRAjNQR+Q/orwqdQYJSe2m3hCOeznkw==} + dev: false /@emotion/weak-memoize/0.3.0: resolution: {integrity: sha512-AHPmaAx+RYfZz0eYu6Gviiagpmiyw98ySSlQvCUhVGDRtDFe4DBS0x1bSjdF3gqUDYOczB+yYvBTtEylYSdRhg==} @@ -3465,6 +3468,7 @@ packages: /@types/parse-json/4.0.0: resolution: {integrity: sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==} + dev: false /@types/prettier/2.7.2: resolution: {integrity: sha512-KufADq8uQqo1pYKVIYzfKbJfBAc0sOeXqGbFaSpv8MRmC/zXgowNZmFcbngndGk922QDmOASEXUZCaY48gs4cg==} @@ -3943,19 +3947,6 @@ packages: schema-utils: 2.7.1 dev: true - /babel-plugin-istanbul/6.1.1: - resolution: {integrity: sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==} - engines: {node: '>=8'} - dependencies: - '@babel/helper-plugin-utils': 7.20.2 - '@istanbuljs/load-nyc-config': 1.1.0 - '@istanbuljs/schema': 0.1.3 - istanbul-lib-instrument: 5.2.1 - test-exclude: 6.0.0 - transitivePeerDependencies: - - supports-color - dev: true - /babel-plugin-macros/3.1.0: resolution: {integrity: sha512-Cg7TFGpIr01vOQNODXOOaGz2NpCU5gl8x1qJFbb6hbZxR7XrcE2vtbAsTAbJ7/xwJtUuJEw8K8Zr/AE0LHlesg==} engines: {node: '>=10', npm: '>=6'} @@ -3963,6 +3954,7 @@ packages: '@babel/runtime': 7.20.7 cosmiconfig: 7.0.1 resolve: 1.22.1 + dev: false /babel-plugin-polyfill-corejs2/0.3.3_@babel+core@7.20.5: resolution: {integrity: sha512-8hOdmFYFSZhqg2C/JgLUQ+t52o5nirNwaWM2B9LWteozwIvM14VSwdsCAUET10qT+kmySAlseadmfeeSWFCy+Q==} @@ -4329,6 +4321,7 @@ packages: parse-json: 5.2.0 path-type: 4.0.0 yaml: 1.10.2 + dev: false /create-require/1.1.1: resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} @@ -5431,6 +5424,7 @@ packages: /find-root/1.1.0: resolution: {integrity: sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==} + dev: false /find-up/4.1.0: resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==} @@ -6235,19 +6229,6 @@ packages: - supports-color dev: true - /istanbul-lib-instrument/5.2.1: - resolution: {integrity: sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==} - engines: {node: '>=8'} - dependencies: - '@babel/core': 7.20.5 - '@babel/parser': 7.20.7 - '@istanbuljs/schema': 0.1.3 - istanbul-lib-coverage: 3.2.0 - semver: 6.3.0 - transitivePeerDependencies: - - supports-color - dev: true - /istanbul-lib-processinfo/2.0.3: resolution: {integrity: sha512-NkwHbo3E00oybX6NGJi6ar0B29vxyvNwoC7eJ4G4Yq28UfY758Hgn/heV8VRFhevPED4LXfFz0DQ8z/0kw9zMg==} engines: {node: '>=8'} @@ -8048,6 +8029,7 @@ packages: /source-map/0.5.7: resolution: {integrity: sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==} engines: {node: '>=0.10.0'} + dev: false /source-map/0.6.1: resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} @@ -8305,6 +8287,7 @@ packages: /stylis/4.1.3: resolution: {integrity: sha512-GP6WDNWf+o403jrEp9c5jibKavrtLW+/qYGhFxFrG8maXhwTBI7gLLhiBb0o7uFccWN+EOS9aMO6cGHWAO07OA==} + dev: false /supports-color/5.5.0: resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} @@ -9130,6 +9113,7 @@ packages: /yaml/1.10.2: resolution: {integrity: sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==} engines: {node: '>= 6'} + dev: false /yaml/2.2.1: resolution: {integrity: sha512-e0WHiYql7+9wr4cWMx3TVQrNwejKaEe7/rHNmQmqRjazfOP5W8PB6Jpebb5o6fIapbz9o9+2ipcaTM2ZwDI6lw==} From 5323f659c8ac0cf57906f2d02b1255c56ff2558c Mon Sep 17 00:00:00 2001 From: zuomeng wang Date: Thu, 9 Feb 2023 11:29:04 +0800 Subject: [PATCH 03/24] fix: only owner can set workspace avatar (#882) Co-authored-by: Qi <474021214@qq.com> --- .../workspace-setting/general/General.tsx | 31 +++++++----- .../workspace-setting/general/style.ts | 47 ++++++++++--------- 2 files changed, 44 insertions(+), 34 deletions(-) diff --git a/packages/app/src/components/workspace-setting/general/General.tsx b/packages/app/src/components/workspace-setting/general/General.tsx index 241c97f06..d73c3c87d 100644 --- a/packages/app/src/components/workspace-setting/general/General.tsx +++ b/packages/app/src/components/workspace-setting/general/General.tsx @@ -33,7 +33,6 @@ export const GeneralPage = ({ workspace }: { workspace: WorkspaceUnit }) => { currentWorkspace && (await updateWorkspace({ avatarBlob: blob }, currentWorkspace)); }; - if (!workspace) { return null; } @@ -42,22 +41,30 @@ export const GeneralPage = ({ workspace }: { workspace: WorkspaceUnit }) => { <> {t('Workspace Avatar')} - - - <> -
- -
+ + {isOwner ? ( + + <> +
+ +
+ + +
+ ) : ( - -
+ )}
diff --git a/packages/app/src/components/workspace-setting/general/style.ts b/packages/app/src/components/workspace-setting/general/style.ts index 58538707f..4707843c6 100644 --- a/packages/app/src/components/workspace-setting/general/style.ts +++ b/packages/app/src/components/workspace-setting/general/style.ts @@ -19,26 +19,29 @@ export const StyledProviderInfo = styled('p')(({ theme }) => { }; }); -export const StyledAvatar = styled('div')(() => { - return { - position: 'relative', - cursor: 'pointer', - ':hover': { - '.camera-icon': { - display: 'block', +export const StyledAvatar = styled('div')( + ({ disabled }: { disabled: boolean }) => { + return { + position: 'relative', + marginRight: '20px', + cursor: disabled ? 'default' : 'pointer', + ':hover': { + '.camera-icon': { + display: 'block', + }, }, - }, - '.camera-icon': { - position: 'absolute', - display: 'none', - width: '100%', - height: '100%', - borderRadius: '50%', - backgroundColor: 'rgba(60, 61, 63, 0.5)', - top: 0, - left: 0, - textAlign: 'center', - lineHeight: '72px', - }, - }; -}); + '.camera-icon': { + position: 'absolute', + display: 'none', + width: '100%', + height: '100%', + borderRadius: '50%', + backgroundColor: 'rgba(60, 61, 63, 0.5)', + top: 0, + left: 0, + textAlign: 'center', + lineHeight: '72px', + }, + }; + } +); From 0ccaf2bc45ee17369506df841a93fe3750afa46f Mon Sep 17 00:00:00 2001 From: JimmFly Date: Thu, 9 Feb 2023 11:29:53 +0800 Subject: [PATCH 04/24] fix: infinite call of useEffect on 404 page (#913) --- packages/app/src/components/quick-search/index.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/app/src/components/quick-search/index.tsx b/packages/app/src/components/quick-search/index.tsx index 97921efca..fd14899ab 100644 --- a/packages/app/src/components/quick-search/index.tsx +++ b/packages/app/src/components/quick-search/index.tsx @@ -40,7 +40,6 @@ export const QuickSearch = ({ open, onClose }: TransitionsModalProps) => { // Add ‘⌘+K’ shortcut keys as switches useEffect(() => { if (router.pathname.startsWith('/404')) { - triggerQuickSearchModal(false); return; } const down = (e: KeyboardEvent) => { @@ -59,7 +58,7 @@ export const QuickSearch = ({ open, onClose }: TransitionsModalProps) => { document.addEventListener('keydown', down, { capture: true }); return () => document.removeEventListener('keydown', down, { capture: true }); - }, [open, router.pathname, triggerQuickSearchModal]); + }, [open, router, triggerQuickSearchModal]); useEffect(() => { if (router.pathname.startsWith('/public-workspace')) { @@ -68,6 +67,12 @@ export const QuickSearch = ({ open, onClose }: TransitionsModalProps) => { return setIsPublic(false); } }, [router]); + useEffect(() => { + if (router.pathname.startsWith('/404')) { + return onClose(); + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); return ( Date: Thu, 9 Feb 2023 11:30:57 +0800 Subject: [PATCH 05/24] fix: add page titles (#883) --- packages/app/src/components/editor/index.tsx | 1 - packages/app/src/pages/404.tsx | 10 +++++++++- packages/app/src/pages/_app.tsx | 1 + .../app/src/pages/workspace/[workspaceId]/[pageId].tsx | 6 ++++++ packages/app/src/pages/workspace/[workspaceId]/all.tsx | 5 +++++ .../app/src/pages/workspace/[workspaceId]/favorite.tsx | 4 ++++ .../app/src/pages/workspace/[workspaceId]/setting.tsx | 4 ++++ .../app/src/pages/workspace/[workspaceId]/trash.tsx | 4 ++++ 8 files changed, 33 insertions(+), 2 deletions(-) diff --git a/packages/app/src/components/editor/index.tsx b/packages/app/src/components/editor/index.tsx index eff0dc21a..6e22f0308 100644 --- a/packages/app/src/components/editor/index.tsx +++ b/packages/app/src/components/editor/index.tsx @@ -59,7 +59,6 @@ export const Editor = ({ page, workspace, setEditor }: Props) => { } setEditor(editor); - document.title = page.meta.title || 'Untitled'; return ret; }, [workspace, page, setEditor]); diff --git a/packages/app/src/pages/404.tsx b/packages/app/src/pages/404.tsx index 0eef5261e..6baddddea 100644 --- a/packages/app/src/pages/404.tsx +++ b/packages/app/src/pages/404.tsx @@ -1,5 +1,13 @@ import NotfoundPage from '@/components/404'; +import Head from 'next/head'; export default function Custom404() { - return ; + return ( + <> + + 404 - AFFiNE + + + + ); } diff --git a/packages/app/src/pages/_app.tsx b/packages/app/src/pages/_app.tsx index 5f1c9499d..ca96b8ef6 100644 --- a/packages/app/src/pages/_app.tsx +++ b/packages/app/src/pages/_app.tsx @@ -50,6 +50,7 @@ const App = ({ Component, pageProps }: AppPropsWithLayout) => { sizes="180x180" href="/icons/apple-touch-icon.png" /> + AFFiNE import('@/components/editor'), { ssr: false, }); @@ -25,8 +27,12 @@ const Page: NextPageWithLayout = () => { (editor: EditorContainer) => setEditor.current(editor), [setEditor] ); + const { t } = useTranslation(); return ( <> + + {currentPage?.meta?.title || t('Untitled')} - AFFiNE + diff --git a/packages/app/src/pages/workspace/[workspaceId]/all.tsx b/packages/app/src/pages/workspace/[workspaceId]/all.tsx index 5d8eb5b43..72ad34c48 100644 --- a/packages/app/src/pages/workspace/[workspaceId]/all.tsx +++ b/packages/app/src/pages/workspace/[workspaceId]/all.tsx @@ -5,6 +5,8 @@ import { ReactElement } from 'react'; import WorkspaceLayout from '@/components/workspace-layout'; import { useTranslation } from '@affine/i18n'; import { PageMeta, useAppState } from '@/providers/app-state-provider'; +import Head from 'next/head'; + const All = () => { const { currentWorkspace } = useAppState(); const pageList = (currentWorkspace?.blocksuiteWorkspace?.meta.pageMetas || @@ -12,6 +14,9 @@ const All = () => { const { t } = useTranslation(); return ( <> + + {t('All pages')} - AFFiNE + }>{t('All pages')} !p.trash)} diff --git a/packages/app/src/pages/workspace/[workspaceId]/favorite.tsx b/packages/app/src/pages/workspace/[workspaceId]/favorite.tsx index cc3f0369a..9c088d9d4 100644 --- a/packages/app/src/pages/workspace/[workspaceId]/favorite.tsx +++ b/packages/app/src/pages/workspace/[workspaceId]/favorite.tsx @@ -5,11 +5,15 @@ import { ReactElement } from 'react'; import WorkspaceLayout from '@/components/workspace-layout'; import { useTranslation } from '@affine/i18n'; import { useAppState } from '@/providers/app-state-provider'; +import Head from 'next/head'; export const Favorite = () => { const { pageList } = useAppState(); const { t } = useTranslation(); return ( <> + + {t('Favourites')} - AFFiNE + }> {t('Favourites')} diff --git a/packages/app/src/pages/workspace/[workspaceId]/setting.tsx b/packages/app/src/pages/workspace/[workspaceId]/setting.tsx index 8754e52a7..d2c70c3dd 100644 --- a/packages/app/src/pages/workspace/[workspaceId]/setting.tsx +++ b/packages/app/src/pages/workspace/[workspaceId]/setting.tsx @@ -19,6 +19,7 @@ import WorkspaceLayout from '@/components/workspace-layout'; import { WorkspaceUnit } from '@affine/datacenter'; import { useTranslation } from '@affine/i18n'; import { PageListHeader } from '@/components/header'; +import Head from 'next/head'; const useTabMap = () => { const { t } = useTranslation(); @@ -79,6 +80,9 @@ const WorkspaceSetting = () => { useTabMap(); return ( <> + + {t('Settings')} - AFFiNE + }>{t('Settings')} diff --git a/packages/app/src/pages/workspace/[workspaceId]/trash.tsx b/packages/app/src/pages/workspace/[workspaceId]/trash.tsx index d0c235037..10c786c4f 100644 --- a/packages/app/src/pages/workspace/[workspaceId]/trash.tsx +++ b/packages/app/src/pages/workspace/[workspaceId]/trash.tsx @@ -5,11 +5,15 @@ import { ReactElement } from 'react'; import WorkspaceLayout from '@/components/workspace-layout'; import { useTranslation } from '@affine/i18n'; import { useAppState } from '@/providers/app-state-provider'; +import Head from 'next/head'; export const Trash = () => { const { pageList } = useAppState(); const { t } = useTranslation(); return ( <> + + {t('Trash')} - AFFiNE + }>{t('Trash')} p.trash)} From cc605251a836260cece8c72b36694427043c443b Mon Sep 17 00:00:00 2001 From: Himself65 Date: Wed, 8 Feb 2023 22:19:11 -0600 Subject: [PATCH 06/24] refactor: move component into a single package (#898) --- .gitignore | 1 + packages/app/next.config.js | 1 + packages/app/package.json | 13 +- packages/app/src/components/404/index.tsx | 2 +- packages/app/src/components/404/styles.ts | 2 +- .../src/components/contact-modal/index.tsx | 2 +- .../app/src/components/contact-modal/style.ts | 2 +- .../src/components/create-workspace/index.tsx | 10 +- .../src/components/delete-workspace/index.tsx | 8 +- .../src/components/edgeless-toolbar/index.tsx | 4 +- .../src/components/edgeless-toolbar/style.ts | 2 +- .../components/editor-mode-switch/style.ts | 2 +- packages/app/src/components/editor/index.tsx | 2 +- .../enable-workspace/EnableWorkspaceModal.tsx | 8 +- .../src/components/enable-workspace/index.tsx | 2 +- .../app/src/components/file-upload/index.tsx | 4 +- .../src/components/header/EditorHeader.tsx | 2 +- .../components/header/QuickSearchButton.tsx | 4 +- .../header-right-items/EditorOptionMenu.tsx | 6 +- .../header/header-right-items/SyncUser.tsx | 2 +- .../header-right-items/TrashButtonGroup.tsx | 2 +- .../theme-mode-switch/style.ts | 2 +- packages/app/src/components/header/styles.ts | 2 +- .../app/src/components/help-island/index.tsx | 4 +- .../app/src/components/help-island/style.ts | 2 +- packages/app/src/components/import/index.tsx | 8 +- packages/app/src/components/import/styles.ts | 2 +- .../src/components/loading/PageLoading.tsx | 2 +- packages/app/src/components/loading/styled.ts | 2 +- .../app/src/components/login-modal/index.tsx | 6 +- .../app/src/components/logout-modal/index.tsx | 6 +- .../app/src/components/mobile-modal/index.tsx | 2 +- .../app/src/components/mobile-modal/styles.ts | 2 +- .../app/src/components/page-list/DateCell.tsx | 2 +- .../app/src/components/page-list/Empty.tsx | 2 +- .../components/page-list/OperationCell.tsx | 8 +- .../app/src/components/page-list/index.tsx | 16 +- .../app/src/components/page-list/styles.ts | 4 +- .../app/src/components/quick-search/index.tsx | 2 +- .../app/src/components/quick-search/style.ts | 2 +- .../src/components/shortcuts-modal/index.tsx | 4 +- .../src/components/shortcuts-modal/style.ts | 2 +- .../src/components/workspace-layout/styles.ts | 2 +- .../src/components/workspace-modal/Footer.tsx | 6 +- .../workspace-modal/SelectLanguageMenu.tsx | 6 +- .../workspace-modal/WorkspaceCard.tsx | 2 +- .../src/components/workspace-modal/index.tsx | 6 +- .../src/components/workspace-modal/styles.ts | 9 +- .../workspace-setting/ExportPage.tsx | 4 +- .../workspace-setting/PublishPage.tsx | 8 +- .../components/workspace-setting/SyncPage.tsx | 2 +- .../workspace-setting/general/General.tsx | 50 +- .../general/delete/Delete.tsx | 8 +- .../workspace-setting/general/delete/style.ts | 2 +- .../workspace-setting/general/leave/Leave.tsx | 6 +- .../workspace-setting/general/leave/style.ts | 2 +- .../workspace-setting/general/style.ts | 4 +- .../member/InviteMemberModal.tsx | 10 +- .../workspace-setting/member/MembersPage.tsx | 12 +- .../workspace-setting/member/style.ts | 4 +- .../src/components/workspace-setting/style.ts | 4 +- .../WorkspaceItem/ListItem.tsx | 2 +- .../WorkspaceItem/LoginItem.tsx | 2 +- .../WorkspaceSelector/WorkspaceItem/styles.ts | 4 +- .../WorkspaceSelector/styles.ts | 6 +- .../components/workspace-slider-bar/index.tsx | 6 +- .../components/workspace-slider-bar/style.ts | 2 +- packages/app/src/pages/affine.tsx | 8 +- .../app/src/pages/invite/[invite_code].tsx | 4 +- .../app/src/pages/playground/templates.tsx | 4 +- .../[workspaceId]/[pageId].tsx | 6 +- .../public-workspace/[workspaceId]/index.tsx | 2 +- .../workspace/[workspaceId]/playground.tsx | 4 +- .../app/src/providers/ConfirmProvider.tsx | 2 +- packages/app/src/providers/ThemeProvider.tsx | 17 +- packages/app/src/styles/styled.ts | 3 - packages/app/tsconfig.json | 4 +- packages/component/.storybook/main.js | 44 + packages/component/.storybook/preview.js | 9 + packages/component/package.json | 36 + packages/component/src/index.ts | 16 + .../src/stories/Breadcrumbs.stories.tsx | 19 + .../component/src/stories/Button.stories.tsx | 20 + .../{app => component}/src/styles/helper.ts | 0 .../{app => component}/src/styles/index.ts | 4 +- packages/component/src/styles/styled.tsx | 15 + .../{app => component}/src/styles/theme.ts | 2 +- .../{app => component}/src/styles/types.ts | 0 .../src/styles/utils/index.ts | 0 .../styles/utils/localStorageThemeHelper.ts | 0 .../src/styles/utils/systemThemeHelper.ts | 0 .../src/ui/breadcrumbs/index.ts | 2 +- .../src/ui/button/Button.tsx | 0 .../src/ui/button/IconButton.tsx | 0 .../src/ui/button/Loading.tsx | 2 +- .../src/ui/button/TextButton.tsx | 0 .../{app => component}/src/ui/button/index.ts | 0 .../src/ui/button/interface.ts | 0 .../src/ui/button/styles.ts | 6 +- .../{app => component}/src/ui/button/utils.ts | 2 +- .../src/ui/confirm/Confirm.tsx | 4 +- .../src/ui/confirm/index.ts | 0 .../src/ui/confirm/styles.ts | 4 +- .../src/ui/divider/index.ts | 2 +- .../{app => component}/src/ui/empty/Empty.tsx | 6 +- .../src/ui/empty/EmptySVG.tsx | 0 .../src/ui/empty/emptyPage.svg | 0 .../{app => component}/src/ui/empty/index.ts | 0 .../{app => component}/src/ui/input/Input.tsx | 0 .../{app => component}/src/ui/input/index.ts | 0 .../{app => component}/src/ui/input/style.ts | 2 +- .../src/ui/layout/Content.tsx | 2 +- .../src/ui/layout/Wrapper.tsx | 2 +- .../{app => component}/src/ui/layout/index.ts | 0 .../{app => component}/src/ui/menu/Menu.tsx | 2 +- .../src/ui/menu/MenuItem.tsx | 0 .../{app => component}/src/ui/menu/index.ts | 0 .../{app => component}/src/ui/menu/styles.ts | 2 +- .../{app => component}/src/ui/modal/Modal.tsx | 0 .../src/ui/modal/ModalCloseButton.tsx | 4 +- .../src/ui/modal/ModalWrapper.tsx | 2 +- .../{app => component}/src/ui/modal/index.tsx | 0 .../{app => component}/src/ui/modal/styles.ts | 4 +- packages/{app => component}/src/ui/mui.ts | 0 .../src/ui/popper/PopoverArrow.tsx | 3 +- .../src/ui/popper/Popper.tsx | 2 +- .../{app => component}/src/ui/popper/index.ts | 0 .../src/ui/popper/interface.ts | 0 .../src/ui/shared/Container.tsx | 2 +- .../{app => component}/src/ui/table/Table.tsx | 0 .../src/ui/table/TableBody.tsx | 2 +- .../src/ui/table/TableCell.tsx | 0 .../src/ui/table/TableHead.tsx | 0 .../src/ui/table/TableRow.tsx | 0 .../{app => component}/src/ui/table/index.ts | 0 .../src/ui/table/interface.ts | 0 .../{app => component}/src/ui/table/styles.ts | 2 +- .../{app => component}/src/ui/toast/index.ts | 0 .../{app => component}/src/ui/toast/toast.ts | 0 .../src/ui/tooltip/Tooltip.tsx | 2 +- .../src/ui/tooltip/index.tsx | 0 packages/component/tsconfig.json | 22 + packages/i18n/src/index.ts | 2 +- pnpm-lock.yaml | 9422 ++++++++++++++++- tsconfig.json | 1 + 145 files changed, 9609 insertions(+), 450 deletions(-) delete mode 100644 packages/app/src/styles/styled.ts create mode 100644 packages/component/.storybook/main.js create mode 100644 packages/component/.storybook/preview.js create mode 100644 packages/component/package.json create mode 100644 packages/component/src/index.ts create mode 100644 packages/component/src/stories/Breadcrumbs.stories.tsx create mode 100644 packages/component/src/stories/Button.stories.tsx rename packages/{app => component}/src/styles/helper.ts (100%) rename packages/{app => component}/src/styles/index.ts (50%) create mode 100644 packages/component/src/styles/styled.tsx rename packages/{app => component}/src/styles/theme.ts (99%) rename packages/{app => component}/src/styles/types.ts (100%) rename packages/{app => component}/src/styles/utils/index.ts (100%) rename packages/{app => component}/src/styles/utils/localStorageThemeHelper.ts (100%) rename packages/{app => component}/src/styles/utils/systemThemeHelper.ts (100%) rename packages/{app => component}/src/ui/breadcrumbs/index.ts (82%) rename packages/{app => component}/src/ui/button/Button.tsx (100%) rename packages/{app => component}/src/ui/button/IconButton.tsx (100%) rename packages/{app => component}/src/ui/button/Loading.tsx (97%) rename packages/{app => component}/src/ui/button/TextButton.tsx (100%) rename packages/{app => component}/src/ui/button/index.ts (100%) rename packages/{app => component}/src/ui/button/interface.ts (100%) rename packages/{app => component}/src/ui/button/styles.ts (96%) rename packages/{app => component}/src/ui/button/utils.ts (98%) rename packages/{app => component}/src/ui/confirm/Confirm.tsx (97%) rename packages/{app => component}/src/ui/confirm/index.ts (100%) rename packages/{app => component}/src/ui/confirm/styles.ts (91%) rename packages/{app => component}/src/ui/divider/index.ts (81%) rename packages/{app => component}/src/ui/empty/Empty.tsx (71%) rename packages/{app => component}/src/ui/empty/EmptySVG.tsx (100%) rename packages/{app => component}/src/ui/empty/emptyPage.svg (100%) rename packages/{app => component}/src/ui/empty/index.ts (100%) rename packages/{app => component}/src/ui/input/Input.tsx (100%) rename packages/{app => component}/src/ui/input/index.ts (100%) rename packages/{app => component}/src/ui/input/style.ts (95%) rename packages/{app => component}/src/ui/layout/Content.tsx (95%) rename packages/{app => component}/src/ui/layout/Wrapper.tsx (98%) rename packages/{app => component}/src/ui/layout/index.ts (100%) rename packages/{app => component}/src/ui/menu/Menu.tsx (90%) rename packages/{app => component}/src/ui/menu/MenuItem.tsx (100%) rename packages/{app => component}/src/ui/menu/index.ts (100%) rename packages/{app => component}/src/ui/menu/styles.ts (95%) rename packages/{app => component}/src/ui/modal/Modal.tsx (100%) rename packages/{app => component}/src/ui/modal/ModalCloseButton.tsx (87%) rename packages/{app => component}/src/ui/modal/ModalWrapper.tsx (91%) rename packages/{app => component}/src/ui/modal/index.tsx (100%) rename packages/{app => component}/src/ui/modal/styles.ts (92%) rename packages/{app => component}/src/ui/mui.ts (100%) rename packages/{app => component}/src/ui/popper/PopoverArrow.tsx (96%) rename packages/{app => component}/src/ui/popper/Popper.tsx (99%) rename packages/{app => component}/src/ui/popper/index.ts (100%) rename packages/{app => component}/src/ui/popper/interface.ts (100%) rename packages/{app => component}/src/ui/shared/Container.tsx (97%) rename packages/{app => component}/src/ui/table/Table.tsx (100%) rename packages/{app => component}/src/ui/table/TableBody.tsx (83%) rename packages/{app => component}/src/ui/table/TableCell.tsx (100%) rename packages/{app => component}/src/ui/table/TableHead.tsx (100%) rename packages/{app => component}/src/ui/table/TableRow.tsx (100%) rename packages/{app => component}/src/ui/table/index.ts (100%) rename packages/{app => component}/src/ui/table/interface.ts (100%) rename packages/{app => component}/src/ui/table/styles.ts (96%) rename packages/{app => component}/src/ui/toast/index.ts (100%) rename packages/{app => component}/src/ui/toast/toast.ts (100%) rename packages/{app => component}/src/ui/tooltip/Tooltip.tsx (95%) rename packages/{app => component}/src/ui/tooltip/index.tsx (100%) create mode 100644 packages/component/tsconfig.json diff --git a/.gitignore b/.gitignore index 090865ce9..80b073618 100644 --- a/.gitignore +++ b/.gitignore @@ -48,6 +48,7 @@ Thumbs.db .next out/ +storybook-static module-resolve.js module-resolve.cjs diff --git a/packages/app/next.config.js b/packages/app/next.config.js index 1ef34b267..14fa2711d 100644 --- a/packages/app/next.config.js +++ b/packages/app/next.config.js @@ -47,6 +47,7 @@ const nextConfig = { COMMIT_HASH: getCommitHash(), EDITOR_VERSION, }, + transpilePackages: ['@affine/component'], webpack: config => { config.experiments = { ...config.experiments, topLevelAwait: true }; config.resolve.alias['yjs'] = require.resolve('yjs'); diff --git a/packages/app/package.json b/packages/app/package.json index 1b47cf1e3..39dcfda30 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -9,21 +9,22 @@ "lint": "next lint" }, "dependencies": { + "@affine/component": "workspace:*", "@affine/datacenter": "workspace:*", "@affine/i18n": "workspace:*", "@blocksuite/blocks": "0.4.0-alpha.2", "@blocksuite/editor": "0.4.0-alpha.2", "@blocksuite/icons": "^2.0.2", "@blocksuite/store": "0.4.0-alpha.2", - "@emotion/css": "^11.10.0", - "@emotion/react": "^11.10.4", + "@emotion/css": "^11.10.5", + "@emotion/react": "^11.10.5", "@emotion/server": "^11.10.0", - "@emotion/styled": "^11.10.4", + "@emotion/styled": "^11.10.5", "@fontsource/poppins": "^4.5.10", "@fontsource/space-mono": "^4.5.10", - "@mui/base": "^5.0.0-alpha.87", - "@mui/icons-material": "^5.10.9", - "@mui/material": "^5.8.6", + "@mui/base": "=5.0.0-alpha.101", + "@mui/icons-material": "=5.10.9", + "@mui/material": "=5.8.6", "@toeverything/pathfinder-logger": "workspace:@affine/logger@*", "cmdk": "^0.1.20", "css-spring": "^4.1.0", diff --git a/packages/app/src/components/404/index.tsx b/packages/app/src/components/404/index.tsx index ffba2a08d..55b04dbe7 100644 --- a/packages/app/src/components/404/index.tsx +++ b/packages/app/src/components/404/index.tsx @@ -1,6 +1,6 @@ import { NotFoundTitle, PageContainer } from './styles'; import { useTranslation } from '@affine/i18n'; -import { Button } from '@/ui/button'; +import { Button } from '@affine/component'; import { useRouter } from 'next/router'; export const NotfoundPage = () => { const { t } = useTranslation(); diff --git a/packages/app/src/components/404/styles.ts b/packages/app/src/components/404/styles.ts index 450be72e6..4e0bd9b64 100644 --- a/packages/app/src/components/404/styles.ts +++ b/packages/app/src/components/404/styles.ts @@ -1,4 +1,4 @@ -import { styled } from '@/styles'; +import { styled } from '@affine/component'; export const PageContainer = styled('div')(({ theme }) => { return { diff --git a/packages/app/src/components/contact-modal/index.tsx b/packages/app/src/components/contact-modal/index.tsx index d22b2ea6c..fdade2b7a 100644 --- a/packages/app/src/components/contact-modal/index.tsx +++ b/packages/app/src/components/contact-modal/index.tsx @@ -1,4 +1,4 @@ -import { Modal, ModalCloseButton, ModalWrapper } from '@/ui/modal'; +import { Modal, ModalCloseButton, ModalWrapper } from '@affine/component'; import { LogoIcon, DocIcon, diff --git a/packages/app/src/components/contact-modal/style.ts b/packages/app/src/components/contact-modal/style.ts index 8ac277370..1ba3b3b88 100644 --- a/packages/app/src/components/contact-modal/style.ts +++ b/packages/app/src/components/contact-modal/style.ts @@ -1,4 +1,4 @@ -import { absoluteCenter, displayFlex, styled } from '@/styles'; +import { absoluteCenter, displayFlex, styled } from '@affine/component'; export const StyledBigLink = styled('a')(({ theme }) => { return { diff --git a/packages/app/src/components/create-workspace/index.tsx b/packages/app/src/components/create-workspace/index.tsx index 2c374a990..c3ccca93d 100644 --- a/packages/app/src/components/create-workspace/index.tsx +++ b/packages/app/src/components/create-workspace/index.tsx @@ -1,13 +1,13 @@ -import { styled } from '@/styles'; -import { Modal, ModalWrapper, ModalCloseButton } from '@/ui/modal'; -import { Button } from '@/ui/button'; +import { styled } from '@affine/component'; +import { Modal, ModalWrapper, ModalCloseButton } from '@affine/component'; +import { Button } from '@affine/component'; import { useState } from 'react'; -import Input from '@/ui/input'; +import { Input } from '@affine/component'; import { KeyboardEvent } from 'react'; import { useTranslation } from '@affine/i18n'; import { useWorkspaceHelper } from '@/hooks/use-workspace-helper'; import { useRouter } from 'next/router'; -import { toast } from '@/ui/toast'; +import { toast } from '@affine/component'; interface ModalProps { open: boolean; diff --git a/packages/app/src/components/delete-workspace/index.tsx b/packages/app/src/components/delete-workspace/index.tsx index cead4b135..51418532a 100644 --- a/packages/app/src/components/delete-workspace/index.tsx +++ b/packages/app/src/components/delete-workspace/index.tsx @@ -1,7 +1,7 @@ -import { styled } from '@/styles'; -import { Modal, ModalWrapper, ModalCloseButton } from '@/ui/modal'; -import { Button } from '@/ui/button'; -import Input from '@/ui/input'; +import { styled } from '@affine/component'; +import { Modal, ModalWrapper, ModalCloseButton } from '@affine/component'; +import { Button } from '@affine/component'; +import { Input } from '@affine/component'; import { useState } from 'react'; interface LoginModalProps { diff --git a/packages/app/src/components/edgeless-toolbar/index.tsx b/packages/app/src/components/edgeless-toolbar/index.tsx index e26189986..b64b07c06 100644 --- a/packages/app/src/components/edgeless-toolbar/index.tsx +++ b/packages/app/src/components/edgeless-toolbar/index.tsx @@ -14,8 +14,8 @@ import { UndoIcon, RedoIcon, } from './Icons'; -import { MuiSlide } from '@/ui/mui'; -import { Tooltip } from '@/ui/tooltip'; +import { MuiSlide } from '@affine/component'; +import { Tooltip } from '@affine/component'; import useCurrentPageMeta from '@/hooks/use-current-page-meta'; import { useAppState } from '@/providers/app-state-provider'; import useHistoryUpdated from '@/hooks/use-history-update'; diff --git a/packages/app/src/components/edgeless-toolbar/style.ts b/packages/app/src/components/edgeless-toolbar/style.ts index ff925808e..31d2fbbdd 100644 --- a/packages/app/src/components/edgeless-toolbar/style.ts +++ b/packages/app/src/components/edgeless-toolbar/style.ts @@ -1,4 +1,4 @@ -import { styled, displayFlex } from '@/styles'; +import { styled, displayFlex } from '@affine/component'; export const StyledEdgelessToolbar = styled.div(({ theme }) => ({ height: '320px', diff --git a/packages/app/src/components/editor-mode-switch/style.ts b/packages/app/src/components/editor-mode-switch/style.ts index d17f65bd1..bb9a7d5df 100644 --- a/packages/app/src/components/editor-mode-switch/style.ts +++ b/packages/app/src/components/editor-mode-switch/style.ts @@ -1,4 +1,4 @@ -import { displayFlex, keyframes, styled } from '@/styles'; +import { displayFlex, keyframes, styled } from '@affine/component'; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore import spring, { toString } from 'css-spring'; diff --git a/packages/app/src/components/editor/index.tsx b/packages/app/src/components/editor/index.tsx index 6e22f0308..176777f86 100644 --- a/packages/app/src/components/editor/index.tsx +++ b/packages/app/src/components/editor/index.tsx @@ -3,7 +3,7 @@ import type { Page, Workspace } from '@blocksuite/store'; import '@blocksuite/blocks'; import { EditorContainer } from '@blocksuite/editor'; import exampleMarkdown from '@/templates/Welcome-to-AFFiNE-Alpha-Downhills.md'; -import { styled } from '@/styles'; +import { styled } from '@affine/component'; const StyledEditorContainer = styled('div')(() => { return { diff --git a/packages/app/src/components/enable-workspace/EnableWorkspaceModal.tsx b/packages/app/src/components/enable-workspace/EnableWorkspaceModal.tsx index 95da09511..548f7ae8b 100644 --- a/packages/app/src/components/enable-workspace/EnableWorkspaceModal.tsx +++ b/packages/app/src/components/enable-workspace/EnableWorkspaceModal.tsx @@ -1,11 +1,11 @@ -import { styled } from '@/styles'; -import { Modal, ModalWrapper } from '@/ui/modal'; -import { Button, IconButton } from '@/ui/button'; +import { styled } from '@affine/component'; +import { Modal, ModalWrapper } from '@affine/component'; +import { Button, IconButton } from '@affine/component'; import { useTranslation } from '@affine/i18n'; import { useAppState } from '@/providers/app-state-provider'; import { useState } from 'react'; import router from 'next/router'; -import { toast } from '@/ui/toast'; +import { toast } from '@affine/component'; import { CloseIcon } from '@blocksuite/icons'; interface EnableWorkspaceModalProps { open: boolean; diff --git a/packages/app/src/components/enable-workspace/index.tsx b/packages/app/src/components/enable-workspace/index.tsx index cd4d558ff..6edff7f46 100644 --- a/packages/app/src/components/enable-workspace/index.tsx +++ b/packages/app/src/components/enable-workspace/index.tsx @@ -1,4 +1,4 @@ -import { Button } from '@/ui/button'; +import { Button } from '@affine/component'; import { useTranslation } from '@affine/i18n'; import { useState } from 'react'; import { EnableWorkspaceModal } from './EnableWorkspaceModal'; diff --git a/packages/app/src/components/file-upload/index.tsx b/packages/app/src/components/file-upload/index.tsx index 80b089c35..35db5abc6 100644 --- a/packages/app/src/components/file-upload/index.tsx +++ b/packages/app/src/components/file-upload/index.tsx @@ -1,6 +1,6 @@ -import { Button } from '@/ui/button'; +import { Button } from '@affine/component'; import { FC, useRef, ChangeEvent, ReactElement } from 'react'; -import { styled } from '@/styles'; +import { styled } from '@affine/component'; import { useTranslation } from '@affine/i18n'; interface Props { uploadType?: string; diff --git a/packages/app/src/components/header/EditorHeader.tsx b/packages/app/src/components/header/EditorHeader.tsx index 76bdb9c88..0315dafd5 100644 --- a/packages/app/src/components/header/EditorHeader.tsx +++ b/packages/app/src/components/header/EditorHeader.tsx @@ -5,7 +5,7 @@ import { StyledTitle, StyledTitleWrapper, } from './styles'; -import { Content } from '@/ui/layout'; +import { Content } from '@affine/component'; import { useAppState } from '@/providers/app-state-provider'; import EditorModeSwitch from '@/components/editor-mode-switch'; import QuickSearchButton from './QuickSearchButton'; diff --git a/packages/app/src/components/header/QuickSearchButton.tsx b/packages/app/src/components/header/QuickSearchButton.tsx index dfc00eef1..9b73c096f 100644 --- a/packages/app/src/components/header/QuickSearchButton.tsx +++ b/packages/app/src/components/header/QuickSearchButton.tsx @@ -1,8 +1,8 @@ import React from 'react'; -import { IconButton, IconButtonProps } from '@/ui/button'; +import { IconButton, IconButtonProps } from '@affine/component'; import { ArrowDownIcon } from '@blocksuite/icons'; import { useModal } from '@/providers/GlobalModalProvider'; -import { styled } from '@/styles'; +import { styled } from '@affine/component'; const StyledIconButtonWithAnimate = styled(IconButton)(({ theme }) => { return { diff --git a/packages/app/src/components/header/header-right-items/EditorOptionMenu.tsx b/packages/app/src/components/header/header-right-items/EditorOptionMenu.tsx index b4eef4ebf..879e6a411 100644 --- a/packages/app/src/components/header/header-right-items/EditorOptionMenu.tsx +++ b/packages/app/src/components/header/header-right-items/EditorOptionMenu.tsx @@ -1,5 +1,5 @@ -import { Menu, MenuItem } from '@/ui/menu'; -import { IconButton } from '@/ui/button'; +import { Menu, MenuItem } from '@affine/component'; +import { IconButton } from '@affine/component'; import { EdgelessIcon, ExportIcon, @@ -15,7 +15,7 @@ import { useAppState } from '@/providers/app-state-provider'; import { usePageHelper } from '@/hooks/use-page-helper'; import { useConfirm } from '@/providers/ConfirmProvider'; import useCurrentPageMeta from '@/hooks/use-current-page-meta'; -import { toast } from '@/ui/toast'; +import { toast } from '@affine/component'; import { useTranslation } from '@affine/i18n'; const PopoverContent = () => { const { editor } = useAppState(); diff --git a/packages/app/src/components/header/header-right-items/SyncUser.tsx b/packages/app/src/components/header/header-right-items/SyncUser.tsx index 0923de989..0cedea6fe 100644 --- a/packages/app/src/components/header/header-right-items/SyncUser.tsx +++ b/packages/app/src/components/header/header-right-items/SyncUser.tsx @@ -1,7 +1,7 @@ import { CloudUnsyncedIcon } from '@blocksuite/icons'; import { useModal } from '@/providers/GlobalModalProvider'; import { useAppState } from '@/providers/app-state-provider'; -import { IconButton } from '@/ui/button'; +import { IconButton } from '@affine/component'; // Temporary solution to use this component, since the @blocksuite/icons has not been published yet const DefaultSyncIcon = () => { diff --git a/packages/app/src/components/header/header-right-items/TrashButtonGroup.tsx b/packages/app/src/components/header/header-right-items/TrashButtonGroup.tsx index af0a12a8d..96156fd91 100644 --- a/packages/app/src/components/header/header-right-items/TrashButtonGroup.tsx +++ b/packages/app/src/components/header/header-right-items/TrashButtonGroup.tsx @@ -1,4 +1,4 @@ -import { Button } from '@/ui/button'; +import { Button } from '@affine/component'; import { usePageHelper } from '@/hooks/use-page-helper'; import { useAppState } from '@/providers/app-state-provider'; import { useConfirm } from '@/providers/ConfirmProvider'; diff --git a/packages/app/src/components/header/header-right-items/theme-mode-switch/style.ts b/packages/app/src/components/header/header-right-items/theme-mode-switch/style.ts index 59d82211e..279d09b99 100644 --- a/packages/app/src/components/header/header-right-items/theme-mode-switch/style.ts +++ b/packages/app/src/components/header/header-right-items/theme-mode-switch/style.ts @@ -1,4 +1,4 @@ -import { displayFlex, keyframes, styled } from '@/styles'; +import { displayFlex, keyframes, styled } from '@affine/component'; import { CSSProperties } from 'react'; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore diff --git a/packages/app/src/components/header/styles.ts b/packages/app/src/components/header/styles.ts index 9870e390a..4e88860ee 100644 --- a/packages/app/src/components/header/styles.ts +++ b/packages/app/src/components/header/styles.ts @@ -1,4 +1,4 @@ -import { displayFlex, styled } from '@/styles'; +import { displayFlex, styled } from '@affine/component'; export const StyledHeaderContainer = styled.div<{ hasWarning: boolean }>( ({ hasWarning }) => { diff --git a/packages/app/src/components/help-island/index.tsx b/packages/app/src/components/help-island/index.tsx index 9fb883481..4f7b12684 100644 --- a/packages/app/src/components/help-island/index.tsx +++ b/packages/app/src/components/help-island/index.tsx @@ -6,8 +6,8 @@ import { StyledTransformIcon, } from './style'; import { CloseIcon, ContactIcon, HelpIcon, KeyboardIcon } from './Icons'; -import { MuiGrow } from '@/ui/mui'; -import { Tooltip } from '@/ui/tooltip'; +import { MuiGrow } from '@affine/component'; +import { Tooltip } from '@affine/component'; import { useTranslation } from '@affine/i18n'; import { useModal } from '@/providers/GlobalModalProvider'; import { useTheme } from '@/providers/ThemeProvider'; diff --git a/packages/app/src/components/help-island/style.ts b/packages/app/src/components/help-island/style.ts index 9373a53da..46b2e271a 100644 --- a/packages/app/src/components/help-island/style.ts +++ b/packages/app/src/components/help-island/style.ts @@ -1,4 +1,4 @@ -import { displayFlex, styled } from '@/styles'; +import { displayFlex, styled } from '@affine/component'; export const StyledIsland = styled('div')(({ theme }) => { return { diff --git a/packages/app/src/components/import/index.tsx b/packages/app/src/components/import/index.tsx index d8eaa2ffd..e9d160294 100644 --- a/packages/app/src/components/import/index.tsx +++ b/packages/app/src/components/import/index.tsx @@ -1,13 +1,13 @@ -import { Modal, ModalWrapper, ModalCloseButton } from '@/ui/modal'; +import { Modal, ModalWrapper, ModalCloseButton } from '@affine/component'; import { StyledButtonWrapper, StyledTitle } from './styles'; -import { Button } from '@/ui/button'; -import { Content, FlexWrapper } from '@/ui/layout'; +import { Button } from '@affine/component'; +import { Content, FlexWrapper } from '@affine/component'; import Loading from '@/components/loading'; import { usePageHelper } from '@/hooks/use-page-helper'; import { useAppState } from '@/providers/app-state-provider'; import { useEffect, useState } from 'react'; import { useTranslation } from '@affine/i18n'; -// import { Tooltip } from '@/ui/tooltip'; +// import { Tooltip } from '@affine/component'; type ImportModalProps = { open: boolean; onClose: () => void; diff --git a/packages/app/src/components/import/styles.ts b/packages/app/src/components/import/styles.ts index 580d8a153..1665d2899 100644 --- a/packages/app/src/components/import/styles.ts +++ b/packages/app/src/components/import/styles.ts @@ -1,4 +1,4 @@ -import { styled } from '@/styles'; +import { styled } from '@affine/component'; export const StyledTitle = styled.div(({ theme }) => { return { diff --git a/packages/app/src/components/loading/PageLoading.tsx b/packages/app/src/components/loading/PageLoading.tsx index ef853c4d6..92e60d7f4 100644 --- a/packages/app/src/components/loading/PageLoading.tsx +++ b/packages/app/src/components/loading/PageLoading.tsx @@ -1,4 +1,4 @@ -import { styled } from '@/styles'; +import { styled } from '@affine/component'; import Loading from './Loading'; import { useTranslation } from '@affine/i18n'; diff --git a/packages/app/src/components/loading/styled.ts b/packages/app/src/components/loading/styled.ts index 31906e1b7..b88f0f7c8 100644 --- a/packages/app/src/components/loading/styled.ts +++ b/packages/app/src/components/loading/styled.ts @@ -1,4 +1,4 @@ -import { styled } from '@/styles'; +import { styled } from '@affine/component'; // Inspired by https://codepen.io/graphilla/pen/rNvBMYY export const StyledLoadingWrapper = styled('div', { diff --git a/packages/app/src/components/login-modal/index.tsx b/packages/app/src/components/login-modal/index.tsx index 880ebe6e3..105334a77 100644 --- a/packages/app/src/components/login-modal/index.tsx +++ b/packages/app/src/components/login-modal/index.tsx @@ -1,6 +1,6 @@ -import { positionAbsolute, styled } from '@/styles'; -import { Modal, ModalWrapper, ModalCloseButton } from '@/ui/modal'; -import { Button } from '@/ui/button'; +import { positionAbsolute, styled } from '@affine/component'; +import { Modal, ModalWrapper, ModalCloseButton } from '@affine/component'; +import { Button } from '@affine/component'; import { useAppState } from '@/providers/app-state-provider'; import { useTranslation } from '@affine/i18n'; import { GoogleIcon } from './GoogleIcon'; diff --git a/packages/app/src/components/logout-modal/index.tsx b/packages/app/src/components/logout-modal/index.tsx index d710b2e45..450b8834d 100644 --- a/packages/app/src/components/logout-modal/index.tsx +++ b/packages/app/src/components/logout-modal/index.tsx @@ -1,6 +1,6 @@ -import { styled } from '@/styles'; -import { Modal, ModalWrapper, ModalCloseButton } from '@/ui/modal'; -import { Button } from '@/ui/button'; +import { styled } from '@affine/component'; +import { Modal, ModalWrapper, ModalCloseButton } from '@affine/component'; +import { Button } from '@affine/component'; import { Check, UnCheck } from './icon'; import { useState } from 'react'; import { useTranslation } from '@affine/i18n'; diff --git a/packages/app/src/components/mobile-modal/index.tsx b/packages/app/src/components/mobile-modal/index.tsx index b568c2697..3f7b0d976 100644 --- a/packages/app/src/components/mobile-modal/index.tsx +++ b/packages/app/src/components/mobile-modal/index.tsx @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import Modal, { ModalCloseButton, ModalWrapper } from '@/ui/modal'; +import { Modal, ModalCloseButton, ModalWrapper } from '@affine/component'; import getIsMobile from '@/utils/get-is-mobile'; import { StyledButton, StyledContent, StyledTitle } from './styles'; import bg from './bg.png'; diff --git a/packages/app/src/components/mobile-modal/styles.ts b/packages/app/src/components/mobile-modal/styles.ts index 40a8bcc37..771a6b585 100644 --- a/packages/app/src/components/mobile-modal/styles.ts +++ b/packages/app/src/components/mobile-modal/styles.ts @@ -1,4 +1,4 @@ -import { displayFlex, styled } from '@/styles'; +import { displayFlex, styled } from '@affine/component'; export const StyledTitle = styled.div(() => { return { diff --git a/packages/app/src/components/page-list/DateCell.tsx b/packages/app/src/components/page-list/DateCell.tsx index 4ffc4e95c..d01404986 100644 --- a/packages/app/src/components/page-list/DateCell.tsx +++ b/packages/app/src/components/page-list/DateCell.tsx @@ -1,7 +1,7 @@ import localizedFormat from 'dayjs/plugin/localizedFormat'; import dayjs from 'dayjs'; import { PageMeta } from '@/providers/app-state-provider'; -import { TableCell } from '@/ui/table'; +import { TableCell } from '@affine/component'; import React from 'react'; dayjs.extend(localizedFormat); diff --git a/packages/app/src/components/page-list/Empty.tsx b/packages/app/src/components/page-list/Empty.tsx index f8dfc6745..236968bd0 100644 --- a/packages/app/src/components/page-list/Empty.tsx +++ b/packages/app/src/components/page-list/Empty.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Empty } from '@/ui/empty'; +import { Empty } from '@affine/component'; import { useTranslation } from '@affine/i18n'; export const PageListEmpty = (props: { listType?: string }) => { const { listType } = props; diff --git a/packages/app/src/components/page-list/OperationCell.tsx b/packages/app/src/components/page-list/OperationCell.tsx index a9efc634c..2bbcbeea7 100644 --- a/packages/app/src/components/page-list/OperationCell.tsx +++ b/packages/app/src/components/page-list/OperationCell.tsx @@ -1,8 +1,8 @@ import { useConfirm } from '@/providers/ConfirmProvider'; import { PageMeta } from '@/providers/app-state-provider'; -import { Menu, MenuItem } from '@/ui/menu'; -import { FlexWrapper } from '@/ui/layout'; -import { IconButton } from '@/ui/button'; +import { Menu, MenuItem } from '@affine/component'; +import { FlexWrapper } from '@affine/component'; +import { IconButton } from '@affine/component'; import { MoreVerticalIcon, RestoreIcon, @@ -12,7 +12,7 @@ import { OpenInNewIcon, TrashIcon, } from '@blocksuite/icons'; -import { toast } from '@/ui/toast'; +import { toast } from '@affine/component'; import { usePageHelper } from '@/hooks/use-page-helper'; import { useTranslation } from '@affine/i18n'; export const OperationCell = ({ pageMeta }: { pageMeta: PageMeta }) => { diff --git a/packages/app/src/components/page-list/index.tsx b/packages/app/src/components/page-list/index.tsx index 7623eb489..714d6ca11 100644 --- a/packages/app/src/components/page-list/index.tsx +++ b/packages/app/src/components/page-list/index.tsx @@ -11,17 +11,23 @@ import { StyledTitleLink, StyledTitleWrapper, } from './styles'; -import { Table, TableBody, TableCell, TableHead, TableRow } from '@/ui/table'; +import { + Table, + TableBody, + TableCell, + TableHead, + TableRow, +} from '@affine/component'; import { OperationCell, TrashOperationCell } from './OperationCell'; import Empty from './Empty'; -import { Content } from '@/ui/layout'; +import { Content } from '@affine/component'; import React from 'react'; import DateCell from '@/components/page-list/DateCell'; -import { IconButton } from '@/ui/button'; -import { Tooltip } from '@/ui/tooltip'; +import { IconButton } from '@affine/component'; +import { Tooltip } from '@affine/component'; import { useRouter } from 'next/router'; import { useAppState } from '@/providers/app-state-provider'; -import { toast } from '@/ui/toast'; +import { toast } from '@affine/component'; import { usePageHelper } from '@/hooks/use-page-helper'; import { useTheme } from '@/providers/ThemeProvider'; import { useTranslation } from '@affine/i18n'; diff --git a/packages/app/src/components/page-list/styles.ts b/packages/app/src/components/page-list/styles.ts index fcf80e813..6b03fb7ce 100644 --- a/packages/app/src/components/page-list/styles.ts +++ b/packages/app/src/components/page-list/styles.ts @@ -1,5 +1,5 @@ -import { displayFlex, styled } from '@/styles'; -import { TableRow } from '@/ui/table'; +import { displayFlex, styled } from '@affine/component'; +import { TableRow } from '@affine/component'; export const StyledTableContainer = styled.div(() => { return { diff --git a/packages/app/src/components/quick-search/index.tsx b/packages/app/src/components/quick-search/index.tsx index fd14899ab..3ca942444 100644 --- a/packages/app/src/components/quick-search/index.tsx +++ b/packages/app/src/components/quick-search/index.tsx @@ -1,4 +1,4 @@ -import { Modal, ModalWrapper } from '@/ui/modal'; +import { Modal, ModalWrapper } from '@affine/component'; import { StyledContent, StyledModalHeader, diff --git a/packages/app/src/components/quick-search/style.ts b/packages/app/src/components/quick-search/style.ts index 3c949aaaa..024f5e249 100644 --- a/packages/app/src/components/quick-search/style.ts +++ b/packages/app/src/components/quick-search/style.ts @@ -1,4 +1,4 @@ -import { displayFlex, styled } from '@/styles'; +import { displayFlex, styled } from '@affine/component'; export const StyledContent = styled('div')(({ theme }) => { return { diff --git a/packages/app/src/components/shortcuts-modal/index.tsx b/packages/app/src/components/shortcuts-modal/index.tsx index 08416e312..bfe6c75a7 100644 --- a/packages/app/src/components/shortcuts-modal/index.tsx +++ b/packages/app/src/components/shortcuts-modal/index.tsx @@ -13,8 +13,8 @@ import { useWindowsKeyboardShortcuts, useWinMarkdownShortcuts, } from '@/components/shortcuts-modal/config'; -import { MuiSlide } from '@/ui/mui'; -import { ModalCloseButton } from '@/ui/modal'; +import { MuiSlide } from '@affine/component'; +import { ModalCloseButton } from '@affine/component'; import { getUaHelper } from '@/utils'; import { useTranslation } from '@affine/i18n'; type ModalProps = { diff --git a/packages/app/src/components/shortcuts-modal/style.ts b/packages/app/src/components/shortcuts-modal/style.ts index fabe9b3fe..d3696090c 100644 --- a/packages/app/src/components/shortcuts-modal/style.ts +++ b/packages/app/src/components/shortcuts-modal/style.ts @@ -1,4 +1,4 @@ -import { displayFlex, styled } from '@/styles'; +import { displayFlex, styled } from '@affine/component'; export const StyledShortcutsModal = styled.div(({ theme }) => ({ width: '288px', diff --git a/packages/app/src/components/workspace-layout/styles.ts b/packages/app/src/components/workspace-layout/styles.ts index e935901b3..4c246db80 100644 --- a/packages/app/src/components/workspace-layout/styles.ts +++ b/packages/app/src/components/workspace-layout/styles.ts @@ -1,4 +1,4 @@ -import { styled } from '@/styles'; +import { styled } from '@affine/component'; export const StyledPage = styled('div')(({ theme }) => { return { diff --git a/packages/app/src/components/workspace-modal/Footer.tsx b/packages/app/src/components/workspace-modal/Footer.tsx index 9a591e197..45a84998d 100644 --- a/packages/app/src/components/workspace-modal/Footer.tsx +++ b/packages/app/src/components/workspace-modal/Footer.tsx @@ -1,11 +1,11 @@ import { CloudInsyncIcon, LogOutIcon } from '@blocksuite/icons'; -import { FlexWrapper } from '@/ui/layout'; +import { FlexWrapper } from '@affine/component'; import { WorkspaceAvatar } from '@/components/workspace-avatar'; -import { IconButton } from '@/ui/button'; +import { IconButton } from '@affine/component'; import { useAppState } from '@/providers/app-state-provider'; import { StyledFooter, StyleUserInfo, StyledSignInButton } from './styles'; import { useTranslation } from '@affine/i18n'; -import { Tooltip } from '@/ui/tooltip'; +import { Tooltip } from '@affine/component'; export const Footer = ({ onLogin, onLogout, diff --git a/packages/app/src/components/workspace-modal/SelectLanguageMenu.tsx b/packages/app/src/components/workspace-modal/SelectLanguageMenu.tsx index 47e4ae02a..c79b3f5c1 100644 --- a/packages/app/src/components/workspace-modal/SelectLanguageMenu.tsx +++ b/packages/app/src/components/workspace-modal/SelectLanguageMenu.tsx @@ -1,9 +1,9 @@ import { LOCALES } from '@affine/i18n'; -import { styled } from '@/styles'; +import { styled } from '@affine/component'; import { useTranslation } from '@affine/i18n'; import { ArrowDownIcon } from '@blocksuite/icons'; -import { Button } from '@/ui/button'; -import { Menu, MenuItem } from '@/ui/menu'; +import { Button } from '@affine/component'; +import { Menu, MenuItem } from '@affine/component'; const LanguageMenuContent = () => { const { i18n } = useTranslation(); diff --git a/packages/app/src/components/workspace-modal/WorkspaceCard.tsx b/packages/app/src/components/workspace-modal/WorkspaceCard.tsx index e075bddf0..d90fb9daa 100644 --- a/packages/app/src/components/workspace-modal/WorkspaceCard.tsx +++ b/packages/app/src/components/workspace-modal/WorkspaceCard.tsx @@ -10,7 +10,7 @@ import { WorkspaceUnit } from '@affine/datacenter'; import { useAppState } from '@/providers/app-state-provider'; import { StyleWorkspaceInfo, StyleWorkspaceTitle, StyledCard } from './styles'; import { useTranslation } from '@affine/i18n'; -import { FlexWrapper } from '@/ui/layout'; +import { FlexWrapper } from '@affine/component'; const WorkspaceType = ({ workspaceData }: { workspaceData: WorkspaceUnit }) => { const { user } = useAppState(); diff --git a/packages/app/src/components/workspace-modal/index.tsx b/packages/app/src/components/workspace-modal/index.tsx index 4a6e78e90..2c67459ed 100644 --- a/packages/app/src/components/workspace-modal/index.tsx +++ b/packages/app/src/components/workspace-modal/index.tsx @@ -1,9 +1,9 @@ -import { Modal, ModalWrapper, ModalCloseButton } from '@/ui/modal'; -import { FlexWrapper } from '@/ui/layout'; +import { Modal, ModalWrapper, ModalCloseButton } from '@affine/component'; +import { FlexWrapper } from '@affine/component'; import { useState } from 'react'; import { CreateWorkspaceModal } from '../create-workspace'; -import { Tooltip } from '@/ui/tooltip'; +import { Tooltip } from '@affine/component'; import { AddIcon, HelpCenterIcon } from '@blocksuite/icons'; diff --git a/packages/app/src/components/workspace-modal/styles.ts b/packages/app/src/components/workspace-modal/styles.ts index 7c2cc9a37..d022bc8df 100644 --- a/packages/app/src/components/workspace-modal/styles.ts +++ b/packages/app/src/components/workspace-modal/styles.ts @@ -1,5 +1,10 @@ -import { displayFlex, displayInlineFlex, styled, textEllipsis } from '@/styles'; -import { Button } from '@/ui/button'; +import { + displayFlex, + displayInlineFlex, + styled, + textEllipsis, +} from '@affine/component'; +import { Button } from '@affine/component'; export const StyledSplitLine = styled.div(({ theme }) => { return { diff --git a/packages/app/src/components/workspace-setting/ExportPage.tsx b/packages/app/src/components/workspace-setting/ExportPage.tsx index d2c598880..1a375ee17 100644 --- a/packages/app/src/components/workspace-setting/ExportPage.tsx +++ b/packages/app/src/components/workspace-setting/ExportPage.tsx @@ -1,7 +1,7 @@ import { WorkspaceUnit } from '@affine/datacenter'; import { useTranslation } from '@affine/i18n'; -import { Wrapper } from '@/ui/layout'; -import { Button } from '@/ui/button'; +import { Wrapper } from '@affine/component'; +import { Button } from '@affine/component'; export const ExportPage = ({ workspace }: { workspace: WorkspaceUnit }) => { const { t } = useTranslation(); console.log(workspace); diff --git a/packages/app/src/components/workspace-setting/PublishPage.tsx b/packages/app/src/components/workspace-setting/PublishPage.tsx index c2a1b258a..fefb96742 100644 --- a/packages/app/src/components/workspace-setting/PublishPage.tsx +++ b/packages/app/src/components/workspace-setting/PublishPage.tsx @@ -1,12 +1,12 @@ import { useState } from 'react'; -import { Button } from '@/ui/button'; -import Input from '@/ui/input'; -import { toast } from '@/ui/toast'; +import { Button } from '@affine/component'; +import { Input } from '@affine/component'; +import { toast } from '@affine/component'; import { WorkspaceUnit } from '@affine/datacenter'; import { useWorkspaceHelper } from '@/hooks/use-workspace-helper'; import { useTranslation } from '@affine/i18n'; import { EnableWorkspaceButton } from '../enable-workspace'; -import { Wrapper, Content, FlexWrapper } from '@/ui/layout'; +import { Wrapper, Content, FlexWrapper } from '@affine/component'; export const PublishPage = ({ workspace }: { workspace: WorkspaceUnit }) => { const shareUrl = window.location.host + '/public-workspace/' + workspace.id; const { publishWorkspace } = useWorkspaceHelper(); diff --git a/packages/app/src/components/workspace-setting/SyncPage.tsx b/packages/app/src/components/workspace-setting/SyncPage.tsx index c98b06da4..fa6586c3e 100644 --- a/packages/app/src/components/workspace-setting/SyncPage.tsx +++ b/packages/app/src/components/workspace-setting/SyncPage.tsx @@ -9,7 +9,7 @@ import { useTranslation, Trans } from '@affine/i18n'; import { WorkspaceUnitAvatar } from '@/components/workspace-avatar'; import { EnableWorkspaceButton } from '../enable-workspace'; import { useAppState } from '@/providers/app-state-provider'; -import { FlexWrapper, Content, Wrapper } from '@/ui/layout'; +import { FlexWrapper, Content, Wrapper } from '@affine/component'; // // FIXME: Temporary solution, since the @blocksuite/icons is broken // const ActiveIcon = () => { diff --git a/packages/app/src/components/workspace-setting/general/General.tsx b/packages/app/src/components/workspace-setting/general/General.tsx index d73c3c87d..dbfdce1ff 100644 --- a/packages/app/src/components/workspace-setting/general/General.tsx +++ b/packages/app/src/components/workspace-setting/general/General.tsx @@ -1,9 +1,9 @@ import { StyledInput, StyledProviderInfo, StyledAvatar } from './style'; import { StyledSettingKey, StyledRow } from '../style'; -import { FlexWrapper, Content } from '@/ui/layout'; +import { FlexWrapper, Content } from '@affine/component'; import { useState } from 'react'; -import { Button } from '@/ui/button'; +import { Button } from '@affine/component'; import { useAppState } from '@/providers/app-state-provider'; import { WorkspaceDelete } from './delete'; import { WorkspaceLeave } from './leave'; @@ -42,29 +42,29 @@ export const GeneralPage = ({ workspace }: { workspace: WorkspaceUnit }) => { {t('Workspace Avatar')} - {isOwner ? ( - - <> -
- -
- - -
- ) : ( - - )} + {isOwner ? ( + + <> +
+ +
+ + +
+ ) : ( + + )}
diff --git a/packages/app/src/components/workspace-setting/general/delete/Delete.tsx b/packages/app/src/components/workspace-setting/general/delete/Delete.tsx index af2570f81..0d4231414 100644 --- a/packages/app/src/components/workspace-setting/general/delete/Delete.tsx +++ b/packages/app/src/components/workspace-setting/general/delete/Delete.tsx @@ -1,6 +1,6 @@ import { useRouter } from 'next/router'; -import Modal from '@/ui/modal'; -import Input from '@/ui/input'; +import { Modal } from '@affine/component'; +import { Input } from '@affine/component'; import { StyledModalHeader, StyledTextContent, @@ -10,8 +10,8 @@ import { StyledWorkspaceName, } from './style'; import { useState } from 'react'; -import { ModalCloseButton } from '@/ui/modal'; -import { Button } from '@/ui/button'; +import { ModalCloseButton } from '@affine/component'; +import { Button } from '@affine/component'; import { WorkspaceUnit } from '@affine/datacenter'; import { Trans, useTranslation } from '@affine/i18n'; diff --git a/packages/app/src/components/workspace-setting/general/delete/style.ts b/packages/app/src/components/workspace-setting/general/delete/style.ts index d029d54fe..05396823f 100644 --- a/packages/app/src/components/workspace-setting/general/delete/style.ts +++ b/packages/app/src/components/workspace-setting/general/delete/style.ts @@ -1,4 +1,4 @@ -import { styled } from '@/styles'; +import { styled } from '@affine/component'; export const StyledModalWrapper = styled('div')(({ theme }) => { return { diff --git a/packages/app/src/components/workspace-setting/general/leave/Leave.tsx b/packages/app/src/components/workspace-setting/general/leave/Leave.tsx index 3c91b026b..bd18e21b0 100644 --- a/packages/app/src/components/workspace-setting/general/leave/Leave.tsx +++ b/packages/app/src/components/workspace-setting/general/leave/Leave.tsx @@ -1,12 +1,12 @@ -import Modal from '@/ui/modal'; +import { Modal } from '@affine/component'; import { StyledModalHeader, StyledTextContent, StyledModalWrapper, StyledButtonContent, } from './style'; -import { ModalCloseButton } from '@/ui/modal'; -import { Button } from '@/ui/button'; +import { ModalCloseButton } from '@affine/component'; +import { Button } from '@affine/component'; import { useTranslation } from '@affine/i18n'; import { useWorkspaceHelper } from '@/hooks/use-workspace-helper'; // import { getDataCenter } from '@affine/datacenter'; diff --git a/packages/app/src/components/workspace-setting/general/leave/style.ts b/packages/app/src/components/workspace-setting/general/leave/style.ts index 1d9696af3..bbbf7e1c9 100644 --- a/packages/app/src/components/workspace-setting/general/leave/style.ts +++ b/packages/app/src/components/workspace-setting/general/leave/style.ts @@ -1,4 +1,4 @@ -import { styled } from '@/styles'; +import { styled } from '@affine/component'; export const StyledModalWrapper = styled('div')(({ theme }) => { return { diff --git a/packages/app/src/components/workspace-setting/general/style.ts b/packages/app/src/components/workspace-setting/general/style.ts index 4707843c6..35c44e5f3 100644 --- a/packages/app/src/components/workspace-setting/general/style.ts +++ b/packages/app/src/components/workspace-setting/general/style.ts @@ -1,5 +1,5 @@ -import { styled } from '@/styles'; -import Input from '@/ui/input'; +import { styled } from '@affine/component'; +import { Input } from '@affine/component'; export const StyledInput = styled(Input)(({ theme }) => { return { diff --git a/packages/app/src/components/workspace-setting/member/InviteMemberModal.tsx b/packages/app/src/components/workspace-setting/member/InviteMemberModal.tsx index 15c5d5f58..e7ca8982d 100644 --- a/packages/app/src/components/workspace-setting/member/InviteMemberModal.tsx +++ b/packages/app/src/components/workspace-setting/member/InviteMemberModal.tsx @@ -1,10 +1,10 @@ import { EmailIcon } from '@blocksuite/icons'; -import { styled } from '@/styles'; -import { Modal, ModalWrapper, ModalCloseButton } from '@/ui/modal'; -import { Button } from '@/ui/button'; -import Input from '@/ui/input'; +import { styled } from '@affine/component'; +import { Modal, ModalWrapper, ModalCloseButton } from '@affine/component'; +import { Button } from '@affine/component'; +import { Input } from '@affine/component'; import { useState } from 'react'; -import { MuiAvatar } from '@/ui/mui'; +import { MuiAvatar } from '@affine/component'; import useMembers from '@/hooks/use-members'; import { User } from '@affine/datacenter'; import { useTranslation } from '@affine/i18n'; diff --git a/packages/app/src/components/workspace-setting/member/MembersPage.tsx b/packages/app/src/components/workspace-setting/member/MembersPage.tsx index c2d4c76a6..7a64e14f5 100644 --- a/packages/app/src/components/workspace-setting/member/MembersPage.tsx +++ b/packages/app/src/components/workspace-setting/member/MembersPage.tsx @@ -12,19 +12,19 @@ import { StyledMoreVerticalButton, StyledMemberContainer, } from './style'; -import { Wrapper } from '@/ui/layout'; +import { Wrapper } from '@affine/component'; import { MoreVerticalIcon, EmailIcon, TrashIcon } from '@blocksuite/icons'; import { useState } from 'react'; -import { Button, IconButton } from '@/ui/button'; +import { Button, IconButton } from '@affine/component'; import { InviteMemberModal } from './InviteMemberModal'; -import { Menu, MenuItem } from '@/ui/menu'; -import { Empty } from '@/ui/empty'; +import { Menu, MenuItem } from '@affine/component'; +import { Empty } from '@affine/component'; import { WorkspaceUnit } from '@affine/datacenter'; import { useConfirm } from '@/providers/ConfirmProvider'; -import { toast } from '@/ui/toast'; +import { toast } from '@affine/component'; import useMembers from '@/hooks/use-members'; import Loading from '@/components/loading'; -import { FlexWrapper } from '@/ui/layout'; +import { FlexWrapper } from '@affine/component'; import { useTranslation } from '@affine/i18n'; import { EnableWorkspaceButton } from '@/components/enable-workspace'; diff --git a/packages/app/src/components/workspace-setting/member/style.ts b/packages/app/src/components/workspace-setting/member/style.ts index 3345f591a..b1d350205 100644 --- a/packages/app/src/components/workspace-setting/member/style.ts +++ b/packages/app/src/components/workspace-setting/member/style.ts @@ -1,5 +1,5 @@ -import { styled } from '@/styles'; -import { MuiAvatar } from '@/ui/mui'; +import { styled } from '@affine/component'; +import { MuiAvatar } from '@affine/component'; export const StyledMemberTitleContainer = styled('li')(() => { return { diff --git a/packages/app/src/components/workspace-setting/style.ts b/packages/app/src/components/workspace-setting/style.ts index 12fe79835..1dad9cb83 100644 --- a/packages/app/src/components/workspace-setting/style.ts +++ b/packages/app/src/components/workspace-setting/style.ts @@ -1,5 +1,5 @@ -import { styled } from '@/styles'; -import { FlexWrapper } from '@/ui/layout'; +import { styled } from '@affine/component'; +import { FlexWrapper } from '@affine/component'; export const StyledSettingContainer = styled('div')(() => { return { display: 'flex', diff --git a/packages/app/src/components/workspace-slider-bar/WorkspaceSelector/WorkspaceItem/ListItem.tsx b/packages/app/src/components/workspace-slider-bar/WorkspaceSelector/WorkspaceItem/ListItem.tsx index 120a00395..48c7c7ac4 100644 --- a/packages/app/src/components/workspace-slider-bar/WorkspaceSelector/WorkspaceItem/ListItem.tsx +++ b/packages/app/src/components/workspace-slider-bar/WorkspaceSelector/WorkspaceItem/ListItem.tsx @@ -1,5 +1,5 @@ import type { ReactNode } from 'react'; -import { styled } from '@/styles'; +import { styled } from '@affine/component'; import { WorkspaceItemWrapper, WorkspaceItemContent } from './styles'; interface ListItemProps { diff --git a/packages/app/src/components/workspace-slider-bar/WorkspaceSelector/WorkspaceItem/LoginItem.tsx b/packages/app/src/components/workspace-slider-bar/WorkspaceSelector/WorkspaceItem/LoginItem.tsx index d7771f1ac..7ea99ecce 100644 --- a/packages/app/src/components/workspace-slider-bar/WorkspaceSelector/WorkspaceItem/LoginItem.tsx +++ b/packages/app/src/components/workspace-slider-bar/WorkspaceSelector/WorkspaceItem/LoginItem.tsx @@ -1,5 +1,5 @@ import { useModal } from '@/providers/GlobalModalProvider'; -import { styled } from '@/styles'; +import { styled } from '@affine/component'; import { AffineIcon } from '../../icons/Icons'; import { WorkspaceItemAvatar, diff --git a/packages/app/src/components/workspace-slider-bar/WorkspaceSelector/WorkspaceItem/styles.ts b/packages/app/src/components/workspace-slider-bar/WorkspaceSelector/WorkspaceItem/styles.ts index d56661de3..f1eb324a6 100644 --- a/packages/app/src/components/workspace-slider-bar/WorkspaceSelector/WorkspaceItem/styles.ts +++ b/packages/app/src/components/workspace-slider-bar/WorkspaceSelector/WorkspaceItem/styles.ts @@ -1,5 +1,5 @@ -import { MuiAvatar } from '@/ui/mui'; -import { styled } from '@/styles'; +import { MuiAvatar } from '@affine/component'; +import { styled } from '@affine/component'; export const WorkspaceItemWrapper = styled('div')(({ theme }) => ({ display: 'flex', diff --git a/packages/app/src/components/workspace-slider-bar/WorkspaceSelector/styles.ts b/packages/app/src/components/workspace-slider-bar/WorkspaceSelector/styles.ts index e700d8cd8..600bcaf56 100644 --- a/packages/app/src/components/workspace-slider-bar/WorkspaceSelector/styles.ts +++ b/packages/app/src/components/workspace-slider-bar/WorkspaceSelector/styles.ts @@ -1,6 +1,6 @@ -import { MuiAvatar } from '@/ui/mui'; -import { styled } from '@/styles'; -import { StyledPopperContainer } from '@/ui/shared/Container'; +import { MuiAvatar } from '@affine/component'; +import { styled } from '@affine/component'; +import { StyledPopperContainer } from '@affine/component'; export const SelectorWrapper = styled('div')({ width: '100%', diff --git a/packages/app/src/components/workspace-slider-bar/index.tsx b/packages/app/src/components/workspace-slider-bar/index.tsx index 4a56307d1..3df649a8a 100644 --- a/packages/app/src/components/workspace-slider-bar/index.tsx +++ b/packages/app/src/components/workspace-slider-bar/index.tsx @@ -21,11 +21,11 @@ import { SettingsIcon, } from '@blocksuite/icons'; import Link from 'next/link'; -import { MuiCollapse } from '@/ui/mui'; -import { Tooltip } from '@/ui/tooltip'; +import { MuiCollapse } from '@affine/component'; +import { Tooltip } from '@affine/component'; import { useModal } from '@/providers/GlobalModalProvider'; import { useAppState } from '@/providers/app-state-provider'; -import { IconButton } from '@/ui/button'; +import { IconButton } from '@affine/component'; import useLocalStorage from '@/hooks/use-local-storage'; import { usePageHelper } from '@/hooks/use-page-helper'; import { useTranslation } from '@affine/i18n'; diff --git a/packages/app/src/components/workspace-slider-bar/style.ts b/packages/app/src/components/workspace-slider-bar/style.ts index d285213ff..11baa74c4 100644 --- a/packages/app/src/components/workspace-slider-bar/style.ts +++ b/packages/app/src/components/workspace-slider-bar/style.ts @@ -1,4 +1,4 @@ -import { displayFlex, styled, textEllipsis } from '@/styles'; +import { displayFlex, styled, textEllipsis } from '@affine/component'; import Link from 'next/link'; export const StyledSliderBar = styled.div<{ show: boolean }>( diff --git a/packages/app/src/pages/affine.tsx b/packages/app/src/pages/affine.tsx index 8cd313937..c596ec061 100644 --- a/packages/app/src/pages/affine.tsx +++ b/packages/app/src/pages/affine.tsx @@ -1,10 +1,10 @@ -import { displayFlex, styled } from '@/styles'; +import { displayFlex, styled } from '@affine/component'; import Loading from '@/components/loading'; -import Modal from '@/ui/modal'; +import { Modal } from '@affine/component'; import { useState } from 'react'; -import { Button } from '@/ui/button'; +import { Button } from '@affine/component'; import { FavouritedIcon } from '@blocksuite/icons'; -import { toast } from '@/ui/toast'; +import { toast } from '@affine/component'; export const StyledHeader = styled('div')({ height: '60px', width: '100vw', diff --git a/packages/app/src/pages/invite/[invite_code].tsx b/packages/app/src/pages/invite/[invite_code].tsx index 3af2a8c18..155f85f71 100644 --- a/packages/app/src/pages/invite/[invite_code].tsx +++ b/packages/app/src/pages/invite/[invite_code].tsx @@ -1,6 +1,6 @@ import { useWorkspaceHelper } from '@/hooks/use-workspace-helper'; -import { styled } from '@/styles'; -import { Empty } from '@/ui/empty'; +import { styled } from '@affine/component'; +import { Empty } from '@affine/component'; import { useRouter } from 'next/router'; import { useEffect, useState } from 'react'; import { PageLoading } from '@/components/loading'; diff --git a/packages/app/src/pages/playground/templates.tsx b/packages/app/src/pages/playground/templates.tsx index e30fdbee6..318f597e9 100644 --- a/packages/app/src/pages/playground/templates.tsx +++ b/packages/app/src/pages/playground/templates.tsx @@ -5,7 +5,7 @@ import exampleMarkdown2 from '@/templates/AFFiNE-Docs.md'; import { usePageHelper } from '@/hooks/use-page-helper'; import { useAppState } from '@/providers/app-state-provider'; -import { Button } from '@/ui/button'; +import { Button } from '@affine/component'; interface Template { name: string; source: string; @@ -21,7 +21,7 @@ const TemplateItemContainer = styled('div')(() => { }, }; }); -import { styled } from '@/styles'; +import { styled } from '@affine/component'; const TEMPLATES: Template[] = [ { name: 'Welcome-to-the-AFFiNE-Alpha.md', diff --git a/packages/app/src/pages/public-workspace/[workspaceId]/[pageId].tsx b/packages/app/src/pages/public-workspace/[workspaceId]/[pageId].tsx index 859ef9b43..4ccda04b7 100644 --- a/packages/app/src/pages/public-workspace/[workspaceId]/[pageId].tsx +++ b/packages/app/src/pages/public-workspace/[workspaceId]/[pageId].tsx @@ -1,13 +1,13 @@ import { ReactElement, useEffect, useState } from 'react'; import { useAppState } from '@/providers/app-state-provider'; import type { NextPageWithLayout } from '../..//_app'; -import { displayFlex, styled } from '@/styles'; +import { displayFlex, styled } from '@affine/component'; import dynamic from 'next/dynamic'; import { useRouter } from 'next/router'; import { Page as PageStore, Workspace } from '@blocksuite/store'; import { PageLoading } from '@/components/loading'; -import { Breadcrumbs } from '@/ui/breadcrumbs'; -import { IconButton } from '@/ui/button'; +import { Breadcrumbs } from '@affine/component'; +import { IconButton } from '@affine/component'; import NextLink from 'next/link'; import { PaperIcon, SearchIcon } from '@blocksuite/icons'; import { WorkspaceUnitAvatar } from '@/components/workspace-avatar'; diff --git a/packages/app/src/pages/public-workspace/[workspaceId]/index.tsx b/packages/app/src/pages/public-workspace/[workspaceId]/index.tsx index 3d4a8a4dc..37aaa7317 100644 --- a/packages/app/src/pages/public-workspace/[workspaceId]/index.tsx +++ b/packages/app/src/pages/public-workspace/[workspaceId]/index.tsx @@ -8,7 +8,7 @@ import { StyledBreadcrumbs, SearchButton, } from './[pageId]'; -import { Breadcrumbs } from '@/ui/breadcrumbs'; +import { Breadcrumbs } from '@affine/component'; import { WorkspaceUnitAvatar } from '@/components/workspace-avatar'; import { SearchIcon } from '@blocksuite/icons'; import { useModal } from '@/providers/GlobalModalProvider'; diff --git a/packages/app/src/pages/workspace/[workspaceId]/playground.tsx b/packages/app/src/pages/workspace/[workspaceId]/playground.tsx index 3be75a7ae..28302d6db 100644 --- a/packages/app/src/pages/workspace/[workspaceId]/playground.tsx +++ b/packages/app/src/pages/workspace/[workspaceId]/playground.tsx @@ -1,8 +1,8 @@ -import { styled } from '@/styles'; +import { styled } from '@affine/component'; import { ReactElement, ReactNode } from 'react'; import WorkspaceLayout from '@/components/workspace-layout'; -import { Button } from '@/ui/button'; +import { Button } from '@affine/component'; export const FeatureCardDiv = styled('section')({ width: '800px', diff --git a/packages/app/src/providers/ConfirmProvider.tsx b/packages/app/src/providers/ConfirmProvider.tsx index cc349f3c6..933f85c7d 100644 --- a/packages/app/src/providers/ConfirmProvider.tsx +++ b/packages/app/src/providers/ConfirmProvider.tsx @@ -1,6 +1,6 @@ import { createContext, useContext, useState, ReactNode } from 'react'; import type { PropsWithChildren } from 'react'; -import { Confirm, ConfirmProps } from '@/ui/confirm'; +import { Confirm, ConfirmProps } from '@affine/component'; type ConfirmContextValue = { confirm: (props: ConfirmProps) => Promise; diff --git a/packages/app/src/providers/ThemeProvider.tsx b/packages/app/src/providers/ThemeProvider.tsx index 07616f28e..2001b7a09 100644 --- a/packages/app/src/providers/ThemeProvider.tsx +++ b/packages/app/src/providers/ThemeProvider.tsx @@ -1,9 +1,5 @@ import { createContext, useContext, useEffect, useState } from 'react'; -import { - ThemeProvider as EmotionThemeProvider, - Global, - css, -} from '@emotion/react'; +import { Global, css } from '@emotion/react'; import { ThemeProvider as MuiThemeProvider, createTheme as MuiCreateTheme, @@ -14,13 +10,14 @@ import { ThemeMode, ThemeProviderProps, ThemeProviderValue, -} from '@/styles/types'; +} from '@affine/component'; import { getLightTheme, getDarkTheme, globalThemeVariables, -} from '@/styles/theme'; -import { SystemThemeHelper, localStorageThemeHelper } from '@/styles/utils'; + ThemeProvider as ComponentThemeProvider, +} from '@affine/component'; +import { SystemThemeHelper, localStorageThemeHelper } from '@affine/component'; import useCurrentPageMeta from '@/hooks/use-current-page-meta'; export const ThemeContext = createContext({ @@ -106,9 +103,9 @@ export const ThemeProvider = ({ } `} /> - + {children} - + ); diff --git a/packages/app/src/styles/styled.ts b/packages/app/src/styles/styled.ts deleted file mode 100644 index 7410fa135..000000000 --- a/packages/app/src/styles/styled.ts +++ /dev/null @@ -1,3 +0,0 @@ -import emotionStyled from '@emotion/styled'; -export { css, keyframes } from '@emotion/react'; -export const styled = emotionStyled; diff --git a/packages/app/tsconfig.json b/packages/app/tsconfig.json index 592edefeb..1dc257d3b 100644 --- a/packages/app/tsconfig.json +++ b/packages/app/tsconfig.json @@ -1,4 +1,5 @@ { + "extends": "../../tsconfig.json", "compilerOptions": { "target": "ES2020", "lib": ["dom", "dom.iterable", "esnext"], @@ -17,7 +18,8 @@ "experimentalDecorators": true, "baseUrl": ".", "paths": { - "@/*": ["src/*"] + "@/*": ["src/*"], + "@affine/component": ["../component/src/index"] } }, "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], diff --git a/packages/component/.storybook/main.js b/packages/component/.storybook/main.js new file mode 100644 index 000000000..9458beb43 --- /dev/null +++ b/packages/component/.storybook/main.js @@ -0,0 +1,44 @@ +const path = require('node:path'); + +module.exports = { + stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'], + staticDirs: ['../../app/public'], + addons: ['@storybook/addon-links', '@storybook/addon-essentials'], + core: { + builder: '@storybook/builder-webpack5', + }, + webpackFinal: config => { + const transpile = config.module.rules.find(x => + x.test.toString().includes('tsx') + ).use; + transpile.push({ + loader: require.resolve('swc-loader'), + options: { + parseMap: true, + jsc: { + parser: { + syntax: 'typescript', + dynamicImport: true, + tsx: true, + }, + target: 'es2022', + transform: { + react: { + runtime: 'automatic', + }, + }, + }, + }, + }); + + config.resolve.alias = { + ...config.resolve.alias, + '@': path.resolve(__dirname, '..', 'src'), + '@affine/i18n': path.resolve(__dirname, '..', '..', 'i18n', 'src'), + }; + return config; + }, + reactOptions: { + fastRefresh: true, + }, +}; diff --git a/packages/component/.storybook/preview.js b/packages/component/.storybook/preview.js new file mode 100644 index 000000000..d3914580a --- /dev/null +++ b/packages/component/.storybook/preview.js @@ -0,0 +1,9 @@ +export const parameters = { + actions: { argTypesRegex: '^on[A-Z].*' }, + controls: { + matchers: { + color: /(background|color)$/i, + date: /Date$/, + }, + }, +}; diff --git a/packages/component/package.json b/packages/component/package.json new file mode 100644 index 000000000..4cf948d9c --- /dev/null +++ b/packages/component/package.json @@ -0,0 +1,36 @@ +{ + "name": "@affine/component", + "private": true, + "version": "0.3.1", + "scripts": { + "storybook": "start-storybook -p 6006", + "build-storybook": "build-storybook" + }, + "dependencies": { + "@affine/i18n": "workspace:*", + "@blocksuite/editor": "0.4.0-alpha.2", + "@blocksuite/icons": "^2.0.2", + "@emotion/react": "^11.10.5", + "@emotion/styled": "^11.10.5", + "@mui/base": "=5.0.0-alpha.101", + "@mui/icons-material": "=5.10.9", + "@mui/material": "=5.8.6", + "lit": "^2.6.1", + "react": "^18.2.0", + "react-dom": "^18.2.0" + }, + "devDependencies": { + "@storybook/addon-actions": "^6.5.16", + "@storybook/addon-essentials": "^6.5.16", + "@storybook/addon-links": "^6.5.16", + "@storybook/builder-webpack5": "^6.5.16", + "@storybook/manager-webpack5": "^6.5.16", + "@storybook/react": "^6.5.16", + "@types/react": "^18.0.27", + "@types/react-dom": "18.0.10", + "swc": "^1.0.11", + "swc-loader": "^0.2.3", + "typescript": "^4.9.5", + "webpack": "^5.75.0" + } +} diff --git a/packages/component/src/index.ts b/packages/component/src/index.ts new file mode 100644 index 000000000..635963816 --- /dev/null +++ b/packages/component/src/index.ts @@ -0,0 +1,16 @@ +export * from './ui/breadcrumbs'; +export * from './ui/button'; +export * from './ui/confirm'; +export * from './ui/divider'; +export * from './ui/empty'; +export * from './ui/input'; +export * from './ui/layout'; +export * from './ui/menu'; +export * from './ui/modal'; +export * from './ui/popper'; +export * from './ui/shared/Container'; +export * from './ui/table'; +export * from './ui/toast'; +export * from './ui/tooltip'; +export * from './ui/mui'; +export * from './styles'; diff --git a/packages/component/src/stories/Breadcrumbs.stories.tsx b/packages/component/src/stories/Breadcrumbs.stories.tsx new file mode 100644 index 000000000..38334b179 --- /dev/null +++ b/packages/component/src/stories/Breadcrumbs.stories.tsx @@ -0,0 +1,19 @@ +import React, { useMemo } from 'react'; +import { Meta, Story } from '@storybook/react'; +import { Breadcrumbs, getLightTheme, ThemeProvider } from '..'; + +export default { + title: 'AFFiNE/Breadcrumbs', + component: Breadcrumbs, +} as Meta; + +const Template: Story = args => ( + getLightTheme('page'), [])}> + + +); + +export const Primary = Template.bind({}); +Primary.args = { + children: [1, 2, 3], +}; diff --git a/packages/component/src/stories/Button.stories.tsx b/packages/component/src/stories/Button.stories.tsx new file mode 100644 index 000000000..9fc32156e --- /dev/null +++ b/packages/component/src/stories/Button.stories.tsx @@ -0,0 +1,20 @@ +import React, { useMemo } from 'react'; +import { Meta, Story } from '@storybook/react'; +import { Button, getLightTheme, ThemeProvider } from '..'; + +export default { + title: 'AFFiNE/Button', + component: Button, +} as Meta; + +const Template: Story = args => ( + getLightTheme('page'), [])}> + - - { - setShow(false); - }} - > -
hi
-
- - - - - - - - - - - - ); -}; - -export default Affine; diff --git a/packages/app/src/pages/affine/[workspace_id].tsx b/packages/app/src/pages/affine/[workspace_id].tsx deleted file mode 100644 index 875928acf..000000000 --- a/packages/app/src/pages/affine/[workspace_id].tsx +++ /dev/null @@ -1,20 +0,0 @@ -// for dynamic route get workspace id maybe path will change -import { useRouter } from 'next/router'; - -const Post = () => { - const router = useRouter(); - const { workspace_id } = router.query; - - return ( -

- workspace_id: {workspace_id}, -

- ); -}; - -export default Post; diff --git a/packages/app/src/pages/playground/templates.tsx b/packages/app/src/pages/playground/templates.tsx deleted file mode 100644 index 318f597e9..000000000 --- a/packages/app/src/pages/playground/templates.tsx +++ /dev/null @@ -1,123 +0,0 @@ -import { ReactElement } from 'react'; -import WorkspaceLayout from '@/components/workspace-layout'; -import exampleMarkdown1 from '@/templates/Welcome-to-the-AFFiNE-Alpha.md'; -import exampleMarkdown2 from '@/templates/AFFiNE-Docs.md'; - -import { usePageHelper } from '@/hooks/use-page-helper'; -import { useAppState } from '@/providers/app-state-provider'; -import { Button } from '@affine/component'; -interface Template { - name: string; - source: string; -} -const TemplateItemContainer = styled('div')(() => { - return { - color: 'blue', - padding: '10px 15px', - borderBottom: '1px solid #eee', - cursor: 'pointer', - '&:hover': { - background: '#eee', - }, - }; -}); -import { styled } from '@affine/component'; -const TEMPLATES: Template[] = [ - { - name: 'Welcome-to-the-AFFiNE-Alpha.md', - source: exampleMarkdown1, - }, - { - name: 'AFFiNE-Docs.md', - source: exampleMarkdown2, - }, -]; - -const All = () => { - const { openPage, createPage } = usePageHelper(); - const { currentWorkspace } = useAppState(); - const _applyTemplate = function (pageId: string, template: Template) { - const page = currentWorkspace?.blocksuiteWorkspace?.getPage(pageId); - - const title = template.name; - if (page) { - currentWorkspace?.blocksuiteWorkspace?.setPageMeta(page.id, { title }); - if (page && page.root === null) { - setTimeout(async () => { - const editor = document.querySelector('editor-container'); - if (editor) { - page.addBlock({ flavour: 'affine:surface' }, null); - const frameId = page.addBlock({ flavour: 'affine:frame' }, pageId); - // TODO blocksuite should offer a method to import markdown from store - await editor.clipboard.importMarkdown( - template.source, - `${frameId}` - ); - page.resetHistory(); - editor.requestUpdate(); - } - }, 300); - } - } - }; - const _handleAppleTemplate = async function (template: Template) { - const pageId = await createPage(); - if (pageId) { - openPage(pageId); - _applyTemplate(pageId, template); - } - }; - const _handleAppleTemplateFromFilePicker = async () => { - if (!window.showOpenFilePicker) { - return; - } - const arrFileHandle = await window.showOpenFilePicker({ - types: [ - { - accept: { - 'image/*': ['.md'], - }, - }, - ], - multiple: false, - }); - for (const fileHandle of arrFileHandle) { - const file = await fileHandle.getFile(); - const text = await file.text(); - _handleAppleTemplate({ - name: file.name, - source: text, - }); - } - }; - - return ( -
-
-

Templates

- {TEMPLATES.map(template => { - return ( - _handleAppleTemplate(template)} - > - {template.name} - - - ); - })} -
-

Import Markdown

- -
-
- ); -}; - -All.getLayout = function getLayout(page: ReactElement) { - return {page}; -}; - -export default All; diff --git a/packages/app/src/pages/testing-only.tsx b/packages/app/src/pages/testing-only.tsx deleted file mode 100644 index a050496bb..000000000 --- a/packages/app/src/pages/testing-only.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { useEffect } from 'react'; -import { getDataCenter } from '@affine/datacenter'; -/** - * testing only when development - */ - -const Page = () => { - useEffect(() => { - getDataCenter().then(dc => { - // @ts-expect-error global variable - window.dc = dc; - }); - }, []); - - return
Testing only
; -}; - -export default Page; From 2bde086e2831b7a26033863c3d0a68c8a1184f18 Mon Sep 17 00:00:00 2001 From: JimmFly Date: Thu, 9 Feb 2023 13:54:55 +0800 Subject: [PATCH 09/24] chore: update font size of quick search (#919) --- packages/app/src/components/quick-search/style.ts | 14 +++++++------- packages/component/src/styles/helper.ts | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/app/src/components/quick-search/style.ts b/packages/app/src/components/quick-search/style.ts index 024f5e249..86870c5b3 100644 --- a/packages/app/src/components/quick-search/style.ts +++ b/packages/app/src/components/quick-search/style.ts @@ -13,7 +13,7 @@ export const StyledContent = styled('div')(({ theme }) => { letterSpacing: '0.06em', '[cmdk-group-heading]': { margin: '5px 16px', - fontSize: theme.font.sm, + fontSize: theme.font.base, fontWeight: '500', }, '[aria-selected="true"]': { @@ -28,7 +28,7 @@ export const StyledJumpTo = styled('div')(({ theme }) => { ...displayFlex('center', 'start'), flexDirection: 'column', padding: '10px 10px 10px 0', - fontSize: theme.font.sm, + fontSize: theme.font.base, strong: { fontWeight: '500', marginBottom: '10px', @@ -41,7 +41,7 @@ export const StyledNotFound = styled('div')(({ theme }) => { ...displayFlex('center', 'center'), flexDirection: 'column', padding: '5px 16px', - fontSize: theme.font.sm, + fontSize: theme.font.base, span: { width: '100%', fontWeight: '500', @@ -75,7 +75,7 @@ export const StyledInputContent = styled('div')(({ theme }) => { export const StyledShortcut = styled('div')(({ theme }) => { return { color: theme.colors.placeHolderColor, - fontSize: theme.font.sm, + fontSize: theme.font.base, whiteSpace: 'nowrap', }; }); @@ -109,7 +109,7 @@ export const StyledModalDivider = styled('div')(({ theme }) => { export const StyledModalFooter = styled('div')(({ theme }) => { return { - fontSize: theme.font.sm, + fontSize: theme.font.base, lineHeight: '22px', marginBottom: '8px', textAlign: 'center', @@ -127,7 +127,7 @@ export const StyledModalFooterContent = styled.button(({ theme }) => { return { width: '612px', height: '32px', - fontSize: theme.font.sm, + fontSize: theme.font.base, lineHeight: '22px', textAlign: 'center', ...displayFlex('center', 'center'), @@ -144,7 +144,7 @@ export const StyledListItem = styled.button(({ theme }) => { return { width: '612px', height: '32px', - fontSize: theme.font.sm, + fontSize: theme.font.base, color: 'inherit', paddingLeft: '12px', borderRadius: '5px', diff --git a/packages/component/src/styles/helper.ts b/packages/component/src/styles/helper.ts index 20e397f74..3e4ad4a64 100644 --- a/packages/component/src/styles/helper.ts +++ b/packages/component/src/styles/helper.ts @@ -60,8 +60,8 @@ export const absoluteCenter = ({ position: 'absolute', left: left ? left : horizontal ? '50%' : 'auto', top: top ? top : vertical ? '50%' : 'auto', - right: right ? right : horizontal ? 'auto' : 'auto', - bottom: bottom ? bottom : vertical ? 'auto' : 'auto', + right: right ? right : 'auto', + bottom: bottom ? bottom : 'auto', transform: `translate(${horizontal ? '-50%' : '0'}, ${ vertical ? '-50%' : '0' })`, @@ -92,8 +92,8 @@ export const fixedCenter = ({ position: 'fixed', left: left ? left : horizontal ? '50%' : 'auto', top: top ? top : vertical ? '50%' : 'auto', - right: right ? right : horizontal ? 'auto' : 'auto', - bottom: bottom ? bottom : vertical ? 'auto' : 'auto', + right: right ? right : 'auto', + bottom: bottom ? bottom : 'auto', transform: `translate(${horizontal ? '-50%' : '0'}, ${ vertical ? '-50%' : '0' })`, From 6327b5864d055a791ddd17b2010f2ab6ba3e1a3f Mon Sep 17 00:00:00 2001 From: DiamondThree Date: Thu, 9 Feb 2023 14:59:02 +0800 Subject: [PATCH 10/24] fix: localworkspace will request blob (#925) --- packages/data-center/src/provider/local/utils.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/data-center/src/provider/local/utils.ts b/packages/data-center/src/provider/local/utils.ts index bd5654c51..378801410 100644 --- a/packages/data-center/src/provider/local/utils.ts +++ b/packages/data-center/src/provider/local/utils.ts @@ -7,7 +7,9 @@ import { setDefaultAvatar } from '../utils.js'; export const loadWorkspaceUnit = async (params: WorkspaceUnitCtorParams) => { const workspaceUnit = new WorkspaceUnit(params); - const blocksuiteWorkspace = createBlocksuiteWorkspace(workspaceUnit.id); + const blocksuiteWorkspace = createBlocksuiteWorkspace(workspaceUnit.id, { + blobOptionsGetter: (k: string) => undefined, + }); await applyLocalUpdates(blocksuiteWorkspace); @@ -19,7 +21,9 @@ export const loadWorkspaceUnit = async (params: WorkspaceUnitCtorParams) => { export const createWorkspaceUnit = async (params: WorkspaceUnitCtorParams) => { const workspaceUnit = new WorkspaceUnit(params); - const blocksuiteWorkspace = createBlocksuiteWorkspace(workspaceUnit.id); + const blocksuiteWorkspace = createBlocksuiteWorkspace(workspaceUnit.id, { + blobOptionsGetter: (k: string) => undefined, + }); blocksuiteWorkspace.meta.setName(workspaceUnit.name); if (!workspaceUnit.avatar) { await setDefaultAvatar(blocksuiteWorkspace); From f47d1c2f7ba39ed68399d908c2b06bb466f268a6 Mon Sep 17 00:00:00 2001 From: DiamondThree Date: Thu, 9 Feb 2023 14:59:18 +0800 Subject: [PATCH 11/24] fix: local will request api/token (#924) --- packages/data-center/src/provider/affine/affine.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/data-center/src/provider/affine/affine.ts b/packages/data-center/src/provider/affine/affine.ts index a4a25e4ee..ee596675c 100644 --- a/packages/data-center/src/provider/affine/affine.ts +++ b/packages/data-center/src/provider/affine/affine.ts @@ -64,6 +64,7 @@ export class AffineProvider extends BaseProvider { if (this._apis.token.isExpired) { try { const refreshToken = storage.getItem('token'); + if (!refreshToken) return; await this._apis.token.refreshToken(refreshToken); if (this._apis.token.refresh) { From eb47794e984a76e60ba72ed47cbfd268085c9274 Mon Sep 17 00:00:00 2001 From: DarkSky Date: Thu, 9 Feb 2023 15:24:25 +0800 Subject: [PATCH 12/24] chore: renew dev server --- packages/app/next.config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/app/next.config.js b/packages/app/next.config.js index 14fa2711d..964b6e65f 100644 --- a/packages/app/next.config.js +++ b/packages/app/next.config.js @@ -11,8 +11,8 @@ const EDITOR_VERSION = enableDebugLocal const profileTarget = { ac: '100.85.73.88:12001', - dev: '100.77.180.48:11001', - test: '100.77.180.48:11001', + dev: '100.84.105.99:11001', + test: '100.84.105.99:11001', stage: '', pro: 'http://pathfinder.affine.pro', local: '127.0.0.1:3000', From 233793cecb2eb7764e984b8c14330ff5d9cfd530 Mon Sep 17 00:00:00 2001 From: Chi Zhang Date: Thu, 9 Feb 2023 15:34:43 +0800 Subject: [PATCH 13/24] Create BUILDING.md --- docs/BUILDING.md | 56 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 docs/BUILDING.md diff --git a/docs/BUILDING.md b/docs/BUILDING.md new file mode 100644 index 000000000..123aac7c5 --- /dev/null +++ b/docs/BUILDING.md @@ -0,0 +1,56 @@ +# Building BlockSuite + +## Table of Contents + +- [Prerequisites](#prerequisites) +- [Setup Environment](#setup-environment) +- [Play with Playground](#play-with-playground) +- [Testing](#testing) + +## Prerequisites + +We suggest develop our product under node.js LTS(Long-term support) version + +### Option 1: Manually install node.js + +install [Node LTS version](https://nodejs.org/en/download) + +> Up to now, the major node.js version is 18.x + +### Option 2: Use node version manager + +install [nvm](https://github.com/nvm-sh/nvm) + +```sh +nvm install --lts +nvm use --lts +``` + +## Setup Environment + +```sh +# install dependencies +pnpm install +``` + +## Play with Playground + +```sh +pnpm dev +``` + +The playground page should work at [http://localhost:8080/](http://localhost:8080/) + + +## Testing + +Adding test cases is strongly encouraged when you contribute new features and bug fixes. + +We use [Playwright](https://playwright.dev/) for E2E test, and [vitest](https://vitest.dev/) for unit test. + +To test locally, please make sure browser binaries are already installed via `npx playwright install`. Then there are multi commands to choose from: + +```sh +# run tests in headless mode in another terminal window +pnpm test +``` From 1777b4f91e383dd5d2ac2c143946a11075b32349 Mon Sep 17 00:00:00 2001 From: Chi Zhang Date: Thu, 9 Feb 2023 15:34:54 +0800 Subject: [PATCH 14/24] Update BUILDING.md --- docs/BUILDING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/BUILDING.md b/docs/BUILDING.md index 123aac7c5..6064918d1 100644 --- a/docs/BUILDING.md +++ b/docs/BUILDING.md @@ -1,4 +1,4 @@ -# Building BlockSuite +# Building AFFiNE ## Table of Contents From 044eb8976a58dc5cb8739015b5615a76d9029721 Mon Sep 17 00:00:00 2001 From: Chi Zhang Date: Thu, 9 Feb 2023 15:37:07 +0800 Subject: [PATCH 15/24] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index dc750f48d..25fd95dd8 100644 --- a/README.md +++ b/README.md @@ -215,6 +215,10 @@ For feature request please see https://community.affine.pro/c/feature-requests/ [These people](https://twitter.com/AffineOfficial/followers) seem to like it. +## Building + +See [./docs/BUILDING.md](BUILDING.md) for instructions on how to build BlockSuite from source code. + ## License See [LICENSE](/LICENSE) for details. From b9544e102201df5864afd3906e1170a243035eb1 Mon Sep 17 00:00:00 2001 From: Chi Zhang Date: Thu, 9 Feb 2023 15:37:22 +0800 Subject: [PATCH 16/24] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 25fd95dd8..7cad3c35b 100644 --- a/README.md +++ b/README.md @@ -217,7 +217,7 @@ For feature request please see https://community.affine.pro/c/feature-requests/ ## Building -See [./docs/BUILDING.md](BUILDING.md) for instructions on how to build BlockSuite from source code. +See [BUILDING.md](./docs/BUILDING.md) for instructions on how to build BlockSuite from source code. ## License From 2fd4dc5201ab301777b9e29bf473feb5f421ae3a Mon Sep 17 00:00:00 2001 From: Chi Zhang Date: Thu, 9 Feb 2023 15:39:07 +0800 Subject: [PATCH 17/24] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7cad3c35b..18ea94c95 100644 --- a/README.md +++ b/README.md @@ -217,7 +217,7 @@ For feature request please see https://community.affine.pro/c/feature-requests/ ## Building -See [BUILDING.md](./docs/BUILDING.md) for instructions on how to build BlockSuite from source code. +See [BUILDING.md](./docs/BUILDING.md) for instructions on how to build AFFiNE from source code. ## License From 718322ec65e92caba2c710dd010f2bc13119a981 Mon Sep 17 00:00:00 2001 From: JimmFly Date: Thu, 9 Feb 2023 15:46:59 +0800 Subject: [PATCH 18/24] chore: replace all "favourite" with "favorite" (#927) --- .../header-right-items/EditorOptionMenu.tsx | 4 ++-- .../app/src/components/page-list/Empty.tsx | 2 +- .../components/page-list/OperationCell.tsx | 4 ++-- .../app/src/components/page-list/index.tsx | 6 +++--- .../app/src/components/quick-search/config.ts | 2 +- .../components/workspace-slider-bar/index.tsx | 2 +- .../workspace/[workspaceId]/favorite.tsx | 4 ++-- .../Welcome-to-AFFiNE-Abbey-Alpha-Wood.md | 4 ++-- packages/i18n/src/resources/en.json | 20 +++++++++---------- tests/local-first-delete-page.spec.ts | 2 +- tests/local-first-export-page.spec.ts | 4 ++-- tests/local-first-favorite-page.spec.ts | 8 ++++---- tests/local-first-favorites-items.spec.ts | 2 +- 13 files changed, 32 insertions(+), 32 deletions(-) diff --git a/packages/app/src/components/header/header-right-items/EditorOptionMenu.tsx b/packages/app/src/components/header/header-right-items/EditorOptionMenu.tsx index 879e6a411..dc64ae05c 100644 --- a/packages/app/src/components/header/header-right-items/EditorOptionMenu.tsx +++ b/packages/app/src/components/header/header-right-items/EditorOptionMenu.tsx @@ -37,12 +37,12 @@ const PopoverContent = () => { onClick={() => { toggleFavoritePage(id); toast( - favorite ? t('Removed from Favourites') : t('Added to Favourites') + favorite ? t('Removed from Favorites') : t('Added to Favorites') ); }} icon={favorite ? : } > - {favorite ? t('Remove from favourites') : t('Add to favourites')} + {favorite ? t('Remove from favorites') : t('Add to favorites')} : } diff --git a/packages/app/src/components/page-list/Empty.tsx b/packages/app/src/components/page-list/Empty.tsx index 236968bd0..5252e2bbc 100644 --- a/packages/app/src/components/page-list/Empty.tsx +++ b/packages/app/src/components/page-list/Empty.tsx @@ -12,7 +12,7 @@ export const PageListEmpty = (props: { listType?: string }) => { sx={{ marginTop: '100px', marginBottom: '30px' }} /> {listType === 'all' &&

{t('emptyAllPages')}

} - {listType === 'favorite' &&

{t('emptyFavourite')}

} + {listType === 'favorite' &&

{t('emptyFavorite')}

} {listType === 'trash' &&

{t('emptyTrash')}

} ); diff --git a/packages/app/src/components/page-list/OperationCell.tsx b/packages/app/src/components/page-list/OperationCell.tsx index 2bbcbeea7..b6435ece7 100644 --- a/packages/app/src/components/page-list/OperationCell.tsx +++ b/packages/app/src/components/page-list/OperationCell.tsx @@ -27,12 +27,12 @@ export const OperationCell = ({ pageMeta }: { pageMeta: PageMeta }) => { onClick={() => { toggleFavoritePage(id); toast( - favorite ? t('Removed from Favourites') : t('Added to Favourites') + favorite ? t('Removed from Favorites') : t('Added to Favorites') ); }} icon={favorite ? : } > - {favorite ? t('Remove from favourites') : t('Add to favourites')} + {favorite ? t('Remove from favorites') : t('Add to favorites')}
{ diff --git a/packages/app/src/components/page-list/index.tsx b/packages/app/src/components/page-list/index.tsx index 714d6ca11..7cbcf80c9 100644 --- a/packages/app/src/components/page-list/index.tsx +++ b/packages/app/src/components/page-list/index.tsx @@ -41,7 +41,7 @@ const FavoriteTag = ({ const { t } = useTranslation(); return ( {favorite ? ( - + ) : ( )} diff --git a/packages/app/src/components/quick-search/config.ts b/packages/app/src/components/quick-search/config.ts index 9aa284558..a171ea32e 100644 --- a/packages/app/src/components/quick-search/config.ts +++ b/packages/app/src/components/quick-search/config.ts @@ -22,7 +22,7 @@ export const useSwitchToConfig = ( icon: AllPagesIcon, }, { - title: t('Favourites'), + title: t('Favorites'), href: currentWorkspaceId ? `/workspace/${currentWorkspaceId}/favorite` : '', diff --git a/packages/app/src/components/workspace-slider-bar/index.tsx b/packages/app/src/components/workspace-slider-bar/index.tsx index 3df649a8a..556f560a2 100644 --- a/packages/app/src/components/workspace-slider-bar/index.tsx +++ b/packages/app/src/components/workspace-slider-bar/index.tsx @@ -131,7 +131,7 @@ export const WorkSpaceSliderBar = () => { - {t('Favourites')} + {t('Favorites')} { return ( <> - {t('Favourites')} - AFFiNE + {t('Favorites')} - AFFiNE }> - {t('Favourites')} + {t('Favorites')} p.favorite && !p.trash)} diff --git a/packages/app/src/templates/Welcome-to-AFFiNE-Abbey-Alpha-Wood.md b/packages/app/src/templates/Welcome-to-AFFiNE-Abbey-Alpha-Wood.md index 91e2fe48c..741711147 100644 --- a/packages/app/src/templates/Welcome-to-AFFiNE-Abbey-Alpha-Wood.md +++ b/packages/app/src/templates/Welcome-to-AFFiNE-Abbey-Alpha-Wood.md @@ -22,7 +22,7 @@ docker run -it --name affine -d -v [YOUR_PATH]:/app/data -p 3000:3000 ghcr.io/to ### In this release, you can now: -- Manage your pages from the collapsible **sidebar**, which allows you to add **favourites** and restore deleted files from the **trash** +- Manage your pages from the collapsible **sidebar**, which allows you to add **favorites** and restore deleted files from the **trash** - Search through all your content with the quick search - activate with `Ctrl/⌘ + K` - A friendly Reminder: - In the case of unselected text, `Ctrl/⌘ + K` activates quick search; @@ -53,7 +53,7 @@ console.log('Hello world'); [] Send a page to trash -[] Favourite a page +[] Favorite a page **Have an enjoyable editing experience !!!** 😃 diff --git a/packages/i18n/src/resources/en.json b/packages/i18n/src/resources/en.json index f242290f9..8a44ca4c2 100644 --- a/packages/i18n/src/resources/en.json +++ b/packages/i18n/src/resources/en.json @@ -1,7 +1,7 @@ { "Quick search": "Quick search", "All pages": "All pages", - "Favourites": "Favourites", + "Favorites": "Favorites", "No item": "No item", "Import": "Import", "Trash": "Trash", @@ -11,8 +11,8 @@ "Find results": "Find {{number}} results", "Collapse sidebar": "Collapse sidebar", "Expand sidebar": "Expand sidebar", - "Added to Favourites": "Added to Favourites", - "Add to favourites": "Add to favourites", + "Added to Favorites": "Added to Favorites", + "Add to favorites": "Add to favorites", "Paper": "Paper", "Edgeless": "Edgeless", "Convert to ": "Convert to ", @@ -26,8 +26,8 @@ "Created": "Created", "Updated": "Updated", "Open in new tab": "Open in new tab", - "Favourite": "Favourite", - "Favourited": "Favourited", + "Favorite": "Favorite", + "Favorited": "Favorited", "Delete page?": "Delete page?", "Delete permanently?": "Delete permanently?", "will be moved to Trash": "{{title}} will be moved to Trash", @@ -60,15 +60,15 @@ "Once deleted, you can't undo this action": { "": "Once deleted, you can't undo this action." }, - "Remove from favourites": "Remove from favourites", - "Removed from Favourites": "Removed from Favourites", + "Remove from favorites": "Remove from favorites", + "Removed from Favorites": "Removed from Favorites", "Jump to": "Jump to", "404 - Page Not Found": "404 - Page Not Found", "Once deleted, you can't undo this action": { "": "Once deleted, you can't undo this action." }, - "Remove from favourites": "Remove from favourites", - "Removed from Favourites": "Removed from Favourites", + "Remove from favorites": "Remove from favorites", + "Removed from Favorites": "Removed from Favorites", "New Workspace": "New Workspace", "Workspace description": "A workspace is your virtual space to capture, create and plan as just one person or together as a team.", "Create": "Create", @@ -105,7 +105,7 @@ "mobile device description": "We are still working on mobile support and recommend you use a desktop device.", "Got it": "Got it", "emptyAllPages": "This workspace is empty. Create a new page to begin editing.", - "emptyFavourite": "Click Add to Favourites and the page will appear here.", + "emptyFavorite": "Click Add to Favorites and the page will appear here.", "emptyTrash": "Click Add to Trash and the page will appear here.", "still designed": "(This page is still being designed.)", "My Workspaces": "My Workspaces", diff --git a/tests/local-first-delete-page.spec.ts b/tests/local-first-delete-page.spec.ts index 7a08ff616..14fb54d86 100644 --- a/tests/local-first-delete-page.spec.ts +++ b/tests/local-first-delete-page.spec.ts @@ -43,7 +43,7 @@ test.describe('Local first delete page', () => { // show empty tip expect( page.getByText( - 'Tips: Click Add to Favourites/Trash and the page will appear here.' + 'Tips: Click Add to Favorites/Trash and the page will appear here.' ) ).not.toBeUndefined(); }); diff --git a/tests/local-first-export-page.spec.ts b/tests/local-first-export-page.spec.ts index 8e959135b..08579b3a3 100644 --- a/tests/local-first-export-page.spec.ts +++ b/tests/local-first-export-page.spec.ts @@ -21,7 +21,7 @@ test.describe('Local first export page', () => { await cell.click(); await clickPageMoreActions(page); const exportParentBtn = page.getByRole('tooltip', { - name: 'Add to favourites Convert to Edgeless Export Delete', + name: 'Add to favorites Convert to Edgeless Export Delete', }); await exportParentBtn.click(); const [download] = await Promise.all([ @@ -48,7 +48,7 @@ test.describe('Local first export page', () => { await cell.click(); await clickPageMoreActions(page); const exportParentBtn = page.getByRole('tooltip', { - name: 'Add to favourites Convert to Edgeless Export Delete', + name: 'Add to favorites Convert to Edgeless Export Delete', }); await exportParentBtn.click(); const [download] = await Promise.all([ diff --git a/tests/local-first-favorite-page.spec.ts b/tests/local-first-favorite-page.spec.ts index 8e65ec920..afb30372b 100644 --- a/tests/local-first-favorite-page.spec.ts +++ b/tests/local-first-favorite-page.spec.ts @@ -37,7 +37,7 @@ test.describe('Local first favorite and cancel favorite page', () => { await favoriteBtn.click(); // expect it in favorite list - await page.getByRole('link', { name: 'Favourites' }).click(); + await page.getByRole('link', { name: 'Favorites' }).click(); expect( page.getByRole('cell', { name: 'this is a new page to favorite' }) ).not.toBeUndefined(); @@ -52,13 +52,13 @@ test.describe('Local first favorite and cancel favorite page', () => { //hover table record await page.mouse.move((box?.x ?? 0) + 10, (box?.y ?? 0) + 10); - await page.getByTestId('favourited-icon').click(); + await page.getByTestId('favorited-icon').click(); // expect it not in favorite list - await page.getByRole('link', { name: 'Favourites' }).click(); + await page.getByRole('link', { name: 'Favorites' }).click(); expect( page.getByText( - 'Tips: Click Add to Favourites/Trash and the page will appear here.' + 'Tips: Click Add to Favorites/Trash and the page will appear here.' ) ).not.toBeUndefined(); }); diff --git a/tests/local-first-favorites-items.spec.ts b/tests/local-first-favorites-items.spec.ts index e7dd0c90d..8a4b1b9d5 100644 --- a/tests/local-first-favorites-items.spec.ts +++ b/tests/local-first-favorites-items.spec.ts @@ -43,7 +43,7 @@ test.describe('Local first favorite items ui', () => { const favoriteBtn = page.getByTestId('editor-option-menu-favorite'); await favoriteBtn.click(); - await page.getByRole('link', { name: 'Favourites' }).click(); + await page.getByRole('link', { name: 'Favorites' }).click(); expect( page.getByRole('cell', { name: 'this is a new page to favorite' }) ).not.toBeUndefined(); From 5a93b26cc30b8f1088fff96858df500acd67a228 Mon Sep 17 00:00:00 2001 From: zuomeng wang Date: Thu, 9 Feb 2023 15:53:46 +0800 Subject: [PATCH 19/24] fix: duplicate api call for cloud workspace (#928) --- .../data-center/src/provider/affine/affine.ts | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/packages/data-center/src/provider/affine/affine.ts b/packages/data-center/src/provider/affine/affine.ts index ee596675c..e8e564e09 100644 --- a/packages/data-center/src/provider/affine/affine.ts +++ b/packages/data-center/src/provider/affine/affine.ts @@ -45,6 +45,7 @@ export class AffineProvider extends BaseProvider { private _apis: Apis; private _channel?: WebsocketClient; // private _idbMap: Map = new Map(); + private _workspaceLoadingQueue: Set = new Set(); constructor({ apis, ...params }: AffineProviderConstructorParams) { super(params); @@ -145,11 +146,13 @@ export class AffineProvider extends BaseProvider { // update workspaces this._workspaces.update(id, workspace); } else { - const workspaceUnit = await loadWorkspaceUnit( - { id, ...workspace }, - this._apis - ); - newlyCreatedWorkspaces.push(workspaceUnit); + if (!this._workspaceLoadingQueue.has(id)) { + const workspaceUnit = await loadWorkspaceUnit( + { id, ...workspace }, + this._apis + ); + newlyCreatedWorkspaces.push(workspaceUnit); + } } } else { console.log(`[log warn] ${id} name is empty`); @@ -204,6 +207,7 @@ export class AffineProvider extends BaseProvider { } override async warpWorkspace(workspace: BlocksuiteWorkspace) { + // FIXME: if add indexedDB cache in the future, can remove following line. await this._applyCloudUpdates(workspace); const { room } = workspace; assert(room); @@ -234,6 +238,7 @@ export class AffineProvider extends BaseProvider { const workspacesList = await this._apis.getWorkspaces(); const workspaceUnits = await Promise.all( workspacesList.map(w => { + this._workspaceLoadingQueue.add(w.id); return loadWorkspaceUnit( { id: w.id, @@ -246,7 +251,9 @@ export class AffineProvider extends BaseProvider { syncMode: 'core', }, this._apis - ); + ).finally(() => { + this._workspaceLoadingQueue.delete(w.id); + }); }) ); this._workspaces.add(workspaceUnits); From 3d6d8694ba2493a91042d703f369fe903232389f Mon Sep 17 00:00:00 2001 From: DiamondThree Date: Thu, 9 Feb 2023 16:28:01 +0800 Subject: [PATCH 20/24] feat: add create workspace test (#914) --- packages/app/src/components/page-list/index.tsx | 1 + .../app/src/components/workspace-modal/index.tsx | 1 + .../workspace-setting/general/General.tsx | 2 +- .../src/components/workspace-slider-bar/index.tsx | 3 ++- tests/local-first-workspace-list.spec.ts | 15 +++++++++++++++ 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/packages/app/src/components/page-list/index.tsx b/packages/app/src/components/page-list/index.tsx index 7cbcf80c9..8386f902c 100644 --- a/packages/app/src/components/page-list/index.tsx +++ b/packages/app/src/components/page-list/index.tsx @@ -106,6 +106,7 @@ export const PageList = ({ {pageList.map((pageMeta, index) => { return ( { if (isPublic) { diff --git a/packages/app/src/components/workspace-modal/index.tsx b/packages/app/src/components/workspace-modal/index.tsx index 2c67459ed..8c3850e39 100644 --- a/packages/app/src/components/workspace-modal/index.tsx +++ b/packages/app/src/components/workspace-modal/index.tsx @@ -71,6 +71,7 @@ export const WorkspaceModal = ({ open, onClose }: WorkspaceModalProps) => { { onClose(); }} diff --git a/packages/app/src/components/workspace-setting/general/General.tsx b/packages/app/src/components/workspace-setting/general/General.tsx index dbfdce1ff..2c33eb3bf 100644 --- a/packages/app/src/components/workspace-setting/general/General.tsx +++ b/packages/app/src/components/workspace-setting/general/General.tsx @@ -18,7 +18,7 @@ import { Upload } from '@/components/file-upload'; export const GeneralPage = ({ workspace }: { workspace: WorkspaceUnit }) => { const [showDelete, setShowDelete] = useState(false); const [showLeave, setShowLeave] = useState(false); - const [workspaceName, setWorkspaceName] = useState(workspace.name); + const [workspaceName, setWorkspaceName] = useState(workspace?.name); const { currentWorkspace, isOwner } = useAppState(); const { updateWorkspace } = useWorkspaceHelper(); const { t } = useTranslation(); diff --git a/packages/app/src/components/workspace-slider-bar/index.tsx b/packages/app/src/components/workspace-slider-bar/index.tsx index 556f560a2..5c98f28ff 100644 --- a/packages/app/src/components/workspace-slider-bar/index.tsx +++ b/packages/app/src/components/workspace-slider-bar/index.tsx @@ -125,7 +125,8 @@ export const WorkSpaceSliderBar = () => { - {t('All pages')} + + {t('All pages')} diff --git a/tests/local-first-workspace-list.spec.ts b/tests/local-first-workspace-list.spec.ts index ddee0e36c..0f71989c1 100644 --- a/tests/local-first-workspace-list.spec.ts +++ b/tests/local-first-workspace-list.spec.ts @@ -27,6 +27,21 @@ test.describe('Local first workspace list', () => { //check workspace list length const workspaceCards = await page.$$('data-testid=workspace-card'); expect(workspaceCards.length).toBe(2); + + //check page list length + const closeWorkspaceModal = page.getByTestId('close-workspace-modal'); + await closeWorkspaceModal.click(); + const allPageButton = page.getByTestId('all-pages'); + await allPageButton.click(); + await page.waitForTimeout(1000); + const pageList = page.locator('[data-testid=page-list-item]'); + const result = await pageList.count(); + expect(result).toBe(1); + await page.reload(); + await page.waitForTimeout(1000); + const pageList1 = page.locator('[data-testid=page-list-item]'); + const result1 = await pageList1.count(); + expect(result1).toBe(1); }); test('create multi workspace in the workspace list', async ({ page }) => { From 7ab0040810ae88d8b273672eb67db27cd1635a9c Mon Sep 17 00:00:00 2001 From: JimmFly Date: Thu, 9 Feb 2023 17:31:21 +0800 Subject: [PATCH 21/24] feat: update language (#929) --- docs/BUILDING.md | 1 - packages/i18n/src/index.ts | 2 +- packages/i18n/src/resources/de.json | 174 ++++++++++++++ packages/i18n/src/resources/fr.json | 175 ++++++++++++++ packages/i18n/src/resources/index.ts | 48 +++- packages/i18n/src/resources/pt-BR.json | 147 ++++++++++++ packages/i18n/src/resources/ru.json | 180 ++++++++++++++ packages/i18n/src/resources/zh-Hans.json | 283 ++++++++++++----------- packages/i18n/src/scripts/download.ts | 2 +- 9 files changed, 874 insertions(+), 138 deletions(-) create mode 100644 packages/i18n/src/resources/de.json create mode 100644 packages/i18n/src/resources/fr.json create mode 100644 packages/i18n/src/resources/pt-BR.json create mode 100644 packages/i18n/src/resources/ru.json diff --git a/docs/BUILDING.md b/docs/BUILDING.md index 6064918d1..1a5d37afb 100644 --- a/docs/BUILDING.md +++ b/docs/BUILDING.md @@ -41,7 +41,6 @@ pnpm dev The playground page should work at [http://localhost:8080/](http://localhost:8080/) - ## Testing Adding test cases is strongly encouraged when you contribute new features and bug fixes. diff --git a/packages/i18n/src/index.ts b/packages/i18n/src/index.ts index 31e4e30ed..bfb132ce0 100644 --- a/packages/i18n/src/index.ts +++ b/packages/i18n/src/index.ts @@ -31,7 +31,7 @@ const resources = LOCALES.reduce( {} ); -const fallbackLng = LOCALES[0].tag; +const fallbackLng = 'en'; const standardizeLocale = (language: string) => { if (language === 'zh-CN' || language === 'zh') { language = 'zh-Hans'; diff --git a/packages/i18n/src/resources/de.json b/packages/i18n/src/resources/de.json new file mode 100644 index 000000000..72ce3a2df --- /dev/null +++ b/packages/i18n/src/resources/de.json @@ -0,0 +1,174 @@ +{ + "// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.": "", + "Delete Workspace Description": "Workspace (<1>{{workspace}}) wird gelöscht und der Inhalt wird verloren sein. Dies kann nicht rückgängig gemacht werden.", + "Copied link to clipboard": "Link in die Zwischenablage kopiert", + "Local Workspace Description": "Alle Daten sind auf dem aktuellen Gerät gespeichert. Du kannst AFFiNE Cloud für diesen Workspace aktivieren, um deine Daten mit der Cloud zu synchronisieren.", + "Member": "Mitglied", + "Once deleted, you can't undo this action": { + "": "Das Löschen kann nicht rückgängig gemacht werden." + }, + "Owner": "Besitzer", + "Sync Description2": "<1>{{workspaceName}} ist ein Cloud Workspace. Alle Daten werden synchronisiert und in der AFFiNE Cloud gespeichert.", + "Download data Description1": "Es verbraucht mehr Speicherplatz auf deinem Gerät.", + "Wait for Sync": "Warte auf Sync", + "Published Description": "Der aktuelle Workspace wurde im Web veröffentlicht, jeder mit dem Link kann den Inhalt sehen.", + "Sync Description": "{{workspaceName}} ist ein lokaler Workspace. Alle Daten werden nur auf dem aktuellen Gerät gespeichert. Wenn du AFFiNE Cloud für diesen Workspace aktivierst, kann der Inhalt mit der Cloud synchronisiert werden. ", + "Joined Workspace": "Workspace beigetreten", + "404 - Page Not Found": "404 - Seite nicht gefunden", + "Add to favorites": "Zu Favoriten hinzufügen", + "Added to Favorites": "Zu Favoriten hinzugefügt", + "All pages": "Alle Seiten", + "Bold": "Fett", + "Cancel": "Abbrechen", + "Contact Us": "Kontaktiere uns", + "Create": "Erstellen", + "Created": "Erstellt", + "Delete": "Löschen", + "Delete page?": "Seite löschen?", + "Delete permanently": "Dauerhaft löschen", + "Delete permanently?": "Dauerhaft löschen?", + "Export": "Exportieren", + "Export to HTML": "Zu HTML exportieren", + "Export to Markdown": "Zu Markdown exportieren", + "Favorite": "Favorit", + "Favorited": "Favorisiert", + "Favorites": "Favoriten", + "Heading": "Überschrift {{number}}", + "Import": "Importieren", + "Italic": "Kursiv", + "Local Workspace": "Lokaler Workspace", + "Official Website": "Offizielle Webseite", + "Page": "Seite", + "Select": "Auswählen", + "Strikethrough": "Durchgestrichen", + "Title": "Titel", + "Trash": "Papierkorb", + "AFFiNE Community": "AFFiNE Community", + "All changes are saved locally": "Alle Änderungen sind lokal gespeichert", + "Body text": "Haupttext", + "ClearData": "Lokale Daten löschen", + "Code block": "Code-Block", + "Collaboration": "Zusammenarbeit", + "Collaboration Description": "Für die Zusammenarbeit mit anderen Nutzern werden die AFFiNE Cloud Services benötigt.", + "Collapse sidebar": "Seitenleiste einklappen", + "Connector": "Verbindung (bald verfügbar)", + "General": "Generelles", + "Available Offline": "Offline verfügbar", + "Continue with Google": "Mit Google fortfahren", + "Convert to ": "Konvertiere zu", + "Copy Link": "Link kopieren", + "Create Or Import": "Erstellen oder importieren", + "Delete Workspace": "Workspace löschen", + "Delete Workspace Description2": "Das Löschen von (<1>{{workspace}}) wird sowohl lokale als auch Daten in der Cloud löschen. Dies kann nicht rückgängig gemacht werden.", + "Edgeless": "Edgeless", + "Divider": "Trenner", + "Enable": "Aktivieren", + "Enable AFFiNE Cloud": "AFFiNE Cloud aktivieren", + "Enable AFFiNE Cloud Description": "Falls aktiviert, werden die Daten in diesem Workspace via der AFFiNE Cloud gesichert und synchronisiert.", + "Expand sidebar": "Seitenleiste ausklappen", + "Export Workspace": "Das Exportieren von Workspace <1>{{workspace}} kommt bald", + "Find 0 result": "0 Ergebnisse gefunden", + "Find results": "{{number}} Ergebnis(se) gefunden", + "Get in touch!": "Kontaktiere uns!", + "Got it": "Verstanden", + "How is AFFiNE Alpha different?": "Worin unterscheidet sich AFFiNE Alpha?", + "Invite": "Einladen", + "Jump to": "Springe zu", + "Delete Workspace placeholder": "Bitte gib als Bestätigung \"Delete\" ein", + "Increase indent": "Einzug vergrößern", + "Invite Members": "Mitglieder einladen", + "Keyboard Shortcuts": "Tastaturkürzel", + "Leave": "Verlassen", + "Leave Workspace": "Workspace verlassen", + "Leave Workspace Description": "Nach dem Verlassen hast du keinen Zugriff mehr auf die Inhalte dieses Workspaces.", + "Link": "Hyperlink (mit ausgewähltem Text)", + "Loading": "Lade...", + "Markdown Syntax": "Markdown Syntax", + "Moved to Trash": "In Papierkorb verschoben", + "My Workspaces": "Meine Workspaces", + "New Keyword Page": "Neue '{{query}}' Seite", + "New Page": "Neue Seite", + "New Workspace": "Neuer Workspace", + "No item": "Kein Inhalt", + "Non-Gmail": "Nur Gmail wird unterstützt", + "NotLoggedIn": "Derzeit nicht angemeldet", + "Ooops!": "Uuups!", + "Open in new tab": "In neuem Tab öffnen", + "Paper": "Papier", + "Pen": "Stift (bald verfügbar)", + "Pending": "Ausstehend", + "Permanently deleted": "Dauerhaft gelöscht", + "Publish": "Veröffentlichen", + "Publish to web": "Im Web veröffentlichen", + "Publishing": "Für das Veröffentlichen im Web werden die AFFiNE Cloud Services benötigt.", + "Quick search": "Schnelle Suche", + "Quick search placeholder": "Schnelle Suche...", + "Quick search placeholder2": "Suche in {{workspace}}", + "Redo": "Wiederholen", + "Reduce indent": "Einzug verringern", + "Remove from favorites": "Von Favoriten entfernen", + "Removed from Favorites": "Von Favoriten entfernt", + "Restore it": "Wiederherstellen", + "Sticky": "Haftnotiz (bald verfügbar)", + "Settings": "Einstellungen", + "Shape": "Form", + "Share with link": "Mit Link teilen", + "Shortcuts": "Shortcuts", + "Sign in": "In AFFiNE Cloud anmelden", + "Sign in and Enable": "Anmelden und aktivieren", + "Sign out": "Abmelden", + "Skip": "Überspringen", + "Stay logged out": "Abgemeldet bleiben", + "Stop publishing": "Veröffentlichen stoppen", + "Sync": "Sync", + "Invite placeholder": "E-Mails durchsuchen (Unterstützt nur Gmail)", + "Text": "Text (bald verfügbar)", + "Tips": "Tipps:", + "TrashButtonGroupTitle": "Dauerhaft löschen", + "Underline": "Unterstreichen", + "Undo": "Rückgängig", + "Upload": "Hochladen", + "Workspace Icon": "Workspace Icon", + "Workspace Name": "Workspace Name", + "Workspace Settings": "Workspace Einstellungen", + "Workspace Type": "Workspace Typ", + "emptyAllPages": "Dieser Workspace ist leer. Erstelle eine Seite, um sie zu bearbeiten.", + "emptyFavorite": "Klicke auf \"Zu Favoriten hinzufügen\" und die Seite wird hier erscheinen", + "Publishing Description": "Nach der Veröffentlichung im Web kann jeder den Inhalt dieses Workspaces über den Link einsehen.", + "login success": "Login erfolgreich", + "restored": "{{title}} wiederhergestellt", + "Inline code": "Inline-Code", + "Set up an AFFiNE account to sync data": "Für das Synchronisieren wird ein AFFiNE Account benötigt", + "Cloud Workspace": "Cloud Workspace", + "TrashButtonGroupDescription": "Das Löschen kann nicht rückgängig gemacht werden. Fortfahren?", + "Untitled": "Unbenannt", + "Updated": "Aktualisiert", + "Users": "Benutzer", + "Workspace description": "Ein Workspace ist dein virtueller Raum zum Erfassen, Gestalten und Planen, ob allein oder gemeinsam im Team.", + "emptyTrash": "Klicke auf \"In Papierkorb verschieben\" und die Seite wird hier erscheinen.", + "mobile device": "Sieht aus, als ob du ein mobiles Gerät nutzt.", + "mobile device description": "Wir arbeiten noch an der Unterstützung für mobile Geräte und empfehlen dir, ein Desktop-Gerät zu verwenden.", + "will be moved to Trash": "{{title}} wird in den Papierkorb verschoben", + "still designed": "(Diese Seite ist noch im Aufbau.)", + "recommendBrowser": "Wir empfehlen den <1>Chrome Browser für die beste Nutzererfahrung.", + "upgradeBrowser": "Bitte aktualisiere auf die neueste Chrome-Version, um eine optimale Nutzererfahrung zu gewährleisten.", + "Delete Member?": "Mitglied löschen?", + "Download data": "{{CoreOrAll}} Daten herunterladen", + "Set a Workspace name": "Name vom Workspace ändern", + "Member has been removed": "{{name}} wurde entfernt", + "Enabled success": "Aktivierung erfolgreich", + "Force Sign Out": "Abmeldung erwingen", + "Retain local cached data": "Lokale, zwischengespeicherte Daten beibehalten", + "Workspace Avatar": "Workspace Avatar", + "all": "Alle", + "core": "Core", + "is a Cloud Workspace": "ist ein Cloud Workspace.", + "is a Local Workspace": "ist ein lokaler Workspace.", + "Published to Web": "Im Web veröffentlicht", + "Download data Description2": "Es verbraucht nur wenig Speicherplatz auf deinem Gerät.", + "will delete member": "wird Mitglied löschen", + "Failed to publish workspace": "Workspace Veröffentlichung fehlgeschlagen", + "Back Home": "Zurück zum Start", + "Cloud Workspace Description": "Alle Daten werden synchronisiert und zu dem AffiNE account <1>{{email}} gespeichert", + "Access level": "Zugriffsberechtigung" +} diff --git a/packages/i18n/src/resources/fr.json b/packages/i18n/src/resources/fr.json new file mode 100644 index 000000000..807731931 --- /dev/null +++ b/packages/i18n/src/resources/fr.json @@ -0,0 +1,175 @@ +{ + "// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.": "", + "Download data Description2": "Cela prendra peu d'espace sur votre appareil.", + "Enabled success": "Activation réussie", + "Cloud Workspace": "Espace de travail distant", + "Failed to publish workspace": "La publication de l'espace de travail a échoué", + "Force Sign Out": "Forcer la déconnexion", + "Joined Workspace": "L'espace de travail a été rejoint", + "Local Workspace": "Espace de travail local", + "Local Workspace Description": "Toutes les données sont stockées sur le périphérique actuel. Vous pouvez activer AFFiNE Cloud pour garder les données de cet espace de travail synchronisé dans le cloud.", + "Published Description": "L'espace de travail courant a été publié sur le net, tout le monde peut voir son contenu à partir du lien.", + "Retain local cached data": "Conserver les données du cache local", + "Copied link to clipboard": "Lien copié dans le presse-papier", + "Published to Web": "Publié sur internet", + "Set a Workspace name": "Définir un nom pour l'espace de travail", + "Wait for Sync": "Attendre la synchronisation", + "Available Offline": "Disponible hors ligne", + "Delete Member?": "Supprimer le membre ?", + "404 - Page Not Found": "Erreur 404 - Page non trouvée", + "AFFiNE Community": "Communauté AFFiNE", + "Add to favorites": "Ajouter aux favoris", + "Added to Favorites": "Ajouté aux favoris ", + "All pages": "Toutes les pages", + "Bold": "Gras", + "Cancel": "Annuler ", + "Convert to ": "Convertir en", + "Created": "Objet créé ", + "Delete page?": "Supprimer la page ?", + "Delete permanently?": "Supprimer de manière définitive ? ", + "Edgeless": "Mode sans bords", + "Expand sidebar": "Agrandir la barre latérale", + "Export": "Exporter ", + "Export to HTML": "Exporter en HTML", + "Export to Markdown": "Exporter en Markdown", + "Favorite": "Favoris ", + "Favorited": "Ajouté aux favoris", + "Updated": "Mis à jour", + "Contact Us": "Contactez nous ", + "Create": "Créer ", + "Delete permanently": "Supprimer définitivement", + "Divider": "Diviseur ", + "Favorites": "Favoris ", + "Find 0 result": "Aucun résultat trouvé ", + "Find results": "{{number}} résultats trouvés", + "Get in touch!": "Contactez-nous ! ", + "How is AFFiNE Alpha different?": "Quel sont les différences avec AFFiNE Alpha", + "Import": "Importer ", + "Italic": "Italique", + "Jump to": "Passer à ", + "Keyboard Shortcuts": "Raccourcis clavier", + "Link": "Lien hypertexte (avec le texte sélectionné)", + "Markdown Syntax": "Syntaxe Markdown", + "Moved to Trash": "Déplacé à la corbeille ", + "New Keyword Page": "Nouvelle page '{{query}}'", + "New Page": "Nouvelle page", + "New Workspace": "Nouvel espace de travail ", + "No item": "Aucun objet ", + "Official Website": "Site officiel ", + "Once deleted, you can't undo this action": { + "": "Une fois supprimé, vous ne pourrez plus retourner en arrière." + }, + "Open in new tab": "Ouvrir dans un nouvel onglet", + "Page": "Page", + "Paper": "Papier", + "Pen": "Stylo (bientôt disponible) ", + "Permanently deleted": "Supprimé définitivement ", + "Quick search": "Recherche rapide", + "Redo": "Retour ", + "Remove from favorites": "Retirer des favoris", + "Removed from Favorites": "Retiré des favoris ", + "Restore it": "Restaurer ", + "Shape": "Forme", + "Sticky": "Post-it (bientôt) ", + "Shortcuts": "Raccourcis", + "Text": "Texte (bientôt disponible)", + "Title": "Titre ", + "Trash": "Corbeille ", + "Underline": "Souligner ", + "Undo": "Retour", + "Untitled": "Non nommé ", + "will be moved to Trash": "{{title}} sera déplacé à la corbeille ", + "Select": "Sélectionner ", + "TrashButtonGroupTitle": "Supprimer définitivement", + "restored": "{{title}} a été restauré ", + "Heading": "Titre {{number}}", + "Upload": "Uploader ", + "Code block": "Bloc de code", + "Collapse sidebar": "Rabattre la barre latérale", + "Connector": "Connecteur (bientôt disponible) ", + "Increase indent": "Augmenter l'indentation", + "Reduce indent": "Réduire l'indentation du texte", + "Inline code": "Ligne de code", + "Strikethrough": "Barré", + "Member": "Membre", + "ClearData": "Effacer les données locales", + "Collaboration": "Collaboration", + "Collaboration Description": "La collaboration avec d'autres membres nécessite AFFiNE Cloud.", + "Copy Link": "Copier le lien", + "Delete Workspace": "Supprimer l'espace de travail", + "Delete Workspace placeholder": "Veuillez écrire \"Delete\" pour confirmer", + "Enable": "Activer", + "Create Or Import": "Créer ou importer", + "Got it": "Compris", + "Loading": "Chargement...", + "NotLoggedIn": "Actuellement non connecté", + "Ooops!": "Oups !", + "Publish": "Publier", + "Publish to web": "Publier sur internet", + "Quick search placeholder": "Recherche rapide...", + "Settings": "Paramètres", + "Stay logged out": "Rester déconnecté", + "Tips": "Astuces :", + "Users": "Utilisateur", + "My Workspaces": "Mes espaces de travail", + "Access level": "Permissions", + "Delete Workspace Description2": "La suppression de (<1>{{workspace}}) aura pour effet de supprimer les données locales et les données dans le cloud. Attention, cette opération est irréversible.", + "Enable AFFiNE Cloud": "Activer AFFiNE Cloud", + "Enable AFFiNE Cloud Description": "Si cette option est activée, les données de cet espace de travail seront sauvegardées et synchronisées via AFFiNE Cloud.", + "Export Workspace": "L'exportation de l'espace de travail <1>{{workspace}} sera bientôt disponible.", + "General": "Général", + "Invite": "Inviter", + "Invite Members": "Inviter des membres", + "Invite placeholder": "Rechercher une adresse mail (compatible uniquement avec Gmail)", + "Leave": "Quitter", + "Leave Workspace": "Quitter l'espace de travail", + "Leave Workspace Description": "Une fois quitté, vous ne pourrez plus accéder au contenu de cet espace de travail.", + "Non-Gmail": "Seul Gmail est supporté", + "Pending": "En attente", + "Publishing": "Publier sur le web nécessite le service AFFiNE Cloud.", + "Publishing Description": "Après avoir publié sur le net, tout le monde pourra voir le contenu de cet espace de travail depuis le lien.", + "Quick search placeholder2": "Rechercher dans {{workspace}}", + "Set up an AFFiNE account to sync data": "Configurer un compte AFFiNE pour synchroniser les données", + "Sign in": "Se connecter à AFFiNE Cloud", + "Sign in and Enable": "Se connecter et activer", + "Sign out": "Se déconnecter d'AFFiNE Cloud", + "Skip": "Passer", + "Stop publishing": "Arrêter de publier", + "Sync": "Synchroniser", + "Sync Description2": "<1>{{workspaceName}} est un espace de travail distant. Toutes ses données seront synchronisées et sauvegardées dans AFFiNE Cloud.", + "Workspace Icon": "Icône espace de travail", + "Workspace Name": "Nom de l'espace de travail", + "Workspace Settings": "Paramètres de l'espace de travail", + "Workspace Type": "Type de l'espace de travail", + "Workspace description": "Un espace de travail est votre espace virtuel pour capturer, créer et planifier aussi bien seul qu'en équipe.", + "emptyAllPages": "Cet espace de travail est vide. Créer une nouvelle page pour commencer l'édition.", + "emptyFavorite": "Cliquez sur Ajouter aux favoris et la page apparaitra ici.", + "emptyTrash": "Cliquez sur Ajouter à la corbeille et la page apparaitra ici.", + "login success": "Connexion réussie", + "mobile device description": "Nous travaillons toujours sur le support des appareils mobiles. Ainsi, nous vous recommandons d'utiliser un ordinateur.", + "still designed": "(Cette page est toujours en cours de conception.)", + "Body text": "Corps du texte", + "Back Home": "Retour à l'accueil", + "Member has been removed": "{{name}} a été supprimé", + "Not now": "Pas maintenant", + "Owner": "Propriétaire", + "Workspace Avatar": "Avatar de l'espace de travail", + "core": "l'essentiel", + "All changes are saved locally": "Les changements sont sauvegardés localement", + "Continue with Google": "Se connecter avec Google ", + "Delete": "Supprimer objet ", + "Delete Workspace Description": "Attention, la suppression de (<1>{{workspace}}) est irréversible. Le contenu sera perdu.", + "Share with link": "Partager un lien", + "Sync Description": "{{workspaceName}} est un espace de travail local. Toutes ses données sont stockées sur le périphérique actuel. Vous pouvez activer AFFiNE Cloud pour garder les données de cet espace de travail synchronisé dans le cloud.", + "TrashButtonGroupDescription": "Une fois supprimé, vous ne pouvez pas retourner en arrière. Confirmez-vous la suppression ? ", + "all": "Tout", + "mobile device": "Il semblerait que vous naviguiez sur un appareil mobile.", + "recommendBrowser": "Pour une expérience optimale, nous vous recommandons le navigateur <1>Chrome.", + "upgradeBrowser": "Veuillez installer la dernière version de Chrome pour bénéficier d'une expérience optimale.", + "is a Cloud Workspace": "est un espace de travail distant", + "is a Local Workspace": "est un espace de travail local", + "will delete member": "supprimera le membre", + "Cloud Workspace Description": "Toutes les données vont être synchronisées et sauvegardées sur le compte AFFiNE <1>{{email}}", + "Download data Description1": "Cela prendra plus d'espace sur votre appareil.", + "Download data": "Télécharger les données {{CoreOrAll}}" +} diff --git a/packages/i18n/src/resources/index.ts b/packages/i18n/src/resources/index.ts index cf5c5fc72..069fcc7a2 100644 --- a/packages/i18n/src/resources/index.ts +++ b/packages/i18n/src/resources/index.ts @@ -1,10 +1,24 @@ // THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. // Run `pnpm run download-resources` to regenerate. // To overwrite this, please overwrite download.ts script. +import pt_BR from './pt-BR.json'; import en from './en.json'; import zh_Hans from './zh-Hans.json'; +import fr from './fr.json'; +import de from './de.json'; +import ru from './ru.json'; export const LOCALES = [ + { + id: 1000040021, + name: 'Portuguese (Brazil)', + tag: 'pt-BR', + originalName: 'português (Brasil)', + flagEmoji: '🇧🇷', + base: false, + completeRate: 0.8022598870056498, + res: pt_BR, + }, { id: 1000040001, name: 'English', @@ -12,7 +26,7 @@ export const LOCALES = [ originalName: 'English', flagEmoji: '🇬🇧', base: true, - completeRate: 1, + completeRate: 1.0169491525423728, res: en, }, { @@ -22,7 +36,37 @@ export const LOCALES = [ originalName: '简体中文', flagEmoji: '🇨🇳', base: false, - completeRate: 1, + completeRate: 0.9548022598870056, res: zh_Hans, }, + { + id: 1000040006, + name: 'French', + tag: 'fr', + originalName: 'français', + flagEmoji: '🇫🇷', + base: false, + completeRate: 0.96045197740113, + res: fr, + }, + { + id: 1000040009, + name: 'German', + tag: 'de', + originalName: 'Deutsch', + flagEmoji: '🇩🇪', + base: false, + completeRate: 0.9548022598870056, + res: de, + }, + { + id: 1000040011, + name: 'Russian', + tag: 'ru', + originalName: 'русский', + flagEmoji: '🇷🇺', + base: false, + completeRate: 0.9887005649717514, + res: ru, + }, ] as const; diff --git a/packages/i18n/src/resources/pt-BR.json b/packages/i18n/src/resources/pt-BR.json new file mode 100644 index 000000000..c6a6a90e2 --- /dev/null +++ b/packages/i18n/src/resources/pt-BR.json @@ -0,0 +1,147 @@ +{ + "// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.": "", + "404 - Page Not Found": "404 - Página não encontrada", + "AFFiNE Community": "Comunidade AFFiNE", + "Access level": "Nível de acesso", + "Add to favorites": "Adicionar aos favoritos", + "Added to Favorites": "Adicionado aos Favoritos", + "All changes are saved locally": "Todas as alterações estão salvas localmente", + "All pages": "Todas páginas", + "Body text": "Texto do Corpo", + "Bold": "Negrito", + "Cancel": "Cancelar", + "ClearData": "Limpar cache local", + "Code block": "Bloco de código", + "Collaboration": "Colaboração", + "Collaboration Description": "Colaborar com outros membros exige o serviço AFFiNE Cloud.", + "Collapse sidebar": "Ocultar barra lateral", + "Connector": "Conector (em breve)", + "Contact Us": "Entre em contato", + "Continue with Google": "Continue com o Google", + "Convert to ": "Converter para", + "Copy Link": "Copiar link", + "Create": "Criar", + "Create Or Import": "Criar ou Importar", + "Created": "Criado", + "Delete": "Deletar", + "Delete Workspace": "Deletar Workspace", + "login success": "Login feito com sucesso", + "core": "core", + "all": "todos", + "Users": "Usuários", + "Upload": "Upload", + "Updated": "Atualizado", + "Untitled": "Sem título", + "Undo": "Desfazer", + "Underline": "Sublinhar", + "TrashButtonGroupTitle": "Deletar permanentemente", + "TrashButtonGroupDescription": "Uma vez deletado, você não poderá desfazer esta ação. Deseja confirmar?", + "Trash": "Lixeira", + "Title": "Título", + "Tips": "Dicas:", + "Text": "Texto (em breve)", + "Sync": "Sincronizar", + "Stop publishing": "Para a publicação", + "Skip": "Pular", + "Sign out": "Deslogar da AFFiNE Cloud", + "Sign in and Enable": "Logar na conta e Habilitar", + "Sign in": "Logar na AFFiNE Cloud", + "Shortcuts": "Atalhos", + "Share with link": "Compartilhar com link", + "Shape": "Forma", + "Settings": "Configurações", + "Select": "Selecionar", + "Restore it": "Restaurar", + "Removed from Favorites": "Removido dos Favoritos", + "Remove from favorites": "Remover dos Favoritos", + "Reduce indent": "Reduzir o espaço do indento", + "Redo": "Refazer", + "Quick search placeholder2": "Pesquisar em {{workspace}}", + "Quick search placeholder": "Pesquisa rápida...", + "Quick search": "Pesquisa rápida", + "Publish to web": "Publicar na Web", + "Publish": "Publicar", + "Permanently deleted": "Deletado permanentemente", + "Pending": "Pendente", + "Pen": "Caneta (em breve)", + "Paper": "Papel", + "Page": "Página", + "Open in new tab": "Abrir em uma nova aba", + "Ooops!": "Ooops!", + "Once deleted, you can't undo this action": { + "": "Uma vez deletado, esta ação não pode ser desfeita." + }, + "Official Website": "Website Oficial", + "NotLoggedIn": "Você não está logado no momento", + "Non-Gmail": "Apenas o Gmail é suportado momento. Demais e-mails não são.", + "No item": "Nenhum item", + "New Workspace": "Nova Workspace", + "New Page": "Nova Página", + "New Keyword Page": "Nova página '{{query}}' ", + "My Workspaces": "Minhas Workspaces", + "Moved to Trash": "Movido para a Lixeira", + "Loading": "Carregando...", + "Link": "Hyperlink (com o texto selecionado)", + "Leave Workspace Description": "Depois de você sair, você não conseguirá acessar os conteúdos dessa Workspace.", + "Leave Workspace": "Sair da Workspace.", + "Leave": "Sair", + "Keyboard Shortcuts": "Atalhos do Teclado", + "Jump to": "Pular para", + "Italic": "Itálico", + "Invite Members": "Convidar Membros", + "Invite": "Convidar", + "Invite placeholder": "Pesquisar e-mail (Apenas Gmail)", + "Inline code": "Código inline", + "Increase indent": "Aumentar Indento", + "Import": "Importar", + "Got it": "Entendi", + "How is AFFiNE Alpha different?": "Como AFFiNE Alpha é diferente?", + "Heading": "Cabeçalho {{number}}", + "Get in touch!": "Entre em contato!", + "General": "Geral", + "Find 0 result": "Foram encontrados 0 resultados", + "Find results": "Foram encontrados {{number}} resultados", + "Favorites": "Favoritos", + "Favorited": "Favoritado", + "Favorite": "Favorito", + "Export to HTML": "Exportar para HTML", + "Export to Markdown": "Exportar para Markdown", + "Export": "Exportar", + "Export Workspace": "Exportar Workspace <1>{{workspace}} (em breve)", + "Expand sidebar": "Expandir barra lateral", + "Enable AFFiNE Cloud Description": "Se habilitada, os dados desta Workspace serão salvos e sincronizados via AFFiNE Cloud.", + "Enable AFFiNE Cloud": "Habilitar AFFiNE Cloud", + "Enable": "Habilitar", + "Divider": "Divisor", + "Delete permanently?": "Deletar permanentemente?", + "Delete permanently": "Deletar permanentemente", + "Delete page?": "Deletar página?", + "Delete Workspace placeholder": "Por favor, digite \"Delete\" para confirmar", + "will be moved to Trash": "\n{{title}} será movido para a Lixeira", + "upgradeBrowser": "Por favor, atualize o seu Chrome para a última versão para poder usufruir da melhor experiência.", + "still designed": "(Está página está em construção.)", + "restored": "{{title}} foi restaurado", + "recommendBrowser": "Nós recomendamos o navegador <1>Chrome para a melhor experiência de uso.", + "mobile device description": "Nós ainda estamos trabalhando na versão mobile e recomendamos que você utilize um computador.", + "mobile device": "Parece que você está acessando de um smartphone.", + "emptyTrash": "Clique Adicionar para Lixeira e a página irá aparecer aqui.", + "emptyFavorite": "Clique Adicionar para Favoritos e a página irá aparecer aqui.", + "emptyAllPages": "Esta Workspace está vazia. Crie uma nova página para começar a editá-la.", + "Workspace Type": "Tipo de Workspace", + "Workspace Settings": "Configurações da Workspace", + "Workspace Name": "Nome da Workspace", + "Workspace Icon": "Ícone da Workspace", + "Strikethrough": "Riscado", + "Sticky": "Sticky (em breve)", + "Stay logged out": "Permanecer deslogado", + "Set up an AFFiNE account to sync data": "Crie uma conta AFFiNE para sincronizar seus dados", + "Markdown Syntax": "Sintaxe Markdown", + "Publishing Description": "Após publicar para a web, qualquer pessoa poderá ver o conteúdo desta Workspace através do link.", + "Publishing": "Publicar para a web demanda o serviço AFFiNE Cloud.", + "Delete Workspace Description": "Deletar (<1>{{workspace}}) não pode ser desfeito, por favor proceder com atenção. Todos os conteúdos da sua Workspace serão perdidos. ", + "Delete Workspace Description2": "Deletar (<1>{{workspace}}) deletará na cópia local e na nuvem contratada, esta operação não pode ser desfeita, por favor proceda com atenção.", + "Workspace description": "Workspace é o seu espaço virtual para capturar, criar e planejar individualmente ou colaborando com sua equipe.", + "Sync Description2": "<1>{{workspaceName}} é uma Workspace armazenada na Nuvem. Todos os dados serão sincronizados e salvos na AFFiNE Cloud.", + "Edgeless": "Sem Bordas", + "Sync Description": "{{workspaceName}} é uma Workspace local. Todo o conteúdo dela está armazenado no seu equipamento. Você pode habilitar a AFFiNE Cloud para esta Workspace para manter os dados salvos e sincronizados pela nuvem." +} diff --git a/packages/i18n/src/resources/ru.json b/packages/i18n/src/resources/ru.json new file mode 100644 index 000000000..748fa5ead --- /dev/null +++ b/packages/i18n/src/resources/ru.json @@ -0,0 +1,180 @@ +{ + "// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.": "", + "Local Workspace Description": "Все данные сохраняются на текущем устройстве. Вы можете включить AFFiNE Cloud для этого рабочего пространства, чтобы синхронизировать данные с облаком.", + "Member": "Участник", + "Member has been removed": "{{name}} был удален", + "Owner": "Владелец", + "is a Cloud Workspace": "это облачное рабочее пространство.", + "Workspace Avatar": "Аватар рабочего пространства", + "Published to Web": "Опубликовано в Интернете", + "is a Local Workspace": "это локальное рабочее пространство", + "Wait for Sync": "Дождитесь синхронизации", + "Set a Workspace name": "Задайте имя рабочего пространства", + "Published Description": "Текущее рабочее пространство было опубликовано в Интернете, каждый может просмотреть содержимое этого рабочего пространства по ссылке.", + "Joined Workspace": "Присоединенное рабочее пространство", + "Retain local cached data": "Сохранять локальные кэшированные данные", + "will delete member": "удалит участника", + "Not now": "Не сейчас", + "Download all data": "Скачать все данные", + "All data has been stored in the cloud": "Все данные хранятся в облаке.", + "Confirm": "Подтвердить", + "Data sync mode": "Режим синхронизации данных", + "Available Offline": "Доступно оффлайн", + "Back Home": "Вернуться на Главную", + "Cloud Workspace": "Облачное рабочее пространство", + "Cloud Workspace Description": "Все данные будут синхронизированы и сохранены в AFFiNE аккаунт <1>{{email}}", + "Copied link to clipboard": "Ссылка скопирована в буфер обмена", + "Delete Member?": "Удалить участника?", + "404 - Page Not Found": "404 - Страница не найдена", + "Add to favorites": "Добавить в избранное", + "Added to Favorites": "Добавлено в Избранное", + "All changes are saved locally": "Все изменения сохраняются локально", + "All pages": "Все страницы", + "Cancel": "Отмена", + "Bold": "Жирный", + "ClearData": "Удалить локальные данные", + "Code block": "Блок кода", + "Collaboration Description": "Для совместной работы с другими участниками требуется AFFiNE Cloud сервис.", + "Collaboration": "Совместная работа", + "Collapse sidebar": "Свернуть боковую панель", + "Contact Us": "Связаться с нами", + "Continue with Google": "Продолжить с Google", + "Copy Link": "Копировать ссылку", + "Create": "Создать", + "Create Or Import": "Создать или Импортировать", + "Delete": "Удалить", + "Delete Workspace": "Удалить рабочее пространство", + "Delete page?": "Удалить страницу?", + "Delete permanently": "Удалить навсегда", + "Delete permanently?": "Удалить навсегда?", + "Enable": "Включить", + "Enable AFFiNE Cloud": "Включить AFFiNE Cloud", + "Expand sidebar": "Развернуть боковую панель", + "Export": "Экспорт", + "Export to HTML": "Экспорт в HTML", + "Export to Markdown": "Экспорт в Markdown", + "Find 0 result": "Найдено 0 результатов", + "How is AFFiNE Alpha different?": "Чем отличается AFFiNE Alpha?", + "Import": "Импорт", + "Increase indent": "Увеличить отступ", + "Inline code": "Встроенный код", + "Invite Members": "Пригласить участников", + "Italic": "Курсив", + "Jump to": "Перейти к", + "Keyboard Shortcuts": "Горячие Клавиши", + "Loading": "Загрузка...", + "mobile device": "Похоже, вы просматриваете веб-страницы на мобильном устройстве.", + "login success": "Успешный вход в систему", + "Upload": "Загрузить", + "Text": "Текст (скоро)", + "Settings": "Настройки", + "Publish to web": "Опубликовать в интернете", + "Publish": "Опубликовать", + "Pen": "Ручка (скоро)", + "Paper": "Бумага", + "Page": "Страница", + "Open in new tab": "Открыть в новой вкладке", + "Ooops!": "Упс!", + "Official Website": "Официальный Сайт", + "New Page": "Новая страница", + "Moved to Trash": "Перемещено в корзину", + "Markdown Syntax": "Markdown Синтаксис", + "Access level": "Уровень доступа", + "Favorites": "Избранное", + "Select": "Выбор", + "Shape": "Фигура", + "Untitled": "Без названия", + "Sticky": "Стикер (скоро)", + "Connector": "Коннектор (скоро)", + "Redo": "Повторно выполнить", + "Undo": "Отменить", + "Convert to ": "Конвертировать в", + "Quick search": "Быстрый поиск", + "Quick search placeholder": "Быстрый поиск...", + "Quick search placeholder2": "Поиск в {{workspace}}", + "Trash": "Корзина", + "TrashButtonGroupDescription": "После удаления вы не сможете отменить это действие. Уверены?", + "TrashButtonGroupTitle": "Удалить навсегда", + "emptyTrash": "Нажмите «Добавить в корзину», и страница появится здесь.", + "Body text": "Основной текст", + "Leave Workspace": "Выйти из рабочего пространства", + "Leave Workspace Description": "После выхода вы больше не сможете получить доступ к содержимому этого рабочего пространства.", + "My Workspaces": "Мои рабочие пространства", + "New Workspace": "Новое рабочее пространство", + "Publishing Description": "После публикации в Интернете все смогут просматривать содержимое этого рабочего пространства по ссылке.", + "Sync Description": "{{workspaceName}} это локальное рабочее пространство. Все данные сохраняются на текущем устройстве. Вы можете включить AFFiNE Cloud для этого рабочего пространства, чтобы синхронизировать данные с облаком.", + "Tips": "Совет:", + "Sync Description2": "<1>{{workspaceName}} это облачное рабочее пространство. Все данные будут синхронизированы и сохранены в AFFiNE Cloud.", + "emptyAllPages": "Это рабочее пространство пусто. Создайте новую страницу, чтобы начать редактирование.", + "Export Workspace": "Экспорт рабочего пространства <1>{{workspace}} скоро будет доступен", + "Delete Workspace placeholder": "Пожалуйста, введите \"Delete\" для подтверждения", + "Delete Workspace Description": "Удаление (<1>{{workspace}}) нельзя отменить, пожалуйста, действуйте с осторожностью. Все содержимое будет потеряно.", + "Delete Workspace Description2": "Удаление (<1>{{workspace}}) приведет к удалению как локальных, так и облачных данных, эта операция не может быть отменена, пожалуйста действуйте с осторожностью.", + "Enable AFFiNE Cloud Description": "Если этот параметр включен, данные в этом рабочем пространстве будут скопированы и синхронизированы с помощью AFFiNE Cloud.", + "Once deleted, you can't undo this action": { + "": "После удаления вы не сможете отменить это действие." + }, + "Permanently deleted": "Удалено навсегда", + "No item": "Нет элементов", + "New Keyword Page": "Новая '{{query}}' страница", + "emptyFavorite": "Нажмите «Добавить в избранное», и страница появится здесь.", + "Removed from Favorites": "Удалено из Избранного", + "Remove from favorites": "Удалить из Избранного", + "Favorited": "В Избранном", + "Favorite": "В Избранное", + "AFFiNE Community": "Сообщество AFFiNE", + "Underline": "Подчеркнутый", + "Heading": "Заголовок {{number}}", + "Title": "Заголовок", + "Strikethrough": "Перечеркнутый", + "Created": "Создан", + "Divider": "Разделитель", + "Link": "Гиперссылка (с выделенным текстом)", + "will be moved to Trash": "{{title}} будет перемещен в Корзину", + "upgradeBrowser": "Пожалуйста, обновите Chrome до последней версии для лучшего взаимодействия.", + "still designed": "(Эта страница все еще находится в разработке.)", + "restored": "{{title}} восстановлен", + "recommendBrowser": "Мы рекомендуем <1>Chrome браузер для наилучшего взаимодействия.", + "mobile device description": "Мы все еще работаем над поддержкой мобильных устройств и рекомендуем использовать настольное устройство.", + "all": "все", + "core": "основных", + "Workspace Type": "Тип рабочего пространства", + "Workspace Settings": "Настройки рабочего пространства", + "Workspace Name": "Имя рабочего пространства", + "Workspace Icon": "Иконка рабочего пространства", + "Users": "Пользователи", + "Updated": "Обновлено", + "Sync": "Синхронизация", + "Stop publishing": "Остановить публикацию", + "Stay logged out": "Не выходить из системы", + "Skip": "Пропустить", + "Sign in and Enable": "Войти и Включить", + "Sign out": "Выйти из AFFiNE Cloud", + "Sign in": "Войти в AFFiNE Cloud", + "Shortcuts": "Ярлыки", + "Share with link": "Поделиться ссылкой", + "Set up an AFFiNE account to sync data": "Настройте учетную запись AFFiNE для синхронизации данных", + "Restore it": "Where is this key used?", + "Reduce indent": "Уменьшить отступ", + "Got it": "Понятно", + "Get in touch!": "Связаться!", + "General": "Общие", + "Find results": "Найдено {{number}} результатов", + "Edgeless": "Без полей", + "Invite": "Пригласить", + "Download data": "Скачать {{CoreOrAll}} данные", + "Publishing": "Для публикации в интернете требуется сервис AFFiNE Cloud", + "Pending": "В ожидании", + "NotLoggedIn": "В настоящее время на авторизован", + "Non-Gmail": "Поддерживается только Gmail", + "Invite placeholder": "Поиск почты (поддерживается только Gmail)", + "Workspace description": "Рабочее пространство - это ваше виртуальное пространство для фиксации, создания и планирования в одиночку или в команде. ", + "Leave": "Выйти", + "Force Sign Out": "Принудительный выход", + "Local Workspace": "Локальное рабочее пространство", + "Download data Description1": "Это занимает больше места на вашем устройстве.", + "Enabled success": "Успешно", + "Failed to publish workspace": "Не удалось опубликовать рабочее пространство", + "Download data Description2": "Это занимает мало места на вашем устройстве.", + "Download core data": "Скачать основные данные" +} diff --git a/packages/i18n/src/resources/zh-Hans.json b/packages/i18n/src/resources/zh-Hans.json index 6ed058b3a..9c19d1163 100644 --- a/packages/i18n/src/resources/zh-Hans.json +++ b/packages/i18n/src/resources/zh-Hans.json @@ -1,157 +1,174 @@ { "// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.": "", - "Quick search": "快速搜索", + "Delete Member?": "删除成员?", + "Wait for Sync": "等待同步", + "is a Cloud Workspace": "是云端工作区", + "will delete member": "将删除成员", + "Download data Description1": "此操作会在你的设备上占用更多空间。", + "Download data Description2": "此操作会在你的设备上占用少许空间。", + "Cloud Workspace": "云端工作区", + "Cloud Workspace Description": "所有数据将被同步并保存在AFFiNE账户(<1>{{email}})中", + "Copied link to clipboard": "复制链接到剪贴板", + "Available Offline": "可供离线使用", + "Back Home": "返回首页", + "Enabled success": "启用成功", + "Published Description": "当前工作区已被发布到Web,所有人都可以通过链接来查看此工作区内容。", + "Download data": "下载 {{CoreOrAll}} 数据", + "Force Sign Out": "强制登出", + "Joined Workspace": "加入工作区", + "Local Workspace": "本地工作区", + "Add to favorites": "加入收藏", "All pages": "全部页面", - "Favourites": "收藏夹", - "No item": "无项目", - "Import": "导入", - "Trash": "垃圾箱", - "New Page": "新建页面", - "New Keyword Page": "新建 “{{query}}“ 为标题的页面 ", - "Find 0 result": "找到 0 个结果", - "Find results": "找到 {{number}} 个结果", + "Cancel": "取消", + "Code block": "代码块", "Collapse sidebar": "折叠侧边栏", - "Expand sidebar": "展开侧边栏", - "Added to Favourites": "已收藏", - "Add to favourites": "加入收藏", - "Paper": "文档", - "Edgeless": "无界", + "Contact Us": "联系我们", + "Copy Link": "复制链接", + "Delete": "删除", + "404 - Page Not Found": "404 - 页面不见了", + "Open in new tab": "在新标签页打开", + "Create": "创建", + "AFFiNE Community": "AFFiNE 社区", + "All changes are saved locally": "所有改动已保存到本地", + "Body text": "正文", + "Bold": "粗体", + "Create Or Import": "创建或导入", "Convert to ": "转换为", - "Page": "页面", + "ClearData": "清除本地数据", + "Delete Workspace": "删除工作空间", + "Divider": "分割线", + "Expand sidebar": "展开侧边栏", "Export": "导出", "Export to HTML": "导出为 HTML", "Export to Markdown": "导出为 Markdown", - "Delete": "删除", + "Favorite": "收藏", + "Favorited": "已收藏", + "Heading": "标题 {{number}}", + "Import": "导入", + "Increase indent": "增加缩进", + "Inline code": "行内代码", + "Italic": "斜体", + "Keyboard Shortcuts": "键盘快捷键", + "Loading": "加载中...", + "Markdown Syntax": "Markdown 语法", "Title": "标题", - "Untitled": "未命名", - "Created": "已创建", - "Updated": "已更新", - "Open in new tab": "在新标签页打开", - "Favourite": "收藏", - "Favourited": "已收藏", + "Underline": "下划线", + "Undo": "撤销", + "Redo": "重做", + "Reduce indent": "减少缩进", + "Remove from favorites": "从收藏中移除", + "Removed from Favorites": "已从收藏中移除", + "Access level": "访问权限", + "Added to Favorites": "已收藏", + "Collaboration": "协作", + "Collaboration Description": "与其他成员协作需要AFFiNE云服务支持。", + "Continue with Google": "谷歌登录以继续", "Delete page?": "确定要删除页面?", + "Delete permanently": "永久删除", "Delete permanently?": "是否永久删除?", - "will be moved to Trash": "{{title}} 将被移到垃圾箱", + "Edgeless": "无界", + "Enable AFFiNE Cloud": "启用 AFFiNE 云服务", + "Enable AFFiNE Cloud Description": "如启用,此工作区中的数据将通过AFFiNE Cloud进行备份和同步。", + "Favorites": "收藏夹", + "Get in touch!": "保持联络!", + "Got it": "知道了", + "How is AFFiNE Alpha different?": "AFFiNE Alpha有何不同?", + "Invite": "邀请", + "Invite Members": "邀请成员", + "Invite placeholder": "搜索邮件(仅支持Gmail)", + "Jump to": "跳转到", + "Enable": "启用", + "Leave": "退出", + "Leave Workspace": "退出工作区", + "Leave Workspace Description": "退出后,您将无法再访问此工作区的内容。", + "Link": "超链接(选定文本)", + "Moved to Trash": "已移到垃圾箱", + "My Workspaces": "我的工作区", + "New Page": "新建页面", + "New Workspace": "新建工作区", + "No item": "无项目", + "Non-Gmail": "不支持非Gmail邮箱", + "NotLoggedIn": "当前未登录", + "Official Website": "官网", "Once deleted, you can't undo this action": { "": "一旦删除,将无法撤销!" }, - "Moved to Trash": "已移到垃圾箱", - "Permanently deleted": "已永久删除", - "restored": "{{title}} 已恢复", - "Cancel": "取消", - "Confirm": "确定", - "Keyboard Shortcuts": "键盘快捷键", - "Contact Us": "联系我们", - "Official Website": "官网", - "Get in touch!": "保持联络!", - "AFFiNE Community": "AFFiNE 社区", - "How is AFFiNE Alpha different?": "AFFiNE Alpha有何不同?", - "Shortcuts": "快捷键", - "Undo": "撤销", - "Redo": "重做", - "Bold": "粗体", - "Italic": "斜体", - "Underline": "下划线", - "Strikethrough": "删除线", - "Inline code": "行内代码", - "Code block": "代码块", - "Link": "超链接(选定文本)", - "Body text": "正文", - "Heading": "标题 {{number}}", - "Increase indent": "增加缩进", - "Reduce indent": "减少缩进", - "Markdown Syntax": "Markdown 语法", - "Divider": "分割线", - "404 - Page Not Found": "404 - 页面不见了", - "Remove from favourites": "从收藏中移除", - "Removed from Favourites": "已从收藏中移除", - "New Workspace": "新建工作区", - "Workspace description": "工作区是为个人和团队进行引用、创建和规划的虚拟空间。", - "Create": "创建", - "Select": "选择", - "Text": "文本(即将上线)", - "Shape": "图形", - "Sticky": "便利贴(即将上线)", + "Ooops!": "啊哦!", + "Created": "已创建", + "Delete Workspace Description": "正在删除 (<1>{{workspace}}) ,此操作无法撤销,所有内容将会丢失。", + "Export Workspace": "导出工作区 <1>{{workspace}} 即将上线", + "Find 0 result": "找到 0 个结果", + "Find results": "找到 {{number}} 个结果", + "Page": "页面", + "Paper": "文档", "Pen": "笔(即将上线)", - "Connector": "链接(即将上线)", - "Upload": "上传", - "Restore it": "恢复TA", - "TrashButtonGroupTitle": "永久删除", - "TrashButtonGroupDescription": "一旦删除,将无法撤消此操作。确定吗?", - "Delete permanently": "永久删除", + "Pending": "待定", + "Permanently deleted": "已永久删除", + "Publish": "发布", + "Publishing": "发布到web需要AFFiNE云服务。", + "Publish to web": "发布到web", + "Publishing Description": "发布到web后,所有人都可以通过链接查看此工作区的内容。", + "Quick search": "快速搜索", "Quick search placeholder": "快速搜索...", "Quick search placeholder2": "在{{workspace}} 中搜索", - "Settings": "设置", - "recommendBrowser": "建议使用 <1>Chrome 浏览器以获得最佳体验。", - "upgradeBrowser": "请升级到最新版本的 Chrome 以获得最佳体验。", - "Invite Members": "邀请成员", - "Invite placeholder": "搜索邮件(仅支持Gmail)", - "Non-Gmail": "不支持非Gmail邮箱", - "Invite": "邀请", - "Loading": "加载中...", - "NotLoggedIn": "当前未登录", - "ClearData": "清除本地数据", - "Continue with Google": "谷歌登录以继续", + "Select": "选择", "Set up an AFFiNE account to sync data": "设置AFFiNE帐户以同步数据", - "Stay logged out": "保持登出状态", - "All changes are saved locally": "所有改动已保存到本地", - "Ooops!": "啊哦!", - "mobile device": "貌似你正在移动设备上浏览。", - "mobile device description": "我们仍在进行移动端的支持工作,建议使用桌面设备。", - "Got it": "知道了", - "emptyAllPages": "此工作区为空。创建新页面并开始编辑。", - "emptyFavourite": "单击“添加到收藏夹”,页面将显示在此处。", - "emptyTrash": "单击“添加到垃圾箱”,页面将显示在此处。", - "still designed": "(此页面仍在设计中。)", - "My Workspaces": "我的工作区", - "Create Or Import": "创建或导入", - "Tips": "提示:", - "login success": "登录成功", - "Sign in": "登录 AFFiNE 云", - "Sign out": "登出 AFFiNE 云", - "Delete Workspace": "删除工作空间", - "Delete Workspace Description": "正在删除 (<1>{{workspace}}) ,此操作无法撤销,所有内容将会丢失。", - "Delete Workspace Description2": "正在删除(<1>{{workspace}}),将同时删除本地和云端数据。此操作无法撤消,请谨慎操作。", - "Delete Workspace placeholder": "请输入”Delete“以确认", - "Leave Workspace": "退出工作区", - "Leave Workspace Description": "退出后,您将无法再访问此工作区的内容。", - "Jump to": "跳转到", - "Leave": "退出", - "Workspace Icon": "工作区图标", - "Workspace Name": "工作区名称", - "Workspace Type": "工作区类型", - "Export Workspace": "导出工作区 <1>{{workspace}} 即将上线", - "Users": "用户", - "Access level": "访问权限", - "Pending": "待定", - "Collaboration Description": "与其他成员协作需要AFFiNE云服务支持。", - "Enable AFFiNE Cloud": "启用 AFFiNE 云服务", - "Enable AFFiNE Cloud Description": "如启用,此工作区中的数据将通过AFFiNE Cloud进行备份和同步。", - "Enable": "启动", - "Sign in and Enable": "登录并启用", - "Not now": "下次再说", - "Publishing": "发布到web需要AFFiNE云服务。", + "Settings": "设置", + "Shortcuts": "快捷键", "Share with link": "通过链接分享", - "Copy Link": "复制链接", - "Publishing Description": "发布到web后,所有人都可以通过链接查看此工作区的内容。", - "Export Description": "您可以导出整个Workspace数据进行备份,并且可以重新导入导出的数据。", + "Shape": "图形", + "Sign in": "登录 AFFiNE 云", + "Sign in and Enable": "登录并启用", + "Sign out": "登出 AFFiNE 云", + "Skip": "跳过", + "Stay logged out": "保持登出状态", + "Delete Workspace placeholder": "请输入”Delete“以确认", + "New Keyword Page": "新建 “{{query}}“ 为标题的页面 ", + "Sticky": "便利贴(即将上线)", "Stop publishing": "中止发布", - "Publish to web": "发布到web", - "Sync Description": "{{workspaceName}}是本地工作区,所有数据都存储在当前设备上。您可以为此工作区启用AFFiNE Cloud,以使数据与云端保持同步。", - "Sync Description2": "<1>{{workspaceName}}是云端工作区。所有数据将同步并保存到AFFiNE Cloud。", - "Download data to device": "下载{{CoreOrAll}}数据到设备", - "General": "常规", + "Strikethrough": "删除线", "Sync": "同步", - "Collaboration": "协作", - "Publish": "发布", + "Text": "文本(即将上线)", + "Tips": "提示:", + "Trash": "垃圾箱", + "TrashButtonGroupDescription": "一旦删除,将无法撤消此操作。确定吗?", + "Untitled": "未命名", + "TrashButtonGroupTitle": "永久删除", + "Updated": "已更新", + "Upload": "上传", + "Users": "用户", + "Workspace Icon": "工作区图标", + "Workspace Type": "工作区类型", + "Workspace description": "工作区是为个人和团队进行引用、创建和规划的虚拟空间。", "Workspace Settings": "工作区设置", - "core": "核心", + "Workspace Name": "工作区名称", + "emptyAllPages": "此工作区为空。创建新页面并开始编辑。", + "emptyFavorite": "单击“添加到收藏夹”,页面将显示在此处。", + "emptyTrash": "单击“添加到垃圾箱”,页面将显示在此处。", + "login success": "登录成功", + "mobile device": "貌似你正在移动设备上浏览。", + "Sync Description2": "<1>{{workspaceName}}是云端工作区。所有数据将同步并保存到AFFiNE Cloud。", + "mobile device description": "我们仍在进行移动端的支持工作,建议使用桌面设备。", + "restored": "{{title}} 已恢复", + "still designed": "(此页面仍在设计中。)", + "upgradeBrowser": "请升级到最新版本的 Chrome 以获得最佳体验。", + "will be moved to Trash": "{{title}} 将被移到垃圾箱", + "recommendBrowser": "建议使用 <1>Chrome 浏览器以获得最佳体验。", + "Connector": "链接(即将上线)", + "General": "常规", + "Restore it": "恢复TA", "all": "全部", - "A workspace is your virtual space to capture, create and plan as just one person or together as a team.": "工作空间是一个人或一个团队创建和计划的虚拟空间。", - "Export AFFINE backup file (coming soon)": "导出 AFFiNE 备份文件(即将上线)", - "Data sync mode": "数据同步模式", - "Download all data": "下载全部数据", - "It takes up more space on your device.": "占用设备更多空间。", - "Download core data": "下载核心数据", - "It takes up little space on your device.": "占用设备较少空间。" + "core": "核心", + "Sync Description": "{{workspaceName}}是本地工作区,所有数据都存储在当前设备上。您可以为此工作区启用AFFiNE Cloud,以使数据与云端保持同步。", + "Delete Workspace Description2": "正在删除(<1>{{workspace}}),将同时删除本地和云端数据。此操作无法撤消,请谨慎操作。", + "Failed to publish workspace": "工作区发布失败", + "Local Workspace Description": "所有数据都本地存储在当前设备。您可以为此工作区启用AFFiNE Cloud,以保证数据时刻被云端同步。", + "Member": "成员", + "Member has been removed": "{{name}} 已被移除。", + "Owner": "所有者", + "Published to Web": "公开到互联网", + "Retain local cached data": "保留本地缓存数据", + "Set a Workspace name": "设置工作区名字", + "Workspace Avatar": "工作区头像", + "is a Local Workspace": "是本地工作区" } diff --git a/packages/i18n/src/scripts/download.ts b/packages/i18n/src/scripts/download.ts index 7aa0740c6..eeb15c858 100644 --- a/packages/i18n/src/scripts/download.ts +++ b/packages/i18n/src/scripts/download.ts @@ -66,7 +66,7 @@ const main = async () => { ); const availableLanguages = languagesWithTranslations.filter( - language => language.completeRate === 1 + language => language.completeRate > 0.8 ); availableLanguages From a3eb4a42794e68d98a886984c50a204a88c9f973 Mon Sep 17 00:00:00 2001 From: DarkSky Date: Thu, 9 Feb 2023 17:40:13 +0800 Subject: [PATCH 22/24] chore: update cla description --- .github/CLA.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 22 ++++++++++++++++------ 2 files changed, 65 insertions(+), 6 deletions(-) create mode 100644 .github/CLA.md diff --git a/.github/CLA.md b/.github/CLA.md new file mode 100644 index 000000000..75c332982 --- /dev/null +++ b/.github/CLA.md @@ -0,0 +1,49 @@ +AFFiNE Contributor License Agreement + +To clarify the intellectual property license granted with contributions from any person or entity, AFFiNE must have on file a signed Contributor License Agreement ("CLA") from each contributor, indicating agreement with the license terms below. This agreement is for your protection as a contributor as well as the protection of the AFFiNE and its users; it does not change your rights to use your own contributions for any other purpose. + +You accept and agree to the following terms and conditions for your past, present and future contributions submitted to AFFiNE. You should sign this agreement before submitting your first contribution. Except for the license granted herein to AFFiNE and recipients of software distributed by AFFiNE , You reserve all right, title, and interest in and to Your Contributions. + +1. Parties. + +(a) “AFFiNE ” refers to the project’s operator, TOEVERYTHING PTE. LTD registered in Republic of Singapore. + +(b) “You” (or “Your”) means the copyright owner or legal entity authorized by the copyright owner that is making this Agreement with AFFiNE . + +2. Definitions. “Contribution” shall mean any original work of authorship, including any modifications or additions to an existing work, that is intentionally submitted by You to AFFiNE for inclusion in, or documentation of, any of the products owned or managed by AFFiNE (the “Work”). For the purposes of this definition, “submitted” means any form of electronic, verbal, or written communication sent to AFFiNE or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, AFFiNE for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by You as “Not a Contribution.” + +3. Grant of Copyright License. Subject to the terms and conditions of this Agreement, You hereby grant to AFFiNE and to recipients of software distributed by AFFiNE a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to use, copy, reproduce, prepare derivative works of, distribute, sublicense, and publicly perform and display the Contribution and such derivative works on any licensing terms, including without limitation open source licenses and binary, proprietary, or commercial licenses. + +4. Grant of Patent License. Subject to the terms and conditions of this Agreement, You hereby grant to AFFiNE and to recipients of software distributed by AFFiNE a perpetual, irrevocable, non-exclusive, worldwide, no-charge, royalty-free patent license to make, have made, use, sell, offer to sell, import, and otherwise transfer your Contribution in whole or in part, alone or in combination with or included in any product, work or materials arising out of the project to which your contribution was submitted, and to sublicense these same rights to third parties through multiple levels of sublicensees or other licensing arrangements. + +5. Except as set out above, You keep all right, title, and interest in your contribution. The rights that you grant to AFFiNE under these terms are effective on the date you first submitted a contribution to AFFiNE , even if your submission took place before the date you sign these terms. + +6. You promise that: + +- Each of Your Contributions is Your original work and that you are legally entitled to grant the above license. + +-Each of Your Contributions does not to the best of your knowledge violate any third party’s copyrights, trademarks, patents, or other intellectual property rights; + +- Your Contribution submissions include complete details of any third-party license or other restriction (including, but not limited to, related patents and trademarks) of which you are personally aware and which are associated with any part of Your Contributions. + +- If You are an individual and if your employer(s) has rights to intellectual property that you create that includes your Contributions, you represent that you have received permission to make Contributions on behalf of that employer, that your employer has waived such rights for your Contributions to AFFiNE , or that your employer has executed a separate Corporate CLA with AFFiNE . + +7. You provide Your Contributions on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + +8. You agree to notify AFFiNE of any facts or circumstances of which you become aware that would make these representations inaccurate in any respect. + +9. This Agreement will be governed by the laws of Republic of Singapore without reference to conflict of laws principles. + +## List of Contributors + +The below-signed are contributors to a code repository that is part of the project named "AFFiNE". Each below-signed contributor has read, understand and agrees to the terms above in the section within this document entitled "AFFiNE Contributor License Agreement" as of the date beside their real name (or entity name) and GitHub account name. + +--- + + + +- Dark Sky, @darkskygit, 2022/07/22 diff --git a/README.md b/README.md index 18ea94c95..012b996f7 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,8 @@ Before we tell you how to get started with AFFiNE, we'd like to shamelessly plug Calling all developers, testers, tech writers and more! Contributions of all types are more than welcome, you can read more in [docs/types-of-contributions.md](docs/types-of-contributions.md). If you are interested in contributing code, read our [docs/CONTRIBUTING.md](docs/CONTRIBUTING.md) and feel free to check out our GitHub issues to get stuck in to show us what you’re made of. +**Before you start contributing, please make sure you have read and accepted our [Contributor License Agreement]. To indicate your agreement, simply edit this file and submit a pull request.** + For **bug reports**, **feature requests** and other **suggestions** you can also [create a new issue](https://github.com/toeverything/AFFiNE/issues/new/choose) and choose the most appropiate template for your feedback. For **translation** and **language support** you can visit our [i18n General Space](https://community.affine.pro/c/i18n-general). @@ -197,15 +199,15 @@ Thanks a lot to the community for providing such powerful and simple libraries, ## Self-Host -Get started with Docker and deploy your own feature-rich, restriction-free deployment of AFFiNE - check the [latest packages](https://github.com/toeverything/AFFiNE/pkgs/container/affine-self-hosted). +Get started with Docker and deploy your own feature-rich, restriction-free deployment of AFFiNE - check the [latest packages]. ## Hiring -Some amazing companies including AFFiNE are looking for developers! Are you interested in helping build with AFFiNE and/or its partners? Check out some of the latest [jobs available](./docs/jobs/summary.md). +Some amazing companies including AFFiNE are looking for developers! Are you interested in helping build with AFFiNE and/or its partners? Check out some of the latest [jobs available]. ## Upgrading -For upgrading information please see our [update page](https://affine.pro/blog?tag=Release%20Note). +For upgrading information please see our [update page]. ## Feature Request @@ -213,12 +215,20 @@ For feature request please see https://community.affine.pro/c/feature-requests/ ## Is it awesome? -[These people](https://twitter.com/AffineOfficial/followers) seem to like it. +[These people] seem to like it. ## Building -See [BUILDING.md](./docs/BUILDING.md) for instructions on how to build AFFiNE from source code. +See [BUILDING.md] for instructions on how to build AFFiNE from source code. ## License -See [LICENSE](/LICENSE) for details. +See [LICENSE] for details. + +[license]: ./LICENSE +[building.md]: ./docs/BUILDING.md +[these people]: https://twitter.com/AffineOfficial/followers +[update page]: https://affine.pro/blog?tag=Release%20Note +[jobs available]: ./docs/jobs/summary.md +[latest packages]: https://github.com/toeverything/AFFiNE/pkgs/container/affine-self-hosted +[contributor license agreement]: https://github.com/toeverything/affine/edit/master/.github/CLA.md From a5216bf01cc2498dc4b7cb3016ab9ed10ce8cac3 Mon Sep 17 00:00:00 2001 From: DarkSky Date: Thu, 9 Feb 2023 17:42:40 +0800 Subject: [PATCH 23/24] chore: fix format --- .github/CLA.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/CLA.md b/.github/CLA.md index 75c332982..e9c1ec012 100644 --- a/.github/CLA.md +++ b/.github/CLA.md @@ -1,4 +1,4 @@ -AFFiNE Contributor License Agreement +## AFFiNE Contributor License Agreement To clarify the intellectual property license granted with contributions from any person or entity, AFFiNE must have on file a signed Contributor License Agreement ("CLA") from each contributor, indicating agreement with the license terms below. This agreement is for your protection as a contributor as well as the protection of the AFFiNE and its users; it does not change your rights to use your own contributions for any other purpose. @@ -6,9 +6,9 @@ You accept and agree to the following terms and conditions for your past, presen 1. Parties. -(a) “AFFiNE ” refers to the project’s operator, TOEVERYTHING PTE. LTD registered in Republic of Singapore. + (a) “AFFiNE ” refers to the project’s operator, TOEVERYTHING PTE. LTD registered in Republic of Singapore. -(b) “You” (or “Your”) means the copyright owner or legal entity authorized by the copyright owner that is making this Agreement with AFFiNE . + (b) “You” (or “Your”) means the copyright owner or legal entity authorized by the copyright owner that is making this Agreement with AFFiNE . 2. Definitions. “Contribution” shall mean any original work of authorship, including any modifications or additions to an existing work, that is intentionally submitted by You to AFFiNE for inclusion in, or documentation of, any of the products owned or managed by AFFiNE (the “Work”). For the purposes of this definition, “submitted” means any form of electronic, verbal, or written communication sent to AFFiNE or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, AFFiNE for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by You as “Not a Contribution.” From 18e1eecefc63ecc3abb772e0e5a8914370271e12 Mon Sep 17 00:00:00 2001 From: Yifeng Wang Date: Thu, 9 Feb 2023 17:52:00 +0800 Subject: [PATCH 24/24] docs: cleanup cla format (#934) --- .github/CLA.md | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/.github/CLA.md b/.github/CLA.md index e9c1ec012..22324966d 100644 --- a/.github/CLA.md +++ b/.github/CLA.md @@ -1,34 +1,33 @@ -## AFFiNE Contributor License Agreement + + +# AFFiNE Contributor License Agreement To clarify the intellectual property license granted with contributions from any person or entity, AFFiNE must have on file a signed Contributor License Agreement ("CLA") from each contributor, indicating agreement with the license terms below. This agreement is for your protection as a contributor as well as the protection of the AFFiNE and its users; it does not change your rights to use your own contributions for any other purpose. -You accept and agree to the following terms and conditions for your past, present and future contributions submitted to AFFiNE. You should sign this agreement before submitting your first contribution. Except for the license granted herein to AFFiNE and recipients of software distributed by AFFiNE , You reserve all right, title, and interest in and to Your Contributions. +You accept and agree to the following terms and conditions for your past, present and future contributions submitted to AFFiNE. You should sign this agreement before submitting your first contribution. Except for the license granted herein to AFFiNE and recipients of software distributed by AFFiNE, You reserve all right, title, and interest in and to Your Contributions. 1. Parties. - (a) “AFFiNE ” refers to the project’s operator, TOEVERYTHING PTE. LTD registered in Republic of Singapore. + (a) "AFFiNE" refers to the project's operator, TOEVERYTHING PTE. LTD registered in Republic of Singapore. - (b) “You” (or “Your”) means the copyright owner or legal entity authorized by the copyright owner that is making this Agreement with AFFiNE . + (b) "You" (or "Your") means the copyright owner or legal entity authorized by the copyright owner that is making this Agreement with AFFiNE. -2. Definitions. “Contribution” shall mean any original work of authorship, including any modifications or additions to an existing work, that is intentionally submitted by You to AFFiNE for inclusion in, or documentation of, any of the products owned or managed by AFFiNE (the “Work”). For the purposes of this definition, “submitted” means any form of electronic, verbal, or written communication sent to AFFiNE or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, AFFiNE for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by You as “Not a Contribution.” +2. Definitions. "Contribution" shall mean any original work of authorship, including any modifications or additions to an existing work, that is intentionally submitted by You to AFFiNE for inclusion in, or documentation of, any of the products owned or managed by AFFiNE (the "Work"). For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to AFFiNE or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, AFFiNE for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by You as "Not a Contribution". 3. Grant of Copyright License. Subject to the terms and conditions of this Agreement, You hereby grant to AFFiNE and to recipients of software distributed by AFFiNE a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to use, copy, reproduce, prepare derivative works of, distribute, sublicense, and publicly perform and display the Contribution and such derivative works on any licensing terms, including without limitation open source licenses and binary, proprietary, or commercial licenses. 4. Grant of Patent License. Subject to the terms and conditions of this Agreement, You hereby grant to AFFiNE and to recipients of software distributed by AFFiNE a perpetual, irrevocable, non-exclusive, worldwide, no-charge, royalty-free patent license to make, have made, use, sell, offer to sell, import, and otherwise transfer your Contribution in whole or in part, alone or in combination with or included in any product, work or materials arising out of the project to which your contribution was submitted, and to sublicense these same rights to third parties through multiple levels of sublicensees or other licensing arrangements. -5. Except as set out above, You keep all right, title, and interest in your contribution. The rights that you grant to AFFiNE under these terms are effective on the date you first submitted a contribution to AFFiNE , even if your submission took place before the date you sign these terms. +5. Except as set out above, You keep all right, title, and interest in your contribution. The rights that you grant to AFFiNE under these terms are effective on the date you first submitted a contribution to AFFiNE, even if your submission took place before the date you sign these terms. 6. You promise that: - Each of Your Contributions is Your original work and that you are legally entitled to grant the above license. - --Each of Your Contributions does not to the best of your knowledge violate any third party’s copyrights, trademarks, patents, or other intellectual property rights; - +- Each of Your Contributions does not to the best of your knowledge violate any third party's copyrights, trademarks, patents, or other intellectual property rights; - Your Contribution submissions include complete details of any third-party license or other restriction (including, but not limited to, related patents and trademarks) of which you are personally aware and which are associated with any part of Your Contributions. +- If You are an individual and if your employer(s) has rights to intellectual property that you create that includes your Contributions, you represent that you have received permission to make Contributions on behalf of that employer, that your employer has waived such rights for your Contributions to AFFiNE, or that your employer has executed a separate Corporate CLA with AFFiNE. -- If You are an individual and if your employer(s) has rights to intellectual property that you create that includes your Contributions, you represent that you have received permission to make Contributions on behalf of that employer, that your employer has waived such rights for your Contributions to AFFiNE , or that your employer has executed a separate Corporate CLA with AFFiNE . - -7. You provide Your Contributions on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. +7. You provide Your Contributions on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. 8. You agree to notify AFFiNE of any facts or circumstances of which you become aware that would make these representations inaccurate in any respect.