chore: Release v0.1.1-beta.0 (#1143)

This commit is contained in:
DIYgod
2024-10-25 21:20:13 +08:00
committed by GitHub
488 changed files with 2960 additions and 7864 deletions
+17 -5
View File
@@ -54,13 +54,25 @@
"rule": "unused-imports/no-unused-imports",
"severity": "off"
},
{ "rule": "@typescript-eslint/require-await", "severity": "info" },
{ "rule": "@typescript-eslint/await-thenable", "severity": "info" },
{ "rule": "@typescript-eslint/no-floating-promises", "severity": "info" },
{ "rule": "@typescript-eslint/no-misused-promises", "severity": "info" }
{
"rule": "@typescript-eslint/require-await",
"severity": "info"
},
{
"rule": "@typescript-eslint/await-thenable",
"severity": "info"
},
{
"rule": "@typescript-eslint/no-floating-promises",
"severity": "info"
},
{
"rule": "@typescript-eslint/no-misused-promises",
"severity": "info"
}
],
"cSpell.words": ["Hydable", "rsshub", "Русский"],
"editor.foldingImportsByDefault": true,
// "editor.foldingImportsByDefault": true,
"commentTranslate.hover.enabled": false,
"typescript.tsdk": "node_modules/typescript/lib",
"i18n-ally.enabledFrameworks": ["i18next"],
+41 -1
View File
@@ -1,6 +1,6 @@
# CHANGELOG
# [0.1.0-beta.0](https://github.com/RSSNext/follow/compare/v0.0.1-alpha.21...v0.1.0-beta.0) (2024-10-23)
## [0.1.1-beta.0](https://github.com/RSSNext/follow/compare/v0.0.1-alpha.21...v0.1.1-beta.0) (2024-10-25)
### Bug Fixes
@@ -76,6 +76,7 @@
* avoid image cls in entry content ([#666](https://github.com/RSSNext/follow/issues/666)) ([ccda887](https://github.com/RSSNext/follow/commit/ccda8875e93a52131307e69956c2d58fa5481e46))
* blurhash covers the image ([98d3715](https://github.com/RSSNext/follow/commit/98d3715cbd45938b2e0558a25afbb01ba265ad91)), closes [#959](https://github.com/RSSNext/follow/issues/959)
* blurhash size ([fc469ab](https://github.com/RSSNext/follow/commit/fc469ab4f5f15e9aa53cfad1920180af79b64836))
* boost modal and reward desc behavior ([8212d06](https://github.com/RSSNext/follow/commit/8212d0699db1cbf8dd40fec1c309a834f56014d9))
* boost modal use async modal ([0c1215d](https://github.com/RSSNext/follow/commit/0c1215dbf0a3e50ecb295e60e305c857c4538255))
* border color in dark mode ([472fbb2](https://github.com/RSSNext/follow/commit/472fbb2a6b41d9953bbfbda5452558621f71c8d5))
* **build:** ensure needed node_module is copied in dist ([5e4226a](https://github.com/RSSNext/follow/commit/5e4226ab176428205265d0ca69350c80c2263015))
@@ -121,6 +122,7 @@
* config `__dirname` resolve ([f3f3cac](https://github.com/RSSNext/follow/commit/f3f3cac2b4ff0865f863b848397f0e27caa435b3))
* context menu item title should use title case ([f11eb19](https://github.com/RSSNext/follow/commit/f11eb198157f26861b3d69965f051c2a5b02886e))
* context menu sub menu ([9352dd1](https://github.com/RSSNext/follow/commit/9352dd1a2a2d4d30c04cb41a22b95a0dda3eeb40))
* convert html to markdown before save to obsidian ([bef80de](https://github.com/RSSNext/follow/commit/bef80de315fd320d565196f17e658f4dbcbc69a1))
* copy grammatical ([0267b08](https://github.com/RSSNext/follow/commit/0267b080c01733671ac4fc12cfd5ec9c1807c928))
* copywrite ([8967d20](https://github.com/RSSNext/follow/commit/8967d20102bc1ad6f2f94b38909c7abfca6168d1))
* corner player tooltip bg color ([16b91f9](https://github.com/RSSNext/follow/commit/16b91f9a7d3267f34f525c2e820efff6e1cbc049))
@@ -136,11 +138,13 @@
* **db:** remove remaining data if unfollow feed ([1edf560](https://github.com/RSSNext/follow/commit/1edf5605e9621219e6cdfc732f12e6464113f765))
* debug for forworded handled host ([c0ec27d](https://github.com/RSSNext/follow/commit/c0ec27d04853508a888267a1c5273b07eee3bfa6))
* debug proxy inject env ([6b80cdc](https://github.com/RSSNext/follow/commit/6b80cdc6e7141913643f77a0b9a089333b86278d))
* debug vercel headers ([29a48ee](https://github.com/RSSNext/follow/commit/29a48eed489695291ceb016a553d0d8caea0e84d))
* deeplink adding feed does not work on Windows ([#1002](https://github.com/RSSNext/follow/issues/1002)) ([9d5f2c9](https://github.com/RSSNext/follow/commit/9d5f2c908ee3c91083a57b964236d0c41a5c41c9))
* deeplink navigate ([00d41ce](https://github.com/RSSNext/follow/commit/00d41cee5632dab86f7a93b1bc965cb3a896417a))
* default extra window size ([5688eff](https://github.com/RSSNext/follow/commit/5688eff6a70ab9abc3e94d9dce861726df8d9123))
* determine snowflake id ([7dbf48b](https://github.com/RSSNext/follow/commit/7dbf48b92c9445b83588bcf11892f3728e959977))
* devtools font not work due to comment ([#846](https://github.com/RSSNext/follow/issues/846)) ([ac09c71](https://github.com/RSSNext/follow/commit/ac09c711d94cd966b5c9839276d11b2e2235e2ce))
* disable auto toggle readability in web ([b94e051](https://github.com/RSSNext/follow/commit/b94e051c1c4593e34e2c5bd23e885e30ac045d97))
* disable window blur material lower than windows 11 ([3735390](https://github.com/RSSNext/follow/commit/3735390af80671a4bf954f70062f3838206b8890))
* disabled ghost button style ([e01985b](https://github.com/RSSNext/follow/commit/e01985b1e9bf8a60ea20f47fc3e7a7a9a969bca9))
* discover form overflow scrollbar ([1145e92](https://github.com/RSSNext/follow/commit/1145e92ae7125873d69f2689d86418b004d93319))
@@ -164,6 +168,7 @@
* drawer top edge anchor ([248369a](https://github.com/RSSNext/follow/commit/248369afe6d085885fd76a4ecf6a3f9b692b14cf))
* dropmenu icon prop passive, profile avatar button cls ([ddfcffe](https://github.com/RSSNext/follow/commit/ddfcffeda59c2d2503645b36aba423eff9e2b5b9))
* duplicated separator ([6e1ee50](https://github.com/RSSNext/follow/commit/6e1ee50536ded4b65f76cdb35bdf98c4657a1a74))
* **dx:** reload page if store circular import detected ([f60fc6f](https://github.com/RSSNext/follow/commit/f60fc6f1d423521d99532a142e37e2e7330cd85a))
* dynamic import error component ([d98c06e](https://github.com/RSSNext/follow/commit/d98c06e1c04cd5a1189c47653dc20bef1b6a9aa2))
* dynamic load i18n resource in electron prod ([2328648](https://github.com/RSSNext/follow/commit/232864852a934d571a2b47af7f4d02c787cc8250))
* eagle icon ([021dfab](https://github.com/RSSNext/follow/commit/021dfab5eeb888f155982cc1cd3636b2b4ca52a3))
@@ -176,6 +181,7 @@
* electron window frame and `backgroundMaterial` ([e18ec75](https://github.com/RSSNext/follow/commit/e18ec754a05231fb82a7cbdb80632d79a6232872))
* electron window layout titleSticky ui ([#1010](https://github.com/RSSNext/follow/issues/1010)) ([1135361](https://github.com/RSSNext/follow/commit/113536104e635d78a1ad7ec46041aa4156131002))
* electron window type ([909d692](https://github.com/RSSNext/follow/commit/909d6929da5bd3930a6e1d8aa3342c46d00e5c7d))
* embed video can not play, close [#1086](https://github.com/RSSNext/follow/issues/1086) ([1554a93](https://github.com/RSSNext/follow/commit/1554a93c956e276f45d4f0fd88872cf0ec6d649f))
* empty default font on electron app ([#481](https://github.com/RSSNext/follow/issues/481)) ([4f9d4f2](https://github.com/RSSNext/follow/commit/4f9d4f26f22ac86cce64bb9f1582c2be2b3361c3))
* empty entry list will throw not found feed error, fixed [#224](https://github.com/RSSNext/follow/issues/224) ([c41756d](https://github.com/RSSNext/follow/commit/c41756d2b91173a753e09f5de988b71a27daa9ba))
* empty title break ([fbbb2a9](https://github.com/RSSNext/follow/commit/fbbb2a98b204ff17d80f1826134b713854a0f40d))
@@ -191,6 +197,7 @@
* entry preview modal content ([8492c2a](https://github.com/RSSNext/follow/commit/8492c2afb3af79726b9448359a63b432b04a3518))
* entry read history more not showing on desktop ([0c6494b](https://github.com/RSSNext/follow/commit/0c6494b5682078fa1da1ea2e6f5d81aa436a5155))
* entry view tracker params ([0c05a8b](https://github.com/RSSNext/follow/commit/0c05a8b88c1c385b7809f1ea9e3355f0d11e69dd))
* **entry-colmun:** refetch view as deps ([39be37e](https://github.com/RSSNext/follow/commit/39be37e378dba2beb3adccfa17c328168939a0e5))
* **entry-layout:** only padding left in wide mode ([c0d49e5](https://github.com/RSSNext/follow/commit/c0d49e5436b9f93857c9efa4bdaf4cc939e86c73))
* env example ([cdb8dd5](https://github.com/RSSNext/follow/commit/cdb8dd5cf31ec2d43b18a50cdd3259302620867e))
* error boundary lazy suspense ([fefd578](https://github.com/RSSNext/follow/commit/fefd578df9cacaef79a92b190a862931f2e5a39a))
@@ -212,6 +219,7 @@
* feed column layout ([8a31463](https://github.com/RSSNext/follow/commit/8a31463e4ef82811e0f7d5fd40cb3281202a24e3))
* feed column resize perf ([a09f55a](https://github.com/RSSNext/follow/commit/a09f55af080714d0b0022983421e942d14ceb562))
* feed column vertical align ([63139f2](https://github.com/RSSNext/follow/commit/63139f25b2b771480de4c04d91967067897c94fc))
* feed form max width of markdown container ([99478f1](https://github.com/RSSNext/follow/commit/99478f1d9995fc548ea84684e8e91e98c676827c))
* feed form view type radio text wrap ([d9e89e2](https://github.com/RSSNext/follow/commit/d9e89e213c57908c18dc1391bb7c07d35f7b02ca))
* feed icon in player cover ([c6a8613](https://github.com/RSSNext/follow/commit/c6a8613b29cec24bb61eec2196f1827ae9a759fa))
* feed icon style ([3f04f14](https://github.com/RSSNext/follow/commit/3f04f148f5a34d47da8dab1a4fc4b00f9a2fadba))
@@ -223,6 +231,7 @@
* fill relative url in entry title link, fix [#372](https://github.com/RSSNext/follow/issues/372) ([7c3aab6](https://github.com/RSSNext/follow/commit/7c3aab6f042a710aaa99d8fb7a774fce89af2b08))
* Fix popup's width when viewport changes. ([#981](https://github.com/RSSNext/follow/issues/981)) ([6f20509](https://github.com/RSSNext/follow/commit/6f2050908f93d95a98e5e4cdb71ba03c24844277))
* fix the fixed misalignment when image is empty and name is also empty ([#179](https://github.com/RSSNext/follow/issues/179)) ([f6b62c8](https://github.com/RSSNext/follow/commit/f6b62c8ce0908772c394d653857197c9302e332b))
* fix toast wrong tip amount ([#1139](https://github.com/RSSNext/follow/issues/1139)) ([7c7be10](https://github.com/RSSNext/follow/commit/7c7be1016a38d5eea3e83c3bb4ad450768c2b633))
* fixed text overlap issues caused by style ([#527](https://github.com/RSSNext/follow/issues/527)) ([103bd6a](https://github.com/RSSNext/follow/commit/103bd6a414beb9a808a9ad661348ff416626bc18))
* flat ([6bada5e](https://github.com/RSSNext/follow/commit/6bada5e986ff77ef5de42d18734ea92f872ca818))
* font name duplicated if installed default font ([1efdd40](https://github.com/RSSNext/follow/commit/1efdd40f99cb1ad52f048bd53648f32b4cfbbae8))
@@ -286,6 +295,7 @@
* inbox ([df86527](https://github.com/RSSNext/follow/commit/df86527072df1a30c65bce8ab48a963be596a716))
* inbox data refreshment ([a3a7c82](https://github.com/RSSNext/follow/commit/a3a7c82ea6308756a800514d9df528815ba77781))
* inbox unread filter ([ea643e5](https://github.com/RSSNext/follow/commit/ea643e5ffe84ac5d474876c847bd5cd40fe2ba22)), closes [#792](https://github.com/RSSNext/follow/issues/792)
* **inbox:** do not inject host style in mail render ([483d4ac](https://github.com/RSSNext/follow/commit/483d4acc39067b85b0861f559ec5db10cf397ab8))
* incorrect tooltip in read history ([#385](https://github.com/RSSNext/follow/issues/385)) ([cabe210](https://github.com/RSSNext/follow/commit/cabe210aaf8f4a1133fa653532874fa86d02c252))
* increase feeds tab cell width ([5d7faf7](https://github.com/RSSNext/follow/commit/5d7faf70b49c9b5f35323dc5716ba15772d95074))
* init store after app init ([728ea84](https://github.com/RSSNext/follow/commit/728ea84fa6e9faff1990184285390a1d86eb2c56))
@@ -303,6 +313,8 @@
* language setting syncing ([fa1dc5d](https://github.com/RSSNext/follow/commit/fa1dc5df35a2225bb22320a8fc049d3c0b75fa5b))
* layout shift ([f5f5213](https://github.com/RSSNext/follow/commit/f5f521300f59a0194a349342d2990e2c5d4bfd63))
* less white space, close [#818](https://github.com/RSSNext/follow/issues/818) ([4b0802d](https://github.com/RSSNext/follow/commit/4b0802da69bd64192f622c08e53ba95484d27c71))
* limit preview media image max height ([bd77bc4](https://github.com/RSSNext/follow/commit/bd77bc400fa35285ed2239a44ac78a8faa2d5382)), closes [#1131](https://github.com/RSSNext/follow/issues/1131)
* limit select area ([f7696b3](https://github.com/RSSNext/follow/commit/f7696b3f8acee99379557320e68d9bf8543e53c3))
* link underline style when selected ([781b120](https://github.com/RSSNext/follow/commit/781b1200f8eae3f61b39dc53151c5a688fa36d1b))
* lint ([ef0d80d](https://github.com/RSSNext/follow/commit/ef0d80d8546c804b1b52c58fca7640d2f541188a))
* list data store and list edit form ([f420e78](https://github.com/RSSNext/follow/commit/f420e78ca921217b18a5c6b4811074d8eb11fe4e))
@@ -324,6 +336,7 @@
* **login-button:** add overflow ([650aeeb](https://github.com/RSSNext/follow/commit/650aeeb099a18341a6fd25b006e77818f040fa93))
* make media take up space ([a0a26a9](https://github.com/RSSNext/follow/commit/a0a26a98dc9f1ab877025b8e43cbab7ce933537f)), closes [#1050](https://github.com/RSSNext/follow/issues/1050)
* margin between the top bar and the content ([#1054](https://github.com/RSSNext/follow/issues/1054)) ([e6491e5](https://github.com/RSSNext/follow/commit/e6491e512b891409c1200be315dd3065c33bee20))
* margin condition in EntryListHeader ([#1103](https://github.com/RSSNext/follow/issues/1103)) ([ac7fa6b](https://github.com/RSSNext/follow/commit/ac7fa6bba7f46abec5b016bd8fee894d71a8c1da))
* mark all as read height ([eb1a944](https://github.com/RSSNext/follow/commit/eb1a9440b5e3eb8fa205251c312e47a1ad47d77f)), closes [#811](https://github.com/RSSNext/follow/issues/811)
* mark all as read in feed action ([cbb5022](https://github.com/RSSNext/follow/commit/cbb502223fd82212f8534eb578786cb138813474))
* mark all button overlay position ([5e34d36](https://github.com/RSSNext/follow/commit/5e34d3650eaaa999c660377db3e955269123eab5))
@@ -354,10 +367,12 @@
* navigating from a tts player doesn't work properly ([#828](https://github.com/RSSNext/follow/issues/828)) ([22a72ac](https://github.com/RSSNext/follow/commit/22a72ac15b8aa7ae5707f68051951ea5707a4ae9))
* new invitation button zindex ([0d79392](https://github.com/RSSNext/follow/commit/0d79392cde4c282cbc3faf69fd697b3726638279))
* nightly build ci ([85a52ad](https://github.com/RSSNext/follow/commit/85a52ad1dfc3f55950b7ae3b59c2c18eaee0e37e))
* no scale for inline image ([8f7a101](https://github.com/RSSNext/follow/commit/8f7a101013157132c981f475bef1af8086ec0670))
* not showing '0' when no followers on the search results card ([#1032](https://github.com/RSSNext/follow/issues/1032)) ([a09b80e](https://github.com/RSSNext/follow/commit/a09b80e933af86c16040ebae4e0395e795fb240a))
* null bigint error ([fa2d0f3](https://github.com/RSSNext/follow/commit/fa2d0f3583f4bdb06c75e79ae78093323db49619))
* null reference introduced in ab8c9e5 ([#667](https://github.com/RSSNext/follow/issues/667)) ([1eae565](https://github.com/RSSNext/follow/commit/1eae565fb37c2ed3b6a627855862d2ae30c3dc00))
* only can add feed to owned lists, fixed [#863](https://github.com/RSSNext/follow/issues/863) ([0c306bc](https://github.com/RSSNext/follow/commit/0c306bc34ac351ad36617e07769df8dc647d24b5))
* only fit content for image media ([4417092](https://github.com/RSSNext/follow/commit/4417092cfb3c3634f7e1af1bc708e1574d384cc6))
* only navigate to root when document is focus ([b0bad7a](https://github.com/RSSNext/follow/commit/b0bad7afe07e847a0e7b6eabaa02a2c17d024d25))
* only valid feed can be claimed ([1e03bf6](https://github.com/RSSNext/follow/commit/1e03bf66e17e3d873081c9f6faa93ee2407f57e1))
* only windows 11 can manually resize logic ([338803a](https://github.com/RSSNext/follow/commit/338803a18936c29fcea694c95baef1b3e8650980))
@@ -365,6 +380,7 @@
* optimize ai daily modal ([8872067](https://github.com/RSSNext/follow/commit/88720679df1371543c0feb5d3a48b7b7e664a20b))
* optimize code string parser ([b3d32d0](https://github.com/RSSNext/follow/commit/b3d32d09fd4d5b53ae1692ffdc154e8d37a77fdd))
* optimize invitation page ([5f93e4b](https://github.com/RSSNext/follow/commit/5f93e4baac340998b08aaa273e2185893fe88e92))
* optimize the appearing horizontal scroll bar. ([#1108](https://github.com/RSSNext/follow/issues/1108)) ([8532257](https://github.com/RSSNext/follow/commit/8532257f5c64d79561507ddd8a7aea8eac1f8521))
* optimize the content margin of the Discover Page ([#1021](https://github.com/RSSNext/follow/issues/1021)) ([3cf887b](https://github.com/RSSNext/follow/commit/3cf887be4f47ca96df2c41d83082a1e1ad262293))
* optional response data for check new, fixed [#195](https://github.com/RSSNext/follow/issues/195) ([2c650b0](https://github.com/RSSNext/follow/commit/2c650b08ae031e18dbe4b25d9c124c3eb7ff4f9a))
* overflow text in setting modal layout ([b34aa57](https://github.com/RSSNext/follow/commit/b34aa579f07af9dd3feca036b8996e561204d850))
@@ -373,6 +389,7 @@
* panel split color in dark mode ([3a0cfa1](https://github.com/RSSNext/follow/commit/3a0cfa1ebf794351d7f7b1132c0068a55ff2e9a6))
* panel spliter zindex ([23e428a](https://github.com/RSSNext/follow/commit/23e428ad30d5df968e881462a699fdf40db43131))
* peek modal header background color and copywrite ([b8be81b](https://github.com/RSSNext/follow/commit/b8be81b2105d2c229955a433af91c43f5286194a))
* peek modal overlay transition when dismiss ([aeb380c](https://github.com/RSSNext/follow/commit/aeb380cc2c782427e16d5106c65eae0151d674df))
* picture action button position ([b18e4a2](https://github.com/RSSNext/follow/commit/b18e4a2bd4f4266e4e44da17b3deac9826570322)), closes [#811](https://github.com/RSSNext/follow/issues/811)
* picture entry preview in Grid view ([#658](https://github.com/RSSNext/follow/issues/658)) ([634978f](https://github.com/RSSNext/follow/commit/634978f427865f646088f13a315207cde63d532c))
* player holder size ([78cb08c](https://github.com/RSSNext/follow/commit/78cb08c7dc98aeab9cb5575296470106dbeb4e84))
@@ -390,6 +407,7 @@
* prevent translation popup from being obscured by time display ([#631](https://github.com/RSSNext/follow/issues/631)) ([ea6fbc2](https://github.com/RSSNext/follow/commit/ea6fbc27e6d29d59c4419422a6a12c81d56c2c98))
* preview image and video size ([e4e4700](https://github.com/RSSNext/follow/commit/e4e47006ee55aa59db5fdb76f565a5ec929f3d95))
* preview image fallback ([7410ca2](https://github.com/RSSNext/follow/commit/7410ca229afdb6fafb01f5ebe370d01dc33a4500))
* preview image size ([553640e](https://github.com/RSSNext/follow/commit/553640e495d0c6e521c59448a6997476ff2b631c))
* preview image size ([af474c1](https://github.com/RSSNext/follow/commit/af474c1592b5cf92c114936ccb3e6686ea737e37))
* preview image width ([7847da8](https://github.com/RSSNext/follow/commit/7847da84321e8c33f002e72c6653338602c35dc9))
* preview media entry background color in dark mode ([4751447](https://github.com/RSSNext/follow/commit/4751447ce2bd9e0dd7d6865ed48b600a747556cf))
@@ -429,6 +447,7 @@
* remove motion overlay, fixed [#868](https://github.com/RSSNext/follow/issues/868) ([e5e53b8](https://github.com/RSSNext/follow/commit/e5e53b8ef8486ed9047c0efe1b67c9fa3184673d))
* remove posthog, and fix [#1022](https://github.com/RSSNext/follow/issues/1022) ([9cb25c9](https://github.com/RSSNext/follow/commit/9cb25c96565e5660e0e2943b866915b8fa3e5ef7))
* remove prefetch achievement ([619aa82](https://github.com/RSSNext/follow/commit/619aa82b5ceeafcf6cf34f32b64e01b7e8c864b5))
* remove timeline tabs ([3d1c10d](https://github.com/RSSNext/follow/commit/3d1c10d4af48c902e2e41f4388308095075d897f))
* remove windows under blur and ensure main window in the screen bounds ([d772343](https://github.com/RSSNext/follow/commit/d7723435a1527e5f9c065c36bf1d1d81b3b43ec4))
* rename category input composition and style ([1ab3770](https://github.com/RSSNext/follow/commit/1ab3770f0279eb043f7a37a1b5251e5ead0ef0b6))
* reorganize package.json ([b2c48a4](https://github.com/RSSNext/follow/commit/b2c48a49e3789cb3dfd9e9170f5371fc6b25c4b1))
@@ -442,14 +461,18 @@
* rewrite ([3a8cbf2](https://github.com/RSSNext/follow/commit/3a8cbf243903f08392dd1d3eab723b31ff86143a))
* round left only in electron ([2d10811](https://github.com/RSSNext/follow/commit/2d10811273d2053b889b2688189b4212b6e9d6a1))
* safari entry colmun styles ([f36cfd3](https://github.com/RSSNext/follow/commit/f36cfd36103016d4d8afffd471a218e435096e43))
* safe file name ([3af3935](https://github.com/RSSNext/follow/commit/3af3935fcac43cc2cfc03b654059e1d26a77f57c)), closes [#1129](https://github.com/RSSNext/follow/issues/1129)
* save to Obsidian error in browser environment ([#1040](https://github.com/RSSNext/follow/issues/1040)) ([497cb5a](https://github.com/RSSNext/follow/commit/497cb5a96512e02c9f6ca12688f0939db69f6164))
* scroll to top when switch to other entry ([4ec1c93](https://github.com/RSSNext/follow/commit/4ec1c93e95d79daa84018b9bb0f84f03ba0f4dee))
* search entries ([4cbe2a2](https://github.com/RSSNext/follow/commit/4cbe2a2d816e1a56bd89206d1026fc19d86d47b1))
* search items ensure unique keys ([#597](https://github.com/RSSNext/follow/issues/597)) ([ff14738](https://github.com/RSSNext/follow/commit/ff14738eeacf04ffe0c457f3600287fb2ddd0529))
* sentry config ([779236e](https://github.com/RSSNext/follow/commit/779236e0827af3981bce29e3c1ac9a527aec3fd5))
* **server:** client api client ([f54c886](https://github.com/RSSNext/follow/commit/f54c8869501847e07310a93298c5038abc8e0a1a))
* **server:** deeplink handler ([1decc35](https://github.com/RSSNext/follow/commit/1decc3555a5ff0ede2a7b8146210be5973907995))
* **server:** inject `WEB_URL` env ([db7ba9d](https://github.com/RSSNext/follow/commit/db7ba9df8d9d638b77873e54d18fcbfc58faf073))
* **server:** og title template ([8678de0](https://github.com/RSSNext/follow/commit/8678de0d66eeff41e3c375ed1b9a14420e9756a8))
* **server:** should bundle some deps ([0745685](https://github.com/RSSNext/follow/commit/0745685beaef806d0a9e6d33e946ca7a1a3590db))
* **server:** upstream origin url ([27faed9](https://github.com/RSSNext/follow/commit/27faed996539c74e3e55f5c2c9f021b764c18400))
* **server:** workspace deps as dev deps ([6eb4b2d](https://github.com/RSSNext/follow/commit/6eb4b2d260dd26a51d19afeac0ddd79e0cc6fe9a))
* set auth config first ([a281f58](https://github.com/RSSNext/follow/commit/a281f58a811213d933585280238fec4088ad7749))
* set cmdf container `z-index` to `1000` ([#859](https://github.com/RSSNext/follow/issues/859)) ([db1d190](https://github.com/RSSNext/follow/commit/db1d19076c781696b9421f53dd79c35a6f49a324))
@@ -486,6 +509,7 @@
* social media feed icon style ([841f445](https://github.com/RSSNext/follow/commit/841f445403aef7acc01e30345be963257eea5e14))
* social media typesetting ([664b70d](https://github.com/RSSNext/follow/commit/664b70d00871ed7f3a3f327bff8aca24c7b4a9a5))
* social media typography ([5d27d29](https://github.com/RSSNext/follow/commit/5d27d29e4bd2791248d6a907a889a4907f0e0d20))
* solve overflow issue in achievement model ([#1114](https://github.com/RSSNext/follow/issues/1114)) ([f726921](https://github.com/RSSNext/follow/commit/f72692145bc59a8e18bbb25ef681b62acfabba94))
* sort by preferred title, fix [#390](https://github.com/RSSNext/follow/issues/390) ([cc25c67](https://github.com/RSSNext/follow/commit/cc25c6785e98f7a200904bdac2b36ff03cf358dd))
* sort categories suggestions ([2c53ecb](https://github.com/RSSNext/follow/commit/2c53ecb65b4b79851ae7498d90427a951b68acb7))
* sort shortcut ([1f8e4a3](https://github.com/RSSNext/follow/commit/1f8e4a3b966891787f05d9b6d0ec0fe327260e49))
@@ -521,6 +545,7 @@
* The problem with the display of the right content area ([#501](https://github.com/RSSNext/follow/issues/501)) ([4692ebd](https://github.com/RSSNext/follow/commit/4692ebd11ecf9b05a57e49270f920a33bbd9a5c3))
* the search results on the Discover Page are not centered ([#1029](https://github.com/RSSNext/follow/issues/1029)) ([93461e8](https://github.com/RSSNext/follow/commit/93461e8ad7ed47adba6afa351c816d1392ecc2f7))
* threshold for sidebar temp show ([7d62ea6](https://github.com/RSSNext/follow/commit/7d62ea6801713e2b43b116c5ddfea0b1a96a6fe8))
* timeline margin and picture view content top marigin, closes [#1106](https://github.com/RSSNext/follow/issues/1106) ([cf08c75](https://github.com/RSSNext/follow/commit/cf08c752751307c971bd3ded72a2cc500ae3ba7b))
* timeline tabs styles ([0a98f37](https://github.com/RSSNext/follow/commit/0a98f371a837ba3b7e4bc086f6352af6033c2081))
* tip modal styles ([3154c4f](https://github.com/RSSNext/follow/commit/3154c4f95b47d7fbce6142f49b211799408bc5aa))
* toc active logic ([13ba679](https://github.com/RSSNext/follow/commit/13ba679ed879920798e434ee10c3fb407395dcb1))
@@ -568,6 +593,7 @@
* types ([4287b5d](https://github.com/RSSNext/follow/commit/4287b5d986e74fbb2f96c2f322f09f921f773d7a))
* types ([d9458a1](https://github.com/RSSNext/follow/commit/d9458a1850b3e83e9bbb9374d4fc3b6884a24837))
* typing ([a386fd6](https://github.com/RSSNext/follow/commit/a386fd6e97fb98c42b3eedf156c5b167ff67bd34))
* typo ([44d3c1a](https://github.com/RSSNext/follow/commit/44d3c1af68e62bfe5815c87e63228369f4c53afd))
* typo ([deb96c5](https://github.com/RSSNext/follow/commit/deb96c538258c939c60762c723d58955899031cf))
* **ui:** entry title line height ([#608](https://github.com/RSSNext/follow/issues/608)) ([5309491](https://github.com/RSSNext/follow/commit/53094912981ad8cfc79120621725bab1708250f8))
* **ui:** fetch error toast margin ([e5fc18f](https://github.com/RSSNext/follow/commit/e5fc18fd9a16a0e32928b2d2b04c7d48d546c782))
@@ -578,6 +604,8 @@
* unify date item mark read styles ([9f5cbab](https://github.com/RSSNext/follow/commit/9f5cbabfafc905046258ceb5fe2c0bdd6993b830))
* unify player actions icons ([7d2382d](https://github.com/RSSNext/follow/commit/7d2382d56bf4b4186e566191cbbb1662a6a15d30))
* unify setting tab icon color, fix [#303](https://github.com/RSSNext/follow/issues/303) ([33a049a](https://github.com/RSSNext/follow/commit/33a049a8513f5c3cab9ce8a6adefadf7399164f8))
* unique id for entry timeline data, fixed [#1101](https://github.com/RSSNext/follow/issues/1101) ([e86c60d](https://github.com/RSSNext/follow/commit/e86c60d4c43a5e20f61d4628b23a77db5623c715))
* unique key of skeleton ([ab43626](https://github.com/RSSNext/follow/commit/ab436266ad255433143af90b820fefc42375caa4))
* unread state not up to date, fix [#485](https://github.com/RSSNext/follow/issues/485) ([96f7762](https://github.com/RSSNext/follow/commit/96f77623edd04582e95aa8125ccf4515daac96c1))
* update cmdk high contrast, [@unixzii](https://github.com/unixzii) advice ([cbd7593](https://github.com/RSSNext/follow/commit/cbd75932433ad056b257c5934e6aefc3c0d829dd))
* update DropdownMenuTrigger class for open state styling ([#931](https://github.com/RSSNext/follow/issues/931)) ([25234e1](https://github.com/RSSNext/follow/commit/25234e1bc1b6cd695f93d51b52fb62ddc9adba63))
@@ -586,6 +614,7 @@
* update invitation fab ([0cd1837](https://github.com/RSSNext/follow/commit/0cd183780f299b94a800cd86342484afa7f716bd))
* update lists table ui ([0d68e75](https://github.com/RSSNext/follow/commit/0d68e7584592d08191c54a16257dd92924216387))
* update search for ([b51d75f](https://github.com/RSSNext/follow/commit/b51d75ffc9b0a9c2760269041aaa4c5a7f6b26d0))
* update tax display logic ([c8ccf35](https://github.com/RSSNext/follow/commit/c8ccf352f23196eb89fa8a8606466edc557472af))
* update unread dot style ([e2fef01](https://github.com/RSSNext/follow/commit/e2fef01d2c374f720a6ff4b265344c828f8b80ba))
* updater should closes all window first ([7cb1a94](https://github.com/RSSNext/follow/commit/7cb1a94a15383e3190c37d3fea9ff0ff5a97dfd5))
* upgrade tip when player open ([033831b](https://github.com/RSSNext/follow/commit/033831bdab0a85a2f1f02af85c6da2278e40de5e))
@@ -613,6 +642,7 @@
* wait language load then switch to target language ([bbe4ea6](https://github.com/RSSNext/follow/commit/bbe4ea66e75a8911e9ef39764d02d22251ba743e))
* wallet table latyout ([6c60dd2](https://github.com/RSSNext/follow/commit/6c60dd265245d08d622c59d035d2124285ff68f1))
* **wallet:** add missing space between words in wallet ([#279](https://github.com/RSSNext/follow/issues/279)) ([6873d21](https://github.com/RSSNext/follow/commit/6873d21e267fda102b13bc2a4e52de9bd7eea206))
* **wallet:** balance align ([3a35a97](https://github.com/RSSNext/follow/commit/3a35a971f1435b6667b1a555b48a2556cf2c2782))
* win UI - feed claim modal ui & header readHistory ui ([#1019](https://github.com/RSSNext/follow/issues/1019)) ([77edf34](https://github.com/RSSNext/follow/commit/77edf34db7907de7679281f9f5e2467dad0959fa))
* window titlebar position, fixed [#197](https://github.com/RSSNext/follow/issues/197) ([b6158ec](https://github.com/RSSNext/follow/commit/b6158ec0bd1e18aed29d028f2ff86008489c8a64))
* windows app titlebar style in dark mode and radius ([3843905](https://github.com/RSSNext/follow/commit/38439050bb6db71bf6d966ab43026b660ad24f9a))
@@ -627,6 +657,8 @@
* **windows:** skip remove locle ([5df82d0](https://github.com/RSSNext/follow/commit/5df82d0c0f98bebb6e78a694a6ceda3644eb36ef))
* withdraw availableBalance ([2be9c93](https://github.com/RSSNext/follow/commit/2be9c93225b95d7515c0a590905865053442daac))
* withdraw availableBalance ([167d82a](https://github.com/RSSNext/follow/commit/167d82adc061078102fa9984d29f94735d052ce9))
* word break ([b0641ff](https://github.com/RSSNext/follow/commit/b0641ffe3f086850044fa371a9090076933ebd4c)), closes [#1117](https://github.com/RSSNext/follow/issues/1117)
* Wrong initial position of tab animation ([#1087](https://github.com/RSSNext/follow/issues/1087)) ([bb2b350](https://github.com/RSSNext/follow/commit/bb2b350fe71b353af0d1f612aba196291723ca14))
* wrong opening status of newly added feed ([#726](https://github.com/RSSNext/follow/issues/726)) ([2520ddb](https://github.com/RSSNext/follow/commit/2520ddb0f4f1923b729ae707a703713f1a158f06))
* wrong text wrap ([#316](https://github.com/RSSNext/follow/issues/316)) ([0cee7ef](https://github.com/RSSNext/follow/commit/0cee7eff25ed1058b108f1c7a9c643ea17b479c0))
* wtf, cursor deleted my code ([1852d1e](https://github.com/RSSNext/follow/commit/1852d1ee812567c473ff26d316b93d1ccf8e8a88))
@@ -649,6 +681,7 @@
* add BoostingContributors components to enhance boost functionality ([4d6b9ff](https://github.com/RSSNext/follow/commit/4d6b9fff9f92bfbd97b0834f25ec3d0dc7bfc3e2))
* add BoostProgress and LevelBenefits components for enhanced feed boost ([8db9ee3](https://github.com/RSSNext/follow/commit/8db9ee3f3e231666a2f8cd30f9042030268576a0))
* add bundleId to PushReceiver ([f196493](https://github.com/RSSNext/follow/commit/f196493b68a84489de93ac0c3944b039c79f25c0))
* add close button on image preview modal, closed [#1132](https://github.com/RSSNext/follow/issues/1132) ([6edbf10](https://github.com/RSSNext/follow/commit/6edbf10fcd4b410b6456f51693556816a0923516))
* add copy title to context menu of feed entry ([#801](https://github.com/RSSNext/follow/issues/801)) ([1f57ab2](https://github.com/RSSNext/follow/commit/1f57ab2ac76ef04aff37814b4c7e961ad33b6e11))
* add discover back to top fab ([a97e60c](https://github.com/RSSNext/follow/commit/a97e60cd005ca7ebb5aed56655b94975ebf1ccb7))
* add divider when sticky for date item ([755e292](https://github.com/RSSNext/follow/commit/755e292af05c3adeae8943cc5c4c05af11d30d16))
@@ -658,9 +691,11 @@
* add fallback image tip ([c244aab](https://github.com/RSSNext/follow/commit/c244aab0b77b2a143c4802552de486526e96f513))
* add getBoosters query to fetch boosters by feedId ([f4fbe81](https://github.com/RSSNext/follow/commit/f4fbe81bfea7c10dfed3314bddef4cd9a6fa18d2))
* add guess code lang option ([cbd8a72](https://github.com/RSSNext/follow/commit/cbd8a722b2940c4ad9092bfe4e08f850b8bc7c5d))
* add horizontal scroll functionality to TimelineTabs ([#1081](https://github.com/RSSNext/follow/issues/1081)) ([9778ce2](https://github.com/RSSNext/follow/commit/9778ce203713e715a7d877e3bc109a77e39bbbca))
* add i18n detector ([7eb8a32](https://github.com/RSSNext/follow/commit/7eb8a322c78c7e075ed842036971e9aa5f094341))
* add link parser for audio timestamp navigate ([1478fa5](https://github.com/RSSNext/follow/commit/1478fa5a9343384f45a57431d029480a96b8441c))
* add loading when Discover Inbox querying data ([#891](https://github.com/RSSNext/follow/issues/891)) ([30591f8](https://github.com/RSSNext/follow/commit/30591f8415068d748b5462257787d572065a3449))
* add login track ([522840b](https://github.com/RSSNext/follow/commit/522840b5d7ad192a0c15895b91647e7860804c5f))
* add manual setting lang lock keyu ([b9c6a8b](https://github.com/RSSNext/follow/commit/b9c6a8b58099c86a178494ffe4c875f7c31760a3))
* add missing words in zh-HK ([#610](https://github.com/RSSNext/follow/issues/610)) ([d34c1c9](https://github.com/RSSNext/follow/commit/d34c1c95d68445075987f833d29956b45e1036a3))
* add more words i18n ([#516](https://github.com/RSSNext/follow/issues/516)) ([e2b8ec8](https://github.com/RSSNext/follow/commit/e2b8ec88624ad1e8e7f6136a624fc284ae3fb77b))
@@ -677,6 +712,7 @@
* add setting user profile avatar preview ([2412d59](https://github.com/RSSNext/follow/commit/2412d59e3e91b327af102cc9f006e1022fa3b69e))
* add show all when filtered media mode ([38c21da](https://github.com/RSSNext/follow/commit/38c21dae11b84d1cb493078f999c7dac9b72d348))
* add support for pointer cursor ([#517](https://github.com/RSSNext/follow/issues/517)) ([b6ff6fb](https://github.com/RSSNext/follow/commit/b6ff6fb48f3133e10f8fc7598eaa9a7bc63aec25))
* add system-ui font selection to desktop app ([#1109](https://github.com/RSSNext/follow/issues/1109)) ([841126c](https://github.com/RSSNext/follow/commit/841126cfac3796ef3524c7cf13d4f6ee58dc3919))
* add theme in user dropmemu ([f254e14](https://github.com/RSSNext/follow/commit/f254e144ed6172f11250f3fd9bcbca3fbfc02add))
* add tts ([#215](https://github.com/RSSNext/follow/issues/215)) ([b9fecc4](https://github.com/RSSNext/follow/commit/b9fecc46bf523a0ad07a9a9dc26adf40287f7653))
* add view feed url on exteral feed url ([0a61fa3](https://github.com/RSSNext/follow/commit/0a61fa37c3df29b686c937f802202534ba79d602))
@@ -708,6 +744,7 @@
* context menu of adding feeds to lists ([afb79a2](https://github.com/RSSNext/follow/commit/afb79a27fba87d43e62ea06c3a64267ac3d7f4e4))
* context sub menu ([2d18c53](https://github.com/RSSNext/follow/commit/2d18c53de0cb8c99336d0e915941b1fdee36df98))
* copy logo svg ([512699c](https://github.com/RSSNext/follow/commit/512699c07080f3064f984f23a21e28356ef9fcc0))
* copywriting ([079ec27](https://github.com/RSSNext/follow/commit/079ec2723530a0765c5b12c95bb57c878b412033))
* **corner-player:** support now playing ([#717](https://github.com/RSSNext/follow/issues/717)) ([553f71b](https://github.com/RSSNext/follow/commit/553f71b1babb7a483fe8ddef741e281f1eb77730))
* custom feed title ([#300](https://github.com/RSSNext/follow/issues/300)) ([501e2f4](https://github.com/RSSNext/follow/commit/501e2f44c1d3eb9a1a316549faedb2e1288f7fbe))
* daily reward display ([78db8ad](https://github.com/RSSNext/follow/commit/78db8ad50f084bd3a68d64a73d026a1ad786ae63))
@@ -724,6 +761,7 @@
* display power purchase and tx ([dbe7aee](https://github.com/RSSNext/follow/commit/dbe7aee9151ee04147edbce7d34e1275edfc1254))
* display power ranking ([1150289](https://github.com/RSSNext/follow/commit/1150289d6433856359bcad8fbc94f8a03713e838))
* display subs and earn for lists list ([c0d2663](https://github.com/RSSNext/follow/commit/c0d2663df92d2935ec2ddc2010ecce95bb50d93a))
* display tax amount in balance renderer ([#1140](https://github.com/RSSNext/follow/issues/1140)) ([7e670a3](https://github.com/RSSNext/follow/commit/7e670a3f72b8d11000017e9d382466c935443017))
* double click to video fullscreen ([c066820](https://github.com/RSSNext/follow/commit/c066820ce8baeed808b788e9c780f75c53ba8909))
* dual code theme ([#511](https://github.com/RSSNext/follow/issues/511)) ([f278377](https://github.com/RSSNext/follow/commit/f278377d1017f9edf89c583a4fb24eb48451daf1))
* dynamic update relative time ([744422f](https://github.com/RSSNext/follow/commit/744422fc12050e09d3cb147c2affe5e95af2056b))
@@ -771,6 +809,7 @@
* **i18n:** add Russian language support ([#402](https://github.com/RSSNext/follow/issues/402)) ([0745ac0](https://github.com/RSSNext/follow/commit/0745ac07dd2a4a34e4251c034678ace15c302697))
* **i18n:** add Spanish language support ([#400](https://github.com/RSSNext/follow/issues/400)) ([6b7823d](https://github.com/RSSNext/follow/commit/6b7823d9b314509f209516b1d7412446ff4ac1a3))
* **i18n:** add zh-CN i18n for external page ([#399](https://github.com/RSSNext/follow/issues/399)) ([49a5c50](https://github.com/RSSNext/follow/commit/49a5c50236d51c3c728bb51cd19f34915291e59a))
* **i18n:** Added multiple text translations (zh-TW) ([#1130](https://github.com/RSSNext/follow/issues/1130)) ([10a59cb](https://github.com/RSSNext/follow/commit/10a59cb066a5f1b4e00027598456ff4ec93c784a))
* **i18n:** added Turkish language ([#544](https://github.com/RSSNext/follow/issues/544)) ([3751363](https://github.com/RSSNext/follow/commit/3751363d45af3096ccefb81bf60ac72040fce505))
* **i18n:** Chinese: Update `errors` ([#687](https://github.com/RSSNext/follow/issues/687)) ([368d232](https://github.com/RSSNext/follow/commit/368d23250817bb4033168d8736f8e0ed5cd9475f))
* **i18n:** Chinese: Update translation ([#679](https://github.com/RSSNext/follow/issues/679)) ([36593cc](https://github.com/RSSNext/follow/commit/36593cc05a1b94545266e65008ef4a52f80cfbfe))
@@ -832,6 +871,7 @@
* more achievemnt ([#964](https://github.com/RSSNext/follow/issues/964)) ([d18ed86](https://github.com/RSSNext/follow/commit/d18ed862244ec90de406c90e494eae019a6c3b8f))
* more excluded path params ([3d16aa9](https://github.com/RSSNext/follow/commit/3d16aa9f8b3b369a146537f19ab9a2fe230e9553))
* more i18n text ([6f8acce](https://github.com/RSSNext/follow/commit/6f8acced7bc51d2bb22325506e1c9bc97ee963f7))
* muti select action ([#1062](https://github.com/RSSNext/follow/issues/1062)) ([94ab663](https://github.com/RSSNext/follow/commit/94ab66366ad8e0f61341440ff00b305314e59a1f))
* native menu add `hide` prop ([8c6753d](https://github.com/RSSNext/follow/commit/8c6753d4a66d1e7ad09efcbbca24c8cf51ed8222))
* navigator bar ([56750fd](https://github.com/RSSNext/follow/commit/56750fd1722eaca7416e5c8617fb501fcf055cac))
* new design for mark read in date item ([e5b0583](https://github.com/RSSNext/follow/commit/e5b0583d38e41d81663bec1ee16e0c24cb385d7a))
-4
View File
@@ -30,8 +30,6 @@
"@mozilla/readability": "^0.5.0",
"@sentry/electron": "5.6.0",
"builder-util-runtime": "9.2.10",
"dayjs": "1.11.13",
"dotenv": "16.4.5",
"electron-context-menu": "4.0.4",
"electron-log": "5.2.0",
"electron-squirrel-startup": "1.0.1",
@@ -39,10 +37,8 @@
"font-list": "1.5.1",
"i18next": "^23.16.0",
"linkedom": "^0.18.5",
"lodash-es": "4.17.21",
"lowdb": "7.0.1",
"msedge-tts": "1.3.4",
"nanoid": "5.0.7",
"ofetch": "1.4.1",
"semver": "7.6.3",
"vscode-languagedetection": "npm:@vscode/vscode-languagedetection@^1.0.22"
+4 -2
View File
@@ -72,7 +72,9 @@ function bootstrap() {
userAgent = userAgent.replace(/\s?Electron\/[\d.]+/, "")
userAgent = userAgent.replace(/\s?Follow\/[\d.a-zA-Z-]+/, "")
}
details.requestHeaders["Origin"] = "https://app.follow.is"
if (env.VITE_OPENPANEL_API_URL && details.url.startsWith(env.VITE_OPENPANEL_API_URL)) {
details.requestHeaders["Origin"] = "https://app.follow.is"
}
details.requestHeaders["User-Agent"] = userAgent
callback({ cancel: false, requestHeaders: details.requestHeaders })
})
@@ -121,7 +123,7 @@ function bootstrap() {
app.on("before-quit", () => {
// store window pos when before app quit
const window = getMainWindow()
if (!window) return
if (!window || window.isDestroyed()) return
const bounds = window.getBounds()
store.set(windowStateStoreKey, {
+1 -1
View File
@@ -241,7 +241,7 @@ export const appRoute = {
try {
const { url, title, content, author, publishedAt, vaultPath } = input
const fileName = `${(title || publishedAt).trim().slice(0, 20)}.md`
const fileName = `${(title || publishedAt).trim().slice(0, 20).replaceAll("/", "-")}.md`
const filePath = path.join(vaultPath, fileName)
const exists = fs.existsSync(filePath)
if (exists) {
+13 -16
View File
@@ -4,6 +4,7 @@
"private": true,
"main": "./dist/main/index.js",
"scripts": {
"dev": "cd ../.. && pnpm dev:web",
"test": "vitest",
"typecheck": "tsc --noEmit"
},
@@ -16,39 +17,28 @@
"@headlessui/react": "2.1.10",
"@hono/auth-js": "1.0.11",
"@hookform/resolvers": "3.9.0",
"@iconify/tools": "4.0.7",
"@lottiefiles/dotlottie-react": "0.9.1",
"@microflash/remark-callout-directives": "4.3.1",
"@mozilla/readability": "^0.5.0",
"@openpanel/web": "1.0.1",
"@radix-ui/react-avatar": "1.1.1",
"@radix-ui/react-checkbox": "1.1.2",
"@radix-ui/react-context-menu": "2.2.2",
"@radix-ui/react-dialog": "1.1.2",
"@radix-ui/react-dropdown-menu": "2.1.2",
"@radix-ui/react-hover-card": "1.1.2",
"@radix-ui/react-label": "2.1.0",
"@radix-ui/react-popover": "1.1.2",
"@radix-ui/react-radio-group": "1.2.1",
"@radix-ui/react-scroll-area": "1.2.0",
"@radix-ui/react-select": "2.1.2",
"@radix-ui/react-slider": "^1.2.1",
"@radix-ui/react-slot": "1.1.0",
"@radix-ui/react-switch": "1.1.1",
"@radix-ui/react-tabs": "1.1.1",
"@radix-ui/react-toast": "1.2.2",
"@radix-ui/react-tooltip": "1.1.3",
"@sentry/react": "8.34.0",
"@shikijs/transformers": "1.22.0",
"@t3-oss/env-core": "^0.11.1",
"@tanstack/query-sync-storage-persister": "5.59.13",
"@tanstack/react-query": "5.59.14",
"@tanstack/react-query-devtools": "5.59.14",
"@tanstack/react-query-persist-client": "5.59.14",
"@use-gesture/react": "10.3.1",
"@welldone-software/why-did-you-render": "8.0.3",
"@yornaath/batshit": "0.10.1",
"camelcase-keys": "9.1.3",
"class-variance-authority": "0.7.0",
"click-to-react-component": "1.1.0",
"clsx": "2.1.1",
"cmdk": "1.0.0",
@@ -62,6 +52,7 @@
"franc-min": "6.2.0",
"fuse.js": "7.0.0",
"hast-util-to-jsx-runtime": "2.3.2",
"hast-util-to-mdast": "^10.1.0",
"hast-util-to-text": "4.0.2",
"i18next": "^23.16.0",
"i18next-browser-languagedetector": "8.0.0",
@@ -72,12 +63,13 @@
"lethargy": "1.0.9",
"lodash-es": "4.17.21",
"masonic": "4.0.1",
"mdast-util-to-markdown": "^2.1.0",
"nanoid": "5.0.7",
"ofetch": "1.4.1",
"path-to-regexp": "8.2.0",
"re-resizable": "6.10.0",
"react-blurhash": "^0.3.0",
"react-error-boundary": "4.0.13",
"react-error-boundary": "4.1.2",
"react-fast-marquee": "1.6.5",
"react-hook-form": "7.53.0",
"react-hotkeys-hook": "4.5.1",
@@ -85,7 +77,7 @@
"react-intersection-observer": "9.13.1",
"react-resizable-layout": "npm:@innei/react-resizable-layout@0.7.3-fork.1",
"react-router-dom": "6.27.0",
"react-selecto": "1.26.3",
"react-selecto": "^1.26.3",
"react-shadow": "20.5.0",
"react-virtuoso": "4.12.0",
"rehype-infer-description-meta": "2.0.0",
@@ -100,8 +92,6 @@
"shiki": "1.22.0",
"sonner": "^1.5.0",
"swiper": "11.1.14",
"tailwind-merge": "2.5.4",
"tailwindcss-motion": "0.3.0-beta",
"tldts": "6.1.51",
"unified": "11.0.5",
"use-context-selector": "2.0.0",
@@ -113,7 +103,14 @@
},
"devDependencies": {
"@babel/generator": "7.25.7",
"@follow/atoms": "workspace:*",
"@follow/components": "workspace:*",
"@follow/constants": "workspace:*",
"@follow/hooks": "workspace:*",
"@follow/models": "workspace:*",
"@follow/shared": "workspace:*",
"@follow/types": "workspace:*",
"@follow/utils": "workspace:*",
"@hono/node-server": "1.13.2",
"@types/katex": "0.16.7",
"@types/lodash-es": "4.17.12",
+1 -1
View File
@@ -1,4 +1,5 @@
import { IN_ELECTRON } from "@follow/shared/constants"
import { cn, getOS } from "@follow/utils/utils"
import { useEffect, useLayoutEffect } from "react"
import { Outlet } from "react-router-dom"
@@ -9,7 +10,6 @@ import { useUISettingKey } from "./atoms/settings/ui"
import { navigateEntry } from "./hooks/biz/useNavigateEntry"
import { applyAfterReadyCallbacks } from "./initialize/queue"
import { appLog } from "./lib/log"
import { cn, getOS } from "./lib/utils"
import { Titlebar } from "./modules/app/Titlebar"
import { RootProviders } from "./providers/root-providers"
import { handlers } from "./tipc"
+1 -1
View File
@@ -1,7 +1,7 @@
import type { Models } from "@follow/models"
import camelcaseKeys from "camelcase-keys"
import { apiFetch } from "~/lib/api-fetch"
import type { Models } from "~/models"
const v1ApiPrefix = "/v1"
export const getTrendingAggregates = async () => {
+1 -1
View File
@@ -1,7 +1,7 @@
import { getStorageNS } from "@follow/utils/ns"
import { atomWithStorage } from "jotai/utils"
import { createAtomHooks } from "~/lib/jotai"
import { getStorageNS } from "~/lib/ns"
type CornerPlayerAtomValue = {
show: boolean
-27
View File
@@ -1,27 +0,0 @@
import type { ExtractAtomValue } from "jotai"
import { useAtomValue } from "jotai"
import { selectAtom } from "jotai/utils"
import { useCallback } from "react"
import { jotaiStore } from "~/lib/jotai"
import { viewportAtom } from "../viewport"
export const useViewport = <T>(selector: (value: ExtractAtomValue<typeof viewportAtom>) => T): T =>
useAtomValue(
selectAtom(
viewportAtom,
useCallback((atomValue) => selector(atomValue), []),
),
)
export const useIsMobile = () =>
useViewport(useCallback((v: ExtractAtomValue<typeof viewportAtom>) => isMobile(v), []))
const isMobile = (v: ExtractAtomValue<typeof viewportAtom>) => (v.sm || v.md || !v.sm) && !v.lg
export const currentIsMobile = () => {
const v = jotaiStore.get(viewportAtom)
return isMobile(v)
}
export const getViewport = () => jotaiStore.get(viewportAtom)
+1 -1
View File
@@ -1,10 +1,10 @@
import { getStorageNS } from "@follow/utils/ns"
import { noop } from "foxact/noop"
import { atomWithStorage, createJSONStorage } from "jotai/utils"
import type { SyncStorage } from "jotai/vanilla/utils/atomWithStorage"
import { getRouteParams } from "~/hooks/biz/useRouteParams"
import { createAtomHooks } from "~/lib/jotai"
import { getStorageNS } from "~/lib/ns"
type PlayerAtomValue = {
show: boolean
-41
View File
@@ -1,41 +0,0 @@
import { atom, useAtomValue } from "jotai"
import { selectAtom } from "jotai/utils"
import { useMemo } from "react"
import type { Location, NavigateFunction, Params } from "react-router-dom"
import { createAtomHooks } from "~/lib/jotai"
interface RouteAtom {
params: Readonly<Params<string>>
searchParams: URLSearchParams
location: Location<any>
}
export const [routeAtom, , , , getReadonlyRoute, setRoute] = createAtomHooks(
atom<RouteAtom>({
params: {},
searchParams: new URLSearchParams(),
location: {
pathname: "",
search: "",
hash: "",
state: null,
key: "",
},
}),
)
const noop = []
export const useReadonlyRouteSelector = <T>(
selector: (route: RouteAtom) => T,
deps: any[] = noop,
): T => useAtomValue(useMemo(() => selectAtom(routeAtom, (route) => selector(route)), deps))
// Vite HMR will create new router instance, but RouterProvider always stable
const [, , , , navigate, setNavigate] = createAtomHooks(
atom<{ fn: NavigateFunction | null }>({ fn() {} }),
)
const getStableRouterNavigate = () => navigate().fn
export { getStableRouterNavigate, setNavigate }
+1 -1
View File
@@ -1,7 +1,7 @@
import type { ServerConfigs } from "@follow/models/types"
import { atom } from "jotai"
import { createAtomHooks } from "~/lib/jotai"
import type { ServerConfigs } from "~/models"
export const [, , useServerConfigs, , getServerConfigs, setServerConfigs] = createAtomHooks(
atom<Nullable<ServerConfigs>>(null),
+1 -2
View File
@@ -1,9 +1,8 @@
import { createSettingAtom } from "@follow/atoms/helper/setting.js"
import type { GeneralSettings } from "@follow/shared/interface/settings"
import { jotaiStore } from "~/lib/jotai"
import { createSettingAtom } from "./helper"
const createDefaultSettings = (): GeneralSettings => ({
// App
appLaunchOnStartup: false,
-155
View File
@@ -1,155 +0,0 @@
import { useAtomValue } from "jotai"
import { atomWithStorage, selectAtom } from "jotai/utils"
import { useMemo } from "react"
import { useRefValue } from "~/hooks/common"
import { EventBus } from "~/lib/event-bus"
import { createAtomHooks } from "~/lib/jotai"
import { getStorageNS } from "~/lib/ns"
import type { SettingItem } from "~/modules/settings/setting-builder"
import { createSettingBuilder } from "~/modules/settings/setting-builder"
declare module "~/lib/event-bus" {
interface CustomEvent {
SETTING_CHANGE_EVENT: {
updated: number
payload: Record<string, any>
key: string
}
}
}
export const createSettingAtom = <T extends object>(
settingKey: string,
createDefaultSettings: () => T,
) => {
const atom = atomWithStorage(getStorageNS(settingKey), createDefaultSettings(), undefined, {
getOnInit: true,
})
const [, , useSettingValue, , getSettings, setSettings] = createAtomHooks(atom)
const initializeDefaultSettings = () => {
const currentSettings = getSettings()
const defaultSettings = createDefaultSettings()
if (typeof currentSettings !== "object") setSettings(defaultSettings)
const newSettings = { ...defaultSettings, ...currentSettings }
setSettings(newSettings)
}
const selectAtomCacheMap = {} as Record<keyof ReturnType<typeof getSettings>, any>
const useSettingKey = <T extends keyof ReturnType<typeof getSettings>>(key: T) => {
let selectedAtom = selectAtomCacheMap[key]
if (!selectedAtom) {
selectedAtom = selectAtom(atom, (s) => s[key])
selectAtomCacheMap[key] = selectedAtom
}
return useAtomValue(selectedAtom) as ReturnType<typeof getSettings>[T]
}
const useSettingSelector = <
T extends keyof ReturnType<typeof getSettings>,
S extends ReturnType<typeof getSettings>,
R = S[T],
>(
selector: (s: S) => R,
): R => {
const stableSelector = useRefValue(selector)
return useAtomValue(
// @ts-expect-error
useMemo(() => selectAtom(atom, stableSelector.current), [stableSelector]),
)
}
const setSetting = <K extends keyof ReturnType<typeof getSettings>>(
key: K,
value: ReturnType<typeof getSettings>[K],
) => {
const updated = Date.now()
setSettings({
...getSettings(),
[key]: value,
updated,
})
EventBus.dispatch("SETTING_CHANGE_EVENT", {
payload: { [key]: value },
updated,
key: settingKey,
})
}
const clearSettings = () => {
setSettings(createDefaultSettings())
}
Object.defineProperty(useSettingValue, "select", {
value: useSettingSelector,
})
return {
useSettingKey,
useSettingSelector,
setSetting,
clearSettings,
initializeDefaultSettings,
useSettingValue,
getSettings,
settingAtom: atom,
} as {
useSettingKey: typeof useSettingKey
useSettingSelector: typeof useSettingSelector
setSetting: typeof setSetting
clearSettings: typeof clearSettings
initializeDefaultSettings: typeof initializeDefaultSettings
useSettingValue: typeof useSettingValue & {
select: <T extends keyof ReturnType<() => T>>(key: T) => Awaited<T[T]>
}
getSettings: typeof getSettings
settingAtom: typeof atom
}
}
export const createDefineSettingItem =
<T>(_getSetting: () => T, setSetting: (key: any, value: Partial<T>) => void) =>
<K extends keyof T>(
key: K,
options: {
label: string
description?: string | JSX.Element
onChange?: (value: T[K]) => void
hide?: boolean
} & Omit<SettingItem<any>, "onChange" | "description" | "label" | "hide" | "key">,
): any => {
const { label, description, onChange, hide, ...rest } = options
return {
key,
label,
description,
onChange: (value: any) => {
if (onChange) return onChange(value as any)
setSetting(key, value as any)
},
disabled: hide,
...rest,
} as SettingItem<any>
}
export const createSetting = <T extends object>(
useSetting: () => T,
setSetting: (key: any, value: Partial<T>) => void,
) => {
const SettingBuilder = createSettingBuilder(useSetting)
const defineSettingItem = createDefineSettingItem(useSetting, setSetting)
return {
SettingBuilder,
defineSettingItem,
}
}
@@ -1,7 +1,6 @@
import { createSettingAtom } from "@follow/atoms/helper/setting.js"
import type { IntegrationSettings } from "@follow/shared/interface/settings"
import { createSettingAtom } from "./helper"
export const createDefaultSettings = (): IntegrationSettings => ({
// eagle
enableEagle: true,
+1 -2
View File
@@ -1,7 +1,6 @@
import { createSettingAtom } from "@follow/atoms/helper/setting.js"
import type { UISettings } from "@follow/shared/interface/settings"
import { createSettingAtom } from "./helper"
export const createDefaultSettings = (): UISettings => ({
// Sidebar
entryColWidth: 356,
+1 -1
View File
@@ -1,7 +1,7 @@
import { FeedViewType } from "@follow/constants"
import { atom } from "jotai"
import { getRouteParams } from "~/hooks/biz/useRouteParams"
import { FeedViewType } from "~/lib/enum"
import { createAtomHooks } from "~/lib/jotai"
const defaultFeedView = FeedViewType.Articles
+1 -1
View File
@@ -1,7 +1,7 @@
import { atom } from "jotai"
import { useCallback } from "react"
import { useModalStack } from "~/components/ui/modal"
import { useModalStack } from "~/components/ui/modal/stacked/hooks"
import { createAtomHooks } from "~/lib/jotai"
import { SourceContentView } from "~/modules/entry-content/components/SourceContentView"
+1 -1
View File
@@ -1,7 +1,7 @@
import { getStorageNS } from "@follow/utils/ns"
import { atomWithStorage } from "jotai/utils"
import { createAtomHooks } from "~/lib/jotai"
import { getStorageNS } from "~/lib/ns"
export const [, , useUpdaterStatus, , , setUpdaterStatus] = createAtomHooks(
atomWithStorage(getStorageNS("updater"), false, undefined, {
+1 -1
View File
@@ -1,7 +1,7 @@
import type { User } from "@auth/core/types"
import type { UserRole } from "@follow/constants"
import { atom } from "jotai"
import type { UserRole } from "~/lib/enum"
import { createAtomHooks } from "~/lib/jotai"
export const [, , useWhoami, , whoami, setWhoami] = createAtomHooks(atom<Nullable<User>>(null))
-31
View File
@@ -1,31 +0,0 @@
import { atom } from "jotai"
export const viewportAtom = atom({
/**
* 640px
*/
sm: false,
/**
* 768px
*/
md: false,
/**
* 1024px
*/
lg: false,
/**
* 1280px
*/
xl: false,
/**
* 1536px
*/
"2xl": false,
h: 0,
w: 0,
})
@@ -1,3 +1,4 @@
import { Button } from "@follow/components/ui/button/index.js"
import { captureException } from "@sentry/react"
import { useEffect, useRef } from "react"
import { isRouteErrorResponse, useNavigate, useRouteError } from "react-router-dom"
@@ -7,7 +8,6 @@ import { attachOpenInEditor } from "~/lib/dev"
import { getNewIssueUrl } from "~/lib/issues"
import { clearLocalPersistStoreData } from "~/store/utils/clear"
import { Button } from "../ui/button"
import { PoweredByFooter } from "./PoweredByFooter"
export function ErrorElement() {
@@ -1,7 +1,6 @@
import { LoadingCircle } from "@follow/components/ui/loading/index.jsx"
import { useInView } from "react-intersection-observer"
import { LoadingCircle } from "../ui/loading"
export const LoadMoreIndicator: Component<{
onLoading: () => void
}> = ({ onLoading, children, className }) => {
@@ -1,8 +1,7 @@
import { LoadingCircle } from "@follow/components/ui/loading/index.jsx"
import type { FC, ReactNode } from "react"
import { createElement, useEffect, useState } from "react"
import { LoadingCircle } from "../ui/loading"
export const LoadRemixAsyncComponent: FC<{
loader: () => Promise<any>
Header: FC<{ loader: () => any; [key: string]: any }>
@@ -1,19 +0,0 @@
import type { FC } from "react"
import { memo, useMemo } from "react"
export const MemoedDangerousHTMLStyle: FC<
{
children: string
} & React.DetailedHTMLProps<React.StyleHTMLAttributes<HTMLStyleElement>, HTMLStyleElement> &
Record<string, unknown>
> = memo(({ children, ...rest }) => (
<style
{...rest}
dangerouslySetInnerHTML={useMemo(
() => ({
__html: children,
}),
[children],
)}
/>
))
@@ -1,3 +1,5 @@
import { Logo } from "@follow/components/icons/logo.jsx"
import { Button } from "@follow/components/ui/button/index.js"
import { captureException } from "@sentry/react"
import { useEffect } from "react"
import type { Location } from "react-router-dom"
@@ -5,8 +7,6 @@ import { useLocation, useNavigate } from "react-router-dom"
import { isElectronBuild } from "~/constants"
import { Logo } from "../icons/logo"
import { Button } from "../ui/button"
import { PoweredByFooter } from "./PoweredByFooter"
class AccessNotFoundError extends Error {
@@ -1,9 +1,7 @@
import { Logo } from "@follow/components/icons/logo.jsx"
import { cn } from "@follow/utils/utils"
import pkg from "@pkg"
import { cn } from "~/lib/utils"
import { Logo } from "../icons/logo"
export const PoweredByFooter: Component = ({ className }) => (
<footer className={cn("center mt-12 flex gap-2", className)}>
Powered by <Logo className="size-5" />{" "}
@@ -1,3 +1,5 @@
import { MemoedDangerousHTMLStyle } from "@follow/components/common/MemoedDangerousHTMLStyle.js"
import { useIsDark } from "@follow/hooks"
import { nanoid } from "nanoid"
import type { FC, PropsWithChildren, ReactNode } from "react"
import { createContext, createElement, useContext, useLayoutEffect, useMemo, useState } from "react"
@@ -5,9 +7,6 @@ import root from "react-shadow"
import { useUISettingKey } from "~/atoms/settings/ui"
import { useReduceMotion } from "~/hooks/biz/useReduceMotion"
import { useIsDark } from "~/hooks/common"
import { MemoedDangerousHTMLStyle } from "./MemoedDangerousHTMLStyle"
const ShadowDOMContext = createContext(false)
@@ -1,16 +1,16 @@
import { Button } from "@follow/components/ui/button/index.js"
import type { FeedModel } from "@follow/models/types"
import { nextFrame } from "@follow/utils/dom"
import type { FC } from "react"
import { useNavigate } from "react-router-dom"
import { getSidebarActiveView } from "~/atoms/sidebar"
import { getRouteParams } from "~/hooks/biz/useRouteParams"
import { nextFrame } from "~/lib/dom"
import type { FeedModel } from "~/models"
import { FeedForm } from "~/modules/discover/feed-form"
import { entries } from "~/queries/entries"
import type { AppErrorFallbackProps } from "../common/AppErrorBoundary"
import { Button } from "../ui/button"
import { useModalStack } from "../ui/modal"
import { useModalStack } from "../ui/modal/stacked/hooks"
import { CustomSafeError, useResetErrorWhenRouteChange } from "./helper"
import { FeedPreview } from "./previews/FeedPreview"
@@ -1,9 +1,9 @@
import { Logo } from "@follow/components/icons/logo.jsx"
import { Button } from "@follow/components/ui/button/index.js"
import type { FC } from "react"
import { useNavigate } from "react-router-dom"
import type { AppErrorFallbackProps } from "../common/AppErrorBoundary"
import { Logo } from "../icons/logo"
import { Button } from "../ui/button"
import { CustomSafeError, useResetErrorWhenRouteChange } from "./helper"
const FeedNotFoundErrorFallback: FC<AppErrorFallbackProps> = ({ resetError, error }) => {
@@ -1,3 +1,4 @@
import { Button } from "@follow/components/ui/button/index.js"
import type { FC } from "react"
import { attachOpenInEditor } from "~/lib/dev"
@@ -5,8 +6,7 @@ import { attachOpenInEditor } from "~/lib/dev"
import type { AppErrorFallbackProps } from "../common/AppErrorBoundary"
import { FeedbackIssue } from "../common/ErrorElement"
import { m } from "../common/Motion"
import { Button } from "../ui/button"
import { useCurrentModal } from "../ui/modal"
import { useCurrentModal } from "../ui/modal/stacked/hooks"
import { parseError } from "./helper"
const ModalErrorFallback: FC<AppErrorFallbackProps> = (props) => {
@@ -1,10 +1,10 @@
import { Button } from "@follow/components/ui/button/index.js"
import type { FC } from "react"
import { attachOpenInEditor } from "~/lib/dev"
import type { AppErrorFallbackProps } from "../common/AppErrorBoundary"
import { FeedbackIssue } from "../common/ErrorElement"
import { Button } from "../ui/button"
import { parseError, useResetErrorWhenRouteChange } from "./helper"
const PageErrorFallback: FC<AppErrorFallbackProps> = (props) => {
@@ -1,8 +1,8 @@
import { nextFrame } from "@follow/utils/dom"
import type { FC } from "react"
import { createElement, useEffect, useRef } from "react"
import { useLocation } from "react-router-dom"
import { nextFrame } from "~/lib/dom"
import { createErrorToaster } from "~/lib/error-parser"
import type { AppErrorFallbackProps } from "../common/AppErrorBoundary"
@@ -1,16 +1,16 @@
import { LoadingCircle } from "@follow/components/ui/loading/index.jsx"
import type { FeedViewType } from "@follow/constants"
import { views } from "@follow/constants"
import type { FeedModel } from "@follow/models/types"
import { cn } from "@follow/utils/utils"
import type { FC } from "react"
import { useTranslation } from "react-i18next"
import { useSearchParams } from "react-router-dom"
import { FeedCertification } from "~/components/feed-certification"
import { FeedIcon } from "~/components/feed-icon"
import { LoadingCircle } from "~/components/ui/loading"
import { views } from "~/constants"
import type { FeedViewType } from "~/lib/enum"
import { cn } from "~/lib/utils"
import type { FeedModel } from "~/models"
import { getItemComponentByView } from "~/modules/entry-column/Items"
import type { UniversalItemProps } from "~/modules/entry-column/types"
import { FeedCertification } from "~/modules/feed/feed-certification"
import { FeedIcon } from "~/modules/feed/feed-icon"
import { useEntriesPreview } from "~/queries/entries"
import { useFeed } from "~/queries/feed"
-95
View File
@@ -1,95 +0,0 @@
import type { MotionValue } from "framer-motion"
import { useMotionValueEvent, useScroll } from "framer-motion"
import type { FC } from "react"
import { cloneElement, useState } from "react"
import { useTranslation } from "react-i18next"
import { Link } from "react-router-dom"
import { whoami } from "~/atoms/user"
import { cn } from "~/lib/utils"
import { usePresentUserProfileModal } from "~/modules/profile/hooks"
import { UserAvatar } from "../modules/user/UserAvatar"
import { FollowIcon } from "./icons/follow"
import { Logo } from "./icons/logo"
const useMotionValueToState = (value: MotionValue<number>) => {
const [state, setState] = useState(value.get())
useMotionValueEvent(value, "change", (v) => setState(v))
return state
}
export function Header() {
const present = usePresentUserProfileModal()
const { t } = useTranslation("external")
const { scrollY } = useScroll()
const scrollYState = useMotionValueToState(scrollY)
return (
<header className="fixed inset-x-0 top-0 z-[99] px-5 py-2 xl:px-0">
<div className="relative mx-auto my-4 flex w-full max-w-[1240px] items-center justify-between">
<div
className="absolute inset-0 z-0 -mx-3 -my-2 rounded-full bg-slate-50/80 backdrop-blur-lg dark:bg-neutral-900/80 xl:-mx-8"
style={{
opacity: scrollYState / 100,
}}
/>
<div className="relative z-10 flex w-full items-center justify-between gap-8 px-3">
<div className="flex grow items-center gap-8">
<div className="flex items-center gap-2 text-xl font-bold">
<Logo className="size-8" />
</div>
<div className="mx-6 hidden gap-12 text-sm font-medium lg:flex [&>div]:hover:cursor-pointer">
<HoverableLink
href="/"
icon={<FollowIcon className="!size-3" />}
label={t("header.app")}
/>
<HoverableLink
href="https://github.com/RSSNext/follow/releases"
icon={<i className="i-mgc-download-2-cute-fi" />}
label={t("header.download")}
/>
</div>
</div>
<button
className="cursor-pointer"
type="button"
onClick={() => {
present(whoami()?.id)
}}
>
<UserAvatar className="h-10 bg-transparent p-0" hideName />
</button>
</div>
</div>
</header>
)
}
const HoverableLink: FC<{
label: string
icon: React.JSX.Element
href: string
className?: string
}> = ({ icon, label, href, className }) => (
<Link
to={href}
target={href.startsWith("http") ? "_blank" : undefined}
className={cn("group center flex gap-3 duration-200 hover:text-accent", className)}
>
<span className="center">
{cloneElement(icon, { className: `size-4 ${icon.props.className}` })}
</span>
<span className="inline-flex h-[1.5em] flex-col overflow-hidden leading-[1.5em]">
<span className="inline-flex flex-col gap-2 duration-200 group-hover:translate-y-[calc(-50%-0.25em)]">
<span>{label}</span>
<span>{label}</span>
</span>
</span>
</Link>
)
@@ -1,78 +0,0 @@
import type { SVGProps } from "react"
export function MdiLanguageTypescript(props: SVGProps<SVGSVGElement>) {
return (
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" {...props}>
<path
fill="currentColor"
d="M3 3h18v18H3zm10.71 14.86c.5.98 1.51 1.73 3.09 1.73c1.6 0 2.8-.83 2.8-2.36c0-1.41-.81-2.04-2.25-2.66l-.42-.18c-.73-.31-1.04-.52-1.04-1.02c0-.41.31-.73.81-.73c.48 0 .8.21 1.09.73l1.31-.87c-.55-.96-1.33-1.33-2.4-1.33c-1.51 0-2.48.96-2.48 2.23c0 1.38.81 2.03 2.03 2.55l.42.18c.78.34 1.24.55 1.24 1.13c0 .48-.45.83-1.15.83c-.83 0-1.31-.43-1.67-1.03zM13 11.25H8v1.5h1.5V20h1.75v-7.25H13z"
/>
</svg>
)
}
export function UilReact(props: SVGProps<SVGSVGElement>) {
return (
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" {...props}>
<path
fill="currentColor"
d="M11.103 10.438a1.786 1.786 0 1 0 2.44.654a1.786 1.786 0 0 0-2.44-.654m8.005 1.938q-.176-.201-.371-.403q.136-.144.264-.287c1.605-1.804 2.283-3.614 1.655-4.701c-.602-1.043-2.393-1.354-4.636-.918q-.331.065-.659.146q-.063-.216-.133-.43C14.467 3.49 13.238 1.999 11.982 2c-1.204 0-2.368 1.397-3.111 3.558q-.11.32-.203.644q-.219-.054-.44-.1c-2.366-.485-4.271-.165-4.898.924c-.601 1.043.027 2.75 1.528 4.472q.224.255.46.5c-.186.19-.361.381-.525.571c-1.465 1.698-2.057 3.376-1.457 4.415c.62 1.074 2.498 1.425 4.785.975q.278-.055.553-.124q.1.351.221.697C9.635 20.649 10.792 22 11.992 22c1.24 0 2.482-1.453 3.235-3.659c.06-.174.115-.355.169-.541q.355.088.715.156c2.203.417 3.952.09 4.551-.95c.619-1.075-.02-2.877-1.554-4.63M4.07 7.452c.386-.67 1.943-.932 3.986-.512q.196.04.399.09a20.464 20.464 0 0 0-.422 2.678A20.887 20.887 0 0 0 5.93 11.4q-.219-.227-.427-.465C4.216 9.461 3.708 8.081 4.07 7.452m3.887 5.728c-.51-.387-.985-.783-1.416-1.181c.43-.396.905-.79 1.415-1.176q-.028.589-.027 1.179q0 .59.028 1.178m0 3.94a7.237 7.237 0 0 1-2.64.094a1.766 1.766 0 0 1-1.241-.657c-.365-.63.111-1.978 1.364-3.43q.236-.273.488-.532a20.49 20.49 0 0 0 2.107 1.7a20.802 20.802 0 0 0 .426 2.712q-.25.063-.505.114m7.1-8.039q-.503-.317-1.018-.613q-.508-.292-1.027-.563a18.7 18.7 0 0 1 1.739-.635a18.218 18.218 0 0 1 .306 1.811M9.68 5.835c.636-1.85 1.578-2.98 2.304-2.98c.773-.001 1.777 1.218 2.434 3.197q.064.194.12.39a20.478 20.478 0 0 0-2.526.97a20.061 20.061 0 0 0-2.52-.981q.087-.3.188-.596m-.4 1.424a18.307 18.307 0 0 1 1.73.642q-1.052.542-2.048 1.181c.08-.638.187-1.249.318-1.823m-.317 7.66q.497.319 1.009.613q.522.3 1.057.576a18.196 18.196 0 0 1-1.744.665a19.144 19.144 0 0 1-.322-1.853m5.456 3.146a7.236 7.236 0 0 1-1.238 2.333a1.766 1.766 0 0 1-1.188.748c-.729 0-1.658-1.085-2.29-2.896q-.112-.321-.206-.648a20.109 20.109 0 0 0 2.53-1.01a20.8 20.8 0 0 0 2.547.979q-.072.249-.155.494m.362-1.324a19.267 19.267 0 0 1-1.762-.646q.509-.267 1.025-.565q.53-.306 1.032-.627a18.152 18.152 0 0 1-.295 1.838m.447-4.743q0 .911-.057 1.82c-.493.334-1.013.66-1.554.972c-.54.311-1.073.597-1.597.856q-.827-.396-1.622-.854q-.79-.455-1.544-.969q-.07-.91-.07-1.822q0-.911.068-1.821a24.168 24.168 0 0 1 3.158-1.823q.816.397 1.603.851q.79.454 1.55.959q.065.914.065 1.831m.956-5.093c1.922-.373 3.37-.122 3.733.507c.387.67-.167 2.148-1.554 3.706q-.115.129-.238.259a20.061 20.061 0 0 0-2.144-1.688a20.04 20.04 0 0 0-.405-2.649q.31-.076.608-.135m-.13 3.885a18.164 18.164 0 0 1 1.462 1.188a18.12 18.12 0 0 1-1.457 1.208q.023-.594.023-1.188q0-.604-.028-1.208m3.869 5.789c-.364.631-1.768.894-3.653.538q-.324-.061-.664-.146a20.069 20.069 0 0 0 .387-2.682a19.94 19.94 0 0 0 2.137-1.715q.177.183.336.364a7.234 7.234 0 0 1 1.403 2.238a1.766 1.766 0 0 1 .054 1.403"
/>
</svg>
)
}
export function MdiLanguageJavascript(props: SVGProps<SVGSVGElement>) {
return (
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" {...props}>
<path
fill="currentColor"
d="M3 3h18v18H3zm4.73 15.04c.4.85 1.19 1.55 2.54 1.55c1.5 0 2.53-.8 2.53-2.55v-5.78h-1.7V17c0 .86-.35 1.08-.9 1.08c-.58 0-.82-.4-1.09-.87zm5.98-.18c.5.98 1.51 1.73 3.09 1.73c1.6 0 2.8-.83 2.8-2.36c0-1.41-.81-2.04-2.25-2.66l-.42-.18c-.73-.31-1.04-.52-1.04-1.02c0-.41.31-.73.81-.73c.48 0 .8.21 1.09.73l1.31-.87c-.55-.96-1.33-1.33-2.4-1.33c-1.51 0-2.48.96-2.48 2.23c0 1.38.81 2.03 2.03 2.55l.42.18c.78.34 1.24.55 1.24 1.13c0 .48-.45.83-1.15.83c-.83 0-1.31-.43-1.67-1.03z"
/>
</svg>
)
}
export function MdiBash(props: SVGProps<SVGSVGElement>) {
return (
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" {...props}>
<path
fill="currentColor"
d="M5 9h2.31l.32-3h2l-.32 3h2l.32-3h2l-.32 3H15v2h-1.9l-.2 2H15v2h-2.31l-.32 3h-2l.32-3h-2l-.32 3h-2l.32-3H5v-2h1.9l.2-2H5zm4.1 2l-.2 2h2l.2-2M19 6h-2v8h2m0 2h-2v2h2Z"
/>
</svg>
)
}
export function MdiLanguageCss3(props: SVGProps<SVGSVGElement>) {
return (
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" {...props}>
<path
fill="currentColor"
d="m5 3l-.65 3.34h13.59L17.5 8.5H3.92l-.66 3.33h13.59l-.76 3.81l-5.48 1.81l-4.75-1.81l.33-1.64H2.85l-.79 4l7.85 3l9.05-3l1.2-6.03l.24-1.21L21.94 3z"
/>
</svg>
)
}
export function MdiLanguageHtml5(props: SVGProps<SVGSVGElement>) {
return (
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" {...props}>
<path
fill="currentColor"
d="m12 17.56l4.07-1.13l.55-6.1H9.38L9.2 8.3h7.6l.2-1.99H7l.56 6.01h6.89l-.23 2.58l-2.22.6l-2.22-.6l-.14-1.66h-2l.29 3.19zM4.07 3h15.86L18.5 19.2L12 21l-6.5-1.8z"
/>
</svg>
)
}
export function RiMarkdownFill(props: SVGProps<SVGSVGElement>) {
return (
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" {...props}>
<path
fill="currentColor"
d="M3 3h18a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1m4 12.5v-4l2 2l2-2v4h2v-7h-2l-2 2l-2-2H5v7zm11-3v-4h-2v4h-2l3 3l3-3z"
/>
</svg>
)
}
@@ -1,11 +0,0 @@
import type { SVGProps } from "react"
export function OouiUserAnonymous(props: SVGProps<SVGSVGElement>) {
return (
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 20 20" {...props}>
<path fill="currentColor" d="M15 2H5L4 8h12zM0 10s2 1 10 1s10-1 10-1l-4-2H4zm8 4h4v1H8z" />
<circle cx="6" cy="15" r="3" fill="currentColor" />
<circle cx="14" cy="15" r="3" fill="currentColor" />
</svg>
)
}
@@ -1,18 +0,0 @@
import type { SVGProps } from "react"
export function PhCloudCheck(props: SVGProps<SVGSVGElement>) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width="1em"
height="1em"
viewBox="0 0 256 256"
{...props}
>
<path
fill="currentColor"
d="M160 40a88.09 88.09 0 0 0-78.71 48.67A64 64 0 1 0 72 216h88a88 88 0 0 0 0-176m0 160H72a48 48 0 0 1 0-96c1.1 0 2.2 0 3.29.11A88 88 0 0 0 72 128a8 8 0 0 0 16 0a72 72 0 1 1 72 72m37.66-93.66a8 8 0 0 1 0 11.32l-48 48a8 8 0 0 1-11.32 0l-24-24a8 8 0 0 1 11.32-11.32L144 148.69l42.34-42.35a8 8 0 0 1 11.32 0"
/>
</svg>
)
}
@@ -1,18 +0,0 @@
import type { SVGProps } from "react"
export function PhCloudWarning(props: SVGProps<SVGSVGElement>) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width="1em"
height="1em"
viewBox="0 0 256 256"
{...props}
>
<path
fill="currentColor"
d="M160 40a88.09 88.09 0 0 0-78.71 48.67A64 64 0 1 0 72 216h88a88 88 0 0 0 0-176m0 160H72a48 48 0 0 1 0-96c1.1 0 2.2 0 3.29.11A88 88 0 0 0 72 128a8 8 0 0 0 16 0a72 72 0 1 1 72 72m-8-72V88a8 8 0 0 1 16 0v40a8 8 0 0 1-16 0m20 36a12 12 0 1 1-12-12a12 12 0 0 1 12 12"
/>
</svg>
)
}
@@ -1,18 +0,0 @@
import type { SVGProps } from "react"
export function PhCloudX(props: SVGProps<SVGSVGElement>) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width="1em"
height="1em"
viewBox="0 0 256 256"
{...props}
>
<path
fill="currentColor"
d="M160 40a88.09 88.09 0 0 0-78.71 48.67A64 64 0 1 0 72 216h88a88 88 0 0 0 0-176m0 160H72a48 48 0 0 1 0-96c1.1 0 2.2 0 3.29.11A88 88 0 0 0 72 128a8 8 0 0 0 16 0a72 72 0 1 1 72 72m29.66-82.34L171.31 136l18.35 18.34a8 8 0 0 1-11.32 11.32L160 147.31l-18.34 18.35a8 8 0 0 1-11.32-11.32L148.69 136l-18.35-18.34a8 8 0 0 1 11.32-11.32L160 124.69l18.34-18.35a8 8 0 0 1 11.32 11.32"
/>
</svg>
)
}
@@ -1,33 +0,0 @@
import { cn } from "~/lib/utils"
export const EmptyIcon: Component = ({ className }) => (
<svg
version="1.1"
x="0px"
y="0px"
width="59.227px"
height="59.227px"
viewBox="0 0 59.227 59.227"
className={cn("fill-current", className)}
>
<g>
<g>
<path
d="M51.586,10.029c-0.333-0.475-0.897-0.689-1.449-0.607c-0.021-0.005-0.042-0.014-0.063-0.017L27.469,6.087
c-0.247-0.037-0.499-0.01-0.734,0.076L8.63,12.799c-0.008,0.003-0.015,0.008-0.023,0.011c-0.019,0.008-0.037,0.02-0.057,0.027
c-0.099,0.044-0.191,0.096-0.276,0.157c-0.026,0.019-0.051,0.038-0.077,0.059c-0.093,0.076-0.178,0.159-0.249,0.254
c-0.004,0.006-0.01,0.009-0.014,0.015L0.289,23.78c-0.293,0.401-0.369,0.923-0.202,1.391c0.167,0.469,0.556,0.823,1.038,0.947
l6.634,1.713v16.401c0,0.659,0.431,1.242,1.062,1.435l24.29,7.422c0.008,0.004,0.017,0.001,0.025,0.005
c0.13,0.036,0.266,0.059,0.402,0.06c0.003,0,0.007,0.002,0.011,0.002l0,0h0.001c0.143,0,0.283-0.026,0.423-0.067
c0.044-0.014,0.085-0.033,0.13-0.052c0.059-0.022,0.117-0.038,0.175-0.068l17.43-9.673c0.477-0.265,0.772-0.767,0.772-1.312
V25.586l5.896-2.83c0.397-0.19,0.69-0.547,0.802-0.973c0.111-0.427,0.03-0.88-0.223-1.241L51.586,10.029z M27.41,9.111
l17.644,2.59L33.35,17.143l-18.534-3.415L27.41,9.111z M9.801,15.854l21.237,3.914l-6.242,9.364l-20.78-5.365L9.801,15.854z
M10.759,43.122V28.605l14.318,3.697c0.125,0.031,0.25,0.048,0.375,0.048c0.493,0,0.965-0.244,1.248-0.668l5.349-8.023v25.968
L10.759,43.122z M49.479,41.1l-14.431,8.007V25.414l2.635,5.599c0.171,0.361,0.479,0.641,0.854,0.773
c0.163,0.06,0.333,0.087,0.502,0.087c0.223,0,0.444-0.05,0.649-0.146l9.789-4.698L49.479,41.1L49.479,41.1z M39.755,28.368
l-4.207-8.938L49.85,12.78l5.634,8.037L39.755,28.368z"
/>
</g>
</g>
</svg>
)
@@ -1,12 +0,0 @@
export const FollowIcon: Component = (props) => (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 344 330" fill="none" {...props}>
<g fill="currentColor" clipPath="url(#a)">
<path d="M297.639 0H88.19C62.862 0 42.33 20.514 42.33 45.82c0 25.305 20.532 45.819 45.86 45.819H297.64c25.328 0 45.861-20.514 45.861-45.82C343.5 20.514 322.967 0 297.639 0ZM185.96 119.13H46.361C21.033 119.13.5 139.644.5 164.95c0 25.305 20.533 45.819 45.861 45.819H185.96c25.328 0 45.861-20.514 45.861-45.819 0-25.306-20.533-45.82-45.861-45.82ZM199.466 284.181c0-25.306-20.533-45.82-45.861-45.82-25.328 0-45.861 20.514-45.861 45.82 0 25.305 20.533 45.819 45.861 45.819 25.328 0 45.861-20.514 45.861-45.819Z" />
</g>
<defs>
<clipPath id="a">
<path fill="currentColor" d="M.5 0h343v330H.5z" />
</clipPath>
</defs>
</svg>
)
@@ -1,29 +0,0 @@
import { forwardRef } from "react"
export const Logo = forwardRef<SVGSVGElement, React.SVGProps<SVGSVGElement>>((props, ref) => (
<svg {...props} ref={ref} viewBox="0 0 145 145" fill="none" xmlns="http://www.w3.org/2000/svg">
<mask id="mask0_54_296" maskUnits="userSpaceOnUse" x="0" y="0" width="145" height="145">
<path
fillRule="evenodd"
clipRule="evenodd"
d="M144.491 45.4541C144.491 43.75 144.492 42.0456 144.481 40.3413C144.473 38.9056 144.456 37.4702 144.417 36.0352C144.333 32.9075 144.148 29.753 143.592 26.6601C143.028 23.5227 142.107 20.6027 140.655 17.752C139.228 14.9501 137.364 12.3862 135.139 10.1633C132.915 7.94053 130.351 6.07747 127.548 4.65117C124.694 3.19908 121.771 2.27818 118.63 1.71424C115.537 1.15884 112.381 0.974699 109.254 0.890204C107.818 0.851354 106.382 0.834978 104.945 0.826093C103.24 0.81564 101.535 0.816511 99.8296 0.816511L80.0305 0.745605H65.2222L45.7734 0.816511C44.0649 0.816511 42.3564 0.81564 40.6479 0.826093C39.2085 0.834978 37.7698 0.851354 36.331 0.890204C33.196 0.974699 30.0335 1.15902 26.933 1.71511C23.7879 2.27887 20.8604 3.19943 18.0029 4.65047C15.194 6.07694 12.6239 7.94018 10.3953 10.1633C8.1671 12.386 6.29934 14.9494 4.86956 17.7508C3.41382 20.6028 2.49083 23.5246 1.92533 26.6638C1.36854 29.7554 1.18405 32.9089 1.09921 36.0352C1.06053 37.4704 1.04381 38.9057 1.03509 40.3413C1.02464 42.0458 0.937012 44.163 0.937012 45.8674L0.937534 65.0468L0.937012 80.0136L1.02551 99.6005C1.02551 101.307 1.02482 103.014 1.03509 104.72C1.04381 106.158 1.06053 107.595 1.09938 109.032C1.18405 112.164 1.36889 115.323 1.9262 118.42C2.49153 121.562 3.41434 124.486 4.86886 127.34C6.29882 130.146 8.16692 132.713 10.3953 134.939C12.6237 137.165 15.1932 139.031 18.0015 140.459C20.8607 141.913 23.7896 142.835 26.9366 143.4C30.0357 143.956 33.1972 144.141 36.331 144.225C37.7698 144.264 39.2087 144.281 40.648 144.289C42.3566 144.3 44.0649 144.299 45.7734 144.299L65.398 144.3H80.243L99.8296 144.299C101.535 144.299 103.24 144.3 104.945 144.289C106.382 144.281 107.818 144.264 109.254 144.225C112.383 144.141 115.539 143.956 118.634 143.399C121.773 142.835 124.694 141.913 127.547 140.46C130.35 139.031 132.915 137.166 135.139 134.939C137.363 132.714 139.227 130.147 140.654 127.341C142.107 124.486 143.028 121.56 143.593 118.416C144.148 115.321 144.333 112.163 144.417 109.032C144.456 107.595 144.473 106.158 144.481 104.72C144.492 103.014 144.491 101.307 144.491 99.6005C144.491 99.6005 144.49 80.3594 144.49 80.0136V65.0311C144.49 64.7757 144.491 45.4541 144.491 45.4541Z"
fill="white"
/>
</mask>
<g mask="url(#mask0_54_296)">
<rect x="0.414551" y="-6.74585" width="149.477" height="158.537" fill="#FF5C00" />
<path
d="M103.609 36.6948H53.5823C47.5327 36.6948 42.6284 41.5946 42.6284 47.6388C42.6284 53.683 47.5327 58.5828 53.5823 58.5828H103.609C109.659 58.5828 114.563 53.683 114.563 47.6388C114.563 41.5946 109.659 36.6948 103.609 36.6948Z"
fill="white"
/>
<path
d="M76.9348 65.1489H43.5916C37.5419 65.1489 32.6377 70.0487 32.6377 76.0929C32.6377 82.1371 37.5419 87.0369 43.5916 87.0369H76.9348C82.9845 87.0369 87.8888 82.1371 87.8888 76.0929C87.8888 70.0487 82.9845 65.1489 76.9348 65.1489Z"
fill="white"
/>
<path
d="M80.1608 104.571C80.1608 98.5272 75.2565 93.6274 69.2068 93.6274C63.1572 93.6274 58.2529 98.5272 58.2529 104.571C58.2529 110.616 63.1572 115.515 69.2068 115.515C75.2565 115.515 80.1608 110.616 80.1608 104.571Z"
fill="white"
/>
</g>
</svg>
))
@@ -1,12 +0,0 @@
import type { SVGProps } from "react"
export function LetsIconsResizeDownRightLight(props: SVGProps<SVGSVGElement>) {
return (
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" {...props}>
<g fill="none" stroke="currentColor">
<path d="M10 20h10V10" />
<path d="M12 17h5v-5" />
</g>
</svg>
)
}
@@ -1,22 +0,0 @@
import type { SVGAttributes } from "react"
export function UserArrowLeftIcon(props: SVGAttributes<SVGElement>) {
return (
<svg
width="1em"
height="1em"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
{...props}
>
<path
d="M11 15H7C4.79086 15 3 16.7909 3 19C3 20.1046 3.89543 21 5 21H15M16.8744 13C16.2164 13.4935 15.6221 14.066 15.1049 14.7043C15.035 14.7906 15 14.8953 15 15M16.8744 17C16.2164 16.5065 15.6221 15.934 15.1049 15.2957C15.035 15.2094 15 15.1047 15 15M15 15H21M15 7C15 9.20914 13.2091 11 11 11C8.79086 11 7 9.20914 7 7C7 4.79086 8.79086 3 11 3C13.2091 3 15 4.79086 15 7Z"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
)
}
@@ -1,18 +0,0 @@
import type { SVGProps } from "react"
export function PhUsersBold(props: SVGProps<SVGSVGElement>) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width="1em"
height="1em"
viewBox="0 0 256 256"
{...props}
>
<path
fill="currentColor"
d="M125.18 156.94a64 64 0 1 0-82.36 0a100.23 100.23 0 0 0-39.49 32a12 12 0 0 0 19.35 14.2a76 76 0 0 1 122.64 0a12 12 0 0 0 19.36-14.2a100.33 100.33 0 0 0-39.5-32M44 108a40 40 0 1 1 40 40a40 40 0 0 1-40-40m206.1 97.67a12 12 0 0 1-16.78-2.57A76.31 76.31 0 0 0 172 172a12 12 0 0 1 0-24a40 40 0 1 0-10.3-78.67a12 12 0 1 1-6.16-23.19a64 64 0 0 1 57.64 110.8a100.23 100.23 0 0 1 39.49 32a12 12 0 0 1-2.57 16.73"
/>
</svg>
)
}
-111
View File
@@ -1,111 +0,0 @@
import { useEffect, useMemo, useState } from "react"
import { getColorScheme, stringToHue } from "~/lib/color"
import { getImageProxyUrl } from "~/lib/img-proxy"
import { cn, getUrlIcon } from "~/lib/utils"
import { PlatformIcon } from "./ui/platform-icon"
/**
*
* @deprecated please use `FeedIcon` instead
* @returns
*/
export function SiteIcon({
url,
className,
style,
fallback,
fallbackText,
proxy,
src,
}: {
url?: string
className?: string
style?: React.CSSProperties
/**
* Fallback image when the site icon is not available
*/
fallback?: boolean
fallbackText?: string
src?: string
proxy?: {
width: number
height: number
}
}) {
const colors = useMemo(() => {
const id = src || url
return id && fallback ? getColorScheme(stringToHue(id), true) : null
}, [fallback, src, url])
const [showFallback, setShowFallback] = useState(false)
useEffect(() => {
setShowFallback(false)
}, [url])
const stableProxy = useState(proxy)[0]
const [nextSrc, fallbackUrl] = useMemo((): [string, string] => {
// src ? getProxyUrl(src) : "";
if (src) {
if (stableProxy) {
return [
getImageProxyUrl({
url: src,
width: stableProxy.width,
height: stableProxy.height,
}),
"",
]
}
return [src, ""]
}
if (!url) return ["", ""]
const ret = getUrlIcon(url, fallback)
return [ret.src, ret.fallbackUrl]
}, [fallback, stableProxy, src, url])
if (!nextSrc) return null
return (
<PlatformIcon
url={nextSrc}
style={style}
className={cn("relative mr-2 size-5 shrink-0 rounded-sm", className)}
>
{showFallback && fallback ? (
<div
data-error-image={nextSrc || fallbackUrl}
className="center absolute inset-0 bg-[var(--fo-light-background)] text-[9px] text-white dark:bg-[var(--fo-dark-background)]"
style={
{
"--fo-light-background": colors.light.background,
"--fo-dark-background": colors.dark.background,
} as any
}
>
{!!fallbackText && fallbackText[0]}
</div>
) : (
<img
src={nextSrc}
loading="lazy"
onError={(e) => {
if (fallbackUrl && e.currentTarget.src !== fallbackUrl) {
e.currentTarget.src = fallbackUrl
} else if (fallback) {
setShowFallback(true)
} else {
// Empty svg
e.currentTarget.src =
"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3C/svg%3E"
}
}}
/>
)}
</PlatformIcon>
)
}
-217
View File
@@ -1,217 +0,0 @@
// @copy internal masonic hooks
import { clearRequestTimeout, requestTimeout } from "@essentials/request-timeout"
import { useWindowSize } from "@react-hook/window-size"
import { useForceUpdate } from "framer-motion"
import { isEqual, throttle } from "lodash-es"
import type { ContainerPosition, MasonryProps, MasonryScrollerProps, Positioner } from "masonic"
import { createResizeObserver, useMasonry, usePositioner, useScrollToIndex } from "masonic"
import * as React from "react"
import { useScrollViewElement } from "./scroll-area/hooks"
/**
* A "batteries included" masonry grid which includes all of the implementation details below. This component is the
* easiest way to get off and running in your app, before switching to more advanced implementations, if necessary.
* It will change its column count to fit its container's width and will decide how many rows to render based upon
* the height of the browser `window`.
*
* @param props
*/
export const Masonry = <Item,>(props: MasonryProps<Item>) => {
const [scrollTop, setScrollTop] = React.useState(0)
const [isScrolling, setIsScrolling] = React.useState(false)
const scrollElement = useScrollViewElement()
const fps = props.scrollFps || 12
React.useEffect(() => {
if (!scrollElement) return
const scrollTimer: number | null = null
const handleScroll = throttle(() => {
setIsScrolling(true)
setScrollTop(scrollElement.scrollTop)
}, 1000 / fps)
scrollElement.addEventListener("scroll", handleScroll)
return () => {
scrollElement.removeEventListener("scroll", handleScroll)
if (scrollTimer) {
clearTimeout(scrollTimer)
}
}
}, [fps, scrollElement])
const didMount = React.useRef(0)
React.useEffect(() => {
if (didMount.current === 1) setIsScrolling(true)
let didUnsubscribe = false
const to = requestTimeout(
() => {
if (didUnsubscribe) return
// This is here to prevent premature bail outs while maintaining high resolution
// unsets. Without it there will always bee a lot of unnecessary DOM writes to style.
setIsScrolling(false)
},
40 + 1000 / fps,
)
didMount.current = 1
return () => {
didUnsubscribe = true
clearRequestTimeout(to)
}
}, [fps, scrollTop])
const containerRef = React.useRef<null | HTMLElement>(null)
const windowSize = useWindowSize({
initialWidth: props.ssrWidth,
initialHeight: props.ssrHeight,
})
const containerPos = useContainerPosition(containerRef, windowSize)
const nextProps = Object.assign(
{
offset: containerPos.offset,
width: containerPos.width || windowSize[0],
height: containerPos.height || windowSize[1],
containerRef,
},
props,
) as any
// Workaround for https://github.com/jaredLunde/masonic/issues/12
const itemCounter = React.useRef<number>(props.items.length)
let shrunk = false
if (props.items.length !== itemCounter.current) {
if (props.items.length < itemCounter.current) shrunk = true
itemCounter.current = props.items.length
}
nextProps.positioner = usePositioner(nextProps, [shrunk && Math.random()])
nextProps.resizeObserver = useResizeObserver(nextProps.positioner)
nextProps.scrollTop = scrollTop
nextProps.isScrolling = isScrolling
nextProps.height = window.innerHeight
const scrollToIndex = useScrollToIndex(nextProps.positioner, {
height: nextProps.height,
offset: containerPos.offset,
align: typeof props.scrollToIndex === "object" ? props.scrollToIndex.align : void 0,
})
const index =
props.scrollToIndex &&
(typeof props.scrollToIndex === "number" ? props.scrollToIndex : props.scrollToIndex.index)
React.useEffect(() => {
if (index !== void 0) scrollToIndex(index)
}, [index, scrollToIndex])
return React.createElement(MasonryScroller, nextProps)
}
function MasonryScroller<Item>(
props: MasonryScrollerProps<Item> & {
scrollTop: number
isScrolling: boolean
},
) {
// We put this in its own layer because it's the thing that will trigger the most updates
// and we don't want to slower ourselves by cycling through all the functions, objects, and effects
// of other hooks
// const { scrollTop, isScrolling } = useScroller(props.offset, props.scrollFps)
// This is an update-heavy phase and while we could just Object.assign here,
// it is way faster to inline and there's a relatively low hit to he bundle
// size.
return useMasonry<Item>({
scrollTop: props.scrollTop,
isScrolling: props.isScrolling,
positioner: props.positioner,
resizeObserver: props.resizeObserver,
items: props.items,
onRender: props.onRender,
as: props.as,
id: props.id,
className: props.className,
style: props.style,
role: props.role,
tabIndex: props.tabIndex,
containerRef: props.containerRef,
itemAs: props.itemAs,
itemStyle: props.itemStyle,
itemHeightEstimate: props.itemHeightEstimate,
itemKey: props.itemKey,
overscanBy: props.overscanBy,
height: props.height,
render: props.render,
})
}
function useContainerPosition(
elementRef: React.MutableRefObject<HTMLElement | null>,
deps: React.DependencyList = [],
): ContainerPosition & {
height: number
} {
const [containerPosition, setContainerPosition] = React.useState<
ContainerPosition & {
height: number
}
>({
offset: 0,
width: 0,
height: 0,
})
React.useLayoutEffect(() => {
const { current } = elementRef
if (current !== null) {
let offset = 0
let el = current
do {
offset += el.offsetTop || 0
el = el.offsetParent as HTMLElement
} while (el)
if (offset !== containerPosition.offset || current.offsetWidth !== containerPosition.width) {
setContainerPosition({
offset,
width: current.offsetWidth,
height: current.offsetHeight,
})
}
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, deps)
React.useEffect(() => {
const resizeObserver = new ResizeObserver(() => {
setContainerPosition((prev) => {
const next = {
...prev,
width: elementRef.current?.offsetWidth || 0,
}
if (isEqual(next, prev)) return prev
return next
})
})
resizeObserver.observe(elementRef.current as HTMLElement)
return () => {
resizeObserver.disconnect()
}
}, [containerPosition, elementRef])
return containerPosition
}
function useResizeObserver(positioner: Positioner) {
const [forceUpdate] = useForceUpdate()
const resizeObserver = createResizeObserver(positioner, throttle(forceUpdate, 1000 / 12))
// Cleans up the resize observers when they change or the
// component unmounts
React.useEffect(() => () => resizeObserver.disconnect(), [resizeObserver])
return resizeObserver
}
@@ -1,13 +1,12 @@
import { Input } from "@follow/components/ui/input/index.js"
import { stopPropagation } from "@follow/utils/dom"
import { cn } from "@follow/utils/utils"
import { Combobox, ComboboxInput, ComboboxOption, ComboboxOptions } from "@headlessui/react"
import { AnimatePresence, m } from "framer-motion"
import Fuse from "fuse.js"
import { forwardRef, Fragment, useCallback, useEffect, useState } from "react"
import { stopPropagation } from "~/lib/dom"
import { cn } from "~/lib/utils"
import { Input } from "../input"
import { useCorrectZIndex } from "../modal"
import { useCorrectZIndex } from "../modal/stacked/hooks"
export type Suggestion = {
name: string
@@ -1,42 +0,0 @@
import * as AvatarPrimitive from "@radix-ui/react-avatar"
import * as React from "react"
import { cn } from "~/lib/utils"
const Avatar = React.forwardRef<
React.ElementRef<typeof AvatarPrimitive.Root>,
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
>(({ className, ...props }, ref) => (
<AvatarPrimitive.Root
ref={ref}
className={cn("relative flex size-10 shrink-0 overflow-hidden rounded-full", className)}
{...props}
/>
))
Avatar.displayName = AvatarPrimitive.Root.displayName
const AvatarImage = React.forwardRef<
React.ElementRef<typeof AvatarPrimitive.Image>,
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
>(({ className, ...props }, ref) => (
<AvatarPrimitive.Image
ref={ref}
className={cn("aspect-square size-full", className)}
{...props}
/>
))
AvatarImage.displayName = AvatarPrimitive.Image.displayName
const AvatarFallback = React.forwardRef<
React.ElementRef<typeof AvatarPrimitive.Fallback>,
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
>(({ className, ...props }, ref) => (
<AvatarPrimitive.Fallback
ref={ref}
className={cn("flex size-full items-center justify-center rounded-full bg-muted", className)}
{...props}
/>
))
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName
export { Avatar, AvatarFallback, AvatarImage }
@@ -1,7 +1,7 @@
import { SYSTEM_CAN_UNDER_BLUR_WINDOW } from "@follow/shared/constants"
import { cn } from "@follow/utils/utils"
import { useUISettingKey } from "~/atoms/settings/ui"
import { cn } from "~/lib/utils"
type Props = Component<
React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>
@@ -1,241 +0,0 @@
import type { VariantProps } from "class-variance-authority"
import type { HTMLMotionProps } from "framer-motion"
import { m } from "framer-motion"
import * as React from "react"
import { useHotkeys } from "react-hotkeys-hook"
import type { OptionsOrDependencyArray } from "react-hotkeys-hook/dist/types"
import { stopPropagation } from "~/lib/dom"
import { cn, getOS } from "~/lib/utils"
import { KbdCombined } from "../kbd/Kbd"
import { LoadingCircle } from "../loading"
import { Tooltip, TooltipContent, TooltipPortal, TooltipTrigger } from "../tooltip"
import { styledButtonVariant } from "./variants"
export interface BaseButtonProps {
isLoading?: boolean
}
// BIZ buttons
interface ActionButtonProps {
icon?: React.ReactNode | React.FC<ComponentType>
tooltip?: React.ReactNode
tooltipSide?: "top" | "bottom"
active?: boolean
disabled?: boolean
shortcut?: string
disableTriggerShortcut?: boolean
size?: "sm" | "md" | "base"
}
const actionButtonStyleVariant = {
size: {
base: tw`text-xl size-8`,
sm: tw`text-sm size-6`,
},
}
export const ActionButton = React.forwardRef<
HTMLButtonElement,
ComponentType<ActionButtonProps> & React.HTMLAttributes<HTMLButtonElement>
>(
(
{
icon,
tooltip,
className,
tooltipSide,
children,
active,
shortcut,
disabled,
disableTriggerShortcut,
size = "base",
...rest
},
ref,
) => {
const finalShortcut =
getOS() === "Windows" ? shortcut?.replace("meta", "ctrl").replace("Meta", "Ctrl") : shortcut
const buttonRef = React.useRef<HTMLButtonElement>(null)
React.useImperativeHandle(ref, () => buttonRef.current!)
const Trigger = (
<button
ref={buttonRef}
// @see https://github.com/radix-ui/primitives/issues/2248#issuecomment-2147056904
onFocusCapture={stopPropagation}
className={cn(
"no-drag-region inline-flex items-center justify-center",
active && "bg-zinc-500/15 hover:bg-zinc-500/20",
"rounded-md duration-200 hover:bg-theme-button-hover data-[state=open]:bg-theme-button-hover",
"disabled:cursor-not-allowed disabled:opacity-50",
actionButtonStyleVariant.size[size],
className,
)}
type="button"
disabled={disabled}
{...rest}
>
{typeof icon === "function"
? React.createElement(icon, {
className: "size-4 grayscale text-current",
})
: icon}
{children}
</button>
)
return (
<>
{finalShortcut && !disableTriggerShortcut && (
<HotKeyTrigger shortcut={finalShortcut} fn={() => buttonRef.current?.click()} />
)}
{tooltip ? (
<Tooltip disableHoverableContent>
<TooltipTrigger aria-label={typeof tooltip === "string" ? tooltip : undefined} asChild>
{Trigger}
</TooltipTrigger>
<TooltipPortal>
<TooltipContent className="flex items-center gap-1" side={tooltipSide ?? "bottom"}>
{tooltip}
{!!finalShortcut && (
<div className="ml-1">
<KbdCombined className="text-foreground/80">{finalShortcut}</KbdCombined>
</div>
)}
</TooltipContent>
</TooltipPortal>
</Tooltip>
) : (
Trigger
)}
</>
)
},
)
const HotKeyTrigger = ({
shortcut,
fn,
options,
}: {
shortcut: string
fn: () => void
options?: OptionsOrDependencyArray
}) => {
useHotkeys(shortcut, fn, {
preventDefault: true,
...options,
})
return null
}
export const MotionButtonBase = React.forwardRef<HTMLButtonElement, HTMLMotionProps<"button">>(
({ children, ...rest }, ref) => (
<m.button
layout="size"
initial
whileFocus={{ scale: 1.02 }}
whileTap={{ scale: 0.95 }}
{...rest}
ref={ref}
>
{children}
</m.button>
),
)
MotionButtonBase.displayName = "MotionButtonBase"
export const Button = React.forwardRef<
HTMLButtonElement,
React.PropsWithChildren<
Omit<HTMLMotionProps<"button">, "children"> &
BaseButtonProps &
VariantProps<typeof styledButtonVariant> & {
buttonClassName?: string
}
>
>(({ className, buttonClassName, isLoading, variant, status, ...props }, ref) => {
const handleClick: React.MouseEventHandler<HTMLButtonElement> = React.useCallback(
(e) => {
if (isLoading || props.disabled) {
e.preventDefault()
return
}
props.onClick?.(e)
},
[isLoading, props],
)
return (
<MotionButtonBase
ref={ref}
className={cn(
styledButtonVariant({
variant,
status: isLoading || props.disabled ? "disabled" : undefined,
}),
className,
buttonClassName,
)}
{...props}
onClick={handleClick}
>
<span className="contents">
{typeof isLoading === "boolean" && (
<m.span
className="center"
animate={{
width: isLoading ? "auto" : "0px",
}}
>
{isLoading && <LoadingCircle size="small" className="center mr-2" />}
</m.span>
)}
<span className={cn("center", className)}>{props.children}</span>
</span>
</MotionButtonBase>
)
})
export const IconButton = React.forwardRef<
HTMLButtonElement,
React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement> &
React.PropsWithChildren<{
icon: React.JSX.Element
}>
>((props, ref) => {
const { icon, ...rest } = props
return (
<button
ref={ref}
type="button"
{...rest}
className={cn(
styledButtonVariant({
variant: "ghost",
}),
"group relative gap-2 bg-accent/10 px-4 hover:bg-accent dark:bg-accent/20 dark:hover:bg-accent/60",
rest.className,
)}
>
<span className="center">
{React.cloneElement(icon, {
className: cn("invisible", icon.props.className),
})}
{React.cloneElement(icon, {
className: cn(
"group-hover:text-white dark:group-hover:text-inherit",
"absolute left-4 top-1/2 -translate-y-1/2 duration-200 group-hover:left-1/2 group-hover:-translate-x-1/2",
icon.props.className,
),
})}
</span>
<span className="duration-200 group-hover:opacity-0">{props.children}</span>
</button>
)
})
@@ -1,75 +0,0 @@
import { cva } from "class-variance-authority"
import { cn } from "~/lib/utils"
// Design
// @see https://x.com/uiuxadrian/status/1822947443186504176
export const styledButtonVariant = cva(
[
"inline-flex cursor-button select-none items-center justify-center outline-offset-2 transition active:transition-none disabled:cursor-not-allowed",
"ring-accent/20 duration-200 disabled:ring-0",
"align-middle",
],
{
compoundVariants: [
{
variant: "primary",
status: "disabled",
className: "text-zinc-50 bg-theme-disabled",
},
{
variant: "outline",
status: "disabled",
className:
"text-theme-disabled border-theme-inactive dark:border-zinc-800 hover:!bg-theme-background",
},
{
variant: "text",
status: "disabled",
className: "opacity-60",
},
{
variant: "ghost",
status: "disabled",
className: "opacity-50 hover:!bg-transparent",
},
],
variants: {
size: {
default: "px-3 py-1.5 rounded-lg text-sm",
},
status: {
disabled: "cursor-not-allowed !ring-0",
},
variant: {
primary: cn(
"bg-accent",
"hover:contrast-[1.10] active:contrast-125",
"font-semibold",
"disabled:bg-theme-disabled disabled:dark:text-zinc-50",
"text-zinc-100 dark:text-zinc-200/90",
"focus:border-accent/80 focus:outline-none focus:ring-2",
),
outline: cn(
"bg-theme-background font-semibold duration-200",
"border border-border hover:bg-zinc-50 dark:bg-neutral-900/30 dark:hover:bg-neutral-900/80",
"focus:border-accent/80",
),
text: cn(
"font-semibold text-accent",
"hover:contrast-[1.10] active:contrast-125",
"focus:text-accent focus:outline-none",
),
ghost: cn("px-1.5 font-semibold", "hover:bg-theme-button-hover"),
},
},
defaultVariants: {
variant: "primary",
size: "default",
},
},
)
@@ -5,7 +5,7 @@ import {
MdiLanguageTypescript,
RiMarkdownFill,
UilReact,
} from "~/components/icons/Language"
} from "@follow/components/icons/Language.jsx"
const LanguageAlias = {
ts: "typescript",
@@ -1,11 +1,10 @@
import { MotionButtonBase } from "@follow/components/ui/button/index.js"
import { cn } from "@follow/utils/utils"
import type { Variants } from "framer-motion"
import { AnimatePresence } from "framer-motion"
import { useCallback, useRef, useState } from "react"
import { m } from "~/components/common/Motion"
import { cn } from "~/lib/utils"
import { MotionButtonBase } from "../button"
const copyIconVariants: Variants = {
initial: {
@@ -1,3 +1,5 @@
import { useIsDark } from "@follow/hooks"
import { cn } from "@follow/utils/utils"
import { useIsomorphicLayoutEffect } from "foxact/use-isomorphic-layout-effect"
import type { FC } from "react"
import { useInsertionEffect, useMemo, useRef, useState } from "react"
@@ -10,9 +12,7 @@ import type {
import { useUISettingKey, useUISettingSelector } from "~/atoms/settings/ui"
import { isElectronBuild } from "~/constants"
import { useIsDark } from "~/hooks/common"
import { tipcClient } from "~/lib/client"
import { cn } from "~/lib/utils"
import { getLanguageColor, getLanguageIcon } from "../constants"
import { CopyButton } from "../copy-button"
@@ -1,4 +1,4 @@
import { useIsDark } from "~/hooks/common"
import { useIsDark } from "@follow/hooks"
export const useShikiDefaultTheme = () => {
const isDark = useIsDark()
@@ -1,9 +1,8 @@
import { cn } from "@follow/utils/utils"
import type { Variants } from "framer-motion"
import { AnimatePresence, m } from "framer-motion"
import * as React from "react"
import { cn } from "~/lib/utils"
import {
CollapseGroupItemStateProvider,
CollapseStateProvider,
@@ -1,10 +1,8 @@
import { RootPortal } from "@follow/components/ui/portal/index.jsx"
import { cn } from "@follow/utils/utils"
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu"
import * as React from "react"
import { cn } from "~/lib/utils"
import { RootPortal } from "../portal"
const ContextMenu = ContextMenuPrimitive.Root
const ContextMenuTrigger = ContextMenuPrimitive.Trigger
@@ -157,4 +155,4 @@ export {
ContextMenuTrigger,
}
export { RootPortal as ContextMenuPortal } from "../portal"
export { RootPortal as ContextMenuPortal } from "@follow/components/ui/portal/index.jsx"
@@ -1,98 +1,20 @@
import { getUpdateInterval } from "@follow/components/ui/datetime/index.js"
import {
Tooltip,
TooltipContent,
TooltipPortal,
TooltipTrigger,
} from "@follow/components/ui/tooltip/index.js"
import { stopPropagation } from "@follow/utils/dom"
import dayjs from "dayjs"
import type { FC } from "react"
import { useEffect, useRef, useState } from "react"
import { useTranslation } from "react-i18next"
import { useGeneralSettingSelector } from "~/atoms/settings/general"
import { stopPropagation } from "~/lib/dom"
import { Tooltip, TooltipContent, TooltipPortal, TooltipTrigger } from "../tooltip"
const formatTemplateString = "lll"
export { RelativeTime } from "@follow/components/ui/datetime/index.js"
const formatTemplateStringShort = "ll"
const formatTime = (
date: string | Date,
relativeBeforeDay?: number,
template = formatTemplateString,
) => {
if (relativeBeforeDay && Math.abs(dayjs(date).diff(new Date(), "d")) > relativeBeforeDay) {
return dayjs(date).format(template)
}
return dayjs.duration(dayjs(date).diff(dayjs(), "minute"), "minute").humanize()
}
const getUpdateInterval = (date: string | Date, relativeBeforeDay?: number) => {
if (!relativeBeforeDay) return null
const diffInSeconds = Math.abs(dayjs(date).diff(new Date(), "second"))
if (diffInSeconds <= 60) {
return 1000 // Update every second
}
const diffInMinutes = Math.abs(dayjs(date).diff(new Date(), "minute"))
if (diffInMinutes <= 60) {
return 60000 // Update every minute
}
const diffInHours = Math.abs(dayjs(date).diff(new Date(), "hour"))
if (diffInHours <= 24) {
return 3600000 // Update every hour
}
const diffInDays = Math.abs(dayjs(date).diff(new Date(), "day"))
if (diffInDays <= relativeBeforeDay) {
return 86400000 // Update every day
}
return null // No need to update
}
export const RelativeTime: FC<{
date: string | Date
displayAbsoluteTimeAfterDay?: number
dateFormatTemplate?: string
}> = (props) => {
const { displayAbsoluteTimeAfterDay = 29, dateFormatTemplate = formatTemplateString } = props
const [relative, setRelative] = useState<string>(() =>
formatTime(props.date, displayAbsoluteTimeAfterDay, dateFormatTemplate),
)
const timerRef = useRef<any>(null)
useEffect(() => {
const updateRelativeTime = () => {
setRelative(formatTime(props.date, displayAbsoluteTimeAfterDay, dateFormatTemplate))
const updateInterval = getUpdateInterval(props.date, displayAbsoluteTimeAfterDay)
if (updateInterval !== null) {
timerRef.current = setTimeout(updateRelativeTime, updateInterval)
}
}
updateRelativeTime()
return () => {
clearTimeout(timerRef.current)
}
}, [props.date, displayAbsoluteTimeAfterDay, dateFormatTemplate])
const formated = dayjs(props.date).format(dateFormatTemplate)
const { t } = useTranslation("common")
if (formated === relative) {
return <>{relative}</>
}
return (
<Tooltip>
{/* https://github.com/radix-ui/primitives/issues/2248#issuecomment-2147056904 */}
<TooltipTrigger onFocusCapture={stopPropagation}>
{relative}
{t("space")}
{t("words.ago")}
</TooltipTrigger>
<TooltipPortal>
<TooltipContent>{formated}</TooltipContent>
</TooltipPortal>
</Tooltip>
)
}
export const RelativeDay = ({ date }: { date: Date }) => {
const { t } = useTranslation("common")
const language = useGeneralSettingSelector((s) => s.language)
@@ -1,49 +0,0 @@
import type { DetailedHTMLProps, FC, HTMLAttributes } from "react"
import { cn } from "~/lib/utils"
export const Divider: FC<DetailedHTMLProps<HTMLAttributes<HTMLHRElement>, HTMLHRElement>> = (
props,
) => {
const { className, ...rest } = props
return (
<hr
className={cn("my-4 h-[0.5px] border-0 bg-black !bg-opacity-30 dark:bg-white", className)}
{...rest}
/>
)
}
export const DividerVertical: FC<
DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>
> = (props) => {
const { className, ...rest } = props
return (
<span
className={cn(
"mx-4 inline-block h-full w-[0.5px] select-none bg-black text-transparent !opacity-20 dark:bg-white",
className,
)}
{...rest}
>
w
</span>
)
}
export const BreadcrumbDivider: Component = ({ className }) => (
<svg
width="24"
height="24"
fill="none"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
color="currentColor"
shapeRendering="geometricPrecision"
viewBox="0 0 24 24"
className={className}
>
<path d="M16.88 3.549L7.12 20.451" />
</svg>
)
@@ -1,60 +0,0 @@
import * as React from "react"
import { useMeasure } from "~/hooks/common"
import { cn } from "~/lib/utils"
import { Tooltip, TooltipContent, TooltipTrigger } from "../tooltip"
export const PanelSplitter = (
props: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> & {
isDragging?: boolean
cursor?: string
tooltip?: React.ReactNode
},
) => {
const { isDragging, cursor, tooltip, ...rest } = props
React.useEffect(() => {
if (!isDragging) return
const $css = document.createElement("style")
$css.innerHTML = `
* {
cursor: ${cursor} !important;
}
`
document.head.append($css)
return () => {
$css.remove()
}
}, [cursor, isDragging])
const [ref, { height }] = useMeasure()
const El = (
<div
tabIndex={-1}
ref={ref}
{...rest}
className={cn(
"absolute inset-0 z-[3] w-[2px] -translate-x-1/2 cursor-ew-resize bg-transparent hover:bg-gray-400 active:!bg-accent hover:dark:bg-neutral-500",
isDragging ? "bg-accent" : "",
)}
/>
)
return (
<div className="relative h-full w-0 shrink-0">
{tooltip ? (
<Tooltip>
<TooltipTrigger>{El}</TooltipTrigger>
<TooltipContent sideOffset={height / 2}>{tooltip}</TooltipContent>
</Tooltip>
) : (
El
)}
</div>
)
}
@@ -1,2 +0,0 @@
export * from "./Divider"
export * from "./PanelSpliter"
@@ -1,10 +1,10 @@
import { RootPortal } from "@follow/components/ui/portal/index.js"
import { useTypeScriptHappyCallback } from "@follow/hooks"
import { cn } from "@follow/utils/utils"
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
import * as React from "react"
import { useHotkeyScope, useTypeScriptHappyCallback } from "~/hooks/common"
import { cn } from "~/lib/utils"
import { RootPortal } from "../portal"
import { useHotkeyScope } from "~/hooks/common"
const DropdownMenu: typeof DropdownMenuPrimitive.Root = (props) => {
const [open, setOpen] = React.useState(!!props.open)
@@ -1,3 +1,6 @@
import { RootPortal } from "@follow/components/ui/portal/index.jsx"
import { useTypeScriptHappyCallback } from "@follow/hooks"
import { cn } from "@follow/utils/utils"
import clsx from "clsx"
import { typescriptHappyForwardRef } from "foxact/typescript-happy-forward-ref"
import type { HTMLMotionProps } from "framer-motion"
@@ -8,11 +11,7 @@ import type { JSX, PropsWithChildren, ReactNode } from "react"
import { useId } from "react"
import { m } from "~/components/common/Motion"
import { useTypeScriptHappyCallback } from "~/hooks/common"
import { jotaiStore } from "~/lib/jotai"
import { cn } from "~/lib/utils"
import { RootPortal } from "../portal"
const fabContainerElementAtom = atom(null as HTMLDivElement | null)
@@ -1,37 +0,0 @@
import type { DetailedHTMLProps, InputHTMLAttributes } from "react"
import { forwardRef } from "react"
import { useInputComposition } from "~/hooks/common"
import { stopPropagation } from "~/lib/dom"
import { cn } from "~/lib/utils"
// This composition handler is not perfect
// @see https://foxact.skk.moe/use-composition-input
export const Input = forwardRef<
HTMLInputElement,
Omit<DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">
>(({ className, ...props }, ref) => {
const inputProps = useInputComposition(props)
return (
<input
onContextMenu={stopPropagation}
ref={ref}
className={cn(
"min-w-0 flex-auto appearance-none rounded-lg text-sm",
"bg-theme-background px-3 py-[calc(theme(spacing.2)-1px)]",
"ring-accent/20 duration-200 focus:border-accent/80 focus:outline-none focus:ring-2",
"focus:!bg-accent/5",
"border border-border",
"placeholder:text-theme-placeholder-text dark:bg-zinc-700/[0.15] dark:text-zinc-200",
"hover:border-accent/60",
"disabled:cursor-not-allowed disabled:opacity-50",
props.type === "password" ? "font-mono placeholder:font-sans" : "font-sans",
"w-full",
className,
)}
{...props}
{...inputProps}
/>
)
})
Input.displayName = "Input"
@@ -1,111 +0,0 @@
"use client"
import clsx from "clsx"
import { useMotionValue } from "framer-motion"
import type { DetailedHTMLProps, PropsWithChildren, TextareaHTMLAttributes } from "react"
import { forwardRef, useCallback, useState } from "react"
import { useInputComposition } from "~/hooks/common"
import { stopPropagation } from "~/lib/dom"
import { cn } from "~/lib/utils"
const roundedMap = {
sm: "rounded-sm",
md: "rounded-md",
lg: "rounded-lg",
xl: "rounded-xl",
"2xl": "rounded-2xl",
"3xl": "rounded-3xl",
default: "rounded",
}
export const TextArea = forwardRef<
HTMLTextAreaElement,
DetailedHTMLProps<TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement> &
PropsWithChildren<{
wrapperClassName?: string
onCmdEnter?: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void
rounded?: "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "default"
bordered?: boolean
}>
>((props, ref) => {
const {
className,
wrapperClassName,
children,
rounded = "xl",
bordered = true,
onCmdEnter,
...rest
} = props
const mouseX = useMotionValue(0)
const mouseY = useMotionValue(0)
const handleMouseMove = useCallback(
({ clientX, clientY, currentTarget }: React.MouseEvent) => {
const bounds = currentTarget.getBoundingClientRect()
mouseX.set(clientX - bounds.left)
mouseY.set(clientY - bounds.top)
},
[mouseX, mouseY],
)
const inputProps = useInputComposition<HTMLTextAreaElement>(props)
const [isFocus, setIsFocus] = useState(false)
return (
<div
className={cn(
"group relative h-full border ring-0 ring-accent/20 duration-200",
roundedMap[rounded],
"border-transparent",
isFocus && "border-accent/80 ring-2",
"placeholder:text-theme-placeholder-text dark:text-zinc-200",
wrapperClassName,
)}
onMouseMove={handleMouseMove}
>
{bordered && (
<div
className={clsx(
"pointer-events-none absolute inset-0 z-0 border border-border",
roundedMap[rounded],
)}
aria-hidden="true"
/>
)}
<textarea
ref={ref}
className={cn(
"size-full resize-none bg-transparent",
"overflow-auto px-3 py-4",
"!outline-none",
"text-neutral-900/80 dark:text-slate-100/80",
"focus:!bg-accent/5",
roundedMap[rounded],
className,
)}
{...rest}
onFocus={(e) => {
setIsFocus(true)
rest.onFocus?.(e)
}}
onBlur={(e) => {
setIsFocus(false)
rest.onBlur?.(e)
}}
onContextMenu={stopPropagation}
{...inputProps}
onKeyDown={(e) => {
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
onCmdEnter?.(e)
}
rest.onKeyDown?.(e)
inputProps.onKeyDown?.(e)
}}
/>
{children}
</div>
)
})
TextArea.displayName = "TextArea"
@@ -1,2 +0,0 @@
export * from "./Input"
export * from "./TextArea"
+1 -2
View File
@@ -1,10 +1,9 @@
import { cn, getOS } from "@follow/utils/utils"
import type { FC } from "react"
import * as React from "react"
import { Fragment, memo } from "react"
import { isHotkeyPressed } from "react-hotkeys-hook"
import { cn, getOS } from "~/lib/utils"
const SharedKeys = {
backspace: "⌫",
space: "␣",
@@ -1,4 +1,9 @@
import { Tooltip, TooltipContent, TooltipPortal, TooltipTrigger } from "../tooltip"
import {
Tooltip,
TooltipContent,
TooltipPortal,
TooltipTrigger,
} from "@follow/components/ui/tooltip/index.jsx"
export interface LinkProps {
href: string
@@ -1,89 +0,0 @@
import clsx from "clsx"
import { AnimatePresence } from "framer-motion"
import { useEffect, useRef, useState } from "react"
import { m } from "~/components/common/Motion"
import { views } from "~/constants"
import { useRouteParamsSelector } from "~/hooks/biz/useRouteParams"
import { FeedViewType } from "~/lib/enum"
export const ListItemHoverOverlay = ({
className,
children,
isActive,
}: {
className?: string
children?: React.ReactNode
isActive?: boolean
}) => {
const [mouseEnter, setMouseEnter] = useState(false)
const ref = useRef<HTMLDivElement>(null)
useEffect(() => {
const $ref = ref.current
if (!$ref) return
const $parent = $ref.parentElement
if (!$parent) return
$parent.onfocus = () => {
setMouseEnter(true)
}
$parent.onblur = () => {
setMouseEnter(false)
}
return () => {
$parent.onfocus = null
$parent.onblur = null
}
}, [])
const view = useRouteParamsSelector((s) => s.view)
const mClassName = clsx(
"absolute z-[-1]",
view !== FeedViewType.SocialMedia
? "bg-zinc-200/80 dark:bg-neutral-800"
: "bg-zinc-100 dark:bg-neutral-800/50",
views[view].wideMode ? "inset-x-0 inset-y-1 rounded-xl" : "-inset-x-2 inset-y-0",
className,
)
const motionConfig = {
initial: {
opacity: 0.2,
},
animate: {
opacity: 1,
},
exit: {
opacity: 0,
},
}
return (
<>
<AnimatePresence>
{mouseEnter && !isActive && (
<m.div
layout
{...motionConfig}
layoutId="list-item-hover-overlay"
className={mClassName}
/>
)}
</AnimatePresence>
{isActive && <m.div {...motionConfig} className={mClassName} />}
<div
ref={ref}
className="relative"
onMouseEnter={() => {
setMouseEnter(true)
}}
onMouseLeave={() => {
setMouseEnter(false)
}}
>
{children}
</div>
</>
)
}
-140
View File
@@ -1,140 +0,0 @@
import { m, useAnimation } from "framer-motion"
import * as React from "react"
import { cloneElement, useEffect } from "react"
import { cn } from "~/lib/utils"
interface LoadingCircleProps {
size: "small" | "medium" | "large"
}
const sizeMap = {
small: 16,
medium: 24,
large: 30,
}
export const LoadingCircle: Component<LoadingCircleProps> = ({ className, size }) => (
<div
className={className}
style={{
fontSize: sizeMap[size],
}}
>
<i className="i-mgc-loading-3-cute-re animate-spin" />
</div>
)
const sizeMap2 = {
small: 30,
medium: 40,
large: 50,
}
const smallIconSizeMap = {
small: 16,
medium: 18,
large: 24,
}
export const LoadingWithIcon: Component<
LoadingCircleProps & {
icon: React.JSX.Element
order?: "loading-first" | "icon-first"
}
> = ({ order = "loading-first", size, className, icon, children }) => {
const rootStyle = { width: sizeMap2[size], height: sizeMap2[size] }
const smallIconStyle = {
height: smallIconSizeMap[size],
width: smallIconSizeMap[size],
}
const Children = children && <div className="center flex">{children}</div>
if (order === "icon-first") {
return (
<div className={className}>
<div style={rootStyle} className="relative inline-block">
<span className="block size-full">
{cloneElement(icon, {
style: {
...icon.props.style,
fontSize: sizeMap2[size],
},
className: cn(icon.props.className),
})}
</span>
<span
className="absolute bottom-1"
style={{
...smallIconStyle,
right: -smallIconSizeMap[size] + 4,
}}
>
<i
className="i-mgc-loading-3-cute-re animate-spin"
style={{ fontSize: smallIconSizeMap[size] }}
/>
</span>
</div>
{Children}
</div>
)
} else {
return (
<div className={className}>
<div style={rootStyle} className="relative inline-block">
<span
className="block size-full"
style={{
clipPath: `polygon(0% 0%, 0% 100%, calc(100% - ${smallIconSizeMap[size]}px) 100%, ${smallIconSizeMap[size]}px ${smallIconSizeMap[size]}px, 100% calc(100% - ${smallIconSizeMap[size]}px), 100% 100%, 100% 100%, 100% 0%)`,
}}
>
<i
className="i-mgc-loading-3-cute-li animate-spin"
style={{ fontSize: sizeMap2[size] }}
/>
</span>
<span
className={cn("absolute bottom-0 right-0", "animate-pulse duration-700")}
style={smallIconStyle}
>
{cloneElement(icon, {
style: {
...icon.props.style,
fontSize: smallIconSizeMap[size],
width: smallIconSizeMap[size],
height: smallIconSizeMap[size],
},
className: icon.props.className,
})}
</span>
</div>
{Children}
</div>
)
}
}
export const RotatingRefreshIcon: React.FC<{
isRefreshing: boolean
className?: string
}> = ({ isRefreshing, className }) => {
const controls = useAnimation()
useEffect(() => {
if (isRefreshing) {
controls.set({ rotate: 0 })
controls.start({
rotate: 360,
transition: { duration: 1, repeat: Infinity, ease: "linear" },
})
} else {
controls.start({
rotate: 360,
transition: { type: "spring" },
})
}
}, [isRefreshing, controls])
return <m.i className={cn("i-mgc-refresh-2-cute-re", className)} animate={controls} />
}
@@ -1,3 +1,4 @@
import { RootPortal } from "@follow/components/ui/portal/index.jsx"
import type { DotLottie } from "@lottiefiles/dotlottie-react"
import { DotLottieReact } from "@lottiefiles/dotlottie-react"
import { atom, useAtomValue } from "jotai"
@@ -6,8 +7,6 @@ import { useEffect, useState } from "react"
import { jotaiStore } from "~/lib/jotai"
import { RootPortal } from "../portal"
const portalElementsAtom = atom([] as ReactNode[])
export function LottieRenderContainer() {
@@ -1,7 +1,7 @@
import { MemoedDangerousHTMLStyle } from "@follow/components/common/MemoedDangerousHTMLStyle.js"
import katexStyle from "katex/dist/katex.min.css?raw"
import { createElement, Fragment, memo, useEffect, useMemo, useRef, useState } from "react"
import { MemoedDangerousHTMLStyle } from "~/components/common/MemoedDangerousHTMLStyle"
import { parseHtml } from "~/lib/parse-html"
import { useWrappedElementSize } from "~/providers/wrapped-element-provider"
@@ -1,8 +1,8 @@
import { cn } from "@follow/utils/utils"
import { useMemo, useState } from "react"
import type { RemarkOptions } from "~/lib/parse-markdown"
import { parseMarkdown } from "~/lib/parse-markdown"
import { cn } from "~/lib/utils"
import { MarkdownRenderContainerRefContext } from "./context"
@@ -1,3 +1,8 @@
import { getViewport, useViewport } from "@follow/components/hooks/useViewport.js"
import { useScrollViewElement } from "@follow/components/ui/scroll-area/hooks.js"
import { getElementTop } from "@follow/utils/dom"
import { springScrollToElement } from "@follow/utils/scroller"
import { cn } from "@follow/utils/utils"
import * as HoverCard from "@radix-ui/react-hover-card"
import { AnimatePresence, m } from "framer-motion"
import { throttle } from "lodash-es"
@@ -13,18 +18,13 @@ import {
} from "react"
import { useEventCallback } from "usehooks-ts"
import { getViewport, useViewport } from "~/atoms/hooks/viewport"
import { useUISettingKey } from "~/atoms/settings/ui"
import { getElementTop } from "~/lib/dom"
import { springScrollToElement } from "~/lib/scroller"
import { cn } from "~/lib/utils"
import {
useGetWrappedElementPosition,
useWrappedElementPosition,
useWrappedElementSize,
} from "~/providers/wrapped-element-provider"
import { useScrollViewElement } from "../../scroll-area/hooks"
import { MarkdownRenderContainerRefContext } from "../context"
import type { TocItemProps } from "./TocItem"
import { TocItem } from "./TocItem"
@@ -1,10 +1,8 @@
import { EllipsisHorizontalTextWithTooltip } from "@follow/components/ui/typography/index.js"
import { cn } from "@follow/utils/utils"
import type { FC, MouseEvent } from "react"
import { memo, useCallback, useRef } from "react"
import { cn } from "~/lib/utils"
import { EllipsisHorizontalTextWithTooltip } from "../../typography"
export interface ITocItem {
depth: number
title: string
@@ -1,7 +1,7 @@
import { cn } from "@follow/utils/utils"
import { useContext } from "react"
import { useContextSelector } from "use-context-selector"
import { cn } from "~/lib/utils"
import { useWrappedElementSize } from "~/providers/wrapped-element-provider"
import { Media } from "../../media"
@@ -1,9 +1,8 @@
import { useScrollViewElement } from "@follow/components/ui/scroll-area/hooks.js"
import { springScrollToElement } from "@follow/utils/scroller"
import { cn } from "@follow/utils/utils"
import { useContext, useId, useRef } from "react"
import { springScrollToElement } from "~/lib/scroller"
import { cn } from "~/lib/utils"
import { useScrollViewElement } from "../../scroll-area/hooks"
import { MarkdownRenderContainerRefContext } from "../context"
export const createHeadingRenderer =
@@ -1,7 +1,6 @@
import { cn } from "@follow/utils/utils"
import { useContext } from "react"
import { cn } from "~/lib/utils"
import { Media } from "../../media"
import { MarkdownRenderActionContext } from "../context"
@@ -1,7 +1,12 @@
import {
Tooltip,
TooltipContent,
TooltipPortal,
TooltipTrigger,
} from "@follow/components/ui/tooltip/index.jsx"
import { useContext } from "react"
import type { LinkProps } from "../../link"
import { Tooltip, TooltipContent, TooltipPortal, TooltipTrigger } from "../../tooltip"
import { MarkdownRenderActionContext } from "../context"
export const MarkdownLink = (props: LinkProps) => {
@@ -1,60 +0,0 @@
import type { PropsWithChildren } from "react"
import { useCallback, useRef, useState } from "react"
import type { MarqueeProps } from "react-fast-marquee"
import Marquee from "react-fast-marquee"
export const TitleMarquee = ({
children,
speed = 30,
play,
className,
...rest
}: PropsWithChildren &
MarqueeProps & {
className?: string
}) => {
const [hovered, setHovered] = useState(false)
const ref = useRef<HTMLDivElement>(null)
const $wrapper = useRef<HTMLDivElement>(null)
return (
<div
className={className}
ref={$wrapper}
// className="[&_*]:scrollbar-none"
onMouseEnter={useCallback(() => {
const $container = ref.current
if (!$container) return
const $child = $container.querySelector(".rfm-child")
if (!$child) return
const canScroll = $child.clientWidth > $container.clientWidth
if (!canScroll) return
setHovered(true)
}, [])}
onMouseLeave={useCallback(() => {
setHovered(false)
const $container = ref.current
if (!$container) return
const marqueeContainer = $container
const marqueeChildren = Array.from(marqueeContainer.children) as HTMLElement[]
// Force a reflow on marquee child nodes to reset animation
marqueeChildren.forEach((marquee: HTMLElement) => {
marquee.style.animation = "none"
void marquee.offsetHeight
marquee.style.animation = ""
})
}, [])}
>
<Marquee className="overflow-hidden" play={hovered} ref={ref} speed={speed} {...rest}>
{children}
</Marquee>
</div>
)
}
+20 -3
View File
@@ -1,12 +1,12 @@
import { nextFrame } from "@follow/utils/dom"
import { cn } from "@follow/utils/utils"
import { useForceUpdate } from "framer-motion"
import type { FC, ImgHTMLAttributes, VideoHTMLAttributes } from "react"
import { createContext, memo, useContext, useMemo, useState } from "react"
import { Blurhash, BlurhashCanvas } from "react-blurhash"
import { useEventCallback } from "usehooks-ts"
import { nextFrame } from "~/lib/dom"
import { getImageProxyUrl } from "~/lib/img-proxy"
import { cn } from "~/lib/utils"
import { saveImageDimensionsToDb } from "~/store/image/db"
import { usePreviewMedia } from "./media/hooks"
@@ -21,6 +21,7 @@ type BaseProps = {
thumbnail?: boolean
blurhash?: string
inline?: boolean
fitContent?: boolean
}
export type MediaProps = BaseProps &
(
@@ -62,6 +63,7 @@ const MediaImpl: FC<MediaProps> = ({
height,
width,
inline,
fitContent,
...rest
} = props
@@ -253,6 +255,7 @@ const MediaImpl: FC<MediaProps> = ({
height={Number.parseInt(props.height as string)}
containerWidth={containerWidth}
noScale={inline}
fitContent={fitContent}
>
<div className="absolute inset-0 flex items-center justify-center overflow-hidden rounded">
{blurhash ? (
@@ -306,6 +309,7 @@ const AspectRatio = ({
children,
style,
noScale,
fitContent,
...props
}: {
width: number
@@ -313,10 +317,23 @@ const AspectRatio = ({
containerWidth?: number
children: React.ReactNode
style?: React.CSSProperties
/**
* Keep the content size for inline image usage
*/
noScale?: boolean
/**
* If `fit` is true, the content width may be increased to fit the container width
*/
fitContent?: boolean
[key: string]: any
}) => {
const scaleFactor = noScale ? 1 : containerWidth && width ? containerWidth / width : 1
const scaleFactor = noScale
? 1
: containerWidth && width
? fitContent
? containerWidth / width
: Math.min(1, containerWidth / width)
: 1
const scaledWidth = width ? width * scaleFactor : undefined
const scaledHeight = height ? height * scaleFactor : undefined
@@ -3,6 +3,7 @@ import "swiper/css/navigation"
import "swiper/css/scrollbar"
import type { MediaModel } from "@follow/shared/hono"
import { cn } from "@follow/utils/utils"
import { useHover } from "@use-gesture/react"
import { uniqBy } from "lodash-es"
import { useRef, useState } from "react"
@@ -10,7 +11,6 @@ import { Mousewheel, Navigation, Scrollbar } from "swiper/modules"
import { Swiper, SwiperSlide } from "swiper/react"
import { Media } from "~/components/ui/media"
import { cn } from "~/lib/utils"
import styles from "./index.module.css"
@@ -98,6 +98,7 @@ export function SwipeMedia({
onPreview?.(uniqMedia, i)
}}
showFallback={true}
fitContent
/>
</SwiperSlide>
))}
@@ -135,6 +136,7 @@ export function SwipeMedia({
height={uniqMedia[0].height}
width={uniqMedia[0].width}
blurhash={uniqMedia[0].blurhash}
fitContent
/>
) : (
<div className="relative flex aspect-video w-full items-center overflow-hidden rounded-t-2xl border-b">
@@ -1,3 +1,8 @@
import { MotionButtonBase } from "@follow/components/ui/button/index.js"
import type { HTMLMediaState } from "@follow/hooks"
import { useRefValue, useVideo } from "@follow/hooks"
import { nextFrame, stopPropagation } from "@follow/utils/dom"
import { cn } from "@follow/utils/utils"
import * as Slider from "@radix-ui/react-slider"
import { useSingleton } from "foxact/use-singleton"
import { m, useDragControls, useSpring } from "framer-motion"
@@ -19,13 +24,7 @@ import { useEventCallback } from "usehooks-ts"
import { AudioPlayer } from "~/atoms/player"
import { IconScaleTransition } from "~/components/ux/transition/icon"
import { useRefValue } from "~/hooks/common"
import type { HTMLMediaState } from "~/hooks/common/factory/createHTMLMediaHook"
import { useVideo } from "~/hooks/common/useVideo"
import { nextFrame, stopPropagation } from "~/lib/dom"
import { cn } from "~/lib/utils"
import { MotionButtonBase } from "../button"
import { softSpringPreset } from "../constants/spring"
import { VolumeSlider } from "./VolumeSlider"
@@ -5,14 +5,16 @@ import { useModalStack } from "../modal/stacked/hooks"
import type { PreviewMediaProps } from "./preview-media"
import { PreviewMediaContent } from "./preview-media"
export const usePreviewMedia = (entryId?: string) => {
export const usePreviewMedia = (children?: React.ReactNode) => {
const { present } = useModalStack()
return useCallback(
(media: PreviewMediaProps[], initialIndex = 0) => {
present({
content: () => (
<div className="relative size-full">
<PreviewMediaContent initialIndex={initialIndex} media={media} entryId={entryId} />
<PreviewMediaContent initialIndex={initialIndex} media={media}>
{children}
</PreviewMediaContent>
</div>
),
title: "Media Preview",
@@ -25,6 +27,6 @@ export const usePreviewMedia = (entryId?: string) => {
clickOutsideToDismiss: true,
})
},
[entryId, present],
[children, present],
)
}
@@ -1,5 +1,9 @@
import { ActionButton, MotionButtonBase } from "@follow/components/ui/button/index.js"
import { RootPortal } from "@follow/components/ui/portal/index.js"
import { IN_ELECTRON } from "@follow/shared/constants"
import type { MediaModel } from "@follow/shared/hono"
import { stopPropagation } from "@follow/utils/dom"
import { cn } from "@follow/utils/utils"
import type { FC } from "react"
import { Fragment, useCallback, useEffect, useRef, useState } from "react"
import { Blurhash } from "react-blurhash"
@@ -12,27 +16,34 @@ import { useWindowSize } from "usehooks-ts"
import { m } from "~/components/common/Motion"
import { COPY_MAP } from "~/constants"
import { tipcClient } from "~/lib/client"
import { stopPropagation } from "~/lib/dom"
import { replaceImgUrlIfNeed } from "~/lib/img-proxy"
import { cn } from "~/lib/utils"
import { EntryContent } from "~/modules/entry-content"
import { ActionButton, MotionButtonBase } from "../button"
import { microReboundPreset } from "../constants/spring"
import { useCurrentModal } from "../modal"
import { RootPortal } from "../portal"
import { FixedModalCloseButton } from "../modal/components/close"
import { useCurrentModal } from "../modal/stacked/hooks"
import { VideoPlayer } from "./VideoPlayer"
const Wrapper: Component<{
src: string
showActions?: boolean
entryId?: string
}> = ({ children, src, showActions, entryId }) => {
sideContent?: React.ReactNode
}> = ({ children, src, showActions, sideContent }) => {
const { dismiss } = useCurrentModal()
const { t } = useTranslation(["shortcuts", "external"])
return (
<div className="center relative size-full px-20 pb-8 pt-10" onClick={dismiss}>
<m.div
onFocusCapture={stopPropagation}
initial={true}
exit={{
opacity: 0,
}}
className="fixed right-3 top-2 flex items-center gap-4"
>
<FixedModalCloseButton onClick={dismiss} />
</m.div>
<m.div
className="center flex size-full"
initial={{ scale: 0.94, opacity: 0 }}
@@ -43,11 +54,13 @@ const Wrapper: Component<{
<div
className={cn(
"relative flex h-full w-auto overflow-hidden",
entryId ? "min-w-96 items-center justify-center rounded-l-xl bg-native" : "rounded-xl",
sideContent
? "min-w-96 items-center justify-center rounded-l-xl bg-native"
: "rounded-xl",
)}
>
{children}
<RootPortal to={entryId ? null : undefined}>
<RootPortal to={sideContent ? null : undefined}>
<div
className="pointer-events-auto absolute bottom-4 right-4 z-[99] flex gap-3 text-theme-vibrancyFg dark:text-white/70 [&_button]:hover:text-theme-vibrancyFg dark:[&_button]:hover:text-white"
onClick={stopPropagation}
@@ -77,12 +90,12 @@ const Wrapper: Component<{
</div>
</RootPortal>
</div>
{entryId && (
{!!sideContent && (
<div
className="box-border flex h-full w-[400px] min-w-0 shrink-0 flex-col rounded-r-xl bg-theme-background px-2 pt-1"
onClick={stopPropagation}
>
<EntryContent entryId={entryId} noMedia compact />
{sideContent}
</div>
)}
</m.div>
@@ -96,8 +109,8 @@ export interface PreviewMediaProps extends MediaModel {
export const PreviewMediaContent: FC<{
media: PreviewMediaProps[]
initialIndex?: number
entryId?: string
}> = ({ media, initialIndex = 0, entryId }) => {
children?: React.ReactNode
}> = ({ media, initialIndex = 0, children }) => {
const [currentMedia, setCurrentMedia] = useState(media[initialIndex])
const [currentSlideIndex, setCurrentSlideIndex] = useState(initialIndex)
const swiperRef = useRef<SwiperRef>(null)
@@ -116,14 +129,14 @@ export const PreviewMediaContent: FC<{
const src = media[0].url
const { type } = media[0]
return (
<Wrapper src={src} showActions={type !== "video"} entryId={entryId}>
<Wrapper src={src} showActions={type !== "video"} sideContent={children}>
{type === "video" ? (
<VideoPlayer
src={src}
controls
autoPlay
muted
className={cn("h-full w-auto object-contain", entryId && "rounded-l-xl")}
className={cn("h-full w-auto object-contain", !!children && "rounded-l-xl")}
onClick={stopPropagation}
/>
) : (
@@ -142,7 +155,11 @@ export const PreviewMediaContent: FC<{
)
}
return (
<Wrapper src={currentMedia.url} showActions={currentMedia.type !== "video"} entryId={entryId}>
<Wrapper
src={currentMedia.url}
showActions={currentMedia.type !== "video"}
sideContent={children}
>
<Swiper
ref={swiperRef}
loop
@@ -301,14 +318,14 @@ const FallbackableImage: FC<
<div className={cn("center flex size-full flex-col", containerClassName)}>
{!isAllError && (
<div
className={cn("relative", width < height && "h-full")}
className={cn("relative max-h-full", width <= height && "h-full")}
style={{
// px-20 pb-8 pt-10
width:
width && height && width > height
? Math.min((windowHeight - 32 - 40) * (width / height), width)
? `${Math.min((windowHeight - 32 - 40) * (width / height), width)}px`
: undefined,
maxWidth: width > height ? windowWidth - 80 - 80 - 400 : undefined,
maxWidth: width > height ? `${windowWidth - 80 - 80 - 400}px` : undefined,
}}
>
<img
@@ -0,0 +1,23 @@
import { Tooltip, TooltipContent, TooltipTrigger } from "@follow/components/ui/tooltip/index.js"
import { useTranslation } from "react-i18next"
export const FixedModalCloseButton: Component<{
onClick: () => void
}> = ({ onClick }) => {
const { t } = useTranslation("common")
return (
<Tooltip>
<TooltipTrigger asChild>
<button
type="button"
className="center flex size-8 rounded-full bg-background p-1 shadow-sm ring-1 ring-zinc-200 dark:ring-neutral-800"
onClick={onClick}
>
<i className="i-mgc-close-cute-re text-lg" />
<span className="sr-only">{t("close")}</span>
</button>
</TooltipTrigger>
<TooltipContent>{t("close")}</TooltipContent>
</Tooltip>
)
}
@@ -1,15 +1,14 @@
import { Button } from "@follow/components/ui/button/index.js"
import { LoadingCircle } from "@follow/components/ui/loading/index.jsx"
import { Tooltip, TooltipContent, TooltipTrigger } from "@follow/components/ui/tooltip/index.jsx"
import { stopPropagation } from "@follow/utils/dom"
import { m } from "framer-motion"
import * as React from "react"
import { useTranslation } from "react-i18next"
import { Button } from "~/components/ui/button"
import { LoadingCircle } from "~/components/ui/loading"
import { useCurrentModal } from "~/components/ui/modal"
import { stopPropagation } from "~/lib/dom"
import { useCurrentModal } from "~/components/ui/modal/stacked/hooks"
import { createErrorToaster } from "~/lib/error-parser"
import { Tooltip, TooltipContent, TooltipTrigger } from "../../tooltip"
export interface UseAsyncFetcher<T> {
data: Nullable<T>
error: Nullable<Error>
@@ -1,15 +1,14 @@
/* eslint-disable react-refresh/only-export-components */
import { useSingleton } from "foxact/use-singleton"
import { useOnce, useTypeScriptHappyCallback } from "@follow/hooks"
import type { FC } from "react"
import { createContext, createElement, useContext } from "react"
import { useEventCallback } from "usehooks-ts"
import type { ModalActionsInternal } from "~/components/ui/modal"
import { useModalStack } from "~/components/ui/modal"
import type { UseAsyncFetcher } from "~/components/ui/modal/helper/async-loading"
import { AsyncModalContent } from "~/components/ui/modal/helper/async-loading"
import { NoopChildren } from "~/components/ui/modal/stacked/custom-modal"
import { useTypeScriptHappyCallback } from "~/hooks/common"
import { useModalStack } from "~/components/ui/modal/stacked/hooks"
export type AsyncModalOptions<T> = {
id: string
@@ -20,6 +19,7 @@ export type AsyncModalOptions<T> = {
// Modal options
overlay?: boolean
clickOutsideToDismiss?: boolean
}
const AsyncModalContext = createContext<AsyncModalOptions<any>>(null!)
export const useAsyncModal = () => {
@@ -63,13 +63,14 @@ const Presentable: FC<{
const { present, dismissTop } = useModalStack()
const ctx = useContext(AsyncModalContext)
useSingleton(() => {
useOnce(() => {
dismissTop()
present({
id: `presentable-${ctx.id}`,
content: (props) => createElement(ctx.content, { data, ...props }),
title: typeof ctx.title === "function" ? ctx.title(data) : ctx.title,
icon: ctx.icon?.(data),
clickOutsideToDismiss: ctx.clickOutsideToDismiss,
})
})
return null
@@ -1,11 +1,14 @@
import { Tooltip, TooltipContent, TooltipTrigger } from "@follow/components/ui/tooltip/index.js"
import type { PropsWithChildren } from "react"
import { createContext, useContext } from "react"
import { useTranslation } from "react-i18next"
import { Link } from "react-router-dom"
import { m } from "~/components/common/Motion"
import { microReboundPreset } from "../../constants/spring"
import { useModalStack } from "../stacked"
import { FixedModalCloseButton } from "../components/close"
import { useCurrentModal, useModalStack } from "../stacked/hooks"
const InPeekModal = createContext(false)
export const useInPeekModal = () => useContext(InPeekModal)
@@ -14,8 +17,10 @@ export const PeekModal = (
to: string
}>,
) => {
const { dismissAll, dismissTop } = useModalStack()
const { dismissAll } = useModalStack()
const { to, children } = props
const { t } = useTranslation("common")
const { dismiss } = useCurrentModal()
return (
<div className="relative mx-auto mt-[10vh] max-w-full overflow-auto px-2 scrollbar-none lg:max-w-[65rem] lg:p-0">
@@ -28,7 +33,6 @@ export const PeekModal = (
>
<InPeekModal.Provider value={true}>{children}</InPeekModal.Provider>
</m.div>
<m.div
initial={true}
exit={{
@@ -36,23 +40,20 @@ export const PeekModal = (
}}
className="fixed right-3 top-2 flex items-center gap-4"
>
<Link
className="center flex size-8 rounded-full p-1 shadow-sm ring-1 ring-zinc-200 dark:ring-neutral-800"
to={to}
onClick={dismissAll}
>
<i className="i-mgc-fullscreen-2-cute-re text-lg" />
<span className="sr-only">Go to this link</span>
</Link>
<button
type="button"
className="center flex size-8 rounded-full p-1 shadow-sm ring-1 ring-zinc-200 dark:ring-neutral-800"
onClick={dismissTop}
>
<i className="i-mgc-close-cute-re text-lg" />
<span className="sr-only">Dimiss</span>
</button>
<Tooltip>
<TooltipTrigger asChild>
<Link
className="center flex size-8 cursor-button rounded-full bg-theme-background p-1 shadow-sm ring-1 ring-zinc-200 dark:ring-neutral-800"
to={to}
onClick={dismissAll}
>
<i className="i-mgc-fullscreen-2-cute-re text-lg" />
<span className="sr-only">Go to this link</span>
</Link>
</TooltipTrigger>
<TooltipContent>{t("words.expand")}</TooltipContent>
</Tooltip>
<FixedModalCloseButton onClick={dismiss} />
</m.div>
</div>
)
@@ -1,6 +1,6 @@
import { MotionButtonBase } from "@follow/components/ui/button/index.js"
import { useTranslation } from "react-i18next"
import { MotionButtonBase } from "../../button"
import { useCurrentModal } from "./hooks"
export const ModalClose = () => {
@@ -1,10 +1,9 @@
import { nextFrame, stopPropagation } from "@follow/utils/dom"
import { cn } from "@follow/utils/utils"
import { m, useAnimationControls } from "framer-motion"
import type { FC, PropsWithChildren } from "react"
import { useEffect, useState } from "react"
import { nextFrame, stopPropagation } from "~/lib/dom"
import { cn } from "~/lib/utils"
import { ModalClose } from "./components"
import { useCurrentModal } from "./hooks"
@@ -1,9 +1,9 @@
import { cn } from "@follow/utils/utils"
import { AnimatePresence } from "framer-motion"
import type { FC, ReactNode } from "react"
import { useId, useMemo } from "react"
import { jotaiStore } from "~/lib/jotai"
import { cn } from "~/lib/utils"
import { modalStackAtom } from "./atom"
import { ModalInternal } from "./modal"
@@ -1,6 +1,7 @@
export * from "./context"
export * from "./helper"
export * from "./hooks"
// NOTE: This one can easily cause a circular dependency
// export * from "./hooks"
export * from "./modal"
export * from "./provider"
export * from "./types"
@@ -1,8 +1,7 @@
import { nextFrame } from "@follow/utils/dom"
import { useAnimationControls } from "framer-motion"
import { useCallback, useEffect } from "react"
import { nextFrame } from "~/lib/dom"
import { modalMontionConfig } from "../constants"
/**
@@ -1,7 +1,6 @@
import { nextFrame } from "@follow/utils/dom"
import { useCallback, useRef } from "react"
import { nextFrame } from "~/lib/dom"
/**
* @internal
*
@@ -1,3 +1,9 @@
import { Divider } from "@follow/components/ui/divider/index.js"
import { RootPortalProvider } from "@follow/components/ui/portal/provider.js"
import { EllipsisHorizontalTextWithTooltip } from "@follow/components/ui/typography/index.js"
import { useRefValue } from "@follow/hooks"
import { nextFrame, stopPropagation } from "@follow/utils/dom"
import { cn, getOS } from "@follow/utils/utils"
import * as Dialog from "@radix-ui/react-dialog"
import type { BoundingBox } from "framer-motion"
import { produce } from "immer"
@@ -24,13 +30,8 @@ import { SafeFragment } from "~/components/common/Fragment"
import { m } from "~/components/common/Motion"
import { ErrorComponentType } from "~/components/errors/enum"
import { ElECTRON_CUSTOM_TITLEBAR_HEIGHT, isElectronBuild } from "~/constants"
import { useRefValue, useSwitchHotKeyScope } from "~/hooks/common"
import { nextFrame, stopPropagation } from "~/lib/dom"
import { cn, getOS } from "~/lib/utils"
import { useSwitchHotKeyScope } from "~/hooks/common"
import { Divider } from "../../divider"
import { RootPortalProvider } from "../../portal/provider"
import { EllipsisHorizontalTextWithTooltip } from "../../typography"
import { modalStackAtom } from "./atom"
import { MODAL_STACK_Z_INDEX, modalMontionConfig } from "./constants"
import type { CurrentModalContentProps, ModalActionsInternal } from "./context"
@@ -1,10 +1,10 @@
import { cn } from "@follow/utils/utils"
import * as Dialog from "@radix-ui/react-dialog"
import { AnimatePresence } from "framer-motion"
import type { ForwardedRef } from "react"
import { forwardRef } from "react"
import { m } from "~/components/common/Motion"
import { cn } from "~/lib/utils"
export const ModalOverlay = forwardRef(
(

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