demos for spacedust

icons for lex groups

+19 -2
+19 -2
atproto-notifications/src/components/Feed.tsx
··· 25 25 <ButtonGroup 26 26 options={secondaries.map(({ k, unread, total }) => { 27 27 28 + // blehhhhhhhhhhhh 28 29 29 30 let title = k; 30 31 let icon; ··· 46 47 icon = lex?.clients[0]?.icon; 47 48 appName = lex?.name; 48 49 title = lex?.known_sources[k.slice(app.length + 1)] ?? k; 49 - } 50 - if (secondary === 'app') { 50 + 51 + } else if (secondary === 'group') { 52 + 53 + let appPrefix; 54 + try { 55 + const [nsid, ...rp] = k.split(':'); 56 + const parts = nsid.split('.'); 57 + const unreversed = parts.toReversed().join('.'); 58 + app = psl.parse(unreversed)?.domain ?? 'unknown'; 59 + appPrefix = app.split('.').toReversed().join('.'); 60 + } catch (e) { 61 + console.error('getting top app failed', e); 62 + } 63 + const lex = lexicons[appPrefix]; 64 + icon = lex?.clients[0]?.icon; 65 + appName = lex?.name; 66 + 67 + } else if (secondary === 'app') { 51 68 const appReversed = k.split('.').toReversed().join('.'); 52 69 const lex = lexicons[appReversed]; 53 70 icon = lex?.clients[0]?.icon;