diff --git a/CHANGELOG.md b/CHANGELOG.md index db5569cfa..721bf8296 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)) diff --git a/apps/main/package.json b/apps/main/package.json index 2f66a1416..fafe0ea6b 100644 --- a/apps/main/package.json +++ b/apps/main/package.json @@ -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" } } diff --git a/apps/main/src/lib/readability.ts b/apps/main/src/lib/readability.ts index e16a82b9d..3dfa9e177 100644 --- a/apps/main/src/lib/readability.ts +++ b/apps/main/src/lib/readability.ts @@ -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) diff --git a/apps/main/vitest.config.ts b/apps/main/vitest.config.ts index 76797e786..d86d15bb6 100644 --- a/apps/main/vitest.config.ts +++ b/apps/main/vitest.config.ts @@ -15,6 +15,7 @@ export default defineProject({ }, plugins: [ + // @ts-expect-error tsconfigPath({ projects: ["./tsconfig.json"], }), diff --git a/apps/renderer/.env b/apps/renderer/.env new file mode 120000 index 000000000..c7360fb82 --- /dev/null +++ b/apps/renderer/.env @@ -0,0 +1 @@ +../../.env \ No newline at end of file diff --git a/apps/renderer/package.json b/apps/renderer/package.json index 6d770e0d9..b5ee2bf5a 100644 --- a/apps/renderer/package.json +++ b/apps/renderer/package.json @@ -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" } } diff --git a/apps/renderer/src/atoms/feed.ts b/apps/renderer/src/atoms/feed.ts index d5a5d9e87..0539db436 100644 --- a/apps/renderer/src/atoms/feed.ts +++ b/apps/renderer/src/atoms/feed.ts @@ -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()) +} diff --git a/apps/renderer/src/atoms/player.ts b/apps/renderer/src/atoms/player.ts index db8b56c20..bbc13c414 100644 --- a/apps/renderer/src/atoms/player.ts +++ b/apps/renderer/src/atoms/player.ts @@ -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 diff --git a/apps/renderer/src/atoms/settings/general.ts b/apps/renderer/src/atoms/settings/general.ts index 1e7552015..af799a836 100644 --- a/apps/renderer/src/atoms/settings/general.ts +++ b/apps/renderer/src/atoms/settings/general.ts @@ -26,8 +26,9 @@ const createDefaultSettings = (): GeneralSettings => ({ hoverMarkUnread: true, renderMarkUnread: false, // UX - groupByDate: true, + autoExpandLongSocialMedia: false, + // Secure jumpOutLinkWarn: true, // TTS diff --git a/apps/renderer/src/components/ui/media/SwipeMedia.tsx b/apps/renderer/src/components/ui/media/SwipeMedia.tsx index 732e0af7c..7872af727 100644 --- a/apps/renderer/src/components/ui/media/SwipeMedia.tsx +++ b/apps/renderer/src/components/ui/media/SwipeMedia.tsx @@ -54,10 +54,10 @@ export function SwipeMedia({ )} > {uniqMedia?.length ? ( -
-
+
+
{uniqMedia?.slice(0, 5).map((med, i) => ( -
+
diff --git a/apps/renderer/src/components/ui/modal/stacked/constants.ts b/apps/renderer/src/components/ui/modal/stacked/constants.ts index fe5613a5a..2d4c8ef4f 100644 --- a/apps/renderer/src/components/ui/modal/stacked/constants.ts +++ b/apps/renderer/src/components/ui/modal/stacked/constants.ts @@ -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 diff --git a/apps/renderer/src/components/ui/placeholder.tsx b/apps/renderer/src/components/ui/placeholder.tsx deleted file mode 100644 index 55a90a5ae..000000000 --- a/apps/renderer/src/components/ui/placeholder.tsx +++ /dev/null @@ -1,4 +0,0 @@ -export const ReactVirtuosoItemPlaceholder = () => ( - // NOTE: prevent 0 height element, react virtuoso will not stop render any more -
-) diff --git a/apps/renderer/src/components/ux/transition/icon.tsx b/apps/renderer/src/components/ux/transition/icon.tsx index 7a20bbd4e..f9045c8ec 100644 --- a/apps/renderer/src/components/ux/transition/icon.tsx +++ b/apps/renderer/src/components/ux/transition/icon.tsx @@ -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 ( {status === "init" ? ( - - ) : ( + typeof icon1 === "string" ? ( + + ) : ( + cloneElement(icon1, { + className: cn(icon1ClassName, className), + key: "1", + initial, + animate, + exit, + }) + ) + ) : typeof icon2 === "string" ? ( + ) : ( + cloneElement(icon2, { + className: cn(icon2ClassName, className), + key: "2", + initial, + animate, + exit, + }) )} ) diff --git a/apps/renderer/src/hooks/biz/useFeedActions.tsx b/apps/renderer/src/hooks/biz/useFeedActions.tsx index a433689df..f19e0a914 100644 --- a/apps/renderer/src/hooks/biz/useFeedActions.tsx +++ b/apps/renderer/src/hooks/biz/useFeedActions.tsx @@ -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: , + click() { + present({ + title: t("sidebar.feed_column.context_menu.title"), + content: () => ( + { + addFeedsToCategoryMutation({ + feedIdList: isMultipleSelection ? feedIds : [feedId], + category, + view: view!, + }) + }} + /> + ), + }) + }, + }, + ], + }, { type: "separator" as const, disabled: isEntryList, diff --git a/apps/renderer/src/hooks/biz/useNavigateEntry.ts b/apps/renderer/src/hooks/biz/useNavigateEntry.ts index 584aada0a..dc1697ba0 100644 --- a/apps/renderer/src/hooks/biz/useNavigateEntry.ts +++ b/apps/renderer/src/hooks/biz/useNavigateEntry.ts @@ -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) } diff --git a/apps/renderer/src/modules/action/action-card.tsx b/apps/renderer/src/modules/action/action-card.tsx new file mode 100644 index 000000000..f7df679d7 --- /dev/null +++ b/apps/renderer/src/modules/action/action-card.tsx @@ -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 ( + + + + { + actionActions.removeByIndex(index) + }} + > + + {t("words.delete")} + + {t("words.delete")} + + + + + + + + + ) +} + +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 ( +
+

{t("actions.action_card.name")}

+ { + onChange((data) => { + data.name = e.target.value + }) + }} + /> +
+ + { + onChange((data) => { + data.result.disabled = !checked + }) + }} + /> +
+ ) +} diff --git a/apps/renderer/src/modules/action/action-setting.tsx b/apps/renderer/src/modules/action/action-setting.tsx new file mode 100644 index 000000000..52601c2fb --- /dev/null +++ b/apps/renderer/src/modules/action/action-setting.tsx @@ -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 } size="large" /> + } + + return ( +
+ {Array.from({ length: actionLength }).map((_action, actionIdx) => ( + + ))} + +
+ ) +} + +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 ( +
+ + +
+ ) +} diff --git a/apps/renderer/src/modules/action/feed-filter.tsx b/apps/renderer/src/modules/action/feed-filter.tsx new file mode 100644 index 000000000..118465715 --- /dev/null +++ b/apps/renderer/src/modules/action/feed-filter.tsx @@ -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 ( +
+

{t("actions.action_card.when_feeds_match")}

+
+ 0 ? "filter" : "all"} + onValueChange={(value) => { + onChange((data) => { + if (value === "all") { + data.condition = [] + } else { + data.condition = [[{}]] + } + }) + }} + > + + + +
+ + {condition.length > 0 && ( +
+ + + + {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 ( + + {conditionIdx === 0 && orConditionIdx !== 0 && ( + + + + )} + + + {t("actions.action_card.field")} + change("field", value as ActionFeedField)} + items={FeedOptions} + triggerClassName="max-sm:w-fit" + /> + + change("operator", value)} + /> + + {t("actions.action_card.value")} + {type === "view" ? ( + + ) : ( + change("value", e.target.value)} + /> + )} + + + { + 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) + } + }) + }} + /> + + {conditionIdx !== orConditions.length - 1 && ( + + + + )} + + ) + }) + })} + +
+ { + onChange((data) => { + data.condition.push([{}]) + }) + }} + /> +
+ )} +
+ ) +} + +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 ( + + {t("actions.action_card.operator")} + onValueChange?.(value as ActionOperation)} + items={options} + triggerClassName="h-8 max-sm:w-fit" + /> + + ) +} + +const CommonSelectTrigger = ({ className }: { className?: string }) => ( + + + +) + +const ActionTableCell = ({ + disabled, + onAnd, + onDelete, +}: { + disabled?: boolean + onAnd?: () => void + onDelete?: () => void +}) => { + const { t } = useTranslation("settings") + return ( + <> + + + + + + + + + ) +} + +const OrTableRow = ({ onClick, disabled }: { onClick?: () => void; disabled?: boolean }) => { + const { t } = useTranslation("settings") + return ( + + ) +} + +const FieldTableHeader = () => { + const { t } = useTranslation("settings") + return ( + + + {t("actions.action_card.field")} + {t("actions.action_card.operator")} + {t("actions.action_card.value")} + + + + ) +} diff --git a/apps/renderer/src/modules/action/target-action-list.tsx b/apps/renderer/src/modules/action/target-action-list.tsx new file mode 100644 index 000000000..04fccffc5 --- /dev/null +++ b/apps/renderer/src/modules/action/target-action-list.tsx @@ -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 ( + + ) +} + +const DeleteTableCell = ({ disabled, onClick }: { disabled?: boolean; onClick?: () => void }) => ( + + + + + +) + +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: () => ( + { + 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: () => ( + <> + + + + {t("actions.action_card.from")} + {t("actions.action_card.to")} + + + + + {rewriteRules?.map((rule, rewriteIdx) => { + const change = (key: string, value: string) => { + onChange((data) => { + data.result.rewriteRules![rewriteIdx][key] = value + }) + } + return ( + + + change("from", e.target.value)} + /> + + + change("to", e.target.value)} + /> + + { + onChange((data) => { + if (data.result.rewriteRules?.length === 1) { + delete data.result.rewriteRules + } else { + data.result.rewriteRules?.splice(rewriteIdx, 1) + } + }) + }} + /> + + ) + })} + +
+ { + 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 ( +
+ { + onChange((data) => { + data.result.webhooks![rewriteIdx] = e.target.value + }) + }} + /> + { + onChange((data) => { + if (data.result.webhooks?.length === 1) { + delete data.result.webhooks + } else { + data.result.webhooks?.splice(rewriteIdx, 1) + } + }) + }} + /> +
+ ) + })} + { + 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 ( +
+

{t("actions.action_card.then_do")}

+
+ + + + + + + + {notEnabledActions.map((action) => { + return ( + { + onChange((data) => { + action.onInit(data) + }) + }} + > + {action.title} + + ) + })} + + + +
+ {enabledActions + .filter((action) => action.enabled) + .map((action, index) => { + return ( + +
+ {action.title} + {action.configInline && action.config && action.config()} + + +
+ {!action.configInline && action.config && action.config()} + {index !== enabledActions.length - 1 && } +
+ ) + })} +
+
+
+ ) +} diff --git a/apps/renderer/src/modules/app-layout/feed-column/float-bar.mobile.tsx b/apps/renderer/src/modules/app-layout/feed-column/float-bar.mobile.tsx index 36981e929..228f0a17c 100644 --- a/apps/renderer/src/modules/app-layout/feed-column/float-bar.mobile.tsx +++ b/apps/renderer/src/modules/app-layout/feed-column/float-bar.mobile.tsx @@ -75,13 +75,13 @@ export const MobileFloatBar = ({ return (
{ {isAuthFail && !user && ( - - - + hideHeader + content={} + /> )} diff --git a/apps/renderer/src/modules/app-layout/feed-column/mobile.tsx b/apps/renderer/src/modules/app-layout/feed-column/mobile.tsx index 55dae6f78..dd067f482 100644 --- a/apps/renderer/src/modules/app-layout/feed-column/mobile.tsx +++ b/apps/renderer/src/modules/app-layout/feed-column/mobile.tsx @@ -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 (
@@ -50,7 +49,7 @@ export function FeedColumnMobile({ asWidget }: { asWidget?: boolean }) {
-
+
{views.map((item, index) => (
@@ -63,10 +62,8 @@ export function FeedColumnMobile({ asWidget }: { asWidget?: boolean }) { ))}
- -
diff --git a/apps/renderer/src/modules/auth/LoginModalContent.tsx b/apps/renderer/src/modules/auth/LoginModalContent.tsx index 541ddc9df..b811af0ea 100644 --- a/apps/renderer/src/modules/auth/LoginModalContent.tsx +++ b/apps/renderer/src/modules/auth/LoginModalContent.tsx @@ -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: '', + }, + github: { + id: "github", + name: "GitHub", + color: "#000000", + icon: '', + }, +} +const overrideProviderIconMap = { + apple: , +} 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 = ( + <> +
+ +
+
+ + {t("signin.sign_in_to")} {APP_NAME} + +
+ +
+ {filteredDefaultProviders.map((provider) => ( + { + loginHandler(provider.id, runtime) + setLoadingLockSet(provider.id) + window.analytics?.capture("login", { + type: provider.id, + }) + }} + > + + {" "} + {t("signin.continue_with", { provider: provider.name })} + + + ))} + + +
+ + ) + if (isMobile) { + return Inner + } + return (
-
- {t("signin.sign_in_to")} - - - {APP_NAME} - -
-
- {Object.entries(authProviders || []).map(([key, provider]) => ( - { - loginHandler(key, runtime) - setLoadingLockSet(key) - window.analytics?.capture("login", { - type: key, - }) - }} - > - - {" "} - {t("signin.continue_with", { provider: provider.name })} - - - ))} +
+ {Inner}
@@ -133,3 +186,50 @@ const LoginButtonContent = (props: { children: React.ReactNode; isLoading: boole ) } + +export const AuthProvidersRender: FC<{ + providers: AuthProvider[] + runtime?: LoginRuntime +}> = ({ providers, runtime }) => { + const [authProcessingLockSet, setAuthProcessingLockSet] = useState(() => new Set()) + return ( + + {providers.length > 0 && ( +
    + {providers.map((provider) => ( +
  • + { + if (authProcessingLockSet.has(provider.id)) return + loginHandler(provider.id, runtime) + + setAuthProcessingLockSet((prev) => { + prev.add(provider.id) + return new Set(prev) + }) + }} + > +
    + {!authProcessingLockSet.has(provider.id) ? ( + overrideProviderIconMap[provider.id] || ( + + ) + ) : ( +
    + +
    + )} +
    +
    +
  • + ))} +
+ )} +
+ ) +} diff --git a/apps/renderer/src/modules/discover/form.tsx b/apps/renderer/src/modules/discover/form.tsx index efa681ef0..242813efd 100644 --- a/apps/renderer/src/modules/discover/form.tsx +++ b/apps/renderer/src/modules/discover/form.tsx @@ -123,7 +123,7 @@ export function DiscoverForm({ type = "search" }: { type?: string }) { (event: ChangeEvent) => { 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)) diff --git a/apps/renderer/src/modules/entry-column/Items/picture-item.tsx b/apps/renderer/src/modules/entry-column/Items/picture-item.tsx index 1388e0fca..57d84546a 100644 --- a/apps/renderer/src/modules/entry-column/Items/picture-item.tsx +++ b/apps/renderer/src/modules/entry-column/Items/picture-item.tsx @@ -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(() => , [entryId]) const previewMedia = usePreviewMedia(entryContent) - if (!entry) return + if (!entry) return null return (
diff --git a/apps/renderer/src/modules/entry-column/Items/social-media-item.tsx b/apps/renderer/src/modules/entry-column/Items/social-media-item.tsx index 23a0c774f..35665fc7b 100644 --- a/apps/renderer/src/modules/entry-column/Items/social-media-item.tsx +++ b/apps/renderer/src/modules/entry-column/Items/social-media-item.tsx @@ -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 + 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 (
- + - + {!!entry.collections && }
@@ -363,9 +368,11 @@ const collapsedItemCache = new LRUCache(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(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" > - Show more + {t("words.show_more")}
)} diff --git a/apps/renderer/src/modules/entry-column/Items/video-item.tsx b/apps/renderer/src/modules/entry-column/Items/video-item.tsx index 719205a78..d645530f2 100644 --- a/apps/renderer/src/modules/entry-column/Items/video-item.tsx +++ b/apps/renderer/src/modules/entry-column/Items/video-item.tsx @@ -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 + if (!entry) return null return (
{ + onClick={(e) => { + if (isMobile() && entry.entries.url) { + window.open(entry.entries.url, "_blank") + e.stopPropagation() + return + } if (iframeSrc) { modalStack.present({ title: "", diff --git a/apps/renderer/src/modules/entry-column/grid.tsx b/apps/renderer/src/modules/entry-column/grid.tsx index cf1f4a919..6c17864b1 100644 --- a/apps/renderer/src/modules/entry-column/grid.tsx +++ b/apps/renderer/src/modules/entry-column/grid.tsx @@ -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 = (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 = (props) => { return entriesIds }, [entriesIds, filterNoImage]) const { t } = useTranslation() - if (nextData.length === 0 && entriesIds.length > 0) { + if (nextEntriesIds.length === 0 && entriesIds.length > 0) { return (
@@ -53,7 +61,7 @@ export const EntryColumnGrid: FC = (props) => { ) } - const hasFilteredContent = nextData.length < entriesIds.length + const hasFilteredContent = nextEntriesIds.length < entriesIds.length const FilteredContentTip = hasFilteredContent && !hasNextPage && (
@@ -77,7 +85,7 @@ export const EntryColumnGrid: FC = (props) => { key={feedId} hasNextPage={hasNextPage} endReached={fetchNextPage} - data={entriesIds} + data={nextEntriesIds} /> {FilteredContentTip} @@ -86,7 +94,7 @@ export const EntryColumnGrid: FC = (props) => { } return ( <> - + {FilteredContentTip} ) @@ -101,16 +109,57 @@ const ratioMap = { // 16:9 [FeedViewType.Videos]: 16 / 9, } -const VirtualGrid: FC = (props) => { - const { entriesIds, feedId, onRangeChange, fetchNextPage, view, Footer, hasNextPage, listRef } = - props - const scrollRef = useScrollViewElement() +const VirtualGrid: FC = (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 +} + +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 = (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 = (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 = (props) => { return (
{rowVirtualizer.getVirtualItems().map((virtualRow) => { diff --git a/apps/renderer/src/modules/entry-column/item.tsx b/apps/renderer/src/modules/entry-column/item.tsx index 9fd7a405f..08283ff2c 100644 --- a/apps/renderer/src/modules/entry-column/item.tsx +++ b/apps/renderer/src/modules/entry-column/item.tsx @@ -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 = memo(({ entryId, view }) => { const entry = useEntry(entryId) - if (!entry) return + if (!entry) return null return }) diff --git a/apps/renderer/src/modules/entry-column/layouts/EntryItemWrapper.tsx b/apps/renderer/src/modules/entry-column/layouts/EntryItemWrapper.tsx index 01a44b960..306c8feb2 100644 --- a/apps/renderer/src/modules/entry-column/layouts/EntryItemWrapper.tsx +++ b/apps/renderer/src/modules/entry-column/layouts/EntryItemWrapper.tsx @@ -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") diff --git a/apps/renderer/src/modules/entry-column/templates/grid-item-template.tsx b/apps/renderer/src/modules/entry-column/templates/grid-item-template.tsx index ebe373530..4e32720bc 100644 --- a/apps/renderer/src/modules/entry-column/templates/grid-item-template.tsx +++ b/apps/renderer/src/modules/entry-column/templates/grid-item-template.tsx @@ -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 + if (!entry) return null return (
{children} diff --git a/apps/renderer/src/modules/entry-column/templates/list-item-template.tsx b/apps/renderer/src/modules/entry-column/templates/list-item-template.tsx index 99aec78dd..e97d1b085 100644 --- a/apps/renderer/src/modules/entry-column/templates/list-item-template.tsx +++ b/apps/renderer/src/modules/entry-column/templates/list-item-template.tsx @@ -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 + if (!entry || !(feed || inbox)) return null const displayTime = inInCollection ? entry.collections?.createdAt : entry.entries.publishedAt diff --git a/apps/renderer/src/modules/entry-column/wrapper.desktop.tsx b/apps/renderer/src/modules/entry-column/wrapper.desktop.tsx index 8aaba803e..c906f4646 100644 --- a/apps/renderer/src/modules/entry-column/wrapper.desktop.tsx +++ b/apps/renderer/src/modules/entry-column/wrapper.desktop.tsx @@ -15,7 +15,7 @@ export const EntryColumnWrapper = forwardRef { - 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< diff --git a/apps/renderer/src/modules/entry-content/index.desktop.tsx b/apps/renderer/src/modules/entry-content/index.desktop.tsx index 27a2a27ef..be5c275c5 100644 --- a/apps/renderer/src/modules/entry-content/index.desktop.tsx +++ b/apps/renderer/src/modules/entry-content/index.desktop.tsx @@ -173,7 +173,7 @@ export const EntryContent: Component = ({
@@ -215,7 +215,7 @@ export const EntryContent: Component = ({ )} {entry.settings?.sourceContent && } - {!content && ( + {!content && !isInReadabilityMode && (
{isPending ? ( = ({ 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) diff --git a/apps/renderer/src/modules/entry-content/index.shared.tsx b/apps/renderer/src/modules/entry-content/index.shared.tsx index 4bdc50f29..d8550f748 100644 --- a/apps/renderer/src/modules/entry-content/index.shared.tsx +++ b/apps/renderer/src/modules/entry-content/index.shared.tsx @@ -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 }) => { {t("entry_content.render_error")} {nextError.message} - { + window.open( + getNewIssueUrl({ + body: [ + "### Error", + "", + nextError.message, + "", + "### Stack", + "", + "```", + nextError.stack, + "```", + ].join("\n"), + label: "bug", + title: "Render error", + }), + ) + }} > {t("entry_content.report_issue")} - +
) } +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", )} /> + +
) }) +const BackTopIndicator: Component = memo(({ className }) => { + const [readPercent] = useReadPercent() + const scrollElement = useScrollViewElement() + return ( + +
+ } + icon2={} + status={readPercent === 0 ? "init" : "done"} + /> + {readPercent}%
+
+ { + 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", + )} + > + + Back Top + +
+ ) +}) + export function AISummary({ entryId }: { entryId: string }) { const { t } = useTranslation() const entry = useEntry(entryId) diff --git a/apps/renderer/src/modules/feed-column/category.tsx b/apps/renderer/src/modules/feed-column/category.tsx index a0de62ca6..c767fb1f2 100644 --- a/apps/renderer/src/modules/feed-column/category.tsx +++ b/apps/renderer/src/modules/feed-column/category.tsx @@ -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 } } -} +}) const SortByAlphabeticalList = (props: SortListProps) => { const { ids, showCollapse, view } = props diff --git a/apps/renderer/src/modules/feed-column/item.tsx b/apps/renderer/src/modules/feed-column/item.tsx index 38df38d63..deb8a28b1 100644 --- a/apps/renderer/src/modules/feed-column/item.tsx +++ b/apps/renderer/src/modules/feed-column/item.tsx @@ -40,6 +40,26 @@ interface FeedItemProps { view?: number className?: string } + +const DraggableItemWrapper: Component< + { + className?: string + isInMultipleSelection: boolean + } & React.HTMLAttributes +> = ({ children, isInMultipleSelection, ...props }) => { + const draggableContext = useContext(DraggableContext) + + return ( +
+ {children} +
+ ) +} 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 ( - <> + { + window.open(UrlBuilder.shareFeed(feedId, view), "_blank") + }} + {...contextMenuProps} + >
{ - window.open(UrlBuilder.shareFeed(feedId, view), "_blank") - }} - {...contextMenuProps} > -
- - - {isFeed && feed.errorAt && ( - - - - - - + + + {isFeed && feed.errorAt && ( + + + + + + +
+ + {t("feed_item.error_since")}{" "} + {dayjs + .duration(dayjs(feed.errorAt).diff(dayjs(), "minute"), "minute") + .humanize(true)} +
+ {!!feed.errorMessage && (
- - {t("feed_item.error_since")}{" "} - {dayjs - .duration(dayjs(feed.errorAt).diff(dayjs(), "minute"), "minute") - .humanize(true)} + + {feed.errorMessage}
- {!!feed.errorMessage && ( -
- - {feed.errorMessage} -
- )} -
-
-
- )} - {subscription.isPrivate && ( - - - - - - {t("feed_item.not_publicly_visible")} - - - )} -
- + )} + + + + )} + {subscription.isPrivate && ( + + + + + + {t("feed_item.not_publicly_visible")} + + + )}
- + +
) } @@ -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<{
{ window.open(UrlBuilder.shareList(listId, view), "_blank") diff --git a/apps/renderer/src/modules/settings/action-card.tsx b/apps/renderer/src/modules/settings/action-card.tsx deleted file mode 100644 index 8cf6ee29c..000000000 --- a/apps/renderer/src/modules/settings/action-card.tsx +++ /dev/null @@ -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 ( - - - {t("actions.action_card.field")} - {t("actions.action_card.operator")} - {t("actions.action_card.value")} - - - - ) -} - -const DeleteTableCell = ({ disabled, onClick }: { disabled?: boolean; onClick?: () => void }) => ( - - - -) - -const ActionTableCell = ({ - disabled, - onAnd, - onDelete, -}: { - disabled?: boolean - onAnd?: () => void - onDelete?: () => void -}) => { - const { t } = useTranslation("settings") - return ( - <> - - - - - - - - - ) -} - -const OrTableRow = ({ onClick, disabled }: { onClick?: () => void; disabled?: boolean }) => { - const { t } = useTranslation("settings") - return ( - - ) -} - -const AddTableRow = ({ onClick, disabled }: { onClick?: () => void; disabled?: boolean }) => { - const { t } = useTranslation("settings") - return ( - - ) -} - -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 ( - - {t("actions.action_card.operator")} - onValueChange?.(value as ActionOperation)} - items={options} - triggerClassName="h-8 max-sm:w-fit" - /> - - ) -} - -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 ( - -
{children}
-
- ) - } - - return ( - -
{children}
-
- ) -} - -const CommonSelectTrigger = ({ className }: { className?: string }) => ( - - - -) - -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 ( - - - - -

{t("actions.action_card.name")}

- { - data.name = e.target.value - onChange(data) - }} - /> - -
{data.name}
- { - data.result.disabled = !checked - onChange(data) - }} - onClick={stopPropagation} - /> -
- } - > -
-
-

- {t("actions.action_card.when_feeds_match")} -

-
- 0 ? "filter" : "all"} - onValueChange={(value) => { - if (value === "all") { - data.condition = [] - } else { - data.condition = [[{}]] - } - onChange(data) - }} - > - - - -
- - {data.condition.length > 0 && ( -
- - - - {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 ( - - {conditionIdx === 0 && orConditionIdx !== 0 && ( - - - - )} - - - - {t("actions.action_card.field")} - - - change("field", value as ActionFeedField) - } - items={FeedOptions} - triggerClassName="max-sm:w-fit" - /> - - change("operator", value)} - /> - - - {t("actions.action_card.value")} - - {type === "view" ? ( - - ) : ( - change("value", e.target.value)} - /> - )} - - { - 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) - }} - /> - - {conditionIdx !== orConditions.length - 1 && ( - - - - )} - - ) - }) - })} - -
- { - data.condition.push([{}]) - onChange(data) - }} - /> -
- )} -
-
-

{t("actions.action_card.then_do")}

-
-
- - {t("actions.action_card.generate_summary")} - - { - data.result.summary = checked - onChange(data) - }} - /> -
- - -
- - {t("actions.action_card.translate_into")} - - { - if (value === "none") { - delete data.result.translation - } else { - data.result.translation = value - } - onChange(data) - }} - items={TransitionOptions} - triggerClassName="max-w-44" - /> -
- - -
- - {t("actions.action_card.enable_readability")} - - { - data.result.readability = checked - onChange(data) - }} - /> -
- - -
- - {t("actions.action_card.source_content")} - - { - data.result.sourceContent = checked - onChange(data) - }} - /> -
- - -
- - {t("actions.action_card.new_entry_notification")} - - { - data.result.newEntryNotification = checked - onChange(data) - }} - /> -
- - -
- - {t("actions.action_card.silence")} - - { - data.result.silence = checked - onChange(data) - }} - /> -
- - -
- {t("actions.action_card.block")} - { - data.result.block = checked - onChange(data) - }} - /> -
- - - { - 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 && ( - - - - - {t("actions.action_card.from")} - {t("actions.action_card.to")} - - - - {data.result.rewriteRules.map((rule, rewriteIdx) => { - const change = (key: string, value: string) => { - data.result.rewriteRules![rewriteIdx][key] = value - onChange(data) - } - return ( - - { - if (data.result.rewriteRules?.length === 1) { - delete data.result.rewriteRules - } else { - data.result.rewriteRules?.splice(rewriteIdx, 1) - } - onChange(data) - }} - /> - - change("from", e.target.value)} - /> - - - change("to", e.target.value)} - /> - - - ) - })} - -
- )} - { - if (!data.result.rewriteRules) { - data.result.rewriteRules = [] - } - data.result.rewriteRules!.push({ - from: "", - to: "", - }) - onChange(data) - }} - /> -
- - { - 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 ( -
- { - if (data.result.webhooks?.length === 1) { - delete data.result.webhooks - } else { - data.result.webhooks?.splice(rewriteIdx, 1) - } - onChange(data) - }} - /> - { - data.result.webhooks![rewriteIdx] = e.target.value - onChange(data) - }} - /> -
- ) - })} - - )} - { - if (!data.result.webhooks) { - data.result.webhooks = [] - } - data.result.webhooks!.push("") - onChange(data) - }} - /> -
-
-
-
- - - - ) -} diff --git a/apps/renderer/src/modules/settings/tabs/actions/index.tsx b/apps/renderer/src/modules/settings/tabs/actions/index.tsx deleted file mode 100644 index 8315cc957..000000000 --- a/apps/renderer/src/modules/settings/tabs/actions/index.tsx +++ /dev/null @@ -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([]) - - 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 ( -
- } - size="large" - className="lg:-translate-y-full" - /> -
- ) - } - - return ( -
- {actionsData.map((action, actionIdx) => ( - { - if (!newAction) { - setActionsData(actionsData.filter((_, idx) => idx !== actionIdx)) - } else { - setActionsData(actionsData.map((a, idx) => (idx === actionIdx ? newAction : a))) - } - }} - /> - ))} - -
- -
-
- ) -} diff --git a/apps/renderer/src/modules/settings/tabs/general.tsx b/apps/renderer/src/modules/settings/tabs/general.tsx index 7eff98c86..5c75ab4da 100644 --- a/apps/renderer/src/modules/settings/tabs/general.tsx +++ b/apps/renderer/src/modules/settings/tabs/general.tsx @@ -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"), diff --git a/apps/renderer/src/modules/settings/tabs/lists/modals.tsx b/apps/renderer/src/modules/settings/tabs/lists/modals.tsx index 4af1d1df6..fa54f6ab1 100644 --- a/apps/renderer/src/modules/settings/tabs/lists/modals.tsx +++ b/apps/renderer/src/modules/settings/tabs/lists/modals.tsx @@ -319,3 +319,56 @@ const RowRender = ({ feedId, listId }: { feedId: string; listId: string }) => { ) } +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>({ + resolver: zodResolver(categoryFormSchema), + defaultValues: { + categoryName: "", + }, + }) + + const handleSubmit = form.handleSubmit(({ categoryName }) => { + onSubmit(categoryName) + dismiss() + }) + + return ( +
+ + ( + +
+ + {t("sidebar.feed_column.context_menu.new_category_modal.category_name")} + * + +
+ + + + +
+ )} + /> +
+ +
+ + + ) +} diff --git a/apps/renderer/src/modules/user/ProfileButton.desktop.tsx b/apps/renderer/src/modules/user/ProfileButton.desktop.tsx index 8096602d3..c20aed7e1 100644 --- a/apps/renderer/src/modules/user/ProfileButton.desktop.tsx +++ b/apps/renderer/src/modules/user/ProfileButton.desktop.tsx @@ -143,7 +143,7 @@ export const ProfileButton: FC = memo((props) => { - {/* NOTE: The shortcut needs to be grouped, but there is only one currently, so no separator line has been added. */} + {!zenModeSetting && ( = memo((props) => { {t("user_button.zen_mode")} )} + { + navigate("/action") + }} + icon={} + > + {t("words.actions")} + + + { diff --git a/apps/renderer/src/modules/user/ProfileButton.mobile.tsx b/apps/renderer/src/modules/user/ProfileButton.mobile.tsx index e68708757..db223fc5c 100644 --- a/apps/renderer/src/modules/user/ProfileButton.mobile.tsx +++ b/apps/renderer/src/modules/user/ProfileButton.mobile.tsx @@ -96,6 +96,11 @@ export const ProfileButton: FC = () => { + } + /> { @@ -117,26 +122,39 @@ export const ProfileButton: FC = () => { ) } -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 ( - ) } diff --git a/apps/renderer/src/modules/user/utils.ts b/apps/renderer/src/modules/user/utils.ts index 89c74173d..21088e30b 100644 --- a/apps/renderer/src/modules/user/utils.ts +++ b/apps/renderer/src/modules/user/utils.ts @@ -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 diff --git a/apps/renderer/src/pages/(main)/(layer)/(subview)/action/index.tsx b/apps/renderer/src/pages/(main)/(layer)/(subview)/action/index.tsx new file mode 100644 index 000000000..49d1c22ad --- /dev/null +++ b/apps/renderer/src/pages/(main)/(layer)/(subview)/action/index.tsx @@ -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 ( +
+
{t("words.actions")}
+ +
+ ) +} diff --git a/apps/renderer/src/pages/settings/(settings)/actions.tsx b/apps/renderer/src/pages/settings/(settings)/actions.tsx deleted file mode 100644 index 14c732e0e..000000000 --- a/apps/renderer/src/pages/settings/(settings)/actions.tsx +++ /dev/null @@ -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 ( - <> - - - - ) -} diff --git a/apps/renderer/src/providers/setting-sync.tsx b/apps/renderer/src/providers/setting-sync.tsx index 7ce6b6375..86bcd54a6 100644 --- a/apps/renderer/src/providers/setting-sync.tsx +++ b/apps/renderer/src/providers/setting-sync.tsx @@ -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(() => { diff --git a/apps/renderer/src/queries/actions.ts b/apps/renderer/src/queries/actions.ts index f5995a6c8..de8604f99 100644 --- a/apps/renderer/src/queries/actions.ts +++ b/apps/renderer/src/queries/actions.ts @@ -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, + }) diff --git a/apps/renderer/src/queries/entries.ts b/apps/renderer/src/queries/entries.ts index 2550bb9a5..1c06c9bc5 100644 --- a/apps/renderer/src/queries/entries.ts +++ b/apps/renderer/src/queries/entries.ts @@ -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, }, ) } diff --git a/apps/renderer/src/queries/users.ts b/apps/renderer/src/queries/users.ts index fd1408349..243a8e96e 100644 --- a/apps/renderer/src/queries/users.ts +++ b/apps/renderer/src/queries/users.ts @@ -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, }) } diff --git a/apps/renderer/src/store/action/hooks.ts b/apps/renderer/src/store/action/hooks.ts new file mode 100644 index 000000000..927d3ddc8 --- /dev/null +++ b/apps/renderer/src/store/action/hooks.ts @@ -0,0 +1,21 @@ +import type { ActionModel } from "@follow/models/types" + +import { useActionStore } from "./store" + +export function useActions(): ActionModel[] +export function useActions(selector: (actions: ActionModel[]) => T): T +export function useActions(selector?: (actions: ActionModel[]) => T) { + return useActionStore((state) => (selector ? selector(state.actions) : state.actions)) +} + +export function useActionByIndex(index: number): ActionModel +export function useActionByIndex(index: number, selector: (action: ActionModel) => T): T +export function useActionByIndex(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) +} diff --git a/apps/renderer/src/store/action/index.ts b/apps/renderer/src/store/action/index.ts new file mode 100644 index 000000000..a92fe14dc --- /dev/null +++ b/apps/renderer/src/store/action/index.ts @@ -0,0 +1,3 @@ +export * from "./hooks" +export * from "./store" +export * from "./types" diff --git a/apps/renderer/src/store/action/store.ts b/apps/renderer/src/store/action/store.ts new file mode 100644 index 000000000..26a05ef8f --- /dev/null +++ b/apps/renderer/src/store/action/store.ts @@ -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("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() diff --git a/apps/renderer/src/store/action/types.ts b/apps/renderer/src/store/action/types.ts new file mode 100644 index 000000000..eb3d0d530 --- /dev/null +++ b/apps/renderer/src/store/action/types.ts @@ -0,0 +1,6 @@ +import type { ActionModel } from "@follow/models/types" + +export interface ActionState { + actions: ActionModel[] + isDirty: boolean +} diff --git a/apps/renderer/src/store/entry/store.ts b/apps/renderer/src/store/entry/store.ts index d5eabd377..7a710b3e2 100644 --- a/apps/renderer/src/store/entry/store.ts +++ b/apps/renderer/src/store/entry/store.ts @@ -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 } diff --git a/apps/renderer/src/store/subscription/hooks.ts b/apps/renderer/src/store/subscription/hooks.ts index 1c718d1df..9d37fc101 100644 --- a/apps/renderer/src/store/subscription/hooks.ts +++ b/apps/renderer/src/store/subscription/hooks.ts @@ -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( diff --git a/apps/renderer/src/store/subscription/selector.ts b/apps/renderer/src/store/subscription/selector.ts index 6a19f6482..c04565d88 100644 --- a/apps/renderer/src/store/subscription/selector.ts +++ b/apps/renderer/src/store/subscription/selector.ts @@ -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 }) => diff --git a/apps/renderer/src/styles/additional.css b/apps/renderer/src/styles/additional.css index d3a06e602..298813053 100644 --- a/apps/renderer/src/styles/additional.css +++ b/apps/renderer/src/styles/additional.css @@ -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); + } +} diff --git a/apps/renderer/src/styles/base.css b/apps/renderer/src/styles/base.css index 7dba22e81..28e2b2f47 100644 --- a/apps/renderer/src/styles/base.css +++ b/apps/renderer/src/styles/base.css @@ -53,5 +53,5 @@ button { } #react-scan-toolbar { - @apply !hidden lg:!block; + @apply max-lg:!hidden; } diff --git a/apps/renderer/vitest.config.ts b/apps/renderer/vitest.config.ts index 07e54b4ac..09762f00d 100644 --- a/apps/renderer/vitest.config.ts +++ b/apps/renderer/vitest.config.ts @@ -31,7 +31,9 @@ export default defineProject({ }, plugins: [ + // @ts-expect-error astPlugin, + // @ts-expect-error tsconfigPath({ projects: ["./tsconfig.json"], }), diff --git a/apps/server/client/components/items/grid.tsx b/apps/server/client/components/items/grid.tsx index 468f497eb..4d94488de 100644 --- a/apps/server/client/components/items/grid.tsx +++ b/apps/server/client/components/items/grid.tsx @@ -11,7 +11,7 @@ import { LazyImage } from "../ui/image" export const GridList: FC<{ entries: EntriesPreview - feed: Feed + feed?: Feed }> = ({ entries, feed }) => { return ( @@ -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<{ - {feed.feed.title} + {feed?.feed.title || entryPreview.feeds?.title} · {dayjs diff --git a/apps/server/client/components/items/index.tsx b/apps/server/client/components/items/index.tsx new file mode 100644 index 000000000..432e5b28a --- /dev/null +++ b/apps/server/client/components/items/index.tsx @@ -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 + } + case viewsRenderType.Picture.includes(view): { + return + } + case viewsRenderType.Grid.includes(view): { + return + } + } + }, [entries, feed, view]) + + return
{renderContent}
+} + +const NormalList: FC<{ + entries: EntriesPreview + + feed?: Feed +}> = ({ entries, feed }) => { + return ( + <> + {entries?.map((entry) => ( + +
+ +
+
+ ))} + + ) +} diff --git a/apps/server/client/components/items/picture.tsx b/apps/server/client/components/items/picture.tsx index a5665ca78..10e0680ef 100644 --- a/apps/server/client/components/items/picture.tsx +++ b/apps/server/client/components/items/picture.tsx @@ -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>({}) 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 = ({
- + - {getPreferredTitle(feed.feed)} + {getPreferredTitle(feed?.feed || entry.feeds)} · diff --git a/apps/server/client/components/ui/feed-certification.tsx b/apps/server/client/components/ui/feed-certification.tsx index 4cdae3067..04ccf8801 100644 --- a/apps/server/client/components/ui/feed-certification.tsx +++ b/apps/server/client/components/ui/feed-certification.tsx @@ -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 = ({ {t("feed_item.claimed_by_owner")} {feed.owner ? ( - + {feed.owner.name?.slice(0, 2)} ) : ( diff --git a/apps/server/client/pages/(main)/share/feeds/[id]/index.tsx b/apps/server/client/pages/(main)/share/feeds/[id]/index.tsx index cbbe078e8..f5936cd1d 100644 --- a/apps/server/client/pages/(main)/share/feeds/[id]/index.tsx +++ b/apps/server/client/pages/(main)/share/feeds/[id]/index.tsx @@ -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 - } - case viewsRenderType.Picture.includes(view): { - return - } - case viewsRenderType.Grid.includes(view): { - return - } - } - }, [entries.data, feed.data, view]) + if (feed.isLoading || !feed.data?.feed || !feedData) { return ( <> @@ -131,30 +101,9 @@ export function Component() { {entries.isLoading && !entries.data ? ( ) : ( - renderContent + )}
) } -const NormalList: FC<{ - entries: EntriesPreview - - feed: Feed -}> = ({ entries, feed }) => { - return ( - <> - {entries?.map((entry) => ( - -
- -
-
- ))} - - ) -} diff --git a/apps/server/client/pages/(main)/share/lists/[id]/index.tsx b/apps/server/client/pages/(main)/share/lists/[id]/index.tsx index 9a590b3e1..b8ec3c1ce 100644 --- a/apps/server/client/pages/(main)/share/lists/[id]/index.tsx +++ b/apps/server/client/pages/(main)/share/lists/[id]/index.tsx @@ -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 ( {list.isLoading ? ( @@ -53,12 +57,22 @@ export function Component() { className="mask-squircle mask shrink-0" size={64} /> -
+

{list.data.list.title}

-
-
{list.data.list.description}
+
{list.data.list.description}
+ + {t("feed.madeby")} + + + {list.data.list.owner?.name?.slice(0, 2)} + +
{t("feed.followsAndFeeds", { @@ -89,7 +103,7 @@ export function Component() {
{listData!.feedIds - ?.slice(0, 5) + ?.slice(0, 7) .map((feedId) => )} {"feedCount" in list.data && (
@@ -99,6 +113,10 @@ export function Component() {
)}
+
{t("feed.preview")}
+
+ +
) )} @@ -115,8 +133,9 @@ const FeedRow = ({ feed }: { feed: Feed["feed"] }) => { key={feed.id} > - {feed.title} +
{feed.title}
+
{feed.description}
) } diff --git a/apps/server/client/pages/(main)/share/users/[id]/index.tsx b/apps/server/client/pages/(main)/share/users/[id]/index.tsx index 4496e93a6..042b9df75 100644 --- a/apps/server/client/pages/(main)/share/users/[id]/index.tsx +++ b/apps/server/client/pages/(main)/share/users/[id]/index.tsx @@ -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 = () => { ) : ( - + {user.data?.name?.slice(0, 2)}
diff --git a/apps/server/client/query/entries.ts b/apps/server/client/query/entries.ts index 26878e835..4ea7c37e2 100644 --- a/apps/server/client/query/entries.ts +++ b/apps/server/client/query/entries.ts @@ -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> +export type EntriesPreview = (Awaited>[number] & { + feeds?: Feed["feed"] +})[] diff --git a/apps/server/package.json b/apps/server/package.json index 2a06c349d..70e4bd318 100644 --- a/apps/server/package.json +++ b/apps/server/package.json @@ -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" } } diff --git a/changelog/0.2.7.md b/changelog/0.2.7.md new file mode 100644 index 000000000..cce5e8240 --- /dev/null +++ b/changelog/0.2.7.md @@ -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. diff --git a/forge.config.ts b/forge.config.ts index fa8f10115..058e67806 100644 --- a/forge.config.ts +++ b/forge.config.ts @@ -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, + }, + ], }, }), ], diff --git a/locales/app/en.json b/locales/app/en.json index 824069e30..b82fc81e8 100644 --- a/locales/app/en.json +++ b/locales/app/en.json @@ -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", diff --git a/locales/app/ja.json b/locales/app/ja.json index 8ab94d0d0..f93cba132 100644 --- a/locales/app/ja.json +++ b/locales/app/ja.json @@ -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": "カスタマイズ", diff --git a/locales/app/zh-CN.json b/locales/app/zh-CN.json index 89b7c5d9e..5008f97de 100644 --- a/locales/app/zh-CN.json +++ b/locales/app/zh-CN.json @@ -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": "转换", diff --git a/locales/app/zh-HK.json b/locales/app/zh-HK.json index 8bbe364a9..8cd821147 100644 --- a/locales/app/zh-HK.json +++ b/locales/app/zh-HK.json @@ -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 模式" } diff --git a/locales/app/zh-TW.json b/locales/app/zh-TW.json index 775c75704..debcba08c 100644 --- a/locales/app/zh-TW.json +++ b/locales/app/zh-TW.json @@ -398,6 +398,7 @@ "words.rss3": "RSS3", "words.rsshub": "RSSHub", "words.search": "搜尋", + "words.show_more": "顯示更多", "words.starred": "收藏", "words.title": "標題", "words.transform": "轉換", diff --git a/locales/external/en.json b/locales/external/en.json index f4fbd5c48..ac5ff6e0d 100644 --- a/locales/external/en.json +++ b/locales/external/en.json @@ -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", diff --git a/locales/external/ja.json b/locales/external/ja.json index 8ea52636b..26171f63c 100644 --- a/locales/external/ja.json +++ b/locales/external/ja.json @@ -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": "アプリ", diff --git a/locales/external/zh-HK.json b/locales/external/zh-HK.json index d505fbfb0..b35959ac6 100644 --- a/locales/external/zh-HK.json +++ b/locales/external/zh-HK.json @@ -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": "應用程式", diff --git a/locales/native/zh-HK.json b/locales/native/zh-HK.json index be108f1a9..684b29a83 100644 --- a/locales/native/zh-HK.json +++ b/locales/native/zh-HK.json @@ -67,7 +67,7 @@ "menu.undo": "撤銷", "menu.view": "查看", "menu.window": "窗口", - "menu.zenMode": "專注模式", + "menu.zenMode": "Zen 模式", "menu.zoom": "縮放", "menu.zoomIn": "放大", "menu.zoomOut": "縮小" diff --git a/locales/settings/en.json b/locales/settings/en.json index 7b45b484b..7c2788fe4 100644 --- a/locales/settings/en.json +++ b/locales/settings/en.json @@ -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", diff --git a/locales/settings/ja.json b/locales/settings/ja.json index d501a3b52..7614c57b1 100644 --- a/locales/settings/ja.json +++ b/locales/settings/ja.json @@ -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": "キャッシュ", diff --git a/locales/settings/zh-CN.json b/locales/settings/zh-CN.json index 7205e0802..a6aec4937 100644 --- a/locales/settings/zh-CN.json +++ b/locales/settings/zh-CN.json @@ -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": "缓存", diff --git a/locales/settings/zh-HK.json b/locales/settings/zh-HK.json index e306378f9..98d6ca61c 100644 --- a/locales/settings/zh-HK.json +++ b/locales/settings/zh-HK.json @@ -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": "喜歡我們的產品嗎? 在 GitHub 上給我們 star 吧!", "data_control.app_cache_limit.description": "應用程式快取的最大大小。當快取達到此大小時,最舊的項目將被刪除以釋放空間。", "data_control.app_cache_limit.label": "應用程式快取限制", diff --git a/locales/shortcuts/zh-HK.json b/locales/shortcuts/zh-HK.json index 8deb93e96..7d87ceb89 100644 --- a/locales/shortcuts/zh-HK.json +++ b/locales/shortcuts/zh-HK.json @@ -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": "條目列表", diff --git a/package.json b/package.json index 516be5e8a..e54697669 100644 --- a/package.json +++ b/package.json @@ -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" } diff --git a/packages/components/package.json b/packages/components/package.json index 5c55925f1..9dc9d4a6f 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -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" diff --git a/packages/components/src/common/Fragment.ts b/packages/components/src/common/Fragment.ts new file mode 100644 index 000000000..9d44ab04a --- /dev/null +++ b/packages/components/src/common/Fragment.ts @@ -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) +} diff --git a/packages/components/src/icons/Progress.tsx b/packages/components/src/icons/Progress.tsx new file mode 100644 index 000000000..effc8ab9f --- /dev/null +++ b/packages/components/src/icons/Progress.tsx @@ -0,0 +1,63 @@ +import type { SVGProps } from "react" + +export function MaterialSymbolsProgressActivity(props: SVGProps) { + return ( + + + + ) +} + +interface CircleProgressProps { + percent: number + size?: number + strokeWidth?: number + strokeColor?: string + backgroundColor?: string + className?: string +} + +export const CircleProgress: React.FC = ({ + 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 ( + + + + + ) +} diff --git a/packages/components/src/ui/avatar/index.tsx b/packages/components/src/ui/avatar/index.tsx index 2e7e7abcd..8e1360130 100644 --- a/packages/components/src/ui/avatar/index.tsx +++ b/packages/components/src/ui/avatar/index.tsx @@ -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< )) diff --git a/packages/components/src/ui/divider/Divider.tsx b/packages/components/src/ui/divider/Divider.tsx index 93752f5cf..f28bdbfe8 100644 --- a/packages/components/src/ui/divider/Divider.tsx +++ b/packages/components/src/ui/divider/Divider.tsx @@ -20,7 +20,7 @@ export const DividerVertical: FC< return ( diff --git a/packages/components/src/ui/select/responsive.tsx b/packages/components/src/ui/select/responsive.tsx index 7d3bbcda2..b7cb4b4ce 100644 --- a/packages/components/src/ui/select/responsive.tsx +++ b/packages/components/src/ui/select/responsive.tsx @@ -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, )} > - {renderValue?.(valueInner) ?? valueToLabelMap[valueInner]} + + {(renderValue?.(valueInner) ?? valueToLabelMap[valueInner]) || ( + {placeholder} + )} +