File tree Expand file tree Collapse file tree 2 files changed +18
-15
lines changed
apps/website/src/app/dashboard/[id] Expand file tree Collapse file tree 2 files changed +18
-15
lines changed Original file line number Diff line number Diff line change @@ -34,21 +34,26 @@ export default function GuildPage() {
3434 ] }
3535 />
3636
37- < div className = "flex w-full flex-col gap-3 rounded-lg border-[1px] border-on-secondary bg-card p-4 dark:border-on-secondary-dark dark:bg-card-dark" >
37+ < div className = "flex w-full flex-row gap-3 rounded-lg border-[1px] border-on-secondary bg-card p-4 dark:border-on-secondary-dark dark:bg-card-dark" >
3838 < div className = "flex flex-row gap-4" >
3939 < GuildIcon data = { guild } disableLink hasBots = { guild . bots . length > 0 } />
40- < p className = "content-center w-full overflow-hidden overflow-ellipsis whitespace-nowrap text-lg font-medium text-primary dark:text-primary-dark" >
41- { guild . name }
42- </ p >
40+ < div >
41+ < p className = "content-center w-full overflow-hidden overflow-ellipsis whitespace-nowrap text-lg font-medium text-primary dark:text-primary-dark" >
42+ { guild . name }
43+ </ p >
44+ < p className = "text-base text-secondary dark:text-secondary-dark" > { guild . bots . length } bot(s) active</ p >
45+ </ div >
4346 </ div >
4447
45- < div className = "flex flex-col gap-1" >
46- < p className = "text-base text-secondary dark:text-secondary-dark" > { guild . bots . length } bot(s) active</ p >
48+ < div className = "flex flex-col gap-1 ml-auto text-right" >
4749 { guild . approximate_member_count !== undefined && (
4850 < p className = "text-base text-secondary dark:text-secondary-dark" >
4951 { guild . approximate_member_count . toLocaleString ( ) } member(s)
50- { guild . approximate_presence_count !== undefined &&
51- ` · ${ guild . approximate_presence_count . toLocaleString ( ) } online` }
52+ </ p >
53+ ) }
54+ { guild . approximate_presence_count !== undefined && (
55+ < p className = "text-base text-secondary dark:text-secondary-dark" >
56+ { guild . approximate_presence_count ?. toLocaleString ( ) ?? '0' } online
5257 </ p >
5358 ) }
5459 </ div >
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ export type Me = APIUser & { guilds: MeGuild[]; isGlobalAdmin: boolean };
1616
1717const CACHE = new Map < string , Me > ( ) ;
1818const CACHE_TIMEOUTS = new Map < string , NodeJS . Timeout > ( ) ;
19+ const CACHE_TTL = 5 * 60 * 1_000 ; // 5 minutes
1920
2021export async function fetchMe ( discordAccessToken : string , force = false ) : Promise < Me > {
2122 if ( CACHE . has ( discordAccessToken ) && ! force ) {
@@ -78,13 +79,10 @@ export async function fetchMe(discordAccessToken: string, force = false): Promis
7879 const timeout = CACHE_TIMEOUTS . get ( discordAccessToken ) ! ;
7980 timeout . refresh ( ) ;
8081 } else {
81- const timeout = setTimeout (
82- ( ) => {
83- CACHE . delete ( discordAccessToken ) ;
84- CACHE_TIMEOUTS . delete ( discordAccessToken ) ;
85- } ,
86- 5 * 60 * 1_000 ,
87- ) . unref ( ) ;
82+ const timeout = setTimeout ( ( ) => {
83+ CACHE . delete ( discordAccessToken ) ;
84+ CACHE_TIMEOUTS . delete ( discordAccessToken ) ;
85+ } , CACHE_TTL ) . unref ( ) ;
8886
8987 CACHE_TIMEOUTS . set ( discordAccessToken , timeout ) ;
9088 }
You can’t perform that action at this time.
0 commit comments