feat(toolbar): auto-compact AppSwitcher based on available width

Replace hardcoded app count threshold with ResizeObserver-based
detection. Uses a two-layer layout (overflow-hidden outer + shrink-0
inner) to avoid the compact/normal oscillation problem.
This commit is contained in:
Jason
2026-02-21 20:24:49 +08:00
parent 2e676e5f53
commit ce92f37ef0
3 changed files with 288 additions and 235 deletions
+5 -1
View File
@@ -63,7 +63,11 @@ export function AppSwitcher({
name={appDisplayName[app]}
size={iconSize}
/>
{!compact && <span>{appDisplayName[app]}</span>}
{!compact && (
<span className="transition-all duration-200 whitespace-nowrap">
{appDisplayName[app]}
</span>
)}
</button>
))}
</div>