diff --git a/.idea/workspace.xml b/.idea/workspace.xml index a1a4cc116..7c463cc0e 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,13 +4,12 @@ - - - - - - - - @@ -820,7 +813,15 @@ - diff --git a/public/sw.js b/public/sw.js index bdb339b9f..7adf491c7 100644 --- a/public/sw.js +++ b/public/sw.js @@ -1 +1 @@ -if(!self.define){let e,s={};const a=(a,i)=>(a=new URL(a+".js",i).href,s[a]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=a,e.onload=s,document.head.appendChild(e)}else e=a,importScripts(a),s()})).then((()=>{let e=s[a];if(!e)throw new Error(`Module ${a} didn’t register its module`);return e})));self.define=(i,c)=>{const n=e||("document"in self?document.currentScript.src:"")||location.href;if(s[n])return;let t={};const r=e=>a(e,n),f={module:{uri:n},exports:t,require:r};s[n]=Promise.all(i.map((e=>f[e]||r(e)))).then((e=>(c(...e),t)))}}define(["./workbox-9b4d2a02"],(function(e){"use strict";importScripts(),self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"/_next/app-build-manifest.json",revision:"06fdf70fd91fa81536d0852ea74a23ef"},{url:"/_next/static/VV5f62Zx5kv2Nq-8J-Vbe/_buildManifest.js",revision:"d2412658a613585afb7ea2608e1b5916"},{url:"/_next/static/VV5f62Zx5kv2Nq-8J-Vbe/_ssgManifest.js",revision:"b6652df95db52feb4daf4eca35380933"},{url:"/_next/static/chunks/1172-6fa635d4ba219142.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/13b76428-3a27edfd28c29f16.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/140-0ef6f4bce2ead6e5.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/20-fa165387485c2498.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/210-1ace67500e0574d9.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/2315-6b2b9ab1b69e9efb.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/2355-1bf5d25680f416aa.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/2536-a533303517ccb76b.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/2763-a1febe40f86a3509.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/2793-300c3afe2fbe36c0.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/3aba9d11-f088ea721efdb495.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/4218-68f36d262194bd0b.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/4351-3b599832ff5e4a8d.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/52271efe-1246535f067d990c.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/6107-989d876e8f5c37a7.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/62c88095-d6f38dd65f2fe347.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/6861-e71946cf14fc1fcd.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/7023-46269df5627bf76c.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/7177-815bcdf666b579f0.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/7497-f53bb153b74a7f56.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/77befd7b-fe3783b26f236ca4.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/8210-5f471b99a034197a.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/8470-f1afa765cb3360de.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/9390-2a3dc46a0308d7fa.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/964-87dd0cb2aa692199.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/9691.14c502a3524d7148.js",revision:"14c502a3524d7148"},{url:"/_next/static/chunks/9706-257cfb41f9cfc2c4.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/9950-5a130dd5358d6d99.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/aaea2bcf-0636c7544f3f93b2.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/%5B...slugs%5D/page-5541c7adfad09881.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/(staticPages)/about/page-685487389ccac0a4.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/(staticPages)/contributors/page-8fe6da2ebb35db05.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/(staticPages)/faq/page-b4addf4bd458b632.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/(staticPages)/guest-post/page-e21b77d0386f5402.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/(staticPages)/privacy-policy/page-d54c19c49ce9abf2.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/(staticPages)/terms-of-service/page-33accf6d37613c26.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/(staticPages)/whitepaper/page-840a50dd1067d892.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/_not-found/page-87a42e0a62a94f4f.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/auth/page-e6b0078a5e209d7e.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/chats/%5B...params%5D/page-98ec5a2b93f34b09.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/chats/page-5a3483e53930935a.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/communities/create-hs/page-d276c97411f15ddc.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/communities/create/page-75872cb239addd8e.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/communities/layout-699bddd7c1b057ff.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/communities/loading-c181245d6749a122.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/communities/page-6ae75e2af71c7eba.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/contribute/page-f67368908b334781.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/decks/page-3637962c7a5863db.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/discover/layout-567fc94b563ff3e1.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/discover/loading-51d598877fc97e4e.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/discover/page-4a03f22a34dbd636.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/draft/%5Bid%5D/page-5b6e9a8b7844533a.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/layout-9507ffad13c65f62.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/market/advanced/page-2203ef4515845c26.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/market/limit/page-589811b37df70d1d.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/market/page-42239778a9c6cc06.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/market/swap/page-5ccc784c671c0f04.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/not-found-6e3c1c3ca3c07052.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/onboard-friend/%5B...slugs%5D/page-b6de48a7473cfd37.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/page-e7f978be6e08e265.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/perks/page-20018ef11aee5801.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/proposals/%5Bid%5D/page-3d938a8c9fbc44ff.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/proposals/page-e6043dc1eb0df232.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/purchase/page-5fd977fc1c77fed9.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/search/page-be294eac4c518812.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/signup/page-f23b962f0180d107.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/submit/page-be4d74f0804cdda8.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/app/witnesses/page-7fd997de4dfec3e6.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/c0e397d0-d86ae2426f017668.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/eeac573e-fe0a55ceeef5ebdf.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/fd9d1056-98dfef589c2ee860.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/framework-0af805db6f0c0b82.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/main-8926b8a01066d44e.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/main-app-f2463f3514d5e713.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/pages/_app-f870474a17b7f2fd.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/pages/_error-c66a4e8afc46f17b.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js",revision:"79330112775102f91e1010318bae2bd3"},{url:"/_next/static/chunks/public/assets/notification.7cf94838874c04af.mp3",revision:"7cf94838874c04af"},{url:"/_next/static/chunks/webpack-06a1e20fc5da1d01.js",revision:"VV5f62Zx5kv2Nq-8J-Vbe"},{url:"/_next/static/css/0e316016ae6ca244.css",revision:"0e316016ae6ca244"},{url:"/_next/static/css/1d5d4ebc1cd30c53.css",revision:"1d5d4ebc1cd30c53"},{url:"/_next/static/css/299d776a4aa8641f.css",revision:"299d776a4aa8641f"},{url:"/_next/static/css/2ceade599589d2b8.css",revision:"2ceade599589d2b8"},{url:"/_next/static/css/4c219b8c84cc5e5a.css",revision:"4c219b8c84cc5e5a"},{url:"/_next/static/css/513be94db61781f1.css",revision:"513be94db61781f1"},{url:"/_next/static/css/551656fb847f38d0.css",revision:"551656fb847f38d0"},{url:"/_next/static/css/651733de5938119d.css",revision:"651733de5938119d"},{url:"/_next/static/css/75a5c09387da9bea.css",revision:"75a5c09387da9bea"},{url:"/_next/static/css/7909d0565a6899cf.css",revision:"7909d0565a6899cf"},{url:"/_next/static/css/80594a425fa78f01.css",revision:"80594a425fa78f01"},{url:"/_next/static/css/865f7ab4ef834569.css",revision:"865f7ab4ef834569"},{url:"/_next/static/css/97e918a903ab54c0.css",revision:"97e918a903ab54c0"},{url:"/_next/static/css/c69ae03a9f10c92f.css",revision:"c69ae03a9f10c92f"},{url:"/_next/static/css/ce623685369f6d01.css",revision:"ce623685369f6d01"},{url:"/_next/static/css/e62cdbc508f48afc.css",revision:"e62cdbc508f48afc"},{url:"/_next/static/css/ec4522ef7880f964.css",revision:"ec4522ef7880f964"},{url:"/_next/static/css/fe6943005e1bbbfe.css",revision:"fe6943005e1bbbfe"},{url:"/_next/static/media/arrow1-about.656281e6.png",revision:"656281e6"},{url:"/_next/static/media/arrow2-about.1b039bcc.png",revision:"1b039bcc"},{url:"/_next/static/media/arrow3-about.70f825ed.png",revision:"70f825ed"},{url:"/_next/static/media/back-clouds-down.4d526728.png",revision:"4d526728"},{url:"/_next/static/media/back-clouds-up.23f147d4.png",revision:"23f147d4"},{url:"/_next/static/media/cloud1-about.2cdc493a.png",revision:"2cdc493a"},{url:"/_next/static/media/cloud2-about.32fd33bd.png",revision:"32fd33bd"},{url:"/_next/static/media/fallback.d0906556.png",revision:"8713aeba6805ef460b16fa081edd1887"},{url:"/_next/static/media/index-bg.6a2f476b.png",revision:"6a2f476b"},{url:"/_next/static/media/logo-circle.9f6f8f1c.svg",revision:"2df6f251431f9f36e1815e5b90ce1f8a"},{url:"/_next/static/media/noimage.7dc5d3ff.svg",revision:"68711d71516a091f18169b2882dc6035"},{url:"/_next/static/media/noimage.f7ce9bd0.png",revision:"f7ce9bd0"},{url:"/_next/static/media/thumbnail-play.348281a6.jpg",revision:"99d63c99267bf2e74e95d92bfb00a0ea"},{url:"/assets/arrow1-about.png",revision:"4340c5b200d5d51631f944aad1ee2b5e"},{url:"/assets/arrow2-about.png",revision:"a73b3fcfc161b35e762e52e1810612f9"},{url:"/assets/arrow3-about.png",revision:"6c58e88a02000b98b2f500275e173068"},{url:"/assets/back-clouds-down.png",revision:"12a7304745da678d47a0072132c810c1"},{url:"/assets/back-clouds-up.png",revision:"e56f90fa70a1fe82aebb5f997b823f28"},{url:"/assets/bg-download-mob-dark.png",revision:"8c9a7504cdb60835ef0d39b0f448571d"},{url:"/assets/bg-download-mob-dark.webp",revision:"6a8c212f5d2cb66f259a4a8aa3af3311"},{url:"/assets/bg-download-mob-light.png",revision:"d92057b43d7e4217175d35b944141645"},{url:"/assets/bg-download-mob-light.webp",revision:"a225c5595468ab97f62a03246753cce6"},{url:"/assets/bg-download-tiny-dark.svg",revision:"4dfcf8aaeeb8a52d21bb3525d541ed5b"},{url:"/assets/bg-download-tiny.webp",revision:"a0a4bfab2ddbad09183baf2afe07a616"},{url:"/assets/bubble-center.png",revision:"5606f7307c513e99f36699e10f23ccf9"},{url:"/assets/bubble-center.webp",revision:"ef695adcbbd8936ed59f350682e61397"},{url:"/assets/bubble-left-bottom.png",revision:"df2d82a18a6135cf028abbf11781da69"},{url:"/assets/bubble-left-bottom.webp",revision:"ed0725bf3ac081532ad28a113a25bb0e"},{url:"/assets/bubble-left-top.png",revision:"5485d77a530a6f998e1e0c95cc58d223"},{url:"/assets/bubble-left-top.webp",revision:"cf1c941f7f1bde7958ebc663e7dd2f14"},{url:"/assets/bubble-right-bottom.png",revision:"c34007e9b2e094b58d0ad9f149efe7a6"},{url:"/assets/bubble-right-bottom.webp",revision:"c2189eac8ac13d5a006194e4171148b4"},{url:"/assets/bubble-right-top.png",revision:"6401d7510d2dda133da4f77b8e5857c3"},{url:"/assets/bubble-right-top.webp",revision:"06037b88ba36932c52d5484a2db3c735"},{url:"/assets/cloud1-about.png",revision:"d66dc0e33618136110dc0a851f98f4cc"},{url:"/assets/cloud1.png",revision:"28c7c7b997fb3662e2d21549b32b2972"},{url:"/assets/cloud2-about.png",revision:"8774eb6432d37ac1ecf7deaea117e1a5"},{url:"/assets/cloud2.png",revision:"a66f13dbef7a3324ab1d105991295e00"},{url:"/assets/cloud3.png",revision:"8889d6546ce489ca120d960479fc04d1"},{url:"/assets/coming-soon.png",revision:"ef24f5a15258aaa3846af7089935bf0a"},{url:"/assets/community-img.svg",revision:"3fd1e229d9517bb74c4e4903d9109ded"},{url:"/assets/cover-fallback-day.png",revision:"595641ae8f1d3b74ee12ee0b8878a520"},{url:"/assets/cover-fallback-night.png",revision:"bb6096d6a3e471fa7a8f869562d340db"},{url:"/assets/download-algae-dark.png",revision:"8c70504a94da6e93f4ac1b27046eb939"},{url:"/assets/download-algae-dark.webp",revision:"89a79f1000ca9995a6e14cfc60fd42a9"},{url:"/assets/download-algae.png",revision:"2490f946a17ba1abe4456f0f31d850a3"},{url:"/assets/download-algae.webp",revision:"1d97c2b64cfd934481e18c49ec8e8722"},{url:"/assets/download-dark-fishes.png",revision:"537442c023e388e9e33a93c821094381"},{url:"/assets/download-dark-fishes.webp",revision:"a36ea49d16f9c4b1e2833c2f6bbc618f"},{url:"/assets/dunsky.jpeg",revision:"6af464219667bd1b7a8b05a3a3133cf4"},{url:"/assets/dunsky.webp",revision:"abb98406fd78ae7cbf1ccf61e6b0a8f2"},{url:"/assets/ecency-faq.jpg",revision:"e2d5d30d0cb4a5fc5e470c56d62ede97"},{url:"/assets/ecency-faq.webp",revision:"42faa678c7ef5854f9ed0c999f6ef7eb"},{url:"/assets/fallback.png",revision:"8713aeba6805ef460b16fa081edd1887"},{url:"/assets/fish-1.png",revision:"4386e9af02b5f60f75caa040eced9a65"},{url:"/assets/fish-1.webp",revision:"8f0eb1179c74579084353e5df5b2a74f"},{url:"/assets/fish-2.png",revision:"92ce36fc40b95aeb3475d081bba0d798"},{url:"/assets/fish-2.webp",revision:"fe0c99a9f185d8b2e94bd249e625cf27"},{url:"/assets/fish-3.png",revision:"89c59580c072f1dbf52ac03068f040f3"},{url:"/assets/fish-3.webp",revision:"b9c3a3cc1cd0329d74ddb62d3a4e4b43"},{url:"/assets/fish-4.png",revision:"b91622c6328bbba13847519e0356db62"},{url:"/assets/fish-4.webp",revision:"a404c3ef59a9581554c06188ee262419"},{url:"/assets/fish-5.png",revision:"b271e3992390713707dc08f01691fb52"},{url:"/assets/fish-5.webp",revision:"abb4e590246f17bd00a21f7b414872d3"},{url:"/assets/fish-junior.png",revision:"78924f1ba81f1f59dd9a144be923edb1"},{url:"/assets/fish-junior.webp",revision:"bcae2a76d249cad55891d24e41e73b0c"},{url:"/assets/fish-senior.png",revision:"f3327a9c9d166c9da097fcfe88f38ed3"},{url:"/assets/fish-senior.webp",revision:"c70cf25bd04d52decb151396c900dcb3"},{url:"/assets/footer-discord.svg",revision:"04238f73e8da0be200731a4cc285d00e"},{url:"/assets/footer-main-fish.png",revision:"ba3d7c5371e84bdf30f6dee4d086a156"},{url:"/assets/footer-main-fish.webp",revision:"ac45436a3109caf9f94a2cd00f681783"},{url:"/assets/footer-telegram.svg",revision:"796b996dc8082544484feb13a97aa014"},{url:"/assets/footer-twitter.svg",revision:"c44b68c3cdee7732ce516bc250f6f27c"},{url:"/assets/footer-youtube.svg",revision:"6f91ba3c2f20618d27c15bff5352aba6"},{url:"/assets/github-cover.png",revision:"5eaca17c4b526f9b352a87a5a82dbfe4"},{url:"/assets/good-karma.jpeg",revision:"a7bb11629694bd7f9bd2b16bf058bb6b"},{url:"/assets/good-karma.webp",revision:"9a449b33cf032238499916c25584f58d"},{url:"/assets/hero-algae-dark.svg",revision:"eaa27188f9a588164e731b9f4a8f8295"},{url:"/assets/hero-algae-light.svg",revision:"4efcd71e3e8f8574446eeaa7a7517e33"},{url:"/assets/hero-fishes-dark.png",revision:"f8d8e17b68e2ff1490202f8503d24770"},{url:"/assets/hero-fishes.svg",revision:"a6307454b1e0fc4bcb6d402c33a63c7f"},{url:"/assets/hive-signer.svg",revision:"579ae88263a03ea7c8c4a9ec4e8b67f7"},{url:"/assets/icon-android-white.svg",revision:"f7df8d801059a45a14d1e90864157b1f"},{url:"/assets/icon-android.png",revision:"606b1396c3fffa5dc0f1d074695fab49"},{url:"/assets/icon-android.webp",revision:"c6bd14c9917803f8f69c4557be95ad9e"},{url:"/assets/icon-apple-white.svg",revision:"e4de9f34c14e50ed4fd12847091c16d2"},{url:"/assets/icon-apple.svg",revision:"a27b1b4829e566dca6d38f7c2e6d6ba5"},{url:"/assets/icon-windows-white.svg",revision:"4553dd690e4675fc4fb2132732b1c43b"},{url:"/assets/icon-windows.svg",revision:"80669c801739c850306618a2569b423c"},{url:"/assets/illustration-decentralization.png",revision:"0ad91ae4e70f22e8be87345e73144cb3"},{url:"/assets/illustration-decentralization.webp",revision:"ed3442432df26760623ec58c715fdf43"},{url:"/assets/illustration-earn-money.png",revision:"e2a7951254764e3dabac0697d089a3c2"},{url:"/assets/illustration-earn-money.webp",revision:"58605a59b4c1f6321ef90d5ef21eac24"},{url:"/assets/illustration-hero-day.png",revision:"ca7c9fd189caa73616664823e45b737d"},{url:"/assets/illustration-hero-day.webp",revision:"66c0bb6d0864af304a4e1801c967c526"},{url:"/assets/illustration-hero.png",revision:"9e2e1a46dc78fb0635c054fcf2d27b67"},{url:"/assets/illustration-hero.webp",revision:"75c6cdf85d150e6512fd2b3d0e20e332"},{url:"/assets/illustration-open-source.png",revision:"6f20524696843277aca578db00f29e14"},{url:"/assets/illustration-open-source.webp",revision:"79bf861b3c83c7de1ac96d8a35c4827d"},{url:"/assets/illustration-true-ownership.png",revision:"005b4f456f8d341de75c8c7cb25d750c"},{url:"/assets/illustration-true-ownership.webp",revision:"a2819f44d481e3203270877dc89cf87c"},{url:"/assets/index-bg.png",revision:"0931098d955341c1458c653ef42c5bec"},{url:"/assets/keychain.png",revision:"b4a1776481ec1bce0cdcb654126ee449"},{url:"/assets/left-fishes.png",revision:"c98d0bac15e561c7e4ce226541f5ab1e"},{url:"/assets/left-fishes.webp",revision:"7e5f5cee88eafa722b9b2eadbede120d"},{url:"/assets/like.png",revision:"af5f38b521e1c06eece664d5a3f24cdd"},{url:"/assets/logo-192x192.svg",revision:"09f9b1ec26a43fedaf3c527d9992ea3b"},{url:"/assets/logo-384x384.svg",revision:"c33b1a087528562650bdc7f9bb1889b3"},{url:"/assets/logo-512x512.svg",revision:"e0eb6d6416139753e199cf627599ac40"},{url:"/assets/logo-circle-santa.svg",revision:"a08e76920a86e2749d74345d86797cc5"},{url:"/assets/logo-circle.svg",revision:"2df6f251431f9f36e1815e5b90ce1f8a"},{url:"/assets/logo-small-transparent.png",revision:"197b6e7934149c67237a38f145dfb860"},{url:"/assets/noimage.png",revision:"66290b70590324b996aa6c841a4f6bf1"},{url:"/assets/noimage.svg",revision:"68711d71516a091f18169b2882dc6035"},{url:"/assets/notification.mp3",revision:"594e6e429f66513a2bc759fce6c1abc7"},{url:"/assets/nsfw.png",revision:"2e103d3e107e2974025b441b5fde485a"},{url:"/assets/our-history.png",revision:"730ae7e9850b787ea78d6151391ca463"},{url:"/assets/our-history.webp",revision:"f781b93801170a83acde5cf23bf538f4"},{url:"/assets/our-team.png",revision:"dc4a40a5f543e793462caf5c19d89f2f"},{url:"/assets/our-team.webp",revision:"ca3d13a54a5ba9e7e7df7af748c3a23a"},{url:"/assets/our-vision.png",revision:"acb541b415884dfce4b061ad21ce1b06"},{url:"/assets/our-vision.webp",revision:"bfe56f6816dade138c59010d69a8f83f"},{url:"/assets/phone-dark-pc.png",revision:"ba94fb9341a0303a8f6068ade064b0cb"},{url:"/assets/phone-dark-pc.webp",revision:"beef47eb0f0d9e6708e172b2138c48ab"},{url:"/assets/phone-dark-tablet.png",revision:"2358c7d62d813d3422a5af8bebb2be2e"},{url:"/assets/phone-dark-tablet.webp",revision:"c42d66f8c5c1999a648e6bb6a1a81227"},{url:"/assets/phone-download-tiny.png",revision:"0247b2bb16c64d46e4d8a73f60f4d501"},{url:"/assets/phone-download-tiny.webp",revision:"7120bd905eb5e5acbc866bd42058ba4c"},{url:"/assets/phone-download.png",revision:"54650a95d8ce20a2e03b68f0d6389201"},{url:"/assets/phone-light-pc.png",revision:"7bbef75c3da1d2a8e742b484292e6379"},{url:"/assets/phone-light-pc.webp",revision:"4a5839bf3499ef6687f1a798c683d7a1"},{url:"/assets/phone-light-tablet.png",revision:"49724acf6a25fedcd914ce0125517b8a"},{url:"/assets/phone-light-tablet.webp",revision:"7f448063c46119c5a7f0880f01b1814d"},{url:"/assets/reward.png",revision:"0faea76d5486dc7f637486da769fdad8"},{url:"/assets/rewarding-and-freespeech.png",revision:"ca1fc97612079d93de24bfb3ab6e0ea9"},{url:"/assets/rewarding-and-freespeech.svg",revision:"2df6f251431f9f36e1815e5b90ce1f8a"},{url:"/assets/signup.png",revision:"1ceacafe5770ed4f53829de572c9d219"},{url:"/assets/svg.tsx",revision:"2f1d7fbc25f8166e5b49e8997a803842"},{url:"/assets/talhasch.jpeg",revision:"9abb1df5ddbfd25e7fd72b0a4e202eff"},{url:"/assets/talhasch.webp",revision:"6e7e49e9ba1da71ecf46f0bb17c986c3"},{url:"/assets/thumbnail-play.jpg",revision:"99d63c99267bf2e74e95d92bfb00a0ea"},{url:"/assets/writer-thinking.png",revision:"03deb40c2a35de193e78c0e0d3d72a0e"},{url:"/assets/writer.png",revision:"00feab482a3f5309cce64ce9ca64041a"},{url:"/firebase-messaging-sw.js",revision:"db67bd2ec72e44b813ccabeb1ebb113f"},{url:"/manifest.json",revision:"3547aead3cd7bbd2b2ab3b7e23355d84"},{url:"/next.svg",revision:"8e061864f388b47f33a1c3780831193e"},{url:"/vercel.svg",revision:"61c6b19abff40ea7acd577be818f3976"}],{ignoreURLParametersMatching:[]}),e.cleanupOutdatedCaches(),e.registerRoute("/",new e.NetworkFirst({cacheName:"start-url",plugins:[{cacheWillUpdate:async({request:e,response:s,event:a,state:i})=>s&&"opaqueredirect"===s.type?new Response(s.body,{status:200,statusText:"OK",headers:s.headers}):s}]}),"GET"),e.registerRoute(/^https:\/\/fonts\.(?:gstatic)\.com\/.*/i,new e.CacheFirst({cacheName:"google-fonts-webfonts",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:31536e3})]}),"GET"),e.registerRoute(/^https:\/\/fonts\.(?:googleapis)\.com\/.*/i,new e.StaleWhileRevalidate({cacheName:"google-fonts-stylesheets",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:604800})]}),"GET"),e.registerRoute(/\.(?:eot|otf|ttc|ttf|woff|woff2|font.css)$/i,new e.StaleWhileRevalidate({cacheName:"static-font-assets",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:604800})]}),"GET"),e.registerRoute(/\.(?:jpg|jpeg|gif|png|svg|ico|webp)$/i,new e.StaleWhileRevalidate({cacheName:"static-image-assets",plugins:[new e.ExpirationPlugin({maxEntries:64,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\/_next\/image\?url=.+$/i,new e.StaleWhileRevalidate({cacheName:"next-image",plugins:[new e.ExpirationPlugin({maxEntries:64,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:mp3|wav|ogg)$/i,new e.CacheFirst({cacheName:"static-audio-assets",plugins:[new e.RangeRequestsPlugin,new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:mp4)$/i,new e.CacheFirst({cacheName:"static-video-assets",plugins:[new e.RangeRequestsPlugin,new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:js)$/i,new e.StaleWhileRevalidate({cacheName:"static-js-assets",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:css|less)$/i,new e.StaleWhileRevalidate({cacheName:"static-style-assets",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\/_next\/data\/.+\/.+\.json$/i,new e.StaleWhileRevalidate({cacheName:"next-data",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:json|xml|csv)$/i,new e.NetworkFirst({cacheName:"static-data-assets",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute((({url:e})=>{if(!(self.origin===e.origin))return!1;const s=e.pathname;return!s.startsWith("/api/auth/")&&!!s.startsWith("/api/")}),new e.NetworkFirst({cacheName:"apis",networkTimeoutSeconds:10,plugins:[new e.ExpirationPlugin({maxEntries:16,maxAgeSeconds:86400})]}),"GET"),e.registerRoute((({url:e})=>{if(!(self.origin===e.origin))return!1;return!e.pathname.startsWith("/api/")}),new e.NetworkFirst({cacheName:"others",networkTimeoutSeconds:10,plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute((({url:e})=>!(self.origin===e.origin)),new e.NetworkFirst({cacheName:"cross-origin",networkTimeoutSeconds:10,plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:3600})]}),"GET")})); +if(!self.define){let e,s={};const a=(a,i)=>(a=new URL(a+".js",i).href,s[a]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=a,e.onload=s,document.head.appendChild(e)}else e=a,importScripts(a),s()})).then((()=>{let e=s[a];if(!e)throw new Error(`Module ${a} didn’t register its module`);return e})));self.define=(i,n)=>{const c=e||("document"in self?document.currentScript.src:"")||location.href;if(s[c])return;let t={};const r=e=>a(e,c),o={module:{uri:c},exports:t,require:r};s[c]=Promise.all(i.map((e=>o[e]||r(e)))).then((e=>(n(...e),t)))}}define(["./workbox-9b4d2a02"],(function(e){"use strict";importScripts(),self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"/_next/app-build-manifest.json",revision:"0e4efa53010a1eb8a75ecd282e7f3aac"},{url:"/_next/static/chunks/1172-6fa635d4ba219142.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/13b76428-3a27edfd28c29f16.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/140-0ef6f4bce2ead6e5.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/20-fa165387485c2498.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/210-1ace67500e0574d9.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/2315-fe913af263aad2a1.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/2355-1bf5d25680f416aa.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/2536-a533303517ccb76b.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/2763-a1febe40f86a3509.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/2793-300c3afe2fbe36c0.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/3aba9d11-f088ea721efdb495.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/4218-68f36d262194bd0b.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/4351-3b599832ff5e4a8d.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/52271efe-1246535f067d990c.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/6107-989d876e8f5c37a7.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/62c88095-d6f38dd65f2fe347.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/6861-e253a325bb4cc6fd.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/7023-46269df5627bf76c.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/7177-815bcdf666b579f0.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/7497-063e406b01d9d51e.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/77befd7b-fe3783b26f236ca4.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/8210-1a6e04ca03a2dd5f.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/8470-f1afa765cb3360de.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/9390-2a3dc46a0308d7fa.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/964-87dd0cb2aa692199.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/9691.14c502a3524d7148.js",revision:"14c502a3524d7148"},{url:"/_next/static/chunks/9706-257cfb41f9cfc2c4.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/9950-5a130dd5358d6d99.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/aaea2bcf-0636c7544f3f93b2.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/%5B...slugs%5D/page-0d75a6d47bdfc16e.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/(staticPages)/about/page-685487389ccac0a4.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/(staticPages)/contributors/page-8fe6da2ebb35db05.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/(staticPages)/faq/page-b4addf4bd458b632.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/(staticPages)/guest-post/page-e21b77d0386f5402.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/(staticPages)/privacy-policy/page-d54c19c49ce9abf2.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/(staticPages)/terms-of-service/page-33accf6d37613c26.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/(staticPages)/whitepaper/page-840a50dd1067d892.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/_not-found/page-87a42e0a62a94f4f.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/auth/page-e6b0078a5e209d7e.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/chats/%5B...params%5D/page-98ec5a2b93f34b09.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/chats/page-5a3483e53930935a.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/communities/create-hs/page-d276c97411f15ddc.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/communities/create/page-75872cb239addd8e.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/communities/layout-699bddd7c1b057ff.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/communities/loading-c181245d6749a122.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/communities/page-0a672aa2111d7b86.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/contribute/page-f67368908b334781.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/decks/page-755450c26ff0e0e4.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/discover/layout-567fc94b563ff3e1.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/discover/loading-175daee3d466b725.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/discover/page-70d483b81e83df98.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/draft/%5Bid%5D/page-5b6e9a8b7844533a.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/layout-28d8c4b51a9311e7.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/market/advanced/page-f19d369bdcc1cc53.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/market/limit/page-589811b37df70d1d.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/market/page-42239778a9c6cc06.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/market/swap/page-5ccc784c671c0f04.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/not-found-a42b00872940301d.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/onboard-friend/%5B...slugs%5D/page-7357882ecf795f5b.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/page-e7f978be6e08e265.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/perks/page-20018ef11aee5801.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/proposals/%5Bid%5D/page-e449742826be472c.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/proposals/page-62873e4f89372343.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/purchase/page-5fd977fc1c77fed9.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/search/page-258a844f32905d8d.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/signup/page-f23b962f0180d107.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/submit/page-be4d74f0804cdda8.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/app/witnesses/page-dac81420b51dda91.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/c0e397d0-d86ae2426f017668.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/eeac573e-fe0a55ceeef5ebdf.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/fd9d1056-98dfef589c2ee860.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/framework-0af805db6f0c0b82.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/main-8926b8a01066d44e.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/main-app-f2463f3514d5e713.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/pages/_app-f870474a17b7f2fd.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/pages/_error-c66a4e8afc46f17b.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js",revision:"79330112775102f91e1010318bae2bd3"},{url:"/_next/static/chunks/public/assets/notification.7cf94838874c04af.mp3",revision:"7cf94838874c04af"},{url:"/_next/static/chunks/webpack-06a1e20fc5da1d01.js",revision:"nMzM48WEAu1ZBoSpSnj-i"},{url:"/_next/static/css/0e316016ae6ca244.css",revision:"0e316016ae6ca244"},{url:"/_next/static/css/1d5d4ebc1cd30c53.css",revision:"1d5d4ebc1cd30c53"},{url:"/_next/static/css/299d776a4aa8641f.css",revision:"299d776a4aa8641f"},{url:"/_next/static/css/2ceade599589d2b8.css",revision:"2ceade599589d2b8"},{url:"/_next/static/css/4c219b8c84cc5e5a.css",revision:"4c219b8c84cc5e5a"},{url:"/_next/static/css/513be94db61781f1.css",revision:"513be94db61781f1"},{url:"/_next/static/css/551656fb847f38d0.css",revision:"551656fb847f38d0"},{url:"/_next/static/css/651733de5938119d.css",revision:"651733de5938119d"},{url:"/_next/static/css/75a5c09387da9bea.css",revision:"75a5c09387da9bea"},{url:"/_next/static/css/7909d0565a6899cf.css",revision:"7909d0565a6899cf"},{url:"/_next/static/css/80594a425fa78f01.css",revision:"80594a425fa78f01"},{url:"/_next/static/css/865f7ab4ef834569.css",revision:"865f7ab4ef834569"},{url:"/_next/static/css/97e918a903ab54c0.css",revision:"97e918a903ab54c0"},{url:"/_next/static/css/c69ae03a9f10c92f.css",revision:"c69ae03a9f10c92f"},{url:"/_next/static/css/ce623685369f6d01.css",revision:"ce623685369f6d01"},{url:"/_next/static/css/e62cdbc508f48afc.css",revision:"e62cdbc508f48afc"},{url:"/_next/static/css/ec4522ef7880f964.css",revision:"ec4522ef7880f964"},{url:"/_next/static/css/fe6943005e1bbbfe.css",revision:"fe6943005e1bbbfe"},{url:"/_next/static/media/arrow1-about.656281e6.png",revision:"656281e6"},{url:"/_next/static/media/arrow2-about.1b039bcc.png",revision:"1b039bcc"},{url:"/_next/static/media/arrow3-about.70f825ed.png",revision:"70f825ed"},{url:"/_next/static/media/back-clouds-down.4d526728.png",revision:"4d526728"},{url:"/_next/static/media/back-clouds-up.23f147d4.png",revision:"23f147d4"},{url:"/_next/static/media/cloud1-about.2cdc493a.png",revision:"2cdc493a"},{url:"/_next/static/media/cloud2-about.32fd33bd.png",revision:"32fd33bd"},{url:"/_next/static/media/fallback.d0906556.png",revision:"8713aeba6805ef460b16fa081edd1887"},{url:"/_next/static/media/index-bg.6a2f476b.png",revision:"6a2f476b"},{url:"/_next/static/media/logo-circle.9f6f8f1c.svg",revision:"2df6f251431f9f36e1815e5b90ce1f8a"},{url:"/_next/static/media/noimage.7dc5d3ff.svg",revision:"68711d71516a091f18169b2882dc6035"},{url:"/_next/static/media/noimage.f7ce9bd0.png",revision:"f7ce9bd0"},{url:"/_next/static/media/thumbnail-play.348281a6.jpg",revision:"99d63c99267bf2e74e95d92bfb00a0ea"},{url:"/_next/static/nMzM48WEAu1ZBoSpSnj-i/_buildManifest.js",revision:"d2412658a613585afb7ea2608e1b5916"},{url:"/_next/static/nMzM48WEAu1ZBoSpSnj-i/_ssgManifest.js",revision:"b6652df95db52feb4daf4eca35380933"},{url:"/assets/arrow1-about.png",revision:"4340c5b200d5d51631f944aad1ee2b5e"},{url:"/assets/arrow2-about.png",revision:"a73b3fcfc161b35e762e52e1810612f9"},{url:"/assets/arrow3-about.png",revision:"6c58e88a02000b98b2f500275e173068"},{url:"/assets/back-clouds-down.png",revision:"12a7304745da678d47a0072132c810c1"},{url:"/assets/back-clouds-up.png",revision:"e56f90fa70a1fe82aebb5f997b823f28"},{url:"/assets/bg-download-mob-dark.png",revision:"8c9a7504cdb60835ef0d39b0f448571d"},{url:"/assets/bg-download-mob-dark.webp",revision:"6a8c212f5d2cb66f259a4a8aa3af3311"},{url:"/assets/bg-download-mob-light.png",revision:"d92057b43d7e4217175d35b944141645"},{url:"/assets/bg-download-mob-light.webp",revision:"a225c5595468ab97f62a03246753cce6"},{url:"/assets/bg-download-tiny-dark.svg",revision:"4dfcf8aaeeb8a52d21bb3525d541ed5b"},{url:"/assets/bg-download-tiny.webp",revision:"a0a4bfab2ddbad09183baf2afe07a616"},{url:"/assets/bubble-center.png",revision:"5606f7307c513e99f36699e10f23ccf9"},{url:"/assets/bubble-center.webp",revision:"ef695adcbbd8936ed59f350682e61397"},{url:"/assets/bubble-left-bottom.png",revision:"df2d82a18a6135cf028abbf11781da69"},{url:"/assets/bubble-left-bottom.webp",revision:"ed0725bf3ac081532ad28a113a25bb0e"},{url:"/assets/bubble-left-top.png",revision:"5485d77a530a6f998e1e0c95cc58d223"},{url:"/assets/bubble-left-top.webp",revision:"cf1c941f7f1bde7958ebc663e7dd2f14"},{url:"/assets/bubble-right-bottom.png",revision:"c34007e9b2e094b58d0ad9f149efe7a6"},{url:"/assets/bubble-right-bottom.webp",revision:"c2189eac8ac13d5a006194e4171148b4"},{url:"/assets/bubble-right-top.png",revision:"6401d7510d2dda133da4f77b8e5857c3"},{url:"/assets/bubble-right-top.webp",revision:"06037b88ba36932c52d5484a2db3c735"},{url:"/assets/cloud1-about.png",revision:"d66dc0e33618136110dc0a851f98f4cc"},{url:"/assets/cloud1.png",revision:"28c7c7b997fb3662e2d21549b32b2972"},{url:"/assets/cloud2-about.png",revision:"8774eb6432d37ac1ecf7deaea117e1a5"},{url:"/assets/cloud2.png",revision:"a66f13dbef7a3324ab1d105991295e00"},{url:"/assets/cloud3.png",revision:"8889d6546ce489ca120d960479fc04d1"},{url:"/assets/coming-soon.png",revision:"ef24f5a15258aaa3846af7089935bf0a"},{url:"/assets/community-img.svg",revision:"3fd1e229d9517bb74c4e4903d9109ded"},{url:"/assets/cover-fallback-day.png",revision:"595641ae8f1d3b74ee12ee0b8878a520"},{url:"/assets/cover-fallback-night.png",revision:"bb6096d6a3e471fa7a8f869562d340db"},{url:"/assets/download-algae-dark.png",revision:"8c70504a94da6e93f4ac1b27046eb939"},{url:"/assets/download-algae-dark.webp",revision:"89a79f1000ca9995a6e14cfc60fd42a9"},{url:"/assets/download-algae.png",revision:"2490f946a17ba1abe4456f0f31d850a3"},{url:"/assets/download-algae.webp",revision:"1d97c2b64cfd934481e18c49ec8e8722"},{url:"/assets/download-dark-fishes.png",revision:"537442c023e388e9e33a93c821094381"},{url:"/assets/download-dark-fishes.webp",revision:"a36ea49d16f9c4b1e2833c2f6bbc618f"},{url:"/assets/dunsky.jpeg",revision:"6af464219667bd1b7a8b05a3a3133cf4"},{url:"/assets/dunsky.webp",revision:"abb98406fd78ae7cbf1ccf61e6b0a8f2"},{url:"/assets/ecency-faq.jpg",revision:"e2d5d30d0cb4a5fc5e470c56d62ede97"},{url:"/assets/ecency-faq.webp",revision:"42faa678c7ef5854f9ed0c999f6ef7eb"},{url:"/assets/fallback.png",revision:"8713aeba6805ef460b16fa081edd1887"},{url:"/assets/fish-1.png",revision:"4386e9af02b5f60f75caa040eced9a65"},{url:"/assets/fish-1.webp",revision:"8f0eb1179c74579084353e5df5b2a74f"},{url:"/assets/fish-2.png",revision:"92ce36fc40b95aeb3475d081bba0d798"},{url:"/assets/fish-2.webp",revision:"fe0c99a9f185d8b2e94bd249e625cf27"},{url:"/assets/fish-3.png",revision:"89c59580c072f1dbf52ac03068f040f3"},{url:"/assets/fish-3.webp",revision:"b9c3a3cc1cd0329d74ddb62d3a4e4b43"},{url:"/assets/fish-4.png",revision:"b91622c6328bbba13847519e0356db62"},{url:"/assets/fish-4.webp",revision:"a404c3ef59a9581554c06188ee262419"},{url:"/assets/fish-5.png",revision:"b271e3992390713707dc08f01691fb52"},{url:"/assets/fish-5.webp",revision:"abb4e590246f17bd00a21f7b414872d3"},{url:"/assets/fish-junior.png",revision:"78924f1ba81f1f59dd9a144be923edb1"},{url:"/assets/fish-junior.webp",revision:"bcae2a76d249cad55891d24e41e73b0c"},{url:"/assets/fish-senior.png",revision:"f3327a9c9d166c9da097fcfe88f38ed3"},{url:"/assets/fish-senior.webp",revision:"c70cf25bd04d52decb151396c900dcb3"},{url:"/assets/footer-discord.svg",revision:"04238f73e8da0be200731a4cc285d00e"},{url:"/assets/footer-main-fish.png",revision:"ba3d7c5371e84bdf30f6dee4d086a156"},{url:"/assets/footer-main-fish.webp",revision:"ac45436a3109caf9f94a2cd00f681783"},{url:"/assets/footer-telegram.svg",revision:"796b996dc8082544484feb13a97aa014"},{url:"/assets/footer-twitter.svg",revision:"c44b68c3cdee7732ce516bc250f6f27c"},{url:"/assets/footer-youtube.svg",revision:"6f91ba3c2f20618d27c15bff5352aba6"},{url:"/assets/github-cover.png",revision:"5eaca17c4b526f9b352a87a5a82dbfe4"},{url:"/assets/good-karma.jpeg",revision:"a7bb11629694bd7f9bd2b16bf058bb6b"},{url:"/assets/good-karma.webp",revision:"9a449b33cf032238499916c25584f58d"},{url:"/assets/hero-algae-dark.svg",revision:"eaa27188f9a588164e731b9f4a8f8295"},{url:"/assets/hero-algae-light.svg",revision:"4efcd71e3e8f8574446eeaa7a7517e33"},{url:"/assets/hero-fishes-dark.png",revision:"f8d8e17b68e2ff1490202f8503d24770"},{url:"/assets/hero-fishes.svg",revision:"a6307454b1e0fc4bcb6d402c33a63c7f"},{url:"/assets/hive-signer.svg",revision:"579ae88263a03ea7c8c4a9ec4e8b67f7"},{url:"/assets/icon-android-white.svg",revision:"f7df8d801059a45a14d1e90864157b1f"},{url:"/assets/icon-android.png",revision:"606b1396c3fffa5dc0f1d074695fab49"},{url:"/assets/icon-android.webp",revision:"c6bd14c9917803f8f69c4557be95ad9e"},{url:"/assets/icon-apple-white.svg",revision:"e4de9f34c14e50ed4fd12847091c16d2"},{url:"/assets/icon-apple.svg",revision:"a27b1b4829e566dca6d38f7c2e6d6ba5"},{url:"/assets/icon-windows-white.svg",revision:"4553dd690e4675fc4fb2132732b1c43b"},{url:"/assets/icon-windows.svg",revision:"80669c801739c850306618a2569b423c"},{url:"/assets/illustration-decentralization.png",revision:"0ad91ae4e70f22e8be87345e73144cb3"},{url:"/assets/illustration-decentralization.webp",revision:"ed3442432df26760623ec58c715fdf43"},{url:"/assets/illustration-earn-money.png",revision:"e2a7951254764e3dabac0697d089a3c2"},{url:"/assets/illustration-earn-money.webp",revision:"58605a59b4c1f6321ef90d5ef21eac24"},{url:"/assets/illustration-hero-day.png",revision:"ca7c9fd189caa73616664823e45b737d"},{url:"/assets/illustration-hero-day.webp",revision:"66c0bb6d0864af304a4e1801c967c526"},{url:"/assets/illustration-hero.png",revision:"9e2e1a46dc78fb0635c054fcf2d27b67"},{url:"/assets/illustration-hero.webp",revision:"75c6cdf85d150e6512fd2b3d0e20e332"},{url:"/assets/illustration-open-source.png",revision:"6f20524696843277aca578db00f29e14"},{url:"/assets/illustration-open-source.webp",revision:"79bf861b3c83c7de1ac96d8a35c4827d"},{url:"/assets/illustration-true-ownership.png",revision:"005b4f456f8d341de75c8c7cb25d750c"},{url:"/assets/illustration-true-ownership.webp",revision:"a2819f44d481e3203270877dc89cf87c"},{url:"/assets/index-bg.png",revision:"0931098d955341c1458c653ef42c5bec"},{url:"/assets/keychain.png",revision:"b4a1776481ec1bce0cdcb654126ee449"},{url:"/assets/left-fishes.png",revision:"c98d0bac15e561c7e4ce226541f5ab1e"},{url:"/assets/left-fishes.webp",revision:"7e5f5cee88eafa722b9b2eadbede120d"},{url:"/assets/like.png",revision:"af5f38b521e1c06eece664d5a3f24cdd"},{url:"/assets/logo-192x192.svg",revision:"09f9b1ec26a43fedaf3c527d9992ea3b"},{url:"/assets/logo-384x384.svg",revision:"c33b1a087528562650bdc7f9bb1889b3"},{url:"/assets/logo-512x512.svg",revision:"e0eb6d6416139753e199cf627599ac40"},{url:"/assets/logo-circle-santa.svg",revision:"a08e76920a86e2749d74345d86797cc5"},{url:"/assets/logo-circle.svg",revision:"2df6f251431f9f36e1815e5b90ce1f8a"},{url:"/assets/logo-small-transparent.png",revision:"197b6e7934149c67237a38f145dfb860"},{url:"/assets/noimage.png",revision:"66290b70590324b996aa6c841a4f6bf1"},{url:"/assets/noimage.svg",revision:"68711d71516a091f18169b2882dc6035"},{url:"/assets/notification.mp3",revision:"594e6e429f66513a2bc759fce6c1abc7"},{url:"/assets/nsfw.png",revision:"2e103d3e107e2974025b441b5fde485a"},{url:"/assets/our-history.png",revision:"730ae7e9850b787ea78d6151391ca463"},{url:"/assets/our-history.webp",revision:"f781b93801170a83acde5cf23bf538f4"},{url:"/assets/our-team.png",revision:"dc4a40a5f543e793462caf5c19d89f2f"},{url:"/assets/our-team.webp",revision:"ca3d13a54a5ba9e7e7df7af748c3a23a"},{url:"/assets/our-vision.png",revision:"acb541b415884dfce4b061ad21ce1b06"},{url:"/assets/our-vision.webp",revision:"bfe56f6816dade138c59010d69a8f83f"},{url:"/assets/phone-dark-pc.png",revision:"ba94fb9341a0303a8f6068ade064b0cb"},{url:"/assets/phone-dark-pc.webp",revision:"beef47eb0f0d9e6708e172b2138c48ab"},{url:"/assets/phone-dark-tablet.png",revision:"2358c7d62d813d3422a5af8bebb2be2e"},{url:"/assets/phone-dark-tablet.webp",revision:"c42d66f8c5c1999a648e6bb6a1a81227"},{url:"/assets/phone-download-tiny.png",revision:"0247b2bb16c64d46e4d8a73f60f4d501"},{url:"/assets/phone-download-tiny.webp",revision:"7120bd905eb5e5acbc866bd42058ba4c"},{url:"/assets/phone-download.png",revision:"54650a95d8ce20a2e03b68f0d6389201"},{url:"/assets/phone-light-pc.png",revision:"7bbef75c3da1d2a8e742b484292e6379"},{url:"/assets/phone-light-pc.webp",revision:"4a5839bf3499ef6687f1a798c683d7a1"},{url:"/assets/phone-light-tablet.png",revision:"49724acf6a25fedcd914ce0125517b8a"},{url:"/assets/phone-light-tablet.webp",revision:"7f448063c46119c5a7f0880f01b1814d"},{url:"/assets/reward.png",revision:"0faea76d5486dc7f637486da769fdad8"},{url:"/assets/rewarding-and-freespeech.png",revision:"ca1fc97612079d93de24bfb3ab6e0ea9"},{url:"/assets/rewarding-and-freespeech.svg",revision:"2df6f251431f9f36e1815e5b90ce1f8a"},{url:"/assets/signup.png",revision:"1ceacafe5770ed4f53829de572c9d219"},{url:"/assets/svg.tsx",revision:"2f1d7fbc25f8166e5b49e8997a803842"},{url:"/assets/talhasch.jpeg",revision:"9abb1df5ddbfd25e7fd72b0a4e202eff"},{url:"/assets/talhasch.webp",revision:"6e7e49e9ba1da71ecf46f0bb17c986c3"},{url:"/assets/thumbnail-play.jpg",revision:"99d63c99267bf2e74e95d92bfb00a0ea"},{url:"/assets/writer-thinking.png",revision:"03deb40c2a35de193e78c0e0d3d72a0e"},{url:"/assets/writer.png",revision:"00feab482a3f5309cce64ce9ca64041a"},{url:"/firebase-messaging-sw.js",revision:"db67bd2ec72e44b813ccabeb1ebb113f"},{url:"/manifest.json",revision:"3547aead3cd7bbd2b2ab3b7e23355d84"},{url:"/next.svg",revision:"8e061864f388b47f33a1c3780831193e"},{url:"/vercel.svg",revision:"61c6b19abff40ea7acd577be818f3976"}],{ignoreURLParametersMatching:[]}),e.cleanupOutdatedCaches(),e.registerRoute("/",new e.NetworkFirst({cacheName:"start-url",plugins:[{cacheWillUpdate:async({request:e,response:s,event:a,state:i})=>s&&"opaqueredirect"===s.type?new Response(s.body,{status:200,statusText:"OK",headers:s.headers}):s}]}),"GET"),e.registerRoute(/^https:\/\/fonts\.(?:gstatic)\.com\/.*/i,new e.CacheFirst({cacheName:"google-fonts-webfonts",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:31536e3})]}),"GET"),e.registerRoute(/^https:\/\/fonts\.(?:googleapis)\.com\/.*/i,new e.StaleWhileRevalidate({cacheName:"google-fonts-stylesheets",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:604800})]}),"GET"),e.registerRoute(/\.(?:eot|otf|ttc|ttf|woff|woff2|font.css)$/i,new e.StaleWhileRevalidate({cacheName:"static-font-assets",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:604800})]}),"GET"),e.registerRoute(/\.(?:jpg|jpeg|gif|png|svg|ico|webp)$/i,new e.StaleWhileRevalidate({cacheName:"static-image-assets",plugins:[new e.ExpirationPlugin({maxEntries:64,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\/_next\/image\?url=.+$/i,new e.StaleWhileRevalidate({cacheName:"next-image",plugins:[new e.ExpirationPlugin({maxEntries:64,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:mp3|wav|ogg)$/i,new e.CacheFirst({cacheName:"static-audio-assets",plugins:[new e.RangeRequestsPlugin,new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:mp4)$/i,new e.CacheFirst({cacheName:"static-video-assets",plugins:[new e.RangeRequestsPlugin,new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:js)$/i,new e.StaleWhileRevalidate({cacheName:"static-js-assets",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:css|less)$/i,new e.StaleWhileRevalidate({cacheName:"static-style-assets",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\/_next\/data\/.+\/.+\.json$/i,new e.StaleWhileRevalidate({cacheName:"next-data",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:json|xml|csv)$/i,new e.NetworkFirst({cacheName:"static-data-assets",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute((({url:e})=>{if(!(self.origin===e.origin))return!1;const s=e.pathname;return!s.startsWith("/api/auth/")&&!!s.startsWith("/api/")}),new e.NetworkFirst({cacheName:"apis",networkTimeoutSeconds:10,plugins:[new e.ExpirationPlugin({maxEntries:16,maxAgeSeconds:86400})]}),"GET"),e.registerRoute((({url:e})=>{if(!(self.origin===e.origin))return!1;return!e.pathname.startsWith("/api/")}),new e.NetworkFirst({cacheName:"others",networkTimeoutSeconds:10,plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute((({url:e})=>!(self.origin===e.origin)),new e.NetworkFirst({cacheName:"cross-origin",networkTimeoutSeconds:10,plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:3600})]}),"GET")})); diff --git a/src/api/mutations/create-reply.ts b/src/api/mutations/create-reply.ts index 856ca9cea..fa75db7d0 100644 --- a/src/api/mutations/create-reply.ts +++ b/src/api/mutations/create-reply.ts @@ -10,6 +10,13 @@ import { useGlobalStore } from "@/core/global-store"; export function useCreateReply(entry?: Entry | null, parent?: Entry, onSuccess?: () => void) { const activeUser = useGlobalStore((state) => state.activeUser); + + const { addReply } = EcencyEntriesCacheManagement.useAddReply(entry ?? undefined); + const { updateRepliesCount } = EcencyEntriesCacheManagement.useUpdateRepliesCount( + entry ?? undefined + ); + const { updateEntryQueryData } = EcencyEntriesCacheManagement.useUpdateEntry(); + const queryClient = useQueryClient(); return useMutation({ @@ -58,15 +65,15 @@ export function useCreateReply(entry?: Entry | null, parent?: Entry, onSuccess?: return; } - EcencyEntriesCacheManagement.addReply(entry, data); - EcencyEntriesCacheManagement.updateEntryQueryData([data]); + addReply(data); + updateEntryQueryData([data]); // remove reply draft ss.remove(`reply_draft_${entry.author}_${entry.permlink}`); if (entry.children === 0) { // Update parent comment. - EcencyEntriesCacheManagement.updateRepliesCount(entry, 1); + updateRepliesCount(1); } const previousReplies = queryClient.getQueryData([ diff --git a/src/api/mutations/entry-reblog.ts b/src/api/mutations/entry-reblog.ts index a47b0d282..826b9f8b4 100644 --- a/src/api/mutations/entry-reblog.ts +++ b/src/api/mutations/entry-reblog.ts @@ -10,7 +10,10 @@ import { EcencyEntriesCacheManagement } from "@/core/caches"; export function useEntryReblog(entry: Entry) { const activeUser = useGlobalStore((s) => s.activeUser); + const { mutateAsync: recordUserActivity } = useRecordUserActivity(); + + const { update: updateReblogsCount } = EcencyEntriesCacheManagement.useUpdateReblogsCount(entry); const queryClient = useQueryClient(); return useMutation({ @@ -36,10 +39,7 @@ export function useEntryReblog(entry: Entry) { isDelete ? info(i18next.t("entry-reblog.delete-success")) : success(i18next.t("entry-reblog.success")); - EcencyEntriesCacheManagement.updateReblogsCount( - entry, - (entry.reblogs ?? 0) + (isDelete ? -1 : 1) - ); + updateReblogsCount((entry.reblogs ?? 0) + (isDelete ? -1 : 1)); queryClient.setQueryData( [QueryIdentifiers.REBLOGS, activeUser?.username, 200], (data) => { diff --git a/src/api/mutations/entry-vote.ts b/src/api/mutations/entry-vote.ts index b0f435e96..7aca10bf5 100644 --- a/src/api/mutations/entry-vote.ts +++ b/src/api/mutations/entry-vote.ts @@ -1,15 +1,19 @@ -import { useMutation } from "@tanstack/react-query"; +import { useMutation, useQueryClient } from "@tanstack/react-query"; import { Entry } from "@/entities"; import { useGlobalStore } from "@/core/global-store"; import { formatError, vote } from "@/api/operations"; import { error } from "@/features/shared"; -import { getQueryClient, QueryIdentifiers } from "@/core/react-query"; +import { QueryIdentifiers } from "@/core/react-query"; import { EcencyEntriesCacheManagement } from "@/core/caches"; export function useEntryVote(entry?: Entry) { const activeUser = useGlobalStore((s) => s.activeUser); const updateActiveUser = useGlobalStore((s) => s.updateActiveUser); + const { invalidate } = EcencyEntriesCacheManagement.useInvalidation(entry); + const { update: updateVotes } = EcencyEntriesCacheManagement.useUpdateVotes(entry); + const qc = useQueryClient(); + return useMutation({ mutationKey: ["entryVote", entry?.author, entry?.permlink], mutationFn: async ({ weight, estimated }: { weight: number; estimated: number }) => { @@ -22,7 +26,7 @@ export function useEntryVote(entry?: Entry) { } await vote(activeUser?.username, entry.author, entry.permlink, weight); - await updateActiveUser(); // refresh voting power + updateActiveUser(); // refresh voting power return [ estimated, @@ -41,12 +45,12 @@ export function useEntryVote(entry?: Entry) { const newPayout = entry.payout + estimated; if (entry.active_votes) { - EcencyEntriesCacheManagement.updateVotes(entry, [...votes], newPayout); + updateVotes([...votes], newPayout); } else { - EcencyEntriesCacheManagement.invalidate(entry); + invalidate(); } - getQueryClient().invalidateQueries({ + qc.invalidateQueries({ queryKey: [QueryIdentifiers.ENTRY_ACTIVE_VOTES, entry!.author, entry!.permlink] }); }, diff --git a/src/api/mutations/sign-transfer.ts b/src/api/mutations/sign-transfer.ts index 20dabe37a..8fff6a186 100644 --- a/src/api/mutations/sign-transfer.ts +++ b/src/api/mutations/sign-transfer.ts @@ -32,7 +32,7 @@ import { import { hpToVests } from "@/features/shared/transfer/hp-to-vests"; import { error, TransferAsset, TransferMode } from "@/features/shared"; import { PrivateKey, TransactionConfirmation } from "@hiveio/dhive"; -import { getDynamicPropsQuery } from "@/api/queries"; +import { DEFAULT_DYNAMIC_PROPS, getDynamicPropsQuery } from "@/api/queries"; import { TxResponse } from "@/types"; export function useSignTransferByKey(mode: TransferMode, asset: TransferAsset) { @@ -87,12 +87,18 @@ export function useSignTransferByKey(mode: TransferMode, asset: TransferAsset) { break; } case "power-down": { - const vests = hpToVests(Number(amount), dynamicProps!.hivePerMVests); + const vests = hpToVests( + Number(amount), + (dynamicProps ?? DEFAULT_DYNAMIC_PROPS).hivePerMVests + ); promise = withdrawVesting(username, key, vests); break; } case "delegate": { - const vests = hpToVests(Number(amount), dynamicProps!.hivePerMVests); + const vests = hpToVests( + Number(amount), + (dynamicProps ?? DEFAULT_DYNAMIC_PROPS).hivePerMVests + ); promise = delegateVestingShares(username, key, to, vests); break; } @@ -155,12 +161,18 @@ export function useSignTransferByKeychain(mode: TransferMode, asset: TransferAss break; } case "power-down": { - const vests = hpToVests(Number(amount), dynamicProps!.hivePerMVests); + const vests = hpToVests( + Number(amount), + (dynamicProps ?? DEFAULT_DYNAMIC_PROPS).hivePerMVests + ); promise = withdrawVestingKc(username, vests); break; } case "delegate": { - const vests = hpToVests(Number(amount), dynamicProps!.hivePerMVests); + const vests = hpToVests( + Number(amount), + (dynamicProps ?? DEFAULT_DYNAMIC_PROPS).hivePerMVests + ); promise = delegateVestingSharesKc(username, to, vests); break; } @@ -221,12 +233,18 @@ export function useSignTransferByHiveSigner(mode: TransferMode, asset: TransferA break; } case "power-down": { - const vests = hpToVests(Number(amount), dynamicProps!.hivePerMVests); + const vests = hpToVests( + Number(amount), + (dynamicProps ?? DEFAULT_DYNAMIC_PROPS).hivePerMVests + ); withdrawVestingHot(username, vests); break; } case "delegate": { - const vests = hpToVests(Number(amount), dynamicProps!.hivePerMVests); + const vests = hpToVests( + Number(amount), + (dynamicProps ?? DEFAULT_DYNAMIC_PROPS).hivePerMVests + ); delegateVestingSharesHot(username, to, vests); break; } diff --git a/src/api/mutations/update-reply.ts b/src/api/mutations/update-reply.ts index b88960930..5abad168b 100644 --- a/src/api/mutations/update-reply.ts +++ b/src/api/mutations/update-reply.ts @@ -5,10 +5,13 @@ import { CommentOptions, Entry, MetaData } from "@/entities"; import { comment, formatError } from "@/api/operations"; import { error } from "@/features/shared"; import { EcencyEntriesCacheManagement } from "@/core/caches"; +import useUpdateEntry = EcencyEntriesCacheManagement.useUpdateEntry; export function useUpdateReply(entry?: Entry | null, onSuccess?: () => void) { const activeUser = useGlobalStore((state) => state.activeUser); + const { updateEntryQueryData } = useUpdateEntry(); + return useMutation({ mutationKey: ["reply-update", activeUser?.username, entry?.author, entry?.permlink], mutationFn: async ({ @@ -48,7 +51,7 @@ export function useUpdateReply(entry?: Entry | null, onSuccess?: () => void) { return; } - EcencyEntriesCacheManagement.updateEntryQueryData([data]); + updateEntryQueryData([data]); // remove reply draft ss.remove(`reply_draft_${entry.author}_${entry.permlink}`); diff --git a/src/api/queries/dynamic-props-query.ts b/src/api/queries/dynamic-props-query.ts index 50b1af44c..9a88fad86 100644 --- a/src/api/queries/dynamic-props-query.ts +++ b/src/api/queries/dynamic-props-query.ts @@ -8,6 +8,22 @@ import { import { DynamicProps } from "@/entities"; import { parseAsset } from "@/utils"; +export const DEFAULT_DYNAMIC_PROPS = { + hivePerMVests: 1, + base: 1, + quote: 1, + fundRecentClaims: 1, + fundRewardBalance: 1, + hbdPrintRate: 1, + hbdInterestRate: 1, + headBlock: 1, + totalVestingFund: 1, + totalVestingShares: 1, + virtualSupply: 1, + vestingRewardPercent: 1, + accountCreationFee: "3.000 HIVE" +}; + export const getDynamicPropsQuery = () => EcencyQueriesManager.generateClientServerQuery({ queryKey: [QueryIdentifiers.DYNAMIC_PROPS], diff --git a/src/api/queries/get-boost-plus-prices-query.ts b/src/api/queries/get-boost-plus-prices-query.ts index d5de51f3c..5ee519694 100644 --- a/src/api/queries/get-boost-plus-prices-query.ts +++ b/src/api/queries/get-boost-plus-prices-query.ts @@ -19,5 +19,6 @@ export const getBoostPlusPricesQuery = (activeUser: ActiveUser | null) => ); return response.data; }, - initialData: [] + staleTime: Infinity, + refetchOnMount: true }); diff --git a/src/api/queries/get-discussions-query.ts b/src/api/queries/get-discussions-query.ts index f005b9653..b1fef88c1 100644 --- a/src/api/queries/get-discussions-query.ts +++ b/src/api/queries/get-discussions-query.ts @@ -4,7 +4,6 @@ import { bridgeApiCall } from "@/api/bridge"; import { parseAsset } from "@/utils"; import { SortOrder } from "@/enums"; import { IdentifiableEntry } from "@/app/decks/_components/columns/deck-threads-manager"; -import { EcencyEntriesCacheManagement } from "@/core/caches"; export function sortDiscussions(entry: Entry, discussion: Entry[], order: SortOrder) { const allPayout = (c: Entry) => @@ -89,9 +88,7 @@ export const getDiscussionsQuery = (entry: Entry, order: SortOrder, enabled: boo permlink: entry.permlink }); if (response) { - const entries = Array.from(Object.values(response)); - EcencyEntriesCacheManagement.updateEntryQueryData([...entries]); - return entries; + return Array.from(Object.values(response)); } return []; }, @@ -112,8 +109,6 @@ export const getDiscussionsMapQuery = (entry: Entry | undefined, enabled: boolea } ); if (response) { - const entries = Array.from(Object.values(response)); - EcencyEntriesCacheManagement.updateEntryQueryData([...entries]); return response; } return {}; diff --git a/src/api/queries/get-search-by-username-query.ts b/src/api/queries/get-search-by-username-query.ts new file mode 100644 index 000000000..fea94579f --- /dev/null +++ b/src/api/queries/get-search-by-username-query.ts @@ -0,0 +1,31 @@ +import { QueryIdentifiers } from "@/core/react-query"; +import { lookupAccounts } from "@/api/hive"; +import { error } from "@/features/shared"; +import { formatError } from "@/api/operations"; +import { useQuery } from "@tanstack/react-query"; +import { useGlobalStore } from "@/core/global-store"; + +export function useSearchByUsernameQuery(query: string, excludeActiveUser = false) { + const activeUser = useGlobalStore((s) => s.activeUser); + + return useQuery({ + queryKey: [QueryIdentifiers.SEARCH_BY_USERNAME, query], + staleTime: Infinity, + refetchOnMount: true, + queryFn: async () => { + if (!query) { + return []; + } + + try { + const resp = await lookupAccounts(query, 5); + if (resp) { + resp.filter((item) => (excludeActiveUser ? item !== activeUser?.username : true)); + } + } catch (e) { + error(...formatError(e)); + } finally { + } + } + }); +} diff --git a/src/api/queries/index.ts b/src/api/queries/index.ts index 8a9c3d7a8..02b24f913 100644 --- a/src/api/queries/index.ts +++ b/src/api/queries/index.ts @@ -61,3 +61,4 @@ export * from "./get-followers-query"; export * from "./get-deleted-entry-query"; export * from "./get-hive-hbd-stats-query"; export * from "./get-order-book-query"; +export * from "./get-search-by-username-query"; diff --git a/src/api/queries/points-query.ts b/src/api/queries/points-query.ts index dff44c6f6..599bd665a 100644 --- a/src/api/queries/points-query.ts +++ b/src/api/queries/points-query.ts @@ -36,9 +36,9 @@ export const getPointsQuery = (username?: string, filter = 0) => { transactions } as const; }, - initialData: DEFAULT, - enabled: !!username, - retryDelay: 30000 + staleTime: 30000, + refetchOnMount: true, + enabled: !!username } ); }; diff --git a/src/app/[...slugs]/_profile-components/delegated-vesting/index.tsx b/src/app/[...slugs]/_profile-components/delegated-vesting/index.tsx index a82e90724..af76298ea 100644 --- a/src/app/[...slugs]/_profile-components/delegated-vesting/index.tsx +++ b/src/app/[...slugs]/_profile-components/delegated-vesting/index.tsx @@ -7,7 +7,11 @@ import i18next from "i18next"; import { Pagination, Tooltip } from "@/features/ui"; import { formattedNumber, parseAsset, vestsToHp } from "@/utils"; import { KeyOrHotDialog, LinearProgress, ProfileLink, UserAvatar } from "@/features/shared"; -import { getDynamicPropsQuery, getVestingDelegationsQuery } from "@/api/queries"; +import { + DEFAULT_DYNAMIC_PROPS, + getDynamicPropsQuery, + getVestingDelegationsQuery +} from "@/api/queries"; import { useGlobalStore } from "@/core/global-store"; import { useDelegateVestingSharesByKey, useDelegateVestingSharesByKeychain } from "@/api/mutations"; import { delegateVestingSharesHot } from "@/api/operations"; @@ -55,7 +59,7 @@ export function DelegatedVesting({ onHide, account, totalDelegated }: Props) { useEffect(() => { const totalDelegatedValue = data.reduce((n, item) => { let parsedValue: any = parseAsset(item.vesting_shares).amount; - parsedValue = vestsToHp(parsedValue, dynamicProps!.hivePerMVests); + parsedValue = vestsToHp(parsedValue, (dynamicProps ?? DEFAULT_DYNAMIC_PROPS).hivePerMVests); parsedValue = formattedNumber(parsedValue); parsedValue = parsedValue.replace(/,/g, ""); parsedValue = parseFloat(parsedValue); @@ -119,7 +123,10 @@ export function DelegatedVesting({ onHide, account, totalDelegated }: Props) { {formattedNumber( - vestsToHp(vestingShares, dynamicProps!.hivePerMVests), + vestsToHp( + vestingShares, + (dynamicProps ?? DEFAULT_DYNAMIC_PROPS).hivePerMVests + ), { suffix: "HP" } )} diff --git a/src/app/[...slugs]/_profile-components/profile-info/index.tsx b/src/app/[...slugs]/_profile-components/profile-info/index.tsx index cd746e42a..c2f60d331 100644 --- a/src/app/[...slugs]/_profile-components/profile-info/index.tsx +++ b/src/app/[...slugs]/_profile-components/profile-info/index.tsx @@ -3,7 +3,7 @@ import moment from "moment"; import { RCAccount } from "@hiveio/dhive/lib/chain/rc"; import "./_index.scss"; import { Account, FullAccount } from "@/entities"; -import { getDynamicPropsQuery, getRcAccountsQuery } from "@/api/queries"; +import { DEFAULT_DYNAMIC_PROPS, getDynamicPropsQuery, getRcAccountsQuery } from "@/api/queries"; import { downVotingPower, powerRechargeTime, rcPower, votingPower, votingValue } from "@/api/hive"; import { formattedNumber } from "@/utils"; import i18next from "i18next"; @@ -27,8 +27,10 @@ function ProfileInfoContent({ account, rcAccount }: ContentProps) { const vPowerRechargeDate = moment().add(vPowerRecharge, "seconds"); // Voting value - const vValue = votingValue(account, dynamicProps!, vPower * 100).toFixed(3); - const vValueFull = votingValue(account, dynamicProps!, 10000).toFixed(3); + const vValue = votingValue(account, dynamicProps ?? DEFAULT_DYNAMIC_PROPS, vPower * 100).toFixed( + 3 + ); + const vValueFull = votingValue(account, dynamicProps ?? DEFAULT_DYNAMIC_PROPS, 10000).toFixed(3); // Join date const created = moment.utc(account.created).format("LL"); diff --git a/src/app/[...slugs]/_profile-components/wallet-hive-engine/engine-tokens-estimated/index.tsx b/src/app/[...slugs]/_profile-components/wallet-hive-engine/engine-tokens-estimated/index.tsx index b60f8e361..44d93d3a7 100644 --- a/src/app/[...slugs]/_profile-components/wallet-hive-engine/engine-tokens-estimated/index.tsx +++ b/src/app/[...slugs]/_profile-components/wallet-hive-engine/engine-tokens-estimated/index.tsx @@ -1,7 +1,7 @@ import React, { useCallback, useEffect, useState } from "react"; import { getMetrics } from "@/api/hive-engine"; import i18next from "i18next"; -import { getDynamicPropsQuery } from "@/api/queries"; +import { DEFAULT_DYNAMIC_PROPS, getDynamicPropsQuery } from "@/api/queries"; export const EngineTokensEstimated = (props: any) => { const { tokens: userTokens } = props; @@ -12,7 +12,8 @@ export const EngineTokensEstimated = (props: any) => { const getEstimatedUsdValue = useCallback(async () => { const AllMarketTokens = await getMetrics(); - const pricePerHive = dynamicProps!.base / dynamicProps!.quote; + const pricePerHive = + (dynamicProps ?? DEFAULT_DYNAMIC_PROPS).base / (dynamicProps ?? DEFAULT_DYNAMIC_PROPS).quote; let mappedBalanceMetrics = userTokens.map((item: any) => { let eachMetric = AllMarketTokens.find((m: any) => m.symbol === item.symbol); diff --git a/src/app/[...slugs]/_profile-components/wallet-hive-engine/index.tsx b/src/app/[...slugs]/_profile-components/wallet-hive-engine/index.tsx index 15f9ad4b6..964b5fa00 100644 --- a/src/app/[...slugs]/_profile-components/wallet-hive-engine/index.tsx +++ b/src/app/[...slugs]/_profile-components/wallet-hive-engine/index.tsx @@ -39,7 +39,7 @@ import { SortEngineTokens } from "./sort-hive-engine-tokens"; import { EngineTokensEstimated } from "./engine-tokens-estimated"; import { Account, TokenStatus } from "@/entities"; import { useGlobalStore } from "@/core/global-store"; -import { getDynamicPropsQuery } from "@/api/queries"; +import { DEFAULT_DYNAMIC_PROPS, getDynamicPropsQuery } from "@/api/queries"; import { formatError } from "@/api/operations"; import useMount from "react-use/lib/useMount"; import Image from "next/image"; @@ -141,7 +141,8 @@ export function WalletHiveEngine({ account }: Props) { }; const tokenUsdValue = async () => { const userTokens: any = await getHiveEngineTokenBalances(account.name); - const pricePerHive = dynamicProps!.base / dynamicProps!.quote; + const pricePerHive = + (dynamicProps ?? DEFAULT_DYNAMIC_PROPS).base / (dynamicProps ?? DEFAULT_DYNAMIC_PROPS).quote; let balanceMetrics: any = userTokens.map((item: any) => { let eachMetric = allTokens.find((m: any) => m.symbol === item.symbol); diff --git a/src/app/[...slugs]/_profile-components/wallet-hive/index.tsx b/src/app/[...slugs]/_profile-components/wallet-hive/index.tsx index 832ac2ec2..0b5784068 100644 --- a/src/app/[...slugs]/_profile-components/wallet-hive/index.tsx +++ b/src/app/[...slugs]/_profile-components/wallet-hive/index.tsx @@ -34,6 +34,7 @@ import { WalletMenu } from "../wallet-menu"; import { Dropdown, DropdownItem, DropdownMenu, DropdownToggle } from "@ui/dropdown"; import { useMemo, useState } from "react"; import { + DEFAULT_DYNAMIC_PROPS, getCollateralizedConversionRequestsQuery, getConversionRequestsQuery, getDynamicPropsQuery, @@ -82,7 +83,7 @@ export function WalletHive({ account }: Props) { const decreasePercentPerIncrement = 0.01; // How many increments have happened since block 7m? - const headBlock = dynamicProps!.headBlock; + const headBlock = (dynamicProps ?? DEFAULT_DYNAMIC_PROPS).headBlock; const deltaBlocks = headBlock - initialBlock; const decreaseIncrements = deltaBlocks / decreaseRate; @@ -96,9 +97,10 @@ export function WalletHive({ account }: Props) { } // Now lets calculate the "APR" - const vestingRewardPercent = dynamicProps!.vestingRewardPercent / 10000; - const virtualSupply = dynamicProps!.virtualSupply; - const totalVestingFunds = dynamicProps!.totalVestingFund; + const vestingRewardPercent = + (dynamicProps ?? DEFAULT_DYNAMIC_PROPS).vestingRewardPercent / 10000; + const virtualSupply = (dynamicProps ?? DEFAULT_DYNAMIC_PROPS).virtualSupply; + const totalVestingFunds = (dynamicProps ?? DEFAULT_DYNAMIC_PROPS).totalVestingFund; return ( (virtualSupply * currentInflationRate * vestingRewardPercent) / totalVestingFunds @@ -147,7 +149,7 @@ export function WalletHive({ account }: Props) { [activeUser, account] ); const w = useMemo( - () => new HiveWallet(account, dynamicProps!, converting), + () => new HiveWallet(account, dynamicProps ?? DEFAULT_DYNAMIC_PROPS, converting), [account, converting, dynamicProps] ); const lastIPaymentRelative = useMemo( @@ -189,7 +191,9 @@ export function WalletHive({ account }: Props) { [pendingSeconds, w.savingHbdSeconds] ); const estimatedUIn = useMemo( - () => (secondsToEstimate / (60 * 60 * 24 * 365)) * (dynamicProps!.hbdInterestRate / 10000), + () => + (secondsToEstimate / (60 * 60 * 24 * 365)) * + ((dynamicProps ?? DEFAULT_DYNAMIC_PROPS).hbdInterestRate / 10000), [dynamicProps, secondsToEstimate] ); const estimatedInterest = useMemo( @@ -199,17 +203,23 @@ export function WalletHive({ account }: Props) { const remainingDays = useMemo(() => 30 - lastIPaymentDiff, [lastIPaymentDiff]); const totalHP = useMemo( () => - formattedNumber(vestsToHp(w.vestingShares, dynamicProps!.hivePerMVests), { - suffix: "HP" - }), + formattedNumber( + vestsToHp(w.vestingShares, (dynamicProps ?? DEFAULT_DYNAMIC_PROPS).hivePerMVests), + { + suffix: "HP" + } + ), [dynamicProps, w.vestingShares] ); const totalDelegated = useMemo( () => - formattedNumber(vestsToHp(w.vestingSharesDelegated, dynamicProps!.hivePerMVests), { - prefix: "-", - suffix: "HP" - }), + formattedNumber( + vestsToHp(w.vestingSharesDelegated, (dynamicProps ?? DEFAULT_DYNAMIC_PROPS).hivePerMVests), + { + prefix: "-", + suffix: "HP" + } + ), [dynamicProps, w.vestingSharesDelegated] ); @@ -427,7 +437,10 @@ export function WalletHive({ account }: Props) { setDelegatedList(true)}> {formattedNumber( - vestsToHp(w.vestingSharesDelegated, dynamicProps!.hivePerMVests), + vestsToHp( + w.vestingSharesDelegated, + (dynamicProps ?? DEFAULT_DYNAMIC_PROPS).hivePerMVests + ), { prefix: "-", suffix: "HP" @@ -444,7 +457,10 @@ export function WalletHive({ account }: Props) { } const strReceived = formattedNumber( - vestsToHp(w.vestingSharesReceived, dynamicProps!.hivePerMVests), + vestsToHp( + w.vestingSharesReceived, + (dynamicProps ?? DEFAULT_DYNAMIC_PROPS).hivePerMVests + ), { prefix: "+", suffix: "HP" } ); @@ -474,7 +490,10 @@ export function WalletHive({ account }: Props) { {formattedNumber( - vestsToHp(w.nextVestingSharesWithdrawal, dynamicProps!.hivePerMVests), + vestsToHp( + w.nextVestingSharesWithdrawal, + (dynamicProps ?? DEFAULT_DYNAMIC_PROPS).hivePerMVests + ), { prefix: "-", suffix: "HP" @@ -492,7 +511,10 @@ export function WalletHive({ account }: Props) { {formattedNumber( - vestsToHp(w.vestingSharesTotal, dynamicProps!.hivePerMVests), + vestsToHp( + w.vestingSharesTotal, + (dynamicProps ?? DEFAULT_DYNAMIC_PROPS).hivePerMVests + ), { prefix: "=", suffix: "HP" @@ -617,7 +639,7 @@ export function WalletHive({ account }: Props) {
{i18next.t("wallet.savings-description")}
{i18next.t("wallet.hive-dollars-apr-rate", { - value: dynamicProps!.hbdInterestRate / 100 + value: (dynamicProps ?? DEFAULT_DYNAMIC_PROPS).hbdInterestRate / 100 })}
{estimatedUIn >= 0.001 && ( diff --git a/src/app/chats/[...params]/page.tsx b/src/app/chats/[...params]/page.tsx index 18259328a..5e3467d60 100644 --- a/src/app/chats/[...params]/page.tsx +++ b/src/app/chats/[...params]/page.tsx @@ -3,12 +3,18 @@ import { ChatsScreen } from "@/app/chats/_screens"; export const dynamic = "force-dynamic"; -export default function Chats() { +interface Props { + params: { + params: string[]; + }; +} + +export default function Chats({ params }: Props) { return ( <> - + ); } diff --git a/src/app/chats/_components/chat-channel-messages.tsx b/src/app/chats/_components/chat-channel-messages.tsx index 504bf56f8..5e0f83247 100644 --- a/src/app/chats/_components/chat-channel-messages.tsx +++ b/src/app/chats/_components/chat-channel-messages.tsx @@ -172,11 +172,13 @@ export function ChatsChannelMessages({ publicMessages, currentChannel, isPage }: ))} - setForwardingMessage(undefined)} - /> + {forwardingMessage && ( + setForwardingMessage(undefined)} + /> + )} ); diff --git a/src/app/chats/_components/chats-direct-messages/index.tsx b/src/app/chats/_components/chats-direct-messages/index.tsx index 53e3c62f6..1380935dc 100644 --- a/src/app/chats/_components/chats-direct-messages/index.tsx +++ b/src/app/chats/_components/chats-direct-messages/index.tsx @@ -122,11 +122,13 @@ export function ChatsDirectMessages(props: Props) { ))} ))} - setForwardingMessage(undefined)} - /> + {forwardingMessage && ( + setForwardingMessage(undefined)} + /> + )} ); } diff --git a/src/app/chats/_screens/chats.tsx b/src/app/chats/_screens/chats.tsx index dea5a5c7a..6ea0e909a 100644 --- a/src/app/chats/_screens/chats.tsx +++ b/src/app/chats/_screens/chats.tsx @@ -19,15 +19,17 @@ import { useUnmount } from "react-use"; import { useCreateTemporaryContactFromParam } from "../_hooks"; import { useGlobalStore } from "@/core/global-store"; import { getCommunityCache } from "@/core/caches"; -import { useParams } from "next/navigation"; import i18next from "i18next"; import { classNameObject } from "@ui/util"; -export const ChatsScreen = () => { +interface Props { + params?: string[]; +} + +export const ChatsScreen = ({ params = [] }: Props) => { const activeUser = useGlobalStore((state) => state.activeUser); const { receiverPubKey, revealPrivateKey, setReceiverPubKey } = useContext(ChatContext); - const params = useParams(); const { data: community } = getCommunityCache(params[0] as string).useClientQuery(); useCreateTemporaryContactFromParam(); diff --git a/src/app/decks/_components/columns/content-viewer/deck-thread-item-viewer-reply.tsx b/src/app/decks/_components/columns/content-viewer/deck-thread-item-viewer-reply.tsx index cd139e900..f949321c9 100644 --- a/src/app/decks/_components/columns/content-viewer/deck-thread-item-viewer-reply.tsx +++ b/src/app/decks/_components/columns/content-viewer/deck-thread-item-viewer-reply.tsx @@ -21,6 +21,8 @@ export const DeckThreadItemViewerReply = ({ incrementParentEntryCount }: Props) => { const { data: entry } = EcencyEntriesCacheManagement.getEntryQuery(initialEntry).useClientQuery(); + const { addReply } = EcencyEntriesCacheManagement.useAddReply(entry); + const { updateRepliesCount } = EcencyEntriesCacheManagement.useUpdateRepliesCount(entry); const [isExpanded, setIsExpanded] = useState(false); @@ -47,7 +49,7 @@ export const DeckThreadItemViewerReply = ({ replySource={entry} onSuccess={(reply) => { // Update entry in global cache - EcencyEntriesCacheManagement.addReply(entry, reply); + addReply(reply); incrementParentEntryCount(); }} /> @@ -59,12 +61,7 @@ export const DeckThreadItemViewerReply = ({ key={reply.post_id} entry={reply} parentEntry={entry} - incrementParentEntryCount={() => - EcencyEntriesCacheManagement.updateRepliesCount( - parentEntry, - parentEntry.children + 1 - ) - } + incrementParentEntryCount={() => updateRepliesCount(parentEntry.children + 1)} /> ))} diff --git a/src/app/decks/_components/columns/content-viewer/deck-thread-item-viewer.tsx b/src/app/decks/_components/columns/content-viewer/deck-thread-item-viewer.tsx index 4116e1f71..0974d6728 100644 --- a/src/app/decks/_components/columns/content-viewer/deck-thread-item-viewer.tsx +++ b/src/app/decks/_components/columns/content-viewer/deck-thread-item-viewer.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useMemo, useRef } from "react"; +import React, { useCallback, useEffect, useMemo, useRef } from "react"; import { DeckThreadItemSkeleton, ThreadItem } from "../deck-items"; import { IdentifiableEntry } from "../deck-threads-manager"; import { DeckThreadsForm } from "../../deck-threads-form"; @@ -34,6 +34,9 @@ export const DeckThreadItemViewer = ({ const isMounted = useMounted(); const { data: discussions } = getDiscussionsMapQuery(entry).useClientQuery(); + const { addReply } = EcencyEntriesCacheManagement.useAddReply(entry); + const { updateRepliesCount } = EcencyEntriesCacheManagement.useUpdateRepliesCount(entry); + const { updateEntryQueryData } = EcencyEntriesCacheManagement.useUpdateEntry(); const build = useCallback( (dataset: Record) => { @@ -77,6 +80,10 @@ export const DeckThreadItemViewer = ({ return build(tempResponse); }, [build, discussions, entry?.host]); + useEffect(() => { + updateEntryQueryData(Array.from(Object.values(discussions ?? {}))); + }, [discussions]); + return (
@@ -134,9 +141,7 @@ export const DeckThreadItemViewer = ({ key={reply.post_id} entry={reply as IdentifiableEntry} parentEntry={entry!} - incrementParentEntryCount={() => - EcencyEntriesCacheManagement.updateRepliesCount(entry!, entry!.children + 1) - } + incrementParentEntryCount={() => updateRepliesCount(entry!.children + 1)} /> ))} {data.length === 0 && ( diff --git a/src/app/decks/_components/columns/deck-items/deck-thread-item.tsx b/src/app/decks/_components/columns/deck-items/deck-thread-item.tsx index 31a2f325c..8fe57445f 100644 --- a/src/app/decks/_components/columns/deck-items/deck-thread-item.tsx +++ b/src/app/decks/_components/columns/deck-items/deck-thread-item.tsx @@ -59,9 +59,10 @@ export const ThreadItem = ({ const [intervalStarted, setIntervalStarted] = useState(false); const poll = useEntryPollExtractor(entry); + const { updateEntryQueryData } = EcencyEntriesCacheManagement.useUpdateEntry(); useEntryChecking(entry, intervalStarted, (nextEntry) => { - EcencyEntriesCacheManagement.updateEntryQueryData([ + updateEntryQueryData([ { ...nextEntry, host: initialEntry.host, container: initialEntry.container } as Entry ]); setIntervalStarted(false); diff --git a/src/app/decks/_components/columns/deck-threads-manager/deck-threads-column-manager.tsx b/src/app/decks/_components/columns/deck-threads-manager/deck-threads-column-manager.tsx index 887a7de51..9b079fb4f 100644 --- a/src/app/decks/_components/columns/deck-threads-manager/deck-threads-column-manager.tsx +++ b/src/app/decks/_components/columns/deck-threads-manager/deck-threads-column-manager.tsx @@ -18,6 +18,7 @@ interface Props { export const DeckThreadsColumnManager = ({ children }: Props) => { const queryClient = useQueryClient(); + const { updateEntryQueryData } = EcencyEntriesCacheManagement.useUpdateEntry(); const fetch = async (hosts: string[], lastContainers?: ThreadItemEntry[]) => { let nextThreadItems: ThreadItemEntry[] = []; @@ -39,7 +40,7 @@ export const DeckThreadsColumnManager = ({ children }: Props) => { if (response instanceof Array) { // Add entries to global cache - EcencyEntriesCacheManagement.updateEntryQueryData(response); + updateEntryQueryData(response); nextThreadItems = [...nextThreadItems, ...response]; } diff --git a/src/app/decks/_components/columns/deck-wallet-balance-column.tsx b/src/app/decks/_components/columns/deck-wallet-balance-column.tsx index f2194b859..a79b3ad13 100644 --- a/src/app/decks/_components/columns/deck-wallet-balance-column.tsx +++ b/src/app/decks/_components/columns/deck-wallet-balance-column.tsx @@ -5,7 +5,7 @@ import { UserDeckGridItem } from "../types"; import "./_deck-wallet-balance-column.scss"; import { DeckGridContext } from "../deck-manager"; import { Spinner } from "@ui/spinner"; -import { getDynamicPropsQuery, getPointsQuery } from "@/api/queries"; +import { DEFAULT_DYNAMIC_PROPS, getDynamicPropsQuery, getPointsQuery } from "@/api/queries"; import { FullAccount } from "@/entities"; import { getAccount, getConversionRequests } from "@/api/hive"; import { getCurrencyTokenRate } from "@/api/private-api"; @@ -124,12 +124,15 @@ export const DeckWalletBalanceColumn = ({ }); if (account) { - const wallet = new HiveWallet(account, dynamicProps!, converting); + const wallet = new HiveWallet(account, dynamicProps ?? DEFAULT_DYNAMIC_PROPS, converting); setHive(formattedNumber(wallet.balance, { suffix: "HIVE" })); setHp( - formattedNumber(vestsToHp(wallet.vestingShares, dynamicProps!.hivePerMVests), { - suffix: "HP" - }) + formattedNumber( + vestsToHp(wallet.vestingShares, (dynamicProps ?? DEFAULT_DYNAMIC_PROPS).hivePerMVests), + { + suffix: "HP" + } + ) ); setHbd(formattedNumber(wallet.hbdBalance, { prefix: "$" })); setSavings(formattedNumber(wallet.savingBalance, { suffix: "HIVE" })); @@ -148,7 +151,9 @@ export const DeckWalletBalanceColumn = ({ const tokens = await getMetrics(); const userTokens = await getHiveEngineTokenBalances(username); - const pricePerHive = dynamicProps!.base / dynamicProps!.quote; + const pricePerHive = + (dynamicProps ?? DEFAULT_DYNAMIC_PROPS).base / + (dynamicProps ?? DEFAULT_DYNAMIC_PROPS).quote; const mappedBalanceMetrics = userTokens.map((item: any) => ({ ...item, diff --git a/src/app/decks/_components/deck-threads-form/api/threads-api.ts b/src/app/decks/_components/deck-threads-form/api/threads-api.ts index aa5f52525..ec649d7d9 100644 --- a/src/app/decks/_components/deck-threads-form/api/threads-api.ts +++ b/src/app/decks/_components/deck-threads-form/api/threads-api.ts @@ -13,6 +13,9 @@ export function useThreadsApi() { const activeUser = useGlobalStore((s) => s.activeUser); const { activePoll } = useContext(PollsContext); + const { addReply } = EcencyEntriesCacheManagement.useAddReply(); + const { updateRepliesCount } = EcencyEntriesCacheManagement.useUpdateRepliesCount(); + const request = async (entry: Entry, raw: string, editingEntry?: ThreadItemEntry) => { if (!activeUser || !activeUser.data.__loaded) { throw new Error("No user"); @@ -45,7 +48,7 @@ export function useThreadsApi() { }); // add new reply to store - EcencyEntriesCacheManagement.addReply(entry, nReply); + addReply(nReply, entry); if (entry.children === 0) { // Activate discussion [section] with first comment. @@ -53,7 +56,7 @@ export function useThreadsApi() { ...entry, children: 1 }; - EcencyEntriesCacheManagement.updateRepliesCount(entry, 1); + updateRepliesCount(1, entry); } return nReply; diff --git a/src/app/decks/_components/deck-threads-form/api/use-community-api.ts b/src/app/decks/_components/deck-threads-form/api/use-community-api.ts index 830acd027..9d5c3b9ff 100644 --- a/src/app/decks/_components/deck-threads-form/api/use-community-api.ts +++ b/src/app/decks/_components/deck-threads-form/api/use-community-api.ts @@ -11,6 +11,8 @@ export function useCommunityApi() { const activeUser = useGlobalStore((s) => s.activeUser); const { activePoll } = useContext(PollsContext); + const { updateEntryQueryData } = EcencyEntriesCacheManagement.useUpdateEntry(); + const request = async (host: string, raw: string, editingEntry?: Entry) => { if (!activeUser || !activeUser.data.__loaded) { throw new Error("No user"); @@ -56,7 +58,7 @@ export function useCommunityApi() { max_accepted_payout: options.max_accepted_payout, percent_hbd: options.percent_hbd }; - EcencyEntriesCacheManagement.updateEntryQueryData([entry]); + updateEntryQueryData([entry]); return entry; }; diff --git a/src/app/onboard-friend/[...slugs]/_page.tsx b/src/app/onboard-friend/[...slugs]/_page.tsx index 77281a344..7f65714bd 100644 --- a/src/app/onboard-friend/[...slugs]/_page.tsx +++ b/src/app/onboard-friend/[...slugs]/_page.tsx @@ -37,7 +37,7 @@ import { createAccountWithCreditKey, delegateRC } from "@/api/operations"; -import { getDynamicPropsQuery } from "@/api/queries"; +import { DEFAULT_DYNAMIC_PROPS, getDynamicPropsQuery } from "@/api/queries"; import { onboardEmail } from "@/api/private-api"; import { generatePassword, getPrivateKeys } from "@/utils/onBoard-helper"; @@ -296,7 +296,7 @@ export const OnboardFriend = ({ params: { slugs } }: Props) => { { username: formatUsername(decodedInfo!.username), pub_keys: decodedInfo?.pubkeys, - fee: dynamicProps!.accountCreationFee + fee: (dynamicProps ?? DEFAULT_DYNAMIC_PROPS).accountCreationFee }, activeUser?.username ); @@ -354,7 +354,7 @@ export const OnboardFriend = ({ params: { slugs } }: Props) => { { username: formatUsername(decodedInfo!.username), pub_keys: decodedInfo?.pubkeys, - fee: dynamicProps!.accountCreationFee + fee: (dynamicProps ?? DEFAULT_DYNAMIC_PROPS).accountCreationFee }, activeUser?.username, key @@ -420,7 +420,7 @@ export const OnboardFriend = ({ params: { slugs } }: Props) => { { username: formatUsername(decodedInfo!.username), pub_keys: decodedInfo?.pubkeys, - fee: dynamicProps!.accountCreationFee + fee: (dynamicProps ?? DEFAULT_DYNAMIC_PROPS).accountCreationFee }, activeUser?.username, hashedInfo diff --git a/src/app/proposals/_components/proposal-list-item/index.tsx b/src/app/proposals/_components/proposal-list-item/index.tsx index 88946838a..cb37b03af 100644 --- a/src/app/proposals/_components/proposal-list-item/index.tsx +++ b/src/app/proposals/_components/proposal-list-item/index.tsx @@ -9,7 +9,7 @@ import { linkSvg } from "@ui/svg"; import Link from "next/link"; import { parseAsset } from "@/utils"; import { ProposalVoteBtn, ProposalVotes } from "@/app/proposals/_components"; -import { getDynamicPropsQuery, getProposalVotesQuery } from "@/api/queries"; +import { DEFAULT_DYNAMIC_PROPS, getDynamicPropsQuery, getProposalVotesQuery } from "@/api/queries"; import { useSearchParams } from "next/navigation"; interface Props { @@ -38,7 +38,8 @@ export function ProposalListItem({ proposal, isReturnProposalId, thresholdPropos const endDate = moment(new Date(proposal.end_date)); const duration = endDate.diff(startDate, "days"); - const votesHP = (Number(proposal.total_votes) / 1e12) * dynamicProps!.hivePerMVests; + const votesHP = + (Number(proposal.total_votes) / 1e12) * (dynamicProps ?? DEFAULT_DYNAMIC_PROPS).hivePerMVests; const strVotes = numeral(votesHP).format("0.00,") + " HP"; const dailyPayment = parseAsset(proposal.daily_pay); diff --git a/src/app/proposals/_components/proposal-votes/index.tsx b/src/app/proposals/_components/proposal-votes/index.tsx index fc52977c8..4e93472e4 100644 --- a/src/app/proposals/_components/proposal-votes/index.tsx +++ b/src/app/proposals/_components/proposal-votes/index.tsx @@ -9,7 +9,12 @@ import i18next from "i18next"; import { Entry, Proposal } from "@/entities"; import { LinearProgress, ProfileLink, ProfilePopover, UserAvatar } from "@/features/shared"; import { accountReputation, parseAsset } from "@/utils"; -import { getAccountsQuery, getDynamicPropsQuery, getProposalVotesQuery } from "@/api/queries"; +import { + DEFAULT_DYNAMIC_PROPS, + getAccountsQuery, + getDynamicPropsQuery, + getProposalVotesQuery +} from "@/api/queries"; type SortOption = "reputation" | "hp"; @@ -23,7 +28,7 @@ export function ProposalVotes({ proposal, onHide }: ProposalVotesProps) { const [sort, setSort] = useState("hp"); const { data: dynamicProps } = getDynamicPropsQuery().useClientQuery(); - const { data: votes, isLoading } = getProposalVotesQuery( + const { data: votes, isFetching } = getProposalVotesQuery( proposal.proposal_id, "", 1000 @@ -36,12 +41,14 @@ export function ProposalVotes({ proposal, onHide }: ProposalVotesProps) { accounts ?.map((account) => { const hp = - (parseAsset(account.vesting_shares).amount * dynamicProps!.hivePerMVests) / 1e6; + (parseAsset(account.vesting_shares).amount * + (dynamicProps ?? DEFAULT_DYNAMIC_PROPS).hivePerMVests) / + 1e6; let vsfVotes = 0; account.proxied_vsf_votes.forEach((x: string | number) => (vsfVotes += Number(x))); - const proxyHp = (vsfVotes * dynamicProps!.hivePerMVests) / 1e12; + const proxyHp = (vsfVotes * (dynamicProps ?? DEFAULT_DYNAMIC_PROPS).hivePerMVests) / 1e12; const totalHp = hp + proxyHp; return { @@ -64,8 +71,6 @@ export function ProposalVotes({ proposal, onHide }: ProposalVotesProps) { [accounts, dynamicProps, searchText, sort] ); - console.log(votes, voters); - return ( @@ -90,12 +95,12 @@ export function ProposalVotes({ proposal, onHide }: ProposalVotesProps) {
- {isLoading && } + {isFetching && }
{(voters?.length ?? 0) > 0 ? ( - voters?.map((x,index) => { + voters?.map((x, index) => { const strHp = numeral(x.hp).format("0.00,"); const strProxyHp = numeral(x.proxyHp).format("0.00,"); @@ -131,7 +136,7 @@ export function ProposalVotes({ proposal, onHide }: ProposalVotesProps) { }) ) : (
- {isLoading ? i18next.t("proposals.searching") : i18next.t("proposals.no-results")} + {isFetching ? i18next.t("proposals.searching") : i18next.t("proposals.no-results")}
)}
diff --git a/src/app/submit/_api/publish.ts b/src/app/submit/_api/publish.ts index b91cc98c1..c98586fe5 100644 --- a/src/app/submit/_api/publish.ts +++ b/src/app/submit/_api/publish.ts @@ -34,6 +34,7 @@ export function usePublishApi(onClear: () => void) { const { videos, isNsfw, buildBody } = useThreeSpeakManager(); const { clearAll } = usePollsCreationManagement(); + const { updateEntryQueryData } = EcencyEntriesCacheManagement.useUpdateEntry(); return useMutation({ mutationKey: ["publish"], @@ -152,7 +153,7 @@ export function usePublishApi(onClear: () => void) { max_accepted_payout: options.max_accepted_payout, percent_hbd: options.percent_hbd }; - EcencyEntriesCacheManagement.updateEntryQueryData([entry]); + updateEntryQueryData([entry]); success(i18next.t("submit.published")); onClear(); diff --git a/src/app/submit/_api/update.ts b/src/app/submit/_api/update.ts index c799ddfb2..a36b7b7b4 100644 --- a/src/app/submit/_api/update.ts +++ b/src/app/submit/_api/update.ts @@ -16,6 +16,8 @@ export function useUpdateApi(onClear: () => void) { const { buildBody } = useThreeSpeakManager(); const router = useRouter(); + const { updateEntryQueryData } = EcencyEntriesCacheManagement.useUpdateEntry(); + return useMutation({ mutationKey: ["update"], mutationFn: async ({ @@ -74,7 +76,7 @@ export function useUpdateApi(onClear: () => void) { json_metadata: jsonMeta, updated: correctIsoDate(moment().toISOString()) }; - EcencyEntriesCacheManagement.updateEntryQueryData([entry]); + updateEntryQueryData([entry]); onClear(); success(i18next.t("submit.updated")); diff --git a/src/core/caches/entries-cache.tsx b/src/core/caches/entries-cache.tsx index 570847fa1..12045a312 100644 --- a/src/core/caches/entries-cache.tsx +++ b/src/core/caches/entries-cache.tsx @@ -3,6 +3,7 @@ import * as bridgeApi from "../../api/bridge"; import dmca from "@/dmca.json"; import { Entry, EntryVote } from "@/entities"; import { makeEntryPath } from "@/utils"; +import { QueryClient, useQueryClient } from "@tanstack/react-query"; export namespace EcencyEntriesCacheManagement { export function getEntryQueryByPath(author?: string, permlink?: string) { @@ -12,8 +13,7 @@ export namespace EcencyEntriesCacheManagement { author && permlink ? makeEntryPath("", author!!, permlink!!) : "EMPTY" ], queryFn: () => bridgeApi.getPost(author, permlink), - enabled: typeof author === "string" && typeof permlink === "string" && !!author && !!permlink, - staleTime: Infinity + enabled: typeof author === "string" && typeof permlink === "string" && !!author && !!permlink }); } @@ -25,8 +25,7 @@ export namespace EcencyEntriesCacheManagement { ], queryFn: () => bridgeApi.getPost(initialEntry?.author, initialEntry?.permlink) as Promise, initialData: initialEntry, - enabled: !!initialEntry, - staleTime: Infinity + enabled: !!initialEntry }); } @@ -41,41 +40,118 @@ export namespace EcencyEntriesCacheManagement { }); } - export function addReply(entry: Entry | undefined, reply: Entry) { - return mutateEntryInstance(entry, (value) => ({ - ...value, - children: value.children + 1, - replies: [reply, ...value.replies] - })); + export function useAddReply(initialEntry?: Entry) { + const qc = useQueryClient(); + + return { + addReply: (reply: Entry, entry = initialEntry) => + mutateEntryInstance( + entry, + (value) => ({ + ...value, + children: value.children + 1, + replies: [reply, ...value.replies] + }), + qc + ) + }; } - export function updateRepliesCount(entry: Entry, count: number) { - return mutateEntryInstance(entry, (value) => ({ - ...value, - children: count - })); + export function useUpdateRepliesCount(initialEntry?: Entry) { + const qc = useQueryClient(); + + return { + updateRepliesCount: (count: number, entry = initialEntry) => + mutateEntryInstance( + entry, + (value) => ({ + ...value, + children: count + }), + qc + ) + }; } - export function updateVotes(entry: Entry, votes: EntryVote[], payout: number) { - return mutateEntryInstance(entry, (value) => ({ - ...value, - active_votes: votes, - stats: { ...entry.stats, total_votes: votes.length, flag_weight: entry.stats.flag_weight }, - total_votes: votes.length, - payout, - pending_payout_value: String(payout) - })); + export function useInvalidation(entry?: Entry) { + const qc = useQueryClient(); + return { + invalidate: () => + qc.invalidateQueries({ + queryKey: [ + QueryIdentifiers.ENTRY, + makeEntryPath("", entry?.author ?? "", entry?.permlink ?? "") + ] + }) + }; } - export function invalidate(entry: Entry) { - return getQueryClient().invalidateQueries({ - queryKey: [QueryIdentifiers.ENTRY, makeEntryPath("", entry.author, entry.permlink)] - }); + export function useUpdateVotes(entry?: Entry) { + const qc = useQueryClient(); + return { + update: (votes: EntryVote[], payout: number) => + entry && + mutateEntryInstance( + entry, + (value) => ({ + ...value, + active_votes: votes, + stats: { + ...entry.stats, + total_votes: votes.length, + flag_weight: entry.stats.flag_weight + }, + total_votes: votes.length, + payout, + pending_payout_value: String(payout) + }), + qc + ) + }; + } + + export function useUpdateEntry() { + const qc = useQueryClient(); + + return { + updateEntryQueryData: (entries: Entry[]) => + entries.forEach((entry) => { + qc.setQueryData( + [QueryIdentifiers.ENTRY, makeEntryPath("", entry.author, entry.permlink)], + () => { + const data = { ...entry }; + if ( + dmca.some((rx: string) => new RegExp(rx).test(`@${entry.author}/${entry.permlink}`)) + ) { + data.body = "This post is not available due to a copyright/fraudulent claim."; + data.title = ""; + } + + return data; + } + ); + }) + }; + } + + export function useUpdateReblogsCount(entry: Entry) { + const qc = useQueryClient(); + return { + update: (count: number) => + mutateEntryInstance( + entry, + (value) => ({ + ...value, + reblogs: count + }), + qc + ) + }; } - export function updateEntryQueryData(entries: Entry[]) { + function updateEntryQueryData(entries: Entry[], qc: QueryClient = getQueryClient()) { entries.forEach((entry) => { - getQueryClient().setQueryData( + qc.setQueryData( [QueryIdentifiers.ENTRY, makeEntryPath("", entry.author, entry.permlink)], () => { const data = { ...entry }; @@ -92,24 +168,20 @@ export namespace EcencyEntriesCacheManagement { }); } - export function updateReblogsCount(entry: Entry, count: number) { - console.log(entry, count); - return mutateEntryInstance(entry, (value) => { - value.reblogs = count; - return value; - }); - } - - function mutateEntryInstance(entry: Entry | undefined, callback: (value: Entry) => Entry) { + function mutateEntryInstance( + entry: Entry | undefined, + callback: (value: Entry) => Entry, + qc: QueryClient = getQueryClient() + ) { if (!entry) { throw new Error("Mutate entry instance – entry not provided"); } - const actualEntryValue = getQueryClient().getQueryData([ + const actualEntryValue = qc.getQueryData([ QueryIdentifiers.ENTRY, makeEntryPath("", entry.author, entry.permlink) ]); const value = callback(actualEntryValue ?? entry); - return updateEntryQueryData([value]); + return updateEntryQueryData([value], qc); } } diff --git a/src/core/react-query/index.ts b/src/core/react-query/index.ts index 0fc8ca745..274b5e4bf 100644 --- a/src/core/react-query/index.ts +++ b/src/core/react-query/index.ts @@ -86,7 +86,8 @@ export enum QueryIdentifiers { GET_FOLLOWING = "get-following", HIVE_HBD_STATS = "hive-hbd-stats", GET_ORDER_BOOK = "get-order-book", - SIMILAR_ENTRIES = "similar-entries" + SIMILAR_ENTRIES = "similar-entries", + SEARCH_BY_USERNAME = "search-by-username" } export function makeQueryClient() { @@ -104,13 +105,14 @@ export function makeQueryClient() { }); } -let browserQueryClient: QueryClient | undefined = undefined; +export let BROWSER_QUERY_CLIENT: QueryClient | undefined = undefined; + +export function setBrowserQueryClient(queryClient: QueryClient) { + BROWSER_QUERY_CLIENT = queryClient; +} export const getQueryClient = isServer ? cache(() => makeQueryClient()) - : () => { - if (!browserQueryClient) browserQueryClient = makeQueryClient(); - return browserQueryClient; - }; + : () => BROWSER_QUERY_CLIENT!; export * from "./ecency-queries-manager"; diff --git a/src/features/next-middleware/handle-entries-redirect.ts b/src/features/next-middleware/handle-entries-redirect.ts index bbaa2cc06..ee9bf8acd 100644 --- a/src/features/next-middleware/handle-entries-redirect.ts +++ b/src/features/next-middleware/handle-entries-redirect.ts @@ -11,7 +11,8 @@ export function isEntriesRedirect(request: NextRequest) { "spk", "engine", "settings", - "feed" + "feed", + "referrals" ]; const isAnySection = profileSections.some((section) => request.url.includes(section)); const isEntryLikePage = /\/(@.+)\/(.+)/gm.test(request.nextUrl.pathname); diff --git a/src/features/shared/boost/index.tsx b/src/features/shared/boost/index.tsx index 89d8cde33..6d2eefe8e 100644 --- a/src/features/shared/boost/index.tsx +++ b/src/features/shared/boost/index.tsx @@ -61,7 +61,7 @@ export function BoostDialog({ onHide }: Props) { ); useEffect(() => { - if (prices!.length > 0) { + if (prices && prices.length > 0) { setDuration(prices![0].duration); } }, [prices]); @@ -126,7 +126,7 @@ export function BoostDialog({ onHide }: Props) { className={`balance-input ${balanceError ? "is-invalid" : ""}`} plaintext={true} readOnly={true} - value={`${activeUserPoints?.points} POINTS`} + value={`${activeUserPoints?.points ?? "0.000"} POINTS`} /> {balanceError && {balanceError}} {isAlreadyBoosted && ( diff --git a/src/features/shared/discussion/discussion-item.tsx b/src/features/shared/discussion/discussion-item.tsx index 8f73e8ec5..55f0e0a49 100644 --- a/src/features/shared/discussion/discussion-item.tsx +++ b/src/features/shared/discussion/discussion-item.tsx @@ -60,6 +60,8 @@ export function DiscussionItem({ const { data: mutedUsers } = getMutedUsersQuery(activeUser).useClientQuery(); const { data: botsList } = getBotsQuery().useClientQuery(); + const { updateEntryQueryData } = EcencyEntriesCacheManagement.useUpdateEntry(); + const readMore = useMemo(() => (entry ? entry.children > 0 && entry.depth > 5 : false), [entry]); const showSubList = useMemo( () => (entry ? !readMore && entry.children > 0 : false), @@ -266,7 +268,7 @@ export function DiscussionItem({ EcencyEntriesCacheManagement.updateEntryQueryData([entry])} + onSuccess={(entry) => updateEntryQueryData([entry])} /> )} diff --git a/src/features/shared/discussion/index.tsx b/src/features/shared/discussion/index.tsx index 116e4c3fa..e6e506216 100644 --- a/src/features/shared/discussion/index.tsx +++ b/src/features/shared/discussion/index.tsx @@ -17,6 +17,7 @@ import { LinearProgress, LoginRequired } from "@/features/shared"; import { getBotsQuery } from "@/api/queries"; import { SortOrder } from "@/enums"; import { getDiscussionsQuery } from "@/api/queries/get-discussions-query"; +import { EcencyEntriesCacheManagement } from "@/core/caches"; setProxyBase(defaults.imageServer); @@ -33,6 +34,7 @@ export function Discussion({ hideControls, isRawContent, parent, community }: Pr const [visible, setVisible] = useState(false); const [order, setOrder] = useState(SortOrder.trending); + const { updateEntryQueryData } = EcencyEntriesCacheManagement.useUpdateEntry(); const { isLoading, data } = getDiscussionsQuery( parent, @@ -66,6 +68,10 @@ export function Discussion({ hideControls, isRawContent, parent, community }: Pr }, [isRawContent, previousIsRawContent]); useEffect(() => setVisible(!!activeUser), [activeUser]); + useEffect(() => { + updateEntryQueryData(Array.from(Object.values(data ?? []))); + }, [data]); + const show = () => setVisible(true); const join = ( diff --git a/src/features/shared/entry-vote-btn/entry-vote-dialog.tsx b/src/features/shared/entry-vote-btn/entry-vote-dialog.tsx index dd3371611..bbbb793dd 100644 --- a/src/features/shared/entry-vote-btn/entry-vote-dialog.tsx +++ b/src/features/shared/entry-vote-btn/entry-vote-dialog.tsx @@ -10,7 +10,7 @@ import { useGlobalStore } from "@/core/global-store"; import { InputVote } from "@ui/input"; import { parseAsset } from "@/utils"; import { votingPower } from "@/api/hive"; -import { getDynamicPropsQuery } from "@/api/queries"; +import { DEFAULT_DYNAMIC_PROPS, getDynamicPropsQuery } from "@/api/queries"; import { Account, Entry } from "@/entities"; import { Spinner } from "@ui/spinner"; @@ -126,7 +126,8 @@ export function EntryVoteDialog({ return 0; } - const { fundRecentClaims, fundRewardBalance, base, quote } = dynamicProps!; + const { fundRecentClaims, fundRewardBalance, base, quote } = + dynamicProps ?? DEFAULT_DYNAMIC_PROPS; const { data: account } = activeUser; if (!account.__loaded) { diff --git a/src/features/shared/search-by-username.tsx b/src/features/shared/search-by-username.tsx index 859ea63b2..996fcebf0 100644 --- a/src/features/shared/search-by-username.tsx +++ b/src/features/shared/search-by-username.tsx @@ -1,13 +1,12 @@ -import React, { useCallback, useEffect, useState } from "react"; +import React, { useEffect, useState } from "react"; import { FormControl, InputGroup } from "@ui/input"; import { Spinner } from "@ui/spinner"; import { useGlobalStore } from "@/core/global-store"; -import { lookupAccounts } from "@/api/hive"; -import { formatError } from "@/api/operations"; -import { error } from "@/features/shared/feedback"; import { UserAvatar } from "@/features/shared/user-avatar"; import { SuggestionList } from "@/features/shared/suggestion-list"; import i18next from "i18next"; +import { useSearchByUsernameQuery } from "@/api/queries"; +import { useDebounce } from "react-use"; interface Props { username?: string; @@ -21,10 +20,16 @@ export const SearchByUsername = ({ setUsername, excludeActiveUser, recent, usern const [prefilledUsername, setPrefilledUsername] = useState(username || ""); const [usernameInput, setUsernameInput] = useState(username || ""); - const [usernameData, setUsernameData] = useState([]); const [isActiveUserSet, setIsActiveUserSet] = useState(false); - const [timer, setTimer] = useState(null); - const [isUsernameDataLoading, setIsUsernameDataLoading] = useState(false); + + const [query, setQuery] = useState(""); + + const { data: usernameData, isLoading: isUsernameDataLoading } = useSearchByUsernameQuery( + query, + !isActiveUserSet + ); + + useDebounce(() => setQuery(usernameInput), 500, [usernameInput]); useEffect(() => { if (activeUser && !excludeActiveUser) { @@ -34,53 +39,11 @@ export const SearchByUsername = ({ setUsername, excludeActiveUser, recent, usern } }, [activeUser, excludeActiveUser, setUsername]); - const getUsernameData = useCallback( - async (query: string) => { - try { - const resp = await lookupAccounts(query, 5); - if (resp) { - setUsernameData( - resp.filter((item) => (excludeActiveUser ? item !== activeUser?.username : true)) - ); - } - } catch (e) { - error(...formatError(e)); - } finally { - setIsUsernameDataLoading(false); - } - }, - [activeUser?.username, excludeActiveUser] - ); - const fetchUsernameData = useCallback( - (query: string) => { - if (timer) { - clearTimeout(timer); - } - - if (usernameInput === "" || isActiveUserSet) { - setIsActiveUserSet(false); - setIsUsernameDataLoading(false); - return; - } - - setIsUsernameDataLoading(true); - setTimer(setTimeout(() => getUsernameData(query), 500)); - }, - [getUsernameData, isActiveUserSet, timer, usernameInput] - ); - useEffect(() => { - if (!usernameInput) { - setUsername(""); - if (recent) { - setUsernameData(recent); - } - } if (usernameInput !== prefilledUsername) { - fetchUsernameData(usernameInput); setPrefilledUsername(""); } - }, [fetchUsernameData, prefilledUsername, recent, setUsername, usernameInput]); + }, [prefilledUsername, usernameInput]); const suggestionProps = { renderer: (i: any) => { @@ -99,7 +62,7 @@ export const SearchByUsername = ({ setUsername, excludeActiveUser, recent, usern return ( diff --git a/src/features/shared/transactions/transaction-row.tsx b/src/features/shared/transactions/transaction-row.tsx index e99b830a5..840925c44 100644 --- a/src/features/shared/transactions/transaction-row.tsx +++ b/src/features/shared/transactions/transaction-row.tsx @@ -17,7 +17,7 @@ import { dateToFullRelative, formattedNumber, parseAsset, vestsToHp } from "@/ut import i18next from "i18next"; import { EntryLink, UserAvatar } from "@/features/shared"; import { TwoUserAvatar } from "@/features/shared/two-user-avatar"; -import { getDynamicPropsQuery } from "@/api/queries"; +import { DEFAULT_DYNAMIC_PROPS, getDynamicPropsQuery } from "@/api/queries"; import { Transaction } from "@/entities"; interface Props { @@ -29,7 +29,7 @@ interface Props { export function TransactionRow({ entry, transaction: item }: Props) { const { data: dynamicProps } = getDynamicPropsQuery().useClientQuery(); - const { hivePerMVests } = dynamicProps!; + const { hivePerMVests } = dynamicProps ?? DEFAULT_DYNAMIC_PROPS; const tr = item || entry; let flag = false; diff --git a/src/features/shared/transfer/transfer-step-1.tsx b/src/features/shared/transfer/transfer-step-1.tsx index 52eb896c7..941b22c91 100644 --- a/src/features/shared/transfer/transfer-step-1.tsx +++ b/src/features/shared/transfer/transfer-step-1.tsx @@ -14,7 +14,12 @@ import { vestsToHp } from "@/utils"; import { useGlobalStore } from "@/core/global-store"; -import { getDynamicPropsQuery, getPointsQuery, getTransactionsQuery } from "@/api/queries"; +import { + DEFAULT_DYNAMIC_PROPS, + getDynamicPropsQuery, + getPointsQuery, + getTransactionsQuery +} from "@/api/queries"; import { TransferFormText } from "@/features/shared/transfer/transfer-form-text"; import { TransferAssetSwitch } from "@/features/shared/transfer/transfer-assets-switch"; import { EXCHANGE_ACCOUNTS } from "@/consts"; @@ -64,7 +69,7 @@ export function TransferStep1({ titleLngKey }: Props) { [transactions] ); const w = useMemo( - () => new HiveWallet(activeUser!.data, dynamicProps!), + () => new HiveWallet(activeUser!.data, dynamicProps ?? DEFAULT_DYNAMIC_PROPS), [activeUser, dynamicProps] ); const subTitleLngKey = useMemo(() => `${mode}-sub-title`, [mode]); @@ -149,7 +154,7 @@ export function TransferStep1({ titleLngKey }: Props) { if (asset === "POINT") { return parseAsset(activeUserPoints?.points ?? "0.0").amount; } - const w = new HiveWallet(activeUser!.data, dynamicProps!); + const w = new HiveWallet(activeUser!.data, dynamicProps ?? DEFAULT_DYNAMIC_PROPS); if (mode === "withdraw-saving" || mode === "claim-interest") { return asset === "HIVE" ? w.savingBalance : w.savingBalanceHbd; @@ -164,7 +169,7 @@ export function TransferStep1({ titleLngKey }: Props) { } if (asset === "HP") { - const { hivePerMVests } = dynamicProps!; + const { hivePerMVests } = dynamicProps ?? DEFAULT_DYNAMIC_PROPS; const vestingShares = w.vestingSharesAvailable; return vestsToHp(vestingShares, hivePerMVests); } diff --git a/src/features/shared/transfer/transfer-step-2.tsx b/src/features/shared/transfer/transfer-step-2.tsx index 740ba01c8..891663ae9 100644 --- a/src/features/shared/transfer/transfer-step-2.tsx +++ b/src/features/shared/transfer/transfer-step-2.tsx @@ -7,7 +7,7 @@ import React, { useMemo } from "react"; import { useTransferSharedState } from "./transfer-shared-state"; import { useGlobalStore } from "@/core/global-store"; import { hpToVests } from "@/features/shared/transfer/hp-to-vests"; -import { getDynamicPropsQuery } from "@/api/queries"; +import { DEFAULT_DYNAMIC_PROPS, getDynamicPropsQuery } from "@/api/queries"; interface Props { titleLngKey: string; @@ -48,7 +48,7 @@ export function TransferStep2({ titleLngKey }: Props) {
{asset === "HP" && (
- {hpToVests(Number(amount), dynamicProps!.hivePerMVests)} + {hpToVests(Number(amount), (dynamicProps ?? DEFAULT_DYNAMIC_PROPS).hivePerMVests)}
)} {memo &&
{memo}
} diff --git a/src/features/shared/transfer/use-debounce-transfer-account-data.ts b/src/features/shared/transfer/use-debounce-transfer-account-data.ts index 2dbf95219..2b16c1697 100644 --- a/src/features/shared/transfer/use-debounce-transfer-account-data.ts +++ b/src/features/shared/transfer/use-debounce-transfer-account-data.ts @@ -4,6 +4,7 @@ import { error } from "@/features/shared"; import { formatError } from "@/api/operations"; import { useTransferSharedState } from "./transfer-shared-state"; import { + DEFAULT_DYNAMIC_PROPS, getAccountFullQuery, getDynamicPropsQuery, getVestingDelegationsQuery @@ -47,7 +48,7 @@ export function useDebounceTransferAccountData() { formattedNumber( vestsToHp( Number(parseAsset(delegateAccount!.vesting_shares).amount), - dynamicProps!.hivePerMVests + (dynamicProps ?? DEFAULT_DYNAMIC_PROPS).hivePerMVests ) ) ) diff --git a/src/features/shared/wallet-badge.tsx b/src/features/shared/wallet-badge.tsx index 50b04160d..e17af9436 100644 --- a/src/features/shared/wallet-badge.tsx +++ b/src/features/shared/wallet-badge.tsx @@ -7,7 +7,7 @@ import Link from "next/link"; import { creditCardSvg } from "@ui/svg"; import i18next from "i18next"; import { useGlobalStore } from "@/core/global-store"; -import { getDynamicPropsQuery } from "@/api/queries"; +import { DEFAULT_DYNAMIC_PROPS, getDynamicPropsQuery } from "@/api/queries"; export const WalletBadge = ({ icon }: { icon: ReactNode }) => { const activeUser = useGlobalStore((s) => s.activeUser); @@ -18,7 +18,9 @@ export const WalletBadge = ({ icon }: { icon: ReactNode }) => { useEffect(() => { if (activeUser?.data?.__loaded) { - setHasUnclaimedRewards(new HiveWallet(activeUser.data, dynamicProps!).hasUnclaimedRewards); + setHasUnclaimedRewards( + new HiveWallet(activeUser.data, dynamicProps ?? DEFAULT_DYNAMIC_PROPS).hasUnclaimedRewards + ); } }, [activeUser, dynamicProps]); return (