feat(web): add the calm redesign as a sidebar switch

The redesign proposed after the anti-slop audit (anti-slop/audit-001) is now
an opt-in design layer. The "New design" switch at the bottom of the sidebar
sets data-design="calm" on <html> and remembers it; theme-init.js applies the
stored choice before the first paint. The classic look stays the default and
is unchanged.

styles/calm.css, scoped to that attribute, keeps the Hive DS colors and:
bundles Hanken Grotesk and JetBrains Mono (@fontsource-variable, OFL-1.1);
uses three radii (6 / 10 / 14 px); drops the honeycomb wallpaper, gradient
fills, glass, glows and pulsing dots; keeps shadows only on menus and
dialogs; shows labels as written instead of tracked capitals; and marks the
active sidebar item with fill, a 1px line and weight instead of a stripe.
Screen layouts are unchanged.
This commit is contained in:
shumeiko.it
2026-10-26 21:01:27 +01:00
parent 1e826aa220
commit 5163f3dd48
9 changed files with 321 additions and 3 deletions

View File

@@ -452,7 +452,7 @@ const ShellLayout = () => {
return (
<div className="relative w-screen h-screen overflow-hidden select-none">
<img src={theme === 'light' ? wallpaperLight : wallpaperDark} alt="" className="absolute inset-0 w-full h-full object-cover" width={1920} height={1080} />
<img src={theme === 'light' ? wallpaperLight : wallpaperDark} alt="" className="desktop-wallpaper absolute inset-0 w-full h-full object-cover" width={1920} height={1080} />
<div className="absolute inset-0 desktop-overlay" />
<StatusBar workspaceName={effectiveActiveWorkspace?.name}

View File

@@ -1,7 +1,8 @@
import type { ElementType, ReactElement } from "react";
import { useLocation, useNavigate } from "react-router-dom";
import { ChevronDown, Plus, Search } from "lucide-react";
import { ChevronDown, Palette, Plus, Search } from "lucide-react";
import { cmdKLabel } from "@/lib/platform";
import { useDesignMode } from "@/lib/design-mode";
import { HintTooltip } from "@/components/ui/hint-tooltip";
import { TooltipProvider } from "@/components/ui/tooltip";
@@ -70,6 +71,8 @@ const Sidebar = ({
}: SidebarProps) => {
const navigate = useNavigate();
const { pathname } = useLocation();
const [design, setDesign] = useDesignMode();
const calm = design === "calm";
const isActive = (item: SidebarNavItem): boolean =>
item.activeWhen
@@ -95,7 +98,7 @@ const Sidebar = ({
{active && (
<span
aria-hidden
className="absolute -left-3 top-1/2 h-[18px] w-[3px] -translate-y-1/2 rounded bg-[var(--honey)]"
className="nav-active-stripe absolute -left-3 top-1/2 h-[18px] w-[3px] -translate-y-1/2 rounded bg-[var(--honey)]"
/>
)}
<Icon
@@ -197,6 +200,36 @@ const Sidebar = ({
<div className="flex-1" />
{/* Design switch: the classic look or the calm redesign (styles/calm.css) */}
<RailHint content={calm ? "New design: on" : "New design: off"}>
<button
type="button"
role="switch"
aria-checked={calm}
aria-label="New design"
data-testid="sidebar-design-switch"
onClick={() => setDesign(calm ? "classic" : "calm")}
className="flex items-center justify-center gap-3 rounded-[10px] px-2.5 py-2 text-left text-[var(--text-2)] transition-colors hover:bg-[var(--surface-2)] hover:text-[var(--text)] lg:justify-start"
>
{/* Honey when on, so the icon-only rail shows the state too. */}
<Palette
className={`h-[18px] w-[18px] shrink-0 ${calm ? "text-[var(--honey-text)]" : ""}`}
strokeWidth={1.7}
/>
<span className="hidden flex-1 text-[13px] font-medium lg:inline">New design</span>
<span
aria-hidden
className={`hidden h-[18px] w-8 shrink-0 items-center rounded-full border p-[2px] transition-colors lg:inline-flex ${
calm
? "justify-end border-[var(--honey)] bg-[var(--honey)]"
: "justify-start border-[var(--line-strong)] bg-[var(--surface-2)]"
}`}
>
<span className={`h-3 w-3 rounded-full ${calm ? "bg-[#1a1407]" : "bg-[var(--text-2)]"}`} />
</span>
</button>
</RailHint>
{/* User row → Settings */}
<RailHint content={userName ?? "Account"}>
<button