chore: Release v0.1.2-beta.0 (#1279)
This commit is contained in:
@@ -4,7 +4,7 @@ Thank you for contributing!
|
||||
|
||||
Before submitting the PR, please make sure you do the following:
|
||||
|
||||
- Read the [Contributing Guide](https://github.com/antfu/contribute).
|
||||
- Read the [Contributing Guide](/contribute).
|
||||
- Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
|
||||
- Provide a description in this PR that addresses **what** the PR is solving, or reference the issue that it solves (e.g. `fixes #123`).
|
||||
- Ideally, include relevant tests that fail without this PR but pass with it.
|
||||
@@ -15,8 +15,23 @@ Before submitting the PR, please make sure you do the following:
|
||||
|
||||
<!-- Please insert your description here and provide especially info about the "what" this PR is solving -->
|
||||
|
||||
### PR Type
|
||||
|
||||
<!-- Please check the type of PR: -->
|
||||
|
||||
- [ ] Feature
|
||||
- [ ] Bugfix
|
||||
- [ ] Hotfix
|
||||
- [ ] Other (please describe):
|
||||
|
||||
### Linked Issues
|
||||
|
||||
### Additional context
|
||||
|
||||
<!-- e.g. is there anything you'd like reviewers to focus on? -->
|
||||
|
||||
### Changelog
|
||||
|
||||
<!-- Please ensure the changelog/next.md is updated if this is a feature or hotfix: -->
|
||||
|
||||
- [ ] I have updated the changelog/next.md with my changes.
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches: [main, dev]
|
||||
|
||||
name: CI Build web and SSR server
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-ssr
|
||||
cancel-in-progress: true
|
||||
jobs:
|
||||
build:
|
||||
name: Build web and SSR server
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [lts/*]
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
lfs: true
|
||||
- name: Cache turbo build setup
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: .turbo
|
||||
key: ${{ runner.os }}-turbo-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-turbo-
|
||||
|
||||
- name: Checkout LFS objects
|
||||
run: git lfs checkout
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: "pnpm"
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
- name: Build web and SSR server
|
||||
run: |
|
||||
npm exec turbo run //#build:web @follow/server#build
|
||||
@@ -13,7 +13,7 @@ on:
|
||||
required: true
|
||||
# https://docs.github.com/en/enterprise-cloud@latest/actions/writing-workflows/choosing-what-your-workflow-does/control-the-concurrency-of-workflows-and-jobs
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-build
|
||||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
||||
env:
|
||||
VITE_WEB_URL: ${{ vars.VITE_WEB_URL }}
|
||||
@@ -106,7 +106,7 @@ jobs:
|
||||
|
||||
- name: Build
|
||||
if: matrix.os != 'macos-latest'
|
||||
run: pnpm build
|
||||
run: npm exec turbo run //#build
|
||||
env:
|
||||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
||||
|
||||
@@ -117,7 +117,7 @@ jobs:
|
||||
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
|
||||
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
||||
KEYCHAIN_PATH: ${{ runner.temp }}/app-signing.keychain-db
|
||||
run: pnpm build:macos
|
||||
run: npm exec turbo run //#build:macos
|
||||
|
||||
- name: Upload file
|
||||
uses: actions/upload-artifact@v4
|
||||
|
||||
@@ -5,7 +5,7 @@ on:
|
||||
|
||||
name: CI Format, Typecheck and Lint
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-lint
|
||||
cancel-in-progress: true
|
||||
jobs:
|
||||
build:
|
||||
@@ -19,8 +19,15 @@ jobs:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
lfs: true
|
||||
- name: Cache turbo build setup
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: .turbo
|
||||
key: ${{ runner.os }}-turbo-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-turbo-
|
||||
|
||||
- name: Checkout LFS objects
|
||||
run: git lfs checkout
|
||||
|
||||
@@ -35,8 +42,6 @@ jobs:
|
||||
run: pnpm install
|
||||
- name: Format, Lint and Typecheck
|
||||
run: |
|
||||
pnpm run format:check
|
||||
pnpm run typecheck
|
||||
pnpm run lint
|
||||
npm exec turbo run format:check typecheck lint
|
||||
- name: Run test
|
||||
run: pnpm test
|
||||
run: npm exec turbo run test
|
||||
|
||||
@@ -19,3 +19,4 @@ vite.config.*.mjs
|
||||
# apps/server/**/index.template.ts
|
||||
|
||||
.generated
|
||||
.turbo
|
||||
|
||||
+108
-2
@@ -1,6 +1,109 @@
|
||||
# CHANGELOG
|
||||
|
||||
## [0.1.1-beta.0](https://github.com/RSSNext/follow/compare/v0.0.1-alpha.21...v0.1.1-beta.0) (2024-10-25)
|
||||
## [0.1.2-beta.0](https://github.com/RSSNext/follow/compare/v0.1.1-beta.1...v0.1.2-beta.0) (2024-11-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add missing event bus ([33b3ac4](https://github.com/RSSNext/follow/commit/33b3ac4c53faa617080cbcf3039cbee7fdeb1931))
|
||||
* add rsshub discover error boundary ([665c009](https://github.com/RSSNext/follow/commit/665c009bf8aec87ead601428410f56ba6756a8db))
|
||||
* add turbo build in ci ([7b848cd](https://github.com/RSSNext/follow/commit/7b848cd08aa4f97b1df35666166561d6fc30c5c9))
|
||||
* assets rewrite ([#1204](https://github.com/RSSNext/follow/issues/1204)) ([488e8ef](https://github.com/RSSNext/follow/commit/488e8effc6f00769df7dbf68d4e6d1e4e950b8e7))
|
||||
* auto load achieved entries when show achieved button is available ([074a60d](https://github.com/RSSNext/follow/commit/074a60d3cf93bcede88ea4d70b07cf7480be4229))
|
||||
* **boost:** card text align center ([632d5d4](https://github.com/RSSNext/follow/commit/632d5d42d67999523e602fb18f59ca72543b7d7a))
|
||||
* build pre script ([8bd2de8](https://github.com/RSSNext/follow/commit/8bd2de84b898ffc1a4863d29d7056a0b9e7a9e2f))
|
||||
* **ci:** concurrency group ([fb0152e](https://github.com/RSSNext/follow/commit/fb0152eaec76b28ed9fc26381917ca7ec2aecb0b))
|
||||
* **ci:** turbo not found ([c812bd7](https://github.com/RSSNext/follow/commit/c812bd71aabc63b5c9ebbe032f25aba5ac51bd64))
|
||||
* **ci:** windows build ([9f72c26](https://github.com/RSSNext/follow/commit/9f72c263a6945fe90899f85f732c0866c7f61b25))
|
||||
* css editor lazy and input composition handler ([5c6004a](https://github.com/RSSNext/follow/commit/5c6004a0905c6207c6119de0d37e9a5baf744dab))
|
||||
* detecting windows11 ([#1170](https://github.com/RSSNext/follow/issues/1170)) ([2813f1d](https://github.com/RSSNext/follow/commit/2813f1d6540fcb215287dd32cbc0f8cf87cb1cb0))
|
||||
* disable `pointerDownOutside` trigger `onDismiss` ([#1215](https://github.com/RSSNext/follow/issues/1215)) ([2bf5245](https://github.com/RSSNext/follow/commit/2bf5245126bc9ef890c06afe5a825d1e1ab4059c))
|
||||
* disable auto load archive for inbox and list ([7825e16](https://github.com/RSSNext/follow/commit/7825e16b6d1230ba2c13e5ef00474fc05cc510e5))
|
||||
* **discover:** card text truncate ([557e912](https://github.com/RSSNext/follow/commit/557e91228af27251663904dfd3211c535b5b5415))
|
||||
* entry thumbnail keep origin aspect ratio ([6e04e6e](https://github.com/RSSNext/follow/commit/6e04e6eacd6346bd2869c683ec417932a0d13807))
|
||||
* **entry-column:** pre-render cached entries ([5065c8e](https://github.com/RSSNext/follow/commit/5065c8e52dcba1a8d8f16ce3729b7c2eb7f5a192))
|
||||
* escape for seo meta tags ([9564257](https://github.com/RSSNext/follow/commit/9564257564e417e18bdeedded9397d469e6daf14)), closes [#1232](https://github.com/RSSNext/follow/issues/1232)
|
||||
* **external:** add global 404 page ([5e49b81](https://github.com/RSSNext/follow/commit/5e49b8114e0446b734a54eea3291721d8f9656b3))
|
||||
* **external:** header logo href ([b867af9](https://github.com/RSSNext/follow/commit/b867af9b45de0124e04ee95ec4771b9f35903951))
|
||||
* **external:** remove duplicate border bottom ([32f68ee](https://github.com/RSSNext/follow/commit/32f68ee1987182271295292bff92f482c151b78b))
|
||||
* **external:** set auth config first ([ef46c70](https://github.com/RSSNext/follow/commit/ef46c70a9849c315cc8d827f4ad8a3c004003bac))
|
||||
* **external:** should hard go back to app home ([6786e20](https://github.com/RSSNext/follow/commit/6786e203031f18be0ca386dcaf1dddf4d05ae95b))
|
||||
* group date item z index ([8c5c62e](https://github.com/RSSNext/follow/commit/8c5c62e0d698f3a0d72a2ef0595e44986c95320b))
|
||||
* **i18n:** remove `external` ns in renderer ([229b3e1](https://github.com/RSSNext/follow/commit/229b3e18f50c81c916f877a2a65325e3dcaa783a))
|
||||
* initializeDayjs in server ([d408581](https://github.com/RSSNext/follow/commit/d408581a13ad78d5a871d98f3ff0ff9bb5e45ae5)), closes [#1198](https://github.com/RSSNext/follow/issues/1198)
|
||||
* missing site url in feed selector ([ea677ac](https://github.com/RSSNext/follow/commit/ea677ac6a3a43489a9508a32ecb22fa38ecf4f27))
|
||||
* modal bottom buttons align ([#1216](https://github.com/RSSNext/follow/issues/1216)) ([b97096d](https://github.com/RSSNext/follow/commit/b97096dbd06bb7687b6c1313de45d8e91dee25af))
|
||||
* modal close button overlaps the select content ([#1166](https://github.com/RSSNext/follow/issues/1166)) ([3c103ed](https://github.com/RSSNext/follow/commit/3c103ed15daeb1f57a001d615c047c303087ba46))
|
||||
* **modal:** drawer modal layout symmetric padding ([7141e86](https://github.com/RSSNext/follow/commit/7141e869dfc9328e3eeeda909ea2ffc7e6dd0e34))
|
||||
* **modal:** fixed close modal button position ([78e9424](https://github.com/RSSNext/follow/commit/78e942473fff309e372708b56a59a9009d5bb0e9))
|
||||
* **modal:** modal dismiss action ([b05ff50](https://github.com/RSSNext/follow/commit/b05ff50f14660f20ed881f6aeabb732d80c9539c))
|
||||
* **modal:** repeat user profile dialog ([#1155](https://github.com/RSSNext/follow/issues/1155)) ([ad86372](https://github.com/RSSNext/follow/commit/ad86372bfb345b6f921da783c401be30cdbe4b89))
|
||||
* optimize some styles ([9b99bf4](https://github.com/RSSNext/follow/commit/9b99bf4428cf6f1ca3218a3074a944af4d014f57))
|
||||
* optimize the animation of the Follow button on the User Profile Modal ([#1156](https://github.com/RSSNext/follow/issues/1156)) ([87717d6](https://github.com/RSSNext/follow/commit/87717d642607cca4254f11d673a8a910fc6ab076))
|
||||
* pnpm lockfile ([fdc547a](https://github.com/RSSNext/follow/commit/fdc547a5aaeb11aa13d6321ea60f1d3a4e01a8b4))
|
||||
* power icon align ([11059f6](https://github.com/RSSNext/follow/commit/11059f639ee955a0f10cbd97cb6eed85e335fed7))
|
||||
* preferred title not working in entry column ([#1268](https://github.com/RSSNext/follow/issues/1268)) ([4bdf28e](https://github.com/RSSNext/follow/commit/4bdf28ea766242c74af051e36a9ef205f02eb874))
|
||||
* prevent default for cmd+k ([81d49f0](https://github.com/RSSNext/follow/commit/81d49f0893100de85a22d114765f76e7c9dea36c))
|
||||
* refetch wallet data on mount ([2d11eb2](https://github.com/RSSNext/follow/commit/2d11eb2d92fb57222b14df987b57a75eb9262fc5))
|
||||
* relogin ([80515f6](https://github.com/RSSNext/follow/commit/80515f67652a77fbdbe20a2a3298fd916515a8d7))
|
||||
* remove `useSingleton` ([d1d3fcf](https://github.com/RSSNext/follow/commit/d1d3fcf493bf26ce58cd33fedd7320cfcfe8ef5f))
|
||||
* remove cache-control header ([#1202](https://github.com/RSSNext/follow/issues/1202)) ([c683bda](https://github.com/RSSNext/follow/commit/c683bdaef63716659ca78875022ff38350e50b82))
|
||||
* remove gcore icon ([#1220](https://github.com/RSSNext/follow/issues/1220)) ([486fa20](https://github.com/RSSNext/follow/commit/486fa202ee9488981a733f235f95c90a073e7166))
|
||||
* scroll bar z index ([5057999](https://github.com/RSSNext/follow/commit/50579995367b871e84768c5983b3302f75f8e077)), closes [#1233](https://github.com/RSSNext/follow/issues/1233)
|
||||
* **server:** serialize data ([2410b84](https://github.com/RSSNext/follow/commit/2410b843af3d16f77e88482d9c73f25c1dd3431a))
|
||||
* **server:** use `xss` to serialize data ([93f58ec](https://github.com/RSSNext/follow/commit/93f58ecfd8fadfa67f56ebfe629e73f44bb94a49))
|
||||
* set referer ([29557f3](https://github.com/RSSNext/follow/commit/29557f370f37f7f5c7d1f7ccd7157a4449f7e5ca))
|
||||
* set windows env ([1ea103b](https://github.com/RSSNext/follow/commit/1ea103b7ee1689ba9683c341a2afacacf2884fbd))
|
||||
* **share:** og image grid width and image align top to description ([14e37da](https://github.com/RSSNext/follow/commit/14e37da0cebbdb1b283c562c21acc2f8ba385bf9))
|
||||
* **shortcut:** add cmd+k to guide ([e9ab9b6](https://github.com/RSSNext/follow/commit/e9ab9b6f379abe426ac751961e3767c8aa20b663))
|
||||
* shouldLoadArchivedEntries condition ([94b097f](https://github.com/RSSNext/follow/commit/94b097fd25533b5d1437bf1054dbe44af7828099))
|
||||
* show scrollbar when list table overflows in settings menu ([#1266](https://github.com/RSSNext/follow/issues/1266)) ([47b200f](https://github.com/RSSNext/follow/commit/47b200f7f3340b5b262674c71e876328ec758192))
|
||||
* **store:** singleton store guard ([5a8725b](https://github.com/RSSNext/follow/commit/5a8725b50767bb6faddca6e0af6cef2cfb28da29))
|
||||
* theme cannot be switched ([#1157](https://github.com/RSSNext/follow/issues/1157)) ([d5be028](https://github.com/RSSNext/follow/commit/d5be0287ad03e47635be057222ca7155a033ae80))
|
||||
* **toc:** fix text truncate in title line ([f9b1a61](https://github.com/RSSNext/follow/commit/f9b1a61c0185b449184b34df5f3a3869a4e722a4))
|
||||
* **toc:** should focus when toc item clicked ([f51dfdd](https://github.com/RSSNext/follow/commit/f51dfddc9ef40f4a7f226f32f9357e03a04f6ee0))
|
||||
* translate form style ([6f3bb61](https://github.com/RSSNext/follow/commit/6f3bb61023dde1d58164425d8649c90bb4f680c6)), closes [#1184](https://github.com/RSSNext/follow/issues/1184)
|
||||
* try fix dayjs init ([093f80d](https://github.com/RSSNext/follow/commit/093f80d9da223c567125285cc0f312f419bb4042))
|
||||
* ts import ([14311dd](https://github.com/RSSNext/follow/commit/14311dde0a9cb14e797e1a0f654a11f8502e58f8))
|
||||
* turbo build cmd ([0b9c279](https://github.com/RSSNext/follow/commit/0b9c279fccd25231b90810359125571f817b7f7c))
|
||||
* **ui:** use safe inset top to fix windows overlays, fixed [#1184](https://github.com/RSSNext/follow/issues/1184) ([dc85570](https://github.com/RSSNext/follow/commit/dc855703289ac98db76f4a57760fcd66047b8dd1))
|
||||
* **ui:** user profile follow button style ([d629215](https://github.com/RSSNext/follow/commit/d629215305a0ec9323dea0db929582e9609a82f6))
|
||||
* vercel rewrite config ([#1203](https://github.com/RSSNext/follow/issues/1203)) ([c954d61](https://github.com/RSSNext/follow/commit/c954d61f074e282a9a86cbf1d1546748871c20e7))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add app skeleton to avoid blank page when js loaded ([e2ed162](https://github.com/RSSNext/follow/commit/e2ed162b67d53452af01fe3a7aad3d70c995ff8d))
|
||||
* add appearance to set thumbnail ratio ([1d3f6bc](https://github.com/RSSNext/follow/commit/1d3f6bc910e3878debca3a7576f3891e6947b443))
|
||||
* add follow user button in profile modal ([#1147](https://github.com/RSSNext/follow/issues/1147)) ([7c60d5e](https://github.com/RSSNext/follow/commit/7c60d5e91dd4a21872217427bd99fe8eae688ce1))
|
||||
* add random color for user fallback bg ([dcbae89](https://github.com/RSSNext/follow/commit/dcbae89020e88947be693c100c644ee603519e96))
|
||||
* add updatelog modal ([84228bc](https://github.com/RSSNext/follow/commit/84228bc5c8755c4b957bc901e6e552ef176ed00c))
|
||||
* adjust more ui ([08929ab](https://github.com/RSSNext/follow/commit/08929ab3ae15758850d04b82f7773358579c4a78))
|
||||
* **discover:** improve trending style and discover no image placeholer ([86be1a2](https://github.com/RSSNext/follow/commit/86be1a2e46d3298157cece0731e687a462f833d5))
|
||||
* **external:** move `login` and `redirect` route to external ([7916803](https://github.com/RSSNext/follow/commit/791680332d5e1c2c52eda792dd7ff69281f25adb))
|
||||
* **external:** new open by deeplink logic ([71fcf50](https://github.com/RSSNext/follow/commit/71fcf50d0fd3ac30f8e9c45db90314672904a615))
|
||||
* focusable ([eb01d03](https://github.com/RSSNext/follow/commit/eb01d030129f6196d6e9855be42a218be9d5668b))
|
||||
* **icon:** use gradient fallback background ([e827002](https://github.com/RSSNext/follow/commit/e8270025e469d9a0463d267d3da591a2991951bd))
|
||||
* List delete add secondary confirmation ([#1254](https://github.com/RSSNext/follow/issues/1254)) ([14f2bac](https://github.com/RSSNext/follow/commit/14f2bac8f3ba7e8f2dbd3958a4394c5b11ea2537))
|
||||
* load archived entries automatically ([5fe9e0c](https://github.com/RSSNext/follow/commit/5fe9e0c0e24460ca0fe435db03b753e9dcd3df17))
|
||||
* move hideExtraBadge ([2f14c30](https://github.com/RSSNext/follow/commit/2f14c30307a895bc866ac57989df1dc624eab4e6))
|
||||
* **obsidian:** use readability content when available ([b4a3197](https://github.com/RSSNext/follow/commit/b4a3197e6ebd39bb259a6bc67f408569354a205e))
|
||||
* prefer origin addresses for content images ([d4d4345](https://github.com/RSSNext/follow/commit/d4d43451dec839b64239e1835b2ac1a1aa2478be))
|
||||
* **reader:** support custom css, fixed [#256](https://github.com/RSSNext/follow/issues/256) ([b251fa9](https://github.com/RSSNext/follow/commit/b251fa9421417c75d71707c8f08850f2cc902e1a))
|
||||
* support zen mode sidebar entry timeline selector ([4ab132c](https://github.com/RSSNext/follow/commit/4ab132c593a7acce0167d02f6025030775a9fac5))
|
||||
* unified feed title ([b86afe5](https://github.com/RSSNext/follow/commit/b86afe5a9789ad13c5a026adf553d2c6bc333bff))
|
||||
* use FeedTitle ([73d2c30](https://github.com/RSSNext/follow/commit/73d2c30416ad3f2da626db003996c0fb036025ac))
|
||||
* **ux:** support native space key to page down, fixed [#1121](https://github.com/RSSNext/follow/issues/1121) ([baa66fe](https://github.com/RSSNext/follow/commit/baa66feaf19416d2b9e5efe6b79f6af1b3966404))
|
||||
* zen mode and hide extra badge ([7ba07ad](https://github.com/RSSNext/follow/commit/7ba07adff1e7cd3292cc308f3e70803fe11fb8ce))
|
||||
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* resolve feed item select area performance problem ([f87c0ff](https://github.com/RSSNext/follow/commit/f87c0ff2abfc430719894765796ca457c3f8e7f0))
|
||||
|
||||
|
||||
|
||||
## [0.1.1-beta.1](https://github.com/RSSNext/follow/compare/v0.1.1-beta.0...v0.1.1-beta.1) (2024-10-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
@@ -67,6 +170,7 @@
|
||||
* app got deleted when auto update on windows ([965544b](https://github.com/RSSNext/follow/commit/965544beef41f9c6549c64cd4f53e1a3935259ad))
|
||||
* app icon incorrect in Windows Control Panel ([#899](https://github.com/RSSNext/follow/issues/899)) ([719f1da](https://github.com/RSSNext/follow/commit/719f1dae0e9762218b9e3c24b0aec2ced7f382be))
|
||||
* app width limit to 1024px ([09d7765](https://github.com/RSSNext/follow/commit/09d77657a07f81d69f80c3eea1620efe1ddb9da9))
|
||||
* **app:** throw error popup when close window ([#1144](https://github.com/RSSNext/follow/issues/1144)) ([2ade4ae](https://github.com/RSSNext/follow/commit/2ade4aed28db8c936a51f20a4cf9437f536f1815))
|
||||
* audio player async logic and auto pause logic ([ba40b44](https://github.com/RSSNext/follow/commit/ba40b44ce91bb8acd118b9c6d846ed8d5b9b022c))
|
||||
* audioCover animation and estimatedMins style ([#523](https://github.com/RSSNext/follow/issues/523)) ([11ff31b](https://github.com/RSSNext/follow/commit/11ff31bd40af1884a1760d0d1ca5b9a726f13620))
|
||||
* auto completion can not open when focus in modal ([591f13b](https://github.com/RSSNext/follow/commit/591f13b17f8a22c0c39718d67a88b2024c57efb7))
|
||||
@@ -104,6 +208,7 @@
|
||||
* ci and tootip portal ([3729917](https://github.com/RSSNext/follow/commit/37299173c8fcaf88d44b1a54baf7ddc03aa20ca6))
|
||||
* ci env `NODE_OPTIONS` max-old-space-size ([b4f9b1b](https://github.com/RSSNext/follow/commit/b4f9b1b8ea326b1613ca291ed5bbcd932c5e837a))
|
||||
* **ci:** cannot release macOS APP ([#957](https://github.com/RSSNext/follow/issues/957)) ([4a14738](https://github.com/RSSNext/follow/commit/4a14738a99c7fd26dbf22c8de968a6896cbdc28b)), closes [/github.com/actions/runner/issues/2958#issuecomment-2186602747](https://github.com//github.com/actions/runner/issues/2958/issues/issuecomment-2186602747)
|
||||
* **ci:** cannot release macOS APP ([#957](https://github.com/RSSNext/follow/issues/957)) ([#1078](https://github.com/RSSNext/follow/issues/1078)) ([cd00a20](https://github.com/RSSNext/follow/commit/cd00a2064228890f4891f5b15825d1f5a0d681e9)), closes [/github.com/actions/runner/issues/2958#issuecomment-2186602747](https://github.com//github.com/actions/runner/issues/2958/issues/issuecomment-2186602747)
|
||||
* **ci:** fetch all depth ([a504a12](https://github.com/RSSNext/follow/commit/a504a127bca93a6675b3ff02bcea0b1eca6e9707))
|
||||
* **ci:** nightly build ([a4ce7b1](https://github.com/RSSNext/follow/commit/a4ce7b16f476b8d72a0b1761709ec1ceba591242))
|
||||
* **ci:** nightly linux build ([702b1d9](https://github.com/RSSNext/follow/commit/702b1d976d52c49647d0433f2dd162c034d0abb4))
|
||||
@@ -583,8 +688,8 @@
|
||||
* type error ([c7f11f9](https://github.com/RSSNext/follow/commit/c7f11f99f28bf918aaf8c03b74145b2f9b126a72))
|
||||
* type error ([5cd41ad](https://github.com/RSSNext/follow/commit/5cd41ad10ccbd241083d6f951509eb0bafe6e25f))
|
||||
* type error ([60f8347](https://github.com/RSSNext/follow/commit/60f8347eec118176681a9ad7fcab7f45e383fc1b))
|
||||
* types ([5e2856f](https://github.com/RSSNext/follow/commit/5e2856f579d7b9ed10b37f00dec89fb627d44f95))
|
||||
* types ([ad9a606](https://github.com/RSSNext/follow/commit/ad9a606b6bde6fb1771546e46bddccf0f14a6e7f))
|
||||
* types ([5e2856f](https://github.com/RSSNext/follow/commit/5e2856f579d7b9ed10b37f00dec89fb627d44f95))
|
||||
* types ([f0767e2](https://github.com/RSSNext/follow/commit/f0767e2ad93d29db9a82b283f1163e340167be68))
|
||||
* types ([831f0f8](https://github.com/RSSNext/follow/commit/831f0f892ac32bdb2963267e94c3130805924b59))
|
||||
* types ([a116dd4](https://github.com/RSSNext/follow/commit/a116dd4018f90886239f7583cbc82b511ff2a902))
|
||||
@@ -1009,6 +1114,7 @@
|
||||
* prefetch for entry list ([5c7a27d](https://github.com/RSSNext/follow/commit/5c7a27de7dedfaf1812f26823207331543dfcead))
|
||||
* reduce re-render when ctx menu open ([96ff9f6](https://github.com/RSSNext/follow/commit/96ff9f660c0a469daafbb5f5cad47370bcd3a8f0))
|
||||
* reduce vite alias length ([8bc4771](https://github.com/RSSNext/follow/commit/8bc477100b8e5d3532d09875eda32004762eacca))
|
||||
* resolve feed item select area performance problem ([#1176](https://github.com/RSSNext/follow/issues/1176)) ([e1816e1](https://github.com/RSSNext/follow/commit/e1816e1a12d8b4a8a2c46d2b758a3ce07ee90f0d))
|
||||
* shadow dom css cache ([c1e3a02](https://github.com/RSSNext/follow/commit/c1e3a025f7ef8ff570399a44a95797c2c8261e42))
|
||||
* speed up user profile modal data loading ([53a5bae](https://github.com/RSSNext/follow/commit/53a5bae316b406ff5c250c3e7772ce4071891bee))
|
||||
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
||||
level of experience, education, socio-economic status, nationality, personal
|
||||
appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
- Using welcoming and inclusive language
|
||||
- Being respectful of differing viewpoints and experiences
|
||||
- Gracefully accepting constructive criticism
|
||||
- Focusing on what is best for the community
|
||||
- Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
- The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
- Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
- Public or private harassment
|
||||
- Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
- Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community. Examples of
|
||||
representing a project or community include using an official project e-mail
|
||||
address, posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event. Representation of a project may be
|
||||
further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at follow@rss3.io. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see
|
||||
https://www.contributor-covenant.org/faq
|
||||
@@ -0,0 +1,71 @@
|
||||
# Contributing to Follow
|
||||
|
||||
Thank you for considering contributing to Follow! We welcome contributions from the community to help improve and expand the project.
|
||||
|
||||
## Getting Started
|
||||
|
||||
Before you start contributing, please ensure you have enabled [Corepack](https://nodejs.org/api/corepack.html). Corepack ensures you are using the correct version of the package manager specified in the `package.json`.
|
||||
|
||||
```sh
|
||||
corepack enable
|
||||
```
|
||||
|
||||
### Installing Dependencies
|
||||
|
||||
To install the necessary dependencies, run:
|
||||
|
||||
```sh
|
||||
pnpm install
|
||||
```
|
||||
|
||||
## Development Setup
|
||||
|
||||
### Develop in the Browser
|
||||
|
||||
For a more convenient development experience, we recommend developing in the browser:
|
||||
|
||||
```sh
|
||||
pnpm run dev:web
|
||||
```
|
||||
|
||||
This will open the browser at `https://app.follow.is/__debug_proxy`, allowing you to access the online API environment for development and debugging.
|
||||
|
||||
### Develop in Electron
|
||||
|
||||
If you prefer to develop in Electron, follow these steps:
|
||||
|
||||
1. Copy the example environment variables file:
|
||||
|
||||
```sh
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
2. Set `VITE_API_URL` to `https://api.follow.is` in your `.env` file.
|
||||
|
||||
3. Run the development server:
|
||||
|
||||
```sh
|
||||
pnpm run dev
|
||||
```
|
||||
|
||||
> **Tip:** If you encounter login issues, copy the `authjs.session-token` from your browser's cookies into the app.
|
||||
|
||||
## Contribution Guidelines
|
||||
|
||||
- Ensure your code follows the project's coding standards and conventions.
|
||||
- Write clear, concise commit messages.
|
||||
- Include relevant tests for your changes.
|
||||
- Update documentation as necessary.
|
||||
|
||||
## Community
|
||||
|
||||
Join our community to discuss ideas, ask questions, and share your contributions:
|
||||
|
||||
- [Discord](https://discord.gg/followapp)
|
||||
- [Twitter](https://x.com/intent/follow?screen_name=follow_app_)
|
||||
|
||||
We look forward to your contributions!
|
||||
|
||||
## License
|
||||
|
||||
By contributing to Follow, you agree that your contributions will be licensed under the GNU General Public License version 3, with the special exceptions noted in the `README.md`.
|
||||
@@ -91,7 +91,7 @@ If you have access, you are welcome to use the following methods to download and
|
||||
- You can get the installation packages for each platform from the [Releases page](https://github.com/RSSNext/Follow/releases).
|
||||
- If you are using Arch Linux, you can install package [follow-appimage](https://aur.archlinux.org/packages/follow-appimage) that maintained by [timochan](https://github.com/ttimochan).
|
||||
- If you are using Nix, you can install package [follow](https://github.com/NixOS/nixpkgs/blob/master/pkgs/by-name/fo/follow/package.nix) that maintained by [iosmanthus](https://github.com/iosmanthus).
|
||||
- If you are using macOS with [Homebrew](https://brew.sh), you can install package [follow](https://formulae.brew.sh/cask/follow) or [follow@nightly](https://formulae.brew.sh/cask/follow@nightly) that maintained by [realSunyz](https://github.com/realSunyz).
|
||||
- If you are using macOS with [Homebrew](https://brew.sh), you can install cask [follow](https://formulae.brew.sh/cask/follow) (also [@alpha](https://formulae.brew.sh/cask/follow@alpha) and [@nightly](https://formulae.brew.sh/cask/follow@nightly)) that maintained by [realSunyz](https://github.com/realSunyz).
|
||||
|
||||
## Contributing
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
We always recommend using the latest version of Follow to ensure you get all security updates.
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Please report security vulnerabilities to follow@rss3.io.
|
||||
@@ -19,7 +19,7 @@
|
||||
"scripts": {
|
||||
"build": "tsup",
|
||||
"test": "vitest",
|
||||
"typecheck": "tsup && tsc --noEmit"
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@egoist/tipc": "0.3.2",
|
||||
|
||||
@@ -9,7 +9,22 @@ export const isMacOS = platform === "darwin"
|
||||
export const isWindows = platform === "win32"
|
||||
|
||||
export const isLinux = platform === "linux"
|
||||
export const isWindows11 = isWindows && os.version().startsWith("Windows 11")
|
||||
|
||||
/**
|
||||
* @see https://learn.microsoft.com/en-us/windows/release-health/windows11-release-information
|
||||
* Windows 11 buildNumber starts from 22000.
|
||||
*/
|
||||
const detectingWindows11 = () => {
|
||||
if (!isWindows) return false
|
||||
|
||||
const release = os.release()
|
||||
const majorVersion = Number.parseInt(release.split(".")[0])
|
||||
const buildNumber = Number.parseInt(release.split(".")[2])
|
||||
|
||||
return majorVersion === 10 && buildNumber >= 22000
|
||||
}
|
||||
|
||||
export const isWindows11 = detectingWindows11()
|
||||
|
||||
// Custom APIs for renderer
|
||||
const api = {
|
||||
|
||||
+16
-1
@@ -11,4 +11,19 @@ export const isMacOS = platform === "darwin"
|
||||
export const isWindows = platform === "win32"
|
||||
|
||||
export const isLinux = platform === "linux"
|
||||
export const isWindows11 = isWindows && os.version().startsWith("Windows 11")
|
||||
|
||||
/**
|
||||
* @see https://learn.microsoft.com/en-us/windows/release-health/windows11-release-information
|
||||
* Windows 11 buildNumber starts from 22000.
|
||||
*/
|
||||
const detectingWindows11 = () => {
|
||||
if (!isWindows) return false
|
||||
|
||||
const release = os.release()
|
||||
const majorVersion = Number.parseInt(release.split(".")[0])
|
||||
const buildNumber = Number.parseInt(release.split(".")[2])
|
||||
|
||||
return majorVersion === 10 && buildNumber >= 22000
|
||||
}
|
||||
|
||||
export const isWindows11 = detectingWindows11()
|
||||
|
||||
+22
-4
@@ -2,6 +2,7 @@ import { electronApp, optimizer } from "@electron-toolkit/utils"
|
||||
import { callWindowExpose } from "@follow/shared/bridge"
|
||||
import { APP_PROTOCOL } from "@follow/shared/constants"
|
||||
import { env } from "@follow/shared/env"
|
||||
import { imageRefererMatches, selfRefererMatches } from "@follow/shared/image"
|
||||
import { app, BrowserWindow, session } from "electron"
|
||||
import squirrelStartup from "electron-squirrel-startup"
|
||||
|
||||
@@ -65,17 +66,25 @@ function bootstrap() {
|
||||
updateProxy()
|
||||
registerUpdater()
|
||||
|
||||
//remove Electron, Follow from user agent
|
||||
session.defaultSession.webRequest.onBeforeSendHeaders((details, callback) => {
|
||||
// remove Electron, Follow from user agent
|
||||
let userAgent = details.requestHeaders["User-Agent"]
|
||||
if (userAgent) {
|
||||
userAgent = userAgent.replace(/\s?Electron\/[\d.]+/, "")
|
||||
userAgent = userAgent.replace(/\s?Follow\/[\d.a-zA-Z-]+/, "")
|
||||
}
|
||||
if (env.VITE_OPENPANEL_API_URL && details.url.startsWith(env.VITE_OPENPANEL_API_URL)) {
|
||||
details.requestHeaders["Origin"] = "https://app.follow.is"
|
||||
}
|
||||
details.requestHeaders["User-Agent"] = userAgent
|
||||
|
||||
// set referer and origin
|
||||
if (selfRefererMatches.some((item) => details.url.startsWith(item))) {
|
||||
details.requestHeaders["Referer"] = "https://app.follow.is"
|
||||
details.requestHeaders["Origin"] = "https://app.follow.is"
|
||||
} else {
|
||||
const refererMatch = imageRefererMatches.find((item) => item.url.test(details.url))
|
||||
const referer = refererMatch?.referer || details.url
|
||||
details.requestHeaders["Referer"] = referer
|
||||
}
|
||||
|
||||
callback({ cancel: false, requestHeaders: details.requestHeaders })
|
||||
})
|
||||
|
||||
@@ -155,6 +164,15 @@ function bootstrap() {
|
||||
domain: new URL(apiURL).hostname,
|
||||
sameSite: "no_restriction",
|
||||
})
|
||||
mainWindow.webContents.session.cookies.set({
|
||||
url: apiURL,
|
||||
name: "authjs.callback-url",
|
||||
value: env.VITE_WEB_URL,
|
||||
secure: true,
|
||||
httpOnly: true,
|
||||
domain: new URL(apiURL).hostname,
|
||||
sameSite: "no_restriction",
|
||||
})
|
||||
userId && (await callWindowExpose(mainWindow).clearIfLoginOtherAccount(userId))
|
||||
mainWindow.reload()
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ import { fileURLToPath } from "node:url"
|
||||
|
||||
import { is } from "@electron-toolkit/utils"
|
||||
import { callWindowExpose } from "@follow/shared/bridge"
|
||||
import { IMAGE_PROXY_URL, imageRefererMatches } from "@follow/shared/image"
|
||||
import type { BrowserWindowConstructorOptions } from "electron"
|
||||
import { BrowserWindow, screen, shell } from "electron"
|
||||
|
||||
@@ -122,19 +121,6 @@ export function createWindow(
|
||||
})
|
||||
}
|
||||
|
||||
window.webContents.session.webRequest.onBeforeSendHeaders((details, callback) => {
|
||||
const trueUrl = details.url.startsWith(IMAGE_PROXY_URL)
|
||||
? new URL(details.url).searchParams.get("url") || details.url
|
||||
: details.url
|
||||
const refererMatch = imageRefererMatches.find((item) => item.url.test(trueUrl))
|
||||
callback({
|
||||
requestHeaders: {
|
||||
...details.requestHeaders,
|
||||
Referer: refererMatch?.referer || trueUrl,
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
if (isWindows) {
|
||||
// Change the default font-family and font-size of the devtools.
|
||||
// Make it consistent with Chrome on Windows, instead of SimSun.
|
||||
|
||||
@@ -18,11 +18,12 @@
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="Follow" />
|
||||
<meta property="og:url" content="https://app.follow.is" />
|
||||
<meta property="og:image" content="https://app.follow.is/opengraph-image.png" />
|
||||
<meta property="og:image" content="https://app.follow.is/og-image.png" />
|
||||
<meta property="og:description" content="Your Self-custodial Feeds." />
|
||||
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<meta name="twitter:title" content="Follow" />
|
||||
<meta name="twitter:image" content="https://app.follow.is/opengraph-image.png" />
|
||||
<meta name="twitter:image" content="https://app.follow.is/og-image.png" />
|
||||
|
||||
<script>
|
||||
function setTheme() {
|
||||
@@ -54,14 +55,78 @@
|
||||
}
|
||||
}
|
||||
setTheme()
|
||||
// Can not get window.electron so check userAgent
|
||||
const isElectron = navigator.userAgent.includes("Electron")
|
||||
document.documentElement.dataset.buildType = isElectron ? "electron" : "web"
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root">
|
||||
<div id="root"></div>
|
||||
|
||||
<div id="app-skeleton">
|
||||
<!-- Skeleton -->
|
||||
<div class="h-full w-full flex">
|
||||
<div class="w-64 shrink-0 h-full"></div>
|
||||
<div class="grow w-full h-full bg-theme-background"></div>
|
||||
<style>
|
||||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
#app-skeleton {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 1000;
|
||||
}
|
||||
[data-theme="light"] {
|
||||
--background: 0 0% 100%;
|
||||
}
|
||||
|
||||
[data-theme="dark"] {
|
||||
--background: 0 0% 7.1%;
|
||||
}
|
||||
.skeleton {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
.sidebar {
|
||||
width: 16rem;
|
||||
flex-shrink: 0;
|
||||
height: 100%;
|
||||
background-color: hsl(var(--fo-native));
|
||||
}
|
||||
[data-build-type="electron"] .sidebar {
|
||||
background-color: hsl(var(--fo-native) / 0.3);
|
||||
}
|
||||
[data-build-type="electron"][data-theme="dark"] .sidebar {
|
||||
background-color: hsl(var(--fo-native) / 0.1);
|
||||
}
|
||||
.content {
|
||||
flex-grow: 1;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: hsl(var(--background));
|
||||
}
|
||||
|
||||
[data-theme="light"] {
|
||||
--fo-native: 240 1.6% 87.6%;
|
||||
}
|
||||
[data-theme="dark"] {
|
||||
--fo-native: 30 1.7% 23.5%;
|
||||
}
|
||||
|
||||
[data-build-type="web"] {
|
||||
--fo-native: 240 4.8% 95.9%;
|
||||
}
|
||||
|
||||
[data-build-type="web"][data-theme="dark"] {
|
||||
--fo-native: 220 8.1% 14.5%;
|
||||
}
|
||||
</style>
|
||||
<div class="skeleton">
|
||||
<div class="sidebar"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
"private": true,
|
||||
"main": "./dist/main/index.js",
|
||||
"scripts": {
|
||||
"build:web": "cd ../.. && pnpm build:web",
|
||||
"dev": "cd ../.. && pnpm dev:web",
|
||||
"test": "vitest",
|
||||
"typecheck": "tsc --noEmit"
|
||||
@@ -63,10 +64,12 @@
|
||||
"lethargy": "1.0.9",
|
||||
"lodash-es": "4.17.21",
|
||||
"masonic": "4.0.1",
|
||||
"mdast-util-gfm-table": "^2.0.0",
|
||||
"mdast-util-to-markdown": "^2.1.0",
|
||||
"nanoid": "5.0.7",
|
||||
"ofetch": "1.4.1",
|
||||
"path-to-regexp": "8.2.0",
|
||||
"plain-shiki": "0.0.12",
|
||||
"re-resizable": "6.10.0",
|
||||
"react-blurhash": "^0.3.0",
|
||||
"react-error-boundary": "4.1.2",
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 819 KiB |
@@ -76,6 +76,8 @@ const AppLayer = () => {
|
||||
appLog("App is ready", `${doneTime}ms`)
|
||||
|
||||
applyAfterReadyCallbacks()
|
||||
|
||||
document.querySelector("#app-skeleton")?.remove()
|
||||
}, [appIsReady])
|
||||
|
||||
return appIsReady ? <Outlet /> : <AppSkeleton />
|
||||
|
||||
@@ -18,15 +18,18 @@ const createDefaultSettings = (): GeneralSettings => ({
|
||||
hoverMarkUnread: true,
|
||||
renderMarkUnread: false,
|
||||
// UX
|
||||
// autoHideFeedColumn: true,
|
||||
|
||||
groupByDate: true,
|
||||
// Secure
|
||||
jumpOutLinkWarn: true,
|
||||
// TTS
|
||||
voice: "en-US-AndrewMultilingualNeural",
|
||||
})
|
||||
|
||||
export const {
|
||||
useSettingKey: useGeneralSettingKey,
|
||||
useSettingSelector: useGeneralSettingSelector,
|
||||
useSettingKeys: useGeneralSettingKeys,
|
||||
setSetting: setGeneralSetting,
|
||||
clearSettings: clearGeneralSettings,
|
||||
initializeDefaultSettings: initializeDefaultGeneralSettings,
|
||||
@@ -44,4 +47,5 @@ export const generalServerSyncWhiteListKeys: (keyof GeneralSettings)[] = [
|
||||
"dataPersist",
|
||||
"sendAnonymousData",
|
||||
"language",
|
||||
"voice",
|
||||
]
|
||||
|
||||
@@ -22,6 +22,12 @@ export const createDefaultSettings = (): IntegrationSettings => ({
|
||||
// obsidian
|
||||
enableObsidian: false,
|
||||
obsidianVaultPath: "",
|
||||
|
||||
// outline
|
||||
enableOutline: false,
|
||||
outlineEndpoint: "",
|
||||
outlineToken: "",
|
||||
outlineCollection: "",
|
||||
})
|
||||
|
||||
export const {
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
import { createSettingAtom } from "@follow/atoms/helper/setting.js"
|
||||
import type { UISettings } from "@follow/shared/interface/settings"
|
||||
import { atom, useAtomValue } from "jotai"
|
||||
|
||||
import { internal_feedColumnShowAtom } from "../sidebar"
|
||||
|
||||
export const createDefaultSettings = (): UISettings => ({
|
||||
// Sidebar
|
||||
entryColWidth: 356,
|
||||
feedColWidth: 256,
|
||||
hideExtraBadge: false,
|
||||
|
||||
opaqueSidebar: false,
|
||||
sidebarShowUnreadCount: true,
|
||||
thumbnailRatio: "square",
|
||||
|
||||
// Global UI
|
||||
uiTextSize: 16,
|
||||
@@ -29,19 +34,18 @@ export const createDefaultSettings = (): UISettings => ({
|
||||
codeHighlightThemeDark: "github-dark",
|
||||
guessCodeLanguage: true,
|
||||
hideRecentReader: false,
|
||||
customCSS: "",
|
||||
|
||||
// View
|
||||
pictureViewMasonry: true,
|
||||
pictureViewFilterNoImage: false,
|
||||
wideMode: false,
|
||||
|
||||
// TTS
|
||||
voice: "en-US-AndrewMultilingualNeural",
|
||||
})
|
||||
|
||||
export const {
|
||||
useSettingKey: useUISettingKey,
|
||||
useSettingSelector: useUISettingSelector,
|
||||
useSettingKeys: useUISettingKeys,
|
||||
setSetting: setUISetting,
|
||||
clearSettings: clearUISettings,
|
||||
initializeDefaultSettings: initializeDefaultUISettings,
|
||||
@@ -54,5 +58,12 @@ export const uiServerSyncWhiteListKeys: (keyof UISettings)[] = [
|
||||
"uiFontFamily",
|
||||
"readerFontFamily",
|
||||
"opaqueSidebar",
|
||||
"voice",
|
||||
"customCSS",
|
||||
]
|
||||
|
||||
const isZenModeAtom = atom((get) => {
|
||||
const ui = get(__uiSettingAtom)
|
||||
return ui.wideMode && !get(internal_feedColumnShowAtom)
|
||||
})
|
||||
|
||||
export const useIsZenMode = () => useAtomValue(isZenModeAtom)
|
||||
|
||||
@@ -48,9 +48,14 @@ viewAtom.onMount = () => {
|
||||
setSidebarActiveView(view)
|
||||
}
|
||||
}
|
||||
export const [, , useFeedColumnShow, , getFeedColumnShow, setFeedColumnShow] = createAtomHooks(
|
||||
atom(true),
|
||||
)
|
||||
export const [
|
||||
internal_feedColumnShowAtom,
|
||||
,
|
||||
useFeedColumnShow,
|
||||
,
|
||||
getFeedColumnShow,
|
||||
setFeedColumnShow,
|
||||
] = createAtomHooks(atom(true))
|
||||
|
||||
export const [, , useFeedColumnTempShow, , getFeedColumnTempShow, setFeedColumnTempShow] =
|
||||
createAtomHooks(atom(false))
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { FC, PropsWithChildren, ReactNode } from "react"
|
||||
import { createContext, createElement, useContext, useLayoutEffect, useMemo, useState } from "react"
|
||||
import root from "react-shadow"
|
||||
|
||||
import { useUISettingKey } from "~/atoms/settings/ui"
|
||||
import { useUISettingKeys } from "~/atoms/settings/ui"
|
||||
import { useReduceMotion } from "~/hooks/biz/useReduceMotion"
|
||||
|
||||
const ShadowDOMContext = createContext(false)
|
||||
@@ -84,9 +84,8 @@ export const ShadowDOM: FC<
|
||||
|
||||
const dark = useIsDark()
|
||||
|
||||
const uiFont = useUISettingKey("uiFontFamily")
|
||||
const reduceMotion = useReduceMotion()
|
||||
const usePointerCursor = useUISettingKey("usePointerCursor")
|
||||
const [uiFont, usePointerCursor] = useUISettingKeys(["uiFontFamily", "usePointerCursor"])
|
||||
|
||||
return (
|
||||
<root.div {...rest}>
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
import type { FC } from "react"
|
||||
|
||||
import { attachOpenInEditor } from "~/lib/dev"
|
||||
|
||||
import type { AppErrorFallbackProps } from "../common/AppErrorBoundary"
|
||||
import { FeedbackIssue } from "../common/ErrorElement"
|
||||
import { parseError } from "./helper"
|
||||
|
||||
const RSSHubErrorFallback: FC<AppErrorFallbackProps> = (props) => {
|
||||
const { message, stack } = parseError(props.error)
|
||||
|
||||
return (
|
||||
<div className="flex flex-col items-center justify-center">
|
||||
<div className="m-auto max-w-prose text-center">
|
||||
<p className="center my-3 gap-2 font-bold">
|
||||
<i className="i-mgc-bug-cute-re text-red-500" />
|
||||
RSSHub has a temporary problem, please contact the our team.
|
||||
</p>
|
||||
<div className="text-lg">{message}</div>
|
||||
{import.meta.env.DEV && stack ? (
|
||||
<pre className="mt-4 max-h-48 cursor-text overflow-auto whitespace-pre-line rounded-md bg-red-50 p-4 text-left font-mono text-sm text-red-600">
|
||||
{attachOpenInEditor(stack)}
|
||||
</pre>
|
||||
) : null}
|
||||
|
||||
<FeedbackIssue message={message!} stack={stack} />
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
export default RSSHubErrorFallback
|
||||
@@ -5,4 +5,6 @@ export enum ErrorComponentType {
|
||||
// Feed
|
||||
FeedFoundCanBeFollow = "FeedFoundCanBeFollow",
|
||||
FeedNotFound = "FeedNotFound",
|
||||
// Section
|
||||
RSSHubDiscoverError = "RSSHubDiscoverError",
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ const ErrorFallbackMap = {
|
||||
() => import("./FeedFoundCanBeFollowErrorFallback"),
|
||||
),
|
||||
[ErrorComponentType.FeedNotFound]: lazy(() => import("./FeedNotFound")),
|
||||
[ErrorComponentType.RSSHubDiscoverError]: lazy(() => import("./RSSHubError")),
|
||||
}
|
||||
|
||||
export const getErrorFallback = (type: ErrorComponentType) => ErrorFallbackMap[type]
|
||||
|
||||
@@ -9,8 +9,8 @@ import { useSearchParams } from "react-router-dom"
|
||||
|
||||
import { getItemComponentByView } from "~/modules/entry-column/Items"
|
||||
import type { UniversalItemProps } from "~/modules/entry-column/types"
|
||||
import { FeedCertification } from "~/modules/feed/feed-certification"
|
||||
import { FeedIcon } from "~/modules/feed/feed-icon"
|
||||
import { FeedTitle } from "~/modules/feed/feed-title"
|
||||
import { useEntriesPreview } from "~/queries/entries"
|
||||
import { useFeed } from "~/queries/feed"
|
||||
|
||||
@@ -56,10 +56,7 @@ export function FeedPreview(props: {
|
||||
size={64}
|
||||
/>
|
||||
<div className="flex flex-col items-center">
|
||||
<div className="mb-2 mt-4 flex items-center text-2xl font-bold">
|
||||
<h1>{feed.data.feed.title}</h1>
|
||||
<FeedCertification feed={feed.data.feed} />
|
||||
</div>
|
||||
<FeedTitle feed={feed.data.feed} className="mb-2 mt-4 text-2xl font-bold" />
|
||||
<div className="mb-8 text-sm text-zinc-500">{feed.data.feed.description}</div>
|
||||
</div>
|
||||
<div className="mb-4 text-sm">
|
||||
@@ -95,6 +92,7 @@ export function FeedPreview(props: {
|
||||
feeds: feedData,
|
||||
read: true,
|
||||
feedId: feedData.id!,
|
||||
inboxId: "",
|
||||
}}
|
||||
entryId={entry.id}
|
||||
/>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { Focusable } from "@follow/components/common/Focusable.js"
|
||||
import { SYSTEM_CAN_UNDER_BLUR_WINDOW } from "@follow/shared/constants"
|
||||
import { cn } from "@follow/utils/utils"
|
||||
|
||||
@@ -7,15 +8,15 @@ type Props = Component<
|
||||
React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>
|
||||
>
|
||||
const MacOSVibrancy: Props = ({ className, children, ...rest }) => (
|
||||
<div className={cn("bg-native/30 dark:bg-native/10", className)} {...rest}>
|
||||
<Focusable className={cn("bg-native/30 dark:bg-native/10", className)} {...rest}>
|
||||
{children}
|
||||
</div>
|
||||
</Focusable>
|
||||
)
|
||||
|
||||
const Noop: Props = ({ children, className, ...rest }) => (
|
||||
<div className={cn("bg-native", className)} {...rest}>
|
||||
<Focusable className={cn("bg-native", className)} {...rest}>
|
||||
{children}
|
||||
</div>
|
||||
</Focusable>
|
||||
)
|
||||
|
||||
// Disable blur effect on Windows, because electron backgroundMaterial has some issues
|
||||
|
||||
@@ -42,13 +42,19 @@ export interface ITocItem {
|
||||
$heading: HTMLHeadingElement
|
||||
}
|
||||
|
||||
interface TocProps {
|
||||
onItemClick?: (index: number, $el: HTMLElement | null, anchorId: string) => void
|
||||
}
|
||||
|
||||
const WiderTocStyle = {
|
||||
width: 200,
|
||||
} satisfies React.CSSProperties
|
||||
export const Toc: Component = ({ className }) => {
|
||||
export const Toc: Component<TocProps> = ({ className, onItemClick }) => {
|
||||
const markdownElement = useContext(MarkdownRenderContainerRefContext)
|
||||
const { toc, rootDepth } = useTocItems(markdownElement)
|
||||
const { currentScrollRange, handleScrollTo } = useScrollTracking(toc)
|
||||
const { currentScrollRange, handleScrollTo } = useScrollTracking(toc, {
|
||||
onItemClick,
|
||||
})
|
||||
|
||||
const renderContentElementPosition = useWrappedElementPosition()
|
||||
const renderContentElementSize = useWrappedElementSize()
|
||||
@@ -269,7 +275,7 @@ const useTocItems = (markdownElement: HTMLElement | null) => {
|
||||
return { toc, rootDepth }
|
||||
}
|
||||
|
||||
const useScrollTracking = (toc: ITocItem[]) => {
|
||||
const useScrollTracking = (toc: ITocItem[], options: Pick<TocProps, "onItemClick">) => {
|
||||
const scrollContainerElement = useScrollViewElement()
|
||||
const [currentScrollRange, setCurrentScrollRange] = useState([-1, 0] as [number, number])
|
||||
const { h } = useWrappedElementSize()
|
||||
@@ -361,6 +367,7 @@ const useScrollTracking = (toc: ITocItem[]) => {
|
||||
|
||||
const handleScrollTo = useEventCallback(
|
||||
(i: number, $el: HTMLElement | null, _anchorId: string) => {
|
||||
options.onItemClick?.(i, $el, _anchorId)
|
||||
if ($el) {
|
||||
const handle = () => {
|
||||
springScrollToElement($el, -100, scrollContainerElement!).then(() => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { EllipsisHorizontalTextWithTooltip } from "@follow/components/ui/typography/index.js"
|
||||
import { cn } from "@follow/utils/utils"
|
||||
import { clsx, cn } from "@follow/utils/utils"
|
||||
import type { FC, MouseEvent } from "react"
|
||||
import { memo, useCallback, useRef } from "react"
|
||||
|
||||
@@ -35,7 +35,7 @@ export const TocItem: FC<TocItemProps> = memo((props) => {
|
||||
type="button"
|
||||
ref={$ref}
|
||||
data-index={index}
|
||||
className={cn("cursor-pointer", isTitleLine && "relative flex min-w-0 flex-col")}
|
||||
className={cn("cursor-pointer", isTitleLine && "relative flex w-full flex-col")}
|
||||
style={
|
||||
isTitleLine
|
||||
? {
|
||||
@@ -55,7 +55,14 @@ export const TocItem: FC<TocItemProps> = memo((props) => {
|
||||
title={title}
|
||||
>
|
||||
{isTitleLine && (
|
||||
<EllipsisHorizontalTextWithTooltip className="w-full min-w-0 truncate text-left text-xs text-zinc-500 hover:!text-zinc-500 dark:text-zinc-400 dark:hover:!text-zinc-300">
|
||||
<EllipsisHorizontalTextWithTooltip
|
||||
className={clsx(
|
||||
"w-full min-w-0 truncate text-left text-xs",
|
||||
range
|
||||
? "text-zinc-900 dark:text-zinc-300"
|
||||
: "text-zinc-500 hover:text-zinc-500 dark:text-zinc-400 dark:hover:text-zinc-300",
|
||||
)}
|
||||
>
|
||||
{title}
|
||||
</EllipsisHorizontalTextWithTooltip>
|
||||
)}
|
||||
|
||||
@@ -13,8 +13,6 @@ import { usePreviewMedia } from "./media/hooks"
|
||||
import type { VideoPlayerRef } from "./media/VideoPlayer"
|
||||
import { VideoPlayer } from "./media/VideoPlayer"
|
||||
|
||||
const failedList = new Set<string | undefined>()
|
||||
|
||||
type BaseProps = {
|
||||
mediaContainerClassName?: string
|
||||
showFallback?: boolean
|
||||
@@ -30,6 +28,7 @@ export type MediaProps = BaseProps &
|
||||
width: number
|
||||
height: number
|
||||
}
|
||||
preferOrigin?: boolean
|
||||
popper?: boolean
|
||||
type: "photo"
|
||||
previewImageUrl?: string
|
||||
@@ -40,6 +39,7 @@ export type MediaProps = BaseProps &
|
||||
width: number
|
||||
height: number
|
||||
}
|
||||
preferOrigin?: boolean
|
||||
popper?: boolean
|
||||
type: "video"
|
||||
previewImageUrl?: string
|
||||
@@ -48,6 +48,7 @@ export type MediaProps = BaseProps &
|
||||
const MediaImpl: FC<MediaProps> = ({
|
||||
className,
|
||||
proxy,
|
||||
preferOrigin,
|
||||
popper = false,
|
||||
mediaContainerClassName,
|
||||
thumbnail,
|
||||
@@ -74,41 +75,62 @@ const MediaImpl: FC<MediaProps> = ({
|
||||
const finalHeight = height || ctxHeight
|
||||
const finalWidth = width || ctxWidth
|
||||
|
||||
const [currentState, setCurrentState] = useState<"proxy" | "origin" | "error">(() =>
|
||||
proxy && !preferOrigin ? "proxy" : "origin",
|
||||
)
|
||||
|
||||
const [imgSrc, setImgSrc] = useState(() =>
|
||||
proxy && src && !failedList.has(src)
|
||||
currentState === "proxy" && src
|
||||
? getImageProxyUrl({
|
||||
url: src,
|
||||
width: proxy.width,
|
||||
height: proxy.height,
|
||||
width: proxy?.width || 0,
|
||||
height: proxy?.height || 0,
|
||||
})
|
||||
: src,
|
||||
)
|
||||
|
||||
const previewImageSrc = useMemo(
|
||||
() =>
|
||||
proxy && previewImageUrl
|
||||
currentState === "proxy" && previewImageUrl
|
||||
? getImageProxyUrl({
|
||||
url: previewImageUrl,
|
||||
width: proxy.width,
|
||||
height: proxy.height,
|
||||
width: proxy?.width || 0,
|
||||
height: proxy?.height || 0,
|
||||
})
|
||||
: previewImageUrl,
|
||||
[previewImageUrl, proxy],
|
||||
[currentState, previewImageUrl, proxy?.width, proxy?.height],
|
||||
)
|
||||
|
||||
const [mediaLoadState, setMediaLoadState] = useState<"loading" | "loaded" | "error">("loading")
|
||||
const errorHandle: React.ReactEventHandler<HTMLImageElement> = useEventCallback((e) => {
|
||||
if (imgSrc !== props.src) {
|
||||
setImgSrc(props.src)
|
||||
failedList.add(props.src)
|
||||
} else {
|
||||
setMediaLoadState("error")
|
||||
const [mediaLoadState, setMediaLoadState] = useState<"loading" | "loaded">("loading")
|
||||
|
||||
props.onError?.(e as any)
|
||||
const errorHandle: React.ReactEventHandler<HTMLImageElement> = useEventCallback(() => {
|
||||
switch (currentState) {
|
||||
case "proxy": {
|
||||
if (imgSrc !== props.src && props.src) {
|
||||
setImgSrc(props.src)
|
||||
} else {
|
||||
setCurrentState("error")
|
||||
}
|
||||
break
|
||||
}
|
||||
case "origin": {
|
||||
if (imgSrc === props.src && props.src) {
|
||||
setImgSrc(
|
||||
getImageProxyUrl({
|
||||
url: props.src,
|
||||
width: proxy?.width || 0,
|
||||
height: proxy?.height || 0,
|
||||
}),
|
||||
)
|
||||
} else {
|
||||
setCurrentState("error")
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const isError = mediaLoadState === "error"
|
||||
const isError = currentState === "error"
|
||||
const previewMedia = usePreviewMedia()
|
||||
const handleClick = useEventCallback((e: React.MouseEvent) => {
|
||||
if (popper && src) {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { MotionButtonBase } from "@follow/components/ui/button/index.js"
|
||||
import { Focusable } from "@follow/components/common/Focusable.js"
|
||||
import { ActionButton, MotionButtonBase } from "@follow/components/ui/button/index.js"
|
||||
import type { HTMLMediaState } from "@follow/hooks"
|
||||
import { useRefValue, useVideo } from "@follow/hooks"
|
||||
import { nextFrame, stopPropagation } from "@follow/utils/dom"
|
||||
import { cn } from "@follow/utils/utils"
|
||||
import { clsx, cn } from "@follow/utils/utils"
|
||||
import * as Slider from "@radix-ui/react-slider"
|
||||
import { useSingleton } from "foxact/use-singleton"
|
||||
import { m, useDragControls, useSpring } from "framer-motion"
|
||||
import type { PropsWithChildren } from "react"
|
||||
import {
|
||||
@@ -131,7 +131,7 @@ export const VideoPlayer = forwardRef<VideoPlayerRef, VideoPlayerProps>(
|
||||
)
|
||||
|
||||
return (
|
||||
<div className="group center relative size-full" ref={wrapperRef}>
|
||||
<Focusable className="group center relative size-full" ref={wrapperRef}>
|
||||
{element}
|
||||
|
||||
<div className="center pointer-events-none absolute inset-0">
|
||||
@@ -159,20 +159,19 @@ export const VideoPlayer = forwardRef<VideoPlayerRef, VideoPlayerProps>(
|
||||
{variant === "preview" && <FloatMutedButton />}
|
||||
{isPlayer && <ControlBar />}
|
||||
</VideoPlayerContext.Provider>
|
||||
</div>
|
||||
</Focusable>
|
||||
)
|
||||
},
|
||||
)
|
||||
const BizControlOutsideMedia = () => {
|
||||
const currentAudioPlayerIsPlayRef = useSingleton(() => AudioPlayer.get().status === "playing")
|
||||
const currentAudioPlayerIsPlayRef = useMemo(() => AudioPlayer.get().status === "playing", [])
|
||||
useEffect(() => {
|
||||
const { current } = currentAudioPlayerIsPlayRef
|
||||
if (current) {
|
||||
if (currentAudioPlayerIsPlayRef) {
|
||||
AudioPlayer.pause()
|
||||
}
|
||||
|
||||
return () => {
|
||||
if (current) {
|
||||
if (currentAudioPlayerIsPlayRef) {
|
||||
AudioPlayer.play()
|
||||
}
|
||||
}
|
||||
@@ -286,7 +285,6 @@ const FullScreenControl = () => {
|
||||
<ActionIcon
|
||||
label={isFullScreen ? t("player.exit_full_screen") : t("player.full_screen")}
|
||||
shortcut="f"
|
||||
labelDelayDuration={1}
|
||||
onClick={() => {
|
||||
if (!ref.current) return
|
||||
|
||||
@@ -326,7 +324,7 @@ const DownloadVideo = () => {
|
||||
})
|
||||
|
||||
return (
|
||||
<ActionIcon shortcut="d" label={t("player.download")} labelDelayDuration={1} onClick={download}>
|
||||
<ActionIcon shortcut="d" label={t("player.download")} onClick={download}>
|
||||
{isDownloading ? (
|
||||
<i className="i-mgc-loading-3-cute-re animate-spin" />
|
||||
) : (
|
||||
@@ -353,7 +351,6 @@ const VolumeControl = () => {
|
||||
controls.mute()
|
||||
}
|
||||
}}
|
||||
labelDelayDuration={1}
|
||||
>
|
||||
{muted ? (
|
||||
<i className="i-mgc-volume-mute-cute-re" title={t("player.unmute")} />
|
||||
@@ -422,31 +419,24 @@ const ActionIcon = ({
|
||||
onClick,
|
||||
children,
|
||||
shortcut,
|
||||
label,
|
||||
}: {
|
||||
className?: string
|
||||
onClick?: () => void
|
||||
label: React.ReactNode
|
||||
labelDelayDuration?: number
|
||||
children?: React.ReactNode
|
||||
shortcut?: string
|
||||
}) => {
|
||||
useHotkeys(
|
||||
shortcut || "",
|
||||
(e) => {
|
||||
e.preventDefault()
|
||||
onClick?.()
|
||||
},
|
||||
{
|
||||
enabled: !!shortcut,
|
||||
},
|
||||
)
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
className="center relative z-[1] size-6 rounded-md hover:bg-theme-button-hover"
|
||||
<ActionButton
|
||||
shortcutOnlyFocusWithIn
|
||||
tooltipSide="top"
|
||||
className={clsx("z-[2] hover:bg-transparent", className)}
|
||||
onClick={onClick}
|
||||
tooltip={label}
|
||||
shortcut={shortcut}
|
||||
>
|
||||
{children || <i className={className} />}
|
||||
</button>
|
||||
</ActionButton>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ const Wrapper: Component<{
|
||||
sideContent?: React.ReactNode
|
||||
}> = ({ children, src, showActions, sideContent }) => {
|
||||
const { dismiss } = useCurrentModal()
|
||||
const { t } = useTranslation(["shortcuts", "external"])
|
||||
const { t } = useTranslation(["shortcuts", "common"])
|
||||
|
||||
return (
|
||||
<div className="center relative size-full px-20 pb-8 pt-10" onClick={dismiss}>
|
||||
@@ -39,7 +39,7 @@ const Wrapper: Component<{
|
||||
exit={{
|
||||
opacity: 0,
|
||||
}}
|
||||
className="fixed right-3 top-2 flex items-center gap-4"
|
||||
className="fixed right-4 flex items-center safe-inset-top-4"
|
||||
>
|
||||
<FixedModalCloseButton onClick={dismiss} />
|
||||
</m.div>
|
||||
@@ -62,14 +62,16 @@ const Wrapper: Component<{
|
||||
{children}
|
||||
<RootPortal to={sideContent ? null : undefined}>
|
||||
<div
|
||||
className="pointer-events-auto absolute bottom-4 right-4 z-[99] flex gap-3 text-theme-vibrancyFg dark:text-white/70 [&_button]:hover:text-theme-vibrancyFg dark:[&_button]:hover:text-white"
|
||||
className={
|
||||
"pointer-events-auto absolute bottom-4 right-4 z-[99] flex gap-3 text-theme-vibrancyFg dark:text-white/70 [&_button]:hover:text-theme-vibrancyFg dark:[&_button]:hover:text-white"
|
||||
}
|
||||
onClick={stopPropagation}
|
||||
>
|
||||
{showActions && (
|
||||
<Fragment>
|
||||
{IN_ELECTRON && (
|
||||
<ActionButton
|
||||
tooltip={t("external:header.download")}
|
||||
tooltip={t("common:words.download")}
|
||||
onClick={() => {
|
||||
tipcClient?.download(src)
|
||||
}}
|
||||
@@ -128,9 +130,10 @@ export const PreviewMediaContent: FC<{
|
||||
if (media.length === 1) {
|
||||
const src = media[0].url
|
||||
const { type } = media[0]
|
||||
const isVideo = type === "video"
|
||||
return (
|
||||
<Wrapper src={src} showActions={type !== "video"} sideContent={children}>
|
||||
{type === "video" ? (
|
||||
<Wrapper src={src} showActions={!isVideo} sideContent={children}>
|
||||
{isVideo ? (
|
||||
<VideoPlayer
|
||||
src={src}
|
||||
controls
|
||||
@@ -154,12 +157,9 @@ export const PreviewMediaContent: FC<{
|
||||
</Wrapper>
|
||||
)
|
||||
}
|
||||
const isVideo = currentMedia.type === "video"
|
||||
return (
|
||||
<Wrapper
|
||||
src={currentMedia.url}
|
||||
showActions={currentMedia.type !== "video"}
|
||||
sideContent={children}
|
||||
>
|
||||
<Wrapper src={currentMedia.url} showActions={!isVideo} sideContent={children}>
|
||||
<Swiper
|
||||
ref={swiperRef}
|
||||
loop
|
||||
@@ -205,13 +205,21 @@ export const PreviewMediaContent: FC<{
|
||||
|
||||
{showActions && (
|
||||
<div>
|
||||
<div className="absolute bottom-4 left-4 text-sm tabular-nums text-white/60 animate-in fade-in-0 slide-in-from-bottom-6">
|
||||
<div
|
||||
className={cn(
|
||||
"absolute left-4 text-sm tabular-nums text-white/60 animate-in fade-in-0 slide-in-from-bottom-6",
|
||||
isVideo ? "bottom-12" : "bottom-4",
|
||||
)}
|
||||
>
|
||||
{currentSlideIndex + 1} / {media.length}
|
||||
</div>
|
||||
<div
|
||||
tabIndex={-1}
|
||||
onClick={stopPropagation}
|
||||
className="center absolute bottom-4 left-1/2 z-[99] h-6 -translate-x-1/2 gap-2 rounded-full bg-neutral-700/90 px-4 duration-200 animate-in fade-in-0 slide-in-from-bottom-6"
|
||||
className={cn(
|
||||
"center absolute left-1/2 z-[99] h-6 -translate-x-1/2 gap-2 rounded-full bg-neutral-700/90 px-4 duration-200 animate-in fade-in-0 slide-in-from-bottom-6",
|
||||
isVideo ? "bottom-12" : "bottom-4",
|
||||
)}
|
||||
>
|
||||
{Array.from({ length: media.length })
|
||||
.fill(0)
|
||||
|
||||
@@ -1,21 +1,24 @@
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "@follow/components/ui/tooltip/index.js"
|
||||
import { cn } from "@follow/utils/utils"
|
||||
import { useTranslation } from "react-i18next"
|
||||
|
||||
export const FixedModalCloseButton: Component<{
|
||||
onClick: () => void
|
||||
}> = ({ onClick }) => {
|
||||
className?: string
|
||||
}> = ({ onClick, className }) => {
|
||||
const { t } = useTranslation("common")
|
||||
return (
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<button
|
||||
type="button"
|
||||
className="center flex size-8 rounded-full bg-background p-1 shadow-sm ring-1 ring-zinc-200 dark:ring-neutral-800"
|
||||
onClick={onClick}
|
||||
>
|
||||
<i className="i-mgc-close-cute-re text-lg" />
|
||||
<span className="sr-only">{t("close")}</span>
|
||||
</button>
|
||||
<TooltipTrigger
|
||||
type="button"
|
||||
className={cn(
|
||||
"center flex size-8 rounded-full bg-background p-1 shadow-sm ring-1 ring-zinc-200 dark:ring-neutral-800",
|
||||
className,
|
||||
)}
|
||||
onClick={onClick}
|
||||
>
|
||||
<i className="i-mgc-close-cute-re text-lg" />
|
||||
<span className="sr-only">{t("close")}</span>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>{t("close")}</TooltipContent>
|
||||
</Tooltip>
|
||||
|
||||
@@ -14,7 +14,7 @@ const InPeekModal = createContext(false)
|
||||
export const useInPeekModal = () => useContext(InPeekModal)
|
||||
export const PeekModal = (
|
||||
props: PropsWithChildren<{
|
||||
to: string
|
||||
to?: string
|
||||
}>,
|
||||
) => {
|
||||
const { dismissAll } = useModalStack()
|
||||
@@ -38,21 +38,23 @@ export const PeekModal = (
|
||||
exit={{
|
||||
opacity: 0,
|
||||
}}
|
||||
className="fixed right-3 top-2 flex items-center gap-4"
|
||||
className="fixed right-4 flex items-center gap-4 safe-inset-top-4"
|
||||
>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Link
|
||||
className="center flex size-8 cursor-button rounded-full bg-theme-background p-1 shadow-sm ring-1 ring-zinc-200 dark:ring-neutral-800"
|
||||
to={to}
|
||||
onClick={dismissAll}
|
||||
>
|
||||
<i className="i-mgc-fullscreen-2-cute-re text-lg" />
|
||||
<span className="sr-only">Go to this link</span>
|
||||
</Link>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>{t("words.expand")}</TooltipContent>
|
||||
</Tooltip>
|
||||
{!!to && (
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Link
|
||||
className="center flex size-8 cursor-button rounded-full bg-theme-background p-1 shadow-sm ring-1 ring-zinc-200 dark:ring-neutral-800"
|
||||
to={to}
|
||||
onClick={dismissAll}
|
||||
>
|
||||
<i className="i-mgc-fullscreen-2-cute-re text-lg" />
|
||||
<span className="sr-only">Go to this link</span>
|
||||
</Link>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>{t("words.expand")}</TooltipContent>
|
||||
</Tooltip>
|
||||
)}
|
||||
<FixedModalCloseButton onClick={dismiss} />
|
||||
</m.div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import { createEventBus } from "@follow/utils/event-bus"
|
||||
|
||||
export const ModalEventBus = createEventBus<{
|
||||
MODAL_DISPATCH: ModalDisposeEvent
|
||||
}>()
|
||||
|
||||
export type ModalDisposeEvent = {
|
||||
type: "dismiss"
|
||||
id: string
|
||||
}
|
||||
@@ -10,7 +10,7 @@ export const ModalClose = () => {
|
||||
return (
|
||||
<MotionButtonBase
|
||||
aria-label={t("close")}
|
||||
className="absolute right-6 top-6 z-[99] flex size-8 items-center justify-center rounded-md duration-200 hover:bg-theme-button-hover"
|
||||
className="absolute right-6 top-6 flex size-8 items-center justify-center rounded-md duration-200 hover:bg-theme-button-hover"
|
||||
onClick={dismiss}
|
||||
>
|
||||
<i className="i-mgc-close-cute-re block" />
|
||||
|
||||
@@ -101,7 +101,7 @@ export const DrawerModalLayout: FC<PropsWithChildren> = ({ children }) => {
|
||||
className={cn(
|
||||
"flex flex-col items-center overflow-hidden rounded-xl border bg-theme-background p-8 pb-0",
|
||||
"shadow-drawer-to-left w-[60ch] max-w-full",
|
||||
"fixed bottom-0 right-2 safe-inset-top-4",
|
||||
"fixed bottom-4 right-2 safe-inset-top-4",
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
|
||||
@@ -11,6 +11,7 @@ import { getUISettings } from "~/atoms/settings/ui"
|
||||
import { jotaiStore } from "~/lib/jotai"
|
||||
|
||||
import { modalStackAtom } from "./atom"
|
||||
import { ModalEventBus } from "./bus"
|
||||
import { MODAL_STACK_Z_INDEX } from "./constants"
|
||||
import { CurrentModalContext, CurrentModalStateContext } from "./context"
|
||||
import type { ModalProps, ModalStackOptions } from "./types"
|
||||
@@ -71,19 +72,26 @@ export const useModalStack = (options?: ModalStackOptions) => {
|
||||
}
|
||||
const actions = {
|
||||
getTopModalStack() {
|
||||
return jotaiStore.get(modalStackAtom)[0]
|
||||
return jotaiStore.get(modalStackAtom).at(-1)
|
||||
},
|
||||
getModalStackById(id: string) {
|
||||
return jotaiStore.get(modalStackAtom).find((item) => item.id === id)
|
||||
},
|
||||
dismiss(id: string) {
|
||||
jotaiStore.set(modalStackAtom, (p) => p.filter((item) => item.id !== id))
|
||||
ModalEventBus.dispatch("MODAL_DISPATCH", {
|
||||
type: "dismiss",
|
||||
id,
|
||||
})
|
||||
},
|
||||
dismissTop() {
|
||||
jotaiStore.set(modalStackAtom, (p) => p.slice(0, -1))
|
||||
const topModal = actions.getTopModalStack()
|
||||
|
||||
if (!topModal) return
|
||||
actions.dismiss(topModal.id)
|
||||
},
|
||||
dismissAll() {
|
||||
jotaiStore.set(modalStackAtom, [])
|
||||
const modalStack = jotaiStore.get(modalStackAtom)
|
||||
modalStack.forEach((item) => actions.dismiss(item.id))
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import { useEffect } from "react"
|
||||
|
||||
import { ModalEventBus } from "../bus"
|
||||
import type { ModalActionsInternal } from "../context"
|
||||
|
||||
/** @internal */
|
||||
export const useModalSubscriber = (id: string, ctx: ModalActionsInternal) => {
|
||||
useEffect(() => {
|
||||
return ModalEventBus.subscribe("MODAL_DISPATCH", (data) => {
|
||||
if (data.id === id) {
|
||||
ctx.dismiss()
|
||||
}
|
||||
})
|
||||
}, [ctx, id])
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import { Divider } from "@follow/components/ui/divider/index.js"
|
||||
import { RootPortalProvider } from "@follow/components/ui/portal/provider.js"
|
||||
import { EllipsisHorizontalTextWithTooltip } from "@follow/components/ui/typography/index.js"
|
||||
import { useRefValue } from "@follow/hooks"
|
||||
import { nextFrame, stopPropagation } from "@follow/utils/dom"
|
||||
import { nextFrame, preventDefault, stopPropagation } from "@follow/utils/dom"
|
||||
import { cn, getOS } from "@follow/utils/utils"
|
||||
import * as Dialog from "@radix-ui/react-dialog"
|
||||
import type { BoundingBox } from "framer-motion"
|
||||
@@ -39,6 +39,7 @@ import { CurrentModalContext, CurrentModalStateContext } from "./context"
|
||||
import { useModalAnimate } from "./internal/use-animate"
|
||||
import { useModalResizeAndDrag } from "./internal/use-drag"
|
||||
import { useModalSelect } from "./internal/use-select"
|
||||
import { useModalSubscriber } from "./internal/use-subscriber"
|
||||
import { ModalOverlay } from "./overlay"
|
||||
import type { ModalOverlayOptions, ModalProps } from "./types"
|
||||
|
||||
@@ -151,6 +152,7 @@ export const ModalInternal = memo(
|
||||
}),
|
||||
[close, getIndex, item.id, setStack],
|
||||
)
|
||||
useModalSubscriber(item.id, ModalProps)
|
||||
|
||||
const ModalContextProps = useMemo<CurrentModalContentProps>(
|
||||
() => ({
|
||||
@@ -234,7 +236,12 @@ export const ModalInternal = memo(
|
||||
<Dialog.Portal>
|
||||
{Overlay}
|
||||
<Dialog.DialogTitle className="sr-only">{title}</Dialog.DialogTitle>
|
||||
<Dialog.Content asChild aria-describedby={undefined} onOpenAutoFocus={openAutoFocus}>
|
||||
<Dialog.Content
|
||||
asChild
|
||||
aria-describedby={undefined}
|
||||
onPointerDownOutside={(event) => event.preventDefault()}
|
||||
onOpenAutoFocus={openAutoFocus}
|
||||
>
|
||||
<div
|
||||
ref={setEdgeElementRef}
|
||||
className={cn(
|
||||
@@ -279,7 +286,13 @@ export const ModalInternal = memo(
|
||||
<Dialog.Root modal={modal} open onOpenChange={onClose}>
|
||||
<Dialog.Portal>
|
||||
{Overlay}
|
||||
<Dialog.Content asChild aria-describedby={undefined} onOpenAutoFocus={openAutoFocus}>
|
||||
<Dialog.Content
|
||||
asChild
|
||||
aria-describedby={undefined}
|
||||
// @ts-expect-error
|
||||
onPointerDownOutside={preventDefault}
|
||||
onOpenAutoFocus={openAutoFocus}
|
||||
>
|
||||
<div
|
||||
ref={setEdgeElementRef}
|
||||
className={cn(
|
||||
@@ -360,7 +373,7 @@ export const ModalInternal = memo(
|
||||
</div>
|
||||
<Divider className="my-2 shrink-0 border-slate-200 opacity-80 dark:border-neutral-800" />
|
||||
|
||||
<div className="min-h-0 shrink grow overflow-auto px-4 py-2">
|
||||
<div className="-mx-2 min-h-0 shrink grow overflow-auto px-6 py-2">
|
||||
<ModalContext modalContextProps={ModalContextProps} isTop={!!isTop}>
|
||||
{finalChildren}
|
||||
</ModalContext>
|
||||
|
||||
@@ -29,15 +29,13 @@ export const SentryConfig: BrowserOptions = {
|
||||
|
||||
beforeSend(event, hint) {
|
||||
const error = hint.originalException
|
||||
const errorMessage = error instanceof Error ? error.message : String(error)
|
||||
const isIgnoredError = ERROR_PATTERNS.some((pattern) =>
|
||||
pattern instanceof RegExp ? pattern.test(errorMessage) : errorMessage.includes(pattern),
|
||||
)
|
||||
|
||||
if (error instanceof Error) {
|
||||
const isIgnoredError = ERROR_PATTERNS.some((pattern) =>
|
||||
pattern instanceof RegExp ? pattern.test(error.message) : error.message.includes(pattern),
|
||||
)
|
||||
|
||||
if (isIgnoredError) {
|
||||
return null
|
||||
}
|
||||
if (isIgnoredError) {
|
||||
return null
|
||||
}
|
||||
|
||||
const isPassthroughError = [CustomSafeError, FetchError].some((errorType) => {
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import { COPY_MAP } from "~/constants"
|
||||
|
||||
export const shortcuts = {
|
||||
type Shortcuts = Record<
|
||||
string,
|
||||
Record<string, { name: I18nKeysForShortcuts; key: string; extra?: string }>
|
||||
>
|
||||
export const shortcuts: Shortcuts = {
|
||||
feeds: {
|
||||
add: {
|
||||
name: "keys.feeds.add",
|
||||
@@ -100,7 +104,13 @@ export const shortcuts = {
|
||||
key: "Space",
|
||||
},
|
||||
},
|
||||
} as const
|
||||
misc: {
|
||||
quickSearch: {
|
||||
name: "keys.misc.quickSearch",
|
||||
key: "Meta+K",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
export const shortcutsType: { [key in keyof typeof shortcuts]: I18nKeysForShortcuts } = {
|
||||
feeds: "keys.type.feeds",
|
||||
@@ -108,4 +118,5 @@ export const shortcutsType: { [key in keyof typeof shortcuts]: I18nKeysForShortc
|
||||
entries: "keys.type.entries",
|
||||
entry: "keys.type.entry",
|
||||
audio: "keys.type.audio",
|
||||
misc: "keys.type.misc",
|
||||
}
|
||||
|
||||
Vendored
+1
@@ -2,3 +2,4 @@ declare const APP_VERSION: string
|
||||
declare const APP_NAME: string
|
||||
declare const RELEASE_CHANNEL: string
|
||||
declare const I18N_COMPLETENESS_MAP: Record<string, number>
|
||||
declare const CHANGELOG_CONTENT: string
|
||||
|
||||
@@ -3,6 +3,7 @@ import {
|
||||
SimpleIconsInstapaper,
|
||||
SimpleIconsObsidian,
|
||||
SimpleIconsOmnivore,
|
||||
SimpleIconsOutline,
|
||||
SimpleIconsReadwise,
|
||||
} from "@follow/components/ui/platform-icon/icons.js"
|
||||
import { FeedViewType } from "@follow/constants"
|
||||
@@ -19,12 +20,13 @@ import { useTranslation } from "react-i18next"
|
||||
import { toast } from "sonner"
|
||||
|
||||
import {
|
||||
getReadabilityContent,
|
||||
getReadabilityStatus,
|
||||
ReadabilityStatus,
|
||||
setReadabilityContent,
|
||||
setReadabilityStatus,
|
||||
} from "~/atoms/readability"
|
||||
import { useIntegrationSettingKey } from "~/atoms/settings/integration"
|
||||
import { useIntegrationSettingValue } from "~/atoms/settings/integration"
|
||||
import {
|
||||
setShowSourceContent,
|
||||
toggleShowSourceContent,
|
||||
@@ -40,7 +42,8 @@ import StarAnimationUri from "~/lottie/star.lottie?url"
|
||||
import { useTipModal } from "~/modules/wallet/hooks"
|
||||
import type { FlatEntryModel } from "~/store/entry"
|
||||
import { entryActions } from "~/store/entry"
|
||||
import { useFeedById } from "~/store/feed"
|
||||
import { getFeedById, useFeedById } from "~/store/feed"
|
||||
import { useInboxById } from "~/store/inbox"
|
||||
|
||||
import { navigateEntry } from "./useNavigateEntry"
|
||||
|
||||
@@ -109,23 +112,27 @@ export const useUnCollect = (entry: Nullable<CombinedEntryModel>) => {
|
||||
|
||||
export const useRead = () =>
|
||||
useMutation({
|
||||
mutationFn: async (entry: Nullable<CombinedEntryModel>) =>
|
||||
entry &&
|
||||
entryActions.markRead({
|
||||
feedId: entry.feeds.id,
|
||||
mutationFn: async (entry: Nullable<CombinedEntryModel>) => {
|
||||
const relatedId = entry?.feeds?.id || entry?.inboxes?.id
|
||||
if (!relatedId) return
|
||||
return entryActions.markRead({
|
||||
feedId: relatedId,
|
||||
entryId: entry.entries.id,
|
||||
read: true,
|
||||
}),
|
||||
})
|
||||
},
|
||||
})
|
||||
export const useUnread = () =>
|
||||
useMutation({
|
||||
mutationFn: async (entry: Nullable<CombinedEntryModel>) =>
|
||||
entry &&
|
||||
entryActions.markRead({
|
||||
feedId: entry.feeds.id,
|
||||
mutationFn: async (entry: Nullable<CombinedEntryModel>) => {
|
||||
const relatedId = entry?.feeds?.id || entry?.inboxes?.id
|
||||
if (!relatedId) return
|
||||
return entryActions.markRead({
|
||||
feedId: relatedId,
|
||||
entryId: entry.entries.id,
|
||||
read: false,
|
||||
}),
|
||||
})
|
||||
},
|
||||
})
|
||||
|
||||
export const useDeleteInboxEntry = () => {
|
||||
@@ -147,28 +154,40 @@ export const useEntryActions = ({
|
||||
view,
|
||||
entry,
|
||||
type,
|
||||
inList,
|
||||
}: {
|
||||
view?: number
|
||||
entry?: FlatEntryModel | null
|
||||
type?: "toolbar" | "entryList"
|
||||
inList?: boolean
|
||||
}) => {
|
||||
const { t } = useTranslation()
|
||||
|
||||
const feed = useFeedById(entry?.feedId)
|
||||
const isInbox = feed?.type === "inbox"
|
||||
const feed = useFeedById(entry?.feedId, (feed) => {
|
||||
return {
|
||||
type: feed.type,
|
||||
ownerUserId: feed.ownerUserId,
|
||||
id: feed.id,
|
||||
}
|
||||
})
|
||||
|
||||
const inbox = useInboxById(entry?.inboxId)
|
||||
const isInbox = !!inbox
|
||||
|
||||
const populatedEntry = useMemo(() => {
|
||||
if (!entry) return null
|
||||
if (!feed) return null
|
||||
if (!feed?.id && !inbox?.id) return null
|
||||
|
||||
return {
|
||||
...entry,
|
||||
feeds: feed!,
|
||||
feeds: feed ? getFeedById(feed.id) : undefined,
|
||||
inboxes: inbox,
|
||||
} as CombinedEntryModel
|
||||
}, [entry, feed])
|
||||
}, [entry, feed, inbox])
|
||||
|
||||
const openTipModal = useTipModal({
|
||||
userId: populatedEntry?.feeds.ownerUserId ?? undefined,
|
||||
feedId: populatedEntry?.feeds.id ?? undefined,
|
||||
userId: populatedEntry?.feeds?.ownerUserId ?? undefined,
|
||||
feedId: populatedEntry?.feeds?.id ?? undefined,
|
||||
entryId: populatedEntry?.entries.id ?? undefined,
|
||||
})
|
||||
|
||||
@@ -179,17 +198,24 @@ export const useEntryActions = ({
|
||||
const uncollect = useUnCollect(populatedEntry)
|
||||
const read = useRead()
|
||||
const unread = useUnread()
|
||||
const enableEagle = useIntegrationSettingKey("enableEagle")
|
||||
const enableReadwise = useIntegrationSettingKey("enableReadwise")
|
||||
const readwiseToken = useIntegrationSettingKey("readwiseToken")
|
||||
const enableInstapaper = useIntegrationSettingKey("enableInstapaper")
|
||||
const instapaperUsername = useIntegrationSettingKey("instapaperUsername")
|
||||
const instapaperPassword = useIntegrationSettingKey("instapaperPassword")
|
||||
const enableOmnivore = useIntegrationSettingKey("enableOmnivore")
|
||||
const omnivoreToken = useIntegrationSettingKey("omnivoreToken")
|
||||
const omnivoreEndpoint = useIntegrationSettingKey("omnivoreEndpoint")
|
||||
const enableObsidian = useIntegrationSettingKey("enableObsidian")
|
||||
const obsidianVaultPath = useIntegrationSettingKey("obsidianVaultPath")
|
||||
|
||||
const {
|
||||
enableEagle,
|
||||
enableReadwise,
|
||||
enableInstapaper,
|
||||
enableOmnivore,
|
||||
enableObsidian,
|
||||
enableOutline,
|
||||
readwiseToken,
|
||||
instapaperUsername,
|
||||
instapaperPassword,
|
||||
omnivoreToken,
|
||||
omnivoreEndpoint,
|
||||
obsidianVaultPath,
|
||||
outlineToken,
|
||||
outlineEndpoint,
|
||||
outlineCollection,
|
||||
} = useIntegrationSettingValue()
|
||||
const isObsidianEnabled = enableObsidian && !!obsidianVaultPath
|
||||
|
||||
const saveToObsidian = useMutation({
|
||||
@@ -236,6 +262,17 @@ export const useEntryActions = ({
|
||||
|
||||
const items = useMemo(() => {
|
||||
if (!populatedEntry || view === undefined) return []
|
||||
|
||||
const getEntryContentAsMarkdown = () => {
|
||||
const isReadabilityReady =
|
||||
getReadabilityStatus()[populatedEntry.entries.id] === ReadabilityStatus.SUCCESS
|
||||
const content =
|
||||
(isReadabilityReady
|
||||
? getReadabilityContent()[populatedEntry.entries.id].content
|
||||
: populatedEntry.entries.content) || ""
|
||||
return parseHtml(content).toMarkdown()
|
||||
}
|
||||
|
||||
const items: {
|
||||
key: string
|
||||
className?: string
|
||||
@@ -259,10 +296,15 @@ export const useEntryActions = ({
|
||||
if (!populatedEntry.entries.url || !populatedEntry.entries.media?.length) {
|
||||
return
|
||||
}
|
||||
window.analytics?.capture("integration", {
|
||||
type: "eagle",
|
||||
event: "save",
|
||||
})
|
||||
const response = await tipcClient?.saveToEagle({
|
||||
url: populatedEntry.entries.url,
|
||||
mediaUrls: populatedEntry.entries.media.map((m) => m.url),
|
||||
})
|
||||
|
||||
if (response?.status === "success") {
|
||||
toast.success(t("entry_actions.saved_to_eagle"), {
|
||||
duration: 3000,
|
||||
@@ -281,6 +323,10 @@ export const useEntryActions = ({
|
||||
hide: !enableReadwise || !readwiseToken || !populatedEntry.entries.url,
|
||||
onClick: async () => {
|
||||
try {
|
||||
window.analytics?.capture("integration", {
|
||||
type: "readwise",
|
||||
event: "save",
|
||||
})
|
||||
const data = await ofetch("https://readwise.io/api/v3/save/", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
@@ -297,6 +343,7 @@ export const useEntryActions = ({
|
||||
saved_using: "Follow",
|
||||
},
|
||||
})
|
||||
|
||||
toast.success(
|
||||
<>
|
||||
{t("entry_actions.saved_to_readwise")},{" "}
|
||||
@@ -326,6 +373,10 @@ export const useEntryActions = ({
|
||||
!populatedEntry.entries.url,
|
||||
onClick: async () => {
|
||||
try {
|
||||
window.analytics?.capture("integration", {
|
||||
type: "instapaper",
|
||||
event: "save",
|
||||
})
|
||||
const data = await ofetch("https://www.instapaper.com/api/add", {
|
||||
query: {
|
||||
url: populatedEntry.entries.url,
|
||||
@@ -337,6 +388,7 @@ export const useEntryActions = ({
|
||||
},
|
||||
parseResponse: JSON.parse,
|
||||
})
|
||||
|
||||
toast.success(
|
||||
<>
|
||||
{t("entry_actions.saved_to_instapaper")},{" "}
|
||||
@@ -380,6 +432,10 @@ export const useEntryActions = ({
|
||||
}
|
||||
`
|
||||
|
||||
window.analytics?.capture("integration", {
|
||||
type: "omnivore",
|
||||
event: "save",
|
||||
})
|
||||
try {
|
||||
const data = await ofetch(omnivoreEndpoint, {
|
||||
method: "POST",
|
||||
@@ -425,16 +481,68 @@ export const useEntryActions = ({
|
||||
onClick: () => {
|
||||
if (!isObsidianEnabled || !populatedEntry?.entries?.url || !IN_ELECTRON) return
|
||||
|
||||
const markdownContent = getEntryContentAsMarkdown()
|
||||
window.analytics?.capture("integration", {
|
||||
type: "obsidian",
|
||||
event: "save",
|
||||
})
|
||||
saveToObsidian.mutate({
|
||||
url: populatedEntry.entries.url,
|
||||
title: populatedEntry.entries.title || "",
|
||||
content: parseHtml(populatedEntry.entries.content || "").toMarkdown(),
|
||||
content: markdownContent,
|
||||
author: populatedEntry.entries.author || "",
|
||||
publishedAt: populatedEntry.entries.publishedAt || "",
|
||||
vaultPath: obsidianVaultPath,
|
||||
})
|
||||
},
|
||||
},
|
||||
{
|
||||
name: t("entry_actions.save_to_outline"),
|
||||
icon: <SimpleIconsOutline />,
|
||||
key: "saveTooutline",
|
||||
hide:
|
||||
!IN_ELECTRON ||
|
||||
!enableOutline ||
|
||||
!outlineToken ||
|
||||
!outlineEndpoint ||
|
||||
!outlineCollection ||
|
||||
!populatedEntry.entries.title,
|
||||
onClick: async () => {
|
||||
try {
|
||||
const request = async (method: string, params: Record<string, unknown>) => {
|
||||
return await ofetch(`${outlineEndpoint.replace(/\/$/, "")}/${method}`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${outlineToken}`,
|
||||
},
|
||||
body: params,
|
||||
})
|
||||
}
|
||||
let collectionId = outlineCollection
|
||||
if (!/^[a-f\d]{8}(?:-[a-f\d]{4}){3}-[a-f\d]{12}$/i.test(collectionId)) {
|
||||
const collection = await request("collections.info", {
|
||||
id: collectionId,
|
||||
})
|
||||
collectionId = collection.data.id
|
||||
}
|
||||
const markdownContent = getEntryContentAsMarkdown()
|
||||
await request("documents.create", {
|
||||
title: populatedEntry.entries.title,
|
||||
text: markdownContent,
|
||||
collectionId,
|
||||
publish: true,
|
||||
})
|
||||
toast.success(t("entry_actions.saved_to_outline"), {
|
||||
duration: 3000,
|
||||
})
|
||||
} catch {
|
||||
toast.error(t("entry_actions.failed_to_save_to_outline"), {
|
||||
duration: 3000,
|
||||
})
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
key: "tip",
|
||||
shortcut: shortcuts.entry.tip.key,
|
||||
@@ -578,7 +686,7 @@ export const useEntryActions = ({
|
||||
name: t("entry_actions.mark_as_read"),
|
||||
shortcut: shortcuts.entry.toggleRead.key,
|
||||
className: "i-mgc-round-cute-fi",
|
||||
hide: !!(!!populatedEntry.read || populatedEntry.collections),
|
||||
hide: !!(!!populatedEntry.read || populatedEntry.collections) || inList,
|
||||
onClick: () => {
|
||||
read.mutate(populatedEntry)
|
||||
},
|
||||
@@ -588,7 +696,7 @@ export const useEntryActions = ({
|
||||
name: t("entry_actions.mark_as_unread"),
|
||||
shortcut: shortcuts.entry.toggleRead.key,
|
||||
className: "i-mgc-round-cute-re",
|
||||
hide: !!(!populatedEntry.read || populatedEntry.collections),
|
||||
hide: !!(!populatedEntry.read || populatedEntry.collections) || inList,
|
||||
onClick: () => {
|
||||
unread.mutate(populatedEntry)
|
||||
},
|
||||
@@ -612,10 +720,15 @@ export const useEntryActions = ({
|
||||
omnivoreToken,
|
||||
omnivoreEndpoint,
|
||||
isObsidianEnabled,
|
||||
enableOutline,
|
||||
outlineToken,
|
||||
outlineEndpoint,
|
||||
outlineCollection,
|
||||
isInbox,
|
||||
feed?.ownerUserId,
|
||||
type,
|
||||
showSourceContent,
|
||||
inList,
|
||||
saveToObsidian,
|
||||
obsidianVaultPath,
|
||||
openTipModal,
|
||||
|
||||
@@ -60,8 +60,15 @@ export const useFeedActions = ({
|
||||
type?: "feedList" | "entryList"
|
||||
}) => {
|
||||
const { t } = useTranslation()
|
||||
const feed = useFeedById(feedId)
|
||||
const isInbox = feed?.type === "inbox"
|
||||
const feed = useFeedById(feedId, (feed) => {
|
||||
return {
|
||||
type: feed.type,
|
||||
ownerUserId: feed.ownerUserId,
|
||||
id: feed.id,
|
||||
}
|
||||
})
|
||||
const inbox = useInboxById(feedId)
|
||||
const isInbox = !!inbox
|
||||
const subscription = useSubscriptionByFeedId(feedId)
|
||||
const { present } = useModalStack()
|
||||
const deleteSubscription = useDeleteSubscription({})
|
||||
@@ -81,7 +88,8 @@ export const useFeedActions = ({
|
||||
const isMultipleSelection = feedIds && feedIds.length > 0
|
||||
|
||||
const items = useMemo(() => {
|
||||
if (!feed) return []
|
||||
const related = feed || inbox
|
||||
if (!related) return []
|
||||
|
||||
const items: NullableNativeMenuItem[] = [
|
||||
{
|
||||
@@ -95,9 +103,9 @@ export const useFeedActions = ({
|
||||
}),
|
||||
supportMultipleSelection: true,
|
||||
},
|
||||
!feed.ownerUserId &&
|
||||
!!isBizId(feed.id) &&
|
||||
feed.type === "feed" && {
|
||||
!related.ownerUserId &&
|
||||
!!isBizId(related.id) &&
|
||||
related.type === "feed" && {
|
||||
type: "text" as const,
|
||||
label: isEntryList
|
||||
? t("sidebar.feed_actions.claim_feed")
|
||||
@@ -107,7 +115,7 @@ export const useFeedActions = ({
|
||||
claimFeed()
|
||||
},
|
||||
},
|
||||
...(feed.ownerUserId === whoami()?.id
|
||||
...(related.ownerUserId === whoami()?.id
|
||||
? [
|
||||
{
|
||||
type: "text" as const,
|
||||
@@ -285,12 +293,13 @@ export const useFeedActions = ({
|
||||
return items
|
||||
}, [
|
||||
feed,
|
||||
inbox,
|
||||
t,
|
||||
isEntryList,
|
||||
isInbox,
|
||||
listByView,
|
||||
feedId,
|
||||
isMultipleSelection,
|
||||
feedId,
|
||||
feedIds,
|
||||
claimFeed,
|
||||
openBoostModal,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { env } from "@follow/shared/env"
|
||||
import { clearStorage } from "@follow/utils/ns"
|
||||
import { signOut } from "@hono/auth-js/react"
|
||||
import { useCallback } from "react"
|
||||
@@ -21,5 +22,7 @@ export const useSignOut = () =>
|
||||
// clear local store data
|
||||
await Promise.allSettled([clearLocalPersistStoreData(), tipcClient?.cleanAuthSessionToken()])
|
||||
// Sign out
|
||||
await signOut()
|
||||
await signOut({
|
||||
callbackUrl: env.VITE_WEB_URL,
|
||||
})
|
||||
}, [])
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { initializeDayjs } from "@follow/components/dayjs"
|
||||
import { registerGlobalContext } from "@follow/shared/bridge"
|
||||
import { IN_ELECTRON } from "@follow/shared/constants"
|
||||
import { env } from "@follow/shared/env"
|
||||
@@ -49,6 +50,7 @@ export const initializeApp = async () => {
|
||||
basePath: "/auth",
|
||||
credentials: "include",
|
||||
})
|
||||
initializeDayjs()
|
||||
|
||||
// Set Environment
|
||||
document.documentElement.dataset.buildType = isElectronBuild ? "electron" : "web"
|
||||
|
||||
@@ -1,42 +1,20 @@
|
||||
import { getStorageNS } from "@follow/utils/ns"
|
||||
import { repository } from "@pkg"
|
||||
import { createElement } from "react"
|
||||
import { toast } from "sonner"
|
||||
|
||||
import { appLog } from "~/lib/log"
|
||||
|
||||
import { waitAppReady } from "../queue"
|
||||
|
||||
const appVersionKey = getStorageNS("app_version")
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
__app_is_upgraded__: boolean
|
||||
}
|
||||
}
|
||||
export const doMigration = () => {
|
||||
const lastVersion = localStorage.getItem(appVersionKey)
|
||||
|
||||
if (lastVersion && lastVersion !== APP_VERSION) {
|
||||
appLog(`Upgrade from ${lastVersion} to ${APP_VERSION}`)
|
||||
|
||||
waitAppReady(() => {
|
||||
toast.success(
|
||||
// `App is upgraded to ${APP_VERSION}, enjoy the new features! 🎉`,
|
||||
createElement("div", {
|
||||
children: [
|
||||
"App is upgraded to ",
|
||||
createElement(
|
||||
"a",
|
||||
{
|
||||
href: `${repository.url}/releases/tag/${APP_VERSION}`,
|
||||
target: "_blank",
|
||||
className: "underline",
|
||||
},
|
||||
createElement("strong", {
|
||||
children: APP_VERSION,
|
||||
}),
|
||||
),
|
||||
", enjoy the new features! 🎉",
|
||||
],
|
||||
}),
|
||||
)
|
||||
}, 1000)
|
||||
window.__app_is_upgraded__ = true
|
||||
|
||||
// NOTE: Add migration logic here
|
||||
}
|
||||
|
||||
@@ -9,7 +9,9 @@ import { toast } from "sonner"
|
||||
|
||||
import { NetworkStatus, setApiStatus } from "~/atoms/network"
|
||||
import { setLoginModalShow } from "~/atoms/user"
|
||||
import { isDev } from "~/constants"
|
||||
import { NeedActivationToast } from "~/modules/activation/NeedActivationToast"
|
||||
import { DebugRegistry } from "~/modules/debug/registry"
|
||||
|
||||
let csrfTokenPromise: Promise<string> | null = null
|
||||
export const apiFetch = ofetch.create({
|
||||
@@ -65,6 +67,9 @@ export const apiFetch = ofetch.create({
|
||||
{
|
||||
closeButton: true,
|
||||
duration: 10e4,
|
||||
classNames: {
|
||||
content: tw`w-full`,
|
||||
},
|
||||
},
|
||||
)
|
||||
}, 500)
|
||||
@@ -91,3 +96,24 @@ export const apiClient = hc<AppType>(env.VITE_API_URL, {
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
if (isDev) {
|
||||
DebugRegistry.add("Activation Toast", () => {
|
||||
setTimeout(() => {
|
||||
const toastId = toast.error(
|
||||
createElement(NeedActivationToast, {
|
||||
dimiss: () => {
|
||||
toast.dismiss(toastId)
|
||||
},
|
||||
}),
|
||||
{
|
||||
closeButton: true,
|
||||
duration: 10e4,
|
||||
classNames: {
|
||||
content: tw`w-full`,
|
||||
},
|
||||
},
|
||||
)
|
||||
}, 500)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import { toast } from "sonner"
|
||||
|
||||
import { CopyButton } from "~/components/ui/code-highlighter"
|
||||
import { Markdown } from "~/components/ui/markdown/Markdown"
|
||||
import { isDev } from "~/constants"
|
||||
import { DebugRegistry } from "~/modules/debug/registry"
|
||||
|
||||
export const getFetchErrorMessage = (error: Error) => {
|
||||
if (error instanceof FetchError) {
|
||||
@@ -62,7 +64,7 @@ export const toastFetchError = (
|
||||
..._toastOptions,
|
||||
classNames: {
|
||||
toast: "items-start bg-theme-background",
|
||||
title: tw`-mt-0.5`, // to align with the icon (actually cut the top space from line-height)
|
||||
|
||||
content: "w-full",
|
||||
..._toastOptions.classNames,
|
||||
},
|
||||
@@ -95,3 +97,19 @@ export const toastFetchError = (
|
||||
})
|
||||
}
|
||||
}
|
||||
if (isDev) {
|
||||
DebugRegistry.add("Simulate request error", () => {
|
||||
createErrorToaster(
|
||||
"Simulated request error",
|
||||
{},
|
||||
)({
|
||||
response: {
|
||||
_data: JSON.stringify({
|
||||
code: 1000,
|
||||
message: "Simulated request error",
|
||||
reason: "Simulated reason",
|
||||
}),
|
||||
},
|
||||
} as any)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import {
|
||||
webpCloudPublicServicesMatches,
|
||||
} from "@follow/shared/image"
|
||||
|
||||
import { isWebBuild } from "~/constants"
|
||||
|
||||
export const getImageProxyUrl = ({
|
||||
url,
|
||||
width,
|
||||
@@ -25,9 +27,11 @@ export const replaceImgUrlIfNeed = (url?: string) => {
|
||||
}
|
||||
}
|
||||
|
||||
for (const rule of imageRefererMatches) {
|
||||
if (rule.url.test(url)) {
|
||||
return getImageProxyUrl({ url, width: 0, height: 0 })
|
||||
if (isWebBuild) {
|
||||
for (const rule of imageRefererMatches) {
|
||||
if (rule.url.test(url)) {
|
||||
return getImageProxyUrl({ url, width: 0, height: 0 })
|
||||
}
|
||||
}
|
||||
}
|
||||
return url
|
||||
|
||||
@@ -6,6 +6,7 @@ import type { Components } from "hast-util-to-jsx-runtime"
|
||||
import { toJsxRuntime } from "hast-util-to-jsx-runtime"
|
||||
import { toMdast } from "hast-util-to-mdast"
|
||||
import { toText } from "hast-util-to-text"
|
||||
import { gfmTableToMarkdown } from "mdast-util-gfm-table"
|
||||
import { toMarkdown } from "mdast-util-to-markdown"
|
||||
import { createElement } from "react"
|
||||
import { Fragment, jsx, jsxs } from "react/jsx-runtime"
|
||||
@@ -237,13 +238,14 @@ export const parseHtml = (
|
||||
},
|
||||
}),
|
||||
toText: () => toText(hastTree),
|
||||
toMarkdown: () => toMarkdown(toMdast(hastTree)),
|
||||
toMarkdown: () => toMarkdown(toMdast(hastTree), { extensions: [gfmTableToMarkdown()] }),
|
||||
}
|
||||
}
|
||||
|
||||
const Img: Components["img"] = ({ node, ...props }) => {
|
||||
const nextProps = {
|
||||
...props,
|
||||
preferOrigin: true,
|
||||
proxy: { height: 0, width: 700 },
|
||||
}
|
||||
const widthPx = Number.parseInt(props.width as string)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import "./wdyr"
|
||||
import "@follow/components/tailwind"
|
||||
import "@follow/components/dayjs"
|
||||
import "./styles/main.css"
|
||||
|
||||
import { IN_ELECTRON } from "@follow/shared/constants"
|
||||
|
||||
@@ -9,14 +9,12 @@ import { Chain } from "@follow/utils/chain"
|
||||
import { cn } from "@follow/utils/utils"
|
||||
import { DotLottieReact } from "@lottiefiles/dotlottie-react"
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"
|
||||
import type { SingletonRefObject } from "foxact/use-singleton"
|
||||
import { useSingleton } from "foxact/use-singleton"
|
||||
import type { PrimitiveAtom } from "jotai"
|
||||
import { atom, useStore } from "jotai"
|
||||
import { nanoid } from "nanoid"
|
||||
import type { FC, ReactNode } from "react"
|
||||
import { useEffect, useId, useMemo, useRef } from "react"
|
||||
import { Trans, useTranslation } from "react-i18next"
|
||||
import { useEffect, useId, useMemo, useRef, useState } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
|
||||
import { useServerConfigs } from "~/atoms/server-configs"
|
||||
import { useCurrentModal, useModalStack } from "~/components/ui/modal/stacked/hooks"
|
||||
@@ -79,7 +77,7 @@ type Achievement = ExtractBizResponse<typeof apiClient.achievement.$get>["data"]
|
||||
export const AchievementModalContent: FC = () => {
|
||||
const jotaiStore = useStore()
|
||||
|
||||
const defaultAchievements = useSingleton(buildDefaultAchievements)
|
||||
const defaultAchievements = useState(buildDefaultAchievements)[0]
|
||||
|
||||
const {
|
||||
data: achievements,
|
||||
@@ -97,10 +95,10 @@ export const AchievementModalContent: FC = () => {
|
||||
},
|
||||
})
|
||||
|
||||
jotaiStore.set(achievementsDataAtom.current, res.data)
|
||||
jotaiStore.set(achievementsDataAtom, res.data)
|
||||
return res.data
|
||||
},
|
||||
initialData: defaultAchievements.current as Achievement,
|
||||
initialData: defaultAchievements as Achievement,
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
@@ -126,7 +124,7 @@ export const AchievementModalContent: FC = () => {
|
||||
}
|
||||
}, [achievements, isLoading, refetch])
|
||||
|
||||
const achievementsDataAtom = useSingleton(() => atom<typeof achievements>())
|
||||
const achievementsDataAtom = useState(() => atom<typeof achievements>())[0]
|
||||
|
||||
const t = useI18n()
|
||||
|
||||
@@ -150,18 +148,9 @@ export const AchievementModalContent: FC = () => {
|
||||
|
||||
<div className="mt-4 text-xl font-bold">{t("words.achievement")}</div>
|
||||
|
||||
<small className="center mt-1 gap-1 text-theme-vibrancyFg">
|
||||
<Trans
|
||||
i18nKey={"achievement.mint_more_power"}
|
||||
components={{
|
||||
power: (
|
||||
<span className="center gap-0.5 font-semibold">
|
||||
<span>{t("words.power")}</span>
|
||||
<i className="i-mgc-power text-accent" />
|
||||
</span>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
<small className="mt-1 gap-1 text-theme-vibrancyFg">
|
||||
{t("achievement.description")}
|
||||
<sup className="inline-block translate-y-1 text-xs">*</sup>
|
||||
</small>
|
||||
|
||||
<ScrollArea rootClassName="h-0 grow mt-10 w-[calc(100%+2rem)] -mx-4" viewportClassName="px-4">
|
||||
@@ -178,16 +167,7 @@ export const AchievementModalContent: FC = () => {
|
||||
return (
|
||||
<li key={achievement.id} className="flex items-center justify-between">
|
||||
<div>
|
||||
<div className="text-base font-bold">
|
||||
{t(copy.title)}
|
||||
|
||||
{achievement.power && (
|
||||
<span className="ml-2 inline-flex items-center gap-0.5 text-xs font-normal">
|
||||
<span className="font-medium opacity-80">{achievement.power}</span>
|
||||
<i className="i-mgc-power scale-95 text-sm text-accent" />
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<div className="text-base font-bold">{t(copy.title)}</div>
|
||||
<div className="flex items-center text-sm text-muted-foreground">
|
||||
{t(copy.description)}
|
||||
</div>
|
||||
@@ -242,6 +222,8 @@ export const AchievementModalContent: FC = () => {
|
||||
)}
|
||||
</ul>
|
||||
</ScrollArea>
|
||||
|
||||
<p className="mt-4 pb-2 text-xs text-muted-foreground">{t("achievement.nft_coming_soon")}</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -257,7 +239,7 @@ const buildDefaultAchievements = () => {
|
||||
}
|
||||
|
||||
const MintButton: FC<{
|
||||
achievementsDataAtom: SingletonRefObject<PrimitiveAtom<Achievement | undefined>>
|
||||
achievementsDataAtom: PrimitiveAtom<Achievement | undefined>
|
||||
achievement: Achievement[number]
|
||||
}> = ({ achievementsDataAtom, achievement }) => {
|
||||
const { mutateAsync: mintAchievement, isPending: isMinting } = useMutation({
|
||||
@@ -280,7 +262,7 @@ const MintButton: FC<{
|
||||
onClick={async () => {
|
||||
const res = await mintAchievement(achievement.actionId)
|
||||
|
||||
const currentData = jotaiStore.get(achievementsDataAtom.current)
|
||||
const currentData = jotaiStore.get(achievementsDataAtom)
|
||||
if (!currentData) return
|
||||
let shouldInvalidate = false
|
||||
const newData = currentData.map((item) => {
|
||||
@@ -295,7 +277,7 @@ const MintButton: FC<{
|
||||
}
|
||||
return item
|
||||
})
|
||||
jotaiStore.set(achievementsDataAtom.current, newData)
|
||||
jotaiStore.set(achievementsDataAtom, newData)
|
||||
|
||||
if (shouldInvalidate) {
|
||||
queryClient.invalidateQueries({ queryKey: ["achievements"] })
|
||||
@@ -347,7 +329,7 @@ const IncompleteButton: FC<{
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
{!PRODUCT_HUNT_VOTE_URL && (
|
||||
<TooltipContent>Product Hunk Vote is not ready, We'll see.</TooltipContent>
|
||||
<TooltipContent>Product Hunt Vote is not ready, We'll see.</TooltipContent>
|
||||
)}
|
||||
</Tooltip>
|
||||
)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { Button } from "@follow/components/ui/button/index.js"
|
||||
import { stopPropagation } from "@follow/utils/dom"
|
||||
import { useCallback } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
@@ -10,22 +9,22 @@ export const NeedActivationToast = (props: { dimiss: () => void }) => {
|
||||
|
||||
const { t } = useTranslation()
|
||||
return (
|
||||
<div className="flex flex-col justify-end">
|
||||
<div className="flex justify-between gap-3">
|
||||
<div>{t("activation.description")}</div>
|
||||
|
||||
<div className="text-right">
|
||||
<Button
|
||||
// Prevent modal dismiss
|
||||
onPointerDown={stopPropagation}
|
||||
onClick={useCallback(() => {
|
||||
presentActivationModal()
|
||||
props.dimiss()
|
||||
}, [presentActivationModal, props])}
|
||||
buttonClassName="text-xs"
|
||||
>
|
||||
{t("activation.activate")}
|
||||
</Button>
|
||||
</div>
|
||||
<button
|
||||
className="shrink-0 bg-accent text-white"
|
||||
type="button"
|
||||
data-button="true"
|
||||
data-action="true"
|
||||
onPointerDown={stopPropagation}
|
||||
onClick={useCallback(() => {
|
||||
presentActivationModal()
|
||||
props.dimiss()
|
||||
}, [presentActivationModal, props])}
|
||||
>
|
||||
{t("activation.activate")}
|
||||
</button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { Button } from "@follow/components/ui/button/index.js"
|
||||
import {
|
||||
Tooltip,
|
||||
TooltipContent,
|
||||
@@ -7,15 +8,53 @@ import {
|
||||
import { env } from "@follow/shared/env"
|
||||
|
||||
import { useUserRole } from "~/atoms/user"
|
||||
import { useModalStack } from "~/components/ui/modal/stacked/hooks"
|
||||
import { isDev } from "~/constants"
|
||||
|
||||
import { DebugRegistry } from "../debug/registry"
|
||||
|
||||
export const EnvironmentIndicator = () => {
|
||||
const role = useUserRole()
|
||||
const { present } = useModalStack()
|
||||
return (
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<div className="fixed bottom-0 right-0 z-[99999] rounded-tl bg-accent px-1 py-0.5 text-xs text-white">
|
||||
{role}:{import.meta.env.MODE}
|
||||
</div>
|
||||
<button
|
||||
tabIndex={-1}
|
||||
aria-hidden
|
||||
type="button"
|
||||
onClick={() => {
|
||||
if (!isDev) return
|
||||
|
||||
const actionMap = DebugRegistry.getAll()
|
||||
|
||||
present({
|
||||
title: "Debug Actions",
|
||||
content: () => {
|
||||
return (
|
||||
<div className="flex flex-col gap-2">
|
||||
{Object.entries(actionMap).map(([key, action]) => {
|
||||
return (
|
||||
<div key={key} className="flex w-full items-center gap-2">
|
||||
<span className="flex flex-1">{key}</span>
|
||||
<Button variant="outline" type="button" onClick={() => action()}>
|
||||
<i className="i-mgc-play-cute-fi size-3" />
|
||||
<span className="ml-1">Run</span>
|
||||
</Button>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
)
|
||||
},
|
||||
})
|
||||
}}
|
||||
>
|
||||
<div className="center fixed bottom-0 right-0 z-[99999] flex rounded-tl bg-accent px-1 py-0.5 text-xs text-white">
|
||||
{role}:{isDev && <i className="i-mgc-bug-cute-re size-3" />}
|
||||
{import.meta.env.MODE}
|
||||
</div>
|
||||
</button>
|
||||
</TooltipTrigger>
|
||||
<TooltipPortal>
|
||||
<TooltipContent className="max-w-max break-all" side="top">
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import { createAtomHooks } from "@follow/utils/jotai"
|
||||
import { atom } from "jotai"
|
||||
|
||||
export const [, , useFeedBoostMap, , getFeedBoostMap, setFeedBoostMap] = createAtomHooks(
|
||||
atom<Record<string, boolean>>({}),
|
||||
)
|
||||
|
||||
export const updateFeedBoostStatus = (feedId: string, isBoosted: boolean) => {
|
||||
const prev = getFeedBoostMap()
|
||||
setFeedBoostMap({ ...prev, [feedId]: isBoosted })
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { cn } from "@follow/utils/utils"
|
||||
import { useState } from "react"
|
||||
|
||||
import { useI18n } from "~/hooks/common"
|
||||
|
||||
@@ -16,30 +17,33 @@ export const BoostProgress = ({
|
||||
expiresAt: string
|
||||
} | null
|
||||
}) => {
|
||||
const [numberFormater] = useState(() => new Intl.NumberFormat())
|
||||
const t = useI18n()
|
||||
const percentage = (boostCount / (boostCount + remainingBoostsToLevelUp)) * 100
|
||||
const nextLevel = level + 1
|
||||
const rawPercentage = (boostCount / (boostCount + remainingBoostsToLevelUp)) * 100
|
||||
const percentage = 2 + (rawPercentage * (98 - 1)) / 100
|
||||
const nextLevel = level + 2
|
||||
return (
|
||||
<div className="flex w-full flex-col px-2">
|
||||
<div className="relative w-full pt-12">
|
||||
<div className="relative -mx-2 pt-12">
|
||||
<span
|
||||
className={cn(
|
||||
"absolute bottom-0 mb-10 flex h-8 w-12 -translate-x-1/2 items-center justify-center whitespace-nowrap rounded-full px-3.5 py-2 text-sm font-bold text-white transition-all duration-500 ease-out after:absolute after:bottom-[-5px] after:left-1/2 after:-z-10 after:flex after:size-3 after:-translate-x-1/2 after:rotate-45 ",
|
||||
"absolute -bottom-3 mb-10 flex h-7 -translate-x-1/2 items-center justify-center whitespace-nowrap rounded-full p-2 text-sm font-bold text-white transition-all duration-500 ease-out after:absolute after:bottom-[-5px] after:left-1/2 after:-z-10 after:flex after:size-3 after:-translate-x-1/2 after:rotate-45 ",
|
||||
"bg-orange-500 after:bg-orange-500",
|
||||
"motion-preset-shake",
|
||||
)}
|
||||
style={{ left: `${percentage}%` }}
|
||||
>
|
||||
<i className="i-mgc-train-cute-fi mr-2 shrink-0" />
|
||||
{boostCount}
|
||||
{numberFormater.format(boostCount)}
|
||||
</span>
|
||||
<div className="relative flex h-6 w-full overflow-hidden rounded-3xl bg-gray-200 dark:bg-gray-800">
|
||||
<div className="relative flex h-3 w-full overflow-hidden rounded-3xl bg-gray-200 dark:bg-zinc-800">
|
||||
<div
|
||||
role="progressbar"
|
||||
aria-valuenow={boostCount}
|
||||
aria-valuemin={0}
|
||||
aria-valuemax={remainingBoostsToLevelUp}
|
||||
style={{ width: `${percentage}%` }}
|
||||
className="flex h-full items-center justify-center rounded-3xl bg-accent text-white transition-all duration-500 ease-out"
|
||||
style={{ width: `calc(${percentage}% + 0.5rem)` }}
|
||||
className="flex h-full -translate-x-2 items-center justify-center rounded-3xl bg-accent text-white transition-all duration-500 ease-out"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -48,8 +52,10 @@ export const BoostProgress = ({
|
||||
<span className="text-lg font-bold text-accent">Lv. {level}</span>
|
||||
<span className="text-lg font-bold text-accent">Lv. {nextLevel}</span>
|
||||
</div>
|
||||
<small className="center mt-1 gap-1">
|
||||
{t("boost.remaining_boosts_to_level_up", { remainingBoostsToLevelUp })}
|
||||
<small className="center mt-2 gap-1">
|
||||
{t("boost.remaining_boosts_to_level_up", {
|
||||
remainingBoostsToLevelUp: numberFormater.format(remainingBoostsToLevelUp),
|
||||
})}
|
||||
</small>
|
||||
{lastValidBoost && (
|
||||
<small className="center mt-1 gap-1">
|
||||
|
||||
@@ -1,47 +1,57 @@
|
||||
import { AutoResizeHeight } from "@follow/components/ui/auto-resize-height/index.js"
|
||||
import { Avatar, AvatarFallback, AvatarImage } from "@follow/components/ui/avatar/index.js"
|
||||
import { m } from "framer-motion"
|
||||
|
||||
import { replaceImgUrlIfNeed } from "~/lib/img-proxy"
|
||||
import { useFeedBoostersQuery } from "~/modules/boost/query"
|
||||
|
||||
import { usePresentUserProfileModal } from "../profile/hooks"
|
||||
import { UserGallery } from "../user/UserGallery"
|
||||
import type { User } from "../user/utils"
|
||||
|
||||
export const BoostingContributors = ({ feedId }: { feedId: string }) => {
|
||||
const { data: boosters, isLoading } = useFeedBoostersQuery(feedId)
|
||||
const presentUserProfile = usePresentUserProfileModal("drawer")
|
||||
if (isLoading || !boosters || boosters.length === 0) return
|
||||
const hasData = !(isLoading || !boosters || boosters.length === 0)
|
||||
|
||||
return (
|
||||
<m.div
|
||||
className="overflow-hidden p-4"
|
||||
initial={{ opacity: 0, height: 0 }}
|
||||
animate={{ opacity: 1, height: "auto" }}
|
||||
exit={{ opacity: 0, height: 0 }}
|
||||
transition={{ duration: 0.3, ease: "easeInOut" }}
|
||||
>
|
||||
<h2 className="mb-4 text-2xl font-bold">Boosting Contributors</h2>
|
||||
<ul className="space-y-4">
|
||||
{boosters
|
||||
.map((user) => (
|
||||
<li
|
||||
key={user.id}
|
||||
role="button"
|
||||
className="flex items-center space-x-4"
|
||||
onClick={() => presentUserProfile(user.id)}
|
||||
>
|
||||
<Avatar className="block aspect-square size-10 overflow-hidden rounded-full border border-border ring-1 ring-background">
|
||||
<AvatarImage src={replaceImgUrlIfNeed(user?.image || undefined)} />
|
||||
<AvatarFallback>{user.name?.slice(0, 2)}</AvatarFallback>
|
||||
</Avatar>
|
||||
<div>
|
||||
<div className="font-semibold">{user.name || user.handle}</div>
|
||||
{user.handle && <div className="text-xs text-gray-500">@{user.handle}</div>}
|
||||
</div>
|
||||
</li>
|
||||
))
|
||||
// TODO use grid layout when there are many boosters
|
||||
.slice(0, 10)}
|
||||
</ul>
|
||||
</m.div>
|
||||
<AutoResizeHeight className="mt-4">
|
||||
{hasData && (
|
||||
<>
|
||||
<h2 className="center mb-4 flex text-xl font-bold">
|
||||
<i className="i-mgc-user-heart-cute-fi mr-1" />
|
||||
Boosting Contributors
|
||||
</h2>
|
||||
<ul className="space-y-4">
|
||||
{boosters.length < 8 ? (
|
||||
boosters.map((user) => (
|
||||
<UserListItem key={user.id} user={user} onClick={presentUserProfile} />
|
||||
))
|
||||
) : (
|
||||
<UserGallery users={boosters} />
|
||||
)}
|
||||
</ul>
|
||||
</>
|
||||
)}
|
||||
</AutoResizeHeight>
|
||||
)
|
||||
}
|
||||
|
||||
const UserListItem = ({ user, onClick }: { user: User; onClick: (userId: string) => void }) => {
|
||||
return (
|
||||
<li
|
||||
key={user.id}
|
||||
role="button"
|
||||
className="flex items-center space-x-4"
|
||||
onClick={() => onClick(user.id)}
|
||||
>
|
||||
<Avatar className="block aspect-square size-10 overflow-hidden rounded-full border border-border ring-1 ring-background">
|
||||
<AvatarImage src={replaceImgUrlIfNeed(user?.image || undefined)} />
|
||||
<AvatarFallback>{user.name?.slice(0, 2)}</AvatarFallback>
|
||||
</Avatar>
|
||||
<div>
|
||||
<div className="font-semibold">{user.name || user.handle}</div>
|
||||
{user.handle && <div className="text-xs text-gray-500">@{user.handle}</div>}
|
||||
</div>
|
||||
</li>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { atom } from "jotai"
|
||||
import { useCallback } from "react"
|
||||
|
||||
import { useAsyncModal } from "~/components/ui/modal/helper/use-async-modal"
|
||||
import { useI18n } from "~/hooks/common"
|
||||
import { createAtomHooks } from "~/lib/jotai"
|
||||
|
||||
import { useFeedBoostMap } from "./atom"
|
||||
import { BoostModalContent } from "./modal"
|
||||
import { useBoostStatusQuery } from "./query"
|
||||
|
||||
@@ -19,7 +18,7 @@ export const useBoostModal = () => {
|
||||
type ResponseType = Awaited<ReturnType<ReturnType<typeof useDataFetcher>["fn"]>>
|
||||
|
||||
present<ResponseType>({
|
||||
id: "boost",
|
||||
id: `boost-${feedId}`,
|
||||
title: t("words.boost"),
|
||||
content: () => <BoostModalContent feedId={feedId} />,
|
||||
overlay: true,
|
||||
@@ -31,15 +30,6 @@ export const useBoostModal = () => {
|
||||
)
|
||||
}
|
||||
|
||||
const [, , useFeedBoostMap, , getFeedBoostMap, setFeedBoostMap] = createAtomHooks(
|
||||
atom<Record<string, boolean>>({}),
|
||||
)
|
||||
|
||||
export const updateFeedBoostStatus = (feedId: string, isBoosted: boolean) => {
|
||||
const prev = getFeedBoostMap()
|
||||
setFeedBoostMap({ ...prev, [feedId]: isBoosted })
|
||||
}
|
||||
|
||||
export const useIsFeedBoosted = (feedId: string) => {
|
||||
const map = useFeedBoostMap()
|
||||
return map[feedId] ?? false
|
||||
|
||||
@@ -2,7 +2,7 @@ import { cn } from "@follow/utils/utils"
|
||||
|
||||
const benefits = [
|
||||
{
|
||||
level: "Lv1",
|
||||
level: 1,
|
||||
benefits: [
|
||||
{
|
||||
icon: "i-mgc-certificate-cute-fi",
|
||||
@@ -14,20 +14,20 @@ const benefits = [
|
||||
],
|
||||
},
|
||||
{
|
||||
level: "Lv2",
|
||||
level: 2,
|
||||
benefits: [
|
||||
{ icon: "i-mgc-rocket-cute-re", text: "Faster feed refresh time", comingSoon: true },
|
||||
],
|
||||
},
|
||||
{
|
||||
level: "Lv3",
|
||||
level: 3,
|
||||
benefits: [
|
||||
{ icon: "i-mgc-eye-2-cute-re", text: "More developer attention" },
|
||||
{ icon: "i-mgc-rocket-cute-re", text: "Faster feed refresh time", comingSoon: true },
|
||||
],
|
||||
},
|
||||
{
|
||||
level: "Lv4",
|
||||
level: 4,
|
||||
benefits: [
|
||||
{ icon: "i-mgc-eye-2-cute-re", text: "More developer attention" },
|
||||
{ icon: "i-mgc-magic-2-cute-re", text: "AI summary for feed", comingSoon: true },
|
||||
@@ -57,7 +57,7 @@ const BoostLevel = ({
|
||||
level,
|
||||
benefits,
|
||||
}: {
|
||||
level: string
|
||||
level: number
|
||||
benefits: { icon?: string; text: string; comingSoon?: boolean }[]
|
||||
}) => {
|
||||
return (
|
||||
@@ -65,7 +65,7 @@ const BoostLevel = ({
|
||||
<div className="flex flex-col">
|
||||
<h3 className="flex items-center gap-2 text-xl font-semibold text-theme-accent">
|
||||
<span className="grow border-t border-gray-300 dark:border-gray-700" />
|
||||
<span>{level}</span>
|
||||
<span>Lv. {level}</span>
|
||||
<span className="grow border-t border-gray-300 dark:border-gray-700" />
|
||||
</h3>
|
||||
<ul className="ml-4 list-inside list-disc space-y-1">
|
||||
|
||||
@@ -9,7 +9,10 @@ import { useCurrentModal } from "~/components/ui/modal/stacked/hooks"
|
||||
import { useI18n } from "~/hooks/common"
|
||||
import { useBoostFeedMutation, useBoostStatusQuery } from "~/modules/boost/query"
|
||||
import { useWallet } from "~/queries/wallet"
|
||||
import { useFeedById } from "~/store/feed"
|
||||
import { feedIconSelector } from "~/store/feed/selector"
|
||||
|
||||
import { FeedIcon } from "../feed/feed-icon"
|
||||
import { BoostProgress } from "./boost-progress"
|
||||
import { BoostingContributors } from "./boosting-contributors"
|
||||
import { LevelBenefits } from "./level-benefits"
|
||||
@@ -36,6 +39,8 @@ export const BoostModalContent = ({ feedId }: { feedId: string }) => {
|
||||
boostFeedMutation.mutate({ feedId, amount: amountBigInt.toString() })
|
||||
}, [amountBigInt, boostFeedMutation, feedId])
|
||||
|
||||
const feed = useFeedById(feedId, feedIconSelector)
|
||||
|
||||
if (isLoading || !boostStatus) {
|
||||
return (
|
||||
<div className="center pointer-events-none grow -translate-y-16">
|
||||
@@ -46,13 +51,19 @@ export const BoostModalContent = ({ feedId }: { feedId: string }) => {
|
||||
|
||||
return (
|
||||
<div className="flex w-[80vw] max-w-[350px] flex-col gap-3">
|
||||
<div className="relative flex w-full grow flex-col items-center gap-3">
|
||||
<div className="mt-4 text-xl font-bold">
|
||||
<i className="i-mgc-rocket-cute-fi mr-1.5 text-lg" />
|
||||
{t("boost.boost_feed")}
|
||||
</div>
|
||||
<div className="center flex flex-col gap-2">
|
||||
<FeedIcon className="mr-0" feed={feed} size={50} />
|
||||
|
||||
<small className="center mt-1 gap-1 text-theme-vibrancyFg">
|
||||
<h1 className="center mt-2 flex text-lg font-bold">
|
||||
<div className="center flex">
|
||||
<i className="i-mgc-rocket-cute-fi mr-1.5 text-lg" />
|
||||
{t("boost.boost_feed")}
|
||||
</div>
|
||||
<span>「{feed?.title}」</span>
|
||||
</h1>
|
||||
</div>
|
||||
<div className="relative flex w-full grow flex-col items-center gap-3">
|
||||
<small className="center -mt-1 mb-2 gap-1 text-theme-vibrancyFg">
|
||||
{t("boost.boost_feed_description")}
|
||||
</small>
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { apiClient } from "~/lib/api-fetch"
|
||||
import { defineQuery } from "~/lib/defineQuery"
|
||||
import { toastFetchError } from "~/lib/error-parser"
|
||||
|
||||
import { updateFeedBoostStatus } from "./hooks"
|
||||
import { updateFeedBoostStatus } from "./atom"
|
||||
|
||||
const query = {
|
||||
getStatus: ({ feedId }: { feedId: string }) =>
|
||||
|
||||
@@ -32,7 +32,7 @@ export const RadioCards = ({
|
||||
return (
|
||||
<RadioGroup value={value.toString()} onValueChange={(value) => onValueChange(+value)}>
|
||||
<m.div
|
||||
className="grid w-full grid-cols-2 gap-2 overflow-hidden"
|
||||
className="grid w-full grid-cols-2 gap-2"
|
||||
initial={{ height: "auto", opacity: 0 }}
|
||||
animate={{ height: "auto", opacity: 1 }}
|
||||
exit={{ height: 0, opacity: 0 }}
|
||||
@@ -44,11 +44,11 @@ export const RadioCards = ({
|
||||
wrapperClassName="justify-center"
|
||||
value={(item.value * monthlyBoostCost).toString()}
|
||||
label={
|
||||
<div>
|
||||
<h3 className="pr-3 font-medium leading-none">
|
||||
<div className="text-center">
|
||||
<h3 className="text-sm font-medium leading-none">
|
||||
{dayjs.duration(item.value, "months").humanize()}
|
||||
</h3>
|
||||
<p className="mt-1 flex items-center justify-center gap-1 text-sm text-theme-vibrancyFg">
|
||||
<p className="mt-0.5 flex items-center justify-center gap-1 text-sm text-theme-vibrancyFg">
|
||||
{item.value * monthlyBoostCost}
|
||||
<i className="i-mgc-power text-accent" />
|
||||
</p>
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
class Registry {
|
||||
private actions: Record<string, () => void> = {}
|
||||
|
||||
add(key: string, action: () => void) {
|
||||
this.actions[key] = action
|
||||
|
||||
return () => {
|
||||
delete this.actions[key]
|
||||
}
|
||||
}
|
||||
|
||||
remove(key: string) {
|
||||
delete this.actions[key]
|
||||
}
|
||||
|
||||
getAll() {
|
||||
return this.actions
|
||||
}
|
||||
|
||||
get(key: string) {
|
||||
return this.actions[key]
|
||||
}
|
||||
}
|
||||
|
||||
export const DebugRegistry = new Registry()
|
||||
@@ -310,9 +310,10 @@ export const DiscoverFeedForm = ({
|
||||
<Input
|
||||
{...form.register(`${routeParamsKeyPrefix}${key}`)}
|
||||
placeholder={value.default}
|
||||
className="grow-0"
|
||||
/>
|
||||
{!!value.description && (
|
||||
<Markdown className="w-full max-w-full text-xs text-theme-foreground/5">
|
||||
<Markdown className="w-full max-w-full text-xs text-theme-foreground/50">
|
||||
{value.description}
|
||||
</Markdown>
|
||||
)}
|
||||
|
||||
@@ -361,7 +361,7 @@ const FeedInnerForm = ({
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<div className="absolute inset-x-0 bottom-0 flex flex-1 items-end justify-end gap-4 bg-theme-background p-4">
|
||||
<div className="absolute inset-x-0 bottom-0 flex flex-1 items-center justify-end gap-4 bg-theme-background p-4">
|
||||
{isSubscribed && (
|
||||
<Button
|
||||
type="button"
|
||||
|
||||
@@ -12,13 +12,13 @@ import { Input } from "@follow/components/ui/input/index.js"
|
||||
import { Radio } from "@follow/components/ui/radio-group/index.js"
|
||||
import { RadioGroup } from "@follow/components/ui/radio-group/RadioGroup.jsx"
|
||||
import type { FeedViewType } from "@follow/constants"
|
||||
import { getBackgroundGradient } from "@follow/utils/color"
|
||||
import { zodResolver } from "@hookform/resolvers/zod"
|
||||
import { useMutation } from "@tanstack/react-query"
|
||||
import { useSingleton } from "foxact/use-singleton"
|
||||
import { produce } from "immer"
|
||||
import { atom, useAtomValue, useStore } from "jotai"
|
||||
import type { FC } from "react"
|
||||
import { memo, useCallback, useEffect } from "react"
|
||||
import { memo, useCallback, useEffect, useState } from "react"
|
||||
import { useForm } from "react-hook-form"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { z } from "zod"
|
||||
@@ -90,7 +90,7 @@ export function DiscoverForm({ type = "search" }: { type?: string }) {
|
||||
return data
|
||||
},
|
||||
})
|
||||
const discoverSearchDataAtom = useSingleton(() => atom<DiscoverSearchData>()).current
|
||||
const discoverSearchDataAtom = useState(() => atom<DiscoverSearchData>())[0]
|
||||
|
||||
const discoverSearchData = useAtomValue(discoverSearchDataAtom)
|
||||
|
||||
@@ -300,18 +300,7 @@ const SearchCard: FC<{
|
||||
className="flex min-w-0 flex-1 flex-col items-center gap-1"
|
||||
rel="noreferrer"
|
||||
>
|
||||
{assertEntry.media?.[0] ? (
|
||||
<Media
|
||||
src={assertEntry.media?.[0].url}
|
||||
type={assertEntry.media?.[0].type}
|
||||
previewImageUrl={assertEntry.media?.[0].preview_image_url}
|
||||
className="aspect-square w-full"
|
||||
/>
|
||||
) : (
|
||||
<div className="flex aspect-square w-full overflow-hidden rounded bg-stone-100 p-2 text-xs leading-tight text-zinc-500">
|
||||
{assertEntry.title}
|
||||
</div>
|
||||
)}
|
||||
<FeedCardMediaThumbnail entry={assertEntry} />
|
||||
<div className="line-clamp-2 w-full text-xs leading-tight">
|
||||
{assertEntry.title}
|
||||
</div>
|
||||
@@ -352,3 +341,26 @@ const SearchCard: FC<{
|
||||
</Card>
|
||||
)
|
||||
})
|
||||
|
||||
const FeedCardMediaThumbnail: FC<{
|
||||
entry: NonUndefined<DiscoverSearchData[number]["entries"]>[number]
|
||||
}> = ({ entry }) => {
|
||||
const [, , , bgAccent, bgAccentLight, bgAccentUltraLight] = getBackgroundGradient(entry.title)
|
||||
return entry.media?.[0] ? (
|
||||
<Media
|
||||
src={entry.media?.[0].url}
|
||||
type={entry.media?.[0].type}
|
||||
previewImageUrl={entry.media?.[0].preview_image_url}
|
||||
className="aspect-square w-full"
|
||||
/>
|
||||
) : (
|
||||
<div
|
||||
className="relative flex aspect-square w-full items-end overflow-hidden rounded p-2 text-xs leading-tight text-zinc-900"
|
||||
style={{
|
||||
background: `linear-gradient(37deg, ${bgAccent} 27.82%, ${bgAccentLight} 79.68%, ${bgAccentUltraLight} 100%)`,
|
||||
}}
|
||||
>
|
||||
<div className="line-clamp-2 text-right font-medium">{entry.title}</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
import { useInputComposition, useIsDark } from "@follow/hooks"
|
||||
import { nextFrame } from "@follow/utils/dom"
|
||||
import { cn } from "@follow/utils/utils"
|
||||
import { createPlainShiki } from "plain-shiki"
|
||||
import { useLayoutEffect, useRef } from "react"
|
||||
import css from "shiki/langs/css.mjs"
|
||||
import githubDark from "shiki/themes/github-dark.mjs"
|
||||
import githubLight from "shiki/themes/github-light.mjs"
|
||||
|
||||
import { shiki } from "~/components/ui/code-highlighter/shiki/shared"
|
||||
|
||||
shiki.loadLanguageSync(css)
|
||||
shiki.loadThemeSync(githubDark)
|
||||
shiki.loadThemeSync(githubLight)
|
||||
export const CSSEditor: Component<{
|
||||
onChange: (value: string) => void
|
||||
defaultValue?: string
|
||||
}> = ({ onChange, className, defaultValue }) => {
|
||||
const ref = useRef<HTMLDivElement>(null)
|
||||
|
||||
const isDark = useIsDark()
|
||||
useLayoutEffect(() => {
|
||||
let dispose: () => void
|
||||
if (ref.current) {
|
||||
ref.current.focus()
|
||||
// Move cursor to the end of the content
|
||||
const selection = window.getSelection()
|
||||
const range = document.createRange()
|
||||
range.selectNodeContents(ref.current)
|
||||
range.collapse(false)
|
||||
selection?.removeAllRanges()
|
||||
selection?.addRange(range)
|
||||
|
||||
ref.current.textContent = defaultValue ?? ""
|
||||
const { dispose: disposeShiki } = createPlainShiki(shiki).mount(ref.current, {
|
||||
lang: "css",
|
||||
themes: {
|
||||
light: "github-light",
|
||||
dark: "github-dark",
|
||||
},
|
||||
defaultTheme: isDark ? "dark" : "light",
|
||||
})
|
||||
dispose = disposeShiki
|
||||
}
|
||||
return () => dispose?.()
|
||||
}, [isDark])
|
||||
const props = useInputComposition<HTMLInputElement>({
|
||||
onKeyDown: (e) => {
|
||||
if (e.key === "Escape") {
|
||||
e.preventDefault()
|
||||
}
|
||||
if (e.key === "Tab") {
|
||||
e.preventDefault()
|
||||
const selection = window.getSelection()
|
||||
if (selection && selection.rangeCount > 0) {
|
||||
const range = selection.getRangeAt(0)
|
||||
const tabNode = document.createTextNode("\u00A0\u00A0\u00A0\u00A0") // Using four non-breaking spaces as a tab
|
||||
range.insertNode(tabNode)
|
||||
range.setStartAfter(tabNode)
|
||||
range.setEndAfter(tabNode)
|
||||
selection.removeAllRanges()
|
||||
selection.addRange(range)
|
||||
}
|
||||
}
|
||||
nextFrame(() => {
|
||||
onChange(ref.current?.textContent ?? "")
|
||||
})
|
||||
},
|
||||
})
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
"size-full",
|
||||
|
||||
"ring-accent/20 duration-200 focus:border-accent/80 focus:outline-none focus:ring-2",
|
||||
"focus:!bg-accent/5",
|
||||
"border border-border",
|
||||
"placeholder:text-theme-placeholder-text dark:bg-zinc-700/[0.15] dark:text-zinc-200",
|
||||
"hover:border-accent/60",
|
||||
className,
|
||||
)}
|
||||
ref={ref}
|
||||
contentEditable
|
||||
tabIndex={0}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import { RelativeTime } from "~/components/ui/datetime"
|
||||
import { Media } from "~/components/ui/media"
|
||||
import { ListItem } from "~/modules/entry-column/templates/list-item-template"
|
||||
import { FeedIcon } from "~/modules/feed/feed-icon"
|
||||
import { FeedTitle } from "~/modules/feed/feed-title"
|
||||
|
||||
import type { EntryItemStatelessProps, UniversalItemProps } from "../types"
|
||||
|
||||
@@ -21,7 +22,7 @@ export function ArticleItemStateLess({ entry, feed }: EntryItemStatelessProps) {
|
||||
<FeedIcon className="mr-2 size-5 rounded-sm" feed={feed} fallback />
|
||||
<div className="-mt-0.5 line-clamp-4 flex-1 text-sm leading-tight">
|
||||
<div className="flex gap-1 text-[10px] font-bold text-zinc-400 dark:text-neutral-500">
|
||||
<span>{feed.title}</span>
|
||||
<FeedTitle feed={feed} />
|
||||
<span>·</span>
|
||||
<span>{!!entry.publishedAt && <RelativeTime date={entry.publishedAt} />}</span>
|
||||
</div>
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Skeleton } from "@follow/components/ui/skeleton/index.jsx"
|
||||
import { RelativeTime } from "~/components/ui/datetime"
|
||||
import { Media } from "~/components/ui/media"
|
||||
import { ListItem } from "~/modules/entry-column/templates/list-item-template"
|
||||
import { FeedTitle } from "~/modules/feed/feed-title"
|
||||
|
||||
import type { EntryItemStatelessProps, UniversalItemProps } from "../types"
|
||||
|
||||
@@ -19,7 +20,7 @@ export function AudioItemStateLess({ entry, feed }: EntryItemStatelessProps) {
|
||||
<div className="group relative flex py-4 pl-3 pr-2">
|
||||
<div className="-mt-0.5 line-clamp-4 flex-1 text-sm leading-tight">
|
||||
<div className="flex gap-1 text-[10px] font-bold text-zinc-400 dark:text-neutral-500">
|
||||
<span>{feed.title}</span>
|
||||
<FeedTitle feed={feed} />
|
||||
<span>·</span>
|
||||
<span>{!!entry.publishedAt && <RelativeTime date={entry.publishedAt} />}</span>
|
||||
</div>
|
||||
|
||||
@@ -3,13 +3,12 @@ import { Skeleton } from "@follow/components/ui/skeleton/index.jsx"
|
||||
import { RelativeTime } from "~/components/ui/datetime"
|
||||
import { ListItem } from "~/modules/entry-column/templates/list-item-template"
|
||||
import { FeedIcon } from "~/modules/feed/feed-icon"
|
||||
import { FeedTitle } from "~/modules/feed/feed-title"
|
||||
|
||||
import type { EntryItemStatelessProps, UniversalItemProps } from "../types"
|
||||
|
||||
export function NotificationItem({ entryId, entryPreview, translation }: UniversalItemProps) {
|
||||
return (
|
||||
<ListItem entryId={entryId} entryPreview={entryPreview} translation={translation} withFollow />
|
||||
)
|
||||
return <ListItem entryId={entryId} entryPreview={entryPreview} translation={translation} />
|
||||
}
|
||||
|
||||
export function NotificationItemStateLess({ entry, feed }: EntryItemStatelessProps) {
|
||||
@@ -20,7 +19,7 @@ export function NotificationItemStateLess({ entry, feed }: EntryItemStatelessPro
|
||||
|
||||
<div className="-mt-0.5 line-clamp-4 flex-1 text-sm leading-tight">
|
||||
<div className="flex gap-1 text-[10px] font-bold text-zinc-400 dark:text-neutral-500">
|
||||
<span>{feed.title}</span>
|
||||
<FeedTitle feed={feed} />
|
||||
<span>·</span>
|
||||
<span>{!!entry.publishedAt && <RelativeTime date={entry.publishedAt} />}</span>
|
||||
</div>
|
||||
|
||||
@@ -14,6 +14,7 @@ import { useRouteParamsSelector } from "~/hooks/biz/useRouteParams"
|
||||
import { filterSmallMedia } from "~/lib/utils"
|
||||
import { EntryContent } from "~/modules/entry-content"
|
||||
import { FeedIcon } from "~/modules/feed/feed-icon"
|
||||
import { FeedTitle } from "~/modules/feed/feed-title"
|
||||
import { useEntry } from "~/store/entry/hooks"
|
||||
import { useImageDimensions } from "~/store/image"
|
||||
|
||||
@@ -241,7 +242,7 @@ export function PictureItemStateLess({ entry, feed }: EntryItemStatelessProps) {
|
||||
</div>
|
||||
<div className="mt-1 flex items-center gap-1 truncate text-[13px]">
|
||||
<FeedIcon feed={feed} fallback className="size-4" />
|
||||
<span>{feed.title}</span>
|
||||
<FeedTitle feed={feed} />
|
||||
<span className="text-zinc-500">·</span>
|
||||
{!!entry.publishedAt && <RelativeTime date={entry.publishedAt} />}
|
||||
</div>
|
||||
|
||||
@@ -3,7 +3,6 @@ import { useScrollViewElement } from "@follow/components/ui/scroll-area/hooks.js
|
||||
import { Skeleton } from "@follow/components/ui/skeleton/index.jsx"
|
||||
import { useRefValue } from "@follow/hooks"
|
||||
import { nextFrame } from "@follow/utils/dom"
|
||||
import { useSingleton } from "foxact/use-singleton"
|
||||
import { throttle } from "lodash-es"
|
||||
import type { RenderComponentProps } from "masonic"
|
||||
import { useInfiniteLoader } from "masonic"
|
||||
@@ -60,7 +59,7 @@ const gutter = 24
|
||||
|
||||
export const PictureMasonry: FC<MasonryProps> = (props) => {
|
||||
const { data } = props
|
||||
const cacheMap = useSingleton(() => new Map<string, object>()).current
|
||||
const cacheMap = useState(() => new Map<string, object>())[0]
|
||||
const [isInitDim, setIsInitDim] = useState(false)
|
||||
const [isInitLayout, setIsInitLayout] = useState(false)
|
||||
const [currentItemWidth, setCurrentItemWidth] = useState(0)
|
||||
@@ -277,7 +276,7 @@ interface MasonryProps {
|
||||
|
||||
const LoadingSkeletonItem = () => {
|
||||
// random height, between 100-400px
|
||||
const randomHeight = useSingleton(() => Math.random() * 300 + 100).current
|
||||
const randomHeight = useState(() => Math.random() * 300 + 100)[0]
|
||||
return (
|
||||
<div className="relative flex gap-2 overflow-x-auto">
|
||||
<div
|
||||
|
||||
@@ -15,6 +15,7 @@ import { getImageProxyUrl } from "~/lib/img-proxy"
|
||||
import { jotaiStore } from "~/lib/jotai"
|
||||
import { parseSocialMedia } from "~/lib/parsers"
|
||||
import { FeedIcon } from "~/modules/feed/feed-icon"
|
||||
import { FeedTitle } from "~/modules/feed/feed-title"
|
||||
import { useEntry } from "~/store/entry/hooks"
|
||||
import { useFeedById } from "~/store/feed"
|
||||
|
||||
@@ -62,7 +63,7 @@ export const SocialMediaItem: EntryListItemFC = ({ entryId, entryPreview, transl
|
||||
<div className="-mt-0.5 flex-1 text-sm">
|
||||
<div className="w-[calc(100%-10rem)] space-x-1 leading-6">
|
||||
<span className="inline-flex items-center gap-1 text-base font-semibold">
|
||||
<span>{entry.entries.author || feed.title}</span>
|
||||
<FeedTitle feed={feed} title={entry.entries.author || feed.title} />
|
||||
{parsed?.type === "x" && (
|
||||
<i className="i-mgc-twitter-cute-fi size-3 text-[#4A99E9]" />
|
||||
)}
|
||||
@@ -210,7 +211,7 @@ export function SocialMediaItemStateLess({ entry, feed }: EntryItemStatelessProp
|
||||
<div className="ml-2 min-w-0 flex-1">
|
||||
<div className="-mt-0.5 line-clamp-5 flex-1 text-sm">
|
||||
<div className="flex space-x-1">
|
||||
<span>{feed.title}</span>
|
||||
<FeedTitle feed={feed} />
|
||||
<span className="text-zinc-500">·</span>
|
||||
<span>{!!entry.publishedAt && <RelativeTime date={entry.publishedAt} />}</span>
|
||||
</div>
|
||||
|
||||
@@ -16,6 +16,7 @@ import { useModalStack } from "~/components/ui/modal/stacked/hooks"
|
||||
import { useRouteParamsSelector } from "~/hooks/biz/useRouteParams"
|
||||
import { urlToIframe } from "~/lib/url-to-iframe"
|
||||
import { FeedIcon } from "~/modules/feed/feed-icon"
|
||||
import { FeedTitle } from "~/modules/feed/feed-title"
|
||||
import { useEntry } from "~/store/entry/hooks"
|
||||
|
||||
import { ReactVirtuosoItemPlaceholder } from "../../../components/ui/placeholder"
|
||||
@@ -137,7 +138,7 @@ const PreviewVideoModalContent: ModalContentComponent<{
|
||||
exit={{
|
||||
opacity: 0,
|
||||
}}
|
||||
className="fixed right-3 top-2 flex items-center gap-4"
|
||||
className="fixed right-4 flex items-center safe-inset-top-4"
|
||||
>
|
||||
<FixedModalCloseButton onClick={dismiss} />
|
||||
</m.div>
|
||||
@@ -182,7 +183,7 @@ export function VideoItemStateLess({ entry, feed }: EntryItemStatelessProps) {
|
||||
</div>
|
||||
<div className="mt-1 flex items-center gap-1 truncate text-[13px]">
|
||||
<FeedIcon feed={feed} fallback className="size-4" />
|
||||
<span>{feed.title}</span>
|
||||
<FeedTitle feed={feed} />
|
||||
<span className="text-zinc-500">·</span>
|
||||
{!!entry.publishedAt && <RelativeTime date={entry.publishedAt} />}
|
||||
</div>
|
||||
|
||||
@@ -65,7 +65,7 @@ const useSticky = () => {
|
||||
export const DateItem = memo(({ date, view }: { date: string; view: FeedViewType }) => {
|
||||
const className = cn(
|
||||
"pt-2",
|
||||
`relative z-10 -mx-2 flex items-center gap-1 bg-background px-4 text-base font-bold text-zinc-800 dark:text-neutral-400`,
|
||||
`relative -mx-2 flex items-center gap-1 bg-background px-4 text-base font-bold text-zinc-800 dark:text-neutral-400`,
|
||||
)
|
||||
|
||||
if (view === FeedViewType.SocialMedia) {
|
||||
|
||||
@@ -49,6 +49,7 @@ export const useEntryMarkReadHandler = (entriesIds: string[]) => {
|
||||
return
|
||||
}, [feedView, handleMarkReadInRange, handleRenderAsRead, renderAsRead, scrollMarkUnread])
|
||||
}
|
||||
const anyString = [] as string[]
|
||||
export const useEntriesByView = ({
|
||||
onReset,
|
||||
isArchived,
|
||||
@@ -103,16 +104,15 @@ export const useEntriesByView = ({
|
||||
setPauseQuery(hasUpdate)
|
||||
}, [hasUpdate])
|
||||
|
||||
const remoteEntryIds = useMemo(
|
||||
() =>
|
||||
// FIXME The back end should not return duplicate data, and the front end the unique id here.
|
||||
[
|
||||
...new Set(
|
||||
query.data?.pages?.map((page) => page.data?.map((entry) => entry.entries.id)).flat(),
|
||||
).values(),
|
||||
] as string[],
|
||||
[query.data?.pages],
|
||||
)
|
||||
const remoteEntryIds = useMemo(() => {
|
||||
if (!query.data?.pages) return void 0
|
||||
// FIXME The back end should not return duplicate data, and the front end the unique id here.
|
||||
return [
|
||||
...new Set(
|
||||
query.data?.pages?.map((page) => page.data?.map((entry) => entry.entries.id)).flat(),
|
||||
).values(),
|
||||
] as string[]
|
||||
}, [query.data?.pages])
|
||||
|
||||
const currentEntries = useEntryIdsByFeedIdOrView(isAllFeeds ? view : folderIds || feedId!, {
|
||||
unread: unreadOnly,
|
||||
@@ -126,7 +126,7 @@ export const useEntriesByView = ({
|
||||
// then we have no way to incrementally update the data.
|
||||
// We need to add an interface to incrementally update the data based on the version hash.
|
||||
|
||||
const entryIds = remoteEntryIds || currentEntries
|
||||
const entryIds: string[] = remoteEntryIds || currentEntries || anyString
|
||||
|
||||
// in unread only entries only can grow the data, but not shrink
|
||||
// so we memo this previous data to avoid the flicker
|
||||
@@ -135,12 +135,15 @@ export const useEntriesByView = ({
|
||||
const isFetchingFirstPage = query.isFetching && !query.isFetchingNextPage
|
||||
|
||||
useEffect(() => {
|
||||
if (isArchived) {
|
||||
return
|
||||
}
|
||||
if (!isFetchingFirstPage) {
|
||||
prevEntryIdsRef.current = entryIds
|
||||
setMergedEntries({ ...mergedEntries, [view]: entryIds })
|
||||
onReset?.()
|
||||
}
|
||||
}, [isFetchingFirstPage])
|
||||
}, [isFetchingFirstPage, isArchived])
|
||||
|
||||
const [mergedEntries, setMergedEntries] = useState<Record<number, string[]>>({
|
||||
0: [],
|
||||
@@ -207,7 +210,7 @@ export const useEntriesByView = ({
|
||||
}
|
||||
|
||||
return counts
|
||||
}, [groupByDate, sortEntries, view])
|
||||
}, [groupByDate, listId, sortEntries, view])
|
||||
|
||||
return {
|
||||
...query,
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import { atom, useAtomValue, useSetAtom } from "jotai"
|
||||
import { useEffect, useMemo, useState } from "react"
|
||||
|
||||
/**
|
||||
* This is a global atom to store the current entry column's entry id list snapshot.
|
||||
* It used to get current entry id list(keep sorted) in other components.
|
||||
*/
|
||||
const globalEntryIdListSnapAtom = atom<string[]>([])
|
||||
export const useSnapEntryIdList = (ids: string[]) => {
|
||||
const set = useSetAtom(globalEntryIdListSnapAtom)
|
||||
useEffect(() => {
|
||||
set(ids)
|
||||
}, [ids, set])
|
||||
}
|
||||
|
||||
export const useGetEntryIdInRange = (id: string, range: [number, number]) => {
|
||||
const snap = useAtomValue(globalEntryIdListSnapAtom)
|
||||
const [stableRange] = useState(range)
|
||||
return useMemo(() => {
|
||||
const index = snap.indexOf(id)
|
||||
|
||||
return snap.slice(
|
||||
Math.max(0, index - stableRange[0]),
|
||||
Math.min(snap.length, index + stableRange[1]),
|
||||
)
|
||||
}, [id, snap, stableRange])
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import { ScrollArea } from "@follow/components/ui/scroll-area/index.js"
|
||||
import { FeedViewType, views } from "@follow/constants"
|
||||
import { useTitle, useTypeScriptHappyCallback } from "@follow/hooks"
|
||||
import type { FeedModel } from "@follow/models/types"
|
||||
import { clsx, cn, isBizId } from "@follow/utils/utils"
|
||||
import { clsx, isBizId } from "@follow/utils/utils"
|
||||
import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import type {
|
||||
@@ -31,6 +31,7 @@ import { useFeedById, useFeedHeaderTitle } from "~/store/feed"
|
||||
import { useSubscriptionByFeedId } from "~/store/subscription"
|
||||
|
||||
import { useEntriesByView, useEntryMarkReadHandler } from "./hooks"
|
||||
import { useSnapEntryIdList } from "./hooks/useEntryIdListSnap"
|
||||
import { EntryItem, EntryItemSkeleton } from "./item"
|
||||
import { PictureMasonry } from "./Items/picture-masonry"
|
||||
import { EntryListHeader } from "./layouts/EntryListHeader"
|
||||
@@ -51,11 +52,19 @@ function EntryColumnImpl() {
|
||||
virtuosoRef.current?.scrollTo({
|
||||
top: 0,
|
||||
})
|
||||
setIsArchived(false)
|
||||
}, []),
|
||||
isArchived,
|
||||
})
|
||||
|
||||
const { entriesIds, isFetchingNextPage, groupedCounts } = entries
|
||||
useSnapEntryIdList(entriesIds)
|
||||
const prevEntriesIdsRef = useRef(entriesIds)
|
||||
|
||||
useEffect(() => {
|
||||
if (entriesIds.length > 0) {
|
||||
prevEntriesIdsRef.current = entriesIds
|
||||
}
|
||||
}, [entriesIds])
|
||||
|
||||
const {
|
||||
entryId: activeEntryId,
|
||||
@@ -63,7 +72,14 @@ function EntryColumnImpl() {
|
||||
feedId: routeFeedId,
|
||||
isPendingEntry,
|
||||
isCollection,
|
||||
inboxId,
|
||||
listId,
|
||||
} = useRouteParams()
|
||||
|
||||
useEffect(() => {
|
||||
setIsArchived(false)
|
||||
}, [view, routeFeedId])
|
||||
|
||||
const activeEntry = useEntry(activeEntryId)
|
||||
const feed = useFeedById(routeFeedId)
|
||||
const title = useFeedHeaderTitle()
|
||||
@@ -94,13 +110,27 @@ function EntryColumnImpl() {
|
||||
}
|
||||
}, [isArchived])
|
||||
|
||||
const showArchivedButton =
|
||||
!isArchived &&
|
||||
!unreadOnly &&
|
||||
!isCollection &&
|
||||
routeFeedId !== ROUTE_FEED_PENDING &&
|
||||
entries.totalCount < 40 &&
|
||||
feed?.type === "feed"
|
||||
// Common conditions for both showArchivedButton and shouldLoadArchivedEntries
|
||||
const commonConditions =
|
||||
!isArchived && !unreadOnly && !isCollection && routeFeedId !== ROUTE_FEED_PENDING
|
||||
|
||||
// Determine if the archived button should be shown
|
||||
const showArchivedButton = commonConditions && entries.totalCount < 40 && feed?.type === "feed"
|
||||
const hasNoEntries = entries.totalCount === 0 && !entries.isLoading
|
||||
|
||||
// Determine if archived entries should be loaded
|
||||
const shouldLoadArchivedEntries =
|
||||
commonConditions && (feed?.type === "feed" || !feed) && !inboxId && !listId && hasNoEntries
|
||||
|
||||
// automatically fetch archived entries when there is no entries in timeline
|
||||
useEffect(() => {
|
||||
if (shouldLoadArchivedEntries) {
|
||||
setIsArchived(true)
|
||||
}
|
||||
}, [shouldLoadArchivedEntries])
|
||||
|
||||
const finalEntriesIds =
|
||||
hasNoEntries && !isArchived ? prevEntriesIdsRef.current || entriesIds : entriesIds
|
||||
|
||||
const scrollRef = useRef<HTMLDivElement>(null)
|
||||
const virtuosoOptions = {
|
||||
@@ -150,7 +180,7 @@ function EntryColumnImpl() {
|
||||
}
|
||||
}
|
||||
}, [entries]),
|
||||
data: entriesIds,
|
||||
data: finalEntriesIds,
|
||||
onScroll: () => {
|
||||
if (!isInteracted.current) {
|
||||
isInteracted.current = true
|
||||
@@ -200,13 +230,13 @@ function EntryColumnImpl() {
|
||||
</AutoResizeHeight>
|
||||
<m.div
|
||||
key={`${routeFeedId}-${view}`}
|
||||
className="relative h-0 grow"
|
||||
className="relative mt-2 h-0 grow"
|
||||
initial={{ opacity: 0.01, y: 100 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
exit={{ opacity: 0.01, y: -100 }}
|
||||
>
|
||||
<ScrollArea.ScrollArea
|
||||
scrollbarClassName={cn("mt-3", !views[view].wideMode ? "w-[5px] p-0" : "")}
|
||||
scrollbarClassName={!views[view].wideMode ? "w-[5px] p-0" : ""}
|
||||
mask={false}
|
||||
ref={scrollRef}
|
||||
rootClassName={clsx("h-full", views[view].wideMode ? "mt-2" : "")}
|
||||
|
||||
@@ -52,6 +52,7 @@ function EntryItemImpl({ entry, view }: { entry: FlatEntryModel; view?: number }
|
||||
|
||||
export const EntryItem: FC<EntryItemProps> = memo(({ entryId, view }) => {
|
||||
const entry = useEntry(entryId)
|
||||
|
||||
if (!entry) return <ReactVirtuosoItemPlaceholder />
|
||||
return <EntryItemImpl entry={entry} view={view} />
|
||||
})
|
||||
|
||||
@@ -25,14 +25,16 @@ export const EntryItemWrapper: FC<
|
||||
style?: React.CSSProperties
|
||||
} & PropsWithChildren
|
||||
> = ({ entry, view, children, itemClassName, style }) => {
|
||||
const listId = useRouteParamsSelector((s) => s.listId)
|
||||
const { items } = useEntryActions({
|
||||
view,
|
||||
entry,
|
||||
type: "entryList",
|
||||
inList: !!listId,
|
||||
})
|
||||
|
||||
const { items: feedItems } = useFeedActions({
|
||||
feedId: entry.feedId,
|
||||
feedId: entry.feedId || entry.inboxId,
|
||||
view,
|
||||
type: "entryList",
|
||||
})
|
||||
@@ -74,7 +76,7 @@ export const EntryItemWrapper: FC<
|
||||
[entry.entries.url],
|
||||
)
|
||||
const [isContextMenuOpen, setIsContextMenuOpen] = useState(false)
|
||||
useAnyPointDown(() => setIsContextMenuOpen(false))
|
||||
useAnyPointDown(() => isContextMenuOpen && setIsContextMenuOpen(false))
|
||||
const handleContextMenu: React.MouseEventHandler<HTMLDivElement> = useCallback(
|
||||
(e) => {
|
||||
e.preventDefault()
|
||||
|
||||
@@ -15,7 +15,7 @@ import { setGeneralSetting, useGeneralSettingKey } from "~/atoms/settings/genera
|
||||
import { setUISetting, useUISettingKey } from "~/atoms/settings/ui"
|
||||
import { useWhoami } from "~/atoms/user"
|
||||
import { ImpressionView } from "~/components/common/ImpressionTracker"
|
||||
import { FEED_COLLECTION_LIST, ROUTE_ENTRY_PENDING } from "~/constants"
|
||||
import { FEED_COLLECTION_LIST, ROUTE_ENTRY_PENDING, ROUTE_FEED_IN_LIST } from "~/constants"
|
||||
import { shortcuts } from "~/constants/shortcuts"
|
||||
import { useRouteParams } from "~/hooks/biz/useRouteParams"
|
||||
import { useAIDailyReportModal } from "~/modules/ai/ai-daily/useAIDailyReportModal"
|
||||
@@ -42,7 +42,8 @@ export const EntryListHeader: FC<{
|
||||
const os = getOS()
|
||||
|
||||
const titleAtBottom = IN_ELECTRON && os === "macOS"
|
||||
const isInCollectionList = feedId === FEED_COLLECTION_LIST
|
||||
const isInCollectionList =
|
||||
feedId === FEED_COLLECTION_LIST || feedId?.startsWith(ROUTE_FEED_IN_LIST)
|
||||
|
||||
const titleInfo = !!headerTitle && (
|
||||
<div className={!titleAtBottom ? "min-w-0 translate-y-1" : void 0}>
|
||||
|
||||
@@ -96,6 +96,7 @@ const EntryGroupedList = forwardRef<
|
||||
}
|
||||
>(({ groupCounts, itemContent, onKeyDown, data, totalCount, ...virtuosoOptions }, ref) => (
|
||||
<GroupedVirtuoso
|
||||
className="z-0"
|
||||
ref={ref}
|
||||
groupContent={useCallback(
|
||||
(index: number) => {
|
||||
|
||||
@@ -6,8 +6,9 @@ import { ReactVirtuosoItemPlaceholder } from "~/components/ui/placeholder"
|
||||
import { useAsRead } from "~/hooks/biz/useAsRead"
|
||||
import { EntryTranslation } from "~/modules/entry-column/translation"
|
||||
import { FeedIcon } from "~/modules/feed/feed-icon"
|
||||
import { FeedTitle } from "~/modules/feed/feed-title"
|
||||
import { useEntry } from "~/store/entry/hooks"
|
||||
import { getPreferredTitle, useFeedById } from "~/store/feed"
|
||||
import { useFeedById } from "~/store/feed"
|
||||
|
||||
import { StarIcon } from "../star-icon"
|
||||
import type { UniversalItemProps } from "../types"
|
||||
@@ -78,7 +79,7 @@ export const GridItemFooter = ({
|
||||
<div className="flex items-center gap-1 truncate text-[13px]">
|
||||
<FeedIcon fallback className="mr-0.5 flex" feed={feeds!} entry={entry.entries} size={18} />
|
||||
<span className={cn("min-w-0 truncate", descriptionClassName)}>
|
||||
{getPreferredTitle(feeds)}
|
||||
<FeedTitle feed={feeds} />
|
||||
</span>
|
||||
<span className={cn("text-zinc-500", timeClassName)}>·</span>
|
||||
<span className={cn("text-zinc-500", timeClassName)}>
|
||||
|
||||
@@ -1,25 +1,21 @@
|
||||
import { FollowIcon } from "@follow/components/icons/follow.jsx"
|
||||
import { Button } from "@follow/components/ui/button/index.js"
|
||||
import { EllipsisHorizontalTextWithTooltip } from "@follow/components/ui/typography/index.js"
|
||||
import { UrlBuilder } from "@follow/utils/url-builder"
|
||||
import { cn, isSafari } from "@follow/utils/utils"
|
||||
import { useDebounceCallback } from "usehooks-ts"
|
||||
|
||||
import { AudioPlayer, useAudioPlayerAtomSelector } from "~/atoms/player"
|
||||
import { useUISettingKey } from "~/atoms/settings/ui"
|
||||
import { useUISettingKeys } from "~/atoms/settings/ui"
|
||||
import { RelativeTime } from "~/components/ui/datetime"
|
||||
import { Media } from "~/components/ui/media"
|
||||
import { useModalStack } from "~/components/ui/modal/stacked/hooks"
|
||||
import { FEED_COLLECTION_LIST } from "~/constants"
|
||||
import { useAsRead } from "~/hooks/biz/useAsRead"
|
||||
import { useRouteParamsSelector } from "~/hooks/biz/useRouteParams"
|
||||
import { FeedForm } from "~/modules/discover/feed-form"
|
||||
import { EntryTranslation } from "~/modules/entry-column/translation"
|
||||
import { FeedIcon } from "~/modules/feed/feed-icon"
|
||||
import { FeedTitle } from "~/modules/feed/feed-title"
|
||||
import { Queries } from "~/queries"
|
||||
import { useEntry } from "~/store/entry/hooks"
|
||||
import { getPreferredTitle, useFeedById } from "~/store/feed"
|
||||
import { useSubscriptionStore } from "~/store/subscription"
|
||||
import { useInboxById } from "~/store/inbox"
|
||||
|
||||
import { ReactVirtuosoItemPlaceholder } from "../../../components/ui/placeholder"
|
||||
import { StarIcon } from "../star-icon"
|
||||
@@ -31,11 +27,9 @@ export function ListItem({
|
||||
translation,
|
||||
withDetails,
|
||||
withAudio,
|
||||
withFollow,
|
||||
}: UniversalItemProps & {
|
||||
withDetails?: boolean
|
||||
withAudio?: boolean
|
||||
withFollow?: boolean
|
||||
}) {
|
||||
const entry = useEntry(entryId) || entryPreview
|
||||
|
||||
@@ -43,11 +37,24 @@ export function ListItem({
|
||||
|
||||
const inInCollection = useRouteParamsSelector((s) => s.feedId === FEED_COLLECTION_LIST)
|
||||
|
||||
const feed = useFeedById(entry?.feedId) || entryPreview?.feeds
|
||||
const feed =
|
||||
useFeedById(entry?.feedId, (feed) => {
|
||||
return {
|
||||
type: feed.type,
|
||||
ownerUserId: feed.ownerUserId,
|
||||
id: feed.id,
|
||||
title: feed.title,
|
||||
url: (feed as any).url || "",
|
||||
image: feed.image,
|
||||
siteUrl: feed.siteUrl,
|
||||
}
|
||||
}) || entryPreview?.feeds
|
||||
|
||||
const inbox = useInboxById(entry?.inboxId)
|
||||
|
||||
const handlePrefetchEntry = useDebounceCallback(
|
||||
() => {
|
||||
feed?.type === "inbox"
|
||||
inbox
|
||||
? Queries.entries.byInboxId(entryId).prefetch()
|
||||
: Queries.entries.byId(entryId).prefetch()
|
||||
},
|
||||
@@ -55,22 +62,17 @@ export function ListItem({
|
||||
{ leading: false },
|
||||
)
|
||||
|
||||
const isSubscription =
|
||||
withFollow && entry?.entries.url?.startsWith(UrlBuilder.shareFeed(entry.feedId))
|
||||
const feedId = isSubscription
|
||||
? entry?.entries.url?.slice(UrlBuilder.shareFeed(entry.feedId).length)
|
||||
: undefined
|
||||
const isFollowed = !!useSubscriptionStore((state) => feedId && state.data[feedId])
|
||||
const { present } = useModalStack()
|
||||
|
||||
const settingWideMode = useUISettingKey("wideMode")
|
||||
const [settingWideMode, thumbnailRatio] = useUISettingKeys(["wideMode", "thumbnailRatio"])
|
||||
const rid = `list-item-${entryId}`
|
||||
|
||||
// NOTE: prevent 0 height element, react virtuoso will not stop render any more
|
||||
if (!entry || !feed) return <ReactVirtuosoItemPlaceholder />
|
||||
if (!entry || !(feed || inbox)) return <ReactVirtuosoItemPlaceholder />
|
||||
|
||||
const displayTime = inInCollection ? entry.collections?.createdAt : entry.entries.publishedAt
|
||||
const envIsSafari = isSafari()
|
||||
|
||||
const related = feed || inbox
|
||||
|
||||
return (
|
||||
<div
|
||||
onMouseEnter={handlePrefetchEntry}
|
||||
@@ -82,7 +84,7 @@ export function ListItem({
|
||||
settingWideMode ? "py-3" : "py-4",
|
||||
)}
|
||||
>
|
||||
{!withAudio && <FeedIcon feed={feed} fallback entry={entry.entries} />}
|
||||
{!withAudio && <FeedIcon feed={related} fallback entry={entry.entries} />}
|
||||
<div
|
||||
className={cn(
|
||||
"-mt-0.5 flex-1 text-sm leading-tight",
|
||||
@@ -99,7 +101,11 @@ export function ListItem({
|
||||
)}
|
||||
>
|
||||
<EllipsisHorizontalTextWithTooltip className="truncate">
|
||||
{getPreferredTitle(feed, entry.entries)}
|
||||
<FeedTitle
|
||||
feed={related}
|
||||
title={getPreferredTitle(related, entry.entries)}
|
||||
className="space-x-0.5"
|
||||
/>
|
||||
</EllipsisHorizontalTextWithTooltip>
|
||||
<span>·</span>
|
||||
<span className="shrink-0">{!!displayTime && <RelativeTime date={displayTime} />}</span>
|
||||
@@ -149,28 +155,6 @@ export function ListItem({
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* TODO remove This only share page needed */}
|
||||
{feedId && !isFollowed && (
|
||||
<Button
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
e.preventDefault()
|
||||
present({
|
||||
title: `${APP_NAME}`,
|
||||
clickOutsideToDismiss: true,
|
||||
content: ({ dismiss }) => <FeedForm asWidget id={feedId} onSuccess={dismiss} />,
|
||||
})
|
||||
}}
|
||||
variant="outline"
|
||||
className="h-8"
|
||||
>
|
||||
<>
|
||||
<FollowIcon className="mr-1 size-3" />
|
||||
{APP_NAME}
|
||||
</>
|
||||
</Button>
|
||||
)}
|
||||
|
||||
{withAudio && entry.entries?.attachments?.[0].url && (
|
||||
<AudioCover
|
||||
entryId={entryId}
|
||||
@@ -182,7 +166,7 @@ export function ListItem({
|
||||
feedIcon={
|
||||
<FeedIcon
|
||||
fallback={false}
|
||||
feed={feed}
|
||||
feed={feed || inbox}
|
||||
entry={entry.entries}
|
||||
size={settingWideMode ? 65 : 80}
|
||||
className="m-0 rounded"
|
||||
@@ -204,9 +188,10 @@ export function ListItem({
|
||||
)}
|
||||
mediaContainerClassName={"w-auto h-auto rounded"}
|
||||
loading="lazy"
|
||||
key={`${rid}-media-${thumbnailRatio}`}
|
||||
proxy={{
|
||||
width: 160,
|
||||
height: 160,
|
||||
height: thumbnailRatio === "square" ? 160 : 0,
|
||||
}}
|
||||
height={entry.entries.media[0].height}
|
||||
width={entry.entries.media[0].width}
|
||||
|
||||
@@ -11,6 +11,7 @@ export type UniversalItemProps = {
|
||||
entryPreview?: CombinedEntryModel & {
|
||||
feeds: FeedOrListRespModel
|
||||
feedId: string
|
||||
inboxId: string
|
||||
}
|
||||
translation?: {
|
||||
title?: string
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
import { EllipsisHorizontalTextWithTooltip } from "@follow/components/ui/typography/EllipsisWithTooltip.js"
|
||||
import { cn } from "@follow/utils/utils"
|
||||
import type { Target, TargetAndTransition } from "framer-motion"
|
||||
import { m } from "framer-motion"
|
||||
|
||||
import { useIsZenMode } from "~/atoms/settings/ui"
|
||||
import { useAsRead } from "~/hooks/biz/useAsRead"
|
||||
import { useNavigateEntry } from "~/hooks/biz/useNavigateEntry"
|
||||
import { useRouteParamsSelector } from "~/hooks/biz/useRouteParams"
|
||||
import { useGetEntryIdInRange } from "~/modules/entry-column/hooks/useEntryIdListSnap"
|
||||
import { useEntry } from "~/store/entry"
|
||||
|
||||
export const EntryTimelineSidebar = ({ entryId }: { entryId: string }) => {
|
||||
const isZenMode = useIsZenMode()
|
||||
|
||||
if (!isZenMode) {
|
||||
return null
|
||||
}
|
||||
|
||||
return <Timeline entryId={entryId} />
|
||||
}
|
||||
|
||||
const Timeline = ({ entryId }: { entryId: string }) => {
|
||||
const entryIds = useGetEntryIdInRange(entryId, [5, 5])
|
||||
|
||||
return (
|
||||
<m.div
|
||||
className="absolute left-8 top-28 z-10 @lg:max-w-0 @6xl:max-w-[200px] @7xl:max-w-[200px] @[90rem]:max-w-[250px]"
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1, transition: { delay: 0.5 } }}
|
||||
>
|
||||
{entryIds.map((id) => (
|
||||
<TimelineItem key={id} id={id} />
|
||||
))}
|
||||
</m.div>
|
||||
)
|
||||
}
|
||||
|
||||
const initialButton: Target = {
|
||||
opacity: 0.0001,
|
||||
}
|
||||
const animateButton: TargetAndTransition = {
|
||||
opacity: 1,
|
||||
}
|
||||
|
||||
const TimelineItem = ({ id }: { id: string }) => {
|
||||
const entry = useEntry(id, (e) => ({
|
||||
title: e.entries.title,
|
||||
read: e.read,
|
||||
}))
|
||||
const asRead = useAsRead(entry!)
|
||||
const navigate = useNavigateEntry()
|
||||
|
||||
const isActive = useRouteParamsSelector((r) => r.entryId === id)
|
||||
|
||||
return (
|
||||
<m.button
|
||||
layoutId={`timeline-${id}`}
|
||||
initial={initialButton}
|
||||
animate={animateButton}
|
||||
className={"relative block min-w-0 max-w-full cursor-pointer text-xs leading-loose"}
|
||||
type="button"
|
||||
onClick={() => navigate({ entryId: id })}
|
||||
>
|
||||
{!asRead && (
|
||||
<span className="absolute -left-4 top-1/2 size-1.5 -translate-y-1/2 rounded-full bg-accent opacity-50" />
|
||||
)}
|
||||
<EllipsisHorizontalTextWithTooltip
|
||||
className={cn(
|
||||
"truncate transition-[opacity,font-weight] duration-200",
|
||||
isActive ? "font-medium opacity-100" : "opacity-60 hover:opacity-80",
|
||||
)}
|
||||
>
|
||||
{entry?.title}
|
||||
</EllipsisHorizontalTextWithTooltip>
|
||||
</m.button>
|
||||
)
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import { FeedIcon } from "~/modules/feed/feed-icon"
|
||||
import { Queries } from "~/queries"
|
||||
import { useEntry, useEntryReadHistory } from "~/store/entry"
|
||||
import { getPreferredTitle, useFeedById } from "~/store/feed"
|
||||
import { useInboxById } from "~/store/inbox"
|
||||
|
||||
import { EntryTranslation } from "../../entry-column/translation"
|
||||
|
||||
@@ -28,10 +29,11 @@ export const EntryTitle = ({ entryId, compact }: EntryLinkProps) => {
|
||||
const user = useWhoami()
|
||||
const entry = useEntry(entryId)
|
||||
const feed = useFeedById(entry?.feedId)
|
||||
const inbox = useInboxById(entry?.inboxId)
|
||||
const entryHistory = useEntryReadHistory(entryId)
|
||||
|
||||
const populatedFullHref = useMemo(() => {
|
||||
if (feed?.type === "inbox") return entry?.entries.authorUrl
|
||||
if (inbox) return entry?.entries.authorUrl
|
||||
const href = entry?.entries.url
|
||||
if (!href) return "#"
|
||||
|
||||
@@ -39,7 +41,7 @@ export const EntryTitle = ({ entryId, compact }: EntryLinkProps) => {
|
||||
const feedSiteUrl = feed?.type === "feed" ? feed.siteUrl : null
|
||||
if (href.startsWith("/") && feedSiteUrl) return safeUrl(href, feedSiteUrl)
|
||||
return href
|
||||
}, [entry?.entries.authorUrl, entry?.entries.url, feed])
|
||||
}, [entry?.entries.authorUrl, entry?.entries.url, feed?.siteUrl, feed?.type, inbox])
|
||||
|
||||
const translation = useAuthQuery(
|
||||
Queries.ai.translation({
|
||||
@@ -61,10 +63,10 @@ export const EntryTitle = ({ entryId, compact }: EntryLinkProps) => {
|
||||
|
||||
return compact ? (
|
||||
<div className="-mx-6 flex cursor-button items-center gap-2 rounded-lg p-6 transition-colors @sm:-mx-3 @sm:p-3">
|
||||
<FeedIcon fallback feed={feed} entry={entry.entries} size={50} />
|
||||
<FeedIcon fallback feed={feed || inbox} entry={entry.entries} size={50} />
|
||||
<div className="leading-6">
|
||||
<div className="flex items-center gap-1 text-base font-semibold">
|
||||
<span>{entry.entries.author || feed?.title}</span>
|
||||
<span>{entry.entries.author || feed?.title || inbox?.title}</span>
|
||||
</div>
|
||||
<div className="text-zinc-500">
|
||||
<RelativeTime date={entry.entries.publishedAt} />
|
||||
@@ -86,7 +88,7 @@ export const EntryTitle = ({ entryId, compact }: EntryLinkProps) => {
|
||||
/>
|
||||
</div>
|
||||
<div className="mt-2 text-[13px] font-medium text-zinc-500">
|
||||
{getPreferredTitle(feed, entry.entries)}
|
||||
{getPreferredTitle(feed || inbox, entry.entries)}
|
||||
</div>
|
||||
<div className="flex items-center gap-2 text-[13px] text-zinc-500">
|
||||
{entry.entries.publishedAt && new Date(entry.entries.publishedAt).toLocaleString()}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Button } from "@follow/components/ui/button/index.js"
|
||||
import { Divider } from "@follow/components/ui/divider/index.js"
|
||||
import { useMemo } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
|
||||
import { useWhoami } from "~/atoms/user"
|
||||
@@ -7,9 +8,11 @@ import { useBoostModal } from "~/modules/boost/hooks"
|
||||
import { useFeedBoostersQuery } from "~/modules/boost/query"
|
||||
import { FeedIcon } from "~/modules/feed/feed-icon"
|
||||
import { UserAvatar } from "~/modules/user/UserAvatar"
|
||||
import { deduplicateUsers } from "~/modules/user/utils"
|
||||
import { useEntry } from "~/store/entry"
|
||||
import { useFeedById } from "~/store/feed"
|
||||
|
||||
import { UserGallery } from "../../user/UserGallery"
|
||||
import { useTipModal } from "../../wallet/hooks"
|
||||
|
||||
export const SupportCreator = ({ entryId }: { entryId: string }) => {
|
||||
@@ -26,10 +29,17 @@ export const SupportCreator = ({ entryId }: { entryId: string }) => {
|
||||
const openBoostModal = useBoostModal()
|
||||
|
||||
const isMyOwnedFeed = feed?.ownerUserId === useWhoami()?.id
|
||||
if (!feed || feed.type !== "feed") return null
|
||||
const allSupporters = useMemo(
|
||||
() =>
|
||||
deduplicateUsers([
|
||||
...(feed && "tipUsers" in feed && feed.tipUsers ? feed.tipUsers : []),
|
||||
...(feedBoosters ?? []),
|
||||
]),
|
||||
[feed, feedBoosters],
|
||||
)
|
||||
const supportAmount = allSupporters.length
|
||||
|
||||
const supportAmount =
|
||||
(feed && feed.tipUsers ? feed.tipUsers.length : 0) + (feedBoosters ? feedBoosters.length : 0)
|
||||
if (!feed || feed.type !== "feed") return null
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -44,19 +54,19 @@ export const SupportCreator = ({ entryId }: { entryId: string }) => {
|
||||
enableModal
|
||||
/>
|
||||
) : (
|
||||
<FeedIcon className="w-40 flex-col gap-3 p-0" size={46} feed={feed} fallback />
|
||||
<FeedIcon className="mr-0 w-40 flex-col gap-3 p-0" size={46} feed={feed} fallback />
|
||||
)}
|
||||
<span className="-mt-6 text-lg font-medium">{feed.title}</span>
|
||||
|
||||
<div className="flex items-center gap-4">
|
||||
{!isMyOwnedFeed && (
|
||||
<Button className="text-base" onClick={() => openTipModal()}>
|
||||
<Button onClick={() => openTipModal()}>
|
||||
<i className="i-mgc-power-outline mr-1.5 text-lg" />
|
||||
{t("entry_content.support_creator")}
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
variant={!isMyOwnedFeed ? "outline" : "primary"}
|
||||
className="text-base"
|
||||
onClick={() => openBoostModal(feed.id)}
|
||||
>
|
||||
<i className="i-mgc-rocket-cute-fi mr-1.5 text-lg" />
|
||||
@@ -69,32 +79,7 @@ export const SupportCreator = ({ entryId }: { entryId: string }) => {
|
||||
<div className="text-sm text-zinc-500">
|
||||
{t("entry_content.support_amount", { amount: supportAmount })}
|
||||
</div>
|
||||
<div className="flex w-fit max-w-80 flex-wrap gap-4">
|
||||
{feed.tipUsers?.map((user) => (
|
||||
<div key={user.id} className="size-8">
|
||||
<UserAvatar
|
||||
className="h-auto p-0"
|
||||
avatarClassName="size-8"
|
||||
userId={user?.id}
|
||||
enableModal={true}
|
||||
hideName={true}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
<div className="flex w-fit max-w-80 flex-wrap gap-4">
|
||||
{feedBoosters?.map((user) => (
|
||||
<div key={user.id} className="size-8">
|
||||
<UserAvatar
|
||||
className="h-auto p-0"
|
||||
avatarClassName="size-8"
|
||||
userId={user?.id}
|
||||
enableModal={true}
|
||||
hideName={true}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
<UserGallery users={allSupporters} />
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -19,6 +19,7 @@ import {
|
||||
import { useUISettingKey } from "~/atoms/settings/ui"
|
||||
import { shortcuts } from "~/constants/shortcuts"
|
||||
import { useEntryActions, useEntryReadabilityToggle } from "~/hooks/biz/useEntryActions"
|
||||
import { useRouteParamsSelector } from "~/hooks/biz/useRouteParams"
|
||||
import { tipcClient } from "~/lib/client"
|
||||
import { parseHtml } from "~/lib/parse-html"
|
||||
import type { FlatEntryModel } from "~/store/entry"
|
||||
@@ -41,10 +42,12 @@ function EntryHeaderImpl({
|
||||
}) {
|
||||
const entry = useEntry(entryId)
|
||||
|
||||
const listId = useRouteParamsSelector((s) => s.listId)
|
||||
const { items } = useEntryActions({
|
||||
view,
|
||||
entry,
|
||||
type: "toolbar",
|
||||
inList: !!listId,
|
||||
})
|
||||
|
||||
const entryTitleMeta = useEntryTitleMeta()
|
||||
@@ -59,7 +62,7 @@ function EntryHeaderImpl({
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
"relative flex min-w-0 items-center justify-between gap-3 overflow-hidden text-lg text-zinc-500",
|
||||
"relative flex min-w-0 items-center justify-between gap-3 overflow-hidden text-lg text-zinc-500 duration-200",
|
||||
shouldShowMeta && "border-b border-border",
|
||||
className,
|
||||
)}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { EventBus } from "@follow/utils/event-bus"
|
||||
import { useEffect } from "react"
|
||||
|
||||
declare module "@follow/utils/event-bus" {
|
||||
export interface CustomEvent {
|
||||
FOCUS_ENTRY_CONTAINER: never
|
||||
}
|
||||
}
|
||||
|
||||
export const useFocusEntryContainerSubscriptions = (ref: React.RefObject<HTMLDivElement>) => {
|
||||
useEffect(() => {
|
||||
return EventBus.subscribe("FOCUS_ENTRY_CONTAINER", () => {
|
||||
ref.current?.focus()
|
||||
})
|
||||
}, [ref])
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import { MemoedDangerousHTMLStyle } from "@follow/components/common/MemoedDangerousHTMLStyle.js"
|
||||
import { AutoResizeHeight } from "@follow/components/ui/auto-resize-height/index.jsx"
|
||||
import { LoadingWithIcon } from "@follow/components/ui/loading/index.jsx"
|
||||
import { RootPortal } from "@follow/components/ui/portal/index.jsx"
|
||||
@@ -6,12 +7,12 @@ import { useTitle } from "@follow/hooks"
|
||||
import type { FeedModel, InboxModel } from "@follow/models/types"
|
||||
import { IN_ELECTRON } from "@follow/shared/constants"
|
||||
import { stopPropagation } from "@follow/utils/dom"
|
||||
import { EventBus } from "@follow/utils/event-bus"
|
||||
import { cn } from "@follow/utils/utils"
|
||||
import type { FallbackRender } from "@sentry/react"
|
||||
import { ErrorBoundary } from "@sentry/react"
|
||||
import type { FC } from "react"
|
||||
import { memo, useEffect, useLayoutEffect, useMemo, useRef } from "react"
|
||||
import { useHotkeys } from "react-hotkeys-hook"
|
||||
import { useTranslation } from "react-i18next"
|
||||
|
||||
import {
|
||||
@@ -27,7 +28,6 @@ import { ShadowDOM } from "~/components/common/ShadowDOM"
|
||||
import { Toc } from "~/components/ui/markdown/components/Toc"
|
||||
import { useInPeekModal } from "~/components/ui/modal/inspire/PeekModal"
|
||||
import { isWebBuild } from "~/constants"
|
||||
import { shortcuts } from "~/constants/shortcuts"
|
||||
import { useEntryReadabilityToggle } from "~/hooks/biz/useEntryActions"
|
||||
import { useRouteParamsSelector } from "~/hooks/biz/useRouteParams"
|
||||
import { useAuthQuery } from "~/hooks/common"
|
||||
@@ -41,6 +41,7 @@ import {
|
||||
import { Queries } from "~/queries"
|
||||
import { useEntry } from "~/store/entry"
|
||||
import { useFeedById } from "~/store/feed"
|
||||
import { useInboxById } from "~/store/inbox"
|
||||
|
||||
import { EntryContentHTMLRenderer } from "../renderer/html"
|
||||
import {
|
||||
@@ -49,10 +50,12 @@ import {
|
||||
setEntryTitleMeta,
|
||||
setTranslationCache,
|
||||
} from "./atoms"
|
||||
import { EntryTimelineSidebar } from "./components/EntryTimelineSidebar"
|
||||
import { EntryTitle } from "./components/EntryTitle"
|
||||
import { SourceContentPanel } from "./components/SourceContentView"
|
||||
import { SupportCreator } from "./components/SupportCreator"
|
||||
import { EntryHeader } from "./header"
|
||||
import { useFocusEntryContainerSubscriptions } from "./hooks"
|
||||
import { EntryContentLoading } from "./loading"
|
||||
|
||||
export interface EntryContentClassNames {
|
||||
@@ -92,9 +95,10 @@ export const EntryContentRender: Component<{
|
||||
|
||||
const feed = useFeedById(entry?.feedId) as FeedModel | InboxModel
|
||||
const readerRenderInlineStyle = useUISettingKey("readerRenderInlineStyle")
|
||||
const inbox = useInboxById(entry?.inboxId, (inbox) => inbox !== null)
|
||||
|
||||
const { error, data, isPending } = useAuthQuery(
|
||||
feed?.type === "inbox" ? Queries.entries.byInboxId(entryId) : Queries.entries.byId(entryId),
|
||||
inbox ? Queries.entries.byInboxId(entryId) : Queries.entries.byId(entryId),
|
||||
{
|
||||
staleTime: 300_000,
|
||||
},
|
||||
@@ -122,22 +126,16 @@ export const EntryContentRender: Component<{
|
||||
const scrollerRef = useRef<HTMLDivElement>(null)
|
||||
useEffect(() => {
|
||||
scrollerRef.current?.scrollTo(0, 0)
|
||||
scrollerRef.current?.focus()
|
||||
}, [entryId])
|
||||
|
||||
useHotkeys(shortcuts.entry.scrollDown.key, () => {
|
||||
scrollerRef.current?.scrollBy(0, window.innerHeight / 2)
|
||||
})
|
||||
|
||||
useHotkeys(shortcuts.entry.scrollUp.key, () => {
|
||||
scrollerRef.current?.scrollBy(0, -window.innerHeight / 2)
|
||||
})
|
||||
|
||||
const isPeekModal = useInPeekModal()
|
||||
|
||||
const contentAccessories = useMemo(
|
||||
() => (isPeekModal ? undefined : <ContainerToc key={entryId} />),
|
||||
[entryId, isPeekModal],
|
||||
)
|
||||
useFocusEntryContainerSubscriptions(scrollerRef)
|
||||
const stableRenderStyle = useMemo(
|
||||
() =>
|
||||
readerFontFamily
|
||||
@@ -162,7 +160,7 @@ export const EntryContentRender: Component<{
|
||||
),
|
||||
[entry?.entries.media, data?.entries.media],
|
||||
)
|
||||
|
||||
const customCSS = useUISettingKey("customCSS")
|
||||
if (!entry) return null
|
||||
|
||||
const content = entry?.entries.content ?? data?.entries.content
|
||||
@@ -191,7 +189,7 @@ export const EntryContentRender: Component<{
|
||||
})
|
||||
}
|
||||
|
||||
const isInbox = feed?.type === "inbox"
|
||||
const isInbox = !!inbox
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -202,10 +200,11 @@ export const EntryContentRender: Component<{
|
||||
compact={compact}
|
||||
/>
|
||||
|
||||
<div className="relative flex size-full flex-col overflow-hidden">
|
||||
<div className="relative flex size-full flex-col overflow-hidden @container">
|
||||
<EntryTimelineSidebar entryId={entry.entries.id} />
|
||||
<ScrollArea.ScrollArea
|
||||
mask={false}
|
||||
rootClassName={cn("h-0 min-w-0 grow overflow-y-auto @container", className)}
|
||||
rootClassName={cn("h-0 min-w-0 grow overflow-y-auto", className)}
|
||||
scrollbarClassName="mr-[1.5px]"
|
||||
viewportClassName="p-5"
|
||||
ref={scrollerRef}
|
||||
@@ -239,6 +238,9 @@ export const EntryContentRender: Component<{
|
||||
<ErrorBoundary fallback={RenderError}>
|
||||
{!isInReadabilityMode ? (
|
||||
<ShadowDOM injectHostStyles={!isInbox}>
|
||||
{!!customCSS && (
|
||||
<MemoedDangerousHTMLStyle>{customCSS}</MemoedDangerousHTMLStyle>
|
||||
)}
|
||||
<EntryContentHTMLRenderer
|
||||
view={view}
|
||||
feedId={feed?.id}
|
||||
@@ -270,7 +272,9 @@ export const EntryContentRender: Component<{
|
||||
{!content && (
|
||||
<div className="center mt-16 min-w-0">
|
||||
{isPending ? (
|
||||
<EntryContentLoading icon={!isInbox ? feed?.siteUrl! : undefined} />
|
||||
<EntryContentLoading
|
||||
icon={!isInbox ? (feed as FeedModel)?.siteUrl! : undefined}
|
||||
/>
|
||||
) : error ? (
|
||||
<div className="center flex min-w-0 flex-col gap-2">
|
||||
<i className="i-mgc-close-cute-re text-3xl text-red-500" />
|
||||
@@ -314,10 +318,12 @@ const TitleMetaHandler: Component<{
|
||||
const {
|
||||
entries: { title: entryTitle },
|
||||
feedId,
|
||||
inboxId,
|
||||
} = useEntry(entryId)!
|
||||
|
||||
const { title: feedTitle } = useFeedById(feedId)!
|
||||
|
||||
const feed = useFeedById(feedId)
|
||||
const inbox = useInboxById(inboxId)
|
||||
const feedTitle = feed?.title || inbox?.title
|
||||
const atTop = useIsSoFWrappedElement()
|
||||
useEffect(() => {
|
||||
setEntryContentScrollToTop(true)
|
||||
@@ -466,11 +472,15 @@ const RenderError: FallbackRender = ({ error }) => {
|
||||
|
||||
const ContainerToc: FC = memo(() => {
|
||||
const wrappedElement = useWrappedElement()
|
||||
|
||||
return (
|
||||
<RootPortal to={wrappedElement!}>
|
||||
<div className="group absolute right-[-130px] top-0 h-full w-[100px]">
|
||||
<div className="sticky top-0">
|
||||
<Toc
|
||||
onItemClick={() => {
|
||||
EventBus.dispatch("FOCUS_ENTRY_CONTAINER")
|
||||
}}
|
||||
className={cn(
|
||||
"flex flex-col items-end animate-in fade-in-0 slide-in-from-bottom-12 easing-spring spring-soft",
|
||||
"max-h-[calc(100vh-100px)] overflow-auto scrollbar-none",
|
||||
|
||||
@@ -145,7 +145,7 @@ function FeedCategoryImpl({ data: ids, view, categoryOpenStateData }: FeedCatego
|
||||
|
||||
const [isContextMenuOpen, setIsContextMenuOpen] = useState(false)
|
||||
useAnyPointDown(() => {
|
||||
setIsContextMenuOpen(false)
|
||||
isContextMenuOpen && setIsContextMenuOpen(false)
|
||||
})
|
||||
const isCategoryIsWaiting = isChangePending
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { useFocusable } from "@follow/components/common/Focusable.js"
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "@follow/components/ui/tooltip/index.jsx"
|
||||
import { FeedViewType } from "@follow/constants"
|
||||
import { cn } from "@follow/utils/utils"
|
||||
@@ -23,6 +24,7 @@ import { useNavigateEntry } from "~/hooks/biz/useNavigateEntry"
|
||||
import { FeedIcon } from "~/modules/feed/feed-icon"
|
||||
import { useEntry } from "~/store/entry"
|
||||
import { useFeedById } from "~/store/feed"
|
||||
import { useInboxById } from "~/store/inbox"
|
||||
import { useListById } from "~/store/list"
|
||||
|
||||
const handleClickPlay = () => {
|
||||
@@ -102,9 +104,11 @@ const CornerPlayerImpl = () => {
|
||||
const feed = useFeedById(entry?.feedId)
|
||||
const list = useListById(listId)
|
||||
|
||||
const isFocused = useFocusable()
|
||||
useHotkeys("space", handleClickPlay, {
|
||||
preventDefault: true,
|
||||
scopes: HotKeyScopeMap.Home,
|
||||
enabled: isFocused,
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
@@ -116,6 +120,8 @@ const CornerPlayerImpl = () => {
|
||||
})
|
||||
}, [entry, feed])
|
||||
|
||||
const isInbox = useInboxById(entry?.feedId, (inbox) => inbox !== null)
|
||||
|
||||
const navigateToEntry = useNavigateEntry()
|
||||
usePlayerTracker()
|
||||
|
||||
@@ -124,9 +130,9 @@ const CornerPlayerImpl = () => {
|
||||
const options: NavigateEntryOptions = {
|
||||
entryId: entry.entries.id,
|
||||
}
|
||||
if (feed?.type === "inbox") {
|
||||
if (isInbox) {
|
||||
Object.assign(options, {
|
||||
inboxId: feed.id,
|
||||
inboxId: entry?.feedId,
|
||||
view: FeedViewType.Articles,
|
||||
})
|
||||
} else if (list) {
|
||||
|
||||
@@ -174,6 +174,7 @@ const SearchTrigger = () => {
|
||||
},
|
||||
{
|
||||
enabled: canSearch,
|
||||
preventDefault: true,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@@ -21,15 +21,14 @@ import { useNavigateEntry } from "~/hooks/biz/useNavigateEntry"
|
||||
import { useRouteParamsSelector } from "~/hooks/biz/useRouteParams"
|
||||
import { getNewIssueUrl } from "~/lib/issues"
|
||||
import { showNativeMenu } from "~/lib/native-menu"
|
||||
import { FeedCertification } from "~/modules/feed/feed-certification"
|
||||
import { FeedIcon } from "~/modules/feed/feed-icon"
|
||||
import { FeedTitle } from "~/modules/feed/feed-title"
|
||||
import { getPreferredTitle, useFeedById } from "~/store/feed"
|
||||
import { useInboxById } from "~/store/inbox"
|
||||
import { useListById } from "~/store/list"
|
||||
import { subscriptionActions, useSubscriptionByFeedId } from "~/store/subscription"
|
||||
import { useFeedUnreadStore } from "~/store/unread"
|
||||
|
||||
import { BoostCertification } from "../boost/boost-certification"
|
||||
import { useSelectedFeedIds } from "./atom"
|
||||
import { feedColumnStyles } from "./styles"
|
||||
import { UnreadNumber } from "./unread-number"
|
||||
@@ -43,7 +42,19 @@ const FeedItemImpl = ({ view, feedId, className }: FeedItemProps) => {
|
||||
const { t } = useTranslation()
|
||||
const subscription = useSubscriptionByFeedId(feedId)
|
||||
const navigate = useNavigateEntry()
|
||||
const feed = useFeedById(feedId)
|
||||
const feed = useFeedById(feedId, (feed) => {
|
||||
return {
|
||||
type: feed.type,
|
||||
id: feed.id,
|
||||
title: feed.title,
|
||||
errorAt: feed.errorAt,
|
||||
errorMessage: feed.errorMessage,
|
||||
url: feed.url,
|
||||
image: feed.image,
|
||||
siteUrl: feed.siteUrl,
|
||||
}
|
||||
})
|
||||
|
||||
const [selectedFeedIds, setSelectedFeedIds] = useSelectedFeedIds()
|
||||
|
||||
const handleClick: React.MouseEventHandler<HTMLDivElement> = useCallback(
|
||||
@@ -81,7 +92,7 @@ const FeedItemImpl = ({ view, feedId, className }: FeedItemProps) => {
|
||||
|
||||
const [isContextMenuOpen, setIsContextMenuOpen] = useState(false)
|
||||
useAnyPointDown(() => {
|
||||
setIsContextMenuOpen(false)
|
||||
isContextMenuOpen && setIsContextMenuOpen(false)
|
||||
})
|
||||
if (!feed) return null
|
||||
|
||||
@@ -148,9 +159,7 @@ const FeedItemImpl = ({ view, feedId, className }: FeedItemProps) => {
|
||||
)}
|
||||
>
|
||||
<FeedIcon fallback feed={feed} size={16} />
|
||||
<div className="truncate">{getPreferredTitle(feed)}</div>
|
||||
{isFeed && <FeedCertification feed={feed} className="text-[15px]" />}
|
||||
{isFeed && <BoostCertification feed={feed} className="text-[15px]" />}
|
||||
<FeedTitle feed={feed} />
|
||||
{isFeed && feed.errorAt && (
|
||||
<Tooltip delayDuration={300}>
|
||||
<TooltipTrigger asChild>
|
||||
@@ -208,7 +217,7 @@ const ListItemImpl: Component<{
|
||||
|
||||
const [isContextMenuOpen, setIsContextMenuOpen] = useState(false)
|
||||
useAnyPointDown(() => {
|
||||
setIsContextMenuOpen(false)
|
||||
isContextMenuOpen && setIsContextMenuOpen(false)
|
||||
})
|
||||
const subscription = useSubscriptionByFeedId(listId)
|
||||
const navigate = useNavigateEntry()
|
||||
@@ -291,7 +300,7 @@ const InboxItemImpl: Component<{
|
||||
|
||||
const [isContextMenuOpen, setIsContextMenuOpen] = useState(false)
|
||||
useAnyPointDown(() => {
|
||||
setIsContextMenuOpen(false)
|
||||
isContextMenuOpen && setIsContextMenuOpen(false)
|
||||
})
|
||||
const navigate = useNavigateEntry()
|
||||
const handleNavigate = useCallback(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { PlatformIcon } from "@follow/components/ui/platform-icon/index.jsx"
|
||||
import type { CombinedEntryModel, FeedModel, FeedOrListRespModel } from "@follow/models/types"
|
||||
import { getColorScheme, stringToHue } from "@follow/utils/color"
|
||||
import { getBackgroundGradient } from "@follow/utils/color"
|
||||
import { cn, getUrlIcon } from "@follow/utils/utils"
|
||||
import { Avatar, AvatarFallback, AvatarImage } from "@radix-ui/react-avatar"
|
||||
import { m } from "framer-motion"
|
||||
@@ -65,6 +65,14 @@ const FallbackableImage = forwardRef<
|
||||
)
|
||||
})
|
||||
|
||||
type FeedIconFeed =
|
||||
| (Pick<FeedModel, "ownerUserId" | "id" | "title" | "url" | "image"> & {
|
||||
type: FeedOrListRespModel["type"]
|
||||
siteUrl?: string
|
||||
})
|
||||
| FeedOrListRespModel
|
||||
|
||||
type FeedIconEntry = Pick<CombinedEntryModel["entries"], "media" | "authorAvatar">
|
||||
export function FeedIcon({
|
||||
feed,
|
||||
entry,
|
||||
@@ -75,8 +83,8 @@ export function FeedIcon({
|
||||
siteUrl,
|
||||
useMedia,
|
||||
}: {
|
||||
feed?: FeedOrListRespModel | null
|
||||
entry?: CombinedEntryModel["entries"]
|
||||
feed?: FeedIconFeed | null
|
||||
entry?: FeedIconEntry | null
|
||||
fallbackUrl?: string
|
||||
className?: string
|
||||
size?: number
|
||||
@@ -98,30 +106,34 @@ export function FeedIcon({
|
||||
}
|
||||
|
||||
const colors = useMemo(
|
||||
() =>
|
||||
getColorScheme(stringToHue(feed?.title || (feed as FeedModel)?.url || siteUrl || ""), true),
|
||||
() => getBackgroundGradient(feed?.title || (feed as FeedModel)?.url || siteUrl || ""),
|
||||
[feed?.title, (feed as FeedModel)?.url, siteUrl],
|
||||
)
|
||||
let ImageElement: ReactNode
|
||||
let finalSrc = ""
|
||||
|
||||
const sizeStyle = {
|
||||
width: size,
|
||||
height: size,
|
||||
}
|
||||
const sizeStyle: React.CSSProperties = useMemo(
|
||||
() => ({
|
||||
width: size,
|
||||
height: size,
|
||||
}),
|
||||
[size],
|
||||
)
|
||||
const colorfulStyle: React.CSSProperties = useMemo(() => {
|
||||
const [, , , bgAccent, bgAccentLight, bgAccentUltraLight] = colors
|
||||
return {
|
||||
// Create a bottom-left to top-right avatar fallback background gradient
|
||||
backgroundImage: `linear-gradient(to top right, ${bgAccent} 20%, ${bgAccentLight} 80%, ${bgAccentUltraLight} 95%)`,
|
||||
...sizeStyle,
|
||||
}
|
||||
}, [colors, sizeStyle])
|
||||
|
||||
const fallbackIcon = (
|
||||
<span
|
||||
style={
|
||||
{
|
||||
...sizeStyle,
|
||||
"--fo-light-background": colors.light.background,
|
||||
"--fo-dark-background": colors.dark.background,
|
||||
} as any
|
||||
}
|
||||
style={colorfulStyle}
|
||||
className={cn(
|
||||
"flex shrink-0 items-center justify-center rounded-sm",
|
||||
"bg-[var(--fo-light-background)] text-white dark:bg-[var(--fo-dark-background)]",
|
||||
"text-white",
|
||||
"mr-2",
|
||||
className,
|
||||
)}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user