From 332a5c66851b77fa1da5f1698a7d833798ce7ba0 Mon Sep 17 00:00:00 2001 From: JimmFly <447268514@qq.com> Date: Thu, 21 Dec 2023 07:13:05 +0000 Subject: [PATCH 1/6] chore(core): temporarily hide export png and pdf in edgeless (#5364) --- .../page-list/operation-menu-items/export.tsx | 19 ++++++++++++++----- .../share-menu/share-export.tsx | 4 ++++ .../operation-menu.tsx | 2 +- ...se-register-blocksuite-editor-commands.tsx | 4 ++-- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/packages/frontend/component/src/components/page-list/operation-menu-items/export.tsx b/packages/frontend/component/src/components/page-list/operation-menu-items/export.tsx index d37bb64a18..939fd9f1ea 100644 --- a/packages/frontend/component/src/components/page-list/operation-menu-items/export.tsx +++ b/packages/frontend/component/src/components/page-list/operation-menu-items/export.tsx @@ -21,6 +21,7 @@ interface ExportMenuItemProps { interface ExportProps { exportHandler: (type: 'pdf' | 'html' | 'png' | 'markdown') => Promise; + pageMode?: 'page' | 'edgeless'; className?: string; } @@ -47,6 +48,7 @@ export function ExportMenuItem({ export const ExportMenuItems = ({ exportHandler, className = transitionStyle, + pageMode = 'page', }: ExportProps) => { const t = useAFFiNEI18N(); const itemMap = useMemo( @@ -94,16 +96,23 @@ export const ExportMenuItems = ({ ], [className, exportHandler, t] ); - const items = itemMap.map(({ component: Component, props }) => ( - - )); + const items = itemMap.map(({ component: Component, props }) => + pageMode === 'edgeless' && + (props.type === 'pdf' || props.type === 'png') ? null : ( + + ) + ); return items; }; -export const Export = ({ exportHandler, className }: ExportProps) => { +export const Export = ({ exportHandler, className, pageMode }: ExportProps) => { const t = useAFFiNEI18N(); const items = ( - + ); return ( @@ -36,6 +39,7 @@ export const ShareExport = ({ {workspace.flavour !== WorkspaceFlavour.LOCAL ? ( diff --git a/packages/frontend/core/src/components/blocksuite/block-suite-header-title/operation-menu.tsx b/packages/frontend/core/src/components/blocksuite/block-suite-header-title/operation-menu.tsx index 4aa9080bb4..7bb2979a48 100644 --- a/packages/frontend/core/src/components/blocksuite/block-suite-header-title/operation-menu.tsx +++ b/packages/frontend/core/src/components/blocksuite/block-suite-header-title/operation-menu.tsx @@ -182,7 +182,7 @@ export const PageHeaderMenuButton = ({ rename, pageId }: PageMenuProps) => { > {t['Import']()} - + {workspace.flavour === WorkspaceFlavour.AFFINE_CLOUD && runtimeConfig.enablePageHistory ? ( diff --git a/packages/frontend/core/src/hooks/affine/use-register-blocksuite-editor-commands.tsx b/packages/frontend/core/src/hooks/affine/use-register-blocksuite-editor-commands.tsx index 4667436032..302f34ad00 100644 --- a/packages/frontend/core/src/hooks/affine/use-register-blocksuite-editor-commands.tsx +++ b/packages/frontend/core/src/hooks/affine/use-register-blocksuite-editor-commands.tsx @@ -141,7 +141,7 @@ export function useRegisterBlocksuiteEditorCommands( unsubs.push( registerAffineCommand({ id: `editor:${mode}-export-to-pdf`, - preconditionStrategy, + preconditionStrategy: () => mode === 'page' && !trash, category: `editor:${mode}`, icon: mode === 'page' ? : , label: t['Export to PDF'](), @@ -167,7 +167,7 @@ export function useRegisterBlocksuiteEditorCommands( unsubs.push( registerAffineCommand({ id: `editor:${mode}-export-to-png`, - preconditionStrategy, + preconditionStrategy: () => mode === 'page' && !trash, category: `editor:${mode}`, icon: mode === 'page' ? : , label: t['Export to PNG'](), From eaa62df2dd11216d6039393507093e8d13457083 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Thu, 21 Dec 2023 07:23:11 +0000 Subject: [PATCH 2/6] chore: bump up eslint-plugin-unicorn version to v50 (#5362) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [eslint-plugin-unicorn](https://togithub.com/sindresorhus/eslint-plugin-unicorn) | [`^49.0.0` -> `^50.0.0`](https://renovatebot.com/diffs/npm/eslint-plugin-unicorn/49.0.0/50.0.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/eslint-plugin-unicorn/50.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/eslint-plugin-unicorn/50.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/eslint-plugin-unicorn/49.0.0/50.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/eslint-plugin-unicorn/49.0.0/50.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
sindresorhus/eslint-plugin-unicorn (eslint-plugin-unicorn) ### [`v50.0.0`](https://togithub.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v50.0.0) [Compare Source](https://togithub.com/sindresorhus/eslint-plugin-unicorn/compare/v49.0.0...v50.0.0) ##### New rules - [`no-unnecessary-polyfills`](https://togithub.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-polyfills.md) ([#​1717](https://togithub.com/sindresorhus/eslint-plugin-unicorn/issues/1717)) [`6788d86`](https://togithub.com/sindresorhus/eslint-plugin-unicorn/commit/6788d86) ##### Improvements - Support ESLint's new config system ([#​1886](https://togithub.com/sindresorhus/eslint-plugin-unicorn/issues/1886)) [`65711f9`](https://togithub.com/sindresorhus/eslint-plugin-unicorn/commit/65711f9) - `no-useless-undefined`: Add `checkArrowFunctionBody` option ([#​2232](https://togithub.com/sindresorhus/eslint-plugin-unicorn/issues/2232)) [`9d7048c`](https://togithub.com/sindresorhus/eslint-plugin-unicorn/commit/9d7048c) - `prefer-negative-index`: Check `TypedArray#subarray()` ([#​2237](https://togithub.com/sindresorhus/eslint-plugin-unicorn/issues/2237)) [`6708a30`](https://togithub.com/sindresorhus/eslint-plugin-unicorn/commit/6708a30) - `no-useless-undefined`: Ignore React state setters ([#​2223](https://togithub.com/sindresorhus/eslint-plugin-unicorn/issues/2223)) [`42881ba`](https://togithub.com/sindresorhus/eslint-plugin-unicorn/commit/42881ba) - `prefer-module`: Allow `module` as TSTypeParameter name ([#​2213](https://togithub.com/sindresorhus/eslint-plugin-unicorn/issues/2213)) [`8f61f7c`](https://togithub.com/sindresorhus/eslint-plugin-unicorn/commit/8f61f7c) ##### Fixes - `string-content`: Fix JSX autofix for newlines, etc. ([#​2222](https://togithub.com/sindresorhus/eslint-plugin-unicorn/issues/2222)) [`b95e75e`](https://togithub.com/sindresorhus/eslint-plugin-unicorn/commit/b95e75e)
--- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/toeverything/AFFiNE). --- package.json | 2 +- yarn.lock | 79 ++++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 72 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 19e34ecfa6..171dfa6190 100644 --- a/package.json +++ b/package.json @@ -88,7 +88,7 @@ "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-simple-import-sort": "^10.0.0", "eslint-plugin-sonarjs": "^0.23.0", - "eslint-plugin-unicorn": "^49.0.0", + "eslint-plugin-unicorn": "^50.0.0", "eslint-plugin-unused-imports": "^3.0.0", "eslint-plugin-vue": "^9.18.1", "fake-indexeddb": "5.0.1", diff --git a/yarn.lock b/yarn.lock index 04743c1578..e83e63be31 100644 --- a/yarn.lock +++ b/yarn.lock @@ -628,7 +628,7 @@ __metadata: eslint-plugin-react-hooks: "npm:^4.6.0" eslint-plugin-simple-import-sort: "npm:^10.0.0" eslint-plugin-sonarjs: "npm:^0.23.0" - eslint-plugin-unicorn: "npm:^49.0.0" + eslint-plugin-unicorn: "npm:^50.0.0" eslint-plugin-unused-imports: "npm:^3.0.0" eslint-plugin-vue: "npm:^9.18.1" fake-indexeddb: "npm:5.0.1" @@ -5863,6 +5863,23 @@ __metadata: languageName: node linkType: hard +"@eslint/eslintrc@npm:^2.1.4": + version: 2.1.4 + resolution: "@eslint/eslintrc@npm:2.1.4" + dependencies: + ajv: "npm:^6.12.4" + debug: "npm:^4.3.2" + espree: "npm:^9.6.0" + globals: "npm:^13.19.0" + ignore: "npm:^5.2.0" + import-fresh: "npm:^3.2.1" + js-yaml: "npm:^4.1.0" + minimatch: "npm:^3.1.2" + strip-json-comments: "npm:^3.1.1" + checksum: 7a3b14f4b40fc1a22624c3f84d9f467a3d9ea1ca6e9a372116cb92507e485260359465b58e25bcb6c9981b155416b98c9973ad9b796053fd7b3f776a6946bce8 + languageName: node + linkType: hard + "@eslint/js@npm:8.54.0": version: 8.54.0 resolution: "@eslint/js@npm:8.54.0" @@ -17329,6 +17346,20 @@ __metadata: languageName: node linkType: hard +"browserslist@npm:^4.22.2": + version: 4.22.2 + resolution: "browserslist@npm:4.22.2" + dependencies: + caniuse-lite: "npm:^1.0.30001565" + electron-to-chromium: "npm:^1.4.601" + node-releases: "npm:^2.0.14" + update-browserslist-db: "npm:^1.0.13" + bin: + browserslist: cli.js + checksum: e3590793db7f66ad3a50817e7b7f195ce61e029bd7187200244db664bfbe0ac832f784e4f6b9c958aef8ea4abe001ae7880b7522682df521f4bc0a5b67660b5e + languageName: node + linkType: hard + "bser@npm:2.1.1": version: 2.1.1 resolution: "bser@npm:2.1.1" @@ -17646,6 +17677,13 @@ __metadata: languageName: node linkType: hard +"caniuse-lite@npm:^1.0.30001565": + version: 1.0.30001570 + resolution: "caniuse-lite@npm:1.0.30001570" + checksum: a9b939e003dd70580cc18bce54627af84f298af7c774415c8d6c99871e7cee13bd8278b67955a979cd338369c73e8821a10b37e607d1fff2fbc8ff92fc489653 + languageName: node + linkType: hard + "capital-case@npm:^1.0.4": version: 1.0.4 resolution: "capital-case@npm:1.0.4" @@ -17971,7 +18009,7 @@ __metadata: languageName: node linkType: hard -"ci-info@npm:^3.2.0, ci-info@npm:^3.8.0": +"ci-info@npm:^3.2.0": version: 3.9.0 resolution: "ci-info@npm:3.9.0" checksum: 75bc67902b4d1c7b435497adeb91598f6d52a3389398e44294f6601b20cfef32cf2176f7be0eb961d9e085bb333a8a5cae121cb22f81cf238ae7f58eb80e9397 @@ -18787,6 +18825,15 @@ __metadata: languageName: node linkType: hard +"core-js-compat@npm:^3.34.0": + version: 3.34.0 + resolution: "core-js-compat@npm:3.34.0" + dependencies: + browserslist: "npm:^4.22.2" + checksum: e29571cc524b4966e331b5876567f13c2b82ed48ac9b02784f3156b29ee1cd82fe3e60052d78b017c429eb61969fd238c22684bb29180908d335266179a29155 + languageName: node + linkType: hard + "core-js-pure@npm:^3.23.3": version: 3.33.3 resolution: "core-js-pure@npm:3.33.3" @@ -20095,6 +20142,13 @@ __metadata: languageName: node linkType: hard +"electron-to-chromium@npm:^1.4.601": + version: 1.4.615 + resolution: "electron-to-chromium@npm:1.4.615" + checksum: dbf9deb234cbd381a91f41f6c6729cc8b4bed9b1580d6aea589d689d5f2a8aadf88837ef6887e761c143a1e1015f5eb3ae1bd2728a3068fa6a235c16c0fd76ae + languageName: node + linkType: hard + "electron-updater@npm:^6.1.5": version: 6.1.7 resolution: "electron-updater@npm:6.1.7" @@ -20916,14 +20970,16 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-unicorn@npm:^49.0.0": - version: 49.0.0 - resolution: "eslint-plugin-unicorn@npm:49.0.0" +"eslint-plugin-unicorn@npm:^50.0.0": + version: 50.0.0 + resolution: "eslint-plugin-unicorn@npm:50.0.0" dependencies: "@babel/helper-validator-identifier": "npm:^7.22.20" "@eslint-community/eslint-utils": "npm:^4.4.0" - ci-info: "npm:^3.8.0" + "@eslint/eslintrc": "npm:^2.1.4" + ci-info: "npm:^4.0.0" clean-regexp: "npm:^1.0.0" + core-js-compat: "npm:^3.34.0" esquery: "npm:^1.5.0" indent-string: "npm:^4.0.0" is-builtin-module: "npm:^3.2.1" @@ -20935,8 +20991,8 @@ __metadata: semver: "npm:^7.5.4" strip-indent: "npm:^3.0.0" peerDependencies: - eslint: ">=8.52.0" - checksum: 7f73f41356cdf720675998c558ab13872d76302dde3a49661df0b5219fd328627e3d7e418aaa3e94cf8764d1ef8b606f7ea01f019eccc0bf0522def8e6769caa + eslint: ">=8.56.0" + checksum: 09d069bac3d4c7d3d3d4ddf8a9992718cd1acc6bbba99cfcb0fb581d9dd0d64378c55d6cc5579aadf23d199c53b539a4351446e0855b363c95e8926be15c95e6 languageName: node linkType: hard @@ -29033,6 +29089,13 @@ __metadata: languageName: node linkType: hard +"node-releases@npm:^2.0.14": + version: 2.0.14 + resolution: "node-releases@npm:2.0.14" + checksum: 0f7607ec7db5ef1dc616899a5f24ae90c869b6a54c2d4f36ff6d84a282ab9343c7ff3ca3670fe4669171bb1e8a9b3e286e1ef1c131f09a83d70554f855d54f24 + languageName: node + linkType: hard + "nodemailer@npm:^6.9.7": version: 6.9.7 resolution: "nodemailer@npm:6.9.7" From c2db8b356c230ff532ac17ffadcfb9f37404be1b Mon Sep 17 00:00:00 2001 From: Cats Juice Date: Thu, 21 Dec 2023 15:44:21 +0800 Subject: [PATCH 3/6] feat(electron): handle onboarding-window moved between screens (#5345) --- .../components/affine/onboarding/style.css.ts | 3 +- .../frontend/electron/src/main/onboarding.ts | 30 +++++++++++++++++-- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/packages/frontend/core/src/components/affine/onboarding/style.css.ts b/packages/frontend/core/src/components/affine/onboarding/style.css.ts index 2f8ba3b561..3ae2d0294d 100644 --- a/packages/frontend/core/src/components/affine/onboarding/style.css.ts +++ b/packages/frontend/core/src/components/affine/onboarding/style.css.ts @@ -100,8 +100,7 @@ export const onboarding = style([ animation: `${fadeIn} 0.8s linear`, // content: 'unset', background: - // 'linear-gradient(180deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 99.58%)', - 'linear-gradient(180deg, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0) 80%)', + 'linear-gradient(180deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 99.58%)', }, '&[data-is-window="true"][data-is-desktop="true"]::after': { opacity: 0, diff --git a/packages/frontend/electron/src/main/onboarding.ts b/packages/frontend/electron/src/main/onboarding.ts index 714bf19028..57b3adb625 100644 --- a/packages/frontend/electron/src/main/onboarding.ts +++ b/packages/frontend/electron/src/main/onboarding.ts @@ -1,10 +1,16 @@ -import { BrowserWindow, screen } from 'electron'; +import { BrowserWindow, type Display, screen } from 'electron'; import { join } from 'path'; +import { isMacOS } from '../shared/utils'; import { mainWindowOrigin } from './constants'; // import { getExposedMeta } from './exposed'; import { logger } from './logger'; +const getScreenSize = (display: Display) => { + const { width, height } = isMacOS() ? display.bounds : display.workArea; + return { width, height }; +}; + // todo: not all window need all of the exposed meta const getWindowAdditionalArguments = async () => { const { getExposedMeta } = await import('./exposed'); @@ -15,11 +21,24 @@ const getWindowAdditionalArguments = async () => { ]; }; +function fullscreenAndCenter(browserWindow: BrowserWindow) { + const position = browserWindow.getPosition(); + const size = browserWindow.getSize(); + const currentDisplay = screen.getDisplayNearestPoint({ + x: position[0] + size[0] / 2, + y: position[1] + size[1] / 2, + }); + if (!currentDisplay) return; + const { width, height } = getScreenSize(currentDisplay); + browserWindow.setSize(width, height); + browserWindow.center(); +} + async function createOnboardingWindow(additionalArguments: string[]) { logger.info('creating onboarding window'); // get user's screen size - const { width, height } = screen.getPrimaryDisplay().workAreaSize; + const { width, height } = getScreenSize(screen.getPrimaryDisplay()); const browserWindow = new BrowserWindow({ width, @@ -36,6 +55,7 @@ async function createOnboardingWindow(additionalArguments: string[]) { // skipTaskbar: true, transparent: true, hasShadow: false, + roundedCorners: false, webPreferences: { webgl: true, preload: join(__dirname, './preload.js'), @@ -56,12 +76,18 @@ async function createOnboardingWindow(additionalArguments: string[]) { browserWindow.on('ready-to-show', () => { // forcing zoom factor to 1 to avoid onboarding display issues browserWindow.webContents.setZoomFactor(1); + fullscreenAndCenter(browserWindow); // TODO: add a timeout to avoid flickering, window is ready, but dom is not ready setTimeout(() => { browserWindow.show(); }, 300); }); + // When moved to another screen, resize to fit the screen + browserWindow.on('moved', () => { + fullscreenAndCenter(browserWindow); + }); + await browserWindow.loadURL( `${mainWindowOrigin}${mainWindowOrigin.endsWith('/') ? '' : '/'}onboarding` ); From cc731242596de69d3e17a4c3a624d4da1c1d1541 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Thu, 21 Dec 2023 07:45:32 +0000 Subject: [PATCH 4/6] chore: bump up @react-hookz/web version to v24 (#5359) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@react-hookz/web](https://togithub.com/react-hookz/web) | [`^23.1.0` -> `^24.0.0`](https://renovatebot.com/diffs/npm/@react-hookz%2fweb/23.1.0/24.0.1) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@react-hookz%2fweb/24.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@react-hookz%2fweb/24.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@react-hookz%2fweb/23.1.0/24.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@react-hookz%2fweb/23.1.0/24.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
react-hookz/web (@​react-hookz/web) ### [`v24.0.1`](https://togithub.com/react-hookz/web/blob/HEAD/CHANGELOG.md#2401-2023-12-20) [Compare Source](https://togithub.com/react-hookz/web/compare/v24.0.0...v24.0.1) ##### Bug Fixes - change build so development and distributed imports match ([6383cdd](https://togithub.com/react-hookz/web/commit/6383cdd5581d60aac3c0000686ebd4139eac6e65)) ### [`v24.0.0`](https://togithub.com/react-hookz/web/blob/HEAD/CHANGELOG.md#2400-2023-12-20) [Compare Source](https://togithub.com/react-hookz/web/compare/v23.1.0...v24.0.0) ##### Features - switch package to module type ([#​1472](https://togithub.com/react-hookz/web/issues/1472)) ([50921ef](https://togithub.com/react-hookz/web/commit/50921efda58aefcd52d50bfff27c31755c9253d9)) ##### BREAKING CHANGES - Hooks are now distrubutes as JS built form TS with target ESNext and ESM module resolution. There is no more sense to distribute CJS version as package is ESM-only. Consequent of above - no more esm and cjs subfolders - hooks are importable from index.js or its own directory which don't have a prefix anymore, thanks to exports directive. All of below examples will lead to same result, choose any on your taste: import { useFirstMountState } from '[@​react-hookz/web](https://togithub.com/react-hookz/web)'; import { useFirstMountState } from '@​react-hookz/web/'; import { useFirstMountState } from '@​react-hookz/web/useFirstMountState/'; import { useFirstMountState } from '@​react-hookz/web/useFirstMountState/index.js'; Thought is seems not to have subfolder, it is only due to exports directive, in real it is @​react-hookz/web/dist/useFirstMountState/index.js. Pakage uses imports directive to define path alias #root - it stays so even in distributed code, thus, some may be affected in case their bundler configured to somehow handle such alias. Those developer shoud configure import rewriter not to handle node_modules or [@​react-hookz/web](https://togithub.com/react-hookz/web) package exclusively. Side-effect for current PR - documentation is broken, as storybook 6 is not working within ESM packages and I'm planning to switch to another domenting engine anyway.
--- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/toeverything/AFFiNE). --- packages/frontend/core/package.json | 2 +- yarn.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/frontend/core/package.json b/packages/frontend/core/package.json index 3a0c6bbdbb..8f44a1d578 100644 --- a/packages/frontend/core/package.json +++ b/packages/frontend/core/package.json @@ -44,7 +44,7 @@ "@radix-ui/react-dialog": "^1.0.4", "@radix-ui/react-scroll-area": "^1.0.5", "@radix-ui/react-select": "^2.0.0", - "@react-hookz/web": "^23.1.0", + "@react-hookz/web": "^24.0.0", "@sentry/integrations": "^7.83.0", "@sentry/react": "^7.83.0", "@toeverything/theme": "^0.7.20", diff --git a/yarn.lock b/yarn.lock index e83e63be31..36d7527dab 100644 --- a/yarn.lock +++ b/yarn.lock @@ -372,7 +372,7 @@ __metadata: "@radix-ui/react-dialog": "npm:^1.0.4" "@radix-ui/react-scroll-area": "npm:^1.0.5" "@radix-ui/react-select": "npm:^2.0.0" - "@react-hookz/web": "npm:^23.1.0" + "@react-hookz/web": "npm:^24.0.0" "@sentry/integrations": "npm:^7.83.0" "@sentry/react": "npm:^7.83.0" "@sentry/webpack-plugin": "npm:^2.8.0" @@ -11238,9 +11238,9 @@ __metadata: languageName: node linkType: hard -"@react-hookz/web@npm:^23.1.0": - version: 23.1.0 - resolution: "@react-hookz/web@npm:23.1.0" +"@react-hookz/web@npm:^24.0.0": + version: 24.0.0 + resolution: "@react-hookz/web@npm:24.0.0" dependencies: "@react-hookz/deep-equal": "npm:^1.0.4" peerDependencies: @@ -11250,7 +11250,7 @@ __metadata: peerDependenciesMeta: js-cookie: optional: true - checksum: 7f345fc286ee3bae74b76b909898213a589250856783805d0356d8ef9ca0e3d1638e7499d8b77ae1dff6350dec230fda468e0e4c8fc05a9997902569d3d81b49 + checksum: 85ec7ebecf3a69f098fecb89c1515ffd8c119f29a74521277df34af637059320669cf8ff6273063cec6a4c86cee4849e24fa8772191d08f81b2b88de69749670 languageName: node linkType: hard From fb1ed90ecc69af72f6469262b0648c239677f018 Mon Sep 17 00:00:00 2001 From: Joooye_34 Date: Thu, 21 Dec 2023 07:58:16 +0000 Subject: [PATCH 5/6] ci: use setup version action to init version (#5365) 1. Create setup version action to unify version initialization 2. Split tag event from release desktop 3. Add schedule to daily deploy and desktop release --- .github/actions/setup-version/action.yml | 20 ++++++++ .github/workflows/deploy-automatically.yml | 27 +++++++++++ .github/workflows/deploy.yml | 26 ++++++---- .github/workflows/dispatch-deploy.yml | 30 ------------ .../release-desktop-automatically.yml | 27 +++++++++++ ...se-desktop-app.yml => release-desktop.yml} | 48 +++++++------------ 6 files changed, 109 insertions(+), 69 deletions(-) create mode 100644 .github/actions/setup-version/action.yml create mode 100644 .github/workflows/deploy-automatically.yml delete mode 100644 .github/workflows/dispatch-deploy.yml create mode 100644 .github/workflows/release-desktop-automatically.yml rename .github/workflows/{release-desktop-app.yml => release-desktop.yml} (88%) diff --git a/.github/actions/setup-version/action.yml b/.github/actions/setup-version/action.yml new file mode 100644 index 0000000000..4c60d599d2 --- /dev/null +++ b/.github/actions/setup-version/action.yml @@ -0,0 +1,20 @@ +name: Setup Version +description: 'Setup Version' +runs: + using: 'composite' + steps: + - name: 'Write Version' + id: version + shell: bash + run: | + if [ "${{ github.ref_type }}" == "tag" ]; then + APP_VERSION=$(echo "${{ github.ref_name }}" | sed 's/^v//') + else + PACKAGE_VERSION=$(node -p "require('./package.json').version") + TIME_VERSION=$(date +%Y%m%d%H%M) + GIT_SHORT_HASH=$(git rev-parse --short HEAD) + APP_VERSION=$PACKAGE_VERSION-nightly-$TIME_VERSION-$GIT_SHORT_HASH + fi + echo $APP_VERSION + echo "APP_VERSION=$APP_VERSION" >> "$GITHUB_OUTPUT" + ./scripts/set-version.sh $APP_VERSION diff --git a/.github/workflows/deploy-automatically.yml b/.github/workflows/deploy-automatically.yml new file mode 100644 index 0000000000..b15b7af05f --- /dev/null +++ b/.github/workflows/deploy-automatically.yml @@ -0,0 +1,27 @@ +name: Deploy Automatically + +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+-canary.[0-9]+' + schedule: + - cron: '0 9 * * *' + +jobs: + dispatch-deploy: + runs-on: ubuntu-latest + name: Setup Deploy + steps: + - name: dispatch deploy by tag + if: ${{ github.event_name == 'push' }} + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: deploy.yml + inputs: '{ "flavor": "canary" }' + - name: dispatch deploy by schedule + if: ${{ github.event_name == 'schedule' }} + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: deploy.yml + inputs: '{ "flavor": "canary" }' + ref: canary diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index d0ec8394af..7749f50975 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -4,10 +4,14 @@ on: workflow_dispatch: inputs: flavor: - description: 'Build type (canary, beta, or stable or internal)' - type: string + description: 'Select what enverionment to deploy to' + type: choice default: canary - + options: + - canary + - beta + - stable + - internal env: APP_NAME: affine NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} @@ -18,6 +22,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - name: Setup Version + uses: ./.github/actions/setup-version - name: Setup Node.js uses: ./.github/actions/setup-node with: @@ -36,6 +42,8 @@ jobs: environment: ${{ github.event.inputs.flavor }} steps: - uses: actions/checkout@v4 + - name: Setup Version + uses: ./.github/actions/setup-version - name: Setup Node.js uses: ./.github/actions/setup-node - name: Build Plugins @@ -67,6 +75,8 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Setup Version + uses: ./.github/actions/setup-version - name: Setup Node.js uses: ./.github/actions/setup-node - name: Build Rust @@ -88,6 +98,8 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Setup Version + uses: ./.github/actions/setup-version - name: Setup Node.js uses: ./.github/actions/setup-node - name: Build Rust @@ -207,12 +219,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: setup deploy version - id: version - run: | - export APP_VERSION=`node -e "console.log(require('./package.json').version)"` - echo $APP_VERSION - echo "APP_VERSION=$APP_VERSION" >> "$GITHUB_OUTPUT" + - name: Setup Version + uses: ./.github/actions/setup-version - name: Deploy to ${{ github.event.inputs.flavor }} uses: ./.github/actions/deploy with: diff --git a/.github/workflows/dispatch-deploy.yml b/.github/workflows/dispatch-deploy.yml deleted file mode 100644 index fa58a0a679..0000000000 --- a/.github/workflows/dispatch-deploy.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Dispatch Deploy by tag - -on: - push: - tags: - - 'v[0-9]+.[0-9]+.[0-9]+-canary.[0-9]+' - -jobs: - dispatch-deploy-by-tag: - runs-on: ubuntu-latest - name: Setup deploy environment - steps: - - uses: actions/checkout@v4 - - name: Setup Node.js - uses: ./.github/actions/setup-node - with: - extra-flags: 'workspaces focus @affine/monorepo' - hard-link-nm: false - electron-install: false - build-infra: false - build-plugins: false - - name: Setup output value - id: flavor - run: | - node -e "const env = require('semver').parse('${{ github.ref_name }}').prerelease[0] ?? 'stable'; console.log(`flavor=${env}`)" >> "$GITHUB_OUTPUT" - - name: dispatch deploy - uses: benc-uk/workflow-dispatch@v1 - with: - workflow: deploy.yml - inputs: '{ "flavor": "${{ steps.flavor.outputs.flavor }}" }' diff --git a/.github/workflows/release-desktop-automatically.yml b/.github/workflows/release-desktop-automatically.yml new file mode 100644 index 0000000000..60887b09e1 --- /dev/null +++ b/.github/workflows/release-desktop-automatically.yml @@ -0,0 +1,27 @@ +name: Release Desktop Automatically + +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+-canary.[0-9]+' + schedule: + - cron: '0 9 * * *' + +jobs: + dispatch-release-desktop: + runs-on: ubuntu-latest + name: Setup Release Desktop + steps: + - name: dispatch desktop release by tag + if: ${{ github.event_name == 'push' }} + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: release-desktop.yml + inputs: '{ "build-type": "canary", "is-draft": false, "is-pre-release": true }' + - name: dispatch desktop release by schedule + if: ${{ github.event_name == 'schedule' }} + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: release-desktop.yml + inputs: '{ "build-type": "canary", "is-draft": false, "is-pre-release": true }' + ref: canary diff --git a/.github/workflows/release-desktop-app.yml b/.github/workflows/release-desktop.yml similarity index 88% rename from .github/workflows/release-desktop-app.yml rename to .github/workflows/release-desktop.yml index 41347783d6..7dc9755ab8 100644 --- a/.github/workflows/release-desktop-app.yml +++ b/.github/workflows/release-desktop.yml @@ -1,15 +1,17 @@ name: Release Desktop App on: - push: - tags: - - 'v[0-9]+.[0-9]+.[0-9]+-canary.[0-9]+' workflow_dispatch: inputs: - version: - description: App Version + build-type: + description: 'Build Type' + type: choice required: true - default: 0.0.0 + default: canary + options: + - canary + - beta + - stable is-draft: description: 'Draft Release?' type: boolean @@ -20,11 +22,6 @@ on: type: boolean required: true default: true - build-type: - description: 'Build Type (canary, beta or stable)' - type: string - required: true - default: canary permissions: actions: write @@ -32,7 +29,7 @@ permissions: security-events: write env: - BUILD_TYPE: ${{ github.event.inputs.build-type || (github.ref_type == 'tag' && contains(github.ref, 'canary') && 'canary') }} + BUILD_TYPE: ${{ github.event.inputs.build-type }} DEBUG: napi:* APP_NAME: affine MACOSX_DEPLOYMENT_TARGET: '10.13' @@ -40,26 +37,17 @@ env: jobs: before-make: runs-on: ubuntu-latest - environment: ${{ github.event.inputs.build-type || (github.ref_type == 'tag' && contains(github.ref, 'canary') && 'canary') }} + environment: ${{ github.event.inputs.build-type }} outputs: - RELEASE_VERSION: ${{ steps.get-canary-version.outputs.RELEASE_VERSION }} + RELEASE_VERSION: ${{ steps.version.outputs.APP_VERSION }} steps: - uses: actions/checkout@v4 + - name: Setup Version + uses: ./.github/actions/setup-version - name: Setup Node.js uses: ./.github/actions/setup-node - name: Setup @sentry/cli uses: ./.github/actions/setup-sentry - - name: Get canary version - id: get-canary-version - if: ${{ github.ref_type == 'tag' }} - run: | - TAG_VERSION=${GITHUB_REF#refs/tags/v} - PACKAGE_VERSION=$(node -p "require('./packages/frontend/electron/package.json').version") - if [ "$TAG_VERSION" != "$PACKAGE_VERSION" ]; then - echo "Tag version ($TAG_VERSION) does not match package.json version ($PACKAGE_VERSION)" - exit 1 - fi - echo "RELEASE_VERSION=$(node -p "require('./packages/frontend/electron/package.json').version")" >> $GITHUB_OUTPUT - name: generate-assets run: yarn workspace @affine/electron generate-assets env: @@ -67,7 +55,7 @@ jobs: SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} SENTRY_DSN: ${{ secrets.SENTRY_DSN }} - RELEASE_VERSION: ${{ github.event.inputs.version || steps.get-canary-version.outputs.RELEASE_VERSION }} + RELEASE_VERSION: ${{ steps.version.outputs.APP_VERSION }} SKIP_PLUGIN_BUILD: 'true' SKIP_NX_CACHE: 'true' @@ -361,14 +349,14 @@ jobs: run: | node ./packages/frontend/electron/scripts/generate-yml.js env: - RELEASE_VERSION: ${{ github.event.inputs.version || needs.before-make.outputs.RELEASE_VERSION }} + RELEASE_VERSION: ${{ needs.before-make.outputs.RELEASE_VERSION }} - name: Create Release Draft uses: softprops/action-gh-release@v1 with: - name: ${{ github.event.inputs.version || needs.before-make.outputs.RELEASE_VERSION }} + name: ${{ needs.before-make.outputs.RELEASE_VERSION }} body: '' - draft: ${{ github.event.inputs.is-draft || true }} - prerelease: ${{ github.event.inputs.is-pre-release || needs.before-make.outputs.version }} + draft: ${{ github.event.inputs.is-draft }} + prerelease: ${{ github.event.inputs.is-pre-release }} files: | ./VERSION ./*.zip From aeec68b0d775364be3a00df27c550d43686d7427 Mon Sep 17 00:00:00 2001 From: Cats Juice Date: Thu, 21 Dec 2023 08:09:37 +0000 Subject: [PATCH 6/6] fix(core): onboading tooltip next button always shows (#5363) --- .../affine/onboarding/animate-in-tooltip.tsx | 18 ++++++++++++++---- .../affine/onboarding/onboarding.tsx | 9 ++++++--- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/packages/frontend/core/src/components/affine/onboarding/animate-in-tooltip.tsx b/packages/frontend/core/src/components/affine/onboarding/animate-in-tooltip.tsx index 85fe7640f9..8cfe73f02f 100644 --- a/packages/frontend/core/src/components/affine/onboarding/animate-in-tooltip.tsx +++ b/packages/frontend/core/src/components/affine/onboarding/animate-in-tooltip.tsx @@ -2,7 +2,15 @@ import { Button } from '@affine/component'; import * as styles from './animate-in-tooltip.css'; -export const AnimateInTooltip = ({ onNext }: { onNext: () => void }) => { +interface AnimateInTooltipProps { + onNext: () => void; + visible?: boolean; +} + +export const AnimateInTooltip = ({ + onNext, + visible, +}: AnimateInTooltipProps) => { return ( <>
@@ -10,9 +18,11 @@ export const AnimateInTooltip = ({ onNext }: { onNext: () => void }) => { whiteboards and databases
- + {visible ? ( + + ) : null}
); diff --git a/packages/frontend/core/src/components/affine/onboarding/onboarding.tsx b/packages/frontend/core/src/components/affine/onboarding/onboarding.tsx index 1c48e0af86..9a0751c5ab 100644 --- a/packages/frontend/core/src/components/affine/onboarding/onboarding.tsx +++ b/packages/frontend/core/src/components/affine/onboarding/onboarding.tsx @@ -34,6 +34,11 @@ export const Onboarding = ({ onOpenApp }: OnboardingProps) => { }); }, []); + const onTooltipNext = useCallback(() => { + if (status.activeId) return; + setStatus({ activeId: null, unfoldingId: '4' }); + }, [status.activeId]); + return (
{ )}
- setStatus({ activeId: null, unfoldingId: '4' })} - /> +