this repo has no description
0
fork

Configure Feed

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

Add menu to quick switch to current logged-in instance

+73 -3
+26 -2
src/pages/account-statuses.jsx
··· 57 57 const tagged = searchParams.get('tagged'); 58 58 const media = !!searchParams.get('media'); 59 59 const { masto, instance, authenticated } = api({ instance: params.instance }); 60 + const { masto: currentMasto, instance: currentInstance } = api(); 60 61 const accountStatusesIterator = useRef(); 61 62 62 63 const allSearchParams = [month, excludeReplies, excludeBoosts, tagged, media]; ··· 67 68 }, allSearchParams); 68 69 69 70 const sameCurrentInstance = useMemo( 70 - () => instance === api().instance, 71 - [instance], 71 + () => instance === currentInstance, 72 + [instance, currentInstance], 72 73 ); 73 74 const [searchEnabled, setSearchEnabled] = useState(false); 74 75 useEffect(() => { ··· 516 517 Switch to account's instance (<b>{accountInstance}</b>) 517 518 </small> 518 519 </MenuItem> 520 + {!sameCurrentInstance && ( 521 + <MenuItem 522 + onClick={() => { 523 + (async () => { 524 + try { 525 + const acc = await currentMasto.v1.accounts.lookup({ 526 + acct: account.acct + '@' + instance, 527 + }); 528 + const { id } = acc; 529 + location.hash = `/${currentInstance}/a/${id}`; 530 + } catch (e) { 531 + console.error(e); 532 + alert('Unable to fetch account info'); 533 + } 534 + })(); 535 + }} 536 + > 537 + <Icon icon="transfer" />{' '} 538 + <small class="menu-double-lines"> 539 + Switch to my instance (<b>{currentInstance}</b>) 540 + </small> 541 + </MenuItem> 542 + )} 519 543 </Menu2> 520 544 } 521 545 />
+19 -1
src/pages/hashtag.jsx
··· 42 42 const { masto, instance, authenticated } = api({ 43 43 instance: props?.instance || params.instance, 44 44 }); 45 - const { authenticated: currentAuthenticated } = api(); 45 + const { 46 + masto: currentMasto, 47 + instance: currentInstance, 48 + authenticated: currentAuthenticated, 49 + } = api(); 46 50 const hashtagTitle = hashtags.map((t) => `#${t}`).join(' '); 47 51 const hashtagPostTitle = media ? ` (Media only)` : ''; 48 52 const title = instance ··· 376 380 > 377 381 <Icon icon="bus" /> <span>Go to another instance…</span> 378 382 </MenuItem> 383 + {currentInstance !== instance && ( 384 + <MenuItem 385 + onClick={() => { 386 + location.hash = `/${currentInstance}/t/${hashtags.join( 387 + '+', 388 + )}${linkParams}`; 389 + }} 390 + > 391 + <Icon icon="bus" />{' '} 392 + <small class="menu-double-lines"> 393 + Go to my instance (<b>{currentInstance}</b>) 394 + </small> 395 + </MenuItem> 396 + )} 379 397 </Menu2> 380 398 } 381 399 />
+15
src/pages/public.jsx
··· 21 21 const { masto, instance } = api({ 22 22 instance: props?.instance || params.instance, 23 23 }); 24 + const { masto: currentMasto, instance: currentInstance } = api(); 24 25 const title = `${isLocal ? 'Local' : 'Federated'} timeline (${instance})`; 25 26 useTitle(title, isLocal ? `/:instance?/p/l` : `/:instance?/p`); 26 27 // const navigate = useNavigate(); ··· 138 139 > 139 140 <Icon icon="bus" /> <span>Go to another instance…</span> 140 141 </MenuItem> 142 + {currentInstance !== instance && ( 143 + <MenuItem 144 + onClick={() => { 145 + location.hash = isLocal 146 + ? `/${currentInstance}/p/l` 147 + : `/${currentInstance}/p`; 148 + }} 149 + > 150 + <Icon icon="bus" />{' '} 151 + <small class="menu-double-lines"> 152 + Go to my instance (<b>{currentInstance}</b>) 153 + </small> 154 + </MenuItem> 155 + )} 141 156 </Menu2> 142 157 } 143 158 />
+13
src/pages/trending.jsx
··· 38 38 const { masto, instance } = api({ 39 39 instance: props?.instance || params.instance, 40 40 }); 41 + const { masto: currentMasto, instance: currentInstance } = api(); 41 42 const title = `Trending (${instance})`; 42 43 useTitle(title, `/:instance?/trending`); 43 44 // const navigate = useNavigate(); ··· 291 292 > 292 293 <Icon icon="bus" /> <span>Go to another instance…</span> 293 294 </MenuItem> 295 + {currentInstance !== instance && ( 296 + <MenuItem 297 + onClick={() => { 298 + location.hash = `/${currentInstance}/trending`; 299 + }} 300 + > 301 + <Icon icon="bus" />{' '} 302 + <small class="menu-double-lines"> 303 + Go to my instance (<b>{currentInstance}</b>) 304 + </small> 305 + </MenuItem> 306 + )} 294 307 </Menu2> 295 308 } 296 309 />