From 670c5a56d60b5eebab3869215280d6f336498101 Mon Sep 17 00:00:00 2001 From: Mohammed Faraz <92734739+MuhammedFaraz@users.noreply.github.com> Date: Thu, 1 Sep 2022 15:52:07 +0530 Subject: [PATCH 01/16] CONTRIBUTING.md file updated --- docs/CONTRIBUTING.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 94806e00f8..9af71d88bd 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -2,11 +2,11 @@ Thank you for investing your time in contributing to our project! Any contribution you make will be reflected on our GitHub :sparkles:. -Read our [Code of Conduct](./CODE_OF_CONDUCT.md) to keep our community approachable and respectable. +Read our [Code of Conduct](./CODE_OF_CONDUCT.md) to keep our community approachable and respectable. Join our [dicord](https://discord.com/invite/yz6tGVsf5p) server for more. In this guide you will get an overview of the contribution workflow from opening an issue, creating a PR, reviewing, and merging the PR. -Use the table of contents icon on the top left corner of this document to get to a specific section of this guide quickly. +Use the table of contents icon on the top left corner of this document to get to a specific section of this guide quickly. ## New contributor guide @@ -63,6 +63,8 @@ For more information about using a codespace for working on GitHub documentation Commit the changes once you are happy with them. +Reach out the community members for necessary help. + Once your changes are ready, don't forget to self-review to speed up the review process:zap:. ### Pull Request @@ -81,6 +83,6 @@ When you're finished with the changes, create a pull request, also known as a PR Congratulations :tada::tada: The AFFiNE team thanks you :sparkles:. -Once your PR is merged, your contributions will be publicly visible on the our GitHub. +Once your PR is merged, your contributions will be publicly visible on our GitHub. Now that you are part of the AFFiNE community, see how else you can join and help over at [Gitbook](https://docs.affine.pro/affine/) From e186957e5565fba5d9445e0bc79dbf5b198856d4 Mon Sep 17 00:00:00 2001 From: Whitewater Date: Fri, 2 Sep 2022 14:22:38 +0800 Subject: [PATCH 02/16] chore: lint --- docs/CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 9af71d88bd..b76594f7f6 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -6,7 +6,7 @@ Read our [Code of Conduct](./CODE_OF_CONDUCT.md) to keep our community approacha In this guide you will get an overview of the contribution workflow from opening an issue, creating a PR, reviewing, and merging the PR. -Use the table of contents icon on the top left corner of this document to get to a specific section of this guide quickly. +Use the table of contents icon on the top left corner of this document to get to a specific section of this guide quickly. ## New contributor guide From 1e68c9c090cb1c045758b5d15c046b24fb0b0ed3 Mon Sep 17 00:00:00 2001 From: Whitewater Date: Fri, 2 Sep 2022 14:34:07 +0800 Subject: [PATCH 03/16] chore: prettier --- docs/CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index b76594f7f6..5dfbae23c6 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -63,7 +63,7 @@ For more information about using a codespace for working on GitHub documentation Commit the changes once you are happy with them. -Reach out the community members for necessary help. +Reach out the community members for necessary help. Once your changes are ready, don't forget to self-review to speed up the review process:zap:. From 9b54ffdb64ac1a47aca626c952a0b299a0915776 Mon Sep 17 00:00:00 2001 From: Whitewater Date: Fri, 2 Sep 2022 07:39:23 +0000 Subject: [PATCH 04/16] chore: update contributor --- .all-contributorsrc | 19 +++++++++++++++++++ README.md | 12 +++++++----- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 8993984505..4b1cc35879 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -12,6 +12,16 @@ "contributorsPerLine": 7, "badgeTemplate": "\n[all-contributors-badge]: https://img.shields.io/badge/all_contributors-<%= contributors.length %>-orange.svg?style=flat-square\n", "contributors": [ + { + "login": "doodlewind", + "name": "Yifeng Wang", + "avatar_url": "https://avatars.githubusercontent.com/u/7312949?v=4", + "profile": "https://github.com/doodlewind", + "contributions": [ + "code", + "doc" + ] + }, { "login": "darkskygit", "name": "DarkSky", @@ -303,6 +313,15 @@ "contributions": [ "code" ] + }, + { + "login": "felixonmars", + "name": "Felix Yan", + "avatar_url": "https://avatars.githubusercontent.com/u/1006477?v=4", + "profile": "https://felixc.at/", + "contributions": [ + "code" + ] } ] } diff --git a/README.md b/README.md index f46f41fca8..d4f92bc519 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ See https://github.com/all-?/all-contributors/issues/361#issuecomment-637166066 --> -[all-contributors-badge]: https://img.shields.io/badge/all_contributors-31-orange.svg?style=flat-square +[all-contributors-badge]: https://img.shields.io/badge/all_contributors-33-orange.svg?style=flat-square @@ -147,45 +147,47 @@ Thanks a lot to the community for providing such powerful and simple libraries, + - + - + - + - + +

Yifeng Wang

💻 📖

DarkSky

💻 📖

Chi Zhang

💻 📖

wang xinglong

💻 📖

DiamondThree

💻 📖

Whitewater

💻 📖

xiaodong zuo

💻 📖

MingLIang Wang

💻 📖

MingLIang Wang

💻 📖

Qi

💻 📖

mitsuhatu

💻 📖

Austaras

💻 📖

Jin Yao

💻 📖

HeJiachen-PM

📖

Yipei Wei

📖

fanjing22

🎨

fanjing22

🎨

Svaney

🎨

Guozhu Liu

🎨

fyZheng07

📋 📓

CJSS

📖

Carlos Rafael

💻

Caleb OLeary

💻

JimmFly

💻

JimmFly

💻

Weston Graham

📖

pointmax

📖

Bryan Lee

💻

Simon Li

💻

Bob Hu

💻

Quavo

📖

子瞻 Luci

💻

子瞻 Luci

💻

Horus

💻 📦

Super.x

💻

Wang Yu

💻

Felix Yan

💻
From 14a3cdff41fc1e23474a9d4ec218c92501be71e6 Mon Sep 17 00:00:00 2001 From: mitsuha Date: Fri, 2 Sep 2022 15:59:24 +0800 Subject: [PATCH 05/16] 1.adjust export/import database; --- .../layout/src/header/FileSystem.tsx | 42 +++------ .../layout/src/header/LayoutHeader.tsx | 3 - .../Settings/use-setting-flags.ts | 4 +- .../settings-sidebar/Settings/use-settings.ts | 16 ++-- .../Settings/util/inspector-workspace.ts | 8 +- .../db-service/src/services/database/index.ts | 2 +- .../src/services/workspace/user-config.ts | 2 +- libs/datasource/jwt/src/index.ts | 2 +- libs/datasource/jwt/src/yjs/index.ts | 88 ++++++++++--------- libs/datasource/state/src/user.ts | 38 ++------ 10 files changed, 89 insertions(+), 116 deletions(-) diff --git a/libs/components/layout/src/header/FileSystem.tsx b/libs/components/layout/src/header/FileSystem.tsx index 30c2b68816..c143e6f3f1 100644 --- a/libs/components/layout/src/header/FileSystem.tsx +++ b/libs/components/layout/src/header/FileSystem.tsx @@ -80,34 +80,20 @@ export const FileSystem = () => { if (apiSupported && !selected) { return ( - <> - setError(false)} - > - - - } - /> - { - try { - await requestPermission('AFFiNE'); - onSelected(); - } catch (e) { - onError(); - } - }} - > - {t('Sync to Disk')} - - + setError(false)} + > + + + } + /> ); } return null; diff --git a/libs/components/layout/src/header/LayoutHeader.tsx b/libs/components/layout/src/header/LayoutHeader.tsx index 9619c97c84..4c17564d9c 100644 --- a/libs/components/layout/src/header/LayoutHeader.tsx +++ b/libs/components/layout/src/header/LayoutHeader.tsx @@ -70,9 +70,6 @@ export const LayoutHeader = () => { - - {warningTips} - ); }; diff --git a/libs/components/layout/src/settings-sidebar/Settings/use-setting-flags.ts b/libs/components/layout/src/settings-sidebar/Settings/use-setting-flags.ts index e0a7fb697c..ff3136b230 100644 --- a/libs/components/layout/src/settings-sidebar/Settings/use-setting-flags.ts +++ b/libs/components/layout/src/settings-sidebar/Settings/use-setting-flags.ts @@ -2,8 +2,8 @@ import { useFlag } from '@toeverything/datasource/feature-flags'; export const useSettingFlags = () => { const booleanFullWidthChecked = useFlag('BooleanFullWidthChecked', false); - const booleanExportWorkspace = useFlag('BooleanExportWorkspace', false); - const booleanImportWorkspace = useFlag('BooleanImportWorkspace', false); + const booleanExportWorkspace = useFlag('BooleanExportAffineDb', true); + const booleanImportWorkspace = useFlag('BooleanImportAffineDb', true); const booleanExportHtml = useFlag('BooleanExportHtml', false); const booleanExportPdf = useFlag('BooleanExportPdf', false); const booleanExportMarkdown = useFlag('BooleanExportMarkdown', false); diff --git a/libs/components/layout/src/settings-sidebar/Settings/use-settings.ts b/libs/components/layout/src/settings-sidebar/Settings/use-settings.ts index dfd8918c49..2b32794424 100644 --- a/libs/components/layout/src/settings-sidebar/Settings/use-settings.ts +++ b/libs/components/layout/src/settings-sidebar/Settings/use-settings.ts @@ -145,12 +145,19 @@ export const useSettings = (): SettingItem[] => { type: 'separator', key: 'separator2', }, + { + type: 'button', + name: t('Clear Workspace'), + key: 'Clear Workspace', + onClick: () => clearWorkspace(workspaceId), + flag: 'booleanClearWorkspace', + }, { type: 'button', name: t('Import Workspace'), key: 'Import Workspace', onClick: () => importWorkspace(workspaceId), - flag: 'booleanImportWorkspace', + flag: 'booleanClearWorkspace', }, { type: 'button', @@ -159,13 +166,6 @@ export const useSettings = (): SettingItem[] => { onClick: () => exportWorkspace(), flag: 'booleanExportWorkspace', }, - { - type: 'button', - name: t('Clear Workspace'), - key: 'Clear Workspace', - onClick: () => clearWorkspace(workspaceId), - flag: 'booleanClearWorkspace', - }, ]; return filterSettings(settings, settingFlags); diff --git a/libs/components/layout/src/settings-sidebar/Settings/util/inspector-workspace.ts b/libs/components/layout/src/settings-sidebar/Settings/util/inspector-workspace.ts index ee851dc90c..25adfdd669 100644 --- a/libs/components/layout/src/settings-sidebar/Settings/util/inspector-workspace.ts +++ b/libs/components/layout/src/settings-sidebar/Settings/util/inspector-workspace.ts @@ -6,8 +6,12 @@ export const importWorkspace = (workspaceId: string) => { window.client .inspector() .load() - .then(() => { - window.location.href = `/${workspaceId}/`; + .then(status => { + if (status) { + if (window.confirm('Your currently open data will be lost.')) { + window.location.href = `/${workspaceId}/`; + } + } }); }; diff --git a/libs/datasource/db-service/src/services/database/index.ts b/libs/datasource/db-service/src/services/database/index.ts index 3d70345f0f..dbbe23bb9e 100644 --- a/libs/datasource/db-service/src/services/database/index.ts +++ b/libs/datasource/db-service/src/services/database/index.ts @@ -39,7 +39,7 @@ async function _getCurrentToken() { const _enabled = { demo: [], - AFFiNE: ['sqlite'], + AFFiNE: ['idb'], } as any; async function _getBlockDatabase( diff --git a/libs/datasource/db-service/src/services/workspace/user-config.ts b/libs/datasource/db-service/src/services/workspace/user-config.ts index 5a52581c21..fbe74ce83d 100644 --- a/libs/datasource/db-service/src/services/workspace/user-config.ts +++ b/libs/datasource/db-service/src/services/workspace/user-config.ts @@ -36,7 +36,7 @@ export class UserConfig extends ServiceBaseClass { } const db = await this.database.getDatabase(workspace); - const newPage = await db.get('page'); + const newPage = await db.get_named_block('start-page'); await this.get_dependency(PageTree).addPage(workspace, newPage.id); await this.addRecentPage(workspace, userId, newPage.id); diff --git a/libs/datasource/jwt/src/index.ts b/libs/datasource/jwt/src/index.ts index e8f3483e23..5c74ae8b99 100644 --- a/libs/datasource/jwt/src/index.ts +++ b/libs/datasource/jwt/src/index.ts @@ -357,7 +357,7 @@ export class BlockClient< * @param name block name * @returns block instance */ - private async get_named_block( + public async get_named_block( name: string, options?: { workspace?: boolean } ): Promise> { diff --git a/libs/datasource/jwt/src/yjs/index.ts b/libs/datasource/jwt/src/yjs/index.ts index 7d0f30e4e3..b94f7009ea 100644 --- a/libs/datasource/jwt/src/yjs/index.ts +++ b/libs/datasource/jwt/src/yjs/index.ts @@ -324,53 +324,59 @@ export class YjsAdapter implements AsyncDatabaseAdapter { const binary = encodeStateAsUpdate(this._doc); saveAs( new Blob([binary]), - `affine_workspace_${new Date().toDateString()}.apk` + `affine_workspace_${new Date().toDateString()}.affine` ); }, load: async () => { - const handles = await window.showOpenFilePicker({ - types: [ - { - description: 'AFFiNE Package', - accept: { - // eslint-disable-next-line @typescript-eslint/naming-convention - 'application/affine': ['.apk'], + try { + const handles = await window.showOpenFilePicker({ + types: [ + { + description: 'AFFiNE Package', + accept: { + // eslint-disable-next-line @typescript-eslint/naming-convention + 'application/affine': ['.affine'], + }, }, - }, - ], - }); - const [file] = (await fromEvent(handles)) as File[]; - const binary = await file?.arrayBuffer(); - // await this._provider.idb.clearData(); - const doc = new Doc({ autoLoad: true, shouldLoad: true }); - let updated = 0; - let isUpdated = false; - doc.on('update', () => { - isUpdated = true; - updated += 1; - }); - setInterval(() => { - if (updated > 0) { - updated -= 1; - } - }, 500); - - const update_check = new Promise(resolve => { - const check = async () => { - while (!isUpdated || updated > 0) { - await sleep(); + ], + }); + const [file] = (await fromEvent(handles)) as File[]; + const binary = await file?.arrayBuffer(); + // await this._provider.idb.clearData(); + const doc = new Doc({ autoLoad: true, shouldLoad: true }); + let updated = 0; + let isUpdated = false; + doc.on('update', () => { + isUpdated = true; + updated += 1; + }); + setInterval(() => { + if (updated > 0) { + updated -= 1; } - resolve(); - }; - check(); - }); - // await new IndexedDBProvider(this._provider.idb.name, doc) - // .whenSynced; - if (binary) { - applyUpdate(doc, new Uint8Array(binary)); - await update_check; + }, 500); + + const update_check = new Promise(resolve => { + const check = async () => { + while (!isUpdated || updated > 0) { + await sleep(); + } + resolve(); + }; + check(); + }); + // await new IndexedDBProvider(this._provider.idb.name, doc) + // .whenSynced; + if (binary) { + applyUpdate(doc, new Uint8Array(binary)); + await update_check; + } + console.log('load success'); + + return true; + } catch (err) { + return false; } - console.log('load success'); }, parse: () => this._doc.toJSON(), // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/libs/datasource/state/src/user.ts b/libs/datasource/state/src/user.ts index 61893471de..953603ef2b 100644 --- a/libs/datasource/state/src/user.ts +++ b/libs/datasource/state/src/user.ts @@ -74,41 +74,21 @@ const _useUserAndSpacesForFreeLogin = () => { if (location.pathname.startsWith('/local')) { navigate('/local'); } else { - navigate('/demo'); + navigate(`/${BRAND_ID}`); } setLoading(false); } }, []); useEffect(() => { - if (localTrigger) { - setUser({ - photo: '', - id: BRAND_ID, - username: BRAND_ID, - nickname: BRAND_ID, - email: '', - }); - } else { - if (location.pathname.startsWith('/local')) { - setUser({ - photo: '', - id: 'local', - username: 'local', - nickname: 'local', - email: '', - }); - } else { - setUser({ - photo: '', - id: 'demo', - username: 'demo', - nickname: 'demo', - email: '', - }); - } - } - }, [localTrigger, location, setLoading, setUser]); + setUser({ + photo: '', + id: BRAND_ID, + username: BRAND_ID, + nickname: BRAND_ID, + email: '', + }); + }, [setUser]); const currentSpaceId: string | undefined = useMemo(() => user?.id, [user]); From 67698a7e3e41148991e0f163047b7c03669ed237 Mon Sep 17 00:00:00 2001 From: mitsuha Date: Fri, 2 Sep 2022 17:33:00 +0800 Subject: [PATCH 06/16] 1.hide AddView; --- .../editor-blocks/src/blocks/group/group-menu/MainMenu.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/components/editor-blocks/src/blocks/group/group-menu/MainMenu.tsx b/libs/components/editor-blocks/src/blocks/group/group-menu/MainMenu.tsx index 92aa53566e..43b819aabe 100644 --- a/libs/components/editor-blocks/src/blocks/group/group-menu/MainMenu.tsx +++ b/libs/components/editor-blocks/src/blocks/group/group-menu/MainMenu.tsx @@ -82,7 +82,7 @@ const GroupMenuWrapper = ({ content={ - + {/**/} { // // Closed beta period temporarily // filterSorterFlag && ( From 3b1263447fdbc8d74ab048376c779e7735dffc2e Mon Sep 17 00:00:00 2001 From: mitsuha Date: Fri, 2 Sep 2022 18:32:26 +0800 Subject: [PATCH 07/16] 1.adjust code style. --- .../layout/src/header/FileSystem.tsx | 46 ++++++++++++------- .../layout/src/header/LayoutHeader.tsx | 3 +- .../layout/src/header/PageSettingPortal.tsx | 22 ++++----- .../Settings/use-setting-flags.ts | 4 -- .../settings-sidebar/Settings/use-settings.ts | 4 +- .../Settings/util/inspector-workspace.ts | 23 +++++----- .../src/services/workspace/user-config.ts | 2 +- libs/datasource/jwt/src/index.ts | 4 +- libs/datasource/jwt/src/yjs/index.ts | 1 - 9 files changed, 54 insertions(+), 55 deletions(-) diff --git a/libs/components/layout/src/header/FileSystem.tsx b/libs/components/layout/src/header/FileSystem.tsx index c143e6f3f1..016b26d1c4 100644 --- a/libs/components/layout/src/header/FileSystem.tsx +++ b/libs/components/layout/src/header/FileSystem.tsx @@ -4,7 +4,7 @@ import { CloseIcon } from '@toeverything/components/common'; import { IconButton, MuiSnackbar, styled } from '@toeverything/components/ui'; import { services } from '@toeverything/datasource/db-service'; import { useLocalTrigger } from '@toeverything/datasource/state'; -import { useTranslation } from 'react-i18next'; + const cleanupWorkspace = (workspace: string) => new Promise((resolve, reject) => { const req = indexedDB.deleteDatabase(workspace); @@ -75,25 +75,39 @@ export const FileSystem = () => { setError(true); setTimeout(() => setError(false), 3000); }, []); - const { t } = useTranslation(); + const apiSupported = useMemo(() => fsApiSupported(), []); if (apiSupported && !selected) { return ( - setError(false)} - > - - - } - /> + <> + setError(false)} + > + + + } + /> + { + try { + await requestPermission('AFFiNE'); + onSelected(); + } catch (e) { + onError(); + } + }} + > + Sync to Disk + + ); } return null; diff --git a/libs/components/layout/src/header/LayoutHeader.tsx b/libs/components/layout/src/header/LayoutHeader.tsx index 4c17564d9c..c9e7b7b8da 100644 --- a/libs/components/layout/src/header/LayoutHeader.tsx +++ b/libs/components/layout/src/header/LayoutHeader.tsx @@ -14,7 +14,7 @@ import { import { useTranslation } from 'react-i18next'; import { EditorBoardSwitcher } from './EditorBoardSwitcher'; -import { FileSystem, fsApiSupported } from './FileSystem'; +import { fsApiSupported } from './FileSystem'; import { CurrentPageTitle } from './Title'; export const LayoutHeader = () => { @@ -44,7 +44,6 @@ export const LayoutHeader = () => { - {t('Share')}
)} - {BooleanImportWorkspace && ( - - )} - {BooleanExportWorkspace && ( - - )} + +

Last edited by {user && user.nickname} diff --git a/libs/components/layout/src/settings-sidebar/Settings/use-setting-flags.ts b/libs/components/layout/src/settings-sidebar/Settings/use-setting-flags.ts index ff3136b230..532417de03 100644 --- a/libs/components/layout/src/settings-sidebar/Settings/use-setting-flags.ts +++ b/libs/components/layout/src/settings-sidebar/Settings/use-setting-flags.ts @@ -2,8 +2,6 @@ import { useFlag } from '@toeverything/datasource/feature-flags'; export const useSettingFlags = () => { const booleanFullWidthChecked = useFlag('BooleanFullWidthChecked', false); - const booleanExportWorkspace = useFlag('BooleanExportAffineDb', true); - const booleanImportWorkspace = useFlag('BooleanImportAffineDb', true); const booleanExportHtml = useFlag('BooleanExportHtml', false); const booleanExportPdf = useFlag('BooleanExportPdf', false); const booleanExportMarkdown = useFlag('BooleanExportMarkdown', false); @@ -11,8 +9,6 @@ export const useSettingFlags = () => { return { booleanFullWidthChecked, - booleanExportWorkspace, - booleanImportWorkspace, booleanExportHtml, booleanExportPdf, booleanExportMarkdown, diff --git a/libs/components/layout/src/settings-sidebar/Settings/use-settings.ts b/libs/components/layout/src/settings-sidebar/Settings/use-settings.ts index 2b32794424..53b075db74 100644 --- a/libs/components/layout/src/settings-sidebar/Settings/use-settings.ts +++ b/libs/components/layout/src/settings-sidebar/Settings/use-settings.ts @@ -156,15 +156,13 @@ export const useSettings = (): SettingItem[] => { type: 'button', name: t('Import Workspace'), key: 'Import Workspace', - onClick: () => importWorkspace(workspaceId), - flag: 'booleanClearWorkspace', + onClick: () => importWorkspace(), }, { type: 'button', name: t('Export Workspace'), key: 'Export Workspace', onClick: () => exportWorkspace(), - flag: 'booleanExportWorkspace', }, ]; diff --git a/libs/components/layout/src/settings-sidebar/Settings/util/inspector-workspace.ts b/libs/components/layout/src/settings-sidebar/Settings/util/inspector-workspace.ts index 25adfdd669..6cbd275a01 100644 --- a/libs/components/layout/src/settings-sidebar/Settings/util/inspector-workspace.ts +++ b/libs/components/layout/src/settings-sidebar/Settings/util/inspector-workspace.ts @@ -1,18 +1,17 @@ /** * @deprecated debugging method, deprecated */ -export const importWorkspace = (workspaceId: string) => { - //@ts-ignore - window.client - .inspector() - .load() - .then(status => { - if (status) { - if (window.confirm('Your currently open data will be lost.')) { - window.location.href = `/${workspaceId}/`; - } - } - }); +export const importWorkspace = async () => { + if (window.confirm('Your currently open data will be lost.')) { + //@ts-ignore + const status = await window.client.inspector().load(); + + console.log(status); + + if (status) { + window.location.reload(); + } + } }; /** diff --git a/libs/datasource/db-service/src/services/workspace/user-config.ts b/libs/datasource/db-service/src/services/workspace/user-config.ts index fbe74ce83d..7251659314 100644 --- a/libs/datasource/db-service/src/services/workspace/user-config.ts +++ b/libs/datasource/db-service/src/services/workspace/user-config.ts @@ -36,7 +36,7 @@ export class UserConfig extends ServiceBaseClass { } const db = await this.database.getDatabase(workspace); - const newPage = await db.get_named_block('start-page'); + const newPage = await db.getNamedBlock('start-page'); await this.get_dependency(PageTree).addPage(workspace, newPage.id); await this.addRecentPage(workspace, userId, newPage.id); diff --git a/libs/datasource/jwt/src/index.ts b/libs/datasource/jwt/src/index.ts index 5c74ae8b99..626e6a3c89 100644 --- a/libs/datasource/jwt/src/index.ts +++ b/libs/datasource/jwt/src/index.ts @@ -357,7 +357,7 @@ export class BlockClient< * @param name block name * @returns block instance */ - public async get_named_block( + public async getNamedBlock( name: string, options?: { workspace?: boolean } ): Promise> { @@ -376,7 +376,7 @@ export class BlockClient< */ public async getWorkspace() { if (!this._root.node) { - this._root.node = await this.get_named_block(this._workspace, { + this._root.node = await this.getNamedBlock(this._workspace, { workspace: true, }); } diff --git a/libs/datasource/jwt/src/yjs/index.ts b/libs/datasource/jwt/src/yjs/index.ts index b94f7009ea..9b6fa3c3d9 100644 --- a/libs/datasource/jwt/src/yjs/index.ts +++ b/libs/datasource/jwt/src/yjs/index.ts @@ -371,7 +371,6 @@ export class YjsAdapter implements AsyncDatabaseAdapter { applyUpdate(doc, new Uint8Array(binary)); await update_check; } - console.log('load success'); return true; } catch (err) { From ec99dca594cf0e3c69f3c1ce7b80f008e9a00076 Mon Sep 17 00:00:00 2001 From: mitsuha Date: Fri, 2 Sep 2022 18:39:26 +0800 Subject: [PATCH 08/16] 1.adjust code style. --- libs/components/layout/src/header/FileSystem.tsx | 6 +++--- .../settings-sidebar/Settings/util/inspector-workspace.ts | 2 -- libs/datasource/state/src/user.ts | 6 +----- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/libs/components/layout/src/header/FileSystem.tsx b/libs/components/layout/src/header/FileSystem.tsx index 016b26d1c4..30c2b68816 100644 --- a/libs/components/layout/src/header/FileSystem.tsx +++ b/libs/components/layout/src/header/FileSystem.tsx @@ -4,7 +4,7 @@ import { CloseIcon } from '@toeverything/components/common'; import { IconButton, MuiSnackbar, styled } from '@toeverything/components/ui'; import { services } from '@toeverything/datasource/db-service'; import { useLocalTrigger } from '@toeverything/datasource/state'; - +import { useTranslation } from 'react-i18next'; const cleanupWorkspace = (workspace: string) => new Promise((resolve, reject) => { const req = indexedDB.deleteDatabase(workspace); @@ -75,7 +75,7 @@ export const FileSystem = () => { setError(true); setTimeout(() => setError(false), 3000); }, []); - + const { t } = useTranslation(); const apiSupported = useMemo(() => fsApiSupported(), []); if (apiSupported && !selected) { @@ -105,7 +105,7 @@ export const FileSystem = () => { } }} > - Sync to Disk + {t('Sync to Disk')} ); diff --git a/libs/components/layout/src/settings-sidebar/Settings/util/inspector-workspace.ts b/libs/components/layout/src/settings-sidebar/Settings/util/inspector-workspace.ts index 6cbd275a01..c1edd95c65 100644 --- a/libs/components/layout/src/settings-sidebar/Settings/util/inspector-workspace.ts +++ b/libs/components/layout/src/settings-sidebar/Settings/util/inspector-workspace.ts @@ -6,8 +6,6 @@ export const importWorkspace = async () => { //@ts-ignore const status = await window.client.inspector().load(); - console.log(status); - if (status) { window.location.reload(); } diff --git a/libs/datasource/state/src/user.ts b/libs/datasource/state/src/user.ts index 953603ef2b..063f9f7f04 100644 --- a/libs/datasource/state/src/user.ts +++ b/libs/datasource/state/src/user.ts @@ -71,11 +71,7 @@ const _useUserAndSpacesForFreeLogin = () => { useEffect(() => { if (loading) { - if (location.pathname.startsWith('/local')) { - navigate('/local'); - } else { - navigate(`/${BRAND_ID}`); - } + navigate(`/${BRAND_ID}`); setLoading(false); } }, []); From 3118ab4326d2e22985f1276f3f1712286941bd16 Mon Sep 17 00:00:00 2001 From: tzhangchi Date: Sat, 3 Sep 2022 16:19:16 +0800 Subject: [PATCH 09/16] feat(template): update template config when user firstly onboarding --- .../services/editor-block/templates/get-started-group2.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/datasource/db-service/src/services/editor-block/templates/get-started-group2.json b/libs/datasource/db-service/src/services/editor-block/templates/get-started-group2.json index b98c0e2fcb..fc6f534086 100644 --- a/libs/datasource/db-service/src/services/editor-block/templates/get-started-group2.json +++ b/libs/datasource/db-service/src/services/editor-block/templates/get-started-group2.json @@ -111,7 +111,9 @@ "type": "text", "properties": { "text": { - "value": [{ "text": "Type @ to mention people" }] + "value": [ + { "text": " Open Tag App`AFFiNE` to mention people" } + ] }, "recastValues": { "bNjVwBq8YLxvmvr7": { From 8c2bb2a5fb42f5b03984005ed3f06aae51848dfc Mon Sep 17 00:00:00 2001 From: CJSS Date: Mon, 5 Sep 2022 16:28:55 +0800 Subject: [PATCH 10/16] Update CONTRIBUTING.md Spelling mistake --- docs/CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 5dfbae23c6..fb8ef15453 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -2,7 +2,7 @@ Thank you for investing your time in contributing to our project! Any contribution you make will be reflected on our GitHub :sparkles:. -Read our [Code of Conduct](./CODE_OF_CONDUCT.md) to keep our community approachable and respectable. Join our [dicord](https://discord.com/invite/yz6tGVsf5p) server for more. +Read our [Code of Conduct](./CODE_OF_CONDUCT.md) to keep our community approachable and respectable. Join our [discord](https://discord.com/invite/yz6tGVsf5p) server for more. In this guide you will get an overview of the contribution workflow from opening an issue, creating a PR, reviewing, and merging the PR. From f8b6ece0fe481c9c643bfdbca01505306730dfee Mon Sep 17 00:00:00 2001 From: CJSS Date: Mon, 5 Sep 2022 16:33:17 +0800 Subject: [PATCH 11/16] Update CONTRIBUTING.md --- docs/CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index fb8ef15453..543f380686 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -2,7 +2,7 @@ Thank you for investing your time in contributing to our project! Any contribution you make will be reflected on our GitHub :sparkles:. -Read our [Code of Conduct](./CODE_OF_CONDUCT.md) to keep our community approachable and respectable. Join our [discord](https://discord.com/invite/yz6tGVsf5p) server for more. +Read our [Code of Conduct](./CODE_OF_CONDUCT.md) to keep our community approachable and respectable. Join our [Discord](https://discord.com/invite/yz6tGVsf5p) server for more. In this guide you will get an overview of the contribution workflow from opening an issue, creating a PR, reviewing, and merging the PR. From 950e6bce45f454a17209860b2f27a34d9482ac40 Mon Sep 17 00:00:00 2001 From: lawvs <18554747+lawvs@users.noreply.github.com> Date: Mon, 5 Sep 2022 17:22:14 +0800 Subject: [PATCH 12/16] fix: i18n default value --- .../layout/src/settings-sidebar/Settings/SettingsList.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/components/layout/src/settings-sidebar/Settings/SettingsList.tsx b/libs/components/layout/src/settings-sidebar/Settings/SettingsList.tsx index a4c99c6fe0..f462ccf572 100644 --- a/libs/components/layout/src/settings-sidebar/Settings/SettingsList.tsx +++ b/libs/components/layout/src/settings-sidebar/Settings/SettingsList.tsx @@ -49,7 +49,7 @@ export const SettingsList = () => { {item.key === 'Language' ? (