chore: Release v0.2.7-beta.0 (#2125)

This commit is contained in:
Innei
2024-12-12 21:17:49 +08:00
committed by GitHub
112 changed files with 4614 additions and 3456 deletions
+31 -1
View File
@@ -1,6 +1,6 @@
# CHANGELOG
## [0.2.6-beta.0](https://github.com/RSSNext/follow/compare/v0.2.0-beta.2...v0.2.6-beta.0) (2024-12-06)
## [0.2.7-beta.0](https://github.com/RSSNext/follow/compare/v0.2.0-beta.2...v0.2.7-beta.0) (2024-12-12)
### Bug Fixes
@@ -13,6 +13,7 @@
* add changelog ([4de6355](https://github.com/RSSNext/follow/commit/4de6355bb77ae7b00416be6827a5b71a3a724dfa))
* add cleaner cron impl ([faae74b](https://github.com/RSSNext/follow/commit/faae74b8ba465a240bcdd40de33e446bc0799c41))
* add deps for integration cmds ([#1696](https://github.com/RSSNext/follow/issues/1696)) ([1353d4b](https://github.com/RSSNext/follow/commit/1353d4bfc552c20fdcfc9723a4cafb9ef47c769d))
* add entryId to deps, try fix `isActive` judge ([76fc17e](https://github.com/RSSNext/follow/commit/76fc17eddf1137fb9af227b5a951d62ce4e7cc58))
* add feed and feed list overlap ([6395d22](https://github.com/RSSNext/follow/commit/6395d223750d06d6a73e8bef4f5081cdf8d7c46a))
* add manifest to purge cache ([2f8dc0b](https://github.com/RSSNext/follow/commit/2f8dc0bc8561ebf9bb40160de8658eac799b31b0))
* add minify ([555fc4c](https://github.com/RSSNext/follow/commit/555fc4cde9c8cd9c7fc911f5a27a1ce8c84f269c))
@@ -42,7 +43,9 @@
* **auth:** redirect url ([e7d5576](https://github.com/RSSNext/follow/commit/e7d5576b63a77cd4f4e25a3124f9685f408a73de))
* auto archived list flash ([#1269](https://github.com/RSSNext/follow/issues/1269)) ([8d2478c](https://github.com/RSSNext/follow/commit/8d2478c6a93aa9f5a99fddc55bbb8e532e1a0fe1))
* auto load achieved entries when show achieved button is available ([074a60d](https://github.com/RSSNext/follow/commit/074a60d3cf93bcede88ea4d70b07cf7480be4229))
* back to previous entry list will refresh data ([84a188a](https://github.com/RSSNext/follow/commit/84a188a8e1fa88df18b9bd4d5f0bea1fc92f9394))
* **boost:** card text align center ([632d5d4](https://github.com/RSSNext/follow/commit/632d5d42d67999523e602fb18f59ca72543b7d7a))
* break hono types ([bb529c4](https://github.com/RSSNext/follow/commit/bb529c498a7e2d0408b7de9e1d2f78db9a8b0d0f))
* **bridge:** window call should catch error ([7bdf100](https://github.com/RSSNext/follow/commit/7bdf10050cef7f39b0f485b89ca0445c49116d81))
* build ([740783a](https://github.com/RSSNext/follow/commit/740783a537f85e0bc215cd38ce37bf5bd6fc9b1a))
* build pre script ([8bd2de8](https://github.com/RSSNext/follow/commit/8bd2de84b898ffc1a4863d29d7056a0b9e7a9e2f))
@@ -93,6 +96,7 @@
* disable horizontal auto-scroll ([8666b41](https://github.com/RSSNext/follow/commit/8666b41f2dded5b6b5cb86b7824683b48582cf1d)), closes [#1512](https://github.com/RSSNext/follow/issues/1512)
* disable overscroll-behavior ([5b32e33](https://github.com/RSSNext/follow/commit/5b32e33cf144ea2077ef08fba8008e0d6df022b7))
* disable sw in dev ([150cdea](https://github.com/RSSNext/follow/commit/150cdea5ea4947ada1b968b23e4a278350d98e43))
* discover form button disable state error ([#2113](https://github.com/RSSNext/follow/issues/2113)) ([0ae6ec9](https://github.com/RSSNext/follow/commit/0ae6ec954af3e4c42f224020b67ea294a9c834d6))
* **discover:** card text truncate ([557e912](https://github.com/RSSNext/follow/commit/557e91228af27251663904dfd3211c535b5b5415))
* dismiss non-important modal when click outside, fix [#1468](https://github.com/RSSNext/follow/issues/1468) ([cda2264](https://github.com/RSSNext/follow/commit/cda226420f6c42679d594c02fd7f6fb103bfc236))
* dnd and scroll ([#1528](https://github.com/RSSNext/follow/issues/1528)) ([b1e28be](https://github.com/RSSNext/follow/commit/b1e28be2b0049eae73d51a18cd9180b077a512ca))
@@ -101,6 +105,7 @@
* do not update action setting for archived query ([4adcded](https://github.com/RSSNext/follow/commit/4adcded02179b8d42f1a906b75b10fd403438f8d))
* don't cache user session ([e8d7e6c](https://github.com/RSSNext/follow/commit/e8d7e6ce64d09bb1f2b8f3e26f7aba250c3cca84))
* don't inject pwa into debug html ([5fec56e](https://github.com/RSSNext/follow/commit/5fec56e9b02ec8a3dbed7c99a7328edf51d41035))
* downgrade electron ([9bcb268](https://github.com/RSSNext/follow/commit/9bcb268d3f6ce14d40712bdd049a61fe7df4d93c))
* downgrade radix scrollview ([199e0bc](https://github.com/RSSNext/follow/commit/199e0bc7c514822233c42f048691926f4f7cb190))
* **dx:** merge script and fix host rewrite ([3fa3bd5](https://github.com/RSSNext/follow/commit/3fa3bd5fc5b730421f6abc4dd2938beea67322dc))
* dynamic import dexie-export-import ([48aea7b](https://github.com/RSSNext/follow/commit/48aea7b88e4d72d20e52ce7a5037ef239d80611d))
@@ -126,11 +131,14 @@
* feed icon margin right ([0f32364](https://github.com/RSSNext/follow/commit/0f3236406dc354adc9830c51e73f9fb4790f159a))
* feedIcon margin ([03ce13d](https://github.com/RSSNext/follow/commit/03ce13d45bd89908bd9bcb06484a07873b6388f5))
* fill height when zooming ([75e0da2](https://github.com/RSSNext/follow/commit/75e0da2a866a7789606bd40d484fc29973fd9e0a))
* filter no picture breaking logic ([9a84ed4](https://github.com/RSSNext/follow/commit/9a84ed40a16ea58c2c1cdc8cf9c46009fe46faea))
* float sidebar missing background ([b9982e0](https://github.com/RSSNext/follow/commit/b9982e0a6b44f476621daf30f93f8e740a544a02))
* follow external server fetch ua ([072dec0](https://github.com/RSSNext/follow/commit/072dec02b787bcdd8af7f5c0bf25398e2da8c15e))
* form button align center ([589c6e4](https://github.com/RSSNext/follow/commit/589c6e469b3fecb1c46f1ec2735494da3367abec))
* form content width ([42d66ce](https://github.com/RSSNext/follow/commit/42d66ce19487678a3fd56059b03496d5b50f3b3d))
* grid virtualizer on mobile can't show any items ([2b93dfd](https://github.com/RSSNext/follow/commit/2b93dfd58f403756955f071703b5bdb6573e916b))
* group date item z index ([8c5c62e](https://github.com/RSSNext/follow/commit/8c5c62e0d698f3a0d72a2ef0595e44986c95320b))
* handle popstate for navigation in mobile entry content ([#2038](https://github.com/RSSNext/follow/issues/2038)) ([ab85406](https://github.com/RSSNext/follow/commit/ab85406d4f7137b6f85c85a528c42d598dbcb573))
* handle tipUsers migration for older feed versions ([#1384](https://github.com/RSSNext/follow/issues/1384)) ([2ca6d80](https://github.com/RSSNext/follow/commit/2ca6d807e3c0626eca79dd6789ae20cdc0639fc3))
* handle undefined arguments in executeJavaScript call ([#1958](https://github.com/RSSNext/follow/issues/1958)) ([51519e2](https://github.com/RSSNext/follow/commit/51519e2d7a1a7aee81041c88ec978864903d0b2d))
* handling default port in proxy configuration ([0bd76a2](https://github.com/RSSNext/follow/commit/0bd76a24a240951782d44b7e38040c305bb2b9b9))
@@ -167,6 +175,7 @@
* mobile pop back to entry list will refresh data ([3c18768](https://github.com/RSSNext/follow/commit/3c18768968aeb4635933ae616c52de55b6fad2ab))
* 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 exiting transition type ([5bb0100](https://github.com/RSSNext/follow/commit/5bb01006ad04f8e5ed93076905b78b74ce293f79))
* **modal:** close button can not click on electron ([c544dfc](https://github.com/RSSNext/follow/commit/c544dfcc8d4613e8d4f6025dd8a60cf679881680))
* **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))
@@ -216,6 +225,7 @@
* remove prev entries ids ref ([996629c](https://github.com/RSSNext/follow/commit/996629c14c752f76b65d423ebc23d60b315dee77))
* remove skeleton when app load but in 404 ([54d4e52](https://github.com/RSSNext/follow/commit/54d4e529c796e6cc22c36b2a9a1e949b1dad5b37))
* remove stack when close sheet ([eeb785d](https://github.com/RSSNext/follow/commit/eeb785de3f822166a04b3e6916fc107fb600db25)), closes [#1910](https://github.com/RSSNext/follow/issues/1910)
* remove URL.canParse ([8ce4702](https://github.com/RSSNext/follow/commit/8ce4702df34e2667fb6d666329f6bf88f8f7e2da)), closes [#2103](https://github.com/RSSNext/follow/issues/2103)
* remove vercel header rewrite ([#1463](https://github.com/RSSNext/follow/issues/1463)) ([#1480](https://github.com/RSSNext/follow/issues/1480)) ([94971da](https://github.com/RSSNext/follow/commit/94971dad4e1d828aa4c90d8f02445cc04a8500c9))
* remove vercel header rewrite for assets ([79e6f48](https://github.com/RSSNext/follow/commit/79e6f483265216773e0ccf5ac0690d06300d3e80))
* remove wdyr in prod ([70e3b72](https://github.com/RSSNext/follow/commit/70e3b72b0ae88a722e2ff9e7d6027003f88829e2))
@@ -228,6 +238,7 @@
* scroll out mark read logic ([eaecb25](https://github.com/RSSNext/follow/commit/eaecb252d322b5f2e8e89873523dfbe8d213848c))
* scroll out to mark read in mobile ([a44d598](https://github.com/RSSNext/follow/commit/a44d59820ba7e62b5db9de478f813cd9f287f670))
* scroll state for mobile float bar ([126206b](https://github.com/RSSNext/follow/commit/126206b995f47c17ed60c2a07296987dd0b8dc95))
* scrollbar z-index ([2b2d56c](https://github.com/RSSNext/follow/commit/2b2d56c746fc5cb44cd344cb7911f100f17114fe))
* **security:** add dompurify for raw document string pre-cleaning on readability to avoid xss attack ([#2000](https://github.com/RSSNext/follow/issues/2000)) ([f2ed678](https://github.com/RSSNext/follow/commit/f2ed678afc5a17b099a5931aa5af3a36138750d0))
* selected id state ([36cdbbd](https://github.com/RSSNext/follow/commit/36cdbbd706c41b10b6fd19d84756b35f8c0a3f8b))
* selecting state ([146fe8f](https://github.com/RSSNext/follow/commit/146fe8fa5ccf4c6211bb5d72be9efbb0714de878))
@@ -279,14 +290,17 @@
* **translations:** update zh-CN locale files for accuracy ([#1739](https://github.com/RSSNext/follow/issues/1739)) ([83c9f71](https://github.com/RSSNext/follow/commit/83c9f717dd7092dc4a4b1106961d746988066fd9))
* trending api based on language ([83ca873](https://github.com/RSSNext/follow/commit/83ca87349598acc361c8128bbcb014d89fcb56cf))
* trial limit ([eee2bf8](https://github.com/RSSNext/follow/commit/eee2bf8771d2d30bba1f534984e3ca8d5e26cf04))
* try fix appImage icon config ([9d62c55](https://github.com/RSSNext/follow/commit/9d62c55d062044bfa008ff58872b26e8c9e76011))
* try fix dayjs init ([093f80d](https://github.com/RSSNext/follow/commit/093f80d9da223c567125285cc0f312f419bb4042))
* try fix float bar inset bottom ([3110f95](https://github.com/RSSNext/follow/commit/3110f953da896302a90bb65bd44de034fbb87ec4))
* try remove skeleton ([e0d9502](https://github.com/RSSNext/follow/commit/e0d9502b160928fa4d7b3fa870b948f17aa56eef))
* try stable sort result for feed list ([677b2ea](https://github.com/RSSNext/follow/commit/677b2ea214cc116b748879628a8745ca17609043))
* try to fix linux appImage icon ([c8db70b](https://github.com/RSSNext/follow/commit/c8db70b6ff953cfd006c2ff83c988bcb92ead358))
* ts import ([14311dd](https://github.com/RSSNext/follow/commit/14311dde0a9cb14e797e1a0f654a11f8502e58f8))
* turbo build cmd ([0b9c279](https://github.com/RSSNext/follow/commit/0b9c279fccd25231b90810359125571f817b7f7c))
* tweak boost progress calculation ([#1594](https://github.com/RSSNext/follow/issues/1594)) ([bd2d9d1](https://github.com/RSSNext/follow/commit/bd2d9d1175e953b199d8d686ac83d124caffbfef))
* type error ([4d7365f](https://github.com/RSSNext/follow/commit/4d7365facf51c427e5005af7fdc0e4d6d7354e84))
* types ([b22f325](https://github.com/RSSNext/follow/commit/b22f32594c4bba16eaf64d1aa3906e2b8e56fd3e))
* types ([8241b28](https://github.com/RSSNext/follow/commit/8241b280c9b0fd4fbace59cebf220cdb562c593a))
* typo ([f9a6772](https://github.com/RSSNext/follow/commit/f9a6772af805929338bd92e10605b855d6566d13))
* **ui:** resolve conflict between video progress bar and swiper drag … ([#1337](https://github.com/RSSNext/follow/issues/1337)) ([aa9206f](https://github.com/RSSNext/follow/commit/aa9206f5b1e3ea0c008f912ef22cdaa406546251))
@@ -294,7 +308,9 @@
* **ui:** user profile follow button style ([d629215](https://github.com/RSSNext/follow/commit/d629215305a0ec9323dea0db929582e9609a82f6))
* update class names for responsive design and modify zh-HK ([#1782](https://github.com/RSSNext/follow/issues/1782)) ([70b46f5](https://github.com/RSSNext/follow/commit/70b46f57bf476df15216efd440899798e0e1fa0b))
* update daily claim amount reference in tooltip ([#1487](https://github.com/RSSNext/follow/issues/1487)) ([3792c2d](https://github.com/RSSNext/follow/commit/3792c2d850d9fc3f96ea4591784b61c631ee7e86))
* update electron to resolve present context menu ([2d31b64](https://github.com/RSSNext/follow/commit/2d31b646fd896e6ba55782c447b5d6ad9b327623))
* update empty category correctly ([c7efc67](https://github.com/RSSNext/follow/commit/c7efc67636b4d8b39ec50e26eb2d4839d0cd8750))
* update i18n-detector ([7969022](https://github.com/RSSNext/follow/commit/7969022657b4fe2b5c9a0a0f93467604f697d796))
* update tray icon path for windows and improve tray behavior ([#1511](https://github.com/RSSNext/follow/issues/1511)) ([3706874](https://github.com/RSSNext/follow/commit/3706874e42c215a84df71eae1c135a114be8985a))
* update version toast ([25e7cea](https://github.com/RSSNext/follow/commit/25e7cea3c139335960c3de2922cf0ffa9c9c6c39)), closes [#1450](https://github.com/RSSNext/follow/issues/1450)
* **upgrade:** changelog container should w-full ([1551bf6](https://github.com/RSSNext/follow/commit/1551bf648c511cbf615f515b2e2d93077b0e42b4))
@@ -305,6 +321,7 @@
* vercel do not support `__` prefix for api route ([45a66e0](https://github.com/RSSNext/follow/commit/45a66e0f972d18831795d92b1d3c1f3893f396dc))
* vercel rewrite config ([#1203](https://github.com/RSSNext/follow/issues/1203)) ([c954d61](https://github.com/RSSNext/follow/commit/c954d61f074e282a9a86cbf1d1546748871c20e7))
* video media can not play in video view ([4cbf8a5](https://github.com/RSSNext/follow/commit/4cbf8a54fcf11fb71ff935baee52c79a83f5035c)), closes [#1645](https://github.com/RSSNext/follow/issues/1645)
* **video:** open entry url directly on mobile ([0eed6d1](https://github.com/RSSNext/follow/commit/0eed6d1b237a612981938b32ce884b5f0c1bd13b))
* When pasting the entire URL, auto adjust the URL prefix ([#1762](https://github.com/RSSNext/follow/issues/1762)) ([3c7aeac](https://github.com/RSSNext/follow/commit/3c7aeacc90cbdcbe6bf4b06572d74f269f2c8854)), closes [#1761](https://github.com/RSSNext/follow/issues/1761)
* window titlebar maximize state sync, fixed [#1982](https://github.com/RSSNext/follow/issues/1982) ([#1989](https://github.com/RSSNext/follow/issues/1989)) ([7ad1e30](https://github.com/RSSNext/follow/commit/7ad1e305c3167633d58b6b621dba2cd63d1cf528))
* wrap with Ellipsis ([3ba9093](https://github.com/RSSNext/follow/commit/3ba90936931ad36790a68ee90a2c1582054bb90a))
@@ -314,16 +331,19 @@
### Features
* achievement badge ([aceb4c9](https://github.com/RSSNext/follow/commit/aceb4c964f8d62cd64d26b321021b0b0534677bb))
* action page ([#2006](https://github.com/RSSNext/follow/issues/2006)) ([6d9212e](https://github.com/RSSNext/follow/commit/6d9212ef481cf784f84ab25da3c9a819e6637b63))
* add all language filter in discover ([#1598](https://github.com/RSSNext/follow/issues/1598)) ([cefdd6e](https://github.com/RSSNext/follow/commit/cefdd6e36cdc3c3ebe62df525d98da516290e286))
* 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 application tray functionality ([#1416](https://github.com/RSSNext/follow/issues/1416)) ([76a6e38](https://github.com/RSSNext/follow/commit/76a6e38376a01dbeee83161cdce9fe5e205b1523))
* add auto-expand setting for long social media entries and remove placeholder component, fixed [#2064](https://github.com/RSSNext/follow/issues/2064) ([639b922](https://github.com/RSSNext/follow/commit/639b922ec88ac431f14f9fe5bbb7f4b31bfc59fd))
* add confirmation for opening external apps ([#1618](https://github.com/RSSNext/follow/issues/1618)) ([08a1e76](https://github.com/RSSNext/follow/commit/08a1e76247b3c7ddeb7ef906a27f149e1a46e3d6))
* add entry conditions for actions ([53810ba](https://github.com/RSSNext/follow/commit/53810badc1a7b37be6fd5c187c7a97428e85405f))
* add feed booster achievement with localization ([#1561](https://github.com/RSSNext/follow/issues/1561)) ([e769852](https://github.com/RSSNext/follow/commit/e7698526c2d51232cbdcb279aead6e473b7507a9))
* add follow user button in profile modal ([#1147](https://github.com/RSSNext/follow/issues/1147)) ([7c60d5e](https://github.com/RSSNext/follow/commit/7c60d5e91dd4a21872217427bd99fe8eae688ce1))
* add hydrate data type-safe helper ([cb6a65b](https://github.com/RSSNext/follow/commit/cb6a65b7cc1651d86b83b5b4089a7145cd59b0be))
* add image preview in picture gallery images ([59728a8](https://github.com/RSSNext/follow/commit/59728a89295c2a9c6130651d06699eef027fef5e))
* add list madeby ([03858b1](https://github.com/RSSNext/follow/commit/03858b18b8de5cffb2add05d72fdbf5e229e6cf4))
* add mobile top timeline setting ([fe48d7c](https://github.com/RSSNext/follow/commit/fe48d7cf02a202a1f14bbfe3abe4c813629ac968))
* add more actions to entry header ([#1993](https://github.com/RSSNext/follow/issues/1993)) ([5c4b5f0](https://github.com/RSSNext/follow/commit/5c4b5f0095cff53f1ce70d66f2275d0a9c73e985))
* add old browser check ([a4796ce](https://github.com/RSSNext/follow/commit/a4796ce4c9a0d1558b9467b80f1f0806dfaba321))
@@ -331,6 +351,7 @@
* add reveal log file ([adbdf74](https://github.com/RSSNext/follow/commit/adbdf7472b6789a365489b2c5b09dd503ec648e9))
* add sentry trace id ([40843ac](https://github.com/RSSNext/follow/commit/40843ac79f390d0db81490522475a3557f57b2e4))
* add server announcement toast ([7b34357](https://github.com/RSSNext/follow/commit/7b3435749b8516466eae388172694f22d6b26a83))
* add translation for "show more" and update zh-HK file ([#2033](https://github.com/RSSNext/follow/issues/2033)) ([6f7095e](https://github.com/RSSNext/follow/commit/6f7095e9ab124770f64145b62288cfb092fcf002))
* add updatelog modal ([84228bc](https://github.com/RSSNext/follow/commit/84228bc5c8755c4b957bc901e6e552ef176ed00c))
* add zen mode quick menu item and reduce check show sidebar interval ([f5d43d6](https://github.com/RSSNext/follow/commit/f5d43d6480727e0e5e3f341c0c4c3e7a1f73ce81))
* adjust more ui ([08929ab](https://github.com/RSSNext/follow/commit/08929ab3ae15758850d04b82f7773358579c4a78))
@@ -338,6 +359,7 @@
* allow fille default title when editing feed ([495b29e](https://github.com/RSSNext/follow/commit/495b29e5898f18506577016dfe358f9c0add8035)), closes [#1503](https://github.com/RSSNext/follow/issues/1503)
* and or condition for action ([#1616](https://github.com/RSSNext/follow/issues/1616)) ([4193a6b](https://github.com/RSSNext/follow/commit/4193a6b14d284a5e399fe94d9f305146179a75b4))
* **app:** support cache limit and clean cache ([dee294d](https://github.com/RSSNext/follow/commit/dee294dda589ca9e2eaee8a7e55197635b6323c7))
* bigger font size in mobile ([3e9a92d](https://github.com/RSSNext/follow/commit/3e9a92d16a80139c851671748367f009a3af4de9))
* bring rehypeUrlToAnchor back ([6f0cc4d](https://github.com/RSSNext/follow/commit/6f0cc4d566c9f2f552f0fedf1a8e570a817e0f56)), closes [#1373](https://github.com/RSSNext/follow/issues/1373)
* customizable columns for masonry view, closed [#1749](https://github.com/RSSNext/follow/issues/1749) ([0e0ce84](https://github.com/RSSNext/follow/commit/0e0ce843235f01f33f4c5b9708aa67dac5901b46))
* discover rsshub card background use single color ([7eeea5e](https://github.com/RSSNext/follow/commit/7eeea5e694c142803a37564ef8886d4fc4d2dab4))
@@ -349,6 +371,7 @@
* export database ([85b4502](https://github.com/RSSNext/follow/commit/85b4502f9c113b8de73ccf4a167aa514a3c149ea))
* **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))
* feed description in list page ([8e248ad](https://github.com/RSSNext/follow/commit/8e248ad733b94514213e56a796e68b490d3588ef))
* fetch stream entry content ([1739208](https://github.com/RSSNext/follow/commit/173920802edf1f4e13eee68bf5d541391ca6ebf9))
* focusable ([eb01d03](https://github.com/RSSNext/follow/commit/eb01d030129f6196d6e9855be42a218be9d5668b))
* fold the long text content of social media ([e46b30a](https://github.com/RSSNext/follow/commit/e46b30a07fe74e1bacb234962b1542c849d2177d))
@@ -362,18 +385,22 @@
* **integration:** add outline integration ([#1229](https://github.com/RSSNext/follow/issues/1229)) ([0d0266b](https://github.com/RSSNext/follow/commit/0d0266b25189a74efdc63ce0062f3a379d4a0729))
* **integration:** Add readeck integration ([#1972](https://github.com/RSSNext/follow/issues/1972)) ([1ce3f5b](https://github.com/RSSNext/follow/commit/1ce3f5b8ba95b16ad1b12e702027cede3590491a))
* List delete add secondary confirmation ([#1254](https://github.com/RSSNext/follow/issues/1254)) ([14f2bac](https://github.com/RSSNext/follow/commit/14f2bac8f3ba7e8f2dbd3958a4394c5b11ea2537))
* list preview ([ae390f7](https://github.com/RSSNext/follow/commit/ae390f7afabf3e312217bf13a175e2036c2c2763))
* load archived entries automatically ([5fe9e0c](https://github.com/RSSNext/follow/commit/5fe9e0c0e24460ca0fe435db03b753e9dcd3df17))
* manual action ([#1867](https://github.com/RSSNext/follow/issues/1867)) ([0eedbba](https://github.com/RSSNext/follow/commit/0eedbbadc263b474e2d4bfd5b6c498ac39c16c34))
* **mark-all-button:** add countdown to auto-confirm message ([#1414](https://github.com/RSSNext/follow/issues/1414)) ([e1a5fc6](https://github.com/RSSNext/follow/commit/e1a5fc63f20c941140071789c9b67685da19ea5c))
* merge redirect page into login page ([2fa16b7](https://github.com/RSSNext/follow/commit/2fa16b75d376fe04472e6c91675c67e725da8633))
* migrate to better auth ([#1951](https://github.com/RSSNext/follow/issues/1951)) ([9102203](https://github.com/RSSNext/follow/commit/910220395631bcf86f56bfc2b2168ac95852444c))
* mobile design ([#1568](https://github.com/RSSNext/follow/issues/1568)) ([edd4f9e](https://github.com/RSSNext/follow/commit/edd4f9e5a6dc041e9eae2cee5ddf4eb624527ef5)), closes [#1575](https://github.com/RSSNext/follow/issues/1575)
* move feed to new category in context menu ([#2072](https://github.com/RSSNext/follow/issues/2072)) ([d684e14](https://github.com/RSSNext/follow/commit/d684e14056581744ac78ca697fa5ca059294245e))
* move hideExtraBadge ([2f14c30](https://github.com/RSSNext/follow/commit/2f14c30307a895bc866ac57989df1dc624eab4e6))
* move replaceImgUrlIfNeed ([4a4ecee](https://github.com/RSSNext/follow/commit/4a4ecee7f199ea292a6da7293388ef249e91c766))
* multi select with shift ([2158b1c](https://github.com/RSSNext/follow/commit/2158b1cc255baf3ff5e4e1a5806d85b7df64bd55)), closes [#1256](https://github.com/RSSNext/follow/issues/1256)
* new user guide in mobile ([9eca05e](https://github.com/RSSNext/follow/commit/9eca05ef6f3612658397719a0af00dfc30196ca3))
* **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))
* redesign login modal ([77dd6ce](https://github.com/RSSNext/follow/commit/77dd6ce2f97ea659def1104119085db3201ec029))
* remove DISABLE_PERSONAL_DAILY_POWER ([064f8f5](https://github.com/RSSNext/follow/commit/064f8f524398a451d46e88b2d8b604f807d4ea96))
* remove entries total and remaining to reduce big queries ([df343b1](https://github.com/RSSNext/follow/commit/df343b10d0745a239e3b15fe11c1d3b2cd9ac3bb))
* remove entryCount in feed claim list ([723cc43](https://github.com/RSSNext/follow/commit/723cc43891e3fe7e3ce8c09a422df9fdd42577be))
@@ -388,6 +415,7 @@
* support alway on top, fixed [#1740](https://github.com/RSSNext/follow/issues/1740) ([09df663](https://github.com/RSSNext/follow/commit/09df663a1c0b9a5ec5d30f2609a36b09c3e66e56))
* support drag-and-drop when importing opml ([#2001](https://github.com/RSSNext/follow/issues/2001)) ([bad7be9](https://github.com/RSSNext/follow/commit/bad7be9a8fa0d49c92d2cd17d441303643564f57))
* support markdown for announcement content ([539ec03](https://github.com/RSSNext/follow/commit/539ec03293fc6e3a11dbec69bbf78fe1c5dd2e8c))
* support read indicator and back to top, fixed [#2040](https://github.com/RSSNext/follow/issues/2040) ([dac1a47](https://github.com/RSSNext/follow/commit/dac1a47b0eedc083b8a94291373873f4a2315894))
* support zen mode sidebar entry timeline selector ([4ab132c](https://github.com/RSSNext/follow/commit/4ab132c593a7acce0167d02f6025030775a9fac5))
* **trending:** support language filter ([1cb5b73](https://github.com/RSSNext/follow/commit/1cb5b73eb5901f242d79f357d52bca7af5d8c8b3))
* unified feed title ([b86afe5](https://github.com/RSSNext/follow/commit/b86afe5a9789ad13c5a026adf553d2c6bc333bff))
@@ -397,6 +425,7 @@
* update server hono ([5beaca3](https://github.com/RSSNext/follow/commit/5beaca3c772d7bc097fd53779c581eb6b41c9eaa))
* update text ([5aae827](https://github.com/RSSNext/follow/commit/5aae8273dcd999bc11904bc8c9d7b72e769fa200))
* update text ([89bef43](https://github.com/RSSNext/follow/commit/89bef43267199f60de376c3998d3cfff26faad23))
* update toast style ([cf5eeb6](https://github.com/RSSNext/follow/commit/cf5eeb63c488f9978f12659af59286315b768eea))
* update zh-HK file ([#1955](https://github.com/RSSNext/follow/issues/1955)) ([9364761](https://github.com/RSSNext/follow/commit/936476169caba5cbacafe6f4d35f7857add32802))
* upload arm64 dmg separately ([1d77c09](https://github.com/RSSNext/follow/commit/1d77c092ce18fbabe6cfbbd21d9a96e3445795da))
* use FeedTitle ([73d2c30](https://github.com/RSSNext/follow/commit/73d2c30416ad3f2da626db003996c0fb036025ac))
@@ -413,6 +442,7 @@
* enable router navigation transition ([24e1aea](https://github.com/RSSNext/follow/commit/24e1aead5e9bbb98b59194166fa4fd07eb167353))
* lazy show action, reduce lcp time ([fcf775c](https://github.com/RSSNext/follow/commit/fcf775c976591258f83dea6e34ca3161b539b15e))
* modify some animations to CSS animations ([9ec3fe5](https://github.com/RSSNext/follow/commit/9ec3fe562bf3527ad4279a9a57c0b0bb5934dba1))
* optimize dnd re-render ([12bd659](https://github.com/RSSNext/follow/commit/12bd6594585fda9f7b83daad7f6eebae3059d985))
* optmize masonry perfermance ([d1748c6](https://github.com/RSSNext/follow/commit/d1748c6ce93f7075270d8cc6e88cbd944d165d50))
* reduce mobile entry header re-render ([44646d8](https://github.com/RSSNext/follow/commit/44646d8a86fde1bbf72831477b61774c75414e24))
* reduce re-render zooming ([9b35074](https://github.com/RSSNext/follow/commit/9b350741d16cfd81770e82b866e92d732498ccf3))
+3 -3
View File
@@ -33,13 +33,13 @@
"builder-util-runtime": "9.2.10",
"dompurify": "~3.2.2",
"electron-context-menu": "4.0.4",
"electron-log": "5.2.3",
"electron-log": "5.2.4",
"electron-squirrel-startup": "1.0.1",
"electron-updater": "^6.3.9",
"es-toolkit": "1.29.0",
"fast-folder-size": "2.3.0",
"font-list": "1.5.1",
"i18next": "^24.0.2",
"i18next": "^24.0.5",
"js-yaml": "4.1.0",
"linkedom": "^0.18.5",
"lowdb": "7.0.1",
@@ -55,6 +55,6 @@
"@types/node": "^22.10.1",
"electron": "33.2.0",
"electron-devtools-installer": "3.2.0",
"hono": "4.6.12"
"hono": "4.6.13"
}
}
+16 -5
View File
@@ -8,6 +8,19 @@ import { isDev } from "~/env"
const userAgents = `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36 ${name}/${version}`
// For avoiding xss attack from readability, the raw document string should be sanitized.
// The xss attack in electron may lead to more serious outcomes than browser environment.
// It may allows remotely execute malicious scripts in main process.
// Before the sanitizing, the DOMPurify requires a `window` environment provided by linkedom.
function sanitizeHTMLString(dirtyDocumentString: string) {
const parser = parseHTML(dirtyDocumentString)
const purify = DOMPurify(parser.window)
// How do DOMPurify changes the origin html structure,
// You can refer its document https://github.com/cure53/DOMPurify?tab=readme-ov-file#can-i-configure-dompurify
const sanitizedDocumentString = purify.sanitize(dirtyDocumentString)
return sanitizedDocumentString
}
export async function readability(url: string) {
const dirtyDocumentString = await fetch(url, {
headers: {
@@ -27,15 +40,13 @@ export async function readability(url: string) {
return res.text()
})
// For avoid xss attack from readability, the raw document string should be purified.
const cleanedDocumentString = DOMPurify.sanitize(dirtyDocumentString)
const sanitizedDocumentString = sanitizeHTMLString(dirtyDocumentString)
const baseUrl = new URL(url).origin
// FIXME: linkedom does not handle relative addresses in strings. Refer to
// @see https://github.com/WebReflection/linkedom/issues/153
// JSDOM handles it correctly, but JSDOM introduces canvas binding.
const { document } = parseHTML(cleanedDocumentString)
const baseUrl = new URL(url).origin
const { document } = parseHTML(sanitizedDocumentString)
document.querySelectorAll("a").forEach((a) => {
a.href = replaceRelativeAddress(baseUrl, a.href)
+1
View File
@@ -15,6 +15,7 @@ export default defineProject({
},
plugins: [
// @ts-expect-error
tsconfigPath({
projects: ["./tsconfig.json"],
}),
+1
View File
@@ -0,0 +1 @@
../../.env
+24 -24
View File
@@ -11,7 +11,7 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@dnd-kit/core": "^6.2.0",
"@dnd-kit/core": "^6.3.1",
"@egoist/tipc": "0.3.2",
"@electron-toolkit/preload": "^3.0.1",
"@follow/electron-main": "workspace:*",
@@ -19,7 +19,7 @@
"@fontsource/sn-pro": "5.1.0",
"@headlessui/react": "2.2.0",
"@hookform/resolvers": "3.9.1",
"@lottiefiles/dotlottie-react": "0.10.1",
"@lottiefiles/dotlottie-react": "0.11.0",
"@microflash/remark-callout-directives": "4.3.2",
"@openpanel/web": "1.0.1",
"@radix-ui/react-avatar": "1.1.1",
@@ -31,13 +31,13 @@
"@radix-ui/react-popover": "1.1.2",
"@radix-ui/react-slider": "^1.2.1",
"@radix-ui/react-slot": "1.1.0",
"@sentry/react": "8.41.0",
"@shikijs/transformers": "1.24.0",
"@tanstack/query-sync-storage-persister": "5.62.0",
"@tanstack/react-query": "5.62.0",
"@tanstack/react-query-devtools": "5.62.0",
"@tanstack/react-query-persist-client": "5.62.0",
"@tanstack/react-virtual": "3.10.9",
"@sentry/react": "8.42.0",
"@shikijs/transformers": "1.24.1",
"@tanstack/query-sync-storage-persister": "5.62.3",
"@tanstack/react-query": "5.62.3",
"@tanstack/react-query-devtools": "5.62.3",
"@tanstack/react-query-persist-client": "5.62.3",
"@tanstack/react-virtual": "3.11.0",
"@use-gesture/react": "10.3.1",
"@welldone-software/why-did-you-render": "8.0.3",
"@yornaath/batshit": "0.10.1",
@@ -49,24 +49,24 @@
"dexie": "4.0.10",
"dexie-export-import": "^4.1.4",
"dnum": "^2.14.0",
"electron-log": "5.2.3",
"electron-log": "5.2.4",
"embla-carousel-react": "8.5.1",
"embla-carousel-wheel-gestures": "8.0.1",
"es-toolkit": "1.29.0",
"firebase": "11.0.2",
"foxact": "0.2.42",
"framer-motion": "11.12.0",
"foxact": "0.2.43",
"framer-motion": "11.13.1",
"franc-min": "6.2.0",
"fuse.js": "7.0.0",
"hast-util-to-jsx-runtime": "2.3.2",
"hast-util-to-mdast": "^10.1.1",
"hast-util-to-text": "4.0.2",
"i18next": "^24.0.2",
"i18next-browser-languagedetector": "8.0.0",
"i18next": "^24.0.5",
"i18next-browser-languagedetector": "8.0.2",
"idb-keyval": "6.2.1",
"immer": "10.1.1",
"jotai": "2.10.3",
"katex": "0.16.11",
"katex": "0.16.14",
"lethargy": "1.0.9",
"masonic": "4.0.1",
"mdast-util-gfm-table": "^2.0.0",
@@ -79,13 +79,13 @@
"react-blurhash": "^0.3.0",
"react-error-boundary": "4.1.2",
"react-fast-marquee": "1.6.5",
"react-hook-form": "7.53.2",
"react-hook-form": "7.54.0",
"react-hotkeys-hook": "4.6.1",
"react-i18next": "^15.1.3",
"react-intersection-observer": "9.13.1",
"react-ios-pwa-prompt": "^2.0.6",
"react-resizable-layout": "npm:@innei/react-resizable-layout@0.7.3-fork.1",
"react-router": "7.0.1",
"react-router": "7.0.2",
"react-selecto": "^1.26.3",
"react-shadow": "20.5.0",
"react-zoom-pan-pinch": "^3.6.1",
@@ -98,22 +98,22 @@
"remark-gh-alerts": "0.0.3",
"remark-parse": "11.0.0",
"remark-rehype": "11.1.1",
"shiki": "1.24.0",
"sonner": "1.7.0",
"tldts": "6.1.65",
"shiki": "1.24.1",
"sonner": "1.7.1",
"tldts": "6.1.66",
"unified": "11.0.5",
"unist-util-visit-parents": "^6.0.1",
"use-context-selector": "2.0.0",
"use-pull-to-refresh": "2.4.1",
"use-sync-external-store": "1.2.2",
"use-sync-external-store": "1.4.0",
"usehooks-ts": "3.1.0",
"vfile": "6.0.3",
"web-push": "3.6.7",
"zod": "3.23.8",
"zustand": "5.0.1"
"zustand": "5.0.2"
},
"devDependencies": {
"@babel/generator": "7.26.2",
"@babel/generator": "7.26.3",
"@follow/atoms": "workspace:*",
"@follow/components": "workspace:*",
"@follow/constants": "workspace:*",
@@ -133,6 +133,6 @@
"happy-dom": "15.11.7",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-scan": "0.0.35"
"react-scan": "0.0.41"
}
}
+5
View File
@@ -20,6 +20,7 @@ export const useFeedUnreadIsDirty = (feedId: string) => {
() =>
selectAtom(feedUnreadDirtySetAtom, (set) => {
const isRealFeedId = isBizId(feedId)
if (isRealFeedId) return set.has(feedId)
if (feedId.startsWith(ROUTE_FEED_IN_LIST) || feedId.startsWith(INBOX_PREFIX_ID)) {
@@ -67,3 +68,7 @@ export const clearFeedUnreadDirty = (feedId: string) => {
return newSet
})
}
export const clearAllFeedUnreadDirty = () => {
jotaiStore.set(feedUnreadDirtySetAtom, new Set())
}
+3 -4
View File
@@ -1,4 +1,5 @@
import { getStorageNS } from "@follow/utils/ns"
import { parseSafeUrl } from "@follow/utils/utils"
import { noop } from "foxact/noop"
import { atomWithStorage, createJSONStorage } from "jotai/utils"
import type { SyncStorage } from "jotai/vanilla/utils/atomWithStorage"
@@ -80,10 +81,8 @@ export const AudioPlayer = {
show: true,
listId: routeParams.listId,
})
const currentUrl = URL.canParse(this.audio.src)
? new URL(this.audio.src).toString()
: this.audio.src
const newUrl = URL.canParse(v.src) ? new URL(v.src).toString() : v.src
const currentUrl = parseSafeUrl(this.audio.src)?.toString() ?? this.audio.src
const newUrl = parseSafeUrl(v.src)?.toString() ?? v.src
if (currentUrl !== newUrl) {
this.audio.src = v.src
+2 -1
View File
@@ -26,8 +26,9 @@ const createDefaultSettings = (): GeneralSettings => ({
hoverMarkUnread: true,
renderMarkUnread: false,
// UX
groupByDate: true,
autoExpandLongSocialMedia: false,
// Secure
jumpOutLinkWarn: true,
// TTS
@@ -54,10 +54,10 @@ export function SwipeMedia({
)}
>
{uniqMedia?.length ? (
<div ref={emblaRef} className="w-full overflow-hidden">
<div className="flex">
<div ref={emblaRef} className="size-full overflow-hidden">
<div className="flex size-full">
{uniqMedia?.slice(0, 5).map((med, i) => (
<div className="mr-2 w-full flex-none" key={med.url}>
<div className="mr-2 size-full flex-none" key={med.url}>
<Media
className={cn(imgClassName, "size-full rounded-none")}
alt="cover"
@@ -435,7 +435,7 @@ const FallbackableImage: FC<
)}
{isAllError && (
<div
className="center pointer-events-none absolute inset-0 flex-col gap-6 text-white/80"
className="center pointer-events-none absolute inset-0 flex-col gap-6"
onClick={stopPropagation}
tabIndex={-1}
>
@@ -1,4 +1,4 @@
import type { Target } from "framer-motion"
import type { MotionProps, Target } from "framer-motion"
import { microReboundPreset } from "../../constants/spring"
@@ -14,9 +14,15 @@ const initialStyle: Target = {
export const modalMontionConfig = {
initial: initialStyle,
animate: enterStyle,
exit: initialStyle,
exit: {
...initialStyle,
// no spring
transition: {
type: "tween",
},
},
transition: microReboundPreset,
}
} satisfies MotionProps
// Radix context menu z-index 999
export const MODAL_STACK_Z_INDEX = 1001
@@ -1,4 +0,0 @@
export const ReactVirtuosoItemPlaceholder = () => (
// NOTE: prevent 0 height element, react virtuoso will not stop render any more
<div className="h-[0.5px] shrink-0" />
)
@@ -1,7 +1,8 @@
import { cn } from "@follow/utils/utils"
import type { Target } from "framer-motion"
import { AnimatePresence, m } from "framer-motion"
import { useEffect, useState } from "react"
import * as React from "react"
import { cloneElement, useEffect, useState } from "react"
type TransitionType = {
initial: Target | boolean
@@ -10,8 +11,8 @@ type TransitionType = {
}
type IconTransitionProps = {
icon1: string
icon2: string
icon1: string | React.JSX.Element
icon2: string | React.JSX.Element
status: "init" | "done"
className?: string
icon1ClassName?: string
@@ -34,14 +35,24 @@ const createIconTransition =
return (
<AnimatePresence mode="popLayout">
{status === "init" ? (
<m.i
className={cn(icon1ClassName, className, icon1)}
key="1"
initial={initial}
animate={animate}
exit={exit}
/>
) : (
typeof icon1 === "string" ? (
<m.i
className={cn(icon1ClassName, className, icon1)}
key="1"
initial={initial}
animate={animate}
exit={exit}
/>
) : (
cloneElement(icon1, {
className: cn(icon1ClassName, className),
key: "1",
initial,
animate,
exit,
})
)
) : typeof icon2 === "string" ? (
<m.i
className={cn(icon2ClassName, className, icon2)}
key="2"
@@ -49,6 +60,14 @@ const createIconTransition =
animate={animate}
exit={exit}
/>
) : (
cloneElement(icon2, {
className: cn(icon2ClassName, className),
key: "2",
initial,
animate,
exit,
})
)}
</AnimatePresence>
)
+65 -3
View File
@@ -18,16 +18,24 @@ import { useFeedClaimModal } from "~/modules/claim"
import { FeedForm } from "~/modules/discover/feed-form"
import { InboxForm } from "~/modules/discover/inbox-form"
import { ListForm } from "~/modules/discover/list-form"
import { ListCreationModalContent } from "~/modules/settings/tabs/lists/modals"
import {
CategoryCreationModalContent,
ListCreationModalContent,
} from "~/modules/settings/tabs/lists/modals"
import { useResetFeed } from "~/queries/feed"
import { getFeedById, useFeedById } from "~/store/feed"
import { useInboxById } from "~/store/inbox"
import { listActions, useListById, useOwnedListByView } from "~/store/list"
import { subscriptionActions, useSubscriptionByFeedId } from "~/store/subscription"
import {
subscriptionActions,
useCategoriesByView,
useSubscriptionByFeedId,
useSubscriptionsByFeedIds,
} from "~/store/subscription"
import { useNavigateEntry } from "./useNavigateEntry"
import { getRouteParams } from "./useRouteParams"
import { useDeleteSubscription } from "./useSubscriptionActions"
import { useBatchUpdateSubscription, useDeleteSubscription } from "./useSubscriptionActions"
const ConfirmDestroyModalContent = ({ onConfirm }: { onConfirm: () => void }) => {
const { t } = useTranslation()
@@ -68,9 +76,14 @@ export const useFeedActions = ({
siteUrl: feed.siteUrl,
}
})
const inbox = useInboxById(feedId)
const isInbox = !!inbox
const subscription = useSubscriptionByFeedId(feedId)
const subscriptions = useSubscriptionsByFeedIds(
useMemo(() => feedIds || [feedId], [feedId, feedIds]),
)
const { present } = useModalStack()
const deleteSubscription = useDeleteSubscription({})
const claimFeed = useFeedClaimModal()
@@ -81,9 +94,11 @@ export const useFeedActions = ({
const { mutateAsync: addFeedToListMutation } = useAddFeedToFeedList()
const { mutateAsync: removeFeedFromListMutation } = useRemoveFeedFromFeedList()
const { mutateAsync: resetFeed } = useResetFeed()
const { mutate: addFeedsToCategoryMutation } = useBatchUpdateSubscription()
const openBoostModal = useBoostModal()
const listByView = useOwnedListByView(view!)
const categories = useCategoriesByView(view!)
const isMultipleSelection = feedIds && feedIds.length > 1 && feedIds.includes(feedId)
@@ -192,6 +207,53 @@ export const useFeedActions = ({
},
],
},
{
type: "text" as const,
label: t("sidebar.feed_column.context_menu.add_feeds_to_category"),
disabled: isInbox,
supportMultipleSelection: true,
submenu: [
...Array.from(categories.values()).map((category) => {
const isIncluded = isMultipleSelection
? subscriptions.every((s) => s.category === category)
: subscription?.category === category
return {
label: category,
type: "text" as const,
checked: isIncluded,
click() {
addFeedsToCategoryMutation({
feedIdList: isMultipleSelection ? feedIds : [feedId],
category: isIncluded ? null : category, // if already included, remove it
view: view!,
})
},
}
}),
listByView.length > 0 && { type: "separator" as const },
{
label: t("sidebar.feed_column.context_menu.create_category"),
type: "text" as const,
icon: <i className="i-mgc-add-cute-re" />,
click() {
present({
title: t("sidebar.feed_column.context_menu.title"),
content: () => (
<CategoryCreationModalContent
onSubmit={(category: string) => {
addFeedsToCategoryMutation({
feedIdList: isMultipleSelection ? feedIds : [feedId],
category,
view: view!,
})
}}
/>
),
})
},
},
],
},
{
type: "separator" as const,
disabled: isEntryList,
@@ -93,5 +93,9 @@ export const navigateEntry = (options: NavigateEntryOptions) => {
} else {
if (!isMobile()) path += `/${ROUTE_ENTRY_PENDING}`
}
return getStableRouterNavigate()?.(`${path}?${nextSearchParams.toString()}`)
const finalPath = `${path}?${nextSearchParams.toString()}`
const currentPath = getReadonlyRoute().location.pathname + getReadonlyRoute().location.search
if (finalPath === currentPath) return
return getStableRouterNavigate()?.(finalPath)
}
@@ -0,0 +1,75 @@
import { Card, CardContent, CardHeader } from "@follow/components/ui/card/index.jsx"
import { Input } from "@follow/components/ui/input/index.js"
import { Switch } from "@follow/components/ui/switch/index.jsx"
import { Tooltip, TooltipContent, TooltipTrigger } from "@follow/components/ui/tooltip/index.js"
import clsx from "clsx"
import { useTranslation } from "react-i18next"
import { actionActions, useActionByIndex } from "~/store/action"
import { FeedFilter } from "./feed-filter"
import { TargetActionList } from "./target-action-list"
export const ActionCard = ({ index }: { index: number }) => {
const { t } = useTranslation("common")
return (
<Card className="group relative">
<CardHeader>
<Tooltip>
<TooltipTrigger
type="button"
className={clsx(
"center flex size-6 rounded-full bg-background p-1 shadow-sm ring-1 ring-border",
"absolute -right-2 -top-2 z-[1] opacity-100 duration-200 hover:!opacity-100 group-hover:opacity-70 lg:opacity-0",
)}
onClick={() => {
actionActions.removeByIndex(index)
}}
>
<i className="i-mgc-close-cute-re text-lg" />
<span className="sr-only">{t("words.delete")}</span>
</TooltipTrigger>
<TooltipContent>{t("words.delete")}</TooltipContent>
</Tooltip>
<ActionCardToolbar index={index} />
</CardHeader>
<CardContent className="flex flex-wrap justify-between gap-y-6">
<FeedFilter index={index} />
<TargetActionList index={index} />
</CardContent>
</Card>
)
}
const ActionCardToolbar = ({ index }: { index: number }) => {
const { t } = useTranslation("settings")
const name = useActionByIndex(index, (a) => a.name)
const disabled = useActionByIndex(index, (a) => a.result.disabled)
const onChange = actionActions.updateByIndex.bind(null, index)
return (
<div className="flex w-full items-center gap-3">
<p className="shrink-0 font-medium text-zinc-500">{t("actions.action_card.name")}</p>
<Input
value={name}
className="h-8 max-w-64"
onChange={(e) => {
onChange((data) => {
data.name = e.target.value
})
}}
/>
<div className="grow" />
<Switch
checked={!disabled}
onCheckedChange={(checked) => {
onChange((data) => {
data.result.disabled = !checked
})
}}
/>
</div>
)
}
@@ -0,0 +1,73 @@
import { Button } from "@follow/components/ui/button/index.js"
import { LoadingWithIcon } from "@follow/components/ui/loading/index.jsx"
import { useMutation } from "@tanstack/react-query"
import { useTranslation } from "react-i18next"
import { toast } from "sonner"
import { toastFetchError } from "~/lib/error-parser"
import { queryClient } from "~/lib/query-client"
import { ActionCard } from "~/modules/action/action-card"
import { useActionsQuery } from "~/queries/actions"
import { actionActions, useActions, useIsActionDataDirty } from "~/store/action"
export const ActionSetting = () => {
const actionQuery = useActionsQuery()
const actionLength = useActions((actions) => actions.length)
if (actionQuery.isPending) {
return <LoadingWithIcon icon={<i className="i-mgc-magic-2-cute-re" />} size="large" />
}
return (
<div className="w-full max-w-4xl space-y-4">
{Array.from({ length: actionLength }).map((_action, actionIdx) => (
<ActionCard key={actionIdx} index={actionIdx} />
))}
<ActionSettingOperations />
</div>
)
}
function ActionSettingOperations() {
const { t } = useTranslation("settings")
const actionLength = useActions((actions) => actions.length)
const isDirty = useIsActionDataDirty()
const mutation = useMutation({
mutationFn: () => actionActions.updateRemoteActions(),
onSuccess: () => {
// apply new action settings
queryClient.invalidateQueries({
queryKey: ["entries"],
})
toast(t("actions.saveSuccess"))
},
onError: (error) => {
toastFetchError(error)
},
})
return (
<div className="flex justify-end gap-x-2">
<Button
variant="outline"
onClick={() => {
actionActions.insertNewEmptyAction(t("actions.actionName", { number: actionLength + 1 }))
}}
>
<i className="i-mgc-add-cute-re mr-1" />
<span>{t("actions.newRule")}</span>
</Button>
<Button
variant="primary"
disabled={!isDirty}
isLoading={mutation.isPending}
onClick={() => mutation.mutate()}
>
<i className="i-mgc-check-circle-cute-re mr-1" />
{t("actions.save")}
</Button>
</div>
)
}
@@ -0,0 +1,352 @@
import { Button } from "@follow/components/ui/button/index.js"
import { Input } from "@follow/components/ui/input/index.js"
import { Radio, RadioGroup } from "@follow/components/ui/radio-group/index.js"
import { Select, SelectTrigger, SelectValue } from "@follow/components/ui/select/index.jsx"
import { ResponsiveSelect } from "@follow/components/ui/select/responsive.js"
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "@follow/components/ui/table/index.jsx"
import type { ActionFeedField, ActionOperation } from "@follow/models/types"
import { cn } from "@follow/utils/utils"
import { Fragment, useMemo } from "react"
import { useTranslation } from "react-i18next"
import { ViewSelectContent } from "~/modules/feed/view-select-content"
import { actionActions, useActionByIndex } from "~/store/action"
export const FeedFilter = ({ index }: { index: number }) => {
const { t } = useTranslation("settings")
const FeedOptions = useMemo(() => {
return [
{
label: t("actions.action_card.feed_options.subscription_view"),
value: "view",
type: "view",
},
{
label: t("actions.action_card.feed_options.feed_title"),
value: "title",
},
{
label: t("actions.action_card.feed_options.feed_category"),
value: "category",
},
{
label: t("actions.action_card.feed_options.site_url"),
value: "site_url",
},
{
label: t("actions.action_card.feed_options.feed_url"),
value: "feed_url",
},
{
label: t("actions.action_card.feed_options.entry_title"),
value: "entry_title",
},
{
label: t("actions.action_card.feed_options.entry_content"),
value: "entry_content",
},
{
label: t("actions.action_card.feed_options.entry_url"),
value: "entry_url",
},
{
label: t("actions.action_card.feed_options.entry_author"),
value: "entry_author",
},
{
label: t("actions.action_card.feed_options.entry_media_length"),
value: "entry_media_length",
type: "number",
},
]
}, [t])
const disabled = useActionByIndex(index, (a) => a.result.disabled)
const condition = useActionByIndex(index, (a) => a.condition)
const onChange = actionActions.updateByIndex.bind(null, index)
return (
<div className="w-full shrink space-y-3 overflow-auto">
<p className="font-medium text-zinc-500">{t("actions.action_card.when_feeds_match")}</p>
<div className="flex flex-col gap-2 pl-4">
<RadioGroup
value={condition.length > 0 ? "filter" : "all"}
onValueChange={(value) => {
onChange((data) => {
if (value === "all") {
data.condition = []
} else {
data.condition = [[{}]]
}
})
}}
>
<Radio disabled={disabled} label={t("actions.action_card.all")} value="all" />
<Radio
disabled={disabled}
label={t("actions.action_card.custom_filters")}
value="filter"
/>
</RadioGroup>
</div>
{condition.length > 0 && (
<div className="pl-6">
<Table>
<FieldTableHeader />
<TableBody>
{condition.flatMap((orConditions, orConditionIdx) => {
return orConditions.map((condition, conditionIdx) => {
const change = (key: string, value: string | number) => {
onChange((data) => {
if (!data.condition[orConditionIdx]) {
data.condition[orConditionIdx] = [{}]
}
data.condition[orConditionIdx][conditionIdx][key] = value
})
}
const type =
FeedOptions.find((option) => option.value === condition.field)?.type || "text"
return (
<Fragment key={`${orConditionIdx}${conditionIdx}`}>
{conditionIdx === 0 && orConditionIdx !== 0 && (
<TableRow className="flex h-16 items-center">
<Button disabled variant="outline">
{t("actions.action_card.or")}
</Button>
</TableRow>
)}
<TableRow className="max-sm:flex max-sm:flex-col">
<TableCell
size="sm"
className="max-sm:flex max-sm:items-center max-sm:justify-between max-sm:pr-0"
>
<span className="sm:hidden">{t("actions.action_card.field")}</span>
<ResponsiveSelect
placeholder="Select Field"
disabled={disabled}
value={condition.field}
onValueChange={(value) => change("field", value as ActionFeedField)}
items={FeedOptions}
triggerClassName="max-sm:w-fit"
/>
</TableCell>
<OperationTableCell
type={type}
disabled={disabled}
value={condition.operator}
onValueChange={(value) => change("operator", value)}
/>
<TableCell
size="sm"
className="max-sm:flex max-sm:items-center max-sm:justify-between max-sm:gap-4 max-sm:pr-0"
>
<span className="sm:hidden">{t("actions.action_card.value")}</span>
{type === "view" ? (
<Select
disabled={disabled}
onValueChange={(value) => change("value", value)}
value={condition.value}
>
<CommonSelectTrigger className="max-sm:w-fit" />
<ViewSelectContent />
</Select>
) : (
<Input
disabled={disabled}
type={type}
value={condition.value}
className="h-8"
onChange={(e) => change("value", e.target.value)}
/>
)}
</TableCell>
<ActionTableCell
disabled={disabled}
onAnd={() => {
onChange((data) => {
data.condition[orConditionIdx].push({})
})
}}
onDelete={() => {
onChange((data) => {
if (data.condition[orConditionIdx].length === 1) {
data.condition.splice(orConditionIdx, 1)
} else {
data.condition[orConditionIdx].splice(conditionIdx, 1)
}
})
}}
/>
</TableRow>
{conditionIdx !== orConditions.length - 1 && (
<TableRow className="relative flex items-center">
<Button disabled variant="outline">
{t("actions.action_card.and")}
</Button>
</TableRow>
)}
</Fragment>
)
})
})}
</TableBody>
</Table>
<OrTableRow
disabled={disabled}
onClick={() => {
onChange((data) => {
data.condition.push([{}])
})
}}
/>
</div>
)}
</div>
)
}
const OperationTableCell = ({
type,
value,
onValueChange,
disabled,
}: {
type: string
value?: ActionOperation
onValueChange?: (value: ActionOperation) => void
disabled?: boolean
}) => {
const { t } = useTranslation("settings")
const OperationOptions = useMemo(() => {
return [
{
label: t("actions.action_card.operation_options.contains"),
value: "contains",
types: ["text"],
},
{
label: t("actions.action_card.operation_options.does_not_contain"),
value: "not_contains",
types: ["text"],
},
{
label: t("actions.action_card.operation_options.is_equal_to"),
value: "eq",
types: ["number", "text", "view"],
},
{
label: t("actions.action_card.operation_options.is_not_equal_to"),
value: "not_eq",
types: ["number", "text", "view"],
},
{
label: t("actions.action_card.operation_options.is_greater_than"),
value: "gt",
types: ["number"],
},
{
label: t("actions.action_card.operation_options.is_less_than"),
value: "lt",
types: ["number"],
},
{
label: t("actions.action_card.operation_options.matches_regex"),
value: "regex",
types: ["text"],
},
]
}, [t])
const options = OperationOptions.filter((option) => option.types.includes(type))
return (
<TableCell
size="sm"
className="max-sm:flex max-sm:items-center max-sm:justify-between max-sm:pr-0"
>
<span className="sm:hidden">{t("actions.action_card.operator")}</span>
<ResponsiveSelect
placeholder="Select Field"
disabled={disabled}
value={value}
onValueChange={(value) => onValueChange?.(value as ActionOperation)}
items={options}
triggerClassName="h-8 max-sm:w-fit"
/>
</TableCell>
)
}
const CommonSelectTrigger = ({ className }: { className?: string }) => (
<SelectTrigger className={cn("h-8", className)}>
<SelectValue />
</SelectTrigger>
)
const ActionTableCell = ({
disabled,
onAnd,
onDelete,
}: {
disabled?: boolean
onAnd?: () => void
onDelete?: () => void
}) => {
const { t } = useTranslation("settings")
return (
<>
<TableCell size="sm" className="max-sm:hidden">
<Button variant="outline" className="w-full" disabled={disabled} onClick={onAnd}>
{t("actions.action_card.and")}
</Button>
</TableCell>
<TableCell size="sm" className="w-full max-sm:flex max-sm:space-x-2 max-sm:pr-0 lg:w-8">
<Button className="w-full sm:hidden" variant="outline" disabled={disabled} onClick={onAnd}>
{t("actions.action_card.and")}
</Button>
<Button variant="ghost" disabled={disabled} onClick={onDelete}>
<i className="i-mgc-delete-2-cute-re size-5 text-zinc-600" />
</Button>
</TableCell>
</>
)
}
const OrTableRow = ({ onClick, disabled }: { onClick?: () => void; disabled?: boolean }) => {
const { t } = useTranslation("settings")
return (
<Button
variant="outline"
className="mt-1 w-full gap-1"
buttonClassName="py-1"
onClick={onClick}
disabled={disabled}
>
{t("actions.action_card.or")}
</Button>
)
}
const FieldTableHeader = () => {
const { t } = useTranslation("settings")
return (
<TableHeader className="max-sm:hidden">
<TableRow>
<TableHead size="sm">{t("actions.action_card.field")}</TableHead>
<TableHead size="sm">{t("actions.action_card.operator")}</TableHead>
<TableHead size="sm">{t("actions.action_card.value")}</TableHead>
<TableHead size="sm" />
</TableRow>
</TableHeader>
)
}
@@ -0,0 +1,404 @@
import { ActionButton, Button } from "@follow/components/ui/button/index.js"
import { Divider } from "@follow/components/ui/divider/index.js"
import { Input } from "@follow/components/ui/input/index.js"
import { ResponsiveSelect } from "@follow/components/ui/select/responsive.js"
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "@follow/components/ui/table/index.jsx"
import type { ActionModel, SupportedLanguages } from "@follow/models/types"
import { Fragment, useMemo } from "react"
import { useTranslation } from "react-i18next"
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from "~/components/ui/dropdown-menu/dropdown-menu"
import { actionActions, useActionByIndex } from "~/store/action"
type Action = {
title: string
config?: () => React.ReactNode
configInline?: boolean
enabled: boolean
onInit: (data: ActionModel) => void
onRemove: (data: ActionModel) => void
}
const TransitionOptions: {
label: string
value: SupportedLanguages
}[] = [
{
label: "English",
value: "en",
},
{
label: "日本語",
value: "ja",
},
{
label: "简体中文",
value: "zh-CN",
},
{
label: "繁體中文",
value: "zh-TW",
},
]
const AddTableRow = ({ onClick, disabled }: { onClick?: () => void; disabled?: boolean }) => {
const { t } = useTranslation("settings")
return (
<Button
variant="outline"
className="mt-1 w-full gap-1"
buttonClassName="py-1"
onClick={onClick}
disabled={disabled}
>
{t("actions.action_card.add")}
</Button>
)
}
const DeleteTableCell = ({ disabled, onClick }: { disabled?: boolean; onClick?: () => void }) => (
<TableCell size="sm" className="flex h-10 items-center">
<ActionButton disabled={disabled} onClick={onClick}>
<i className="i-mgc-delete-2-cute-re text-zinc-600" />
</ActionButton>
</TableCell>
)
export const TargetActionList = ({ index }: { index: number }) => {
const summary = useActionByIndex(index, (a) => a.result.summary)
const translation = useActionByIndex(index, (a) => a.result.translation)
const readability = useActionByIndex(index, (a) => a.result.readability)
const sourceContent = useActionByIndex(index, (a) => a.result.sourceContent)
const newEntryNotification = useActionByIndex(index, (a) => a.result.newEntryNotification)
const silence = useActionByIndex(index, (a) => a.result.silence)
const block = useActionByIndex(index, (a) => a.result.block)
const rewriteRules = useActionByIndex(index, (a) => a.result.rewriteRules)
const webhooks = useActionByIndex(index, (a) => a.result.webhooks)
const disabled = useActionByIndex(index, (a) => a.result.disabled)
const { t } = useTranslation("settings")
const onChange = actionActions.updateByIndex.bind(null, index)
const availableActions: Action[] = useMemo(
() => [
{
title: t("actions.action_card.generate_summary"),
enabled: !!summary,
onInit: (data) => {
data.result.summary = true
},
onRemove: (data) => {
delete data.result.summary
},
},
{
title: t("actions.action_card.translate_into"),
enabled: !!translation,
onInit: (data) => {
data.result.translation = "zh-CN"
},
onRemove: (data) => {
delete data.result.translation
},
config: () => (
<ResponsiveSelect
disabled={disabled}
size="sm"
value={translation}
onValueChange={(value) => {
onChange((data) => {
data.result.translation = value
})
}}
items={TransitionOptions}
triggerClassName="w-fit max-w-44 text-sm"
/>
),
configInline: true,
},
{
title: t("actions.action_card.enable_readability"),
enabled: !!readability,
onInit: (data) => {
data.result.readability = true
},
onRemove: (data) => {
delete data.result.readability
},
},
{
title: t("actions.action_card.source_content"),
enabled: !!sourceContent,
onInit: (data) => {
data.result.sourceContent = true
},
onRemove: (data) => {
delete data.result.sourceContent
},
},
{
title: t("actions.action_card.new_entry_notification"),
enabled: !!newEntryNotification,
onInit: (data) => {
data.result.newEntryNotification = true
},
onRemove: (data) => {
delete data.result.newEntryNotification
},
},
{
title: t("actions.action_card.silence"),
enabled: !!silence,
onInit: (data) => {
data.result.silence = true
},
onRemove: (data) => {
delete data.result.silence
},
},
{
title: t("actions.action_card.block"),
enabled: !!block,
onInit: (data) => {
data.result.block = true
},
onRemove: (data) => {
delete data.result.block
},
},
{
title: t("actions.action_card.rewrite_rules"),
enabled: !!rewriteRules,
onInit: (data) => {
data.result.rewriteRules = [
{
from: "",
to: "",
},
]
},
onRemove: (data) => {
delete data.result.rewriteRules
},
config: () => (
<>
<Table className="mt-2">
<TableHeader>
<TableRow>
<TableHead size="sm">{t("actions.action_card.from")}</TableHead>
<TableHead size="sm">{t("actions.action_card.to")}</TableHead>
<TableHead size="sm" className="w-8" />
</TableRow>
</TableHeader>
<TableBody>
{rewriteRules?.map((rule, rewriteIdx) => {
const change = (key: string, value: string) => {
onChange((data) => {
data.result.rewriteRules![rewriteIdx][key] = value
})
}
return (
<TableRow key={rewriteIdx}>
<TableCell size="sm">
<Input
disabled={disabled}
value={rule.from}
className="h-8"
onChange={(e) => change("from", e.target.value)}
/>
</TableCell>
<TableCell size="sm">
<Input
disabled={disabled}
value={rule.to}
className="h-8"
onChange={(e) => change("to", e.target.value)}
/>
</TableCell>
<DeleteTableCell
disabled={disabled}
onClick={() => {
onChange((data) => {
if (data.result.rewriteRules?.length === 1) {
delete data.result.rewriteRules
} else {
data.result.rewriteRules?.splice(rewriteIdx, 1)
}
})
}}
/>
</TableRow>
)
})}
</TableBody>
</Table>
<AddTableRow
disabled={disabled}
onClick={() => {
onChange((data) => {
if (!data.result.rewriteRules) {
data.result.rewriteRules = []
}
data.result.rewriteRules!.push({
from: "",
to: "",
})
})
}}
/>
</>
),
},
{
title: t("actions.action_card.webhooks"),
enabled: !!webhooks,
onInit: (data) => {
data.result.webhooks = [""]
},
onRemove: (data) => {
delete data.result.webhooks
},
config: () => (
<>
{webhooks?.map((webhook, rewriteIdx) => {
return (
<div key={rewriteIdx} className="flex items-center gap-2">
<Input
disabled={disabled}
value={webhook}
className="h-8"
placeholder="https://"
onChange={(e) => {
onChange((data) => {
data.result.webhooks![rewriteIdx] = e.target.value
})
}}
/>
<DeleteTableCell
disabled={disabled}
onClick={() => {
onChange((data) => {
if (data.result.webhooks?.length === 1) {
delete data.result.webhooks
} else {
data.result.webhooks?.splice(rewriteIdx, 1)
}
})
}}
/>
</div>
)
})}
<AddTableRow
disabled={disabled}
onClick={() => {
onChange((data) => {
if (!data.result.webhooks) {
data.result.webhooks = []
}
data.result.webhooks!.push("")
})
}}
/>
</>
),
},
],
[
block,
disabled,
newEntryNotification,
onChange,
readability,
rewriteRules,
silence,
sourceContent,
summary,
t,
translation,
webhooks,
],
)
const enabledActions = useMemo(
() => availableActions.filter((action) => action.enabled),
[availableActions],
)
const notEnabledActions = useMemo(
() => availableActions.filter((action) => !action.enabled),
[availableActions],
)
return (
<div className="w-full shrink grow space-y-4">
<p className="font-medium text-zinc-500">{t("actions.action_card.then_do")}</p>
<div className="relative w-full space-y-4">
<DropdownMenu>
<DropdownMenuTrigger asChild disabled={disabled}>
<ActionButton className="absolute right-0 top-0 -translate-y-11 text-zinc-500 duration-200 hover:text-foreground">
<i className="i-mgc-add-cute-re" />
</ActionButton>
</DropdownMenuTrigger>
<DropdownMenuContent side="left" align="start">
{notEnabledActions.map((action) => {
return (
<DropdownMenuItem
key={action.title}
onClick={() => {
onChange((data) => {
action.onInit(data)
})
}}
>
{action.title}
</DropdownMenuItem>
)
})}
</DropdownMenuContent>
</DropdownMenu>
<section className="pl-6">
{enabledActions
.filter((action) => action.enabled)
.map((action, index) => {
return (
<Fragment key={action.title}>
<div className="group/action mt-3 flex w-full items-center justify-between">
<span className="w-0 shrink grow truncate">{action.title}</span>
{action.configInline && action.config && action.config()}
<Button
buttonClassName="absolute opacity-100 group-hover/action:opacity-70 hover:!opacity-100 duration-200 lg:opacity-0 left-0 z-[1] size-5 rounded-full border"
variant={"ghost"}
disabled={disabled}
onClick={() => {
onChange((data) => {
action.onRemove(data)
})
}}
>
<i className="i-mgc-close-cute-re size-3" />
</Button>
</div>
{!action.configInline && action.config && action.config()}
{index !== enabledActions.length - 1 && <Divider className="my-2" />}
</Fragment>
)
})}
</section>
</div>
</div>
)
}
@@ -75,13 +75,13 @@ export const MobileFloatBar = ({
return (
<div
className={clsx(
"pointer-events-none absolute inset-x-0 bottom-0 flex h-36 items-end overflow-hidden pb-safe-offset-6",
"pointer-events-none absolute inset-x-0 bottom-0 flex h-36 items-end pb-safe-offset-6",
className,
)}
>
<m.div
className={clsx(
"mx-auto inline-flex h-10 min-w-0 items-center rounded-full border border-neutral-200 bg-background pl-4 pr-2 shadow-sm shadow-zinc-100 dark:border-neutral-800",
"mx-1 inline-flex h-10 w-full min-w-0 items-center rounded-full border border-neutral-200 bg-background pl-4 pr-2 shadow-sm shadow-zinc-100 dark:border-neutral-800",
"[box-shadow:0px_8px_30px_rgba(122,122,122,0.2)] dark:[box-shadow:0px_8px_30px_rgba(122,122,122,0.2)]",
"pointer-events-auto",
)}
@@ -1,9 +1,8 @@
import { RootPortal } from "@follow/components/ui/portal/index.js"
import { PresentSheet } from "@follow/components/ui/sheet/Sheet.js"
import { Outlet } from "react-router"
import { useLoginModalShow, useWhoami } from "~/atoms/user"
import { PlainModal } from "~/components/ui/modal/stacked/custom-modal"
import { DeclarativeModal } from "~/components/ui/modal/stacked/declarative-modal"
import { useDailyTask } from "~/hooks/biz/useDailyTask"
import { LoginModalContent } from "~/modules/auth/LoginModalContent"
@@ -20,17 +19,13 @@ export const MobileRootLayout = () => {
{isAuthFail && !user && (
<RootPortal>
<DeclarativeModal
id="login"
CustomModalComponent={PlainModal}
<PresentSheet
open
overlay
contentClassName="overflow-visible pb-safe"
title="Login"
canClose={false}
clickOutsideToDismiss={false}
>
<LoginModalContent canClose={false} runtime={"browser"} />
</DeclarativeModal>
hideHeader
content={<LoginModalContent canClose={false} runtime={"browser"} />}
/>
</RootPortal>
)}
</>
@@ -12,7 +12,6 @@ import { useSetSidebarActiveView, useSidebarActiveView } from "~/atoms/sidebar"
import { getRouteParams } from "~/hooks/biz/useRouteParams"
import { FeedList } from "../../feed-column/list"
import { FooterInfo } from "./components/FooterInfo"
import { MobileFloatBar } from "./float-bar.mobile"
export function FeedColumnMobile({ asWidget }: { asWidget?: boolean }) {
@@ -33,7 +32,7 @@ export function FeedColumnMobile({ asWidget }: { asWidget?: boolean }) {
return (
<div
className={cn(
"relative flex flex-col space-y-3 bg-background",
"relative flex flex-col space-y-3 bg-background pb-11",
asWidget ? "grow" : "h-screen",
)}
>
@@ -50,7 +49,7 @@ export function FeedColumnMobile({ asWidget }: { asWidget?: boolean }) {
</Link>
</div>
</div>
<div className={"relative flex size-full h-0 grow"}>
<div className="relative flex size-full h-0 grow pb-safe-offset-2">
<SwipeWrapper active={active}>
{views.map((item, index) => (
<section key={item.name} className="size-full flex-none shrink-0 snap-center">
@@ -63,10 +62,8 @@ export function FeedColumnMobile({ asWidget }: { asWidget?: boolean }) {
))}
</SwipeWrapper>
</div>
<FooterInfo />
<MobileFloatBar
className={asWidget ? "!bottom-0" : undefined}
className={asWidget ? "!bottom-0 pb-safe-offset-2" : undefined}
scrollContainer={feedListScrollRef}
/>
</div>
@@ -1,23 +1,43 @@
import { FollowIcon } from "@follow/components/icons/follow.jsx"
import { useMobile } from "@follow/components/hooks/useMobile.js"
import { Logo } from "@follow/components/icons/logo.js"
import { AutoResizeHeight } from "@follow/components/ui/auto-resize-height/index.js"
import { MotionButtonBase } from "@follow/components/ui/button/index.js"
import { LoadingCircle } from "@follow/components/ui/loading/index.jsx"
import { authProvidersConfig } from "@follow/constants"
import type { LoginRuntime } from "@follow/shared/auth"
import { loginHandler } from "@follow/shared/auth"
import { stopPropagation } from "@follow/utils/dom"
import clsx from "clsx"
import { AnimatePresence, m } from "framer-motion"
import { useEffect, useRef, useState } from "react"
import type { FC } from "react"
import { useEffect, useMemo, useRef, useState } from "react"
import { useTranslation } from "react-i18next"
import { modalMontionConfig } from "~/components/ui/modal/stacked/constants"
import { useCurrentModal } from "~/components/ui/modal/stacked/hooks"
import type { AuthProvider } from "~/queries/users"
import { useAuthProviders } from "~/queries/users"
interface LoginModalContentProps {
runtime?: LoginRuntime
canClose?: boolean
}
const defaultProviders = {
google: {
id: "google",
name: "Google",
color: "#3b82f6",
icon: '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><g fill="none" fill-rule="evenodd"><path d="M24 0v24H0V0h24ZM12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035c-.01-.004-.019-.001-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427c-.002-.01-.009-.017-.017-.018Zm.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093c.012.004.023 0 .029-.008l.004-.014l-.034-.614c-.003-.012-.01-.02-.02-.022Zm-.715.002a.023.023 0 0 0-.027.006l-.006.014l-.034.614c0 .012.007.02.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01l-.184-.092Z"/><path fill="currentColor" d="M12 5.5a6.5 6.5 0 1 0 6.326 8H13a1.5 1.5 0 0 1 0-3h7a1.5 1.5 0 0 1 1.5 1.5a9.5 9.5 0 1 1-2.801-6.736a1.5 1.5 0 1 1-2.116 2.127A6.475 6.475 0 0 0 12 5.5Z"/></g></svg>',
},
github: {
id: "github",
name: "GitHub",
color: "#000000",
icon: '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><g fill="none"><path d="M24 0v24H0V0h24ZM12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035c-.01-.004-.019-.001-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427c-.002-.01-.009-.017-.017-.018Zm.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093c.012.004.023 0 .029-.008l.004-.014l-.034-.614c-.003-.012-.01-.02-.02-.022Zm-.715.002a.023.023 0 0 0-.027.006l-.006.014l-.034.614c0 .012.007.02.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01l-.184-.092Z"/><path fill="currentColor" d="M7.024 2.31a9.08 9.08 0 0 1 2.125 1.046A11.432 11.432 0 0 1 12 3c.993 0 1.951.124 2.849.355a9.08 9.08 0 0 1 2.124-1.045c.697-.237 1.69-.621 2.28.032c.4.444.5 1.188.571 1.756c.08.634.099 1.46-.111 2.28C20.516 7.415 21 8.652 21 10c0 2.042-1.106 3.815-2.743 5.043a9.456 9.456 0 0 1-2.59 1.356c.214.49.333 1.032.333 1.601v3a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1v-.991c-.955.117-1.756.013-2.437-.276c-.712-.302-1.208-.77-1.581-1.218c-.354-.424-.74-1.38-1.298-1.566a1 1 0 0 1 .632-1.898c.666.222 1.1.702 1.397 1.088c.48.62.87 1.43 1.63 1.753c.313.133.772.22 1.49.122L8 17.98a3.986 3.986 0 0 1 .333-1.581a9.455 9.455 0 0 1-2.59-1.356C4.106 13.815 3 12.043 3 10c0-1.346.483-2.582 1.284-3.618c-.21-.82-.192-1.648-.112-2.283l.005-.038c.073-.582.158-1.267.566-1.719c.59-.653 1.584-.268 2.28-.031Z"/></g></svg>',
},
}
const overrideProviderIconMap = {
apple: <i className="i-mgc-apple-cute-fi text-black dark:text-white" />,
}
export const LoginModalContent = (props: LoginModalContentProps) => {
const modal = useCurrentModal()
@@ -48,45 +68,78 @@ export const LoginModalContent = (props: LoginModalContentProps) => {
}, [])
const disabled = !!loadingLockSet
const filteredDefaultProviders = useMemo(() => {
if (!authProviders) return Object.values(defaultProviders)
return Object.entries(defaultProviders)
.filter(([key]) => authProviders[key])
.map(([_, provider]) => provider)
}, [authProviders])
const extraProviders = useMemo(() => {
if (!authProviders) return []
return Object.entries(authProviders)
.filter(([key]) => !defaultProviders[key])
.map(([_, provider]) => provider)
}, [authProviders])
const isMobile = useMobile()
const Inner = (
<>
<div className="-mt-8 mb-4 flex items-center justify-center md:-mt-8">
<Logo className="size-12" />
</div>
<div className="-mt-0 text-center">
<span className="text-xl">
{t("signin.sign_in_to")} <b>{APP_NAME}</b>
</span>
</div>
<div className="mt-6 flex flex-col gap-4">
{filteredDefaultProviders.map((provider) => (
<MotionButtonBase
key={provider.id}
className={clsx(
"center h-[48px] rounded-[8px] font-sans text-base font-medium text-white lg:w-[320px]",
disabled && "pointer-events-none opacity-50",
"overflow-hidden",
authProvidersConfig[provider.id]?.buttonClassName,
)}
disabled={disabled}
onClick={() => {
loginHandler(provider.id, runtime)
setLoadingLockSet(provider.id)
window.analytics?.capture("login", {
type: provider.id,
})
}}
>
<LoginButtonContent isLoading={loadingLockSet === provider.id}>
<i className={clsx("mr-2 text-xl", authProvidersConfig[provider.id].iconClassName)} />{" "}
{t("signin.continue_with", { provider: provider.name })}
</LoginButtonContent>
</MotionButtonBase>
))}
<AuthProvidersRender providers={extraProviders} />
</div>
</>
)
if (isMobile) {
return Inner
}
return (
<div className="center flex h-full" onClick={canClose ? modal.dismiss : undefined}>
<m.div
className="shadow-modal rounded-lg border border-border bg-theme-background p-4 px-8 pb-8"
onClick={stopPropagation}
{...modalMontionConfig}
initial={{ opacity: 0, y: 10 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, y: 10, transition: { type: "tween" } }}
transition={{ type: "spring" }}
>
<div className="mb-8 mt-4 text-center align-middle font-sans text-2xl font-bold leading-relaxed">
<span className="text-xl">{t("signin.sign_in_to")}</span>
<span className="center flex translate-y-px gap-2 font-theme text-accent">
<FollowIcon className="size-4" />
{APP_NAME}
</span>
</div>
<div className="flex flex-col gap-4">
{Object.entries(authProviders || []).map(([key, provider]) => (
<MotionButtonBase
key={key}
className={clsx(
"center h-[48px] w-[320px] rounded-[8px] font-sans text-base font-medium text-white",
disabled && "pointer-events-none opacity-50",
"overflow-hidden",
authProvidersConfig[key]?.buttonClassName,
)}
disabled={disabled}
onClick={() => {
loginHandler(key, runtime)
setLoadingLockSet(key)
window.analytics?.capture("login", {
type: key,
})
}}
>
<LoginButtonContent isLoading={loadingLockSet === key}>
<i className={clsx("mr-2 text-xl", authProvidersConfig[key].iconClassName)} />{" "}
{t("signin.continue_with", { provider: provider.name })}
</LoginButtonContent>
</MotionButtonBase>
))}
<div className="rounded-xl border bg-background p-3 px-8 shadow-2xl shadow-stone-300 dark:border-neutral-700 dark:shadow-stone-800">
{Inner}
</div>
</m.div>
</div>
@@ -133,3 +186,50 @@ const LoginButtonContent = (props: { children: React.ReactNode; isLoading: boole
</AnimatePresence>
)
}
export const AuthProvidersRender: FC<{
providers: AuthProvider[]
runtime?: LoginRuntime
}> = ({ providers, runtime }) => {
const [authProcessingLockSet, setAuthProcessingLockSet] = useState(() => new Set<string>())
return (
<AutoResizeHeight spring>
{providers.length > 0 && (
<ul className="relative flex items-center justify-center gap-3 pt-4 before:absolute before:inset-x-28 before:top-0 before:h-px before:bg-stone-200 before:content-[''] before:dark:bg-neutral-700">
{providers.map((provider) => (
<li key={provider.id}>
<MotionButtonBase
disabled={authProcessingLockSet.has(provider.id)}
onClick={() => {
if (authProcessingLockSet.has(provider.id)) return
loginHandler(provider.id, runtime)
setAuthProcessingLockSet((prev) => {
prev.add(provider.id)
return new Set(prev)
})
}}
>
<div className="flex size-10 items-center justify-center rounded-full border bg-background dark:border-neutral-700">
{!authProcessingLockSet.has(provider.id) ? (
overrideProviderIconMap[provider.id] || (
<span
className="center inline-flex size-4"
style={{ color: provider.color }}
dangerouslySetInnerHTML={{ __html: provider.icon }}
/>
)
) : (
<div className="center flex">
<i className="i-mgc-loading-3-cute-re animate-spin opacity-50" />
</div>
)}
</div>
</MotionButtonBase>
</li>
))}
</ul>
)}
</AutoResizeHeight>
)
}
+1 -1
View File
@@ -123,7 +123,7 @@ export function DiscoverForm({ type = "search" }: { type?: string }) {
(event: ChangeEvent<HTMLInputElement>) => {
const trimmedKeyword = event.target.value.trimStart()
if (!prefix) {
form.setValue("keyword", trimmedKeyword)
form.setValue("keyword", trimmedKeyword, { shouldValidate: true })
return
}
const isValidPrefix = prefix.find((p) => trimmedKeyword.startsWith(p))
@@ -13,7 +13,6 @@ import { memo, useContext, useEffect, useMemo, useState } from "react"
import { useTranslation } from "react-i18next"
import { SwipeMedia } from "~/components/ui/media/SwipeMedia"
import { ReactVirtuosoItemPlaceholder } from "~/components/ui/placeholder"
import { useRouteParamsSelector } from "~/hooks/biz/useRouteParams"
import { filterSmallMedia } from "~/lib/utils"
import { EntryContent } from "~/modules/entry-content"
@@ -33,7 +32,7 @@ export function PictureItem({ entryId, entryPreview, translation }: UniversalIte
const { t } = useTranslation()
const entryContent = useMemo(() => <EntryContent entryId={entryId} noMedia compact />, [entryId])
const previewMedia = usePreviewMedia(entryContent)
if (!entry) return <ReactVirtuosoItemPlaceholder />
if (!entry) return null
return (
<GridItem entryId={entryId} entryPreview={entryPreview} translation={translation}>
<div className="relative flex gap-2 overflow-x-auto">
@@ -1,3 +1,4 @@
import { PassviseFragment } from "@follow/components/common/Fragment.js"
import { useMobile } from "@follow/components/hooks/useMobile.js"
import { AutoResizeHeight } from "@follow/components/ui/auto-resize-height/index.js"
import { ActionButton } from "@follow/components/ui/button/index.js"
@@ -7,7 +8,9 @@ import { LRUCache } from "@follow/utils/lru-cache"
import { cn } from "@follow/utils/utils"
import { atom } from "jotai"
import { useLayoutEffect, useMemo, useRef, useState } from "react"
import { useTranslation } from "react-i18next"
import { useGeneralSettingKey } from "~/atoms/settings/general"
import { RelativeTime } from "~/components/ui/datetime"
import { Media } from "~/components/ui/media"
import { usePreviewMedia } from "~/components/ui/media/hooks"
@@ -22,7 +25,6 @@ import { FeedTitle } from "~/modules/feed/feed-title"
import { useEntry } from "~/store/entry/hooks"
import { useFeedById } from "~/store/feed"
import { ReactVirtuosoItemPlaceholder } from "../../../components/ui/placeholder"
import { filterSmallMedia } from "../../../lib/utils"
import { StarIcon } from "../star-icon"
import { EntryTranslation } from "../translation"
@@ -51,14 +53,17 @@ export const SocialMediaItem: EntryListItemFC = ({ entryId, entryPreview, transl
jotaiStore.set(socialMediaContentWidthAtom, ref.current.offsetWidth)
}
}, [])
// NOTE: prevent 0 height element, react virtuoso will not stop render any more
if (!entry || !feed) return <ReactVirtuosoItemPlaceholder />
const autoExpandLongSocialMedia = useGeneralSettingKey("autoExpandLongSocialMedia")
if (!entry || !feed) return null
const content = entry.entries.content || entry.entries.description
const parsed = parseSocialMedia(entry.entries)
const media = filterSmallMedia(entry.entries.media)
const EntryContentWrapper = autoExpandLongSocialMedia
? PassviseFragment
: CollapsedSocialMediaItem
return (
<div
@@ -101,14 +106,14 @@ export const SocialMediaItem: EntryListItemFC = ({ entryId, entryPreview, transl
</span>
</div>
<div className={cn("relative mt-1 text-base", !!entry.collections && "pr-5")}>
<CollapsedSocialMediaItem entryId={entryId}>
<EntryContentWrapper entryId={entryId}>
<EntryTranslation
className="cursor-auto select-text text-sm leading-relaxed prose-blockquote:mt-0 [&_br:last-child]:hidden"
source={content}
target={translation?.content}
isHTML
/>
</CollapsedSocialMediaItem>
</EntryContentWrapper>
{!!entry.collections && <StarIcon className="absolute right-0 top-0" />}
</div>
</div>
@@ -363,9 +368,11 @@ const collapsedItemCache = new LRUCache<string, boolean>(100)
const CollapsedSocialMediaItem: Component<{
entryId: string
}> = ({ children, entryId }) => {
const { t } = useTranslation()
const [isOverflow, setIsOverflow] = useState(false)
const [isShowMore, setIsShowMore] = useState(() => collapsedItemCache.get(entryId) ?? false)
const ref = useRef<HTMLDivElement>(null)
useLayoutEffect(() => {
if (ref.current) {
setIsOverflow(ref.current.scrollHeight > collapsedHeight)
@@ -398,7 +405,7 @@ const CollapsedSocialMediaItem: Component<{
className="flex items-center justify-center text-xs duration-200 hover:text-foreground"
>
<i className="i-mingcute-arrow-to-down-line" />
<span className="ml-2">Show more</span>
<span className="ml-2">{t("words.show_more")}</span>
</button>
</div>
)}
@@ -1,3 +1,4 @@
import { isMobile } from "@follow/components/hooks/useMobile.js"
import { Skeleton } from "@follow/components/ui/skeleton/index.jsx"
import { IN_ELECTRON } from "@follow/shared/constants"
import { stopPropagation } from "@follow/utils/dom"
@@ -20,7 +21,6 @@ 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"
import { GridItem } from "../templates/grid-item-template"
import type { EntryItemStatelessProps, UniversalItemProps } from "../types"
@@ -62,12 +62,17 @@ export function VideoItem({ entryId, entryPreview, translation }: UniversalItemP
}
}, [hovered])
if (!entry) return <ReactVirtuosoItemPlaceholder />
if (!entry) return null
return (
<GridItem entryId={entryId} entryPreview={entryPreview} translation={translation}>
<div
className="w-full cursor-card"
onClick={() => {
onClick={(e) => {
if (isMobile() && entry.entries.url) {
window.open(entry.entries.url, "_blank")
e.stopPropagation()
return
}
if (iframeSrc) {
modalStack.present({
title: "",
+67 -30
View File
@@ -6,8 +6,16 @@ import { useTypeScriptHappyCallback } from "@follow/hooks"
import { LRUCache } from "@follow/utils/lru-cache"
import type { Range, VirtualItem, Virtualizer } from "@tanstack/react-virtual"
import { useVirtualizer } from "@tanstack/react-virtual"
import type { FC } from "react"
import { Fragment, startTransition, useEffect, useMemo, useState } from "react"
import type { FC, MutableRefObject } from "react"
import {
Fragment,
startTransition,
useEffect,
useLayoutEffect,
useMemo,
useRef,
useState,
} from "react"
import { useTranslation } from "react-i18next"
import { setUISetting, useUISettingKey } from "~/atoms/settings/ui"
@@ -24,7 +32,7 @@ export const EntryColumnGrid: FC<EntryListProps> = (props) => {
const masonry = useUISettingKey("pictureViewMasonry") || isMobile
const filterNoImage = useUISettingKey("pictureViewFilterNoImage")
const nextData = useMemo(() => {
const nextEntriesIds = useMemo(() => {
if (filterNoImage) {
return entriesIds.filter((entryId) => {
const entry = getEntry(entryId)
@@ -34,7 +42,7 @@ export const EntryColumnGrid: FC<EntryListProps> = (props) => {
return entriesIds
}, [entriesIds, filterNoImage])
const { t } = useTranslation()
if (nextData.length === 0 && entriesIds.length > 0) {
if (nextEntriesIds.length === 0 && entriesIds.length > 0) {
return (
<div className="center absolute inset-x-0 inset-y-12 -translate-y-12 flex-col gap-5">
<i className="i-mgc-photo-album-cute-fi size-12" />
@@ -53,7 +61,7 @@ export const EntryColumnGrid: FC<EntryListProps> = (props) => {
)
}
const hasFilteredContent = nextData.length < entriesIds.length
const hasFilteredContent = nextEntriesIds.length < entriesIds.length
const FilteredContentTip = hasFilteredContent && !hasNextPage && (
<div className="center mb-6 flex flex-col gap-5">
@@ -77,7 +85,7 @@ export const EntryColumnGrid: FC<EntryListProps> = (props) => {
key={feedId}
hasNextPage={hasNextPage}
endReached={fetchNextPage}
data={entriesIds}
data={nextEntriesIds}
/>
{FilteredContentTip}
@@ -86,7 +94,7 @@ export const EntryColumnGrid: FC<EntryListProps> = (props) => {
}
return (
<>
<VirtualGrid {...props} />
<VirtualGrid {...props} entriesIds={nextEntriesIds} />
{FilteredContentTip}
</>
)
@@ -101,16 +109,57 @@ const ratioMap = {
// 16:9
[FeedViewType.Videos]: 16 / 9,
}
const VirtualGrid: FC<EntryListProps> = (props) => {
const { entriesIds, feedId, onRangeChange, fetchNextPage, view, Footer, hasNextPage, listRef } =
props
const scrollRef = useScrollViewElement()
const VirtualGrid: FC<EntryListProps> = (props) => {
const scrollRef = useScrollViewElement()
const [containerWidth, setContainerWidth] = useState(0)
const columns = useMemo(() => {
if (!scrollRef) return [0]
useEffect(() => {
if (!scrollRef) return
const handler = () => {
const rem = Number.parseFloat(getComputedStyle(document.documentElement).fontSize)
const width = scrollRef.clientWidth - 2 * rem
setContainerWidth(width)
measureRef.current?.()
}
const observer = new ResizeObserver(handler)
handler()
observer.observe(scrollRef)
return () => {
observer.disconnect()
}
}, [scrollRef])
const measureRef = useRef<() => void>()
if (!containerWidth) return null
return <VirtualGridImpl {...props} containerWidth={containerWidth} measureRef={measureRef} />
}
const VirtualGridImpl: FC<
EntryListProps & {
containerWidth: number
measureRef: MutableRefObject<(() => void) | undefined>
}
> = (props) => {
const {
entriesIds,
feedId,
onRangeChange,
fetchNextPage,
view,
Footer,
hasNextPage,
listRef,
measureRef,
containerWidth,
} = props
const scrollRef = useScrollViewElement()
const columns = useMemo(() => {
const width = containerWidth
const rem = Number.parseFloat(getComputedStyle(document.documentElement).fontSize)
let columnCount = 1 // default (grid-cols-1)
@@ -120,7 +169,7 @@ const VirtualGrid: FC<EntryListProps> = (props) => {
if (width >= 80 * rem) columnCount = 5 // @8xl (80rem)
return Array.from({ length: columnCount }).fill(width / columnCount) as number[]
}, [containerWidth, scrollRef])
}, [containerWidth])
// Calculate rows based on entries
const rows = useMemo(() => {
@@ -190,23 +239,12 @@ const VirtualGrid: FC<EntryListProps> = (props) => {
listRef.current = rowVirtualizer
}, [rowVirtualizer, listRef])
useEffect(() => {
if (!scrollRef) return
const handler = () => {
const rem = Number.parseFloat(getComputedStyle(document.documentElement).fontSize)
const width = scrollRef.clientWidth - 2 * rem
setContainerWidth(width)
useLayoutEffect(() => {
measureRef.current = () => {
rowVirtualizer.measure()
columnVirtualizer.measure()
}
const observer = new ResizeObserver(handler)
observer.observe(scrollRef)
return () => {
observer.disconnect()
}
}, [columnVirtualizer, rowVirtualizer, scrollRef])
}, [columnVirtualizer, measureRef, rowVirtualizer])
const virtualItems = rowVirtualizer.getVirtualItems()
useEffect(() => {
@@ -233,10 +271,9 @@ const VirtualGrid: FC<EntryListProps> = (props) => {
return (
<div
className="relative mx-4"
className="relative mx-4 w-full"
style={{
height: `${rowVirtualizer.getTotalSize()}px`,
width: `${columnVirtualizer.getTotalSize()}px`,
}}
>
{rowVirtualizer.getVirtualItems().map((virtualRow) => {
@@ -10,7 +10,6 @@ import { Queries } from "~/queries"
import type { FlatEntryModel } from "~/store/entry"
import { useEntry } from "~/store/entry/hooks"
import { ReactVirtuosoItemPlaceholder } from "../../components/ui/placeholder"
import { getItemComponentByView, getSkeletonItemComponentByView } from "./Items"
import { EntryItemWrapper } from "./layouts/EntryItemWrapper"
import { girdClassNames } from "./styles"
@@ -49,7 +48,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 />
if (!entry) return null
return <EntryItemImpl entry={entry} view={view} />
})
@@ -35,7 +35,10 @@ export const EntryItemWrapper: FC<
const { t } = useTranslation("common")
const isActive = useRouteParamsSelector(({ entryId }) => entryId === entry.entries.id)
const isActive = useRouteParamsSelector(
({ entryId }) => entryId === entry.entries.id,
[entry.entries.id],
)
const asRead = useAsRead(entry)
const hoverMarkUnread = useGeneralSettingKey("hoverMarkUnread")
@@ -2,7 +2,6 @@ import { TitleMarquee } from "@follow/components/ui/marquee/index.jsx"
import { cn } from "@follow/utils/utils"
import dayjs from "dayjs"
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"
@@ -21,7 +20,7 @@ export function GridItem(props: GridItemProps) {
const { entryId, entryPreview, wrapperClassName, children, translation } = props
const entry = useEntry(entryId) || entryPreview
if (!entry) return <ReactVirtuosoItemPlaceholder />
if (!entry) return null
return (
<div className={cn("p-1.5", wrapperClassName)}>
{children}
@@ -17,7 +17,6 @@ import { useEntry } from "~/store/entry/hooks"
import { getPreferredTitle, useFeedById } from "~/store/feed"
import { useInboxById } from "~/store/inbox"
import { ReactVirtuosoItemPlaceholder } from "../../../components/ui/placeholder"
import { StarIcon } from "../star-icon"
import type { UniversalItemProps } from "../types"
@@ -79,7 +78,7 @@ export function ListItem({
}, [translation?.title, translation?.description, settingWideMode])
// NOTE: prevent 0 height element, react virtuoso will not stop render any more
if (!entry || !(feed || inbox)) return <ReactVirtuosoItemPlaceholder />
if (!entry || !(feed || inbox)) return null
const displayTime = inInCollection ? entry.collections?.createdAt : entry.entries.publishedAt
@@ -15,7 +15,7 @@ export const EntryColumnWrapper = forwardRef<HTMLDivElement, EntryColumnWrapperP
return (
<div className={clsx(styles, animationStyles, "mt-2")}>
<ScrollArea
scrollbarClassName={!views[view].wideMode ? "w-[5px] p-0" : ""}
scrollbarClassName={clsx(!views[view].wideMode ? "w-[5px] p-0" : "", "z-[3]")}
mask={false}
ref={ref}
rootClassName={clsx("h-full", views[view].wideMode ? "mt-2" : "")}
@@ -2,6 +2,7 @@ import { IconButton } from "@follow/components/ui/button/index.js"
import { Checkbox } from "@follow/components/ui/checkbox/index.jsx"
import { Popover, PopoverContent, PopoverTrigger } from "@follow/components/ui/popover/index.jsx"
import { getStorageNS } from "@follow/utils/ns"
import { parseSafeUrl } from "@follow/utils/utils"
import { Label } from "@radix-ui/react-label"
import { PopoverPortal } from "@radix-ui/react-popover"
import { atomWithStorage } from "jotai/utils"
@@ -37,11 +38,8 @@ const trustedDefaultLinks = new Set([
])
const getURLDomain = (url: string) => {
if (URL.canParse(url)) {
const urlObj = new URL(url)
return urlObj.hostname
}
return null
const urlObj = parseSafeUrl(url)
return urlObj?.hostname ?? null
}
const WarnGoToExternalLinkImpl = forwardRef<
@@ -173,7 +173,7 @@ export const EntryContent: Component<EntryContentProps> = ({
<article
data-testid="entry-render"
onContextMenu={stopPropagation}
className="relative m-auto min-w-0 max-w-[550px] @3xl:max-w-[70ch] @7xl:max-w-[80ch]"
className="relative m-auto min-w-0 max-w-[550px] @[47.5rem]:max-w-[70ch] @7xl:max-w-[80ch]"
>
<EntryTitle entryId={entryId} compact={compact} />
@@ -215,7 +215,7 @@ export const EntryContent: Component<EntryContentProps> = ({
)}
{entry.settings?.sourceContent && <ViewSourceContentAutoToggleEffect />}
{!content && (
{!content && !isInReadabilityMode && (
<div className="center mt-16 min-w-0">
{isPending ? (
<EntryContentLoading
@@ -4,13 +4,14 @@ import type { FeedModel, InboxModel, SupportedLanguages } from "@follow/models/t
import { stopPropagation } from "@follow/utils/dom"
import { cn } from "@follow/utils/utils"
import { ErrorBoundary } from "@sentry/react"
import { useMemo, useState } from "react"
import { useEffect, useMemo, useState } from "react"
import { useShowAITranslation } from "~/atoms/ai-translation"
import { useAudioPlayerAtomSelector } from "~/atoms/player"
import { useGeneralSettingSelector } from "~/atoms/settings/general"
import { useUISettingKey } from "~/atoms/settings/ui"
import { ShadowDOM } from "~/components/common/ShadowDOM"
import { useNavigateEntry } from "~/hooks/biz/useNavigateEntry"
import { useRouteParamsSelector } from "~/hooks/biz/useRouteParams"
import { useAuthQuery, usePreventOverscrollBounce } from "~/hooks/common"
import { LanguageMap } from "~/lib/translate"
@@ -40,6 +41,25 @@ export const EntryContent: Component<{
compact?: boolean
classNames?: EntryContentClassNames
}> = ({ entryId, noMedia, compact, classNames }) => {
const navigateEntry = useNavigateEntry()
const { entryId: _, ...params } = useRouteParamsSelector((route) => route)
useEffect(() => {
const handlePopState = (event: PopStateEvent) => {
event.preventDefault()
// This is triggered when the back button is pressed
navigateEntry({ entryId: null, ...params })
}
// Listen to the popstate event (back button)
window.addEventListener("popstate", handlePopState)
// Clean up the event listener on unmount
return () => {
window.removeEventListener("popstate", handlePopState)
}
}, [navigateEntry, params])
const entry = useEntry(entryId)
useTitle(entry?.entries.title)
@@ -1,12 +1,20 @@
import { getViewport } from "@follow/components/hooks/useViewport.js"
import {
CircleProgress,
MaterialSymbolsProgressActivity,
} from "@follow/components/icons/Progress.js"
import { AutoResizeHeight } from "@follow/components/ui/auto-resize-height/index.js"
import { Button, MotionButtonBase } from "@follow/components/ui/button/index.js"
import { LoadingWithIcon } from "@follow/components/ui/loading/index.jsx"
import { RootPortal } from "@follow/components/ui/portal/index.jsx"
import { useScrollViewElement } from "@follow/components/ui/scroll-area/hooks.js"
import { IN_ELECTRON } from "@follow/shared/constants"
import { EventBus } from "@follow/utils/event-bus"
import { springScrollTo } from "@follow/utils/scroller"
import { cn } from "@follow/utils/utils"
import type { FallbackRender } from "@sentry/react"
import type { FC } from "react"
import { memo, useEffect, useLayoutEffect, useRef } from "react"
import { memo, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react"
import { useTranslation } from "react-i18next"
import { useShowAISummary } from "~/atoms/ai-summary"
@@ -18,12 +26,17 @@ import {
} from "~/atoms/readability"
import { enableShowSourceContent } from "~/atoms/source-content"
import { Toc } from "~/components/ui/markdown/components/Toc"
import { IconOpacityTransition } from "~/components/ux/transition/icon"
import { isWebBuild } from "~/constants"
import { useEntryReadabilityToggle } from "~/hooks/biz/useEntryActions"
import { useRouteParamsSelector } from "~/hooks/biz/useRouteParams"
import { useAuthQuery } from "~/hooks/common/useBizQuery"
import { getNewIssueUrl } from "~/lib/issues"
import { useIsSoFWrappedElement, useWrappedElement } from "~/providers/wrapped-element-provider"
import {
useIsSoFWrappedElement,
useWrappedElement,
useWrappedElementSize,
} from "~/providers/wrapped-element-provider"
import { Queries } from "~/queries"
import { useEntry } from "~/store/entry"
import { useFeedById } from "~/store/feed"
@@ -183,31 +196,64 @@ export const RenderError: FallbackRender = ({ error }) => {
<span className="font-sans text-sm">
{t("entry_content.render_error")} {nextError.message}
</span>
<a
href={getNewIssueUrl({
body: [
"### Error",
"",
nextError.message,
"",
"### Stack",
"",
"```",
nextError.stack,
"```",
].join("\n"),
label: "bug",
title: "Render error",
})}
target="_blank"
rel="noreferrer"
<Button
variant={"outline"}
onClick={() => {
window.open(
getNewIssueUrl({
body: [
"### Error",
"",
nextError.message,
"",
"### Stack",
"",
"```",
nextError.stack,
"```",
].join("\n"),
label: "bug",
title: "Render error",
}),
)
}}
>
{t("entry_content.report_issue")}
</a>
</Button>
</div>
)
}
const useReadPercent = () => {
const y = 55
const { h } = useWrappedElementSize()
const scrollElement = useScrollViewElement()
const [scrollTop, setScrollTop] = useState(0)
useEffect(() => {
const handler = () => {
if (scrollElement) {
setScrollTop(scrollElement.scrollTop)
}
}
handler()
scrollElement?.addEventListener("scroll", handler)
return () => {
scrollElement?.removeEventListener("scroll", handler)
}
}, [scrollElement])
const readPercent = useMemo(() => {
const winHeight = getViewport().h
const deltaHeight = Math.min(scrollTop, winHeight)
return Math.floor(Math.min(Math.max(0, ((scrollTop - y + deltaHeight) / h) * 100), 100)) || 0
}, [y, h, scrollTop])
return [readPercent, scrollTop]
}
export const ContainerToc: FC = memo(() => {
const wrappedElement = useWrappedElement()
@@ -226,12 +272,52 @@ export const ContainerToc: FC = memo(() => {
"@[700px]:-translate-x-12 @[800px]:-translate-x-16 @[900px]:translate-x-0 @[900px]:items-start",
)}
/>
<BackTopIndicator
className={
"@[700px]:-translate-x-4 @[800px]:-translate-x-8 @[900px]:translate-x-0 @[900px]:items-start"
}
/>
</div>
</div>
</RootPortal>
)
})
const BackTopIndicator: Component = memo(({ className }) => {
const [readPercent] = useReadPercent()
const scrollElement = useScrollViewElement()
return (
<span
className={cn(
"mt-2 flex grow flex-col px-2 font-sans text-sm text-gray-800 dark:text-neutral-300",
className,
)}
>
<div className="flex items-center gap-2 tabular-nums">
<IconOpacityTransition
icon1={<MaterialSymbolsProgressActivity />}
icon2={<CircleProgress percent={readPercent} size={14} strokeWidth={2} />}
status={readPercent === 0 ? "init" : "done"}
/>
{readPercent}%<br />
</div>
<MotionButtonBase
onClick={() => {
springScrollTo(0, scrollElement!)
}}
className={cn(
"mt-1 flex flex-nowrap items-center gap-2 opacity-50 transition-all duration-500 hover:opacity-100",
readPercent > 10 ? "" : "pointer-events-none opacity-0",
)}
>
<i className="i-mingcute-arrow-up-circle-line" />
<span className="whitespace-nowrap">Back Top</span>
</MotionButtonBase>
</span>
)
})
export function AISummary({ entryId }: { entryId: string }) {
const { t } = useTranslation()
const entry = useEntry(entryId)
@@ -455,7 +455,7 @@ type SortListProps = {
view: FeedViewType
showCollapse: boolean
}
const SortedFeedItems = (props: SortListProps) => {
const SortedFeedItems = memo((props: SortListProps) => {
const by = useFeedListSortSelector((s) => s.by)
switch (by) {
case "count": {
@@ -469,7 +469,7 @@ const SortedFeedItems = (props: SortListProps) => {
return <SortByUnreadList {...props} />
}
}
}
})
const SortByAlphabeticalList = (props: SortListProps) => {
const { ids, showCollapse, view } = props
+81 -69
View File
@@ -40,6 +40,26 @@ interface FeedItemProps {
view?: number
className?: string
}
const DraggableItemWrapper: Component<
{
className?: string
isInMultipleSelection: boolean
} & React.HTMLAttributes<HTMLDivElement>
> = ({ children, isInMultipleSelection, ...props }) => {
const draggableContext = useContext(DraggableContext)
return (
<div
{...draggableContext?.attributes}
{...draggableContext?.listeners}
style={isInMultipleSelection ? draggableContext?.style : undefined}
{...props}
>
{children}
</div>
)
}
const FeedItemImpl = ({ view, feedId, className }: FeedItemProps) => {
const { t } = useTranslation()
const subscription = useSubscriptionByFeedId(feedId)
@@ -60,7 +80,7 @@ const FeedItemImpl = ({ view, feedId, className }: FeedItemProps) => {
})
const [selectedFeedIds, setSelectedFeedIds] = useSelectedFeedIdsState()
const draggableContext = useContext(DraggableContext)
const isMobile = useMobile()
const isInMultipleSelection = !isMobile && selectedFeedIds.includes(feedId)
const isMultiSelectingButNotSelected =
@@ -141,79 +161,71 @@ const FeedItemImpl = ({ view, feedId, className }: FeedItemProps) => {
const isFeed = feed.type === "feed" || !feed.type
return (
<>
<DraggableItemWrapper
isInMultipleSelection={isInMultipleSelection}
data-feed-id={feedId}
data-active={
isMultiSelectingButNotSelected
? false
: isActive || isContextMenuOpen || isInMultipleSelection
}
className={cn(
feedColumnStyles.item,
isFeed ? "py-[2px]" : "py-1.5",
"justify-between py-[2px]",
className,
)}
onClick={handleClick}
onDoubleClick={() => {
window.open(UrlBuilder.shareFeed(feedId, view), "_blank")
}}
{...contextMenuProps}
>
<div
{...(isInMultipleSelection && draggableContext?.attributes
? draggableContext.attributes
: {})}
{...(isInMultipleSelection && draggableContext?.listeners
? draggableContext.listeners
: {})}
style={isInMultipleSelection ? draggableContext?.style : undefined}
data-feed-id={feedId}
data-active={
isMultiSelectingButNotSelected
? false
: isActive || isContextMenuOpen || isInMultipleSelection
}
className={cn(
feedColumnStyles.item,
isFeed ? "py-[2px]" : "py-1.5",
"justify-between py-[2px]",
className,
"flex min-w-0 items-center",
isFeed && feed.errorAt && "text-red-900 dark:text-red-500",
)}
onClick={handleClick}
onDoubleClick={() => {
window.open(UrlBuilder.shareFeed(feedId, view), "_blank")
}}
{...contextMenuProps}
>
<div
className={cn(
"flex min-w-0 items-center",
isFeed && feed.errorAt && "text-red-900 dark:text-red-500",
)}
>
<FeedIcon fallback feed={feed} size={16} />
<FeedTitle feed={feed} />
{isFeed && feed.errorAt && (
<Tooltip delayDuration={300}>
<TooltipTrigger asChild>
<i className="i-mgc-wifi-off-cute-re ml-1 shrink-0 text-base" />
</TooltipTrigger>
<TooltipPortal>
<TooltipContent>
<FeedIcon fallback feed={feed} size={16} />
<FeedTitle feed={feed} />
{isFeed && feed.errorAt && (
<Tooltip delayDuration={300}>
<TooltipTrigger asChild>
<i className="i-mgc-wifi-off-cute-re ml-1 shrink-0 text-base" />
</TooltipTrigger>
<TooltipPortal>
<TooltipContent>
<div className="flex items-center gap-1">
<i className="i-mgc-time-cute-re" />
{t("feed_item.error_since")}{" "}
{dayjs
.duration(dayjs(feed.errorAt).diff(dayjs(), "minute"), "minute")
.humanize(true)}
</div>
{!!feed.errorMessage && (
<div className="flex items-center gap-1">
<i className="i-mgc-time-cute-re" />
{t("feed_item.error_since")}{" "}
{dayjs
.duration(dayjs(feed.errorAt).diff(dayjs(), "minute"), "minute")
.humanize(true)}
<i className="i-mgc-bug-cute-re" />
{feed.errorMessage}
</div>
{!!feed.errorMessage && (
<div className="flex items-center gap-1">
<i className="i-mgc-bug-cute-re" />
{feed.errorMessage}
</div>
)}
</TooltipContent>
</TooltipPortal>
</Tooltip>
)}
{subscription.isPrivate && (
<Tooltip delayDuration={300}>
<TooltipTrigger>
<OouiUserAnonymous className="ml-1 shrink-0 text-base" />
</TooltipTrigger>
<TooltipPortal>
<TooltipContent>{t("feed_item.not_publicly_visible")}</TooltipContent>
</TooltipPortal>
</Tooltip>
)}
</div>
<UnreadNumber unread={feedUnread} className="ml-2" />
)}
</TooltipContent>
</TooltipPortal>
</Tooltip>
)}
{subscription.isPrivate && (
<Tooltip delayDuration={300}>
<TooltipTrigger>
<OouiUserAnonymous className="ml-1 shrink-0 text-base" />
</TooltipTrigger>
<TooltipPortal>
<TooltipContent>{t("feed_item.not_publicly_visible")}</TooltipContent>
</TooltipPortal>
</Tooltip>
)}
</div>
</>
<UnreadNumber unread={feedUnread} className="ml-2" />
</DraggableItemWrapper>
)
}
@@ -223,7 +235,7 @@ const ListItemImpl: Component<{
listId: string
view: FeedViewType
iconSize?: number
}> = ({ view, listId, className, iconSize = 28 }) => {
}> = ({ view, listId, className, iconSize = 22 }) => {
const list = useListById(listId)
const isActive = useRouteParamsSelector((routerParams) => routerParams.listId === listId)
@@ -268,7 +280,7 @@ const ListItemImpl: Component<{
<div
data-list-id={listId}
data-active={isActive || isContextMenuOpen}
className={cn(feedColumnStyles.item, "py-1.5 pl-2.5", className)}
className={cn(feedColumnStyles.item, "py-1 pl-2.5", className)}
onClick={handleNavigate}
onDoubleClick={() => {
window.open(UrlBuilder.shareList(listId, view), "_blank")
@@ -1,738 +0,0 @@
import { Button } from "@follow/components/ui/button/index.js"
import { Card, CardHeader } from "@follow/components/ui/card/index.jsx"
import { Divider } from "@follow/components/ui/divider/index.js"
import { Input } from "@follow/components/ui/input/index.js"
import { Radio, RadioGroup } from "@follow/components/ui/radio-group/index.js"
import { Select, SelectTrigger, SelectValue } from "@follow/components/ui/select/index.jsx"
import { ResponsiveSelect } from "@follow/components/ui/select/responsive.js"
import { Switch } from "@follow/components/ui/switch/index.jsx"
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "@follow/components/ui/table/index.jsx"
import type {
ActionFeedField,
ActionOperation,
ActionsInput,
SupportedLanguages,
} from "@follow/models/types"
import { stopPropagation } from "@follow/utils/dom"
import { cn } from "@follow/utils/utils"
import { Fragment, useMemo, useState } from "react"
import { useTranslation } from "react-i18next"
import { Collapse, CollapseControlled } from "~/components/ui/collapse"
import { ViewSelectContent } from "~/modules/feed/view-select-content"
const FieldTableHeader = () => {
const { t } = useTranslation("settings")
return (
<TableHeader className="max-sm:hidden">
<TableRow>
<TableHead size="sm">{t("actions.action_card.field")}</TableHead>
<TableHead size="sm">{t("actions.action_card.operator")}</TableHead>
<TableHead size="sm">{t("actions.action_card.value")}</TableHead>
<TableHead size="sm" />
</TableRow>
</TableHeader>
)
}
const DeleteTableCell = ({ disabled, onClick }: { disabled?: boolean; onClick?: () => void }) => (
<TableCell size="sm" className="flex h-10 items-center">
<Button variant="ghost" className="w-full" disabled={disabled} onClick={onClick}>
<i className="i-mgc-delete-2-cute-re text-zinc-600" />
</Button>
</TableCell>
)
const ActionTableCell = ({
disabled,
onAnd,
onDelete,
}: {
disabled?: boolean
onAnd?: () => void
onDelete?: () => void
}) => {
const { t } = useTranslation("settings")
return (
<>
<TableCell size="sm" className="max-sm:flex max-sm:space-x-2 max-sm:pr-0">
<Button variant="ghost" className="sm:w-full" disabled={disabled} onClick={onDelete}>
<i className="i-mgc-delete-2-cute-re text-zinc-600" />
</Button>
<Button className="w-full sm:hidden" variant="outline" disabled={disabled} onClick={onAnd}>
{t("actions.action_card.and")}
</Button>
</TableCell>
<TableCell size="sm" className="max-sm:hidden">
<Button variant="outline" className="w-full" disabled={disabled} onClick={onAnd}>
{t("actions.action_card.and")}
</Button>
</TableCell>
</>
)
}
const OrTableRow = ({ onClick, disabled }: { onClick?: () => void; disabled?: boolean }) => {
const { t } = useTranslation("settings")
return (
<Button
variant="outline"
className="mt-1 w-full gap-1"
buttonClassName="py-1"
onClick={onClick}
disabled={disabled}
>
{t("actions.action_card.or")}
</Button>
)
}
const AddTableRow = ({ onClick, disabled }: { onClick?: () => void; disabled?: boolean }) => {
const { t } = useTranslation("settings")
return (
<Button
variant="outline"
className="mt-1 w-full gap-1"
buttonClassName="py-1"
onClick={onClick}
disabled={disabled}
>
<i className="i-mgc-add-cute-re" /> {t("actions.action_card.add")}
</Button>
)
}
const OperationTableCell = ({
type,
value,
onValueChange,
disabled,
}: {
type: string
value?: ActionOperation
onValueChange?: (value: ActionOperation) => void
disabled?: boolean
}) => {
const { t } = useTranslation("settings")
const OperationOptions = useMemo(() => {
return [
{
label: t("actions.action_card.operation_options.contains"),
value: "contains",
types: ["text"],
},
{
label: t("actions.action_card.operation_options.does_not_contain"),
value: "not_contains",
types: ["text"],
},
{
label: t("actions.action_card.operation_options.is_equal_to"),
value: "eq",
types: ["number", "text", "view"],
},
{
label: t("actions.action_card.operation_options.is_not_equal_to"),
value: "not_eq",
types: ["number", "text", "view"],
},
{
label: t("actions.action_card.operation_options.is_greater_than"),
value: "gt",
types: ["number"],
},
{
label: t("actions.action_card.operation_options.is_less_than"),
value: "lt",
types: ["number"],
},
{
label: t("actions.action_card.operation_options.matches_regex"),
value: "regex",
types: ["text"],
},
]
}, [t])
const options = OperationOptions.filter((option) => option.types.includes(type))
return (
<TableCell
size="sm"
className="max-sm:flex max-sm:items-center max-sm:justify-between max-sm:pr-0"
>
<span className="sm:hidden">{t("actions.action_card.operator")}</span>
<ResponsiveSelect
disabled={disabled}
value={value}
onValueChange={(value) => onValueChange?.(value as ActionOperation)}
items={options}
triggerClassName="h-8 max-sm:w-fit"
/>
</TableCell>
)
}
const SettingCollapsible = ({
title,
onOpenChange,
children,
}: {
title: string
children: React.ReactNode
open?: boolean
onOpenChange?: (open: boolean) => void
}) => {
const [open, setOpen] = useState(false)
const toggleOpen = () => {
setOpen((pre) => !pre)
onOpenChange && onOpenChange(!open)
}
if (typeof open === "boolean" && typeof onOpenChange === "function") {
return (
<CollapseControlled isOpened={open} onOpenChange={toggleOpen} title={title}>
<div className="px-1 pt-2">{children}</div>
</CollapseControlled>
)
}
return (
<Collapse title={title}>
<div className="pt-2">{children}</div>
</Collapse>
)
}
const CommonSelectTrigger = ({ className }: { className?: string }) => (
<SelectTrigger className={cn("h-8", className)}>
<SelectValue />
</SelectTrigger>
)
export function ActionCard({
data,
onChange,
}: {
data: ActionsInput[number]
onChange: (data: ActionsInput[number] | null) => void
}) {
const { t } = useTranslation("settings")
const FeedOptions = useMemo(() => {
return [
{
label: t("actions.action_card.feed_options.subscription_view"),
value: "view",
type: "view",
},
{
label: t("actions.action_card.feed_options.feed_title"),
value: "title",
},
{
label: t("actions.action_card.feed_options.feed_category"),
value: "category",
},
{
label: t("actions.action_card.feed_options.site_url"),
value: "site_url",
},
{
label: t("actions.action_card.feed_options.feed_url"),
value: "feed_url",
},
{
label: t("actions.action_card.feed_options.entry_title"),
value: "entry_title",
},
{
label: t("actions.action_card.feed_options.entry_content"),
value: "entry_content",
},
{
label: t("actions.action_card.feed_options.entry_url"),
value: "entry_url",
},
{
label: t("actions.action_card.feed_options.entry_author"),
value: "entry_author",
},
{
label: t("actions.action_card.feed_options.entry_media_length"),
value: "entry_media_length",
type: "number",
},
]
}, [t])
const TransitionOptions: {
label: string
value: SupportedLanguages
}[] = useMemo(() => {
return [
{
label: t("actions.action_card.no_translation"),
value: "none" as SupportedLanguages,
},
{
label: "English",
value: "en",
},
{
label: "日本語",
value: "ja",
},
{
label: "简体中文",
value: "zh-CN",
},
{
label: "繁體中文",
value: "zh-TW",
},
]
}, [t])
const { disabled } = data.result
return (
<Card>
<CardHeader className="space-y-4 px-6 py-4">
<Collapse
className="[&_.name-placeholder]:data-[state=open]:hidden [&_input.name-input]:data-[state=open]:block"
title={
<div className="flex w-full items-center gap-2 pr-2">
<Button
variant="ghost"
onClick={() => {
onChange(null)
}}
>
<i className="i-mgc-delete-2-cute-re text-zinc-600" />
</Button>
<p className="shrink-0 font-medium text-zinc-500">{t("actions.action_card.name")}</p>
<Input
value={data.name}
className="name-input hidden h-8"
onClick={stopPropagation}
onChange={(e) => {
data.name = e.target.value
onChange(data)
}}
/>
<div className="name-placeholder flex-1 text-sm">{data.name}</div>
<Switch
checked={!data.result.disabled}
onCheckedChange={(checked) => {
data.result.disabled = !checked
onChange(data)
}}
onClick={stopPropagation}
/>
</div>
}
>
<div className="mt-4 space-y-4 px-1">
<div className="space-y-3">
<p className="font-medium text-zinc-500">
{t("actions.action_card.when_feeds_match")}
</p>
<div className="flex flex-col gap-2">
<RadioGroup
value={data.condition.length > 0 ? "filter" : "all"}
onValueChange={(value) => {
if (value === "all") {
data.condition = []
} else {
data.condition = [[{}]]
}
onChange(data)
}}
>
<Radio disabled={disabled} label={t("actions.action_card.all")} value="all" />
<Radio
disabled={disabled}
label={t("actions.action_card.custom_filters")}
value="filter"
/>
</RadioGroup>
</div>
{data.condition.length > 0 && (
<div>
<Table>
<FieldTableHeader />
<TableBody>
{data.condition.flatMap((orConditions, orConditionIdx) => {
return orConditions.map((condition, conditionIdx) => {
const change = (key: string, value: string | number) => {
if (!data.condition[orConditionIdx]) {
data.condition[orConditionIdx] = [{}]
}
data.condition[orConditionIdx][conditionIdx][key] = value
onChange(data)
}
const type =
FeedOptions.find((option) => option.value === condition.field)?.type ||
"text"
return (
<Fragment key={`${orConditionIdx}${conditionIdx}`}>
{conditionIdx === 0 && orConditionIdx !== 0 && (
<TableRow className="flex h-16 items-center">
<Button disabled variant="outline">
{t("actions.action_card.or")}
</Button>
</TableRow>
)}
<TableRow className="max-sm:flex max-sm:flex-col">
<TableCell
size="sm"
className="max-sm:flex max-sm:items-center max-sm:justify-between max-sm:pr-0"
>
<span className="sm:hidden">
{t("actions.action_card.field")}
</span>
<ResponsiveSelect
disabled={disabled}
value={condition.field}
onValueChange={(value) =>
change("field", value as ActionFeedField)
}
items={FeedOptions}
triggerClassName="max-sm:w-fit"
/>
</TableCell>
<OperationTableCell
type={type}
disabled={disabled}
value={condition.operator}
onValueChange={(value) => change("operator", value)}
/>
<TableCell
size="sm"
className="max-sm:flex max-sm:items-center max-sm:justify-between max-sm:gap-4 max-sm:pr-0"
>
<span className="sm:hidden">
{t("actions.action_card.value")}
</span>
{type === "view" ? (
<Select
disabled={disabled}
onValueChange={(value) => change("value", value)}
value={condition.value}
>
<CommonSelectTrigger className="max-sm:w-fit" />
<ViewSelectContent />
</Select>
) : (
<Input
disabled={disabled}
type={type}
value={condition.value}
className="h-8"
onChange={(e) => change("value", e.target.value)}
/>
)}
</TableCell>
<ActionTableCell
disabled={disabled}
onAnd={() => {
data.condition[orConditionIdx].push({})
onChange(data)
}}
onDelete={() => {
if (data.condition[orConditionIdx].length === 1) {
data.condition.splice(orConditionIdx, 1)
} else {
data.condition[orConditionIdx].splice(conditionIdx, 1)
}
onChange(data)
}}
/>
</TableRow>
{conditionIdx !== orConditions.length - 1 && (
<TableRow className="relative flex items-center">
<Button disabled variant="outline">
{t("actions.action_card.and")}
</Button>
</TableRow>
)}
</Fragment>
)
})
})}
</TableBody>
</Table>
<OrTableRow
disabled={disabled}
onClick={() => {
data.condition.push([{}])
onChange(data)
}}
/>
</div>
)}
</div>
<div className="space-y-4">
<p className="font-medium text-zinc-500">{t("actions.action_card.then_do")}</p>
<div className="w-full space-y-4">
<div className="flex w-full items-center justify-between">
<span className="w-0 shrink grow truncate">
{t("actions.action_card.generate_summary")}
</span>
<Switch
disabled={disabled}
checked={data.result.summary}
onCheckedChange={(checked) => {
data.result.summary = checked
onChange(data)
}}
/>
</div>
<Divider />
<div className="flex w-full items-center justify-between">
<span className="w-0 shrink grow truncate">
{t("actions.action_card.translate_into")}
</span>
<ResponsiveSelect
disabled={disabled}
value={data.result.translation}
onValueChange={(value) => {
if (value === "none") {
delete data.result.translation
} else {
data.result.translation = value
}
onChange(data)
}}
items={TransitionOptions}
triggerClassName="max-w-44"
/>
</div>
<Divider />
<div className="flex w-full items-center justify-between">
<span className="w-0 shrink grow truncate">
{t("actions.action_card.enable_readability")}
</span>
<Switch
disabled={disabled}
checked={data.result.readability}
onCheckedChange={(checked) => {
data.result.readability = checked
onChange(data)
}}
/>
</div>
<Divider />
<div className="flex w-full items-center justify-between">
<span className="w-0 shrink grow truncate">
{t("actions.action_card.source_content")}
</span>
<Switch
disabled={disabled}
checked={data.result.sourceContent}
onCheckedChange={(checked) => {
data.result.sourceContent = checked
onChange(data)
}}
/>
</div>
<Divider />
<div className="flex w-full items-center justify-between">
<span className="w-0 shrink grow truncate">
{t("actions.action_card.new_entry_notification")}
</span>
<Switch
disabled={disabled}
checked={data.result.newEntryNotification}
onCheckedChange={(checked) => {
data.result.newEntryNotification = checked
onChange(data)
}}
/>
</div>
<Divider />
<div className="flex w-full items-center justify-between">
<span className="w-0 shrink grow truncate">
{t("actions.action_card.silence")}
</span>
<Switch
disabled={disabled}
checked={data.result.silence}
onCheckedChange={(checked) => {
data.result.silence = checked
onChange(data)
}}
/>
</div>
<Divider />
<div className="flex w-full items-center justify-between">
<span className="w-0 shrink grow truncate">{t("actions.action_card.block")}</span>
<Switch
disabled={disabled}
checked={data.result.block}
onCheckedChange={(checked) => {
data.result.block = checked
onChange(data)
}}
/>
</div>
<Divider />
<SettingCollapsible
title={t("actions.action_card.rewrite_rules")}
onOpenChange={(open) => {
if (
open &&
(!data.result.rewriteRules || data.result.rewriteRules?.length === 0)
) {
data.result.rewriteRules = [
{
from: "",
to: "",
},
]
}
onChange(data)
}}
>
{data.result.rewriteRules && data.result.rewriteRules.length > 0 && (
<Table>
<TableHeader>
<TableRow>
<TableHead size="sm" />
<TableHead size="sm">{t("actions.action_card.from")}</TableHead>
<TableHead size="sm">{t("actions.action_card.to")}</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{data.result.rewriteRules.map((rule, rewriteIdx) => {
const change = (key: string, value: string) => {
data.result.rewriteRules![rewriteIdx][key] = value
onChange(data)
}
return (
<TableRow key={rewriteIdx}>
<DeleteTableCell
disabled={disabled}
onClick={() => {
if (data.result.rewriteRules?.length === 1) {
delete data.result.rewriteRules
} else {
data.result.rewriteRules?.splice(rewriteIdx, 1)
}
onChange(data)
}}
/>
<TableCell size="sm">
<Input
disabled={disabled}
value={rule.from}
className="h-8"
onChange={(e) => change("from", e.target.value)}
/>
</TableCell>
<TableCell size="sm">
<Input
disabled={disabled}
value={rule.to}
className="h-8"
onChange={(e) => change("to", e.target.value)}
/>
</TableCell>
</TableRow>
)
})}
</TableBody>
</Table>
)}
<AddTableRow
disabled={disabled}
onClick={() => {
if (!data.result.rewriteRules) {
data.result.rewriteRules = []
}
data.result.rewriteRules!.push({
from: "",
to: "",
})
onChange(data)
}}
/>
</SettingCollapsible>
<Divider />
<SettingCollapsible
title={t("actions.action_card.webhooks")}
onOpenChange={(open) => {
if (open && (!data.result.webhooks || data.result.webhooks?.length === 0)) {
data.result.webhooks = [""]
}
onChange(data)
}}
>
{data.result.webhooks && data.result.webhooks.length > 0 && (
<>
{data.result.webhooks.map((webhook, rewriteIdx) => {
return (
<div key={rewriteIdx} className="flex items-center gap-2">
<DeleteTableCell
disabled={disabled}
onClick={() => {
if (data.result.webhooks?.length === 1) {
delete data.result.webhooks
} else {
data.result.webhooks?.splice(rewriteIdx, 1)
}
onChange(data)
}}
/>
<Input
disabled={disabled}
value={webhook}
className="h-8"
placeholder="https://"
onChange={(e) => {
data.result.webhooks![rewriteIdx] = e.target.value
onChange(data)
}}
/>
</div>
)
})}
</>
)}
<AddTableRow
disabled={disabled}
onClick={() => {
if (!data.result.webhooks) {
data.result.webhooks = []
}
data.result.webhooks!.push("")
onChange(data)
}}
/>
</SettingCollapsible>
</div>
</div>
</div>
</Collapse>
</CardHeader>
</Card>
)
}
@@ -1,122 +0,0 @@
import { Button } from "@follow/components/ui/button/index.js"
import { LoadingWithIcon } from "@follow/components/ui/loading/index.jsx"
import type { ActionsInput, ActionsResponse } from "@follow/models/types"
import { useMutation } from "@tanstack/react-query"
import { useEffect, useState } from "react"
import { useTranslation } from "react-i18next"
import { toast } from "sonner"
import { useAuthQuery } from "~/hooks/common"
import { apiClient } from "~/lib/api-fetch"
import { toastFetchError } from "~/lib/error-parser"
import { queryClient } from "~/lib/query-client"
import { ActionCard } from "~/modules/settings/action-card"
import { Queries } from "~/queries"
export const ActionSetting = () => {
const { t } = useTranslation("settings")
const actions = useAuthQuery(Queries.action.getAll())
const [actionsData, setActionsData] = useState<ActionsInput>([])
useEffect(() => {
if (actions.data?.rules) {
setActionsData(
actions.data.rules.map((rule) => {
const { condition } = rule
// fix old data
const finalCondition =
condition.length === 0 || Array.isArray(condition[0]) ? condition : [condition]
return {
...rule,
condition: finalCondition as any,
}
}),
)
}
}, [actions.data?.rules])
const mutation = useMutation({
mutationFn: async () => {
actionsData.forEach((action) => {
action.condition = action.condition
.map((condition) => {
return condition.filter((c) => c.field && c.operator && c.value)
})
.filter((c) => c.length > 0)
action.result.rewriteRules = action.result.rewriteRules?.filter((r) => r.from && r.to)
action.result.blockRules = action.result.blockRules?.filter(
(r) => r.field && r.operator && r.value,
)
action.result.webhooks = action.result.webhooks?.filter((w) => w)
})
await apiClient.actions.$put({
json: {
rules: actionsData as ActionsResponse,
},
})
},
onSuccess: () => {
Queries.action.getAll().invalidate()
queryClient.invalidateQueries({
queryKey: ["entries"],
})
toast(t("actions.saveSuccess"))
},
onError: (error) => {
toastFetchError(error)
},
})
if (actions.isPending) {
return (
<div className="center flex lg:absolute lg:inset-0">
<LoadingWithIcon
icon={<i className="i-mgc-magic-2-cute-re" />}
size="large"
className="lg:-translate-y-full"
/>
</div>
)
}
return (
<div className="mt-4 space-y-4">
{actionsData.map((action, actionIdx) => (
<ActionCard
key={actionIdx}
data={action}
onChange={(newAction) => {
if (!newAction) {
setActionsData(actionsData.filter((_, idx) => idx !== actionIdx))
} else {
setActionsData(actionsData.map((a, idx) => (idx === actionIdx ? newAction : a)))
}
}}
/>
))}
<Button
variant="outline"
className="center w-full gap-1"
onClick={() => {
setActionsData([
...actionsData,
{
name: t("actions.actionName", { number: actionsData.length + 1 }),
condition: [],
result: {},
},
])
}}
>
<i className="i-mgc-add-cute-re" />
<span>{t("actions.newRule")}</span>
</Button>
<div className="text-right">
<Button variant="primary" isLoading={mutation.isPending} onClick={() => mutation.mutate()}>
{t("actions.save")}
</Button>
</div>
</div>
)
}
@@ -91,6 +91,11 @@ export const SettingGeneral = () => {
label: t("general.group_by_date.label"),
description: t("general.group_by_date.description"),
}),
defineSettingItem("autoExpandLongSocialMedia", {
label: t("general.auto_expand_long_social_media.label"),
description: t("general.auto_expand_long_social_media.description"),
}),
isMobile &&
defineSettingItem("showQuickTimeline", {
label: t("general.show_quick_timeline.label"),
@@ -319,3 +319,56 @@ const RowRender = ({ feedId, listId }: { feedId: string; listId: string }) => {
</TableRow>
)
}
const categoryFormSchema = z.object({
categoryName: z.string().min(1),
})
export const CategoryCreationModalContent = ({
onSubmit,
}: {
onSubmit: (category: string) => void
}) => {
const { dismiss } = useCurrentModal()
const { t } = useTranslation()
const form = useForm<z.infer<typeof categoryFormSchema>>({
resolver: zodResolver(categoryFormSchema),
defaultValues: {
categoryName: "",
},
})
const handleSubmit = form.handleSubmit(({ categoryName }) => {
onSubmit(categoryName)
dismiss()
})
return (
<Form {...form}>
<form onSubmit={handleSubmit} className="space-y-4 lg:w-[450px]">
<FormField
control={form.control}
name="categoryName"
render={({ field }) => (
<FormItem>
<div>
<FormLabel>
{t("sidebar.feed_column.context_menu.new_category_modal.category_name")}
<sup className="ml-1 align-sub text-red-500">*</sup>
</FormLabel>
</div>
<FormControl>
<Input autoFocus {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<div className="flex justify-end">
<Button type="submit">
{t("sidebar.feed_column.context_menu.new_category_modal.create")}
</Button>
</div>
</form>
</Form>
)
}
@@ -143,7 +143,7 @@ export const ProfileButton: FC<ProfileButtonProps> = memo((props) => {
</DropdownMenuItem>
<DropdownMenuSeparator />
{/* NOTE: The shortcut needs to be grouped, but there is only one currently, so no separator line has been added. */}
{!zenModeSetting && (
<DropdownMenuItem
className="pl-3"
@@ -155,6 +155,17 @@ export const ProfileButton: FC<ProfileButtonProps> = memo((props) => {
{t("user_button.zen_mode")}
</DropdownMenuItem>
)}
<DropdownMenuItem
className="pl-3"
onClick={() => {
navigate("/action")
}}
icon={<i className="i-mgc-magic-2-cute-re" />}
>
{t("words.actions")}
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem
className="pl-3"
onClick={() => {
@@ -96,6 +96,11 @@ export const ProfileButton: FC<ProfileButtonProps> = () => {
<Divider className="mx-auto h-px w-[50px] !bg-border/80" />
<Item
label={t("user_button.actions")}
link="/action"
icon={<i className="i-mgc-magic-2-cute-re" />}
/>
<Item
label={t("user_button.preferences")}
onClick={() => {
@@ -117,26 +122,39 @@ export const ProfileButton: FC<ProfileButtonProps> = () => {
)
}
const Item: FC<{ icon: React.ReactNode; label: string; onClick: () => void }> = ({
const Item: FC<{ icon: React.ReactNode; label: string; onClick?: () => void; link?: string }> = ({
icon,
label,
onClick,
link,
}) => {
return (
<button
type="button"
onClick={onClick}
className={clsx(
"relative flex w-full select-none items-center rounded-sm px-4 py-1.5 outline-none transition-colors focus:bg-theme-item-hover",
"text-base font-medium",
"focus-within:!outline-transparent",
)}
>
const containerClassName = clsx(
"relative flex w-full select-none items-center rounded-sm px-4 py-1.5 outline-none transition-colors focus:bg-theme-item-hover",
"text-base font-medium",
"focus-within:!outline-transparent",
)
const children = (
<>
<span className="mr-1.5 inline-flex size-4 items-center justify-center">{icon}</span>
{label}
{/* Justify Fill */}
<span className="ml-1.5 size-4" />
</>
)
if (link) {
return (
<Link to={link} className={containerClassName}>
{children}
</Link>
)
}
return (
<button type="button" onClick={onClick} className={containerClassName}>
{children}
</button>
)
}
+1 -1
View File
@@ -1,7 +1,7 @@
export interface User {
name: string | null
id: string
emailVerified: string | null
emailVerified: boolean | null
image: string | null
handle: string | null
createdAt: string
@@ -0,0 +1,17 @@
import { useTranslation } from "react-i18next"
import { ActionSetting } from "~/modules/action/action-setting"
import { useSubViewTitle } from "~/modules/app-layout/subview/hooks"
export function Component() {
const { t } = useTranslation()
useSubViewTitle("words.actions")
return (
<div className="relative flex w-full flex-col items-center gap-8 px-4 pb-8 lg:pb-4">
<div className="pt-12 text-2xl font-bold">{t("words.actions")}</div>
<ActionSetting />
</div>
)
}
@@ -1,24 +0,0 @@
import { UserRole } from "@follow/constants"
import { ActionSetting } from "~/modules/settings/tabs/actions"
import { SettingsTitle } from "~/modules/settings/title"
import { defineSettingPageData, DisableWhy } from "~/modules/settings/utils"
const iconName = "i-mgc-magic-2-cute-re"
const priority = 1020
export const loader = defineSettingPageData({
icon: iconName,
name: "titles.actions",
priority,
disableIf: (ctx) => [ctx.role === UserRole.Trial, DisableWhy.NotActivation],
})
export function Component() {
return (
<>
<SettingsTitle />
<ActionSetting />
</>
)
}
+3 -1
View File
@@ -1,3 +1,4 @@
import { isMobile } from "@follow/components/hooks/useMobile.js"
import i18next from "i18next"
import { useEffect, useInsertionEffect, useLayoutEffect } from "react"
@@ -13,10 +14,11 @@ import { feedUnreadActions } from "~/store/unread"
const useUISettingSync = () => {
const setting = useUISettingValue()
const mobile = isMobile()
useSyncTheme()
useInsertionEffect(() => {
const root = document.documentElement
root.style.fontSize = `${setting.uiTextSize}px`
root.style.fontSize = `${setting.uiTextSize * (mobile ? 1.125 : 1)}px`
}, [setting.uiTextSize])
useInsertionEffect(() => {
+8 -6
View File
@@ -1,10 +1,12 @@
import { apiClient } from "~/lib/api-fetch"
import { useAuthQuery } from "~/hooks/common/useBizQuery"
import { defineQuery } from "~/lib/defineQuery"
import { actionActions } from "~/store/action"
export const action = {
getAll: () =>
defineQuery(["actions"], async () => {
const res = await apiClient.actions.$get()
return res.data
}),
getAll: () => defineQuery(["actions"], () => actionActions.fillRemoteActions()),
}
export const useActionsQuery = () =>
useAuthQuery(action.getAll(), {
staleTime: Infinity,
})
+10 -7
View File
@@ -159,17 +159,20 @@ export const useEntries = ({
initialPageParam: undefined,
refetchOnWindowFocus: false,
refetchOnReconnect: false,
refetchOnMount: fetchUnread && feedUnreadDirty ? "always" : false,
// DON'T refetch when the router is pop to previous page
refetchOnMount: fetchUnread && feedUnreadDirty && !history.isPop ? "always" : false,
staleTime:
// Force refetch unread entries when feed is dirty
// HACK: disable refetch when the router is pop to previous page
fetchUnread && feedUnreadDirty && !history.isPop
? 0
: // Keep reduce data fetch logic
reduceRefetch
? maxStaleTime
: defaultStaleTime,
history.isPop
? Infinity
: fetchUnread && feedUnreadDirty
? 0
: // Keep reduce data fetch logic
reduceRefetch
? maxStaleTime
: defaultStaleTime,
},
)
}
+7 -11
View File
@@ -14,19 +14,15 @@ export const users = {
}),
}
export interface AuthProvider {
name: string
id: string
color: string
icon: string
}
export const useAuthProviders = () => {
return useQuery({
queryKey: ["providers"],
queryFn: async () => (await getProviders()).data,
placeholderData: {
google: {
id: "google",
name: "Google",
},
github: {
id: "github",
name: "GitHub",
},
},
queryFn: async () => (await getProviders()).data as Record<string, AuthProvider>,
})
}
+21
View File
@@ -0,0 +1,21 @@
import type { ActionModel } from "@follow/models/types"
import { useActionStore } from "./store"
export function useActions(): ActionModel[]
export function useActions<T>(selector: (actions: ActionModel[]) => T): T
export function useActions<T>(selector?: (actions: ActionModel[]) => T) {
return useActionStore((state) => (selector ? selector(state.actions) : state.actions))
}
export function useActionByIndex(index: number): ActionModel
export function useActionByIndex<T>(index: number, selector: (action: ActionModel) => T): T
export function useActionByIndex<T>(index: number, selector?: (action: ActionModel) => T) {
return useActionStore((state) =>
selector ? selector(state.actions[index]) : state.actions[index],
)
}
export function useIsActionDataDirty() {
return useActionStore((state) => state.isDirty)
}
+3
View File
@@ -0,0 +1,3 @@
export * from "./hooks"
export * from "./store"
export * from "./types"
+100
View File
@@ -0,0 +1,100 @@
import type { ActionModel, ActionsResponse } from "@follow/models/types"
import { apiClient } from "~/lib/api-fetch"
import { createImmerSetter, createZustandStore } from "../utils/helper"
import type { ActionState } from "./types"
export const useActionStore = createZustandStore<ActionState>("action")(() => ({
actions: [],
isDirty: false,
}))
const set = createImmerSetter(useActionStore)
const get = useActionStore.getState
class ActionActionStatic {
init(actions: ActionModel[]) {
set((state) => {
state.actions = actions
})
}
insertNewEmptyAction(name: string) {
set((state) => {
state.actions.push({
name,
condition: [],
result: {},
})
state.isDirty = true
})
}
removeByIndex(index: number) {
set((state) => {
state.actions.splice(index, 1)
state.isDirty = true
})
}
updateByIndex(index: number, update: (action: ActionModel) => void) {
set((state) => {
update(state.actions[index])
state.isDirty = true
})
}
async fillRemoteActions() {
if (get().actions.length > 0) {
return get().actions
}
const res = await apiClient.actions.$get()
const rules = (res.data?.rules?.map((rule) => {
const { condition } = rule
// fix old data
const finalCondition =
condition.length === 0 || Array.isArray(condition[0]) ? condition : [condition]
return {
...rule,
condition: finalCondition as any,
}
}) || []) as ActionModel[]
this.init(rules)
return rules
}
async updateRemoteActions() {
if (!get().isDirty) {
return
}
set((state) => {
state.actions.forEach((action) => {
action.condition = action.condition
.map((condition) => {
return condition.filter((c) => c.field && c.operator && c.value)
})
.filter((c) => c.length > 0)
action.result.rewriteRules = action.result.rewriteRules?.filter((r) => r.from && r.to)
action.result.blockRules = action.result.blockRules?.filter(
(r) => r.field && r.operator && r.value,
)
action.result.webhooks = action.result.webhooks?.filter((w) => w)
})
})
await apiClient.actions.$put({
json: {
rules: get().actions as ActionsResponse,
},
})
set((state) => {
state.isDirty = false
})
}
}
export const actionActions = new ActionActionStatic()
+6
View File
@@ -0,0 +1,6 @@
import type { ActionModel } from "@follow/models/types"
export interface ActionState {
actions: ActionModel[]
isDirty: boolean
}
+6 -3
View File
@@ -11,7 +11,7 @@ import { omitObjectUndefinedValue } from "@follow/utils/utils"
import { isNil, merge, omit } from "es-toolkit/compat"
import { produce } from "immer"
import { clearFeedUnreadDirty, setFeedUnreadDirty } from "~/atoms/feed"
import { clearAllFeedUnreadDirty, clearFeedUnreadDirty, setFeedUnreadDirty } from "~/atoms/feed"
import { runTransactionInScope } from "~/database"
import { apiClient } from "~/lib/api-fetch"
import { getEntriesParams } from "~/lib/utils"
@@ -147,7 +147,7 @@ class EntryActions {
})
if (data.data) {
this.upsertMany(data.data, { isArchived })
this.upsertMany(structuredClone(data.data), { isArchived })
}
return data
}
@@ -170,6 +170,9 @@ class EntryActions {
// Mark feed unread dirty, so re-fetch the unread data when view feed unread entires in the next time
if (read === false) {
if (typeof params.view === "number" && !params.feedId) {
clearAllFeedUnreadDirty()
}
if (params.feedId) {
clearFeedUnreadDirty(params.feedId as string)
}
@@ -180,7 +183,7 @@ class EntryActions {
}
}
if (data.data) {
this.upsertMany(data.data, { isArchived })
this.upsertMany(structuredClone(data.data), { isArchived })
}
return data
}
@@ -12,6 +12,7 @@ import {
subscriptionByFeedIdSelector,
subscriptionByViewSelector,
subscriptionCategoryExistSelector,
subscriptionsByFeedIsdSelector,
} from "./selector"
import { useSubscriptionStore } from "./store"
@@ -30,10 +31,31 @@ export const useSubscriptionByView = (view: FeedViewType) =>
useCallback((state) => subscriptionByViewSelector(view)(state) || [], [view]),
)
export const useCategories = () =>
useSubscriptionStore(useCallback((state) => state.categories || [], []))
export const useCategoriesByView = (view: FeedViewType) =>
useSubscriptionStore(
useCallback(
(state) =>
new Set(
subscriptionByViewSelector(view)(state)
.map((subscription) => subscription.category)
.filter((category) => category !== null && category !== undefined)
.filter(Boolean),
),
[view],
),
)
export const useSubscriptionByFeedId = (feedId: FeedId) =>
useSubscriptionStore(
useCallback((state) => subscriptionByFeedIdSelector(feedId)(state) || null, [feedId]),
)
export const useSubscriptionsByFeedIds = (feedIds: FeedId[]) =>
useSubscriptionStore(
useCallback((state) => subscriptionsByFeedIsdSelector(feedIds)(state) || null, [feedIds]),
)
export const useFolderFeedsByFeedId = ({ feedId, view }: { feedId?: string; view: FeedViewType }) =>
useSubscriptionStore(
@@ -25,6 +25,8 @@ export const subscriptionByViewSelector = (view: FeedViewType) => (state: State)
state.feedIdByView[view].map((id) => state.data[id])
export const subscriptionByFeedIdSelector = (feedId: string) => (state: State) => state.data[feedId]
export const subscriptionsByFeedIsdSelector = (feedIds: string[]) => (state: State) =>
feedIds.map((id) => state.data[id])
export const folderFeedsByFeedIdSelector =
({ feedId, view }: { feedId?: string; view: FeedViewType }) =>
+48
View File
@@ -40,3 +40,51 @@
rgba(255, 255, 255, 0) 100%
);
}
/* Sonner customize */
@media (max-width: 600px) {
#root [data-sonner-toaster][data-y-position="bottom"] {
bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
}
#root [data-sonner-toaster][data-y-position="top"] {
top: calc(env(safe-area-inset-top, 0px) + 20px);
}
#root [data-sonner-toast] {
--border-radius: 16px;
}
#root [data-button="true"][data-action="true"] {
@apply bg-transparent font-bold font-sans text-foreground relative -mr-[16px] px-4 before:absolute before:inset-y-0 before:left-0 before:w-px before:bg-foreground/30;
}
}
#root [data-sonner-toast] {
&[data-type="success"]::before,
&[data-type="error"]::before,
&[data-type="info"]::before,
&[data-type="warning"]::before {
content: "";
border-radius: var(--border-radius);
@apply absolute inset-0 pointer-events-none z-[-1] dark:opacity-20 opacity-10 !transform-none;
}
&[data-type="success"]::before {
background: linear-gradient(to left, #56b4d3, #348f50);
}
&[data-type="error"]::before {
background: linear-gradient(to right, #ee9ca7, #ffdde1);
}
&[data-type="info"]::before {
background: linear-gradient(to right, #64a7d5, #6dd5fa, #c5eef4);
}
&[data-type="warning"]::before {
background: linear-gradient(to right, #f2994a, #f2c94c);
}
}
+1 -1
View File
@@ -53,5 +53,5 @@ button {
}
#react-scan-toolbar {
@apply !hidden lg:!block;
@apply max-lg:!hidden;
}
+2
View File
@@ -31,7 +31,9 @@ export default defineProject({
},
plugins: [
// @ts-expect-error
astPlugin,
// @ts-expect-error
tsconfigPath({
projects: ["./tsconfig.json"],
}),
+4 -4
View File
@@ -11,7 +11,7 @@ import { LazyImage } from "../ui/image"
export const GridList: FC<{
entries: EntriesPreview
feed: Feed
feed?: Feed
}> = ({ entries, feed }) => {
return (
<TeleportalTakeOff>
@@ -53,7 +53,7 @@ const Wrapper: FC<{
}
const GridItemFooter: FC<{
feed: Feed
feed?: Feed
entryId: string
entryPreview: EntriesPreview[number]
}> = ({ feed, entryPreview }) => {
@@ -68,11 +68,11 @@ const GridItemFooter: FC<{
<FeedIcon
fallback
className="mr-0.5 flex"
feed={feed.feed}
feed={feed?.feed || entryPreview.feeds!}
entry={entryPreview}
size={18}
/>
<span className={"min-w-0 truncate"}>{feed.feed.title}</span>
<span className={"min-w-0 truncate"}>{feed?.feed.title || entryPreview.feeds?.title}</span>
<span className={"text-zinc-500"}>·</span>
<span className={"text-zinc-500"}>
{dayjs
@@ -0,0 +1,72 @@
import { GridList } from "@client/components/items/grid"
import { NormalListItem } from "@client/components/items/normal"
import { PictureList } from "@client/components/items/picture"
import type { EntriesPreview } from "@client/query/entries"
import type { Feed } from "@client/query/feed"
import { FeedViewType } from "@follow/constants"
import type { FC } from "react"
import { useMemo } from "react"
const viewsRenderType = {
Normal: [
FeedViewType.Articles,
FeedViewType.Audios,
FeedViewType.Notifications,
FeedViewType.SocialMedia,
],
Picture: [FeedViewType.Pictures],
Grid: [FeedViewType.Videos],
}
export const Item = ({
entries,
feed,
view,
}: {
entries: EntriesPreview
feed?: Feed
view: FeedViewType
}) => {
const renderContent = useMemo(() => {
switch (true) {
case viewsRenderType.Normal.includes(view): {
return <NormalList entries={entries} feed={feed} />
}
case viewsRenderType.Picture.includes(view): {
return <PictureList entries={entries} feed={feed} />
}
case viewsRenderType.Grid.includes(view): {
return <GridList entries={entries} feed={feed} />
}
}
}, [entries, feed, view])
return <div>{renderContent}</div>
}
const NormalList: FC<{
entries: EntriesPreview
feed?: Feed
}> = ({ entries, feed }) => {
return (
<>
{entries?.map((entry) => (
<a className="relative" href={entry.url || void 0} target="_blank" key={entry.id}>
<div className="rounded-xl pl-3 duration-300 hover:bg-theme-item-hover">
<NormalListItem
withDetails
entryId={entry.id}
entryPreview={{
entries: entry,
feeds: feed?.feed || entry.feeds!,
read: true,
feedId: feed?.feed.id || entry.feeds?.id!,
}}
/>
</div>
</a>
))}
</>
)
}
@@ -15,7 +15,6 @@ import {
useSetStableMasonryItemRatio,
} from "@follow/components/ui/masonry/contexts.jsx"
import { Masonry } from "@follow/components/ui/masonry/index.jsx"
import type { EntryModel } from "@follow/models/types"
import { nextFrame } from "@follow/utils/dom"
import { cn } from "@follow/utils/utils"
import dayjs from "dayjs"
@@ -100,7 +99,7 @@ const getCurrentColumn = (w: number) => {
export const PictureList: FC<{
entries: EntriesPreview
feed: Feed
feed?: Feed
}> = ({ entries, feed }) => {
const [masonryItemsRadio, setMasonryItemsRadio] = useState<Record<string, number>>({})
const [currentItemWidth, setCurrentItemWidth] = useState(0)
@@ -211,8 +210,8 @@ const render: React.ComponentType<
width: number | undefined
blurhash: string | undefined
id: string
entry: EntryModel
feed: Feed
entry: EntriesPreview[number]
feed?: Feed
}>
> = memo(({ data }) => {
const [isHovered, setIsHovered] = useState(false)
@@ -273,8 +272,8 @@ const GridItemFooter = ({
timeClassName,
feed,
}: {
entry: EntryModel
feed: Feed
entry: EntriesPreview[number]
feed?: Feed
titleClassName?: string
descriptionClassName?: string
timeClassName?: string
@@ -293,9 +292,15 @@ const GridItemFooter = ({
</div>
</div>
<div className="flex items-center gap-1 truncate text-[13px]">
<FeedIcon fallback className="mr-0.5 flex" feed={feed.feed} entry={entry} size={18} />
<FeedIcon
fallback
className="mr-0.5 flex"
feed={feed?.feed || entry.feeds}
entry={entry}
size={18}
/>
<span className={cn("min-w-0 truncate", descriptionClassName)}>
{getPreferredTitle(feed.feed)}
{getPreferredTitle(feed?.feed || entry.feeds)}
</span>
<span className={cn("text-zinc-500", timeClassName)}>·</span>
<span className={cn("text-zinc-500", timeClassName)}>
@@ -7,7 +7,6 @@ import {
TooltipTrigger,
} from "@follow/components/ui/tooltip/index.jsx"
import type { FeedOrListRespModel } from "@follow/models/types"
import { replaceImgUrlIfNeed } from "@follow/utils/img-proxy"
import { cn } from "@follow/utils/utils"
import { useTranslation } from "react-i18next"
@@ -60,7 +59,7 @@ export const FeedCertification = ({
<span>{t("feed_item.claimed_by_owner")}</span>
{feed.owner ? (
<Avatar className="inline-flex aspect-square size-5 rounded-full">
<AvatarImage src={replaceImgUrlIfNeed(feed.owner.image || undefined)} />
<AvatarImage src={feed.owner.image || undefined} />
<AvatarFallback>{feed.owner.name?.slice(0, 2)}</AvatarFallback>
</Avatar>
) : (
@@ -1,37 +1,19 @@
import { GridList } from "@client/components/items/grid"
import { NormalListItem } from "@client/components/items/normal"
import { PictureList } from "@client/components/items/picture"
import { Item } from "@client/components/items"
import { MainContainer } from "@client/components/layout/main"
import { FeedCertification } from "@client/components/ui/feed-certification"
import { askOpenInFollowApp } from "@client/lib/helper"
import type { EntriesPreview } from "@client/query/entries"
import { useEntriesPreview } from "@client/query/entries"
import type { Feed } from "@client/query/feed"
import { useFeed } from "@client/query/feed"
import { FollowIcon } from "@follow/components/icons/follow.jsx"
import { Button } from "@follow/components/ui/button/index.jsx"
import { FeedIcon } from "@follow/components/ui/feed-icon/index.jsx"
import { LoadingCircle } from "@follow/components/ui/loading/index.jsx"
import { FeedViewType } from "@follow/constants"
import { useTitle } from "@follow/hooks"
import { cn } from "@follow/utils/utils"
import type { FC } from "react"
import { useMemo } from "react"
import { useTranslation } from "react-i18next"
import { useParams, useSearchParams } from "react-router"
import { toast } from "sonner"
const viewsRenderType = {
Normal: [
FeedViewType.Articles,
FeedViewType.Audios,
FeedViewType.Notifications,
FeedViewType.SocialMedia,
],
Picture: [FeedViewType.Pictures],
Grid: [FeedViewType.Videos],
}
const numberFormatter = new Intl.NumberFormat()
export function Component() {
const { id } = useParams()
@@ -51,19 +33,7 @@ export function Component() {
})
useTitle(feed.data?.feed.title)
const renderContent = useMemo(() => {
switch (true) {
case viewsRenderType.Normal.includes(view): {
return <NormalList entries={entries.data!} feed={feed.data} />
}
case viewsRenderType.Picture.includes(view): {
return <PictureList entries={entries.data!} feed={feed.data} />
}
case viewsRenderType.Grid.includes(view): {
return <GridList entries={entries.data!} feed={feed.data} />
}
}
}, [entries.data, feed.data, view])
if (feed.isLoading || !feed.data?.feed || !feedData) {
return (
<>
@@ -131,30 +101,9 @@ export function Component() {
{entries.isLoading && !entries.data ? (
<LoadingCircle size="large" className="center mt-12" />
) : (
renderContent
<Item entries={entries.data} feed={feed.data} view={view} />
)}
</div>
</MainContainer>
)
}
const NormalList: FC<{
entries: EntriesPreview
feed: Feed
}> = ({ entries, feed }) => {
return (
<>
{entries?.map((entry) => (
<a className="relative" href={entry.url || void 0} target="_blank" key={entry.id}>
<div className="rounded-xl pl-3 duration-300 hover:bg-theme-item-hover">
<NormalListItem
withDetails
entryId={entry.id}
entryPreview={{ entries: entry, feeds: feed.feed, read: true, feedId: feed.feed.id! }}
/>
</div>
</a>
))}
</>
)
}
@@ -1,13 +1,16 @@
import { Item } from "@client/components/items"
import { MainContainer } from "@client/components/layout/main"
import { FeedCertification } from "@client/components/ui/feed-certification"
import { askOpenInFollowApp } from "@client/lib/helper"
import type { Feed } from "@client/query/feed"
import { useList } from "@client/query/list"
import { FollowIcon } from "@follow/components/icons/follow.jsx"
import { Avatar, AvatarFallback, AvatarImage } from "@follow/components/ui/avatar/index.jsx"
import { Button } from "@follow/components/ui/button/index.jsx"
import { FeedIcon } from "@follow/components/ui/feed-icon/index.jsx"
import { LoadingCircle } from "@follow/components/ui/loading/index.jsx"
import { useTitle } from "@follow/hooks"
import { cn } from "@follow/utils/utils"
import { useTranslation } from "react-i18next"
import { useParams } from "react-router"
import { toast } from "sonner"
@@ -40,6 +43,7 @@ export function Component() {
return `/feeds/all/pending?view=0&follow=${id}&follow_type=list`
})
}
return (
<MainContainer>
{list.isLoading ? (
@@ -53,12 +57,22 @@ export function Component() {
className="mask-squircle mask shrink-0"
size={64}
/>
<div className="flex max-w-prose flex-col items-center">
<div className="mb-6 flex max-w-prose flex-col items-center">
<div className="mb-2 mt-4 flex items-center text-2xl font-bold">
<h1>{list.data.list.title}</h1>
<FeedCertification feed={list.data.list} />
</div>
<div className="mb-8 text-sm text-zinc-500">{list.data.list.description}</div>
<div className="mb-2 text-sm text-zinc-500">{list.data.list.description}</div>
<a
href={`/share/users/${list.data.list.owner?.id}`}
target="_blank"
className="flex items-center gap-1 text-sm text-zinc-500"
>
<span>{t("feed.madeby")}</span>
<Avatar className="inline-flex aspect-square size-5 rounded-full">
<AvatarImage src={list.data.list.owner?.image || undefined} />
<AvatarFallback>{list.data.list.owner?.name?.slice(0, 2)}</AvatarFallback>
</Avatar>
</a>
</div>
<div className="mb-4 text-sm">
{t("feed.followsAndFeeds", {
@@ -89,7 +103,7 @@ export function Component() {
</span>
<div className="flex w-full max-w-3xl flex-col gap-4 pb-12 pt-8">
{listData!.feedIds
?.slice(0, 5)
?.slice(0, 7)
.map((feedId) => <FeedRow feed={feedMap[feedId]} key={feedId} />)}
{"feedCount" in list.data && (
<div onClick={handleOpenInFollowApp} className="text-sm text-zinc-500">
@@ -99,6 +113,10 @@ export function Component() {
</div>
)}
</div>
<div className="mt-8 text-zinc-500">{t("feed.preview")}</div>
<div className={cn("w-full pb-12 pt-8", "flex max-w-3xl flex-col gap-2")}>
<Item entries={list.data.entries} view={list.data.list.view} />
</div>
</div>
)
)}
@@ -115,8 +133,9 @@ const FeedRow = ({ feed }: { feed: Feed["feed"] }) => {
key={feed.id}
>
<FeedIcon fallback feed={feed} className="mask-squircle mask mr-2 shrink-0" size={20} />
{feed.title}
<div className="shrink-0">{feed.title}</div>
<FeedCertification feed={feed} />
<div className="ml-8 truncate text-sm text-zinc-500">{feed.description}</div>
</a>
)
}
@@ -8,7 +8,6 @@ import { Button } from "@follow/components/ui/button/index.jsx"
import { FeedIcon } from "@follow/components/ui/feed-icon/index.jsx"
import { LoadingCircle } from "@follow/components/ui/loading/index.jsx"
import { useTitle } from "@follow/hooks"
import { replaceImgUrlIfNeed } from "@follow/utils/img-proxy"
import { UrlBuilder } from "@follow/utils/url-builder"
import { cn } from "@follow/utils/utils"
import { Fragment } from "react"
@@ -35,10 +34,7 @@ export const Component = () => {
) : (
<Fragment>
<Avatar className="aspect-square size-16">
<AvatarImage
className="duration-200 animate-in fade-in-0"
src={replaceImgUrlIfNeed(user.data?.image || undefined)}
/>
<AvatarImage className="duration-200 animate-in fade-in-0" src={user.data?.image} />
<AvatarFallback>{user.data?.name?.slice(0, 2)}</AvatarFallback>
</Avatar>
<div className="mb-8 flex flex-col items-center">
+5 -1
View File
@@ -2,6 +2,8 @@ import { apiClient } from "@client/lib/api-fetch"
import { getHydrateData } from "@client/lib/helper"
import { useQuery } from "@tanstack/react-query"
import type { Feed } from "./feed"
const fetchEntriesPreview = async ({ id }: { id?: string }) => {
const res = await apiClient.entries.preview.$get({
query: {
@@ -20,4 +22,6 @@ export const useEntriesPreview = ({ id }: { id?: string }) => {
})
}
export type EntriesPreview = Awaited<ReturnType<typeof fetchEntriesPreview>>
export type EntriesPreview = (Awaited<ReturnType<typeof fetchEntriesPreview>>[number] & {
feeds?: Feed["feed"]
})[]
+10 -10
View File
@@ -12,14 +12,14 @@
"@fontsource/sn-pro": "5.1.0",
"@openpanel/web": "1.0.1",
"@resvg/resvg-js": "2.6.2",
"@sentry/react": "8.41.0",
"@tanstack/react-query": "5.62.0",
"@sentry/react": "8.42.0",
"@tanstack/react-query": "5.62.3",
"blurhash": "2.0.5",
"click-to-react-component": "1.1.2",
"dayjs": "1.11.13",
"fastify": "5.1.0",
"framer-motion": "11.12.0",
"i18next": "^24.0.2",
"framer-motion": "11.13.1",
"i18next": "^24.0.5",
"jotai": "2.10.3",
"kose-font": "1.0.0",
"linkedom": "^0.18.5",
@@ -30,10 +30,10 @@
"react-hotkeys-hook": "4.6.1",
"react-i18next": "^15.1.3",
"react-photo-view": "1.2.6",
"react-router": "7.0.1",
"react-router": "7.0.2",
"satori": "0.12.0",
"sonner": "1.7.0",
"tailwindcss": "3.4.15",
"sonner": "1.7.1",
"tailwindcss": "3.4.16",
"use-context-selector": "2.0.0",
"xss": "1.0.15"
},
@@ -48,10 +48,10 @@
"@radix-ui/react-avatar": "1.1.1",
"@types/html-minifier-terser": "7.0.2",
"chokidar": "4.0.1",
"daisyui": "4.12.14",
"daisyui": "4.12.20",
"dotenv-flow": "4.1.0",
"es-toolkit": "1.29.0",
"foxact": "0.2.42",
"foxact": "0.2.43",
"glob": "11.0.0",
"html-minifier-terser": "7.2.0",
"lightningcss": "1.28.2",
@@ -62,6 +62,6 @@
"tailwindcss": "3.4.15",
"tsup": "8.3.5",
"tsx": "4.19.2",
"vite": "6.0.2"
"vite": "6.0.3"
}
}
+22
View File
@@ -0,0 +1,22 @@
# What's new in v0.2.7
## New Features
1. New `Move to Category` operation in feed subscription context menu
![](https://github.com/RSSNext/assets/blob/main/0.2.7/move-category.png?raw=true)
2. New `Expand long social media` setting to automatically expand social media entries containing long text.
![](https://github.com/RSSNext/assets/blob/main/0.2.7/expand-long-social-media.png?raw=true)
3. New `Back Top` button and read progress indicator in entry content
![](https://github.com/RSSNext/assets/blob/main/0.2.7/read-indicator.png?raw=true)
4. Independent Action page
## Bug Fixes
- Resolved issue where back navigation to the pending view would not behave correctly after changing orientation in some device.
- Fixed issue can't filter entries with no picture in the picture view.
+8 -4
View File
@@ -62,7 +62,7 @@ async function cleanSources(buildPath, electronVersion, platform, arch, callback
// copy needed node_modules to be included in the app
await Promise.all(
keepModules.values().map((item) => {
Array.from(keepModules.values()).map((item) => {
// Check is exist
if (fs.existsSync(path.join(buildPath, "node_modules", item))) {
// eslint-disable-next-line array-callback-return
@@ -158,9 +158,13 @@ const config: ForgeConfig = {
iconUrl: "https://app.follow.is/favicon.ico",
}),
new MakerAppImage({
options: {
icon: "resources/icon.png",
mimeType: ["x-scheme-handler/follow"],
config: {
icons: [
{
file: "resources/icon.png",
size: 256,
},
],
},
}),
],
+8
View File
@@ -336,14 +336,19 @@
"sidebar.feed_actions.unfollow_feed_many": "Unfollow all selected feeds",
"sidebar.feed_actions.unfollow_feed_many_confirm": "Confirm unfollow all selected feeds?",
"sidebar.feed_actions.unfollow_feed_many_warning": "Warning: This operation will unfollow all selected feeds, and cannot be undone.",
"sidebar.feed_column.context_menu.add_feeds_to_category": "Move to Category",
"sidebar.feed_column.context_menu.add_feeds_to_list": "Add Feeds to List",
"sidebar.feed_column.context_menu.change_to_other_view": "Switch to Another View",
"sidebar.feed_column.context_menu.create_category": "New Category",
"sidebar.feed_column.context_menu.delete_category": "Delete Category",
"sidebar.feed_column.context_menu.delete_category_confirmation": "Delete Category {{folderName}}?",
"sidebar.feed_column.context_menu.mark_as_read": "Mark as Read",
"sidebar.feed_column.context_menu.new_category_modal.category_name": "Category Name",
"sidebar.feed_column.context_menu.new_category_modal.create": "Create",
"sidebar.feed_column.context_menu.rename_category": "Rename Category",
"sidebar.feed_column.context_menu.rename_category_error": "Failed to rename category",
"sidebar.feed_column.context_menu.rename_category_success": "Category renamed successfully",
"sidebar.feed_column.context_menu.title": "Move to New Category",
"sidebar.select_sort_method": "Select a sort method",
"signin.continue_with": "Continue with {{provider}}",
"signin.sign_in_to": "Sign in to",
@@ -368,6 +373,7 @@
"trending.user": "Trending Users",
"user_button.account": "Account",
"user_button.achievement": "Achievements",
"user_button.actions": "Actions",
"user_button.download_desktop_app": "Download Desktop app",
"user_button.log_out": "Log out",
"user_button.power": "Power",
@@ -380,6 +386,7 @@
"user_profile.share": "Share",
"user_profile.toggle_item_style": "Toggle Item Style",
"words.achievement": "Achievements",
"words.actions": "Actions",
"words.add": "Add",
"words.boost": "Boost",
"words.browser": "Browser",
@@ -401,6 +408,7 @@
"words.rss3": "RSS3",
"words.rsshub": "RSSHub",
"words.search": "Search",
"words.show_more": "Show more",
"words.starred": "Starred",
"words.title": "Title",
"words.transform": "Transform",
+8 -1
View File
@@ -219,6 +219,7 @@
"feed_item.claimed_by_unknown": "その所有者によってクレームされています。",
"feed_item.claimed_by_you": "あなたによってクレームされています",
"feed_item.claimed_feed": "クレームされたフィード",
"feed_item.claimed_list": "クレームされたリスト",
"feed_item.error_since": "エラー発生時刻",
"feed_item.not_publicly_visible": "プロフィールページに公開されていません",
"feed_view_type.articles": "記事",
@@ -335,14 +336,19 @@
"sidebar.feed_actions.unfollow_feed_many": "選択したすべてのフィードを解除",
"sidebar.feed_actions.unfollow_feed_many_confirm": "選択したすべてのフィードを解除してもよろしいですか?",
"sidebar.feed_actions.unfollow_feed_many_warning": "警告: この操作は選択したすべてのフィードのフォローを解除し元には戻せません。",
"sidebar.feed_column.context_menu.add_feeds_to_category": "カテゴリーに移動",
"sidebar.feed_column.context_menu.add_feeds_to_list": "フィードをリストに追加",
"sidebar.feed_column.context_menu.change_to_other_view": "他のビューに切り替え",
"sidebar.feed_column.context_menu.create_category": "新規カテゴリーを作成",
"sidebar.feed_column.context_menu.delete_category": "カテゴリーを削除",
"sidebar.feed_column.context_menu.delete_category_confirmation": "カテゴリー{{folderName}} を削除しますか?",
"sidebar.feed_column.context_menu.mark_as_read": "既読にする",
"sidebar.feed_column.context_menu.rename_category": "カテゴリーの名前を変更",
"sidebar.feed_column.context_menu.new_category_modal.category_name": "カテゴリー名",
"sidebar.feed_column.context_menu.new_category_modal.create": "作成",
"sidebar.feed_column.context_menu.rename_category": "カテゴリーをリネーム",
"sidebar.feed_column.context_menu.rename_category_error": "カテゴリーのリネームに失敗しました",
"sidebar.feed_column.context_menu.rename_category_success": "カテゴリーのリネームに成功しました",
"sidebar.feed_column.context_menu.title": "新規カテゴリーに移動する",
"sidebar.select_sort_method": "並べ替え方法を選択",
"signin.continue_with": "{{provider}} で続ける",
"signin.sign_in_to": "サインイン",
@@ -400,6 +406,7 @@
"words.rss3": "RSS3",
"words.rsshub": "RSSHub",
"words.search": "検索",
"words.show_more": "Show more",
"words.starred": "スター付き",
"words.title": "タイトル",
"words.transform": "カスタマイズ",
+6
View File
@@ -335,14 +335,19 @@
"sidebar.feed_actions.unfollow_feed_many": "取消订阅选中的订阅源",
"sidebar.feed_actions.unfollow_feed_many_confirm": "确认要取消订阅选中的订阅源?",
"sidebar.feed_actions.unfollow_feed_many_warning": "警告:这个操作将取消订阅所有选中的订阅源,并且不可恢复。",
"sidebar.feed_column.context_menu.add_feeds_to_category": "移动至分类",
"sidebar.feed_column.context_menu.add_feeds_to_list": "添加订阅源到列表",
"sidebar.feed_column.context_menu.change_to_other_view": "更改为其他视图",
"sidebar.feed_column.context_menu.create_category": "新分类",
"sidebar.feed_column.context_menu.delete_category": "删除分类",
"sidebar.feed_column.context_menu.delete_category_confirmation": "删除分类 {{folderName}}?",
"sidebar.feed_column.context_menu.mark_as_read": "标记为已读",
"sidebar.feed_column.context_menu.new_category_modal.category_name": "分类名称",
"sidebar.feed_column.context_menu.new_category_modal.create": "创建",
"sidebar.feed_column.context_menu.rename_category": "重命名分类",
"sidebar.feed_column.context_menu.rename_category_error": "重命名分类失败",
"sidebar.feed_column.context_menu.rename_category_success": "分类重命名成功",
"sidebar.feed_column.context_menu.title": "移动至新分类",
"sidebar.select_sort_method": "选择排序方法",
"signin.continue_with": "使用 {{provider}} 登入",
"signin.sign_in_to": "登入至",
@@ -400,6 +405,7 @@
"words.rss3": "RSS3",
"words.rsshub": "RSSHub",
"words.search": "搜索",
"words.show_more": "显示更多",
"words.starred": "收藏",
"words.title": "标题",
"words.transform": "转换",
+6 -1
View File
@@ -201,6 +201,7 @@
"feed_form.fee_description": "要追隨此清單,您必須向清單創建者支付費用。",
"feed_form.feed_not_found": "未找到相關資訊流",
"feed_form.feedback": "反饋",
"feed_form.fill_default": "填充",
"feed_form.follow": "追隨",
"feed_form.follow_with_fee": "追隨需要 {{fee}} Power",
"feed_form.followed": "🎉 已追隨",
@@ -218,6 +219,7 @@
"feed_item.claimed_by_unknown": "未知所有者",
"feed_item.claimed_by_you": "由你認領",
"feed_item.claimed_feed": "已認領訂閱源",
"feed_item.claimed_list": "已認領清單",
"feed_item.error_since": "錯誤始於",
"feed_item.not_publicly_visible": "在你的個人頁面上不公開可見",
"feed_view_type.articles": "文章",
@@ -371,6 +373,7 @@
"user_button.power": "Power",
"user_button.preferences": "偏好設定",
"user_button.profile": "個人檔案",
"user_button.zen_mode": "Zen 模式",
"user_profile.close": "關閉",
"user_profile.edit": "編輯",
"user_profile.loading": "載入中",
@@ -398,13 +401,15 @@
"words.rss3": "RSS3",
"words.rsshub": "RSSHub",
"words.search": "搜尋",
"words.show_more": "顯示更多",
"words.starred": "收藏",
"words.title": "標題",
"words.transform": "轉換",
"words.trending": "趨勢",
"words.undo": "取消動作",
"words.unread": "未讀",
"words.user": "使用者",
"words.which.all": "所有",
"words.zero_items": "沒有項目",
"zen.exit": "退出專注模式"
"zen.exit": "退出 Zen 模式"
}
+1
View File
@@ -398,6 +398,7 @@
"words.rss3": "RSS3",
"words.rsshub": "RSSHub",
"words.search": "搜尋",
"words.show_more": "顯示更多",
"words.starred": "收藏",
"words.title": "標題",
"words.transform": "轉換",
+2
View File
@@ -9,6 +9,8 @@
"feed.follower_other": "followers",
"feed.followsAndFeeds": "{{subscriptionCount}} {{subscriptionNoun}} and {{feedsCount}} {{feedsNoun}} on {{appName}}",
"feed.followsAndReads": "{{subscriptionCount}} {{subscriptionNoun}} with {{readCount}} recent {{readNoun}} on {{appName}}",
"feed.madeby": "Made by",
"feed.preview": "Preview",
"feed.read_one": "read",
"feed.read_other": "reads",
"feed.view_feed_url": "View Feed URL",
+3
View File
@@ -9,6 +9,8 @@
"feed.follower_other": "フォロー",
"feed.followsAndFeeds": "{{subscriptionCount}} {{subscriptionNoun}} と {{feedsCount}} {{feedsNoun}} on {{appName}}",
"feed.followsAndReads": "{{appName}} で {{subscriptionCount}} {{subscriptionNoun}} と {{readCount}} {{readNoun}}",
"feed.madeby": "作成者",
"feed.preview": "プレビュー",
"feed.read_one": "読む",
"feed.read_other": "読む",
"feed.view_feed_url": "フィードの URL を表示",
@@ -16,6 +18,7 @@
"feed_item.claimed_by_unknown": "所有者によるクレーム",
"feed_item.claimed_by_you": "あなたのクレーム",
"feed_item.claimed_feed": "フィードをクレーム",
"feed_item.claimed_list": "リストをクレーム",
"feed_item.error_since": "エラー",
"feed_item.not_publicly_visible": "あなたのプロファイルページでは非公開です",
"header.app": "アプリ",
+1
View File
@@ -16,6 +16,7 @@
"feed_item.claimed_by_unknown": "未知所有者",
"feed_item.claimed_by_you": "由你認領",
"feed_item.claimed_feed": "已認領訂閱源",
"feed_item.claimed_list": "已認領清單",
"feed_item.error_since": "錯誤始於",
"feed_item.not_publicly_visible": "在你的個人頁面上不公開可見",
"header.app": "應用程式",
+1 -1
View File
@@ -67,7 +67,7 @@
"menu.undo": "撤銷",
"menu.view": "查看",
"menu.window": "窗口",
"menu.zenMode": "專注模式",
"menu.zenMode": "Zen 模式",
"menu.zoom": "縮放",
"menu.zoomIn": "放大",
"menu.zoomOut": "縮小"
+3
View File
@@ -7,6 +7,7 @@
"about.socialMedia": "Social Media",
"actions.actionName": "Action {{number}}",
"actions.action_card.add": "Add",
"actions.action_card.add_action": "Add Action",
"actions.action_card.all": "All",
"actions.action_card.and": "And",
"actions.action_card.block": "Block",
@@ -107,6 +108,8 @@
"feeds.tableHeaders.subscriptionCount": "Subs",
"feeds.tableHeaders.tipAmount": "Tips",
"general.app": "App",
"general.auto_expand_long_social_media.description": "Automatically expand social media entries containing long text.",
"general.auto_expand_long_social_media.label": "Expand long social media",
"general.auto_group.description": "Automatically group feeds by site domain.",
"general.auto_group.label": "Auto Group",
"general.cache": "Cache",
+2
View File
@@ -107,6 +107,8 @@
"feeds.tableHeaders.subscriptionCount": "購読者",
"feeds.tableHeaders.tipAmount": "受け取った報酬",
"general.app": "アプリ",
"general.auto_expand_long_social_media.description": "ソーシャルメディアに含まれる長いテキストを展開して表示します。",
"general.auto_expand_long_social_media.label": "ソーシャルメディアを展開",
"general.auto_group.description": "サイトのドメインごとに自動でグループ化する。",
"general.auto_group.label": "自動グループ化",
"general.cache": "キャッシュ",
+2
View File
@@ -107,6 +107,8 @@
"feeds.tableHeaders.subscriptionCount": "订阅数",
"feeds.tableHeaders.tipAmount": "收到的打赏",
"general.app": "应用程序",
"general.auto_expand_long_social_media.description": "自动展开包含长文本的社交媒体条目。",
"general.auto_expand_long_social_media.label": "展开长社交媒体",
"general.auto_group.description": "自动按网站域名分组订阅源。",
"general.auto_group.label": "自动分组",
"general.cache": "缓存",
+2 -2
View File
@@ -94,8 +94,8 @@
"appearance.unread_count": "未讀數量",
"appearance.use_pointer_cursor.description": "當鼠標懸停在任何互動元素上時,將光標更改為指標。",
"appearance.use_pointer_cursor.label": "使用指標光標",
"appearance.zen_mode.description": "專注模式是一種不受打擾的閱讀模式,讓您專注於內容而不會有任何干擾。啟用專注模式後,側邊欄將被隱藏。",
"appearance.zen_mode.label": "專注模式",
"appearance.zen_mode.description": "Zen 模式是一種不受打擾的閱讀模式,讓您專注於內容而不會有任何干擾。啟用 Zen 模式後,側邊欄將被隱藏。",
"appearance.zen_mode.label": "Zen 模式",
"common.give_star": "<HeartIcon />喜歡我們的產品嗎? <Link>在 GitHub 上給我們 star 吧!</Link>",
"data_control.app_cache_limit.description": "應用程式快取的最大大小。當快取達到此大小時,最舊的項目將被刪除以釋放空間。",
"data_control.app_cache_limit.label": "應用程式快取限制",
+1 -1
View File
@@ -22,7 +22,7 @@
"keys.layout.showShortcuts": "顯示/隱藏快捷鍵",
"keys.layout.toggleSidebar": "顯示/隱藏訂閱側邊欄",
"keys.layout.toggleWideMode": "切換寬屏模式",
"keys.layout.zenMode": "專注模式",
"keys.layout.zenMode": "Zen 模式",
"keys.misc.quickSearch": "快速搜索",
"keys.type.audio": "音頻",
"keys.type.entries": "條目列表",
+19 -16
View File
@@ -1,7 +1,7 @@
{
"name": "Follow",
"type": "module",
"version": "0.2.6-beta.0",
"version": "0.2.7-beta.0",
"private": true,
"packageManager": "pnpm@9.12.3",
"description": "Follow your favorites in one inbox",
@@ -44,7 +44,7 @@
"update:main-hash": "tsx plugins/vite/generate-main-hash.ts"
},
"devDependencies": {
"@babel/generator": "7.26.2",
"@babel/generator": "7.26.3",
"@clack/prompts": "0.8.2",
"@egoist/tailwindcss-icons": "1.8.1",
"@electron-forge/cli": "7.6.0",
@@ -59,12 +59,12 @@
"@hookform/resolvers": "3.9.1",
"@iconify-json/logos": "1.2.3",
"@iconify-json/mingcute": "1.2.1",
"@iconify-json/simple-icons": "^1.2.13",
"@iconify-json/simple-icons": "^1.2.15",
"@iconify/tools": "4.0.7",
"@microflash/remark-callout-directives": "4.3.2",
"@mozilla/readability": "^0.5.0",
"@pengx17/electron-forge-maker-appimage": "1.2.1",
"@sentry/vite-plugin": "2.22.6",
"@sentry/vite-plugin": "2.22.7",
"@t3-oss/env-core": "^0.11.1",
"@tailwindcss/container-queries": "0.1.1",
"@tailwindcss/typography": "0.5.15",
@@ -73,7 +73,7 @@
"@types/node": "^22.10.1",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@vercel/node": "3.2.27",
"@vercel/node": "3.2.28",
"@vitejs/plugin-legacy": "6.0.0",
"@vitejs/plugin-react": "^4.3.4",
"async-es": "^3.2.6",
@@ -81,31 +81,31 @@
"cross-env": "7.0.3",
"cssnano": "7.0.6",
"dnum": "^2.14.0",
"dotenv": "16.4.5",
"drizzle-orm": "0.36.4",
"dotenv": "16.4.7",
"drizzle-orm": "0.37.0",
"electron": "33.2.0",
"electron-devtools-installer": "3.2.0",
"electron-packager-languages": "0.5.0",
"electron-vite": "^2.3.0",
"eslint": "^9.16.0",
"eslint-config-hyoban": "^3.1.14",
"eslint-config-hyoban": "^3.1.15",
"fake-indexeddb": "6.0.0",
"happy-dom": "15.11.7",
"hono": "4.6.12",
"hono": "4.6.13",
"html-minifier-terser": "7.2.0",
"js-yaml": "4.1.0",
"lint-staged": "15.2.10",
"nbump": "2.0.7",
"postcss": "8.4.49",
"postcss-js": "4.0.1",
"prettier": "3.4.1",
"prettier": "3.4.2",
"raw-body": "3.0.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"rimraf": "6.0.1",
"shx": "^0.3.4",
"simple-git-hooks": "2.11.1",
"tailwindcss": "3.4.15",
"tailwindcss": "3.4.16",
"tailwindcss-animate": "1.0.7",
"tailwindcss-motion": "0.4.3-beta",
"tailwindcss-safe-area": "0.6.0",
@@ -115,12 +115,12 @@
"turbo": "2.3.3",
"typescript": "5.7.2",
"unplugin-ast": "^0.12.0",
"vite": "6.0.2",
"vite": "6.0.3",
"vite-bundle-analyzer": "0.15.2",
"vite-plugin-mkcert": "1.17.6",
"vite-plugin-pwa": "0.21.1",
"vite-tsconfig-paths": "5.1.3",
"vitest": "2.1.6"
"vite-tsconfig-paths": "5.1.4",
"vitest": "2.1.8"
},
"pnpm": {
"patchedDependencies": {
@@ -132,9 +132,12 @@
"daisyui": "patches/daisyui.patch",
"jsonpointer": "patches/jsonpointer.patch",
"workbox-precaching": "patches/workbox-precaching.patch",
"@tanstack/react-virtual@3.10.9": "patches/@tanstack__react-virtual@3.10.9.patch"
"@tanstack/react-virtual": "patches/@tanstack__react-virtual.patch",
"@pengx17/electron-forge-maker-appimage": "patches/@pengx17__electron-forge-maker-appimage.patch"
},
"overrides": {
"@types/react": "npm:@types/react@^18.3.12",
"@types/react-dom": "npm:@types/react-dom@^18.3.1",
"is-core-module": "npm:@nolyfill/is-core-module@^1",
"isarray": "npm:@nolyfill/isarray@^1"
}
@@ -173,5 +176,5 @@
]
},
"productName": "Follow",
"mainHash": "a17b3455d95c59da9a9724da5c9a04332f454caf2391c53ac32fc54184965658"
"mainHash": "eff966f43f885985e456a48c734d2cabe9fe30723d6cdc45e2f8ba75cecd0c80"
}
+4 -4
View File
@@ -48,15 +48,15 @@
"@react-hook/window-size": "3.1.1",
"class-variance-authority": "0.7.1",
"dayjs": "1.11.13",
"foxact": "0.2.42",
"framer-motion": "11.12.0",
"foxact": "0.2.43",
"framer-motion": "11.13.1",
"jotai": "2.10.3",
"masonic": "4.0.1",
"react-blurhash": "^0.3.0",
"react-fast-marquee": "1.6.5",
"react-hook-form": "7.53.2",
"react-hook-form": "7.54.0",
"react-i18next": "^15.1.3",
"sonner": "1.7.0",
"sonner": "1.7.1",
"use-context-selector": "2.0.0",
"usehooks-ts": "3.1.0",
"vaul": "1.1.1"
@@ -0,0 +1,6 @@
import * as React from "react"
import { createElement } from "react"
export const PassviseFragment = ({ children }: { children: React.ReactNode }) => {
return createElement(React.Fragment, null, children)
}
@@ -0,0 +1,63 @@
import type { SVGProps } from "react"
export function MaterialSymbolsProgressActivity(props: SVGProps<SVGSVGElement>) {
return (
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" {...props}>
<path
fill="currentColor"
d="M12 22q-2.05 0-3.875-.788t-3.187-2.15q-1.363-1.362-2.15-3.187T2 12q0-2.075.788-3.887t2.15-3.175Q6.3 3.575 8.124 2.788T12 2q.425 0 .713.288T13 3q0 .425-.288.713T12 4Q8.675 4 6.337 6.338T4 12q0 3.325 2.338 5.663T12 20q3.325 0 5.663-2.337T20 12q0-.425.288-.712T21 11q.425 0 .713.288T22 12q0 2.05-.788 3.875t-2.15 3.188q-1.362 1.362-3.175 2.15T12 22"
/>
</svg>
)
}
interface CircleProgressProps {
percent: number
size?: number
strokeWidth?: number
strokeColor?: string
backgroundColor?: string
className?: string
}
export const CircleProgress: React.FC<CircleProgressProps> = ({
percent,
size = 100,
strokeWidth = 8,
strokeColor = "currentColor",
backgroundColor = "hsl(var(--background))",
className,
}) => {
const normalizedPercent = Math.min(100, Math.max(0, percent))
const radius = (size - strokeWidth) / 2
const circumference = radius * 2 * Math.PI
const offset = circumference - (normalizedPercent / 100) * circumference
return (
<svg width={size} height={size} className={className}>
<circle
cx={size / 2}
cy={size / 2}
r={radius}
strokeLinecap="round"
fill="none"
stroke={backgroundColor}
strokeWidth={strokeWidth}
/>
<circle
cx={size / 2}
cy={size / 2}
r={radius}
strokeLinecap="round"
fill="none"
stroke={strokeColor}
strokeWidth={strokeWidth}
strokeDasharray={circumference}
strokeDashoffset={offset}
className="duration-75"
transform={`rotate(-90 ${size / 2} ${size / 2})`}
style={{ transition: "stroke-dashoffset 0.3s" }}
/>
</svg>
)
}
@@ -1,3 +1,4 @@
import { replaceImgUrlIfNeed } from "@follow/utils/img-proxy"
import { cn } from "@follow/utils/utils"
import * as AvatarPrimitive from "@radix-ui/react-avatar"
import * as React from "react"
@@ -21,6 +22,7 @@ export const AvatarImage = React.forwardRef<
<AvatarPrimitive.Image
ref={ref}
className={cn("aspect-square size-full", className)}
src={replaceImgUrlIfNeed(props.src)}
{...props}
/>
))
@@ -20,7 +20,7 @@ export const DividerVertical: FC<
return (
<span
className={cn(
"mx-4 inline-block h-full w-[0.5px] select-none bg-black text-transparent !opacity-20 dark:bg-white",
"mx-3 inline-block h-full w-[0.5px] select-none bg-black text-transparent !opacity-20 dark:bg-white",
className,
)}
{...rest}
@@ -52,7 +52,7 @@ const Scrollbar = React.forwardRef<
className={cn(
"flex w-2.5 touch-none select-none p-0.5",
orientation === "horizontal" ? `h-2.5 w-full flex-col` : `w-2.5 flex-row`,
"z-[3] animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in",
"animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in",
className,
)}
>
@@ -13,7 +13,7 @@ export interface ResponsiveSelectProps {
defaultValue?: string
value?: string
onValueChange?: (value: string) => void
placeholder?: string
items: ResponsiveSelectItem[]
renderValue?: (value: string) => React.ReactNode
renderItem?: (item: ResponsiveSelectItem) => React.ReactNode
@@ -34,6 +34,7 @@ export const ResponsiveSelect = ({
size = "default",
triggerClassName,
contentClassName,
placeholder,
}: ResponsiveSelectProps) => {
const [valueInner] = useControlled(value, defaultValue ?? "", onValueChange)
@@ -67,7 +68,11 @@ export const ResponsiveSelect = ({
triggerClassName,
)}
>
<span className="flex">{renderValue?.(valueInner) ?? valueToLabelMap[valueInner]}</span>
<span className="flex">
{(renderValue?.(valueInner) ?? valueToLabelMap[valueInner]) || (
<span className="text-theme-placeholder-text">{placeholder}</span>
)}
</span>
<i className="i-mingcute-down-line ml-2 size-4 shrink-0 opacity-50" />
<select
ref={setRealSelectRef}
+8 -1
View File
@@ -13,6 +13,7 @@ export interface PresentSheetProps {
open?: boolean
onOpenChange?: (value: boolean) => void
title?: ReactNode
hideHeader?: boolean
zIndex?: number
dismissible?: boolean
defaultOpen?: boolean
@@ -35,6 +36,7 @@ export const PresentSheet = forwardRef<SheetRef, PropsWithChildren<PresentSheetP
children,
zIndex = MODAL_STACK_Z_INDEX,
title,
hideHeader,
dismissible = true,
defaultOpen,
triggerAsChild,
@@ -123,7 +125,12 @@ export const PresentSheet = forwardRef<SheetRef, PropsWithChildren<PresentSheetP
)}
{title ? (
<Drawer.Title className="-mt-4 mb-4 flex justify-center px-4 text-lg font-medium">
<Drawer.Title
className={cn(
"-mt-4 mb-4 flex justify-center px-4 text-lg font-medium",
hideHeader && "sr-only",
)}
>
{title}
</Drawer.Title>
) : (
@@ -14,6 +14,7 @@ export const Toaster = ({ ...props }: ToasterProps) => (
classNames: {
content: "min-w-0",
icon: tw`self-start translate-y-[2px]`,
actionButton: tw`font-sans font-medium`,
closeButton: tw`!border-border !bg-background transition-opacity will-change-opacity duration-200 opacity-0 group-hover:opacity-100`,
},
}}
+1 -1
View File
@@ -17,7 +17,7 @@
"@follow/shared": "workspace:*",
"@follow/types": "workspace:*",
"@follow/utils": "workspace:*",
"foxact": "0.2.42",
"foxact": "0.2.43",
"jotai": "2.10.3",
"usehooks-ts": "3.1.0"
}
+1 -1
View File
@@ -9,6 +9,6 @@
}
},
"dependencies": {
"electron-log": "5.2.3"
"electron-log": "5.2.4"
}
}

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