Compare commits

...

310 Commits

Author SHA1 Message Date
Peng Xiao
9b631f2328 fix(infra): page id compat fix for page ids in workspace.meta (#4950)
since we strip `page:` in keys of workspacedoc.spaces, we should also strip the prefix in meta.pages as well.
2023-11-15 17:36:08 +08:00
LongYinan
01f481a9b6 ci: only disable postinstall on macOS in nightly desktop build (#4938) 2023-11-14 23:00:30 +08:00
Joooye_34
0177ab5c87 fix(infra): workspace migration without blockVersions (#4936) 2023-11-14 14:38:11 +01:00
Peng Xiao
4db35d341c perf(component): use png instead of svg for rendering noise svg (#4935) 2023-11-14 11:52:51 +00:00
DarkSky
3c4a803c97 fix: change password token check (#4934) (#4932) 2023-11-14 11:15:54 +00:00
LongYinan
05154dc7ca ci: disable postinstall in nightly desktop build (#4930)
Should be part of https://github.com/toeverything/AFFiNE/pull/4885
2023-11-14 14:13:55 +08:00
Peng Xiao
c90b477f60 fix(core): change server url of stable to insider (#4902) (#4926) 2023-11-14 12:05:52 +08:00
李华桥
6f18ddbe85 v0.10.1 2023-11-13 19:49:26 +08:00
LongYinan
dde779a71d test(e2e): add subdoc migration test (#4921)
test(e2e): add subdoc migration test

fix: remove .only
2023-11-13 18:00:40 +08:00
Peng Xiao
bd9f66fbc7 fix(infra): compatibility fix for space prefix (#4912)
It seems there are some cases that [this upstream PR](https://github.com/toeverything/blocksuite/pull/4747) will cause data loss.

Because of some historical reasons, the page id could be different with its doc id.
It might be caused by subdoc migration in the following (not 100% sure if all white screen issue is caused by it) 0714c12703/packages/common/infra/src/blocksuite/index.ts (L538-L540)

In version 0.10, page id in spaces no longer has prefix "space:"
The data flow for fetching a doc's updates is:
- page id in `meta.pages` -> find `${page-id}` in `doc.spaces` -> `doc` -> `doc.guid`
if `doc` is not found in `doc.spaces`, a new doc will be created and its `doc.guid` is the same with its pageId
- because of guid logic change, the doc that previously prefixed with `space:` will not be found in `doc.spaces`
- when fetching the rows of this doc using the doc id === page id,
  it will return EMPTY since there is no updates associated with the page id

The provided fix in the PR will patch the `spaces` field of the root doc so that after 0.10 the page doc can still be found in the `spaces` map. It shall apply to both of the idb & sqlite datasources.

Special thanks to @lawvs 's db file for investigation!
2023-11-13 17:57:56 +08:00
liuyi
92f1f40bfa fix(server): wrap updates applying in a transaction (#4922) 2023-11-13 08:49:30 +00:00
LongYinan
48dc1049b3 Merge pull request #4913 from toeverything/darksky/cleanup-depolyment
chore: cleanup deployment
2023-11-12 11:20:02 +08:00
DarkSky
9add530370 chore: cleanup deployment 2023-11-12 11:03:25 +08:00
LongYinan
b77460d871 Merge pull request #4908 from toeverything/61/hotfix-websocket-payload
fix(server): increase server acceptable websocket payload size
2023-11-10 22:01:48 +08:00
forehalo
42db41776b fix(server): increase server acceptable websocket payload size 2023-11-10 21:31:45 +08:00
李华桥
075439c74f fix(core): change server url of stable to insider 2023-11-10 18:32:53 +08:00
Yifeng Wang
fc6c553ece chore: bump theme (#4904)
Co-authored-by: 李华桥 <joooye1991@gmail.com>
2023-11-10 15:40:38 +08:00
Joooye_34
59cb3d5df1 fix(core): change server url of stable to insider (#4902) 2023-11-10 14:50:57 +08:00
Peng Xiao
5c2d958e2b fix(core): svg blob syncing issue (#4886) 2023-11-10 05:32:51 +00:00
Yifeng Wang
2117d6b232 chore: bump blocksuite (#4901) 2023-11-10 13:23:29 +08:00
李华桥
5c48c83301 v0.10.0 2023-11-10 11:42:04 +08:00
fourdim
af7d331610 feat(core): add global loading state (#4840) 2023-11-10 03:25:05 +00:00
JimmFly
1fe5a0fffa feat(core): auto select block when jump to block (#4858)
Co-authored-by: Peng Xiao <pengxiao@outlook.com>
2023-11-10 03:02:56 +00:00
fourdim
f1e32aab66 fix(hooks): push success toast after save (#4830) 2023-11-10 02:40:52 +00:00
liuyi
7698a6ac8e chore(server): bump octobase versions (#4893)
Co-authored-by: DarkSky <darksky2048@gmail.com>
2023-11-10 02:25:28 +00:00
李华桥
063f5a683e v0.10.0-canary.16 2023-11-10 10:10:54 +08:00
Peng Xiao
fd74776abe fix(core): disable sync doc/blob on start (#4897) 2023-11-09 18:00:53 +00:00
LongYinan
9d89e4f7f5 fix(server): earlyAccessPreview env override (#4898) 2023-11-09 17:20:41 +00:00
LongYinan
7182b85bd0 chore: add performance logger (#4896)
Add more performance log to debug loading problem
2023-11-10 00:42:30 +08:00
LongYinan
91f1d0081b ci: adjust the beta cluster configuration (#4895)
- Scale the pod counts to 10
- Set `earlyAccessPreview` to false
2023-11-10 00:42:19 +08:00
李华桥
09c3a8828f chore: add performance logger 2023-11-10 00:33:48 +08:00
LongYinan
927a6489f9 ci: adjust the beta cluster configuration 2023-11-10 00:22:45 +08:00
李华桥
075eead9fa v0.10.0-canary.15 2023-11-09 23:27:12 +08:00
Joooye_34
15b0c127f5 chore: disable outline, copilot and hello world plugin (#4894) 2023-11-09 14:53:45 +00:00
Peng Xiao
d0b014543c fix(core): select all in page list group header does not need to enable selection (#4869) 2023-11-09 12:01:36 +00:00
LongYinan
839f500979 ci: disable postinstall on macOS build (#4885) 2023-11-09 11:58:55 +00:00
Joooye_34
af72bf0f69 feat(core): support signup set password before goto stripe payment url (#4892) 2023-11-09 11:58:16 +00:00
liuyi
405167854b perf(server): avoid auto select blob data when upsert (#4891) 2023-11-09 10:45:31 +00:00
liuyi
f9654bb1f8 feat(core): unify all new created page IDs to nanoid (#4884) 2023-11-09 09:22:02 +00:00
EYHN
e3e0553c56 fix(hooks): missing page preview and references (#4863) 2023-11-09 08:59:36 +00:00
liuyi
248fb1fa69 fix(server): token set with id instead of email (#4883) 2023-11-09 08:23:03 +00:00
Joooye_34
12a2ccf1a5 fix(core): visit /signin pay when already logged and subscribed (#4882)
Co-authored-by: Peng Xiao <pengxiao@outlook.com>
2023-11-09 07:38:52 +00:00
Peng Xiao
227b8b0061 fix(component): dragged component disappear when dragging (#4870) 2023-11-09 06:20:15 +00:00
Peng Xiao
442115632b chore(component): bump bs (#4880) 2023-11-09 04:47:10 +00:00
Peng Xiao
ad82376890 chore: update delete icon (#4871) 2023-11-09 02:49:48 +00:00
Joooye_34
a8bff81a7e ci: use resolutions to resolve building error in mac-os (#4878) 2023-11-09 02:43:47 +00:00
3720
da2821eaac fix(core): collections data migration without blocking data reads (#4866) 2023-11-08 12:38:43 +00:00
Joooye_34
c55565ee71 chore: update changelog url (#4868) 2023-11-08 12:08:24 +00:00
EYHN
ecd5db2952 ci: add oxlint (#4867) 2023-11-08 17:54:41 +08:00
Joooye_34
744cd47481 v0.10.0-canary.14 2023-11-08 15:36:54 +08:00
Hongtao Lye
12c72e63b1 chore: bump blocksuite version (#4862) 2023-11-08 07:12:48 +00:00
EYHN
b7edaab387 chore: fix code style issues (#4857) 2023-11-08 05:51:08 +00:00
JimmFly
83472cc682 fix(core): duplicate registration in edgeless (#4864) 2023-11-08 02:47:46 +00:00
3720
08e7fa3486 fix(core): improve the UX for edit collection (#4827)
Co-authored-by: Peng Xiao <pengxiao@outlook.com>
2023-11-07 10:18:56 +00:00
liuyi
7305530d97 fix(server): wrong data migration (#4855) 2023-11-07 09:20:42 +00:00
liuyi
b99ac51624 chore(server): decrease amount of batch updates merging (#4860) 2023-11-07 09:18:02 +00:00
liuyi
01d7fe4597 fix(server): avoid saving invalid data (#4859) 2023-11-07 08:27:17 +00:00
singhjatin297
ac0a3aab3e docs: update CONTRIBUTING.md (#4848) 2023-11-07 16:29:45 +08:00
singhjatin297
7fe23a31b2 docs: update behind-the-code.md (#4849) 2023-11-07 06:17:01 +00:00
Joooye_34
f50b8002b3 v0.10.0-canary.13 2023-11-07 09:55:30 +08:00
Joooye_34
7a4669a6aa feat(core): implement parts of workspace upgrade design (#4850) 2023-11-06 17:02:25 +00:00
Joooye_34
8554d5d791 v0.10.0-canary.12 2023-11-07 00:13:51 +08:00
Peng Xiao
da9934fbdc fix(electron): add search to proxied url (#4852) 2023-11-06 14:47:44 +00:00
liuyi
cb6974f263 fix(server): avoid server overloading by too many updates (#4846) 2023-11-06 10:21:19 +00:00
liuyi
f75684d6f6 fix(server): failed to share again if disable once (#4844) 2023-11-06 10:19:21 +00:00
JimmFly
acf0734c95 fix(core): adjust discount display (#4847) 2023-11-06 10:17:24 +00:00
Peng Xiao
cfffcad1b8 fix(core): adapt blob in sqlite for svg type (#4845) 2023-11-06 10:09:48 +00:00
Joooye_34
3b74ff2b92 v0.10.0-canary.11 2023-11-06 18:10:28 +08:00
JimmFly
2b34e1a9cd feat(core): adjust filter logic (#4831) 2023-11-06 06:41:18 +00:00
JimmFly
9664d142ad feat(core): temporary expansion files are limited to 100M (#4833) 2023-11-06 06:38:46 +00:00
JimmFly
e7106b7393 chore(i18n): adjust text (#4832) 2023-11-06 06:36:49 +00:00
liuyi
f491ff94cc refactor(server): separate page visibility from workspace permission (#4836) 2023-11-06 03:49:39 +00:00
dependabot[bot]
e8987457ab chore: bump the all-cargo-dependencies group with 1 update (#4841)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-06 03:43:18 +00:00
Cats Juice
7a8150398c feat(core): payment plans error boundary (#4744) 2023-11-06 02:42:21 +00:00
Cats Juice
3c4dbed16b fix(core): payment UI fix (#4839) 2023-11-06 02:40:52 +00:00
Peng Xiao
7e381e830a perf(core): load all pages after 10s (#4834) 2023-11-03 09:42:29 +00:00
Cats Juice
61dc4a56f9 fix(core): implement pricing plans scroll area with radix (#4824) 2023-11-03 06:16:25 +00:00
JimmFly
788c445f2b chore(i18n): add new key for empty trash page (#4829) 2023-11-03 06:15:13 +00:00
Joooye_34
97db941749 fix(core): remove responsive editor width (#4821) 2023-11-03 04:47:51 +00:00
liuyi
f6cfe7c8a1 fix(server): only treat active subscription as existing (#4826) 2023-11-03 04:00:58 +00:00
Joooye_34
fb0aaabe53 v0.10.0-canary.10 2023-11-02 23:40:34 +08:00
Cats Juice
de33967a73 fix(component): flex setting-modal header & footer (#4818) 2023-11-02 15:11:20 +00:00
Peng Xiao
65321e39cc refactor(component): virtual rendering page list (#4775)
Co-authored-by: Joooye_34 <Joooye1991@gmail.com>
2023-11-02 14:21:01 +00:00
liuyi
a3906bf92b fix(server): do not return subscription if not active (#4820) 2023-11-02 14:17:26 +00:00
JimmFly
0a88be7771 feat(core): add jump to block for cmdk (#4802) 2023-11-02 11:49:49 +00:00
3720
7068d5f38a feat(core): remove mode and pages field from Collection (#4817) 2023-11-02 10:47:43 +00:00
LongYinan
bf17b4789b Merge pull request #4819 from toeverything/61/hotfix
fix(server): remove awareness states cache
2023-11-02 18:31:19 +08:00
forehalo
5e9efbffa3 fix(server): page variant may exist 2023-11-02 18:25:30 +08:00
forehalo
7e516236f5 fix(workspace): remove awareness states cache 2023-11-02 18:24:00 +08:00
Hongtao Lye
15024c6c8a chore: bump blocksuite (#4801) 2023-11-02 09:12:23 +00:00
liuyi
6a93203d68 feat(server): sync data with ack (#4791) 2023-11-02 09:05:28 +00:00
JimmFly
af9663d3e7 fix(core): adjust payment related text (#4797) 2023-11-02 08:22:54 +00:00
EYHN
1d7e3dd570 fix(core): currentUser undefined when all workspaces deleted (#4812) 2023-11-02 07:20:08 +00:00
EYHN
6ef02fbc38 fix(core): fix block suite edit mode switch shortcut (#4813) 2023-11-02 07:17:44 +00:00
EYHN
604c3da9fe docs: change yarn version in BUILDING.md (#4811) 2023-11-02 03:56:02 +00:00
Joooye_34
75c8dd75e3 v0.10.0-canary.9 2023-11-01 22:03:47 +08:00
Cats Juice
e5c86a9249 fix(core): billing cancel confirm dialog (#4795) 2023-11-01 09:38:43 +00:00
3720
e5be570f54 fix(core): text color of search input, style for the multi-select tag, date-picker autofocus issue (#4799) 2023-11-01 09:28:00 +00:00
LongYinan
6aaf550241 ci: fix wrangler deploy (#4803) 2023-11-01 09:12:00 +00:00
LongYinan
2d62ec72a7 ci: dynamic setup server deploy environment by release tag (#4790) 2023-11-01 07:38:15 +00:00
Joooye_34
0273ea8b00 v0.10.0-canary.8 2023-11-01 00:03:04 +08:00
JimmFly
97d189f1c8 fix(component): adjust autofill style (#4773) 2023-10-31 15:30:35 +00:00
Joooye_34
db36f81d24 feat(core): support subscribe plan after login (#4788) 2023-10-31 15:29:23 +00:00
DarkSky
c30d2550ff fix: request prevented when re-downgrade subscribe (#4786) 2023-10-31 11:17:28 +00:00
Cats Juice
93e286177f feat(core): billing history pagination (#4787) 2023-10-31 09:47:59 +00:00
Peng Xiao
8ca53326a7 fix(electron): update app icons (#4789)
Co-authored-by: Joooye_34 <Joooye1991@gmail.com>
2023-10-31 09:09:42 +00:00
Cats Juice
7d6c096462 feat(core): payment billing loading (#4763) 2023-10-31 09:00:19 +00:00
Peng Xiao
f08408ebe5 fix(core): possible crash issues (#4783) 2023-10-31 08:56:14 +00:00
Cats Juice
0ad0ab50d0 fix(core): adjust setting-modal layout to center tip (#4776) 2023-10-31 08:10:41 +00:00
Joooye_34
563863005f v0.10.0-canary.6 2023-10-31 14:40:47 +08:00
DarkSky
57d71ad6cf fix: idempotencyKey used (#4774) 2023-10-31 05:26:42 +00:00
Joooye_34
37ec552f74 v0.10.0-canary.5 2023-10-31 11:54:25 +08:00
Peng Xiao
9e3c79526c fix(core): selectAtom crash on isEqual (#4780) 2023-10-31 03:29:18 +00:00
JimmFly
a015dc42bb feat(core): support fuzzy highlighting (#4765) 2023-10-31 03:02:53 +00:00
Joooye_34
17afe218fe v0.10.0-canary.4 2023-10-31 01:49:15 +08:00
Joooye_34
7b204cc611 Merge pull request #4766 from toeverything/chore/stripe-env
chore(server): add stripe env to deploy.yml
2023-10-30 17:25:23 +00:00
Joooye_34
9102f1f9a9 Merge pull request #4768 from toeverything/zzj/new-collections-i18n
feat(i18n): add i18n support for new collections
2023-10-30 16:39:14 +00:00
LongYinan
f6b53a1167 Merge pull request #4770 from toeverything/fix-html-template
fix(core): description field in html template
2023-10-30 16:37:45 +00:00
Joooye_34
6fcdb05925 chore(server): add stripe env 2023-10-31 00:12:17 +08:00
LongYinan
99b35c7a93 ci: reduce deployment events on pull requests 2023-10-30 19:57:54 +08:00
LongYinan
fc27a2e906 fix(core): description field in html template 2023-10-30 19:57:54 +08:00
liuyi
b4d8f1428c Merge pull request #4771 from toeverything/jimmfly/1030/add-i18n
feat(i18n): add new key for billing
2023-10-30 10:56:51 +00:00
JimmFly
1b0c604c02 feat(i18n): add new key for billing 2023-10-30 17:46:48 +08:00
LongYinan
581635f40b Merge pull request #4709 from toeverything/61/doc-perf
perf(server): opmitize updates table
2023-10-30 09:27:19 +00:00
LongYinan
d752086846 Merge pull request #4767 from toeverything/61/fix/data-migration
fix(server): wrong prod data migration scripts filter
2023-10-30 09:21:37 +00:00
zzj3720
f23ec9063c feat(collections): completion i18n 2023-10-30 17:06:59 +08:00
forehalo
26b953ce57 fix(server): wrong prod data migration scripts filter 2023-10-30 16:50:39 +08:00
LongYinan
72babe9157 Merge pull request #4751 from toeverything/yarn-4.0.1
chore: upgrade to yarn@4.0.1
2023-10-30 07:49:29 +00:00
LongYinan
b6ca81821e Merge pull request #4758 from toeverything/dependabot/cargo/all-cargo-dependencies-114856a603
chore: bump the all-cargo-dependencies group with 1 update
2023-10-30 07:46:35 +00:00
DarkSky
f11cc40ae3 Merge pull request #4410 from toeverything/payment-system
feat: payment system
2023-10-30 07:15:52 +00:00
DarkSky
95c1a44a0d Merge branch 'master' into payment-system 2023-10-30 01:55:51 -05:00
LongYinan
198befb006 Merge pull request #4748 from fourdim/doc-0627
docs: update README.md
2023-10-30 06:37:25 +00:00
LongYinan
fc3516acfb Merge pull request #4746 from toeverything/data-migrations-system
feat(server): add data migration system
2023-10-30 06:36:18 +00:00
DarkSky
de9e7f97a4 feat: add idempotent request support for payment apis (#4753) 2023-10-30 05:54:09 +00:00
dependabot[bot]
05ad6eb450 chore: bump the all-cargo-dependencies group with 1 update
Bumps the all-cargo-dependencies group with 1 update: [serde](https://github.com/serde-rs/serde).

- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.189...v1.0.190)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all-cargo-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-30 03:39:55 +00:00
forehalo
98d0ac3c90 feat(server): add data migration system 2023-10-30 11:12:09 +08:00
Flrande
2aa4b4c1f3 fix: remove awareness state before window unload (#4752) 2023-10-29 19:50:18 +00:00
DarkSky
3798293d3e fix: error handle in payment resolver (#4754) 2023-10-30 00:33:21 +08:00
LongYinan
fd76d33421 chore: upgrade to yarn@4.0.1 2023-10-29 16:06:29 +08:00
dependabot[bot]
2a4495f7ee ci: bump cloudflare/wrangler-action from 3.3.1 to 3.3.2 (#4717)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-28 12:08:49 +00:00
DarkSky
1775138228 feat: bump up blob size limit temporarily (#4747) 2023-10-28 07:51:02 +00:00
Cats Juice
8c194ab8b0 feat(core): confirm before cancel in billing page (#4749) 2023-10-28 14:12:25 +08:00
fourdim
5ba1c0dbdb fix: prettier issue 2023-10-28 00:50:03 -04:00
fourdim
59ec122940 docs: update README.md 2023-10-27 21:42:17 -04:00
DarkSky
588f63505d fix: password reset token (#4743) 2023-10-27 09:52:29 +00:00
3720
ef8024c657 feat: new collections (#4530)
Co-authored-by: Peng Xiao <pengxiao@outlook.com>
2023-10-27 09:06:59 +00:00
Joooye_34
abbd8235aa chore(core): enable payment in canary (#4745) 2023-10-27 16:59:13 +08:00
Joooye_34
385de7d33b Merge remote-tracking branch 'origin/master' into payment-system 2023-10-27 16:04:48 +08:00
Cats Juice
87571a0879 chore(core): replace setting-modal sidebar icons (#4742) 2023-10-27 15:59:41 +08:00
JimmFly
af24334264 feat(core): add upgrade success page (#4738) 2023-10-27 15:49:32 +08:00
Joooye_34
9fc0152cb1 fix: directory error when publish npm lib (#4735) 2023-10-27 07:08:54 +00:00
JimmFly
35dbbe561a feat(core): adjust member tips (#4737) 2023-10-27 14:25:48 +08:00
liuyi
50563dcb6e feat(server): auto attach early access coupon (#4728) 2023-10-27 10:28:22 +08:00
Cats Juice
edb6e0fd69 feat(core): pricing plans actions (#4724) 2023-10-26 22:00:14 +08:00
liuyi
9334a363c7 chore(server): upgrade stripe sdk (#4733) 2023-10-26 12:37:52 +00:00
JimmFly
e0f7ac426c feat(core): add translation key for payment (#4723) 2023-10-26 16:15:12 +08:00
Joooye_34
1deb6bffd3 feat(core): disable payment in canary (#4722) 2023-10-26 00:50:39 +08:00
JimmFly
ae6376edee chore(core): update communities icon (#4719) 2023-10-25 10:45:54 +00:00
JimmFly
780c164cc8 fix(core): retrieve missing search result titles (#4718) 2023-10-25 10:45:14 +00:00
JimmFly
df69c908fe feat(core): adapt storage progress to payment system (#4713) 2023-10-25 16:18:30 +08:00
Cats Juice
eaa90c9fb6 feat(core): payment plans skeleton (#4715) 2023-10-25 16:16:50 +08:00
Cats Juice
e8a88da9e4 feat(core): auto scroll to current payment plan (#4714) 2023-10-25 10:58:19 +08:00
joooye34
559ec3956f v0.10.0-canary.3 2023-10-24 20:18:21 +08:00
Cats Juice
3749125907 feat(core): full width scroll area for plans (#4708) 2023-10-24 18:38:31 +08:00
liuyi
97d06432f0 fix(server): wrong invoice recurring value saved (#4712) 2023-10-24 18:32:52 +08:00
LongYinan
b13705ba3d ci: remove setup-maker to reduce release duration (#4710) 2023-10-24 10:09:40 +00:00
JimmFly
df77ffde9a feat(core): add account subscription status (#4707) 2023-10-24 18:05:56 +08:00
forehalo
ef1228dcb4 perf(server): opmitize updates table 2023-10-24 17:54:59 +08:00
dependabot[bot]
551287ab44 ci: bump actions/upload-artifact from 2 to 3 (#4701)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-24 09:36:07 +00:00
dependabot[bot]
113105181d ci: bump docker/login-action from 2 to 3 (#4702)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-24 09:01:09 +00:00
Flrande
627e5dfbb5 feat: bump blocksuite (#4706) 2023-10-24 09:00:27 +00:00
Joooye_34
21604a2cad Merge pull request #4699 from toeverything/61/subscription-edge-case
fix(server): subscription edge case
2023-10-24 16:11:37 +08:00
dependabot[bot]
fd6536ea90 ci: bump actions/checkout from 2 to 4 (#4700)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-24 06:00:00 +00:00
dependabot[bot]
a42d218962 ci: bump actions/setup-node from 3 to 4 (#4704)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-24 05:59:16 +00:00
JimmFly
5226d6c568 feat(core): add search result highlighting (#4667)
Co-authored-by: Peng Xiao <pengxiao@outlook.com>
2023-10-24 05:54:37 +00:00
dependabot[bot]
14bee1811c ci: bump docker/setup-qemu-action from 2 to 3 (#4703)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-24 05:13:58 +00:00
forehalo
7ecee01d20 fix(server): respond stripe webhook immediately 2023-10-24 12:09:14 +08:00
forehalo
2e4f6ef2ed feat(server): combine plan and recurring as stripe lookup key 2023-10-24 12:09:14 +08:00
forehalo
9b43380b05 fix(server): cancel scheduled subscription 2023-10-24 12:09:14 +08:00
liuyi
303dade2ef fix cancel subscription edge cases (#4691) 2023-10-24 11:40:46 +08:00
liuyi
113b20f669 fix(core): payment ui issues (#4672) 2023-10-24 11:40:46 +08:00
liuyi
95d37fc63f refactor(core): make subscription hook (#4669) 2023-10-24 11:40:46 +08:00
liuyi
858a1da35f feat(core): impl billing settings (#4652) 2023-10-24 11:40:46 +08:00
forehalo
1d62133f4f feat(core): impl subscription plans setting 2023-10-24 11:40:46 +08:00
forehalo
df054ac7f6 feat(core): payment backend 2023-10-24 11:40:44 +08:00
Alex Yang
493b815b7b fix(plugin-cli): use relative path (#4698) 2023-10-23 12:14:40 -05:00
dependabot[bot]
e75a0743f8 chore: bump @mui/material from 5.14.13 to 5.14.14 (#4678)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-23 08:07:04 +00:00
dependabot[bot]
5573afc8d5 ci: bump styfle/cancel-workflow-action from 0.11.0 to 0.12.0 (#4686)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-23 07:39:51 +00:00
dependabot[bot]
8b703fd9ad ci: bump docker/build-push-action from 4 to 5 (#4690)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-23 07:23:04 +00:00
dependabot[bot]
2a97194c75 ci: bump docker/setup-buildx-action from 2 to 3 (#4689)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-23 07:22:34 +00:00
dependabot[bot]
13b6bb7ee3 ci: bump kentaro-m/auto-assign-action from 1.2.4 to 1.2.5 (#4687)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-23 07:22:02 +00:00
dependabot[bot]
43220f6db6 ci: bump cloudflare/wrangler-action from 2.0.0 to 3.3.1 (#4688)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-23 07:21:54 +00:00
dependabot[bot]
b52e006bfe chore: bump @mui/icons-material from 5.14.13 to 5.14.14 (#4680)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-23 07:04:49 +00:00
Peng Xiao
a8b10c64b8 fix(component): disable CMDK list animation (#4685) 2023-10-23 06:46:11 +00:00
dependabot[bot]
9d6b335829 chore: bump @aws-sdk/client-s3 from 3.428.0 to 3.433.0 (#4682)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-23 06:38:37 +00:00
LongYinan
9820c80ee2 ci: dependabot group config 2023-10-23 15:03:50 +08:00
LongYinan
1dd17c6334 ci: fix electron app nightly build workflow (#4684) 2023-10-23 06:30:10 +00:00
LongYinan
b6d21c0945 fix(storage): rustix security fix (#4677) 2023-10-23 03:00:15 +00:00
LongYinan
aba771e99c feat: upgrade to yarn@4 (#4676) 2023-10-23 02:55:45 +00:00
Alex Yang
d9e2d17a26 refactor: cleanup code 2023-10-20 19:28:04 -05:00
DarkSky
779ac39b36 fix(server): captcha guard (#4673) 2023-10-20 08:54:08 +00:00
Peng Xiao
817463c40e feat(component): checkbox (#4665) 2023-10-20 03:46:44 +00:00
LongYinan
890905ed0e ci: fix electron make script on Windows 2023-10-19 22:44:55 +08:00
LongYinan
54aad58388 ci: fix electron make script on Windows (#4666) 2023-10-19 13:00:11 +00:00
LongYinan
37c6560dd6 v0.10.0-canary.2 2023-10-19 17:18:18 +08:00
LongYinan
352420b881 build: fix native module in aarch64 docker image (#4656) 2023-10-19 08:59:02 +00:00
Joooye_34
61d9958a4c feat(core): change favicon (#4663) 2023-10-19 08:46:59 +00:00
liuyi
7275d417b2 fix(server): avoid workspace subdoc guid conflict (#4664) 2023-10-19 08:12:57 +00:00
Joooye_34
d835be90cb chore: prettier ignore file generated by napi-rs (#4661) 2023-10-19 07:17:04 +00:00
JimmFly
c54489ba6e fix: wrong confirm button position (#4657) 2023-10-19 03:16:12 +00:00
Alex Yang
9958baa843 fix(hooks): use uuid as pageId (#4658) 2023-10-18 22:14:41 -05:00
Alex Yang
97d8660a54 refactor(electron): fix vitest and add behavior test (#4655) 2023-10-18 22:14:30 -05:00
Alex Yang
b14a6bc29e build: fix generate-assets.ts 2023-10-18 16:33:09 -05:00
Alex Yang
1d29c26284 docs: update README.md 2023-10-18 15:33:28 -05:00
Joooye_34
bed9310519 refactor(infra): directory structure (#4615) 2023-10-18 15:30:08 +00:00
Flrande
814d552be8 feat: bump blocksuite and fix bug in migration (#4653)
Co-authored-by: JimmFly <yangjinfei001@gmail.com>
2023-10-18 14:45:07 +00:00
DarkSky
63ca9671be feat: add captcha support for sign in/up (#4582) 2023-10-18 08:06:07 +00:00
Alex Yang
524e48c8e6 refactor(electron): typescript check on build scripts (#4650) 2023-10-18 06:13:47 +00:00
Peng Xiao
9b3e6bf1f5 fix(docs): update docs 2023-10-18 14:00:44 +08:00
Peng Xiao
4135cfd243 fix(docs): remove secret in readme 2023-10-18 13:45:41 +08:00
Alex Yang
be6bcfdb9a chore: fix version 2023-10-17 20:11:09 -05:00
Alex Yang
bb046a12dc refactor(native): remove unused code (#4651) 2023-10-17 18:19:06 -05:00
Alex Yang
a430266389 refactor: use jotai-effect (#4641) 2023-10-17 16:09:37 -05:00
Peng Xiao
62d2b09e3c fix(core): remove redundant providers (#4648) 2023-10-17 20:24:41 +00:00
LongYinan
e831f612e8 fix(electron): release desktop app workflow (#4594) 2023-10-17 06:15:55 +00:00
liuyi
01987990ee fix: make server guid consistent (#4341) 2023-10-17 02:34:13 +00:00
Alex Yang
b3dc4dce9c test: await setTimeout (#4643) 2023-10-16 21:14:45 -05:00
Peng Xiao
5e9eeaddbd build(electron): allow customizing channel type for internal build (#4511) 2023-10-17 01:15:19 +00:00
Alex Yang
a0095496d7 chore: release y-provider package (#4642) 2023-10-16 19:47:05 -05:00
Alex Yang
77efcad89d v0.10.0-canary.1 2023-10-16 16:30:17 -05:00
Alex Yang
1d06114f00 build(y-indexeddb): fix output package.json (#4640) 2023-10-16 16:25:09 -05:00
dependabot[bot]
579fa1ae4c chore: bump @faker-js/faker from 8.1.0 to 8.2.0 (#4631)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-16 19:23:30 +00:00
Peng Xiao
fea6b81a53 fix(electron): app image icon (#4442) 2023-10-16 15:54:28 +00:00
Alex Yang
7911d67439 chore: bump version (#4604) 2023-10-16 12:47:06 +00:00
JimmFly
efca651429 feat(core): add history shortcut (#4595) 2023-10-16 12:27:06 +00:00
JimmFly
07b5d18441 feat(core): add sign out confirm modal (#4592) 2023-10-16 08:44:09 +00:00
electron97
c1d386d932 fix: disabled form item in the settings can still be operated via keyboard (#4605) 2023-10-16 05:14:11 +00:00
Alex Yang
710a2f2c97 chore: bump version 2023-10-13 15:40:07 -05:00
JimmFly
2e1e486bc6 chore: bump playwright version (#4602) 2023-10-13 14:37:18 -05:00
Alex Yang
227017625d test(core): fix flaky (#4597) 2023-10-13 13:46:32 -05:00
Joooye_34
6ea10860b4 refactor(infra): record legacy data to improve testing stability (#4590) 2023-10-13 03:03:42 +00:00
LongYinan
286347420d 0.10.0-canary.0 2023-10-12 15:21:07 +08:00
JimmFly
daa976ca62 fix(component): adjust dialog and input style (#4566) 2023-10-12 05:49:39 +00:00
Alex Yang
d05897b724 chore: prohibit unnecessary await (#4586) 2023-10-12 05:04:58 +00:00
JimmFly
5ebd82dc04 feat(core): adjust share menu style (#4584) 2023-10-12 03:26:13 +00:00
Alex Yang
ae4322b75f chore: bump version (#4587) 2023-10-12 02:46:52 +00:00
Alex Yang
a0e6ff9bd1 test: fix migration (#4588) 2023-10-11 19:30:37 -05:00
Alex Yang
491cd75fe0 fix(infra): create template workspace with isolated nanoid (#4569) 2023-10-11 13:48:30 -05:00
LongYinan
5be5863693 chore: upgrade yarn@3.6.4 (#4585) 2023-10-11 17:23:22 +00:00
LongYinan
23abb97ccb fix: dependabot security issues (#4579) 2023-10-11 07:36:45 +00:00
dependabot[bot]
b09d5f3e18 chore: bump @types/eslint from 8.44.2 to 8.44.3 (#4551)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-11 07:35:41 +00:00
Alex Yang
a731499024 chore: remove unused file (#4576) 2023-10-11 06:05:21 +00:00
Alex Yang
8f5ee9234c test: remove deprecated api usage (#4577) 2023-10-11 06:05:06 +00:00
JimmFly
1f6a105e5c feat(core): add setting commands (#4568)
Co-authored-by: Peng Xiao <pengxiao@outlook.com>
2023-10-11 03:31:04 +00:00
LongYinan
b1eb926b7b style: enable no-extraneous-dependencies lint rule (#4575) 2023-10-10 17:51:47 +00:00
Alex Yang
c8d1de3a59 chore: bump version (#4571) 2023-10-10 17:43:41 +00:00
dependabot[bot]
aa7e0dd85b chore: bump @vitest/ui from 0.34.5 to 0.34.6 (#4553)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-10 03:47:44 +00:00
liuyi
0092a19812 refactor(server): deprecate unstable redis manager (#4567) 2023-10-10 03:23:12 +00:00
dependabot[bot]
4a6cfedc4a chore: bump react-i18next from 13.2.1 to 13.2.2 (#4562)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-10 03:11:07 +00:00
dependabot[bot]
8c97fd1d28 chore: bump sinon from 16.0.0 to 16.1.0 (#4563)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-10 03:10:21 +00:00
Peng Xiao
d9fe3e73d5 fix: list page storybook not rendering issue (#4560) 2023-10-09 07:54:05 +00:00
dependabot[bot]
59a4b3bc31 chore: bump electron from 26.2.2 to 26.3.0 (#4564)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-09 07:14:50 +00:00
Zero King
0161c98d65 chore: reword template galleries introduction (#4548) 2023-10-06 16:11:08 +08:00
dependabot[bot]
d3ffa2c5f2 chore: bump marked from 7.0.5 to 9.0.3 (#4554)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-03 15:28:38 +00:00
dependabot[bot]
0a6859a1d7 chore: bump esbuild from 0.19.3 to 0.19.4 (#4550)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-03 15:28:10 +00:00
JimmFly
69db99636b feat(core): add editor commanads (#4514)
Co-authored-by: Peng Xiao <pengxiao@outlook.com>
2023-10-02 03:22:12 +00:00
Alex Yang
aab1a1e50a fix(electron): output check (#4547) 2023-09-30 02:02:17 -05:00
Alex Yang
19646a97af fix: twitter preview (#4545) 2023-09-30 01:19:54 -05:00
Qinghao Huang
f59a35d8d2 fix: spacing issue in getting-started template (#4540) 2023-09-30 01:02:43 -05:00
Alex Yang
c911806062 refactor: remove bookmark plugin (#4544) 2023-09-30 00:48:33 -05:00
Qinghao Huang
b440c3a820 docs: update CLA.md (#4541) 2023-09-30 00:26:50 +00:00
Alex Yang
98cabc44e4 ci: remove unstable nx.yml (#4543) 2023-09-29 18:57:31 -05:00
LongYinan
dd94ea5b45 ci: speedup ci by reduce installation packages in certain job (#4457) 2023-09-29 03:02:26 +00:00
Joooye_34
b012e615ba fix(component): content should subtract height of the header (#4507) 2023-09-28 07:04:12 +00:00
Alex Yang
603f82ffc2 refactor: using unified nanoid (#4519) 2023-09-28 02:53:04 +00:00
Alex Yang
56f75160f3 refactor: remove unused packages (#4532) 2023-09-28 01:33:42 +00:00
dependabot[bot]
a860cf8e43 chore: bump electron from 26.1.0 to 26.2.1 (#4527)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-27 10:40:30 +00:00
liuyi
504dda2092 fix(core): setting ui regression (#4525) 2023-09-27 09:56:01 +00:00
JimmFly
1df8b6edfb feat(component): add private copy link button (#4508) 2023-09-27 04:54:02 +00:00
Alex Yang
ddfa5d394d chore: bump version (#4518) 2023-09-27 02:02:54 +00:00
Alex Yang
a69820e4ca fix: type in pluginImportsFunctionMap (#4517) 2023-09-27 01:53:01 +00:00
Peng Xiao
369db3fea5 fix(component): cmdk flaky (#4512) 2023-09-27 01:37:00 +00:00
liuyi
4a03fa65d1 fix(server): wrong member count query (#4506) 2023-09-26 15:36:08 +00:00
Alex Yang
a633fb6dea fix: current page atom (#4515) 2023-09-26 14:53:01 +00:00
JimmFly
1b6cd70247 chore(core): temporarily remove set-syncing-mode (#4489) 2023-09-26 14:11:04 +00:00
Peng Xiao
29fa237dfb fix: storybook previews (#4504) 2023-09-26 05:51:39 +00:00
Alex Yang
61044d91a8 fix(core): page update date (#4502) 2023-09-26 04:09:52 +00:00
Peng Xiao
eb728f7ef2 fix: give content match a lower score (#4499) 2023-09-26 03:15:40 +00:00
JimmFly
1bdc402b7b fix: adjust 404 page style (#4491) 2023-09-26 02:51:58 +00:00
Alex Yang
127a84b4e1 refactor(plugin-cli): use @plugxjs/vite-plugin (#4501) 2023-09-26 02:49:23 +00:00
JimmFly
2e1acec3c0 fix: unexpected pop ups (#4468) 2023-09-26 02:41:45 +00:00
dependabot[bot]
672a01b385 chore: bump sinon from 15.2.0 to 16.0.0 (#4480)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-25 20:17:25 +00:00
Joooye_34
ad63c5a525 fix(component): background animation is different (#4495) 2023-09-25 16:50:39 +00:00
Alex Yang
3a79346ce0 test: workspace provider (#4497) 2023-09-25 16:49:23 +00:00
dependabot[bot]
bf729df7fe chore: bump vite-tsconfig-paths from 4.2.0 to 4.2.1 (#4481)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-25 16:05:09 +00:00
dependabot[bot]
b785840d91 chore: bump marked-gfm-heading-id from 3.0.6 to 3.1.0 (#4479)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-25 16:04:47 +00:00
Peng Xiao
e8410b948d chore(component): bump themes (#4484) 2023-09-25 12:03:28 +00:00
Peng Xiao
3f09ba92bc fix: cmdk scrollbar gutter (#4488) 2023-09-25 12:03:02 +00:00
JimmFly
35dc6d6687 fix: unexpected hover behavior of collection sidebar (#4490) 2023-09-25 10:22:59 +00:00
JimmFly
5b4ce75e13 feat: add commands (#4477) 2023-09-25 10:10:53 +00:00
Peng Xiao
dc6b66c32f fix: register command re-rendering (#4476) 2023-09-25 02:40:53 +00:00
LongYinan
5f7f5b74ca fix(core): error state for non early access user while signing in with email (#4467) 2023-09-23 00:00:09 -07:00
LongYinan
7b5157aa89 fix(server): missing dependency in sync app (#4465) 2023-09-22 21:32:45 +00:00
Alex Yang
bd0ed7f474 test: fix flaky (#4463) 2023-09-22 20:18:41 +00:00
Alex Yang
2da6702991 refactor(infra): simplify currentWorkspaceAtom (#4462) 2023-09-22 20:07:26 +00:00
Alex Yang
56d8fa5d29 docs: upload LICENSE.md 2023-09-22 14:38:19 -05:00
Alex Yang
4e5e48ce9f docs: update README.md
There are no core members actually, people is just a paid guy.
2023-09-22 14:31:15 -05:00
Peng Xiao
e0063ebc9b feat: new CMD-K (#4408) 2023-09-22 14:31:26 +00:00
Peng Xiao
27e4599c94 chore: bump components version (#4454) 2023-09-22 08:56:10 +00:00
JimmFly
edd7d00104 refactor: workspace list (#4432) 2023-09-22 15:02:31 +08:00
1531 changed files with 49487 additions and 29437 deletions

View File

@@ -11,3 +11,4 @@ ENABLE_CLOUD=
ENABLE_MOVE_DATABASE=
SHOULD_REPORT_TRACE=
TRACE_REPORT_ENDPOINT=
CAPTCHA_SITE_KEY=

View File

@@ -7,10 +7,10 @@ affine-out
_next
lib
.eslintrc.js
packages/i18n/src/i18n-generated.ts
e2e-dist-*
static
web-static
public
packages/sdk/src/*.d.ts
packages/sdk/src/*.js
packages/common/sdk/src/*.d.ts
packages/common/sdk/src/*.js
packages/frontend/i18n/src/i18n-generated.ts

View File

@@ -56,26 +56,25 @@ const createPattern = packageName => [
];
const allPackages = [
'packages/cli',
'packages/component',
'packages/debug',
'packages/env',
'packages/graphql',
'packages/hooks',
'packages/i18n',
'packages/native',
'packages/infra',
'packages/sdk',
'packages/templates',
'packages/theme',
'packages/workspace',
'packages/y-indexeddb',
'apps/web',
'apps/server',
'apps/electron',
'apps/storybook',
'plugins/copilot',
'plugins/bookmark-block',
'packages/backend/server',
'packages/frontend/component',
'packages/frontend/web',
'packages/frontend/electron',
'packages/frontend/graphql',
'packages/frontend/hooks',
'packages/frontend/i18n',
'packages/frontend/native',
'packages/frontend/templates',
'packages/frontend/workspace',
'packages/common/debug',
'packages/common/env',
'packages/common/infra',
'packages/common/sdk',
'packages/common/theme',
'packages/common/y-indexeddb',
'packages/plugins/copilot',
'tools/cli',
'tests/storybook',
];
/**
@@ -88,7 +87,7 @@ const config = {
version: 'detect',
},
next: {
rootDir: 'apps/web',
rootDir: 'packages/frontend/core',
},
},
extends: [
@@ -128,10 +127,12 @@ const config = {
'no-constant-binary-expression': 'error',
'no-constructor-return': 'error',
'react/prop-types': 'off',
'react/jsx-no-useless-fragment': 'error',
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/no-non-null-assertion': 'error',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/no-unused-vars': [
'error',
{
@@ -202,6 +203,7 @@ const config = {
ignore: ['^\\[[a-zA-Z0-9-_]+\\]\\.tsx$'],
},
],
'unicorn/no-unnecessary-await': 'error',
'sonarjs/no-all-duplicated-branches': 'error',
'sonarjs/no-element-overwrite': 'error',
'sonarjs/no-empty-collection': 'error',
@@ -221,7 +223,7 @@ const config = {
},
overrides: [
{
files: 'apps/server/**/*.ts',
files: 'packages/backend/server/**/*.ts',
rules: {
'@typescript-eslint/consistent-type-imports': 0,
},
@@ -252,6 +254,7 @@ const config = {
},
],
'@typescript-eslint/no-misused-promises': ['error'],
'i/no-extraneous-dependencies': ['error'],
},
})),
{

1
.github/CLA.md vendored
View File

@@ -61,3 +61,4 @@ Example:
- Shishu, @shishudesu, 2023/05/19
- Kushagra Singh, @kush002, 2023/06/28
- Sarvesh Kumar, @sarvesh521 2023/08/25
- 微扰理论 Qinghao Huang, @wfnuser 2023/09/29

View File

@@ -19,6 +19,8 @@ runs:
with:
toolchain: stable
targets: ${{ inputs.target }}
env:
CARGO_INCREMENTAL: '1'
- name: Cache cargo
uses: actions/cache@v3
@@ -34,7 +36,7 @@ runs:
if: ${{ inputs.target != 'x86_64-unknown-linux-gnu' && inputs.target != 'aarch64-unknown-linux-gnu' }}
shell: bash
run: |
yarn nx build ${{ inputs.package }} --target ${{ inputs.target }}
yarn workspace ${{ inputs.package }} nx build ${{ inputs.package }} --target ${{ inputs.target }}
env:
NX_CLOUD_ACCESS_TOKEN: ${{ inputs.nx_token }}
@@ -48,7 +50,7 @@ runs:
export CC=x86_64-unknown-linux-gnu-gcc
export CC_x86_64_unknown_linux_gnu=x86_64-unknown-linux-gnu-gcc
export RUSTFLAGS="-C debuginfo=1"
yarn nx build ${{ inputs.package }} --target ${{ inputs.target }}
yarn workspace ${{ inputs.package }} nx build ${{ inputs.package }} --target ${{ inputs.target }}
chmod -R 777 node_modules/.cache
chmod -R 777 target
@@ -60,6 +62,6 @@ runs:
options: --user 0:0 -v ${{ github.workspace }}/.cargo-cache/git/db:/usr/local/cargo/git/db -v ${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache -v ${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index -v ${{ github.workspace }}:/build -w /build -e NX_CLOUD_ACCESS_TOKEN=${{ inputs.nx_token }}
run: |
export RUSTFLAGS="-C debuginfo=1"
yarn nx build ${{ inputs.package }} --target ${{ inputs.target }}
yarn workspace ${{ inputs.package }} nx build ${{ inputs.package }} --target ${{ inputs.target }}
chmod -R 777 node_modules/.cache
chmod -R 777 target

View File

@@ -13,6 +13,8 @@ const {
R2_ACCESS_KEY_ID,
R2_SECRET_ACCESS_KEY,
R2_BUCKET,
ENABLE_CAPTCHA,
CAPTCHA_TURNSTILE_SECRET,
OAUTH_EMAIL_SENDER,
OAUTH_EMAIL_LOGIN,
OAUTH_EMAIL_PASSWORD,
@@ -23,6 +25,8 @@ const {
GCLOUD_CLOUD_SQL_INTERNAL_ENDPOINT,
REDIS_HOST,
REDIS_PASSWORD,
STRIPE_API_KEY,
STRIPE_WEBHOOK_KEY,
} = process.env;
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -64,8 +68,8 @@ const createHelmCommand = ({ isDryRun }) => {
]
: [];
const webReplicaCount = isProduction ? 3 : isBeta ? 2 : 2;
const graphqlReplicaCount = isProduction ? 3 : isBeta ? 2 : 2;
const syncReplicaCount = isProduction ? 6 : isBeta ? 3 : 2;
const graphqlReplicaCount = isProduction ? 10 : isBeta ? 10 : 2;
const syncReplicaCount = isProduction ? 10 : isBeta ? 10 : 2;
const namespace = isProduction ? 'production' : isBeta ? 'beta' : 'dev';
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const host = DEPLOY_HOST || CANARY_DEPLOY_HOST;
@@ -81,6 +85,8 @@ const createHelmCommand = ({ isDryRun }) => {
`--set graphql.replicaCount=${graphqlReplicaCount}`,
`--set-string graphql.image.tag="${imageTag}"`,
`--set graphql.app.host=${host}`,
`--set graphql.app.captcha.enabled=${ENABLE_CAPTCHA}`,
`--set-string graphql.app.captcha.turnstile.secret="${CAPTCHA_TURNSTILE_SECRET}"`,
`--set graphql.app.objectStorage.r2.enabled=true`,
`--set-string graphql.app.objectStorage.r2.accountId="${R2_ACCOUNT_ID}"`,
`--set-string graphql.app.objectStorage.r2.accessKeyId="${R2_ACCESS_KEY_ID}"`,
@@ -92,7 +98,10 @@ const createHelmCommand = ({ isDryRun }) => {
`--set-string graphql.app.oauth.google.enabled=true`,
`--set-string graphql.app.oauth.google.clientId="${AFFINE_GOOGLE_CLIENT_ID}"`,
`--set-string graphql.app.oauth.google.clientSecret="${AFFINE_GOOGLE_CLIENT_SECRET}"`,
`--set-string graphql.app.payment.stripe.apiKey="${STRIPE_API_KEY}"`,
`--set-string graphql.app.payment.stripe.webhookKey="${STRIPE_WEBHOOK_KEY}"`,
`--set graphql.app.experimental.enableJwstCodec=true`,
`--set graphql.app.features.earlyAccessPreview=false`,
`--set sync.replicaCount=${syncReplicaCount}`,
`--set-string sync.image.tag="${imageTag}"`,
...serviceAnnotations,

View File

@@ -1,16 +0,0 @@
name: Setup maker
description: 'Setup maker dmg for electron'
runs:
using: 'composite'
steps:
- name: 'Install @electron-forge/maker-dmg'
if: runner.os == 'macos'
shell: bash
working-directory: ./apps/electron
run: yarn add @electron-forge/maker-dmg --dev
env:
HUSKY: '0'
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'
ELECTRON_SKIP_BINARY_DOWNLOAD: '1'
SENTRYCLI_SKIP_DOWNLOAD: '1'

View File

@@ -21,6 +21,21 @@ inputs:
description: 'set nmMode to hardlinks-local in .yarnrc.yml'
required: false
default: 'true'
build-infra:
description: 'Build infra'
required: false
default: 'true'
build-plugins:
description: 'Build plugins'
required: false
default: 'true'
nmHoistingLimits:
description: 'Set nmHoistingLimits in .yarnrc.yml'
required: false
enableScripts:
description: 'Set enableScripts in .yarnrc.yml'
required: false
default: 'true'
runs:
using: 'composite'
@@ -38,26 +53,38 @@ runs:
shell: bash
run: yarn config set nmMode hardlinks-local
- name: Set nmHoistingLimits
if: ${{ inputs.nmHoistingLimits }}
shell: bash
run: yarn config set nmHoistingLimits ${{ inputs.nmHoistingLimits }}
- name: Set enableScripts
if: ${{ inputs.enableScripts == 'false' }}
shell: bash
run: yarn config set enableScripts false
- name: yarn install
if: ${{ inputs.package-install == 'true' }}
continue-on-error: true
shell: bash
run: yarn install ${{ inputs.extra-flags }}
run: yarn ${{ inputs.extra-flags }}
env:
HUSKY: '0'
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'
ELECTRON_SKIP_BINARY_DOWNLOAD: '1'
SENTRYCLI_SKIP_DOWNLOAD: '1'
DEBUG: '*'
- name: yarn install (try again)
if: ${{ steps.install.outcome == 'failure' }}
shell: bash
run: yarn install ${{ inputs.extra-flags }}
run: yarn ${{ inputs.extra-flags }}
env:
HUSKY: '0'
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'
ELECTRON_SKIP_BINARY_DOWNLOAD: '1'
SENTRYCLI_SKIP_DOWNLOAD: '1'
DEBUG: '*'
- name: Get installed Playwright version
id: playwright-version
@@ -89,11 +116,11 @@ runs:
${{ runner.os }}-${{ runner.arch }}-playwright-
# If the Playwright browser binaries weren't able to be restored, we tell
# paywright to install everything for us.
# playwright to install everything for us.
- name: Install Playwright's dependencies
shell: bash
if: inputs.playwright-install == 'true' && steps.playwright-cache.outputs.cache-hit != 'true'
run: yarn playwright install --with-deps
if: inputs.playwright-install == 'true'
run: yarn playwright install --with-deps chromium
- name: Get installed Electron version
id: electron-version
@@ -114,14 +141,16 @@ runs:
- name: Install Electron binary
shell: bash
if: inputs.electron-install == 'true'
run: node apps/electron/node_modules/electron/install.js
run: node ./node_modules/electron/install.js
env:
ELECTRON_OVERRIDE_DIST_PATH: ./node_modules/.cache/electron
- name: Build Infra
shell: bash
if: inputs.build-infra == 'true'
run: yarn run build:infra
- name: Build Plugins
if: inputs.build-plugins == 'true'
shell: bash
run: yarn run build:plugins

View File

@@ -2,8 +2,30 @@ version: 2
updates:
- package-ecosystem: 'npm'
directory: '/'
groups:
all-npm-dependencies:
patterns:
- '*'
schedule:
interval: 'weekly'
versioning-strategy: increase
commit-message:
prefix: 'chore'
- package-ecosystem: 'cargo'
directory: '/'
schedule:
interval: 'weekly'
versioning-strategy: auto
commit-message:
prefix: 'chore'
groups:
all-cargo-dependencies:
patterns:
- '*'
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'daily'
commit-message:
prefix: 'ci'

View File

@@ -1,6 +1,6 @@
FROM openresty/openresty:1.21.4.1-0-buster
WORKDIR /app
COPY ./apps/core/dist ./dist
COPY ./packages/frontend/core/dist ./dist
COPY ./.github/deployment/front/nginx.conf /usr/local/openresty/nginx/conf/nginx.conf
COPY ./.github/deployment/front/affine.nginx.conf /etc/nginx/conf.d/affine.nginx.conf

View File

@@ -1,6 +1,6 @@
FROM node:18-bookworm-slim
COPY ./apps/server /app
COPY ./packages/backend/server /app
WORKDIR /app
RUN apt-get update && \

View File

@@ -0,0 +1,9 @@
{{- if .Values.app.captcha.enabled -}}
apiVersion: v1
kind: Secret
metadata:
name: "{{ .Values.app.captcha.secretName }}"
type: Opaque
data:
turnstileSecret: {{ .Values.app.captcha.turnstile.secret | b64enc }}
{{- end }}

View File

@@ -73,6 +73,10 @@ spec:
value: "{{ .Values.app.host }}"
- name: ENABLE_R2_OBJECT_STORAGE
value: "{{ .Values.app.objectStorage.r2.enabled }}"
- name: ENABLE_CAPTCHA
value: "{{ .Values.app.captcha.enabled }}"
- name: FEATURES_EARLY_ACCESS_PREVIEW
value: "{{ .Values.app.features.earlyAccessPreview }}"
- name: OAUTH_EMAIL_SENDER
valueFrom:
secretKeyRef:
@@ -98,6 +102,16 @@ spec:
secretKeyRef:
name: "{{ .Values.app.oauth.email.secretName }}"
key: password
- name: STRIPE_API_KEY
valueFrom:
secretKeyRef:
name: "{{ .Values.app.payment.stripe.secretName }}"
key: stripeAPIKey
- name: STRIPE_WEBHOOK_KEY
valueFrom:
secretKeyRef:
name: "{{ .Values.app.payment.stripe.secretName }}"
key: stripeWebhookKey
- name: DOC_MERGE_INTERVAL
value: "{{ .Values.app.doc.mergeInterval }}"
{{ if .Values.app.experimental.enableJwstCodec }}
@@ -126,6 +140,13 @@ spec:
name: "{{ .Values.app.objectStorage.r2.secretName }}"
key: bucket
{{ end }}
{{ if .Values.app.captcha.enabled }}
- name: CAPTCHA_TURNSTILE_SECRET
valueFrom:
secretKeyRef:
name: "{{ .Values.app.captcha.secretName }}"
key: turnstileSecret
{{ end }}
{{ if .Values.app.oauth.google.enabled }}
- name: OAUTH_GOOGLE_CLIENT_ID
valueFrom:

View File

@@ -16,7 +16,7 @@ spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
command: ["yarn", "prisma", "migrate", "deploy"]
command: ["yarn", "predeploy"]
env:
- name: NODE_ENV
value: "{{ .Values.env }}"

View File

@@ -0,0 +1,8 @@
apiVersion: v1
kind: Secret
metadata:
name: "{{ .Values.app.payment.stripe.secretName }}"
type: Opaque
data:
stripeAPIKey: "{{ .Values.app.payment.stripe.apiKey | b64enc }}"
stripeWebhookKey: "{{ .Values.app.payment.stripe.webhookKey | b64enc }}"

View File

@@ -22,6 +22,11 @@ app:
secretName: jwt-private-key
# base64 encoded ecdsa private key
privateKey: ''
captcha:
enable: false
secretName: captcha
turnstile:
secret: ''
objectStorage:
r2:
enabled: false
@@ -48,6 +53,13 @@ app:
secretName: oauth-github
clientId: ''
clientSecret: ''
payment:
stripe:
secretName: 'stripe'
apiKey: ''
webhookKey: ''
features:
earlyAccessPreview: false
serviceAccount:
create: true

43
.github/labeler.yml vendored
View File

@@ -1,7 +1,7 @@
docs:
- 'docs/**/*'
- '**/README.md'
- 'packages/templates/**/*'
- 'packages/frontend/templates/**/*'
test:
- 'tests/**/*'
@@ -10,40 +10,37 @@ test:
mod:dev:
- 'scripts/**/*'
- 'packages/cli/**/*'
- 'packages/debug/**/*'
- 'tools/cli/**/*'
- 'packages/common/debug/**/*'
mod:plugin:
- 'plugins/**/*'
plugin:bookmark-block:
- 'plugins/bookmark-block/**/*'
- 'packages/plugins/**/*'
plugin:copilot:
- 'plugins/copilot/**/*'
- 'packages/plugins/copilot/**/*'
mod:infra:
- 'packages/infra/**/*'
- 'packages/common/infra/**/*'
mod:sdk:
- 'packages/sdk/**/*'
- 'packages/common/sdk/**/*'
mod:plugin-cli:
- 'packages/plugin-cli/**/*'
- 'tools/plugin-cli/**/*'
mod:workspace: 'packages/workspace/**/*'
mod:workspace: 'packages/frontend/workspace/**/*'
mod:i18n: 'packages/i18n/**/*'
mod:i18n: 'packages/frontend/i18n/**/*'
mod:env: 'packages/env/**/*'
mod:env: 'packages/common/env/**/*'
mod:hooks: 'packages/hooks/**/*'
mod:hooks: 'packages/frontend/hooks/**/*'
mod:component: 'packages/component/**/*'
mod:component: 'packages/frontend/component/**/*'
mod:storage: 'packages/storage/**/*'
mod:storage: 'packages/backend/storage/**/*'
mod:native: 'packages/native/**/*'
mod:native: 'packages/frontend/native/**/*'
mod:store:
- '**/atoms/**/*'
@@ -56,12 +53,10 @@ rust:
- '**/rust-toolchain.toml'
- '**/rustfmt.toml'
package:y-indexeddb: 'packages/y-indexeddb/**/*'
package:y-indexeddb: 'packages/common/y-indexeddb/**/*'
app:core: 'apps/core/**/*'
app:core: 'packages/frontend/core/**/*'
app:electron: 'apps/electron/**/*'
app:electron: 'packages/frontend/electron/**/*'
app:server: 'apps/server/**/*'
app:docs: 'apps/docs/**/*'
app:server: 'packages/backend/server/**/*'

View File

@@ -38,27 +38,43 @@ jobs:
build-core:
name: Build @affine/core
runs-on: ubuntu-latest
environment: development
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: Build Plugins
run: yarn run build:plugins
with:
electron-install: false
- name: Build Core
run: yarn nx build @affine/core
- name: Upload core artifact
uses: actions/upload-artifact@v3
with:
name: core
path: ./apps/core/dist
path: ./packages/frontend/core/dist
if-no-files-found: error
build-native:
name: Build Native
runs-on: ubuntu-latest
needs: build-core
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: Build AFFiNE native
uses: ./.github/actions/build-rust
with:
target: x86_64-unknown-linux-gnu
package: '@affine/native'
nx_token: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
- name: Run tests
run: yarn test
working-directory: ./packages/frontend/native
desktop-test:
name: Desktop Test
runs-on: ${{ matrix.spec.os }}
environment: development
strategy:
fail-fast: false
# all combinations: macos-latest x64, macos-latest arm64, windows-latest x64, ubuntu-latest x64
@@ -94,13 +110,15 @@ jobs:
}
needs: build-core
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Node.js
uses: ./.github/actions/setup-node
timeout-minutes: 10
with:
extra-flags: workspaces focus @affine/electron @affine/monorepo @affine-test/affine-desktop
playwright-install: true
hard-link-nm: false
enableScripts: false
- name: Build AFFiNE native
uses: ./.github/actions/build-rust
@@ -108,20 +126,18 @@ jobs:
target: ${{ matrix.spec.target }}
package: '@affine/native'
nx_token: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
- name: Run unit tests
if: ${{ matrix.spec.test }}
shell: bash
run: yarn vitest
working-directory: ./apps/electron
working-directory: packages/frontend/electron
- name: Download core artifact
uses: actions/download-artifact@v3
with:
name: core
path: apps/electron/resources/web-static
- name: Build Plugins
run: yarn run build:plugins
path: packages/frontend/electron/resources/web-static
- name: Build Desktop Layers
run: yarn workspace @affine/electron build
@@ -142,13 +158,13 @@ jobs:
if: ${{ matrix.spec.os == 'macos-latest' && matrix.spec.arch == 'arm64' }}
env:
SKIP_BUNDLE: true
SKIP_WEB_BUILD: true
run: yarn workspace @affine/electron make --platform=darwin --arch=arm64
- name: Output check
if: ${{ matrix.spec.os == 'macos-latest' && matrix.spec.arch == 'arm64' }}
run: |
yarn ts-node-esm ./scripts/macos-arm64-output-check.mts
working-directory: apps/electron
yarn workspace @affine/electron ts-node ./scripts/macos-arm64-output-check.ts
- name: Collect code coverage report
if: ${{ matrix.spec.test }}

View File

@@ -39,13 +39,17 @@ jobs:
runs-on: ubuntu-latest
env:
RUSTFLAGS: '-C debuginfo=1'
environment: development
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: Setup Rust
with:
extra-flags: workspaces focus @affine/storage
electron-install: false
build-infra: false
build-plugins: false
- name: Build Rust
uses: ./.github/actions/build-rust
with:
target: 'x86_64-unknown-linux-gnu'
@@ -55,13 +59,12 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: storage.node
path: ./packages/storage/storage.node
path: ./packages/backend/storage/storage.node
if-no-files-found: error
server-test:
name: Server Test
runs-on: ubuntu-latest
environment: development
needs: build-storage
services:
postgres:
@@ -81,10 +84,12 @@ jobs:
- 1025:1025
- 8025:8025
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Node.js
uses: ./.github/actions/setup-node
with:
electron-install: false
- name: Initialize database
run: |
@@ -102,7 +107,7 @@ jobs:
DATABASE_URL: postgresql://affine:affine@localhost:5432/affine
- name: Run init-db script
run: yarn workspace @affine/server exec ts-node-esm ./scripts/init-db.ts
run: yarn workspace @affine/server exec ts-node ./scripts/init-db.ts
env:
DATABASE_URL: postgresql://affine:affine@localhost:5432/affine
@@ -110,7 +115,7 @@ jobs:
uses: actions/download-artifact@v3
with:
name: storage.node
path: ./apps/server
path: ./packages/backend/server
- name: Run server tests
run: yarn workspace @affine/server test:coverage
@@ -122,7 +127,7 @@ jobs:
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./apps/server/.coverage/lcov.info
files: ./packages/backend/server/.coverage/lcov.info
flags: server-test
name: affine
fail_ci_if_error: false
@@ -130,7 +135,6 @@ jobs:
server-e2e-test:
name: Server E2E Test
runs-on: ubuntu-latest
environment: development
needs: build-storage
services:
postgres:
@@ -150,7 +154,7 @@ jobs:
- 1025:1025
- 8025:8025
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Node.js
uses: ./.github/actions/setup-node
@@ -173,7 +177,7 @@ jobs:
DATABASE_URL: postgresql://affine:affine@localhost:5432/affine
- name: Run init-db script
run: yarn workspace @affine/server exec ts-node-esm ./scripts/init-db.ts
run: yarn workspace @affine/server exec ts-node ./scripts/init-db.ts
env:
DATABASE_URL: postgresql://affine:affine@localhost:5432/affine
@@ -181,7 +185,7 @@ jobs:
uses: actions/download-artifact@v3
with:
name: storage.node
path: ./apps/server
path: ./packages/backend/server
- name: Run playwright tests
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn workspace @affine-test/affine-cloud e2e --forbid-only
@@ -212,7 +216,6 @@ jobs:
server-desktop-e2e-test:
name: Server Desktop E2E Test
runs-on: ubuntu-latest
environment: development
needs: build-storage
services:
postgres:
@@ -232,7 +235,7 @@ jobs:
- 1025:1025
- 8025:8025
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Node.js
uses: ./.github/actions/setup-node
@@ -257,15 +260,13 @@ jobs:
- name: Generate prisma client
run: |
yarn exec prisma generate
yarn exec prisma db push
working-directory: apps/server
yarn workspace @affine/server exec prisma generate
yarn workspace @affine/server prisma db push
env:
DATABASE_URL: postgresql://affine:affine@localhost:5432/affine
- name: Run init-db script
run: yarn exec ts-node-esm ./scripts/init-db.ts
working-directory: apps/server
run: yarn workspace @affine/server exec ts-node ./scripts/init-db.ts
env:
DATABASE_URL: postgresql://affine:affine@localhost:5432/affine
@@ -273,7 +274,7 @@ jobs:
uses: actions/download-artifact@v3
with:
name: storage.node
path: ./apps/server
path: ./packages/backend/server
- name: Build Plugins
run: yarn run build:plugins

View File

@@ -39,10 +39,12 @@ jobs:
lint:
name: Lint
runs-on: ubuntu-latest
environment: development
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Run oxlint
# oxlint is fast, so wrong code will fail quickly
run: yarn dlx oxlint@latest .
- name: Setup Node.js
uses: ./.github/actions/setup-node
with:
@@ -64,54 +66,18 @@ jobs:
check-yarn-binary:
name: Check yarn binary
runs-on: ubuntu-latest
environment: development
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Run check
run: |
yarn set version $(node -e "console.log(require('./package.json').packageManager.split('@')[1])")
git diff --exit-code
build-prototype:
name: Build Prototype
runs-on: ubuntu-latest
environment: development
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: ./.github/actions/setup-node
with:
electron-install: false
- name: Build Prototype
run: yarn nx build prototype
- name: Upload prototype artifact
uses: actions/upload-artifact@v3
with:
name: prototype
path: ./apps/prototype/dist
if-no-files-found: error
build-docs:
name: Build Docs
runs-on: ubuntu-latest
environment: development
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: ./.github/actions/setup-node
with:
electron-install: false
- run: yarn nx build @affine/docs
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
e2e-plugin-test:
name: E2E Plugin Test
runs-on: ubuntu-latest
environment: development
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Node.js
uses: ./.github/actions/setup-node
with:
@@ -142,49 +108,6 @@ jobs:
path: ./test-results
if-no-files-found: ignore
e2e-prototype-test:
name: E2E Prototype Test
runs-on: ubuntu-latest
environment: development
needs: build-prototype
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: ./.github/actions/setup-node
with:
playwright-install: true
electron-install: false
- name: Download prototype artifact
uses: actions/download-artifact@v3
with:
name: prototype
path: ./apps/prototype/dist
- name: Run playwright tests
run: yarn e2e --forbid-only
working-directory: tests/affine-prototype
env:
COVERAGE: true
# - name: Collect code coverage report
# run: yarn exec nyc report -t .nyc_output --report-dir .coverage --reporter=lcov
# - name: Upload e2e test coverage results
# uses: codecov/codecov-action@v3
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# files: ./.coverage/lcov.info
# flags: e2etest-prototype
# name: affine
# fail_ci_if_error: false
- name: Upload test results
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: test-results-e2e-prototype
path: ./test-results
if-no-files-found: ignore
e2e-test:
name: E2E Test
runs-on: ubuntu-latest
@@ -192,9 +115,8 @@ jobs:
fail-fast: false
matrix:
shard: [1, 2, 3, 4, 5]
environment: development
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Node.js
uses: ./.github/actions/setup-node
with:
@@ -230,48 +152,42 @@ jobs:
e2e-migration-test:
name: E2E Migration Test
runs-on: ubuntu-latest
environment: development
strategy:
matrix:
spec:
- { package: 0.7.0-canary.18 }
- { package: 0.8.0-canary.7 }
- { package: 0.8.3 }
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Node.js
uses: ./.github/actions/setup-node
with:
playwright-install: true
electron-install: false
- name: Unzip
run: yarn unzip
working-directory: ./tests/affine-legacy/${{ matrix.spec.package }}
- name: Run playwright tests
run: yarn e2e --forbid-only
working-directory: ./tests/affine-legacy/${{ matrix.spec.package }}
run: yarn workspace @affine-test/affine-migration e2e --forbid-only
- name: Upload test results
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: test-results-e2e-migration-${{ matrix.spec.package }}
path: ./tests/affine-legacy/${{ matrix.spec.package }}/test-results
name: test-results-e2e-migration
path: ./tests/affine-migration/test-results
if-no-files-found: ignore
unit-test:
name: Unit Test
runs-on: ubuntu-latest
environment: development
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Node.js
uses: ./.github/actions/setup-node
with:
electron-install: false
- name: Build AFFiNE native
uses: ./.github/actions/build-rust
with:
target: x86_64-unknown-linux-gnu
package: '@affine/native'
nx_token: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
- name: Unit Test
run: yarn nx test:coverage @affine/monorepo

View File

@@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Cleanup
run: |

View File

@@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- uses: styfle/cancel-workflow-action@0.11.0
- uses: styfle/cancel-workflow-action@0.12.0
with:
# See https://api.github.com/repos/toeverything/AFFiNE/actions/workflows
workflow_id: 44038251, 61883931, 65188160, 66789140

View File

@@ -37,7 +37,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL

View File

@@ -1,15 +1,10 @@
name: Deploy
on:
push:
branches:
- master
tags:
- 'v[0-9]+.[0-9]+.[0-9]+-canary.[0-9]+'
workflow_dispatch:
inputs:
flavor:
description: 'Build type (canary, beta, internal or stable)'
description: 'Build type (canary, beta, or stable)'
type: string
default: canary
@@ -24,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.flavor }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Node.js
uses: ./.github/actions/setup-node
with:
@@ -35,15 +30,14 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: server-dist
path: ./apps/server/dist
path: ./packages/backend/server/dist
if-no-files-found: error
build-core:
name: Build @affine/core
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: Build Plugins
@@ -57,20 +51,20 @@ jobs:
BUILD_TYPE_OVERRIDE: ${{ github.event.inputs.flavor }}
SHOULD_REPORT_TRACE: true
TRACE_REPORT_ENDPOINT: ${{ secrets.TRACE_REPORT_ENDPOINT }}
CAPTCHA_SITE_KEY: ${{ secrets.CAPTCHA_SITE_KEY }}
- name: Upload core artifact
uses: actions/upload-artifact@v3
with:
name: core
path: ./apps/core/dist
path: ./packages/frontend/core/dist
if-no-files-found: error
build-storage:
name: Build Storage
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.flavor }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: Setup Rust
@@ -83,34 +77,62 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: storage.node
path: ./packages/storage/storage.node
path: ./packages/backend/storage/storage.node
if-no-files-found: error
build-storage-arm64:
name: Build Storage arm64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: Setup Rust
uses: ./.github/actions/build-rust
with:
target: 'aarch64-unknown-linux-gnu'
package: '@affine/storage'
nx_token: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
- name: Upload storage.node
uses: actions/upload-artifact@v3
with:
name: storage.arm64.node
path: ./packages/backend/storage/storage.node
if-no-files-found: error
build-docker:
name: Build Docker
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.flavor }}
needs:
- build-server
- build-core
- build-storage
- build-storage-arm64
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Download core artifact
uses: actions/download-artifact@v3
with:
name: core
path: ./apps/core/dist
path: ./packages/frontend/core/dist
- name: Download server dist
uses: actions/download-artifact@v3
with:
name: server-dist
path: ./apps/server/dist
path: ./packages/backend/server/dist
- name: Download storage.node
uses: actions/download-artifact@v3
with:
name: storage.node
path: ./apps/server
path: ./packages/backend/server
- name: Download storage.node arm64
uses: actions/download-artifact@v3
with:
name: storage.arm64.node
path: ./packages/backend/storage
- name: move storage.arm64.node
run: mv ./packages/backend/storage/storage.node ./packages/backend/server/storage.arm64.node
- name: Setup env
run: |
echo "GIT_SHORT_HASH=$(git rev-parse --short HEAD)" >> "$GITHUB_ENV"
@@ -122,18 +144,18 @@ jobs:
fi
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
logout: false
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
- name: Build front Dockerfile
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
push: true
@@ -146,20 +168,22 @@ jobs:
# setup node without cache configuration
# Prisma cache is not compatible with docker build cache
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
registry-url: https://npm.pkg.github.com
scope: '@toeverything'
- name: Install Node.js dependencies
run: yarn workspaces focus @affine/server --production
run: |
yarn config set --json supportedArchitectures.cpu '["x64", "arm64"]'
yarn workspaces focus @affine/server --production
- name: Generate Prisma client
run: yarn workspace @affine/server prisma generate
- name: Build graphql Dockerfile
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
push: true
@@ -167,11 +191,11 @@ jobs:
platforms: linux/amd64,linux/arm64
provenance: true
file: .github/deployment/node/Dockerfile
tags: ghcr.io/toeverything/affine-graphql:${{env.RELEASE_FLAVOR}}-${{ env.GIT_SHORT_HASH }},ghcr.io/toeverything/affine-front:${{env.RELEASE_FLAVOR}}
tags: ghcr.io/toeverything/affine-graphql:${{env.RELEASE_FLAVOR}}-${{ env.GIT_SHORT_HASH }},ghcr.io/toeverything/affine-graphql:${{env.RELEASE_FLAVOR}}
deploy:
name: Deploy to cluster
if: ${{ github.event_name == 'workflow_dispatch' || github.ref_type == 'tag' }}
if: ${{ github.event_name == 'workflow_dispatch' }}
environment: ${{ github.event.inputs.flavor }}
permissions:
contents: 'write'
@@ -180,7 +204,7 @@ jobs:
- build-docker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Deploy to dev
uses: ./.github/actions/deploy
with:
@@ -197,6 +221,8 @@ jobs:
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
R2_BUCKET: ${{ secrets.R2_BUCKET }}
ENABLE_CAPTCHA: true
CAPTCHA_TURNSTILE_SECRET: ${{ secrets.CAPTCHA_TURNSTILE_SECRET }}
OAUTH_EMAIL_SENDER: ${{ secrets.OAUTH_EMAIL_SENDER }}
OAUTH_EMAIL_LOGIN: ${{ secrets.OAUTH_EMAIL_LOGIN }}
OAUTH_EMAIL_PASSWORD: ${{ secrets.OAUTH_EMAIL_PASSWORD }}
@@ -212,3 +238,5 @@ jobs:
REDIS_HOST: ${{ secrets.REDIS_HOST }}
REDIS_PASSWORD: ${{ secrets.REDIS_PASSWORD }}
CLOUD_SQL_IAM_ACCOUNT: ${{ secrets.CLOUD_SQL_IAM_ACCOUNT }}
STRIPE_API_KEY: ${{ secrets.STRIPE_API_KEY }}
STRIPE_WEBHOOK_KEY: ${{ secrets.STRIPE_WEBHOOK_KEY }}

30
.github/workflows/dispatch-deploy.yml vendored Normal file
View File

@@ -0,0 +1,30 @@
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 }}" }'

View File

@@ -11,12 +11,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout Helm chart repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: toeverything/helm-charts
path: .helm-chart-repo

View File

@@ -4,13 +4,13 @@ on:
push:
branches: ['master']
paths:
- 'packages/i18n/**'
- 'packages/frontend/i18n/**'
- '.github/workflows/languages-sync.yml'
- '!.github/actions/setup-node/action.yml'
pull_request_target:
branches: ['master']
paths:
- 'packages/i18n/**'
- 'packages/frontend/i18n/**'
- '.github/workflows/languages-sync.yml'
- '!.github/actions/setup-node/action.yml'
workflow_dispatch:
@@ -19,7 +19,7 @@ jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: Check Language Key

View File

@@ -2,6 +2,15 @@ name: Build Canary Desktop App on Staging Branch
on:
workflow_dispatch:
inputs:
channel_override:
description: 'channel type (canary, beta, or stable)'
type: choice
default: beta
options:
- canary
- beta
- stable
push:
branches:
# 0.6.x-staging
@@ -27,27 +36,28 @@ concurrency:
cancel-in-progress: true
env:
# BUILD_TYPE => app icon, app name, etc
BUILD_TYPE: internal
# BUILD_TYPE_OVERRIDE => channel type (canary, beta, or stable) - get the channel type (the api configs)
BUILD_TYPE_OVERRIDE: ${{ github.event.inputs.channel_override || 'beta' }}
jobs:
set-build-version:
runs-on: ubuntu-latest
environment: production
outputs:
version: 0.0.0-internal.${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: toeverything/set-build-version@latest
- id: version
run: echo ::set-output name=version::${{ env.BUILD_VERSION }}
before-make:
runs-on: ubuntu-latest
environment: production
needs:
- set-build-version
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: Setup @sentry/cli
@@ -55,7 +65,7 @@ jobs:
- name: Replace Version
run: ./scripts/set-version.sh ${{ needs.set-build-version.outputs.version }}
- name: generate-assets
working-directory: apps/electron
working-directory: packages/frontend/electron
run: yarn generate-assets
env:
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
@@ -68,10 +78,9 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: core
path: apps/electron/resources/web-static
path: packages/frontend/electron/resources/web-static
make-distribution:
environment: production
strategy:
# all combinations: macos-latest x64, macos-latest arm64, ubuntu-latest x64
# For windows, we need a separate approach
@@ -103,13 +112,26 @@ jobs:
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
SKIP_GENERATE_ASSETS: 1
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Node.js
timeout-minutes: 10
if: ${{ matrix.spec.platform == 'darwin' }}
uses: ./.github/actions/setup-node
- name: Setup Maker
with:
extra-flags: workspaces focus @affine/electron @affine/monorepo
hard-link-nm: false
build-plugins: false
nmHoistingLimits: workspaces
enableScripts: false
- name: Setup Node.js
timeout-minutes: 10
uses: ./.github/actions/setup-maker
if: ${{ matrix.spec.platform != 'darwin' }}
uses: ./.github/actions/setup-node
with:
extra-flags: workspaces focus @affine/electron @affine/monorepo
hard-link-nm: false
build-plugins: false
nmHoistingLimits: workspaces
- name: Build AFFiNE native
uses: ./.github/actions/build-rust
with:
@@ -121,7 +143,7 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: core
path: apps/electron/resources/web-static
path: packages/frontend/electron/resources/web-static
- name: Build Plugins
run: yarn run build:plugins
@@ -138,28 +160,32 @@ jobs:
- name: make
run: yarn workspace @affine/electron make --platform=${{ matrix.spec.platform }} --arch=${{ matrix.spec.arch }}
env:
SKIP_PLUGIN_BUILD: 1
SKIP_WEB_BUILD: 1
HOIST_NODE_MODULES: 1
- name: Save artifacts (mac)
if: ${{ matrix.spec.platform == 'darwin' }}
run: |
mkdir -p builds
mv apps/electron/out/*/make/*.dmg ./builds/affine-${{ env.BUILD_TYPE }}-macos-${{ matrix.spec.arch }}.dmg
mv apps/electron/out/*/make/zip/darwin/${{ matrix.spec.arch }}/*.zip ./builds/affine-${{ env.BUILD_TYPE }}-macos-${{ matrix.spec.arch }}.zip
mv packages/frontend/electron/out/*/make/*.dmg ./builds/affine-${{ env.BUILD_TYPE }}-macos-${{ matrix.spec.arch }}.dmg
mv packages/frontend/electron/out/*/make/zip/darwin/${{ matrix.spec.arch }}/*.zip ./builds/affine-${{ env.BUILD_TYPE }}-macos-${{ matrix.spec.arch }}.zip
- name: Save artifacts (windows)
if: ${{ matrix.spec.platform == 'win32' }}
run: |
mkdir -p builds
mv apps/electron/out/*/make/zip/win32/x64/AFFiNE*-win32-x64-*.zip ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.zip
mv apps/electron/out/*/make/squirrel.windows/x64/*.exe ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.exe
mv apps/electron/out/*/make/squirrel.windows/x64/*.msi ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.msi
mv apps/electron/out/*/make/squirrel.windows/x64/*.nupkg ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.nupkg
mv packages/frontend/electron/out/*/make/zip/win32/x64/AFFiNE*-win32-x64-*.zip ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.zip
mv packages/frontend/electron/out/*/make/squirrel.windows/x64/*.exe ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.exe
mv packages/frontend/electron/out/*/make/squirrel.windows/x64/*.msi ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.msi
mv packages/frontend/electron/out/*/make/squirrel.windows/x64/*.nupkg ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.nupkg
- name: Save artifacts (linux)
if: ${{ matrix.spec.platform == 'linux' }}
run: |
mkdir -p builds
mv apps/electron/out/*/make/zip/linux/x64/*.zip ./builds/affine-${{ env.BUILD_TYPE }}-linux-x64.zip
mv apps/electron/out/*/make/AppImage/x64/*.AppImage ./builds/affine-${{ env.BUILD_TYPE }}-linux-x64.AppImage
mv packages/frontend/electron/out/*/make/zip/linux/x64/*.zip ./builds/affine-${{ env.BUILD_TYPE }}-linux-x64.zip
mv packages/frontend/electron/out/*/make/AppImage/x64/*.AppImage ./builds/affine-${{ env.BUILD_TYPE }}-linux-x64.AppImage
- name: Upload Artifact
uses: actions/upload-artifact@v3
@@ -174,7 +200,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Download Artifacts (macos-x64)
uses: actions/download-artifact@v3
with:
@@ -196,13 +222,12 @@ jobs:
name: affine-linux-x64-builds
path: ./
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
- name: Generate Release yml
run: |
cp ./apps/electron/scripts/generate-yml.js .
node generate-yml.js
node ./packages/frontend/electron/scripts/generate-yml.js
env:
RELEASE_VERSION: ${{ needs.set-build-version.outputs.version }}
- name: Create Release Draft

View File

@@ -1,54 +0,0 @@
name: NX
on:
push:
branches:
- master
- v[0-9]+.[0-9]+.x-staging
- v[0-9]+.[0-9]+.x
paths-ignore:
- README.md
- .github/**
- '!.github/workflows/nx.yml'
- '!.github/actions/build-rust/action.yml'
- '!.github/actions/setup-node/action.yml'
pull_request:
merge_group:
branches:
- master
- v[0-9]+.[0-9]+.x-staging
- v[0-9]+.[0-9]+.x
paths-ignore:
- README.md
- .github/**
- '!.github/workflows/nx.yml'
- '!.github/actions/build-rust/action.yml'
- '!.github/actions/setup-node/action.yml'
jobs:
main:
name: Nx Cloud - Main Job
uses: nrwl/ci/.github/workflows/nx-cloud-main.yml@v0.13.0
with:
runs-on: macos-latest
main-branch-name: master
number-of-agents: 5
init-commands: |
yarn exec nx-cloud start-ci-run --stop-agents-after="build" --agent-count=5
environment-variables: |
BUILD_TYPE=canary
# parallel-commands: |
# yarn exec nx-cloud record -- yarn exec nx format:check
parallel-commands-on-agents: |
yarn exec nx affected --target=build --parallel=5
timeout: 60
agents:
name: Nx Cloud - Agents
uses: nrwl/ci/.github/workflows/nx-cloud-agents.yml@v0.13.0
with:
runs-on: macos-latest
number-of-agents: 5
environment-variables: |
BUILD_TYPE=canary
timeout: 60

View File

@@ -9,4 +9,4 @@ jobs:
add-reviews:
runs-on: ubuntu-latest
steps:
- uses: kentaro-m/auto-assign-action@v1.2.4
- uses: kentaro-m/auto-assign-action@v1.2.5

View File

@@ -17,7 +17,9 @@ jobs:
name: Check pull request title
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Node.js
uses: ./.github/actions/setup-node
- run: echo "${{ github.event.pull_request.title }}" | npx commitlint -g ./.commitlintrc.json
with:
electron-install: false
- run: echo "${{ github.event.pull_request.title }}" | yarn dlx commitlint -g ./.commitlintrc.json

View File

@@ -14,18 +14,16 @@ on:
paths-ignore:
- README.md
- .github/**
- apps/server
- apps/docs
- apps/electron
- packages/backend/server
- packages/frontend/electron
- '!.github/workflows/publish-storybook.yml'
jobs:
publish-storybook:
name: Publish Storybook
runs-on: ubuntu-latest
environment: development
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.merge_commit_sha }}
# This is required to fetch all commits for chromatic
@@ -38,7 +36,7 @@ jobs:
run: yarn run build:plugins
- uses: chromaui/action-next@v1
with:
workingDir: apps/storybook
workingDir: tests/storybook
buildScriptName: build
exitOnceUploaded: true
onlyChanged: false
@@ -46,7 +44,7 @@ jobs:
env:
CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
NODE_OPTIONS: ${{ env.NODE_OPTIONS }}
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: always()
with:
name: chromatic-build-artifacts-${{ github.run_id }}

View File

@@ -40,11 +40,10 @@ env:
jobs:
before-make:
runs-on: ubuntu-latest
environment: production
outputs:
RELEASE_VERSION: ${{ steps.get-canary-version.outputs.RELEASE_VERSION }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: Setup @sentry/cli
@@ -54,12 +53,12 @@ jobs:
if: ${{ github.ref_type == 'tag' }}
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/v}
PACKAGE_VERSION=$(node -p "require('./apps/electron/package.json').version")
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('./apps/electron/package.json').version")" >> $GITHUB_OUTPUT
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,15 +66,15 @@ jobs:
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
RELEASE_VERSION: ${{ github.event.inputs.version || steps.get-canary-version.outputs.RELEASE_VERSION }}
SKIP_PLUGIN_BUILD: 'true'
- name: Upload core artifact
uses: actions/upload-artifact@v3
with:
name: core
path: apps/electron/resources/web-static
path: packages/frontend/electron/resources/web-static
make-distribution:
environment: production
strategy:
# all combinations: macos-latest x64, macos-latest arm64, ubuntu-latest x64
# For windows, we need a separate approach
@@ -101,13 +100,16 @@ jobs:
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
SKIP_GENERATE_ASSETS: 1
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Node.js
timeout-minutes: 10
uses: ./.github/actions/setup-node
- name: Setup Maker
timeout-minutes: 10
uses: ./.github/actions/setup-maker
with:
extra-flags: workspaces focus @affine/electron @affine/monorepo
hard-link-nm: false
build-plugins: false
nmHoistingLimits: workspaces
enableScripts: false
- name: Build AFFiNE native
uses: ./.github/actions/build-rust
with:
@@ -117,10 +119,7 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: core
path: apps/electron/resources/web-static
- name: Build Plugins
run: yarn run build:plugins
path: packages/frontend/electron/resources/web-static
- name: Build Desktop Layers
run: yarn workspace @affine/electron build
@@ -134,19 +133,23 @@ jobs:
- name: make
run: yarn workspace @affine/electron make --platform=${{ matrix.spec.platform }} --arch=${{ matrix.spec.arch }}
env:
SKIP_PLUGIN_BUILD: 1
SKIP_WEB_BUILD: 1
HOIST_NODE_MODULES: 1
- name: Save artifacts (mac)
if: ${{ matrix.spec.platform == 'darwin' }}
run: |
mkdir -p builds
mv apps/electron/out/*/make/*.dmg ./builds/affine-${{ env.BUILD_TYPE }}-macos-${{ matrix.spec.arch }}.dmg
mv apps/electron/out/*/make/zip/darwin/${{ matrix.spec.arch }}/*.zip ./builds/affine-${{ env.BUILD_TYPE }}-macos-${{ matrix.spec.arch }}.zip
mv packages/frontend/electron/out/*/make/*.dmg ./builds/affine-${{ env.BUILD_TYPE }}-macos-${{ matrix.spec.arch }}.dmg
mv packages/frontend/electron/out/*/make/zip/darwin/${{ matrix.spec.arch }}/*.zip ./builds/affine-${{ env.BUILD_TYPE }}-macos-${{ matrix.spec.arch }}.zip
- name: Save artifacts (linux)
if: ${{ matrix.spec.platform == 'linux' }}
run: |
mkdir -p builds
mv apps/electron/out/*/make/zip/linux/x64/*.zip ./builds/affine-${{ env.BUILD_TYPE }}-linux-x64.zip
mv apps/electron/out/*/make/AppImage/x64/*.AppImage ./builds/affine-${{ env.BUILD_TYPE }}-linux-x64.AppImage
mv packages/frontend/electron/out/*/make/zip/linux/x64/*.zip ./builds/affine-${{ env.BUILD_TYPE }}-linux-x64.zip
mv packages/frontend/electron/out/*/make/AppImage/x64/*.AppImage ./builds/affine-${{ env.BUILD_TYPE }}-linux-x64.AppImage
- name: Upload Artifact
uses: actions/upload-artifact@v3
@@ -155,7 +158,6 @@ jobs:
path: builds
package-distribution-windows:
environment: production
strategy:
# all combinations: macos-latest x64, macos-latest arm64, ubuntu-latest x64
# For windows, we need a separate approach
@@ -172,13 +174,15 @@ jobs:
env:
SKIP_GENERATE_ASSETS: 1
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Node.js
timeout-minutes: 10
uses: ./.github/actions/setup-node
- name: Setup Maker
timeout-minutes: 10
uses: ./.github/actions/setup-maker
with:
extra-flags: workspaces focus @affine/electron @affine/monorepo
hard-link-nm: false
build-plugins: false
nmHoistingLimits: workspaces
- name: Build AFFiNE native
uses: ./.github/actions/build-rust
with:
@@ -188,7 +192,7 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: core
path: apps/electron/resources/web-static
path: packages/frontend/electron/resources/web-static
- name: Build Plugins
run: yarn run build:plugins
@@ -198,16 +202,20 @@ jobs:
- name: package
run: yarn workspace @affine/electron package --platform=${{ matrix.spec.platform }} --arch=${{ matrix.spec.arch }}
env:
SKIP_PLUGIN_BUILD: 1
SKIP_WEB_BUILD: 1
HOIST_NODE_MODULES: 1
- name: get all files to be signed
id: get_files_to_be_signed
run: |
Set-Variable -Name FILES_TO_BE_SIGNED -Value ((Get-ChildItem -Path apps/electron/out -Recurse -File | Where-Object { $_.Extension -in @(".exe", ".node", ".dll", ".msi") } | ForEach-Object { '"' + $_.FullName.Replace((Get-Location).Path + '\apps\electron\out\', '') + '"' }) -join ' ')
Set-Variable -Name FILES_TO_BE_SIGNED -Value ((Get-ChildItem -Path packages/frontend/electron/out -Recurse -File | Where-Object { $_.Extension -in @(".exe", ".node", ".dll", ".msi") } | ForEach-Object { '"' + $_.FullName.Replace((Get-Location).Path + '\packages\frontend\electron\out\', '') + '"' }) -join ' ')
"FILES_TO_BE_SIGNED=$FILES_TO_BE_SIGNED" >> $env:GITHUB_OUTPUT
echo $FILES_TO_BE_SIGNED
- name: Zip artifacts for faster upload
run: Compress-Archive -CompressionLevel Fastest -Path apps/electron/out/* -DestinationPath archive.zip
run: Compress-Archive -CompressionLevel Fastest -Path packages/frontend/electron/out/* -DestinationPath archive.zip
- name: Save packaged artifacts for signing
uses: actions/upload-artifact@v3
@@ -225,7 +233,6 @@ jobs:
artifact-name: packaged-win32-x64
make-windows-installer:
environment: production
needs: sign-packaged-artifacts-windows
strategy:
# all combinations: macos-latest x64, macos-latest arm64, ubuntu-latest x64
@@ -240,7 +247,7 @@ jobs:
outputs:
FILES_TO_BE_SIGNED: ${{ steps.get_files_to_be_signed.outputs.FILES_TO_BE_SIGNED }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Node.js
timeout-minutes: 10
uses: ./.github/actions/setup-node
@@ -250,18 +257,18 @@ jobs:
name: signed-packaged-${{ matrix.spec.platform }}-${{ matrix.spec.arch }}
path: .
- name: unzip file
run: Expand-Archive -Path signed.zip -DestinationPath apps/electron/out
run: Expand-Archive -Path signed.zip -DestinationPath packages/frontend/electron/out
- name: Make squirrel.windows installer
run: yarn workspace @affine/electron make-squirrel --platform=${{ matrix.spec.platform }} --arch=${{ matrix.spec.arch }}
- name: Zip artifacts for faster upload
run: Compress-Archive -CompressionLevel Fastest -Path apps/electron/out/${{ env.BUILD_TYPE }}/make/* -DestinationPath archive.zip
run: Compress-Archive -CompressionLevel Fastest -Path packages/frontend/electron/out/${{ env.BUILD_TYPE }}/make/* -DestinationPath archive.zip
- name: get all files to be signed
id: get_files_to_be_signed
run: |
Set-Variable -Name FILES_TO_BE_SIGNED -Value ((Get-ChildItem -Path apps/electron/out/${{ env.BUILD_TYPE }}/make -Recurse -File | Where-Object { $_.Extension -in @(".exe", ".node", ".dll", ".msi") } | ForEach-Object { '"' + $_.FullName.Replace((Get-Location).Path + '\apps\electron\out\${{ env.BUILD_TYPE }}\make\', '') + '"' }) -join ' ')
Set-Variable -Name FILES_TO_BE_SIGNED -Value ((Get-ChildItem -Path packages/frontend/electron/out/${{ env.BUILD_TYPE }}/make -Recurse -File | Where-Object { $_.Extension -in @(".exe", ".node", ".dll", ".msi") } | ForEach-Object { '"' + $_.FullName.Replace((Get-Location).Path + '\packages\frontend\electron\out\${{ env.BUILD_TYPE }}\make\', '') + '"' }) -join ' ')
"FILES_TO_BE_SIGNED=$FILES_TO_BE_SIGNED" >> $env:GITHUB_OUTPUT
echo $FILES_TO_BE_SIGNED
@@ -279,7 +286,6 @@ jobs:
artifact-name: installer-win32-x64
finalize-installer-windows:
environment: production
needs: sign-installer-artifacts-windows
strategy:
# all combinations: macos-latest x64, macos-latest arm64, ubuntu-latest x64
@@ -298,14 +304,14 @@ jobs:
name: signed-installer-${{ matrix.spec.platform }}-${{ matrix.spec.arch }}
path: .
- name: unzip file
run: Expand-Archive -Path signed.zip -DestinationPath apps/electron/out/${{ env.BUILD_TYPE }}/make
run: Expand-Archive -Path signed.zip -DestinationPath packages/frontend/electron/out/${{ env.BUILD_TYPE }}/make
- name: Save artifacts
run: |
mkdir -p builds
mv apps/electron/out/*/make/zip/win32/x64/AFFiNE*-win32-x64-*.zip ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.zip
mv apps/electron/out/*/make/squirrel.windows/x64/*.exe ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.exe
mv apps/electron/out/*/make/squirrel.windows/x64/*.msi ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.msi
mv packages/frontend/electron/out/*/make/zip/win32/x64/AFFiNE*-win32-x64-*.zip ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.zip
mv packages/frontend/electron/out/*/make/squirrel.windows/x64/*.exe ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.exe
mv packages/frontend/electron/out/*/make/squirrel.windows/x64/*.msi ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.msi
- name: Upload Artifact
uses: actions/upload-artifact@v3
@@ -318,7 +324,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: core
path: web-static
- name: Zip web-static
run: zip -r web-static.zip web-static
- name: Download Artifacts (macos-x64)
uses: actions/download-artifact@v3
with:
@@ -339,19 +351,16 @@ jobs:
with:
name: affine-linux-x64-builds
path: ./
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Generate Release yml
run: |
cp ./apps/electron/scripts/generate-yml.js .
node generate-yml.js
node ./packages/frontend/electron/scripts/generate-yml.js
env:
RELEASE_VERSION: ${{ github.event.inputs.version || needs.before-make.outputs.RELEASE_VERSION }}
- name: Create Release Draft
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
with:
name: ${{ github.event.inputs.version || needs.before-make.outputs.RELEASE_VERSION }}
body: ''

View File

@@ -17,7 +17,7 @@ jobs:
name: Try publishing npm@latest release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: Try publishing to NPM
@@ -31,7 +31,7 @@ jobs:
environment: development
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: Build Plugins
@@ -42,7 +42,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: core
path: ./apps/core/dist
path: ./packages/frontend/core/dist
if-no-files-found: error
build-server:
@@ -50,7 +50,7 @@ jobs:
runs-on: ubuntu-latest
environment: development
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Node.js
uses: ./.github/actions/setup-node
with:
@@ -61,7 +61,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: server-dist
path: ./apps/server/dist
path: ./packages/backend/server/dist
if-no-files-found: error
build-storage:
@@ -72,7 +72,7 @@ jobs:
environment: development
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: Setup Rust
@@ -85,7 +85,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: storage.node
path: ./packages/storage/storage.node
path: ./packages/backend/storage/storage.node
if-no-files-found: error
build-docker:
@@ -97,38 +97,38 @@ jobs:
- build-core
- build-storage
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Download core artifact
uses: actions/download-artifact@v3
with:
name: core
path: ./apps/core/dist
path: ./packages/frontend/core/dist
- name: Download server dist
uses: actions/download-artifact@v3
with:
name: server-dist
path: ./apps/server/dist
path: ./packages/backend/server/dist
- name: Download storage.node
uses: actions/download-artifact@v3
with:
name: storage.node
path: ./apps/server
path: ./packages/backend/server
- name: Setup Git short hash
run: |
echo "GIT_SHORT_HASH=$(git rev-parse --short HEAD)" >> "$GITHUB_ENV"
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
logout: false
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
- name: Build front Dockerfile
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
push: true
@@ -141,7 +141,7 @@ jobs:
# setup node without cache configuration
# Prisma cache is not compatible with docker build cache
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
registry-url: https://npm.pkg.github.com
@@ -154,7 +154,7 @@ jobs:
run: yarn workspace @affine/server prisma generate
- name: Build graphql Dockerfile
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
push: true

View File

@@ -5,7 +5,7 @@ on:
branches:
- master
paths:
- packages/workers/**
- tools/workers/**
jobs:
deploy:
@@ -13,10 +13,11 @@ jobs:
name: Deploy
environment: production
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Publish
uses: cloudflare/wrangler-action@2.0.0
uses: cloudflare/wrangler-action@v3.3.2
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
workingDirectory: 'packages/workers'
workingDirectory: 'tools/workers'
packageManager: 'yarn'

View File

@@ -3,8 +3,8 @@
"version": 1,
"list": [
{
"input": "./packages/i18n/src/resources/en.json",
"output": "./packages/i18n/src/i18n-generated",
"input": "./packages/frontend/i18n/src/resources/en.json",
"output": "./packages/frontend/i18n/src/i18n-generated",
"parser": {
"type": "i18next",
"contextSeparator": "$",

View File

@@ -2,16 +2,22 @@ yarn.lock
target
lib
test-results
packages/i18n/src/i18n-generated.ts
packages/graphql/src/graphql/index.ts
.next
out
dist
.yarn
tests/affine-legacy/**/static
.github/helm
_next
storybook-static
web-static
public
apps/server/src/schema.gql
packages/backend/server/src/schema.gql
packages/frontend/i18n/src/i18n-generated.ts
packages/frontend/graphql/src/graphql/index.ts
tests/affine-legacy/**/static
# auto-generated by NAPI-RS
# fixme(@joooye34): need script to check and generate ignore list here
packages/backend/storage/index.d.ts
packages/frontend/native/index.d.ts
packages/frontend/native/index.js

View File

@@ -29,15 +29,7 @@
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"vitest.include": [
"packages/**/*.spec.ts",
"packages/**/*.spec.tsx",
"apps/web/**/*.spec.ts",
"apps/web/**/*.spec.tsx",
"apps/electron/src/**/*.spec.ts",
"tests/unit/**/*.spec.ts",
"tests/unit/**/*.spec.tsx"
],
"vitest.include": ["packages/**/*.spec.ts", "packages/**/*.spec.tsx"],
"rust-analyzer.check.extraEnv": {
"DATABASE_URL": "sqlite:affine.db"
}

View File

@@ -0,0 +1,13 @@
diff --git a/dist/util/forge-config.js b/dist/util/forge-config.js
index 3466ac1a340c8dfe5ea8997178961e8328457d68..ceb33770db48df80e4355e6bac12e8c99162d7bc 100644
--- a/dist/util/forge-config.js
+++ b/dist/util/forge-config.js
@@ -130,7 +130,7 @@ exports.default = async (dir) => {
try {
// The loaded "config" could potentially be a static forge config, ESM module or async function
// eslint-disable-next-line @typescript-eslint/no-var-requires
- const loaded = require(path_1.default.resolve(dir, forgeConfig));
+ const loaded = await import(require('node:url').pathToFileURL(path_1.default.join(dir, forgeConfig)))
const maybeForgeConfig = 'default' in loaded ? loaded.default : loaded;
forgeConfig = typeof maybeForgeConfig === 'function' ? await maybeForgeConfig() : maybeForgeConfig;
}

View File

@@ -0,0 +1,15 @@
diff --git a/package.json b/package.json
index 26dcf8217f3e221e4c53722f14d29bb788332772..57a66dcb0943b9dd5cdaac2eaffccd9225a6b735 100644
--- a/package.json
+++ b/package.json
@@ -34,6 +34,10 @@
"./adapters": {
"types": "./adapters.d.ts"
},
+ "./core": {
+ "types": "./core/index.d.ts",
+ "default": "./core/index.js"
+ },
"./jwt": {
"types": "./jwt/index.d.ts",
"default": "./jwt/index.js"

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

893
.yarn/releases/yarn-4.0.1.cjs vendored Executable file

File diff suppressed because one or more lines are too long

View File

@@ -1,3 +1,7 @@
compressionLevel: mixed
enableGlobalCache: true
nmMode: hardlinks-local
nodeLinker: node-modules
@@ -8,12 +12,4 @@ npmPublishAccess: public
npmPublishRegistry: 'https://registry.npmjs.org'
plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: '@yarnpkg/plugin-interactive-tools'
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: '@yarnpkg/plugin-version'
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: '@yarnpkg/plugin-workspace-tools'
yarnPath: .yarn/releases/yarn-3.6.3.cjs
yarnPath: .yarn/releases/yarn-4.0.1.cjs

626
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,9 @@
[workspace]
resolver = "2"
members = [
"./packages/native",
"./packages/native/schema",
"./packages/storage",
"./packages/frontend/native",
"./packages/frontend/native/schema",
"./packages/backend/storage",
]
[profile.dev.package.sqlx-macros]

View File

@@ -2,7 +2,7 @@ Copyright (c) 2022-present TOEVERYTHING PTE. LTD. and its affiliates.
Portions of this software are licensed as follows:
- All content that resides under the "apps/server" directory of this repository, if that directory exists, is licensed under the license defined in "apps/server/LICENSE".
- All content that resides under the "packages/backend/server" directory of this repository, if that directory exists, is licensed under the license defined in "packages/backend/server/LICENSE".
- All third party components incorporated into the AFFiNE Software are licensed under the original license provided by the owner of the applicable component.
- Content outside of the above mentioned directories or restrictions above is available under the "MIT" license as defined in "LICENSE-MIT".

View File

@@ -110,9 +110,9 @@ If you have questions, you are welcome to contact us. One of the best places to
| Name | | |
| ----------------------------------------------------------------------------------------------- | --------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| [@toeverything/component](https://github.com/toeverything/design/tree/main/packages/components) | Toeverything Shared Component Resources | |
| [@affine/component](packages/component) | AFFiNE Component Resources | [![](https://img.shields.io/codecov/c/github/toeverything/affine?style=flat-square)](https://affine-storybook.vercel.app/) |
| [@toeverything/y-indexeddb](packages/y-indexeddb) | IndexedDB database adapter for Yjs | [![](https://img.shields.io/npm/dm/@toeverything/y-indexeddb?style=flat-square&color=eee)](https://www.npmjs.com/package/@toeverything/y-indexeddb) |
| [@toeverything/theme](packages/theme) | AFFiNE theme | [![](https://img.shields.io/npm/dm/@toeverything/theme?style=flat-square&color=eee)](https://www.npmjs.com/package/@toeverything/theme) |
| [@affine/component](packages/frontend/component) | AFFiNE Component Resources | [![](https://img.shields.io/codecov/c/github/toeverything/affine?style=flat-square)](https://affine-storybook.vercel.app/) |
| [@toeverything/y-indexeddb](packages/common/y-indexeddb) | IndexedDB database adapter for Yjs | [![](https://img.shields.io/npm/dm/@toeverything/y-indexeddb?style=flat-square&color=eee)](https://www.npmjs.com/package/@toeverything/y-indexeddb) |
| [@toeverything/theme](packages/common/theme) | AFFiNE theme | [![](https://img.shields.io/npm/dm/@toeverything/theme?style=flat-square&color=eee)](https://www.npmjs.com/package/@toeverything/theme) |
## Plugins
@@ -120,15 +120,14 @@ If you have questions, you are welcome to contact us. One of the best places to
>
> (Currently, the plugin system is under heavy development. You will see the plugin system in the canary release.)
- [@affine/sdk](./packages/sdk) - SDK for developing plugins
- [@affine/plugin-cli](./packages/plugin-cli) - CLI for developing plugins
- [@affine/sdk](./packages/common/sdk) - SDK for developing plugins
- [@affine/plugin-cli](./tools/plugin-cli) - CLI for developing plugins
| Official Plugin | Description | Status |
| ----------------------------------------------------- | ----------------------------------------- | ------ |
| [@affine/bookmark-plugin](plugins/bookmark) | A block for bookmarking a website | |
| [@affine/copilot-plugin](plugins/copilot) | AI Copilot that help you document writing | 🚧 |
| [@affine/image-preview-plugin](plugins/image-preview) | Component for previewing an image | ✅ |
| [@affine/outline](plugins/outline) | Outline for your document | ✅ |
| Official Plugin | Description | Status |
| ---------------------------------------------------------------- | ----------------------------------------- | ------ |
| [@affine/copilot-plugin](./packages/plugins/copilot) | AI Copilot that help you document writing | 🚧 |
| [@affine/image-preview-plugin](./packages/plugins/image-preview) | Component for previewing an image | |
| [@affine/outline](./packages/plugins/outline) | Outline for your document | ✅ |
## Upstreams
@@ -147,18 +146,7 @@ We would also like to give thanks to open-source projects that make AFFiNE possi
Thanks a lot to the community for providing such powerful and simple libraries, so that we can focus more on the implementation of the product logic, and we hope that in the future our projects will also provide a more easy-to-use knowledge base for everyone.
# Contributors
## Current Core members
Team members who are currently maintaining the project:
- [JimmFly](https://github.com/JimmFly) - Jinfei Yang <yangjinfei001@gmail.com> (he/him)
- [pengx17](https://github.com/pengx17) - Peng Xiao <pengxiao@outlook.com> (he/him)
- [QiShaoXuan](https://github.com/QiSHaoXuan) - Shaoxuan Qi <qishaoxuan777@gmail.com> (he/him)
- [himself65](https://github.com/himself65) - Zeyu "Alex" Yang <himself65@outlook.com> (he/him)
## All Contributors
## Contributors
We would like to express our gratitude to all the individuals who have already contributed to AFFiNE! If you have any AFFiNE-related project, documentation, tool or template, please feel free to contribute it by submitting a pull request to our curated list on GitHub: [awesome-affine](https://github.com/toeverything/awesome-affine).
@@ -238,5 +226,5 @@ See [LICENSE] for details.
[codecov]: https://codecov.io/gh/toeverything/affine/branch/master/graphs/badge.svg?branch=master
[node-version-icon]: https://img.shields.io/badge/node-%3E=18.16.1-success
[typescript-version-icon]: https://img.shields.io/github/package-json/dependency-version/toeverything/affine/dev/typescript
[react-version-icon]: https://img.shields.io/github/package-json/dependency-version/toeverything/AFFiNE/react?filename=apps%2Fcore%2Fpackage.json&color=rgb(97%2C228%2C251)
[blocksuite-icon]: https://img.shields.io/github/package-json/dependency-version/toeverything/AFFiNE/@blocksuite/store?color=6880ff&filename=apps%2Fcore%2Fpackage.json&label=blocksuite
[react-version-icon]: https://img.shields.io/github/package-json/dependency-version/toeverything/AFFiNE/react?filename=packages%2Ffrontend%2Fcore%2Fpackage.json&color=rgb(97%2C228%2C251)
[blocksuite-icon]: https://img.shields.io/github/package-json/dependency-version/toeverything/AFFiNE/@blocksuite/store?color=6880ff&filename=packages%2Ffrontend%2Fcore%2Fpackage.json&label=blocksuite

View File

@@ -1,29 +0,0 @@
# Apps structure
> This is the structure of the `apps` directory.
## docs
AFFiNE Developer Documentation using [waku](https://github.com/dai-shi/waku).
## electron
> `core` needs to be built before electron.
AFFiNE Desktop (macOS, Linux and Windows Distribution) using [Electron](https://www.electronjs.org/).
## server
Server using [Nest.js](https://nestjs.com/).
## storybook
Storybook using [Storybook](https://storybook.js.org/).
## prototype
AFFiNE Prototype using [React.js](https://reactjs.org/) + [Vite](https://vitejs.dev/).
## core
AFFiNE Core Application using [React.js](https://reactjs.org/) + [Webpack](https://webpack.js.org/).

View File

@@ -1,12 +0,0 @@
import type { BuildFlags } from '@affine/cli/config';
export function computeCacheKey(buildFlags: BuildFlags) {
return [
'1',
'node' + process.version,
buildFlags.mode,
buildFlags.distribution,
buildFlags.channel,
...(buildFlags.localBlockSuite ? [buildFlags.localBlockSuite] : []),
].join('-');
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

View File

@@ -1,87 +0,0 @@
import {
AuthContent,
BackButton,
CountDownRender,
ModalHeader,
} from '@affine/component/auth-components';
import { Trans } from '@affine/i18n';
import { useAFFiNEI18N } from '@affine/i18n/hooks';
import { Button } from '@toeverything/components/button';
import { useCallback } from 'react';
import { useCurrentLoginStatus } from '../../../hooks/affine/use-current-login-status';
import type { AuthPanelProps } from './index';
import * as style from './style.css';
import { useAuth } from './use-auth';
export const AfterSignInSendEmail = ({
setAuthState,
email,
onSignedIn,
}: AuthPanelProps) => {
const t = useAFFiNEI18N();
const loginStatus = useCurrentLoginStatus();
const { resendCountDown, allowSendEmail, signIn } = useAuth();
if (loginStatus === 'authenticated') {
onSignedIn?.();
}
const onResendClick = useCallback(async () => {
await signIn(email);
}, [email, signIn]);
return (
<>
<ModalHeader
title={t['com.affine.auth.sign.in']()}
subTitle={t['com.affine.auth.sign.in.sent.email.subtitle']()}
/>
<AuthContent style={{ height: 162 }}>
{t['com.affine.auth.sign.sent.email.message.start']()}
<a href={`mailto:${email}`}>{email}</a>
{t['com.affine.auth.sign.sent.email.message.end']()}
</AuthContent>
<div className={style.resendWrapper}>
{allowSendEmail ? (
<Button type="plain" size="large" onClick={onResendClick}>
{t['com.affine.auth.sign.auth.code.resend.hint']()}
</Button>
) : (
<>
<span className="resend-code-hint">
{t['com.affine.auth.sign.auth.code.on.resend.hint']()}
</span>
<CountDownRender
className={style.resendCountdown}
timeLeft={resendCountDown}
/>
</>
)}
</div>
<div className={style.authMessage} style={{ marginTop: 20 }}>
{/*prettier-ignore*/}
<Trans i18nKey="com.affine.auth.sign.auth.code.message.password">
If you haven&apos;t received the email, please check your spam folder.
Or <span
className="link"
data-testid='sign-in-with-password'
onClick={useCallback(() => {
setAuthState('signInWithPassword');
}, [setAuthState])}
>
sign in with password
</span> instead.
</Trans>
</div>
<BackButton
onClick={useCallback(() => {
setAuthState('signIn');
}, [setAuthState])}
/>
</>
);
};

View File

@@ -1,71 +0,0 @@
import { LOCALES } from '@affine/i18n';
import { useI18N } from '@affine/i18n';
import { Menu, MenuItem, MenuTrigger } from '@toeverything/components/menu';
import type { ReactElement } from 'react';
import { useCallback, useMemo } from 'react';
// Fixme: keyboard focus should be supported by Menu component
const LanguageMenuContent = ({
currentLanguage,
onSelect,
}: {
currentLanguage?: string;
onSelect: (value: string) => void;
}) => {
return (
<>
{LOCALES.map(option => {
return (
<MenuItem
key={option.name}
selected={currentLanguage === option.originalName}
title={option.name}
onSelect={() => onSelect(option.tag)}
>
{option.originalName}
</MenuItem>
);
})}
</>
);
};
export const LanguageMenu = () => {
const i18n = useI18N();
const currentLanguage = useMemo(
() => LOCALES.find(item => item.tag === i18n.language),
[i18n.language]
);
const onSelect = useCallback(
(event: string) => {
return i18n.changeLanguage(event);
},
[i18n]
);
return (
<Menu
items={
(
<LanguageMenuContent
currentLanguage={currentLanguage?.originalName}
onSelect={onSelect}
/>
) as ReactElement
}
contentOptions={{
style: {
background: 'var(--affine-white)',
},
align: 'end',
}}
>
<MenuTrigger
data-testid="language-menu-button"
style={{ textTransform: 'capitalize', fontWeight: 600 }}
block={true}
>
{currentLanguage?.originalName || ''}
</MenuTrigger>
</Menu>
);
};

View File

@@ -1,38 +0,0 @@
import { styled } from '@affine/component';
export const StyledModalWrapper = styled('div')(() => {
return {
position: 'relative',
padding: '0px',
width: '560px',
background: 'var(--affine-background-overlay-panel-color)',
borderRadius: '12px',
// height: '312px',
};
});
export const StyledModalHeader = styled('div')(() => {
return {
margin: '44px 0px 12px 0px',
width: '560px',
fontWeight: '600',
fontSize: '20px;',
textAlign: 'center',
};
});
export const StyledInputContent = styled('div')(() => {
return {
display: 'flex',
flexDirection: 'row',
justifyContent: 'center',
margin: '24px 0',
fontSize: 'var(--affine-font-base)',
};
});
export const StyledWorkspaceName = styled('span')(() => {
return {
fontWeight: '600',
};
});

View File

@@ -1,45 +0,0 @@
import { globalStyle, style } from '@vanilla-extract/css';
export const settingContent = style({
flexGrow: '1',
height: '100%',
padding: '40px 15px',
overflow: 'hidden',
});
globalStyle(`${settingContent} .wrapper`, {
padding: '0 15px',
height: '100%',
maxWidth: '560px',
margin: '0 auto',
overflowY: 'auto',
});
globalStyle(`${settingContent} .wrapper::-webkit-scrollbar`, {
display: 'none',
});
globalStyle(`${settingContent} .content`, {
minHeight: '100%',
paddingBottom: '80px',
});
globalStyle(`${settingContent} .footer`, {
cursor: 'pointer',
paddingTop: '40px',
marginTop: '-80px',
fontSize: 'var(--affine-font-sm)',
display: 'flex',
minHeight: '100px',
});
globalStyle(`${settingContent} .footer a`, {
color: 'var(--affine-text-primary-color)',
lineHeight: 'normal',
});
export const footerIconWrapper = style({
fontSize: 'var(--affine-font-base)',
color: 'var(--affine-icon-color)',
marginRight: '12px',
height: '19px',
display: 'flex',
alignItems: 'center',
});

View File

@@ -1,292 +0,0 @@
import { Empty } from '@affine/component';
import type { ListData, TrashListData } from '@affine/component/page-list';
import { PageList, PageListTrashView } from '@affine/component/page-list';
import type { Collection } from '@affine/env/filter';
import { Trans } from '@affine/i18n';
import { useAFFiNEI18N } from '@affine/i18n/hooks';
import { assertExists } from '@blocksuite/global/utils';
import { EdgelessIcon, PageIcon } from '@blocksuite/icons';
import { type PageMeta, type Workspace } from '@blocksuite/store';
import { useBlockSuitePageMeta } from '@toeverything/hooks/use-block-suite-page-meta';
import { useBlockSuitePagePreview } from '@toeverything/hooks/use-block-suite-page-preview';
import { useBlockSuiteWorkspacePage } from '@toeverything/hooks/use-block-suite-workspace-page';
import { useAtom, useAtomValue } from 'jotai';
import { Suspense, useCallback, useMemo } from 'react';
import { allPageModeSelectAtom } from '../../../atoms';
import { useBlockSuiteMetaHelper } from '../../../hooks/affine/use-block-suite-meta-helper';
import { useGetPageInfoById } from '../../../hooks/use-get-page-info';
import type { BlockSuiteWorkspace } from '../../../shared';
import { toast } from '../../../utils';
import { filterPage } from '../../../utils/filter';
import { currentCollectionsAtom } from '../../../utils/user-setting';
import { emptyDescButton, emptyDescKbd, pageListEmptyStyle } from './index.css';
import { usePageHelper } from './utils';
export interface BlockSuitePageListProps {
blockSuiteWorkspace: BlockSuiteWorkspace;
listType: 'all' | 'trash' | 'shared' | 'public';
isPublic?: boolean;
onOpenPage: (pageId: string, newTab?: boolean) => void;
collection?: Collection;
}
const filter = {
all: (pageMeta: PageMeta) => !pageMeta.trash,
public: (pageMeta: PageMeta) => !pageMeta.trash,
trash: (pageMeta: PageMeta, allMetas: PageMeta[]) => {
const parentMeta = allMetas.find(m => m.subpageIds?.includes(pageMeta.id));
return !parentMeta?.trash && pageMeta.trash;
},
shared: (pageMeta: PageMeta) => pageMeta.isPublic && !pageMeta.trash,
};
interface PagePreviewInnerProps {
workspace: Workspace;
pageId: string;
}
const PagePreviewInner = ({ workspace, pageId }: PagePreviewInnerProps) => {
const page = useBlockSuiteWorkspacePage(workspace, pageId);
assertExists(page);
const previewAtom = useBlockSuitePagePreview(page);
const preview = useAtomValue(previewAtom);
return preview;
};
interface PagePreviewProps {
workspace: Workspace;
pageId: string;
}
const PagePreview = ({ workspace, pageId }: PagePreviewProps) => {
return (
<Suspense>
<PagePreviewInner workspace={workspace} pageId={pageId} />
</Suspense>
);
};
interface PageListEmptyProps {
createPage?: ReturnType<typeof usePageHelper>['createPage'];
listType: BlockSuitePageListProps['listType'];
}
const PageListEmpty = (props: PageListEmptyProps) => {
const { listType, createPage } = props;
const t = useAFFiNEI18N();
const onCreatePage = useCallback(() => {
createPage?.();
}, [createPage]);
const getEmptyDescription = () => {
if (listType === 'all') {
const createNewPageButton = (
<button className={emptyDescButton} onClick={onCreatePage}>
New Page
</button>
);
if (environment.isDesktop) {
const shortcut = environment.isMacOs ? '⌘ + N' : 'Ctrl + N';
return (
<Trans i18nKey="emptyAllPagesClient">
Click on the {createNewPageButton} button Or press
<kbd className={emptyDescKbd}>{{ shortcut } as any}</kbd> to create
your first page.
</Trans>
);
}
return (
<Trans i18nKey="emptyAllPages">
Click on the
{createNewPageButton}
button to create your first page.
</Trans>
);
}
if (listType === 'trash') {
return t['emptyTrash']();
}
if (listType === 'shared') {
return t['emptySharedPages']();
}
return;
};
return (
<div className={pageListEmptyStyle}>
<Empty
title={t['com.affine.emptyDesc']()}
description={getEmptyDescription()}
/>
</div>
);
};
export const BlockSuitePageList = ({
blockSuiteWorkspace,
onOpenPage,
listType,
isPublic = false,
collection,
}: BlockSuitePageListProps) => {
const pageMetas = useBlockSuitePageMeta(blockSuiteWorkspace);
const {
toggleFavorite,
removeToTrash,
restoreFromTrash,
permanentlyDeletePage,
cancelPublicPage,
} = useBlockSuiteMetaHelper(blockSuiteWorkspace);
const [filterMode] = useAtom(allPageModeSelectAtom);
const { createPage, createEdgeless, importFile, isPreferredEdgeless } =
usePageHelper(blockSuiteWorkspace);
const t = useAFFiNEI18N();
const getPageInfo = useGetPageInfoById(blockSuiteWorkspace);
const tagOptionMap = useMemo(
() =>
Object.fromEntries(
(blockSuiteWorkspace.meta.properties.tags?.options ?? []).map(v => [
v.id,
v,
])
),
[blockSuiteWorkspace.meta.properties.tags?.options]
);
const list = useMemo(
() =>
pageMetas
.filter(pageMeta => {
if (filterMode === 'all') {
return true;
}
if (filterMode === 'edgeless') {
return isPreferredEdgeless(pageMeta.id);
}
if (filterMode === 'page') {
return !isPreferredEdgeless(pageMeta.id);
}
console.error('unknown filter mode', pageMeta, filterMode);
return true;
})
.filter(pageMeta => {
if (!filter[listType](pageMeta, pageMetas)) {
return false;
}
if (!collection) {
return true;
}
return filterPage(collection, pageMeta);
}),
[pageMetas, filterMode, isPreferredEdgeless, listType, collection]
);
if (listType === 'trash') {
const pageList: TrashListData[] = list.map(pageMeta => {
return {
icon: isPreferredEdgeless(pageMeta.id) ? (
<EdgelessIcon />
) : (
<PageIcon />
),
pageId: pageMeta.id,
title: pageMeta.title,
preview: (
<PagePreview workspace={blockSuiteWorkspace} pageId={pageMeta.id} />
),
createDate: new Date(pageMeta.createDate),
trashDate: pageMeta.trashDate
? new Date(pageMeta.trashDate)
: undefined,
onClickPage: () => onOpenPage(pageMeta.id),
onClickRestore: () => {
restoreFromTrash(pageMeta.id);
},
onRestorePage: () => {
restoreFromTrash(pageMeta.id);
toast(
t['com.affine.toastMessage.restored']({
title: pageMeta.title || 'Untitled',
})
);
},
onPermanentlyDeletePage: () => {
permanentlyDeletePage(pageMeta.id);
toast(t['com.affine.toastMessage.permanentlyDeleted']());
},
};
});
return (
<PageListTrashView
list={pageList}
fallback={<PageListEmpty listType={listType} />}
/>
);
}
const pageList: ListData[] = list.map(pageMeta => {
const page = blockSuiteWorkspace.getPage(pageMeta.id);
return {
icon: isPreferredEdgeless(pageMeta.id) ? <EdgelessIcon /> : <PageIcon />,
pageId: pageMeta.id,
title: pageMeta.title,
preview: (
<PagePreview workspace={blockSuiteWorkspace} pageId={pageMeta.id} />
),
tags:
page?.meta.tags?.map(id => tagOptionMap[id]).filter(v => v != null) ??
[],
favorite: !!pageMeta.favorite,
isPublicPage: !!pageMeta.isPublic,
createDate: new Date(pageMeta.createDate),
updatedDate: new Date(pageMeta.updatedDate ?? pageMeta.createDate),
onClickPage: () => onOpenPage(pageMeta.id),
onOpenPageInNewTab: () => onOpenPage(pageMeta.id, true),
onClickRestore: () => {
restoreFromTrash(pageMeta.id);
},
removeToTrash: () => {
removeToTrash(pageMeta.id);
toast(t['com.affine.toastMessage.successfullyDeleted']());
},
onRestorePage: () => {
restoreFromTrash(pageMeta.id);
toast(
t['com.affine.toastMessage.restored']({
title: pageMeta.title || 'Untitled',
})
);
},
bookmarkPage: () => {
const status = pageMeta.favorite;
toggleFavorite(pageMeta.id);
toast(
status
? t['com.affine.toastMessage.removedFavorites']()
: t['com.affine.toastMessage.addedFavorites']()
);
},
onDisablePublicSharing: () => {
cancelPublicPage(pageMeta.id);
toast('Successfully disabled', {
portal: document.body,
});
},
};
});
return (
<PageList
collectionsAtom={currentCollectionsAtom}
propertiesMeta={blockSuiteWorkspace.meta.properties}
getPageInfo={getPageInfo}
onCreateNewPage={createPage}
onCreateNewEdgeless={createEdgeless}
onImportFile={importFile}
isPublicWorkspace={isPublic}
list={pageList}
fallback={<PageListEmpty createPage={createPage} listType={listType} />}
/>
);
};

View File

@@ -1,18 +0,0 @@
import { style } from '@vanilla-extract/css';
export const filterContainerStyle = style({
padding: '12px',
display: 'flex',
position: 'relative',
'::after': {
content: '""',
display: 'block',
width: '100%',
height: '1px',
background: 'var(--affine-border-color)',
position: 'absolute',
bottom: 0,
left: 0,
margin: '0 1px',
},
});

View File

@@ -1,60 +0,0 @@
import { WorkspaceSubPath } from '@affine/env/workspace';
import { useAFFiNEI18N } from '@affine/i18n/hooks';
import {
DeleteTemporarilyIcon,
FolderIcon,
SettingsIcon,
} from '@blocksuite/icons';
import { useAtom } from 'jotai';
import type { ReactElement, SVGProps } from 'react';
import { useMemo } from 'react';
import { openSettingModalAtom } from '../../../atoms';
type IconComponent = (props: SVGProps<SVGSVGElement>) => ReactElement;
interface ConfigItem {
title: string;
icon: IconComponent;
onClick: () => void;
}
interface ConfigPathItem {
title: string;
icon: IconComponent;
subPath: WorkspaceSubPath;
}
export type Config = ConfigItem | ConfigPathItem;
export const useSwitchToConfig = (workspaceId: string): Config[] => {
const t = useAFFiNEI18N();
const [, setOpenSettingModalAtom] = useAtom(openSettingModalAtom);
return useMemo(
() => [
{
title: t['com.affine.workspaceSubPath.all'](),
subPath: WorkspaceSubPath.ALL,
icon: FolderIcon,
},
{
title: t['Workspace Settings'](),
onClick: () => {
setOpenSettingModalAtom({
open: true,
activeTab: 'workspace',
workspaceId,
});
},
icon: SettingsIcon,
},
{
title: t['com.affine.workspaceSubPath.trash'](),
subPath: WorkspaceSubPath.TRASH,
icon: DeleteTemporarilyIcon,
},
],
[t, workspaceId, setOpenSettingModalAtom]
);
};

View File

@@ -1,59 +0,0 @@
import { useAFFiNEI18N } from '@affine/i18n/hooks';
import { assertEquals } from '@blocksuite/global/utils';
import { PlusIcon } from '@blocksuite/icons';
import { nanoid } from '@blocksuite/store';
import { useBlockSuiteWorkspaceHelper } from '@toeverything/hooks/use-block-suite-workspace-helper';
import { initEmptyPage } from '@toeverything/infra/blocksuite';
import { Command } from 'cmdk';
import { useCallback } from 'react';
import { useNavigateHelper } from '../../../hooks/use-navigate-helper';
import type { BlockSuiteWorkspace } from '../../../shared';
import { StyledModalFooterContent } from './style';
export interface FooterProps {
query: string;
onClose: () => void;
blockSuiteWorkspace: BlockSuiteWorkspace;
}
export const Footer = ({
query,
onClose,
blockSuiteWorkspace,
}: FooterProps) => {
const { createPage } = useBlockSuiteWorkspaceHelper(blockSuiteWorkspace);
const t = useAFFiNEI18N();
const { jumpToPage } = useNavigateHelper();
const MAX_QUERY_SHOW_LENGTH = 20;
const normalizedQuery =
query.length > MAX_QUERY_SHOW_LENGTH
? query.slice(0, MAX_QUERY_SHOW_LENGTH) + '...'
: query;
return (
<Command.Item
data-testid="quick-search-add-new-page"
onSelect={useCallback(async () => {
const id = nanoid();
const page = createPage(id);
assertEquals(page.id, id);
await initEmptyPage(page, query);
blockSuiteWorkspace.setPageMeta(page.id, {
title: query,
});
onClose();
jumpToPage(blockSuiteWorkspace.id, page.id);
}, [blockSuiteWorkspace, createPage, jumpToPage, onClose, query])}
>
<StyledModalFooterContent>
<PlusIcon />
{query ? (
<span>{t['New Keyword Page']({ query: normalizedQuery })}</span>
) : (
<span>{t['New Page']()}</span>
)}
</StyledModalFooterContent>
</Command.Item>
);
};

View File

@@ -1,164 +0,0 @@
import { useAFFiNEI18N } from '@affine/i18n/hooks';
import { Modal } from '@toeverything/components/modal';
import { Command } from 'cmdk';
import { startTransition, Suspense } from 'react';
import { useCallback, useEffect, useRef, useState } from 'react';
import type { AllWorkspace } from '../../../shared';
import { Footer } from './footer';
import { Results } from './results';
import { SearchInput } from './search-input';
import {
StyledContent,
StyledModalDivider,
StyledModalFooter,
StyledModalHeader,
StyledNotFound,
StyledShortcut,
} from './style';
export interface QuickSearchModalProps {
workspace: AllWorkspace;
open: boolean;
setOpen: (value: boolean) => void;
}
export const QuickSearchModal = ({
open,
setOpen,
workspace,
}: QuickSearchModalProps) => {
const blockSuiteWorkspace = workspace?.blockSuiteWorkspace;
const t = useAFFiNEI18N();
const inputRef = useRef<HTMLInputElement>(null);
const [query, _setQuery] = useState('');
const setQuery = useCallback((query: string) => {
startTransition(() => {
_setQuery(query);
});
}, []);
const [showCreatePage, setShowCreatePage] = useState(true);
const handleClose = useCallback(() => {
setOpen(false);
}, [setOpen]);
// Add ‘⌘+K shortcut keys as switches
useEffect(() => {
const keydown = (e: KeyboardEvent) => {
if ((e.key === 'k' && e.metaKey) || (e.key === 'k' && e.ctrlKey)) {
const selection = window.getSelection();
// prevent search bar focus in firefox
e.preventDefault();
setQuery('');
if (selection?.toString()) {
setOpen(false);
return;
}
setOpen(!open);
}
};
document.addEventListener('keydown', keydown, { capture: true });
return () =>
document.removeEventListener('keydown', keydown, { capture: true });
}, [open, setOpen, setQuery]);
useEffect(() => {
if (open) {
// Waiting for DOM rendering
requestAnimationFrame(() => {
const inputElement = inputRef.current;
inputElement?.focus();
});
}
}, [open]);
return (
<Modal
open={open}
onOpenChange={setOpen}
width={608}
withoutCloseButton
contentOptions={{
['data-testid' as string]: 'quickSearch',
style: {
maxHeight: '80vh',
minHeight: '412px',
top: '80px',
overflow: 'hidden',
transform: 'translateX(-50%)',
padding: 0,
},
}}
>
<Command
shouldFilter={false}
//Handle KeyboardEvent conflicts with blocksuite
onKeyDown={(e: React.KeyboardEvent) => {
if (
e.key === 'ArrowDown' ||
e.key === 'ArrowUp' ||
e.key === 'ArrowLeft' ||
e.key === 'ArrowRight'
) {
e.stopPropagation();
}
}}
>
<StyledModalHeader>
<SearchInput
ref={inputRef}
onValueChange={value => {
setQuery(value);
}}
onKeyDown={e => {
// Avoid triggering the cmdk onSelect event when the input method is in use
if (e.nativeEvent.isComposing) {
e.stopPropagation();
return;
}
}}
placeholder={t['Quick search placeholder']()}
/>
<StyledShortcut>
{environment.isBrowser && environment.isMacOs
? '⌘ + K'
: 'Ctrl + K'}
</StyledShortcut>
</StyledModalHeader>
<StyledModalDivider />
<Command.List>
<StyledContent>
<Suspense
fallback={
<StyledNotFound>
<span>{t['com.affine.loading']()}</span>
</StyledNotFound>
}
>
<Results
query={query}
onClose={handleClose}
workspace={workspace}
setShowCreatePage={setShowCreatePage}
/>
</Suspense>
</StyledContent>
{showCreatePage ? (
<>
<StyledModalDivider />
<StyledModalFooter>
<Footer
query={query}
onClose={handleClose}
blockSuiteWorkspace={blockSuiteWorkspace}
/>
</StyledModalFooter>
</>
) : null}
</Command.List>
</Command>
</Modal>
);
};
export default QuickSearchModal;

View File

@@ -1,188 +0,0 @@
import { UNTITLED_WORKSPACE_NAME } from '@affine/env/constant';
import { useAFFiNEI18N } from '@affine/i18n/hooks';
import { assertExists } from '@blocksuite/global/utils';
import { EdgelessIcon, PageIcon } from '@blocksuite/icons';
import type { Workspace } from '@blocksuite/store';
import { useBlockSuitePageMeta } from '@toeverything/hooks/use-block-suite-page-meta';
import { useBlockSuiteWorkspaceHelper } from '@toeverything/hooks/use-block-suite-workspace-helper';
import { Command } from 'cmdk';
import { type Atom, atom, useAtomValue } from 'jotai';
import type { Dispatch, SetStateAction } from 'react';
import { startTransition, useEffect } from 'react';
import { recentPageSettingsAtom } from '../../../atoms';
import { useNavigateHelper } from '../../../hooks/use-navigate-helper';
import type { AllWorkspace } from '../../../shared';
import { useSwitchToConfig } from './config';
import { StyledListItem, StyledNotFound } from './style';
export interface ResultsProps {
workspace: AllWorkspace;
query: string;
onClose: () => void;
setShowCreatePage: Dispatch<SetStateAction<boolean>>;
}
const loadAllPageWeakMap = new WeakMap<Workspace, Atom<Promise<void>>>();
function getLoadAllPage(workspace: Workspace) {
if (loadAllPageWeakMap.has(workspace)) {
return loadAllPageWeakMap.get(workspace) as Atom<Promise<void>>;
} else {
const aAtom = atom(async () => {
// fixme: we have to load all pages here and re-index them
// there might have performance issue
await Promise.all(
[...workspace.pages.values()].map(page =>
page.waitForLoaded().then(() => {
workspace.indexer.search.refreshPageIndex(page.id, page.spaceDoc);
})
)
);
});
loadAllPageWeakMap.set(workspace, aAtom);
return aAtom;
}
}
export const Results = ({
query,
workspace,
setShowCreatePage,
onClose,
}: ResultsProps) => {
const blockSuiteWorkspace = workspace.blockSuiteWorkspace;
useBlockSuiteWorkspaceHelper(blockSuiteWorkspace);
const pageList = useBlockSuitePageMeta(blockSuiteWorkspace);
assertExists(blockSuiteWorkspace.id);
const list = useSwitchToConfig(workspace.id);
useAtomValue(getLoadAllPage(blockSuiteWorkspace));
const recentPageSetting = useAtomValue(recentPageSettingsAtom);
const t = useAFFiNEI18N();
const { jumpToPage, jumpToSubPath } = useNavigateHelper();
const pageIds = [...blockSuiteWorkspace.search({ query }).values()].map(
id => {
if (id.startsWith('space:')) {
return id.slice(6);
} else {
return id;
}
}
);
const resultsPageMeta = pageList.filter(
page => pageIds.indexOf(page.id) > -1 && !page.trash
);
const recentlyViewedItem = recentPageSetting.filter(recent => {
const page = pageList.find(page => recent.id === page.id);
if (!page) {
return false;
} else {
return page.trash !== true;
}
});
useEffect(() => {
startTransition(() => {
setShowCreatePage(resultsPageMeta.length === 0);
});
}, [resultsPageMeta.length, setShowCreatePage]);
if (!query) {
return (
<>
{recentlyViewedItem.length > 0 && (
<Command.Group heading={t['Recent']()}>
{recentlyViewedItem.map(recent => {
const page = pageList.find(page => recent.id === page.id);
assertExists(page);
return (
<Command.Item
key={page.id}
value={page.id}
onSelect={() => {
onClose();
jumpToPage(blockSuiteWorkspace.id, page.id);
}}
>
<StyledListItem>
{recent.mode === 'edgeless' ? (
<EdgelessIcon />
) : (
<PageIcon />
)}
<span>{page.title || UNTITLED_WORKSPACE_NAME}</span>
</StyledListItem>
</Command.Item>
);
})}
</Command.Group>
)}
<Command.Group heading={t['Jump to']()}>
{list.map(link => {
return (
<Command.Item
key={link.title}
value={link.title}
onSelect={() => {
onClose();
if ('subPath' in link) {
jumpToSubPath(blockSuiteWorkspace.id, link.subPath);
} else if ('onClick' in link) {
link.onClick();
} else {
throw new Error('Invalid link');
}
}}
>
<StyledListItem>
<link.icon />
<span>{link.title}</span>
</StyledListItem>
</Command.Item>
);
})}
</Command.Group>
</>
);
}
if (!resultsPageMeta.length) {
return (
<StyledNotFound>
<span>{t['Find 0 result']()}</span>
<img
alt="no result"
src="/imgs/no-result.svg"
width={200}
height={200}
/>
</StyledNotFound>
);
}
return (
<Command.Group
heading={t['Find results']({ number: `${resultsPageMeta.length}` })}
>
{resultsPageMeta.map(result => {
return (
<Command.Item
key={result.id}
onSelect={() => {
onClose();
assertExists(blockSuiteWorkspace.id);
jumpToPage(blockSuiteWorkspace.id, result.id);
}}
value={result.id}
>
<StyledListItem>
{result.mode === 'edgeless' ? <EdgelessIcon /> : <PageIcon />}
<span>{result.title || UNTITLED_WORKSPACE_NAME}</span>
</StyledListItem>
</Command.Item>
);
})}
</Command.Group>
);
};

View File

@@ -1,33 +0,0 @@
import { SearchIcon } from '@blocksuite/icons';
import { Command } from 'cmdk';
import { forwardRef } from 'react';
import { StyledInputContent, StyledLabel } from './style';
export const SearchInput = forwardRef<
HTMLInputElement,
Omit<
React.InputHTMLAttributes<HTMLInputElement>,
'value' | 'onChange' | 'type'
> & {
/**
* Optional controlled state for the value of the search input.
*/
value?: string;
/**
* Event handler called when the search value changes.
*/
onValueChange?: (search: string) => void;
} & React.RefAttributes<HTMLInputElement>
>((props, ref) => {
return (
<StyledInputContent>
<StyledLabel htmlFor=":r5:">
<SearchIcon />
</StyledLabel>
<Command.Input ref={ref} {...props} />
</StyledInputContent>
);
});
SearchInput.displayName = 'SearchInput';

View File

@@ -1,180 +0,0 @@
import { displayFlex, styled, textEllipsis } from '@affine/component';
export const StyledContent = styled('div')(() => {
return {
minHeight: '290px',
maxHeight: '70vh',
width: '100%',
overflow: 'auto',
marginBottom: '10px',
...displayFlex('flex-start', 'flex-start'),
flexDirection: 'column',
color: 'var(--affine-text-primary-color)',
transition: 'all 0.15s',
letterSpacing: '0.06em',
'[cmdk-group]': {
width: '100%',
},
'[cmdk-group-heading]': {
...displayFlex('start', 'center'),
margin: '0 16px',
height: '36px',
lineHeight: '22px',
fontSize: 'var(--affine-font-sm)',
color: 'var(--affine-text-secondary-color)',
},
'[cmdk-item]': {
margin: '0 4px',
},
'[aria-selected="true"]': {
transition: 'all 0.15s',
borderRadius: '4px',
color: 'var(--affine-primary-color)',
backgroundColor: 'var(--affine-hover-color)',
padding: '0 2px',
},
};
});
export const StyledJumpTo = styled('div')(() => {
return {
...displayFlex('center', 'start'),
flexDirection: 'column',
padding: '10px 10px 10px 0',
fontSize: 'var(--affine-font-base)',
strong: {
fontWeight: '500',
marginBottom: '10px',
},
};
});
export const StyledNotFound = styled('div')(() => {
return {
width: '612px',
...displayFlex('center', 'center'),
flexDirection: 'column',
padding: '0 16px',
fontSize: 'var(--affine-font-sm)',
lineHeight: '22px',
color: 'var(--affine-text-secondary-color)',
span: {
...displayFlex('flex-start', 'center'),
width: '100%',
fontWeight: '400',
height: '36px',
},
img: {
marginTop: '10px',
},
};
});
export const StyledInputContent = styled('div')(() => {
return {
...displayFlex('space-between', 'center'),
input: {
width: '492px',
height: '22px',
padding: '0 12px',
fontSize: 'var(--affine-font-base)',
...displayFlex('space-between', 'center'),
letterSpacing: '0.06em',
color: 'var(--affine-text-primary-color)',
'::placeholder': {
color: 'var(--affine-placeholder-color)',
},
},
};
});
export const StyledShortcut = styled('div')(() => {
return {
color: 'var(--affine-placeholder-color)',
fontSize: 'var(--affine-font-sm)',
whiteSpace: 'nowrap',
};
});
export const StyledLabel = styled('label')(() => {
return {
width: '20px',
height: '20px',
color: 'var(--affine-icon-color)',
fontSize: '20px',
};
});
export const StyledModalHeader = styled('div')(() => {
return {
height: '36px',
margin: '12px 16px 0px 16px',
...displayFlex('space-between', 'center'),
};
});
export const StyledModalDivider = styled('div')(() => {
return {
width: 'auto',
height: '0',
margin: '6px 16px',
borderTop: '0.5px solid var(--affine-border-color)',
};
});
export const StyledModalFooter = styled('div')(() => {
return {
fontSize: 'inherit',
lineHeight: '22px',
marginBottom: '8px',
textAlign: 'center',
color: 'var(--affine-text-primary-color)',
...displayFlex('center', 'center'),
transition: 'all .15s',
'[cmdk-item]': {
margin: '0 4px',
},
'[aria-selected="true"]': {
transition: 'all 0.15s',
borderRadius: '4px',
color: 'var(--affine-primary-color)',
backgroundColor: 'var(--affine-hover-color)',
'span,svg': {
transition: 'all 0.15s',
transform: 'scale(1.02)',
},
},
};
});
export const StyledModalFooterContent = styled('button')(() => {
return {
width: '600px',
height: '32px',
fontSize: 'var(--affine-font-base)',
lineHeight: '22px',
textAlign: 'center',
...displayFlex('center', 'center'),
color: 'inherit',
borderRadius: '4px',
transition: 'background .15s, color .15s',
'>svg': {
fontSize: '20px',
marginRight: '12px',
},
};
});
export const StyledListItem = styled('button')(() => {
return {
width: '100%',
height: '32px',
fontSize: 'inherit',
color: 'inherit',
padding: '0 12px',
borderRadius: '4px',
transition: 'all .15s',
...displayFlex('flex-start', 'center'),
span: {
...textEllipsis(1),
},
'> svg': {
fontSize: '20px',
marginRight: '12px',
},
};
});

View File

@@ -1,60 +0,0 @@
import {
EditCollectionModal,
useCollectionManager,
} from '@affine/component/page-list';
import type { Collection } from '@affine/env/filter';
import { useAFFiNEI18N } from '@affine/i18n/hooks';
import { PlusIcon } from '@blocksuite/icons';
import type { Workspace } from '@blocksuite/store';
import { uuidv4 } from '@blocksuite/store';
import { IconButton } from '@toeverything/components/button';
import { useCallback, useState } from 'react';
import { useGetPageInfoById } from '../../../../hooks/use-get-page-info';
import { currentCollectionsAtom } from '../../../../utils/user-setting';
type AddCollectionButtonProps = {
workspace: Workspace;
};
export const AddCollectionButton = ({
workspace,
}: AddCollectionButtonProps) => {
const getPageInfo = useGetPageInfoById(workspace);
const setting = useCollectionManager(currentCollectionsAtom);
const t = useAFFiNEI18N();
const [show, showUpdateCollection] = useState(false);
const [defaultCollection, setDefaultCollection] = useState<Collection>();
const handleClick = useCallback(() => {
showUpdateCollection(true);
setDefaultCollection({
id: uuidv4(),
name: '',
pinned: true,
filterList: [],
workspaceId: workspace.id,
});
}, [showUpdateCollection, workspace.id]);
return (
<>
<IconButton
data-testid="slider-bar-add-collection-button"
onClick={handleClick}
size="small"
>
<PlusIcon />
</IconButton>
<EditCollectionModal
propertiesMeta={workspace.meta.properties}
getPageInfo={getPageInfo}
onConfirm={setting.saveCollection}
open={show}
onOpenChange={showUpdateCollection}
title={t['com.affine.editCollection.saveCollection']()}
init={defaultCollection}
/>
</>
);
};

View File

@@ -1,309 +0,0 @@
import { MenuItem as CollectionItem } from '@affine/component/app-sidebar';
import {
EditCollectionModal,
useCollectionManager,
useSavedCollections,
} from '@affine/component/page-list';
import type { Collection } from '@affine/env/filter';
import type { GetPageInfoById } from '@affine/env/page-info';
import { WorkspaceSubPath } from '@affine/env/workspace';
import { useAFFiNEI18N } from '@affine/i18n/hooks';
import {
DeleteIcon,
FilterIcon,
InformationIcon,
MoreHorizontalIcon,
UnpinIcon,
ViewLayersIcon,
} from '@blocksuite/icons';
import type { PageMeta, Workspace } from '@blocksuite/store';
import type { DragEndEvent } from '@dnd-kit/core';
import { useDroppable } from '@dnd-kit/core';
import * as Collapsible from '@radix-ui/react-collapsible';
import { IconButton } from '@toeverything/components/button';
import {
Menu,
MenuIcon,
MenuItem,
type MenuItemProps,
} from '@toeverything/components/menu';
import { useBlockSuitePageMeta } from '@toeverything/hooks/use-block-suite-page-meta';
import type { ReactElement } from 'react';
import { useCallback, useMemo, useState } from 'react';
import { useGetPageInfoById } from '../../../../hooks/use-get-page-info';
import { useNavigateHelper } from '../../../../hooks/use-navigate-helper';
import { filterPage } from '../../../../utils/filter';
import { currentCollectionsAtom } from '../../../../utils/user-setting';
import type { CollectionsListProps } from '../index';
import { Page } from './page';
import * as styles from './styles.css';
const Collections_DROP_AREA_PREFIX = 'collections-';
const isCollectionsDropArea = (id?: string | number) => {
return typeof id === 'string' && id.startsWith(Collections_DROP_AREA_PREFIX);
};
export const processCollectionsDrag = (e: DragEndEvent) => {
if (
isCollectionsDropArea(e.over?.id) &&
String(e.active.id).startsWith('page-list-item-')
) {
e.over?.data.current?.addToCollection?.(e.active.data.current?.pageId);
}
};
const CollectionOperations = ({
view,
showUpdateCollection,
setting,
}: {
view: Collection;
showUpdateCollection: () => void;
setting: ReturnType<typeof useCollectionManager>;
}) => {
const t = useAFFiNEI18N();
const actions = useMemo<
Array<
| {
icon: ReactElement;
name: string;
click: () => void;
type?: MenuItemProps['type'];
element?: undefined;
}
| {
element: ReactElement;
}
>
>(
() => [
{
icon: (
<MenuIcon>
<FilterIcon />
</MenuIcon>
),
name: t['Edit Filter'](),
click: showUpdateCollection,
},
{
icon: (
<MenuIcon>
<UnpinIcon />
</MenuIcon>
),
name: t['Unpin'](),
click: () => {
return setting.updateCollection({
...view,
pinned: false,
});
},
},
{
element: <div key="divider" className={styles.menuDividerStyle}></div>,
},
{
icon: (
<MenuIcon>
<DeleteIcon />
</MenuIcon>
),
name: t['Delete'](),
click: () => {
return setting.deleteCollection(view.id);
},
type: 'danger',
},
],
[setting, showUpdateCollection, t, view]
);
return (
<div style={{ minWidth: 150 }}>
{actions.map(action => {
if (action.element) {
return action.element;
}
return (
<MenuItem
data-testid="collection-option"
key={action.name}
type={action.type}
preFix={action.icon}
onClick={action.click}
>
{action.name}
</MenuItem>
);
})}
</div>
);
};
const CollectionRenderer = ({
collection,
pages,
workspace,
getPageInfo,
}: {
collection: Collection;
pages: PageMeta[];
workspace: Workspace;
getPageInfo: GetPageInfoById;
}) => {
const [collapsed, setCollapsed] = useState(true);
const setting = useCollectionManager(currentCollectionsAtom);
const { jumpToSubPath } = useNavigateHelper();
const clickCollection = useCallback(() => {
jumpToSubPath(workspace.id, WorkspaceSubPath.ALL);
setting.selectCollection(collection.id);
}, [jumpToSubPath, workspace.id, setting, collection.id]);
const { setNodeRef, isOver } = useDroppable({
id: `${Collections_DROP_AREA_PREFIX}${collection.id}`,
data: {
addToCollection: (id: string) => {
setting.addPage(collection.id, id).catch(err => {
console.error(err);
});
},
},
});
const allPagesMeta = useMemo(
() => Object.fromEntries(pages.map(v => [v.id, v])),
[pages]
);
const [show, showUpdateCollection] = useState(false);
const allowList = useMemo(
() => new Set(collection.allowList),
[collection.allowList]
);
const excludeList = useMemo(
() => new Set(collection.excludeList),
[collection.excludeList]
);
const removeFromAllowList = useCallback(
(id: string) => {
return setting.updateCollection({
...collection,
allowList: collection.allowList?.filter(v => v != id),
});
},
[collection, setting]
);
const addToExcludeList = useCallback(
(id: string) => {
return setting.updateCollection({
...collection,
excludeList: [id, ...(collection.excludeList ?? [])],
});
},
[collection, setting]
);
const pagesToRender = pages.filter(
page => filterPage(collection, page) && !page.trash
);
return (
<Collapsible.Root open={!collapsed}>
<EditCollectionModal
propertiesMeta={workspace.meta.properties}
getPageInfo={getPageInfo}
init={collection}
onConfirm={setting.saveCollection}
open={show}
onOpenChange={showUpdateCollection}
/>
<CollectionItem
data-testid="collection-item"
data-type="collection-list-item"
ref={setNodeRef}
onCollapsedChange={setCollapsed}
active={isOver}
icon={<ViewLayersIcon />}
postfix={
<Menu
items={
<CollectionOperations
view={collection}
showUpdateCollection={() => showUpdateCollection(true)}
setting={setting}
/>
}
>
<IconButton
data-testid="collection-options"
type="plain"
withoutHoverStyle
>
<MoreHorizontalIcon />
</IconButton>
</Menu>
}
collapsed={pagesToRender.length > 0 ? collapsed : undefined}
onClick={clickCollection}
>
<div
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
}}
>
<div>{collection.name}</div>
</div>
</CollectionItem>
<Collapsible.Content className={styles.collapsibleContent}>
<div style={{ marginLeft: 20, marginTop: -4 }}>
{pagesToRender.map(page => {
return (
<Page
inAllowList={allowList.has(page.id)}
removeFromAllowList={removeFromAllowList}
inExcludeList={excludeList.has(page.id)}
addToExcludeList={addToExcludeList}
allPageMeta={allPagesMeta}
page={page}
key={page.id}
workspace={workspace}
/>
);
})}
</div>
</Collapsible.Content>
</Collapsible.Root>
);
};
export const CollectionsList = ({ workspace }: CollectionsListProps) => {
const metas = useBlockSuitePageMeta(workspace);
const { savedCollections } = useSavedCollections(currentCollectionsAtom);
const getPageInfo = useGetPageInfoById(workspace);
const pinedCollections = useMemo(
() => savedCollections.filter(v => v.pinned),
[savedCollections]
);
const t = useAFFiNEI18N();
if (pinedCollections.length === 0) {
return (
<CollectionItem
data-testid="slider-bar-collection-null-description"
icon={<InformationIcon />}
disabled
>
<span>{t['Create a collection']()}</span>
</CollectionItem>
);
}
return (
<div data-testid="collections" className={styles.wrapper}>
{pinedCollections.map(view => {
return (
<CollectionRenderer
getPageInfo={getPageInfo}
key={view.id}
collection={view}
pages={metas}
workspace={workspace}
/>
);
})}
</div>
);
};

View File

@@ -1,397 +0,0 @@
import { WorkspaceList } from '@affine/component/workspace-list';
import type {
AffineCloudWorkspace,
LocalWorkspace,
} from '@affine/env/workspace';
import { WorkspaceFlavour, WorkspaceSubPath } from '@affine/env/workspace';
import { useAFFiNEI18N } from '@affine/i18n/hooks';
import type { RootWorkspaceMetadata } from '@affine/workspace/atom';
import { rootWorkspacesMetadataAtom } from '@affine/workspace/atom';
import {
AccountIcon,
ImportIcon,
Logo1Icon,
MoreHorizontalIcon,
PlusIcon,
SignOutIcon,
} from '@blocksuite/icons';
import type { DragEndEvent } from '@dnd-kit/core';
import { arrayMove } from '@dnd-kit/sortable';
import { IconButton } from '@toeverything/components/button';
import { Divider } from '@toeverything/components/divider';
import { Menu, MenuIcon, MenuItem } from '@toeverything/components/menu';
import {
currentPageIdAtom,
currentWorkspaceIdAtom,
} from '@toeverything/infra/atom';
import { useAtom, useAtomValue, useSetAtom } from 'jotai';
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
import { useSession } from 'next-auth/react';
import { startTransition, useCallback, useMemo, useTransition } from 'react';
import {
authAtom,
openCreateWorkspaceModalAtom,
openDisableCloudAlertModalAtom,
openSettingModalAtom,
} from '../../../../atoms';
import type { AllWorkspace } from '../../../../shared';
import { signOutCloud } from '../../../../utils/cloud-utils';
import { useNavigateHelper } from '../.././../../hooks/use-navigate-helper';
import {
StyledCreateWorkspaceCardPill,
StyledCreateWorkspaceCardPillContent,
StyledCreateWorkspaceCardPillIcon,
StyledImportWorkspaceCardPill,
StyledItem,
StyledModalBody,
StyledModalContent,
StyledModalFooterContent,
StyledModalHeader,
StyledModalHeaderContent,
StyledModalHeaderLeft,
StyledModalTitle,
StyledOperationWrapper,
StyledSignInCardPill,
StyledSignInCardPillTextCotainer,
StyledSignInCardPillTextPrimary,
StyledSignInCardPillTextSecondary,
StyledWorkspaceFlavourTitle,
} from './styles';
interface WorkspaceModalProps {
disabled?: boolean;
workspaces: RootWorkspaceMetadata[];
currentWorkspaceId: AllWorkspace['id'] | null;
onClickWorkspace: (workspace: RootWorkspaceMetadata['id']) => void;
onClickWorkspaceSetting: (workspace: RootWorkspaceMetadata['id']) => void;
onNewWorkspace: () => void;
onAddWorkspace: () => void;
onMoveWorkspace: (activeId: string, overId: string) => void;
}
const AccountMenu = ({
onOpenAccountSetting,
onSignOut,
}: {
onOpenAccountSetting: () => void;
onSignOut: () => void;
}) => {
const t = useAFFiNEI18N();
return (
<div>
<MenuItem
preFix={
<MenuIcon>
<AccountIcon />
</MenuIcon>
}
data-testid="editor-option-menu-import"
onClick={onOpenAccountSetting}
>
{t['com.affine.workspace.cloud.account.settings']()}
</MenuItem>
<Divider />
<MenuItem
preFix={
<MenuIcon>
<SignOutIcon />
</MenuIcon>
}
data-testid="editor-option-menu-import"
onClick={onSignOut}
>
{t['com.affine.workspace.cloud.account.logout']()}
</MenuItem>
</div>
);
};
const CloudWorkSpaceList = ({
disabled,
workspaces,
onClickWorkspace,
onClickWorkspaceSetting,
currentWorkspaceId,
onMoveWorkspace,
}: WorkspaceModalProps) => {
const t = useAFFiNEI18N();
return (
<>
<StyledModalHeader>
<StyledModalHeaderLeft>
<StyledWorkspaceFlavourTitle>
{t['com.affine.workspace.cloud']()}
</StyledWorkspaceFlavourTitle>
</StyledModalHeaderLeft>
</StyledModalHeader>
<StyledModalContent>
<WorkspaceList
disabled={disabled}
items={
workspaces.filter(
({ flavour }) => flavour === WorkspaceFlavour.AFFINE_CLOUD
) as (AffineCloudWorkspace | LocalWorkspace)[]
}
currentWorkspaceId={currentWorkspaceId}
onClick={onClickWorkspace}
onSettingClick={onClickWorkspaceSetting}
onDragEnd={useCallback(
(event: DragEndEvent) => {
const { active, over } = event;
if (active.id !== over?.id) {
onMoveWorkspace(active.id as string, over?.id as string);
}
},
[onMoveWorkspace]
)}
/>
</StyledModalContent>
</>
);
};
export const UserWithWorkspaceList = ({
onEventEnd,
}: {
onEventEnd?: () => void;
}) => {
const setOpenCreateWorkspaceModal = useSetAtom(openCreateWorkspaceModalAtom);
const { jumpToSubPath, jumpToIndex } = useNavigateHelper();
const workspaces = useAtomValue(rootWorkspacesMetadataAtom, {
delay: 0,
});
const setWorkspaces = useSetAtom(rootWorkspacesMetadataAtom);
const [currentWorkspaceId, setCurrentWorkspaceId] = useAtom(
currentWorkspaceIdAtom
);
const setCurrentPageId = useSetAtom(currentPageIdAtom);
const [, startCloseTransition] = useTransition();
const setOpenSettingModalAtom = useSetAtom(openSettingModalAtom);
const setSettingModalAtom = useSetAtom(openSettingModalAtom);
const t = useAFFiNEI18N();
const setOpen = useSetAtom(authAtom);
const setDisableCloudOpen = useSetAtom(openDisableCloudAlertModalAtom);
// TODO: AFFiNE Cloud support
const { data: session, status } = useSession();
const isLoggedIn = useMemo(() => status === 'authenticated', [status]);
const cloudWorkspaces = useMemo(
() =>
workspaces.filter(
({ flavour }) => flavour === WorkspaceFlavour.AFFINE_CLOUD
) as (AffineCloudWorkspace | LocalWorkspace)[],
[workspaces]
);
const localWorkspaces = useMemo(
() =>
workspaces.filter(
({ flavour }) => flavour === WorkspaceFlavour.LOCAL
) as (AffineCloudWorkspace | LocalWorkspace)[],
[workspaces]
);
const onClickWorkspaceSetting = useCallback(
(workspaceId: string) => {
setOpenSettingModalAtom({
open: true,
activeTab: 'workspace',
workspaceId,
});
onEventEnd?.();
},
[onEventEnd, setOpenSettingModalAtom]
);
const onMoveWorkspace = useCallback(
(activeId: string, overId: string) => {
const oldIndex = workspaces.findIndex(w => w.id === activeId);
const newIndex = workspaces.findIndex(w => w.id === overId);
startTransition(() => {
setWorkspaces(workspaces => arrayMove(workspaces, oldIndex, newIndex));
});
},
[setWorkspaces, workspaces]
);
const onClickWorkspace = useCallback(
(workspaceId: string) => {
startCloseTransition(() => {
setCurrentWorkspaceId(workspaceId);
setCurrentPageId(null);
jumpToSubPath(workspaceId, WorkspaceSubPath.ALL);
});
onEventEnd?.();
},
[jumpToSubPath, onEventEnd, setCurrentPageId, setCurrentWorkspaceId]
);
const onNewWorkspace = useCallback(() => {
setOpenCreateWorkspaceModal('new');
onEventEnd?.();
}, [onEventEnd, setOpenCreateWorkspaceModal]);
const onAddWorkspace = useCallback(async () => {
setOpenCreateWorkspaceModal('add');
onEventEnd?.();
}, [onEventEnd, setOpenCreateWorkspaceModal]);
const onOpenAccountSetting = useCallback(() => {
setSettingModalAtom(prev => ({
...prev,
open: true,
activeTab: 'account',
}));
onEventEnd?.();
}, [onEventEnd, setSettingModalAtom]);
const onSignOut = useCallback(async () => {
signOutCloud()
.then(() => {
jumpToIndex();
})
.catch(console.error);
onEventEnd?.();
}, [onEventEnd, jumpToIndex]);
return (
<>
{!isLoggedIn ? (
<StyledModalHeaderContent>
<StyledSignInCardPill>
<StyledItem
onClick={async () => {
if (!runtimeConfig.enableCloud) {
setDisableCloudOpen(true);
} else {
setOpen(state => ({
...state,
openModal: true,
}));
}
}}
data-testid="cloud-signin-button"
>
<StyledCreateWorkspaceCardPillContent>
<StyledCreateWorkspaceCardPillIcon>
<Logo1Icon />
</StyledCreateWorkspaceCardPillIcon>
<StyledSignInCardPillTextCotainer>
<StyledSignInCardPillTextPrimary>
{t['com.affine.workspace.cloud.auth']()}
</StyledSignInCardPillTextPrimary>
<StyledSignInCardPillTextSecondary>
{t['com.affine.workspace.cloud.description']()}
</StyledSignInCardPillTextSecondary>
</StyledSignInCardPillTextCotainer>
</StyledCreateWorkspaceCardPillContent>
</StyledItem>
</StyledSignInCardPill>
<Divider
style={{
margin: '12px 0px',
}}
/>
</StyledModalHeaderContent>
) : (
<StyledModalHeaderContent>
<StyledModalHeader>
<StyledModalTitle>{session?.user.email}</StyledModalTitle>
<StyledOperationWrapper>
<Menu
items={
<AccountMenu
onOpenAccountSetting={onOpenAccountSetting}
onSignOut={onSignOut}
/>
}
contentOptions={{
side: 'right',
sideOffset: 30,
}}
>
<IconButton
data-testid="more-button"
icon={<MoreHorizontalIcon />}
type="plain"
/>
</Menu>
</StyledOperationWrapper>
</StyledModalHeader>
<Divider style={{ margin: '12px 0px' }} />
</StyledModalHeaderContent>
)}
<StyledModalBody>
{isLoggedIn && cloudWorkspaces.length !== 0 ? (
<>
<CloudWorkSpaceList
workspaces={workspaces}
onClickWorkspace={onClickWorkspace}
onClickWorkspaceSetting={onClickWorkspaceSetting}
onNewWorkspace={onNewWorkspace}
onAddWorkspace={onAddWorkspace}
currentWorkspaceId={currentWorkspaceId}
onMoveWorkspace={onMoveWorkspace}
/>
<Divider
style={{
margin: '12px 0px',
}}
/>
</>
) : null}
<StyledModalHeader>
<StyledWorkspaceFlavourTitle>
{t['com.affine.workspace.local']()}
</StyledWorkspaceFlavourTitle>
</StyledModalHeader>
<StyledModalContent>
<WorkspaceList
items={localWorkspaces}
currentWorkspaceId={currentWorkspaceId}
onClick={onClickWorkspace}
onSettingClick={onClickWorkspaceSetting}
onDragEnd={useCallback(
(event: DragEndEvent) => {
const { active, over } = event;
if (active.id !== over?.id) {
onMoveWorkspace(active.id as string, over?.id as string);
}
},
[onMoveWorkspace]
)}
/>
</StyledModalContent>
{runtimeConfig.enableSQLiteProvider && environment.isDesktop ? (
<StyledImportWorkspaceCardPill>
<StyledItem onClick={onAddWorkspace} data-testid="add-workspace">
<StyledCreateWorkspaceCardPillContent
style={{ gap: '14px', paddingLeft: '2px' }}
>
<StyledCreateWorkspaceCardPillIcon style={{ fontSize: '24px' }}>
<ImportIcon />
</StyledCreateWorkspaceCardPillIcon>
<div>
<p>{t['com.affine.workspace.local.import']()}</p>
</div>
</StyledCreateWorkspaceCardPillContent>
</StyledItem>
</StyledImportWorkspaceCardPill>
) : null}
</StyledModalBody>
<StyledModalFooterContent>
<StyledCreateWorkspaceCardPill>
<StyledItem onClick={onNewWorkspace} data-testid="new-workspace">
<StyledCreateWorkspaceCardPillContent>
<StyledCreateWorkspaceCardPillIcon>
<PlusIcon />
</StyledCreateWorkspaceCardPillIcon>
<div>
<p>{t['New Workspace']()}</p>
</div>
</StyledCreateWorkspaceCardPillContent>
</StyledItem>
</StyledCreateWorkspaceCardPill>
</StyledModalFooterContent>
</>
);
};

View File

@@ -1,273 +0,0 @@
import { displayFlex, styled, textEllipsis } from '@affine/component';
export const StyledSplitLine = styled('div')(() => {
return {
width: '1px',
height: '20px',
background: 'var(--affine-border-color)',
marginRight: '12px',
};
});
export const StyleWorkspaceInfo = styled('div')(() => {
return {
marginLeft: '15px',
width: '202px',
p: {
height: '20px',
fontSize: 'var(--affine-font-sm)',
...displayFlex('flex-start', 'center'),
},
svg: {
marginRight: '10px',
fontSize: '16px',
flexShrink: 0,
},
span: {
flexGrow: 1,
...textEllipsis(1),
},
};
});
export const StyleWorkspaceTitle = styled('div')(() => {
return {
fontSize: 'var(--affine-font-base)',
fontWeight: 600,
lineHeight: '24px',
marginBottom: '10px',
maxWidth: '200px',
...textEllipsis(1),
};
});
export const StyledCreateWorkspaceCard = styled('div')(() => {
return {
width: '310px',
height: '124px',
marginBottom: '24px',
cursor: 'pointer',
padding: '16px',
boxShadow: 'var(--affine-shadow-1)',
borderRadius: '12px',
transition: 'all .1s',
background: 'var(--affine-white-80)',
...displayFlex('flex-start', 'flex-start'),
color: 'var(--affine-text-secondary-color)',
':hover': {
background: 'var(--affine-hover-color)',
color: 'var(--affine-text-primary-color)',
'.add-icon': {
borderColor: 'var(--affine-white)',
color: 'var(--affine-primary-color)',
},
},
'@media (max-width: 720px)': {
width: '100%',
},
};
});
export const StyledCreateWorkspaceCardPillContainer = styled('div')(() => {
return {
borderRadius: '10px',
display: 'flex',
margin: '-8px -4px',
flexFlow: 'column',
gap: '12px',
background: 'var(--affine-background-overlay-panel-color)',
};
});
export const StyledCreateWorkspaceCardPill = styled('div')(() => {
return {
borderRadius: '8px',
display: 'flex',
width: '100%',
height: '58px',
border: `1px solid var(--affine-border-color)`,
};
});
export const StyledSignInCardPill = styled('div')(() => {
return {
borderRadius: '8px',
display: 'flex',
width: '100%',
height: '58px',
};
});
export const StyledImportWorkspaceCardPill = styled('div')(() => {
return {
borderRadius: '5px',
display: 'flex',
width: '100%',
};
});
export const StyledCreateWorkspaceCardPillContent = styled('div')(() => {
return {
display: 'flex',
gap: '12px',
alignItems: 'center',
};
});
export const StyledCreateWorkspaceCardPillIcon = styled('div')(() => {
return {
fontSize: '28px',
width: '1em',
height: '1em',
};
});
export const StyledSignInCardPillTextCotainer = styled('div')(() => {
return {
display: 'flex',
flexDirection: 'column',
};
});
export const StyledSignInCardPillTextSecondary = styled('div')(() => {
return {
fontSize: '12px',
color: 'var(--affine-text-secondary-color)',
};
});
export const StyledSignInCardPillTextPrimary = styled('div')(() => {
return {
fontSize: 'var(--affine-font-base)',
fontWeight: 600,
lineHeight: '24px',
maxWidth: '200px',
textAlign: 'left',
...textEllipsis(1),
};
});
export const StyledModalHeaderLeft = styled('div')(() => {
return { ...displayFlex('flex-start', 'center') };
});
export const StyledModalTitle = styled('div')(() => {
return {
fontWeight: 600,
fontSize: 'var(--affine-font-h6)',
color: 'var(--affine-text-primary-color)',
};
});
export const StyledHelperContainer = styled('div')(() => {
return {
color: 'var(--affine-icon-color)',
marginLeft: '15px',
fontWeight: 400,
fontSize: 'var(--affine-font-h6)',
...displayFlex('center', 'center'),
};
});
export const StyledModalContent = styled('div')({
...displayFlex('space-between', 'flex-start', 'flex-start'),
flexWrap: 'wrap',
flexDirection: 'column',
width: '100%',
gap: '4px',
});
export const StyledModalFooterContent = styled('div')({
...displayFlex('space-between', 'flex-start', 'flex-start'),
flexWrap: 'wrap',
flexDirection: 'column',
width: '100%',
marginTop: '12px',
backgroundColor: 'var(--affine-background-overlay-panel-color)',
});
export const StyledModalHeaderContent = styled('div')({
...displayFlex('space-between', 'flex-start', 'flex-start'),
flexWrap: 'wrap',
flexDirection: 'column',
width: '100%',
backgroundColor: 'var(--affine-background-overlay-panel-color)',
});
export const StyledOperationWrapper = styled('div')(() => {
return {
...displayFlex('flex-end', 'center'),
};
});
export const StyleWorkspaceAdd = styled('div')(() => {
return {
width: '58px',
height: '58px',
borderRadius: '100%',
background: 'var(--affine-background-overlay-panel-color)',
border: '1.5px dashed #f4f5fa',
transition: 'background .2s',
fontSize: '24px',
...displayFlex('center', 'center'),
borderColor: 'var(--affine-white)',
color: 'var(--affine-background-overlay-panel-color)',
};
});
export const StyledModalHeader = styled('div')(() => {
return {
width: '100%',
left: 0,
top: 0,
borderRadius: '24px 24px 0 0',
padding: '0px 14px',
...displayFlex('space-between', 'center'),
};
});
export const StyledModalBody = styled('div')(() => {
return {
display: 'inline-flex',
flexDirection: 'column',
alignItems: 'flex-start',
gap: '4px',
flex: 1,
overflowY: 'auto',
};
});
export const StyledWorkspaceFlavourTitle = styled('div')(() => {
return {
fontSize: 'var(--affine-font-xs)',
color: 'var(--affine-text-secondary-color)',
marginBottom: '4px',
};
});
export const StyledItem = styled('button')<{
active?: boolean;
}>(({ active = false }) => {
return {
height: 'auto',
padding: '8px 12px',
width: '100%',
borderRadius: '5px',
fontSize: 'var(--affine-font-sm)',
...displayFlex('flex-start', 'center'),
cursor: 'pointer',
position: 'relative',
backgroundColor: 'transparent',
color: 'var(--affine-text-primary-color)',
svg: {
color: 'var(--affine-icon-color)',
},
':hover': {
backgroundColor: 'var(--affine-hover-color)',
},
...(active
? {
backgroundColor: 'var(--affine-hover-color)',
}
: {}),
};
});

View File

@@ -1,261 +0,0 @@
import {
AddPageButton,
AppSidebar,
appSidebarOpenAtom,
AppUpdaterButton,
CategoryDivider,
MenuItem,
MenuLinkItem,
QuickSearchInput,
SidebarContainer,
SidebarScrollableContainer,
} from '@affine/component/app-sidebar';
import { useCollectionManager } from '@affine/component/page-list';
import { useAFFiNEI18N } from '@affine/i18n/hooks';
import {
DeleteTemporarilyIcon,
FolderIcon,
SettingsIcon,
} from '@blocksuite/icons';
import type { Page } from '@blocksuite/store';
import { useDroppable } from '@dnd-kit/core';
import { Popover } from '@toeverything/components/popover';
import { useAtom } from 'jotai';
import type { HTMLAttributes, ReactElement } from 'react';
import {
forwardRef,
Suspense,
useCallback,
useEffect,
useMemo,
useState,
} from 'react';
import { useHistoryAtom } from '../../atoms/history';
import { useAppSetting } from '../../atoms/settings';
import type { AllWorkspace } from '../../shared';
import { currentCollectionsAtom } from '../../utils/user-setting';
import { CollectionsList } from '../pure/workspace-slider-bar/collections';
import { AddCollectionButton } from '../pure/workspace-slider-bar/collections/add-collection-button';
import { AddFavouriteButton } from '../pure/workspace-slider-bar/favorite/add-favourite-button';
import FavoriteList from '../pure/workspace-slider-bar/favorite/favorite-list';
import { UserWithWorkspaceList } from '../pure/workspace-slider-bar/user-with-workspace-list';
import { WorkspaceCard } from '../pure/workspace-slider-bar/workspace-card';
import ImportPage from './import-page';
export type RootAppSidebarProps = {
isPublicWorkspace: boolean;
onOpenQuickSearchModal: () => void;
onOpenSettingModal: () => void;
currentWorkspace: AllWorkspace;
openPage: (pageId: string) => void;
createPage: () => Page;
currentPath: string;
paths: {
all: (workspaceId: string) => string;
trash: (workspaceId: string) => string;
shared: (workspaceId: string) => string;
};
};
const RouteMenuLinkItem = forwardRef<
HTMLDivElement,
{
currentPath: string; // todo: pass through useRouter?
path: string;
icon: ReactElement;
children?: ReactElement;
isDraggedOver?: boolean;
} & HTMLAttributes<HTMLDivElement>
>(({ currentPath, path, icon, children, isDraggedOver, ...props }, ref) => {
// Force active style when a page is dragged over
const active = isDraggedOver || currentPath === path;
return (
<MenuLinkItem
ref={ref}
{...props}
active={active}
to={path ?? ''}
icon={icon}
>
{children}
</MenuLinkItem>
);
});
RouteMenuLinkItem.displayName = 'RouteMenuLinkItem';
// Unique droppable IDs
export const DROPPABLE_SIDEBAR_TRASH = 'trash-folder';
/**
* This is for the whole affine app sidebar.
* This component wraps the app sidebar in `@affine/component` with logic and data.
*
* @todo(himself65): rewrite all styled component into @vanilla-extract/css
*/
export const RootAppSidebar = ({
currentWorkspace,
openPage,
createPage,
currentPath,
paths,
onOpenQuickSearchModal,
onOpenSettingModal,
}: RootAppSidebarProps): ReactElement => {
const currentWorkspaceId = currentWorkspace.id;
const [appSettings] = useAppSetting();
const { backToAll } = useCollectionManager(currentCollectionsAtom);
const blockSuiteWorkspace = currentWorkspace.blockSuiteWorkspace;
const t = useAFFiNEI18N();
const [openUserWorkspaceList, setOpenUserWorkspaceList] = useState(false);
const onClickNewPage = useCallback(async () => {
const page = createPage();
await page.waitForLoaded();
openPage(page.id);
}, [createPage, openPage]);
// Listen to the "New Page" action from the menu
useEffect(() => {
if (environment.isDesktop) {
return window.events?.applicationMenu.onNewPageAction(onClickNewPage);
}
return;
}, [onClickNewPage]);
const [sidebarOpen, setSidebarOpen] = useAtom(appSidebarOpenAtom);
useEffect(() => {
if (environment.isDesktop) {
window.apis?.ui.handleSidebarVisibilityChange(sidebarOpen).catch(err => {
console.error(err);
});
}
}, [sidebarOpen]);
useEffect(() => {
const keydown = (e: KeyboardEvent) => {
if ((e.key === '/' && e.metaKey) || (e.key === '/' && e.ctrlKey)) {
setSidebarOpen(!sidebarOpen);
}
};
document.addEventListener('keydown', keydown, { capture: true });
return () =>
document.removeEventListener('keydown', keydown, { capture: true });
}, [sidebarOpen, setSidebarOpen]);
const [history, setHistory] = useHistoryAtom();
const router = useMemo(() => {
return {
forward: () => {
setHistory(true);
},
back: () => {
setHistory(false);
},
history,
};
}, [history, setHistory]);
const trashDroppable = useDroppable({
id: DROPPABLE_SIDEBAR_TRASH,
});
const closeUserWorkspaceList = useCallback(() => {
setOpenUserWorkspaceList(false);
}, []);
return (
<>
<AppSidebar
router={router}
hasBackground={
!(
appSettings.enableBlurBackground &&
environment.isDesktop &&
environment.isMacOs
)
}
>
<SidebarContainer>
<Popover
open={openUserWorkspaceList}
content={
<Suspense>
<UserWithWorkspaceList onEventEnd={closeUserWorkspaceList} />
</Suspense>
}
contentOptions={{
// hide trigger
sideOffset: -58,
onInteractOutside: closeUserWorkspaceList,
onEscapeKeyDown: closeUserWorkspaceList,
}}
>
<WorkspaceCard
currentWorkspace={currentWorkspace}
onClick={useCallback(() => {
setOpenUserWorkspaceList(true);
}, [])}
/>
</Popover>
<QuickSearchInput
data-testid="slider-bar-quick-search-button"
onClick={onOpenQuickSearchModal}
/>
<RouteMenuLinkItem
icon={<FolderIcon />}
currentPath={currentPath}
path={paths.all(currentWorkspaceId)}
onClick={backToAll}
>
<span data-testid="all-pages">
{t['com.affine.workspaceSubPath.all']()}
</span>
</RouteMenuLinkItem>
{runtimeConfig.enableNewSettingModal ? (
<MenuItem
data-testid="slider-bar-workspace-setting-button"
icon={<SettingsIcon />}
onClick={onOpenSettingModal}
>
<span data-testid="settings-modal-trigger">
{t['com.affine.settingSidebar.title']()}
</span>
</MenuItem>
) : null}
</SidebarContainer>
<SidebarScrollableContainer>
<CategoryDivider label={t['com.affine.rootAppSidebar.favorites']()}>
<AddFavouriteButton workspace={blockSuiteWorkspace} />
</CategoryDivider>
<FavoriteList workspace={blockSuiteWorkspace} />
<CategoryDivider label={t['com.affine.rootAppSidebar.collections']()}>
<AddCollectionButton workspace={blockSuiteWorkspace} />
</CategoryDivider>
<CollectionsList workspace={blockSuiteWorkspace} />
<CategoryDivider label={t['com.affine.rootAppSidebar.others']()} />
{/* fixme: remove the following spacer */}
<div style={{ height: '4px' }} />
<RouteMenuLinkItem
ref={trashDroppable.setNodeRef}
isDraggedOver={trashDroppable.isOver}
icon={<DeleteTemporarilyIcon />}
currentPath={currentPath}
path={paths.trash(currentWorkspaceId)}
>
<span data-testid="trash-page">
{t['com.affine.workspaceSubPath.trash']()}
</span>
</RouteMenuLinkItem>
{blockSuiteWorkspace && (
<ImportPage blocksuiteWorkspace={blockSuiteWorkspace} />
)}
</SidebarScrollableContainer>
<SidebarContainer>
{environment.isDesktop && <AppUpdaterButton />}
<div style={{ height: '4px' }} />
<AddPageButton onClick={onClickNewPage} />
</SidebarContainer>
</AppSidebar>
</>
);
};

View File

@@ -1,35 +0,0 @@
import type { AffineOfficialWorkspace } from '@affine/env/workspace';
import { rootWorkspacesMetadataAtom } from '@affine/workspace/atom';
import { assertExists } from '@blocksuite/global/utils';
import type { Workspace } from '@blocksuite/store';
import { useStaticBlockSuiteWorkspace } from '@toeverything/infra/__internal__/react';
import type { Atom } from 'jotai';
import { atom, useAtomValue } from 'jotai';
const workspaceWeakMap = new WeakMap<
Workspace,
Atom<Promise<AffineOfficialWorkspace>>
>();
export function useWorkspace(workspaceId: string): AffineOfficialWorkspace {
const blockSuiteWorkspace = useStaticBlockSuiteWorkspace(workspaceId);
if (!workspaceWeakMap.has(blockSuiteWorkspace)) {
const baseAtom = atom(async get => {
const metadata = await get(rootWorkspacesMetadataAtom);
const flavour = metadata.find(({ id }) => id === workspaceId)?.flavour;
assertExists(flavour, 'workspace flavour not found');
return {
id: workspaceId,
flavour,
blockSuiteWorkspace,
};
});
workspaceWeakMap.set(blockSuiteWorkspace, baseAtom);
}
return useAtomValue(
workspaceWeakMap.get(blockSuiteWorkspace) as Atom<
Promise<AffineOfficialWorkspace>
>
);
}

View File

@@ -1,37 +0,0 @@
import { NotFoundPage } from '@affine/component/not-found-page';
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
import { useSession } from 'next-auth/react';
import type { ReactElement } from 'react';
import { useCallback } from 'react';
import { RouteLogic, useNavigateHelper } from '../hooks/use-navigate-helper';
import { signOutCloud } from '../utils/cloud-utils';
export const Component = (): ReactElement => {
const { data: session } = useSession();
const { jumpToIndex } = useNavigateHelper();
const handleBackButtonClick = useCallback(
() => jumpToIndex(RouteLogic.REPLACE),
[jumpToIndex]
);
const handleSignOut = useCallback(async () => {
await signOutCloud({
callbackUrl: '/signIn',
});
}, []);
return (
<NotFoundPage
user={
session?.user
? {
name: session.user.name || '',
email: session.user.email || '',
avatar: session.user.image || '',
}
: null
}
onBack={handleBackButtonClick}
onSignOut={handleSignOut}
/>
);
};

View File

@@ -1,70 +0,0 @@
import { SignInPageContainer } from '@affine/component/auth-components';
import { useAtom } from 'jotai';
import { useCallback, useEffect } from 'react';
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
import { useLocation, useNavigate } from 'react-router-dom';
import { authAtom } from '../atoms';
import { AuthPanel } from '../components/affine/auth';
import { useCurrentLoginStatus } from '../hooks/affine/use-current-login-status';
import { RouteLogic, useNavigateHelper } from '../hooks/use-navigate-helper';
interface LocationState {
state?: {
callbackURL?: string;
};
}
export const Component = () => {
const [{ state, email = '', emailType = 'changePassword' }, setAuthAtom] =
useAtom(authAtom);
const loginStatus = useCurrentLoginStatus();
const location = useLocation() as LocationState;
const navigate = useNavigate();
const { jumpToIndex } = useNavigateHelper();
useEffect(() => {
if (loginStatus === 'authenticated') {
if (location.state?.callbackURL) {
navigate(location.state.callbackURL, {
replace: true,
});
} else {
jumpToIndex(RouteLogic.REPLACE);
}
}
}, [
jumpToIndex,
location.state?.callbackURL,
loginStatus,
navigate,
setAuthAtom,
]);
return (
<SignInPageContainer>
<AuthPanel
state={state}
email={email}
emailType={emailType}
setEmailType={useCallback(
emailType => {
setAuthAtom(prev => ({ ...prev, emailType }));
},
[setAuthAtom]
)}
setAuthState={useCallback(
state => {
setAuthAtom(prev => ({ ...prev, state }));
},
[setAuthAtom]
)}
setAuthEmail={useCallback(
email => {
setAuthAtom(prev => ({ ...prev, email }));
},
[setAuthAtom]
)}
/>
</SignInPageContainer>
);
};

View File

@@ -1,68 +0,0 @@
import { useCollectionManager } from '@affine/component/page-list';
import { WorkspaceSubPath } from '@affine/env/workspace';
import { assertExists } from '@blocksuite/global/utils';
import { getActiveBlockSuiteWorkspaceAtom } from '@toeverything/infra/__internal__/workspace';
import { getCurrentStore } from '@toeverything/infra/atom';
import { useCallback } from 'react';
import type { LoaderFunction } from 'react-router-dom';
import { redirect } from 'react-router-dom';
import { getUIAdapter } from '../../adapters/workspace';
import { useCurrentWorkspace } from '../../hooks/current/use-current-workspace';
import { useNavigateHelper } from '../../hooks/use-navigate-helper';
import { currentCollectionsAtom } from '../../utils/user-setting';
export const loader: LoaderFunction = async args => {
const rootStore = getCurrentStore();
const workspaceId = args.params.workspaceId;
assertExists(workspaceId);
const workspaceAtom = getActiveBlockSuiteWorkspaceAtom(workspaceId);
const workspace = await rootStore.get(workspaceAtom);
for (const pageId of workspace.pages.keys()) {
const page = workspace.getPage(pageId);
if (page && page.meta.jumpOnce) {
workspace.meta.setPageMeta(page.id, {
jumpOnce: false,
});
return redirect(`/workspace/${workspace.id}/${page.id}`);
}
}
return null;
};
export const AllPage = () => {
const { jumpToPage } = useNavigateHelper();
const [currentWorkspace] = useCurrentWorkspace();
const setting = useCollectionManager(currentCollectionsAtom);
const onClickPage = useCallback(
(pageId: string, newTab?: boolean) => {
assertExists(currentWorkspace);
if (newTab) {
window.open(`/workspace/${currentWorkspace?.id}/${pageId}`, '_blank');
} else {
jumpToPage(currentWorkspace.id, pageId);
}
},
[currentWorkspace, jumpToPage]
);
const { PageList, Header } = getUIAdapter(currentWorkspace.flavour);
return (
<>
<Header
currentWorkspaceId={currentWorkspace.id}
currentEntry={{
subPath: WorkspaceSubPath.ALL,
}}
/>
<PageList
collection={setting.currentCollection}
onOpenPage={onClickPage}
blockSuiteWorkspace={currentWorkspace.blockSuiteWorkspace}
/>
</>
);
};
export const Component = () => {
return <AllPage />;
};

View File

@@ -1,47 +0,0 @@
import { WorkspaceSubPath } from '@affine/env/workspace';
import { assertExists } from '@blocksuite/global/utils';
import { useCallback } from 'react';
import { getUIAdapter } from '../../adapters/workspace';
import { BlockSuitePageList } from '../../components/blocksuite/block-suite-page-list';
import { useCurrentWorkspace } from '../../hooks/current/use-current-workspace';
import { useNavigateHelper } from '../../hooks/use-navigate-helper';
export const TrashPage = () => {
const { jumpToPage } = useNavigateHelper();
const [currentWorkspace] = useCurrentWorkspace();
const onClickPage = useCallback(
(pageId: string, newTab?: boolean) => {
assertExists(currentWorkspace);
if (newTab) {
window.open(`/workspace/${currentWorkspace?.id}/${pageId}`, '_blank');
} else {
jumpToPage(currentWorkspace.id, pageId);
}
},
[currentWorkspace, jumpToPage]
);
// todo(himself65): refactor to plugin
const blockSuiteWorkspace = currentWorkspace.blockSuiteWorkspace;
assertExists(blockSuiteWorkspace);
const { Header } = getUIAdapter(currentWorkspace.flavour);
return (
<>
<Header
currentWorkspaceId={currentWorkspace.id}
currentEntry={{
subPath: WorkspaceSubPath.TRASH,
}}
/>
<BlockSuitePageList
blockSuiteWorkspace={blockSuiteWorkspace}
onOpenPage={onClickPage}
listType="trash"
/>
</>
);
};
export const Component = () => {
return <TrashPage />;
};

View File

@@ -1,18 +0,0 @@
import { filterByFilterList } from '@affine/component/page-list';
import type { Collection } from '@affine/env/filter';
import type { PageMeta } from '@blocksuite/store';
export const filterPage = (collection: Collection, page: PageMeta) => {
if (collection.excludeList?.includes(page.id)) {
return false;
}
if (collection.allowList?.includes(page.id)) {
return true;
}
return filterByFilterList(collection.filterList, {
'Is Favourited': !!page.favorite,
Created: page.createDate,
Updated: page.updatedDate ?? page.createDate,
Tags: page.tags,
});
};

View File

@@ -1,207 +0,0 @@
import type { CollectionsAtom } from '@affine/component/page-list';
import type { Collection } from '@affine/env/filter';
import { DisposableGroup } from '@blocksuite/global/utils';
import { currentWorkspaceAtom } from '@toeverything/infra/atom';
import { type DBSchema, openDB } from 'idb';
import { atom } from 'jotai';
import { atomWithObservable } from 'jotai/utils';
import { Observable } from 'rxjs';
import type { Map as YMap } from 'yjs';
import { Doc as YDoc } from 'yjs';
import { sessionAtom } from '../atoms/cloud-user';
export interface PageCollectionDBV1 extends DBSchema {
view: {
key: Collection['id'];
value: Collection;
};
}
export interface StorageCRUD<Value> {
get: (key: string) => Promise<Value | null>;
set: (key: string, value: Value) => Promise<string>;
delete: (key: string) => Promise<void>;
list: () => Promise<string[]>;
}
type Subscribe = () => void;
const collectionDBAtom = atom(
openDB<PageCollectionDBV1>('page-view', 1, {
upgrade(database) {
database.createObjectStore('view', {
keyPath: 'id',
});
},
})
);
const callbackSet = new Set<Subscribe>();
const localCollectionCRUDAtom = atom(get => ({
get: async (key: string) => {
const db = await get(collectionDBAtom);
const t = db.transaction('view').objectStore('view');
return (await t.get(key)) ?? null;
},
set: async (key: string, value: Collection) => {
const db = await get(collectionDBAtom);
const t = db.transaction('view', 'readwrite').objectStore('view');
await t.put(value);
callbackSet.forEach(cb => cb());
return key;
},
delete: async (key: string) => {
const db = await get(collectionDBAtom);
const t = db.transaction('view', 'readwrite').objectStore('view');
callbackSet.forEach(cb => cb());
await t.delete(key);
},
list: async () => {
const db = await get(collectionDBAtom);
const t = db.transaction('view').objectStore('view');
return t.getAllKeys();
},
}));
const getCollections = async (
storage: StorageCRUD<Collection>
): Promise<Collection[]> => {
return storage
.list()
.then(async keys => {
return await Promise.all(keys.map(key => storage.get(key))).then(v =>
v.filter((v): v is Collection => v !== null)
);
})
.catch(error => {
console.error('Failed to load collections', error);
return [];
});
};
const pageCollectionBaseAtom = atomWithObservable<Collection[]>(get => {
const currentWorkspacePromise = get(currentWorkspaceAtom);
const session = get(sessionAtom);
const localCRUD = get(localCollectionCRUDAtom);
const userId = session?.data?.user.id ?? null;
const useLocalStorage = userId === null;
return new Observable<Collection[]>(subscriber => {
// initial value
subscriber.next([]);
if (useLocalStorage) {
const fn = () => {
getCollections(localCRUD).then(async collections => {
const workspaceId = (await currentWorkspacePromise).id;
subscriber.next(
collections.filter(c => c.workspaceId === workspaceId)
);
});
};
fn();
callbackSet.add(fn);
return () => {
callbackSet.delete(fn);
};
} else {
const group = new DisposableGroup();
currentWorkspacePromise.then(async currentWorkspace => {
const collectionsFromLocal = await getCollections(localCRUD);
const rootDoc = currentWorkspace.doc;
const settingMap = rootDoc.getMap('settings') as YMap<YDoc>;
if (!settingMap.has(userId)) {
settingMap.set(
userId,
new YDoc({
guid: `${rootDoc.guid}:settings:${userId}`,
})
);
}
const settingDoc = settingMap.get(userId) as YDoc;
if (!settingDoc.isLoaded) {
settingDoc.load();
await settingDoc.whenLoaded;
}
const viewMap = settingDoc.getMap('view') as YMap<Collection>;
// sync local storage to doc
collectionsFromLocal.map(v => viewMap.set(v.id, v));
// delete from indexeddb
Promise.all(
collectionsFromLocal.map(async v => {
await localCRUD.delete(v.id);
})
).catch(error => {
console.error('Failed to delete collections from indexeddb', error);
});
const collectionsFromDoc: Collection[] = Array.from(viewMap.keys())
.map(key => viewMap.get(key))
.filter((v): v is Collection => !!v);
const collections = [...collectionsFromDoc];
subscriber.next(collections);
if (group.disposed) {
return;
}
const fn = () => {
const collectionsFromDoc: Collection[] = Array.from(viewMap.keys())
.map(key => viewMap.get(key))
.filter((v): v is Collection => !!v);
const collections = [...collectionsFromLocal, ...collectionsFromDoc];
subscriber.next(collections);
};
viewMap.observe(fn);
group.add(() => {
viewMap.unobserve(fn);
});
});
return () => {
group.dispose();
};
}
});
});
export const currentCollectionsAtom: CollectionsAtom = atom(
get => get(pageCollectionBaseAtom),
async (get, _, apply) => {
const collections = await get(pageCollectionBaseAtom);
let newCollections: Collection[];
if (typeof apply === 'function') {
newCollections = apply(collections);
} else {
newCollections = apply;
}
const session = get(sessionAtom);
const userId = session?.data?.user.id ?? null;
const useLocalStorage = userId === null;
const added = newCollections.filter(v => !collections.includes(v));
const removed = collections.filter(v => !newCollections.includes(v));
if (useLocalStorage) {
const localCRUD = get(localCollectionCRUDAtom);
await Promise.all([
...added.map(async v => {
await localCRUD.set(v.id, v);
}),
...removed.map(async v => {
await localCRUD.delete(v.id);
}),
]);
} else {
const currentWorkspace = await get(currentWorkspaceAtom);
const rootDoc = currentWorkspace.doc;
const settingMap = rootDoc.getMap('settings') as YMap<YDoc>;
const settingDoc = settingMap.get(userId) as YDoc;
const viewMap = settingDoc.getMap('view') as YMap<Collection>;
await Promise.all([
...added.map(async v => {
viewMap.set(v.id, v);
}),
...removed.map(async v => {
viewMap.delete(v.id);
}),
]);
}
}
);

View File

@@ -1,35 +0,0 @@
{
"name": "@affine/docs",
"version": "0.9.0-canary.13",
"type": "module",
"private": true,
"scripts": {
"dev": "waku dev",
"build": "waku build",
"build:vercel": "waku build && cp -Lr ./dist/.vercel/output ./.vercel/"
},
"dependencies": {
"@affine/component": "workspace:*",
"@blocksuite/block-std": "0.0.0-20230921103931-38d8f07a-nightly",
"@blocksuite/blocks": "0.0.0-20230921103931-38d8f07a-nightly",
"@blocksuite/editor": "0.0.0-20230921103931-38d8f07a-nightly",
"@blocksuite/global": "0.0.0-20230921103931-38d8f07a-nightly",
"@blocksuite/lit": "0.0.0-20230921103931-38d8f07a-nightly",
"@blocksuite/store": "0.0.0-20230921103931-38d8f07a-nightly",
"express": "^4.18.2",
"jotai": "^2.4.1",
"react": "18.3.0-canary-7118f5dd7-20230705",
"react-dom": "18.3.0-canary-7118f5dd7-20230705",
"react-server-dom-webpack": "18.3.0-canary-7118f5dd7-20230705",
"waku": "0.14.0"
},
"devDependencies": {
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"@vanilla-extract/css": "^1.13.0",
"@vanilla-extract/vite-plugin": "^3.9.0",
"autoprefixer": "^10.4.15",
"tailwindcss": "^3.3.3",
"typescript": "^5.2.2"
}
}

View File

@@ -1,6 +0,0 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};

View File

@@ -1,44 +0,0 @@
/// <reference types="vite/client" />
'use server';
import { existsSync, readFileSync } from 'node:fs';
import { resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import type { ReactElement } from 'react';
import { lazy } from 'react';
import { Sidebar } from './components/sidebar/index.js';
import { saveFile } from './server-fns.js';
const Editor = lazy(() =>
import('./components/editor.js').then(({ Editor }) => ({ default: Editor }))
);
const __dirname = fileURLToPath(new URL('.', import.meta.url));
const AppCreator = (pathname: string) =>
function App(): ReactElement {
let path = resolve(__dirname, 'pages', 'binary');
if (!existsSync(path)) {
path = resolve(__dirname, '..', '..', 'src', 'pages', 'binary');
}
const buffer = [...readFileSync(path)];
return (
<div className="flex flex-col-reverse sm:flex-row h-screen">
<nav className="w-full sm:w-64">
<Sidebar />
</nav>
<main className="flex-1 p-6 w-full sm:w-[calc(100%-16rem)] overflow-scroll">
<Editor
workspaceId={pathname}
pageId="1"
onSave={saveFile}
binary={buffer}
/>
</main>
</div>
);
};
export default AppCreator;

View File

@@ -1,11 +0,0 @@
import { __unstableSchemas, AffineSchemas } from '@blocksuite/blocks/models';
import { atom } from 'jotai/vanilla';
export const workspaceAtom = atom(async () => {
const { Workspace } = await import('@blocksuite/store');
return new Workspace({
id: 'test-workspace',
})
.register(AffineSchemas)
.register(__unstableSchemas);
});

View File

@@ -1,53 +0,0 @@
'use client';
import '@blocksuite/editor/themes/affine.css';
import { BlockSuiteEditor } from '@affine/component/block-suite-editor';
import type { Page } from '@blocksuite/store';
import { useAtomValue } from 'jotai/react';
import type { ReactElement } from 'react';
import { use } from 'react';
import { applyUpdate } from 'yjs';
import { workspaceAtom } from '../atom.js';
export type EditorProps = {
workspaceId: string;
pageId: string;
binary?: number[];
onSave: (binary: any) => Promise<void>;
};
export const Editor = (props: EditorProps): ReactElement => {
const workspace = useAtomValue(workspaceAtom);
let page = workspace.getPage('page0') as Page;
if (!page) {
page = workspace.createPage({
id: 'page0',
});
}
if (props.binary && !page.root) {
use(
page.waitForLoaded().then(() => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
applyUpdate(page._ySpaceDoc, new Uint8Array(props.binary as number[]));
})
);
if (import.meta.env.MODE !== 'development') {
page.awarenessStore.setReadonly(page, true);
}
} else if (!page.root) {
use(
page.waitForLoaded().then(() => {
const pageBlockId = page.addBlock('affine:page', {
title: new page.Text(''),
});
page.addBlock('affine:surface', {}, pageBlockId);
const noteBlockId = page.addBlock('affine:note', {}, pageBlockId);
page.addBlock('affine:paragraph', {}, noteBlockId);
})
);
}
return <BlockSuiteEditor page={page} mode="page" onInit={() => {}} />;
};

View File

@@ -1,31 +0,0 @@
'use server';
import { lazy } from 'react';
import { saveFile } from '../../server-fns.js';
const SaveToLocal = lazy(() =>
import('./save-to-local.js').then(({ SaveToLocal }) => ({
default: SaveToLocal,
}))
);
export const Sidebar = () => {
return (
<div
className="h-screen text-black overflow-y-auto"
style={{
backgroundColor: '#f9f7f7',
}}
>
<a href="/">
<div className="flex items-center justify-center h-16 font-bold">
AFFiNE
</div>
</a>
{import.meta.env.MODE === 'development' && (
<SaveToLocal saveFile={saveFile} />
)}
</div>
);
};

View File

@@ -1,28 +0,0 @@
'use client';
import { assertExists } from '@blocksuite/global/utils';
import { useAtomValue } from 'jotai/react';
import { useCallback } from 'react';
import { encodeStateAsUpdate } from 'yjs';
import { workspaceAtom } from '../../atom.js';
type SaveToLocalProps = {
saveFile: (update: number[]) => void;
};
export const SaveToLocal = (props: SaveToLocalProps) => {
const workspace = useAtomValue(workspaceAtom);
const saveFile = props.saveFile;
const onSave = useCallback(() => {
const page = workspace.getPage('page0');
assertExists(page);
saveFile([...encodeStateAsUpdate(page.spaceDoc)]);
}, [saveFile, workspace]);
return (
<div>
<div className="flex items-center justify-center h-16 font-bold">
<button onClick={onSave}>Save to Local</button>
</div>
</div>
);
};

View File

@@ -1,17 +0,0 @@
import { defineRouter } from 'waku/router/server';
export default defineRouter(
async id => {
switch (id) {
case 'index': {
const { default: AppCreator } = await import('./app.js');
return AppCreator(id);
}
default:
return null;
}
},
async () => {
return ['index'];
}
);

View File

@@ -1,3 +0,0 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

View File

@@ -1,36 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>AFFiNE Developer Documentation</title>
<style>
@keyframes spinner {
to {
transform: rotate(360deg);
}
}
.spinner {
width: 36px;
height: 36px;
margin: auto;
border: 2px solid #ddd;
border-top-color: #222;
border-radius: 50%;
animation: spinner 1s linear infinite;
}
#root > .spinner {
margin-top: calc(50% - 18px);
}
</style>
</head>
<body>
<!--placeholder1-->
<div id="root">
<div class="spinner"></div>
</div>
<!--/placeholder1-->
<script src="./index.tsx" defer type="module"></script>
<!--placeholder2-->
<!--/placeholder2-->
</body>
</html>

View File

@@ -1,14 +0,0 @@
import '@blocksuite/editor/themes/affine.css';
import './index.css';
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import { Router } from 'waku/router/client';
const root = createRoot(document.getElementById('root') as HTMLElement);
root.render(
<StrictMode>
<Router />
</StrictMode>
);

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More