Open History to see the last commit
1import type { SidebarRowToken } from "@t3tools/client-runtime/thread-row-layout";
2
3export * from "@t3tools/client-runtime/thread-row-layout";
4
5const SHARED_TEXT_CLASS_NAME = "min-w-0 max-w-max basis-0 grow-[100]";
6
7/**
8 * Text items split a crowded line evenly and give back what they don't need, so a short branch
9 * keeps its full width beside a long project name. Spacers get only what the text leaves over.
10 */
11export function sidebarRowItemFlexClassName(token: SidebarRowToken, titleStretches: boolean) {
12 switch (token.id) {
13 case "spacer":
14 return "min-w-0 flex-1";
15 case "title":
16 // A crowded line still leaves the title a few characters.
17 return titleStretches
18 ? "min-w-12 basis-0 grow-[100]"
19 : "min-w-12 max-w-max basis-0 grow-[100]";
20 case "projectName":
21 return SHARED_TEXT_CLASS_NAME;
22 case "branch":
23 case "environment":
24 return token.form === "compact" ? "shrink-0" : SHARED_TEXT_CLASS_NAME;
25 default:
26 return "shrink-0";
27 }
28}