okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221apps/host: the owner's UI and the Node App Host0b3299a01

main
387 B6 linesraw
1/** Pick the adjacent tab when the selected preview closes. */
2export function closePreviewTab<T extends {id:string}>(items:T[], selected:string|null, id:string) {
3  const index=items.findIndex(item=>item.id===id);
4  const remaining=items.filter(item=>item.id!==id);
5  return {items:remaining,selected:selected===id?(remaining[Math.min(index,remaining.length-1)]?.id??null):selected};
6}