Retro Bulletin Board Systems on atproto. Web app and TUI. lazy mirror of alyraffauf/atbbs atbbs.xyz
forums python tui atproto bbs
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

web/Home: add bbs randomizer

+19 -6
+19 -6
web/src/pages/Home.tsx
··· 29 29 if (h) nav(`/bbs/${encodeURIComponent(h)}`); 30 30 } 31 31 32 + function onRandom() { 33 + if (!discovered.length) return; 34 + const d = discovered[Math.floor(Math.random() * discovered.length)]; 35 + nav(`/bbs/${encodeURIComponent(d.handle)}`); 36 + } 37 + 32 38 useEffect(() => { 33 39 (async () => { 34 40 try { ··· 37 43 ); 38 44 let records = (await r.json()) as UFORecord[]; 39 45 if (!records.length) return; 40 - if (records.length > 5) { 41 - records = records.sort(() => Math.random() - 0.5).slice(0, 5); 42 - } 46 + records = records.sort(() => Math.random() - 0.5); 43 47 const authors = await resolveIdentitiesBatch(records.map((r) => r.did)); 44 48 const items: Discovered[] = []; 45 49 for (const r of records) { ··· 95 99 > 96 100 go 97 101 </button> 102 + <button 103 + type="button" 104 + onClick={onRandom} 105 + className="bg-neutral-800 hover:bg-neutral-700 text-neutral-200 px-4 py-2 rounded" 106 + > 107 + random 108 + </button> 98 109 </form> 99 110 {discovered.length > 0 && ( 100 111 <div> ··· 102 113 or try one of these 103 114 </p> 104 115 <div className="space-y-1"> 105 - {discovered.map((d) => ( 116 + {discovered.slice(0, 5).map((d) => ( 106 117 <Link 107 118 key={d.handle} 108 119 to={`/bbs/${encodeURIComponent(d.handle)}`} ··· 136 147 </div> 137 148 {tab === "pip" && ( 138 149 <pre className="bg-neutral-900 border border-neutral-800 rounded px-4 py-3 text-neutral-400 text-xs"> 139 - <span className="text-neutral-500 select-none">$ </span>pip install atbbs 150 + <span className="text-neutral-500 select-none">$ </span>pip install 151 + atbbs 140 152 {"\n"} 141 153 <span className="text-neutral-500 select-none">$ </span>atbbs 142 154 </pre> 143 155 )} 144 156 {tab === "uv" && ( 145 157 <pre className="bg-neutral-900 border border-neutral-800 rounded px-4 py-3 text-neutral-400 text-xs"> 146 - <span className="text-neutral-500 select-none">$ </span>uv tool install atbbs 158 + <span className="text-neutral-500 select-none">$ </span>uv tool 159 + install atbbs 147 160 {"\n"} 148 161 <span className="text-neutral-500 select-none">$ </span>atbbs 149 162 </pre>