Richte die Oberflaeche an den Designrichtlinien von Mitai aus.
Deploy Development / deploy (push) Successful in 22s
Deploy Development / deploy (push) Successful in 22s
Farben, Karten, Formulare und die Shell folgen Mitai: unten die Navigation, ab 1024 Pixel die Seitenleiste. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
2558239bfd
commit
332be8376e
3 files changed
+432
-117
No files matched your search
@@ -50,7 +50,7 @@ export function Login() {
|
||||
<input type="password" autoComplete="current-password" value={password} onChange={(event) => setPassword(event.target.value)} required />
|
||||
</label>
|
||||
{error ? <p className="error">{error}</p> : null}
|
||||
<button type="submit" disabled={pending}>{pending ? "Anmeldung …" : "Anmelden"}</button>
|
||||
<button type="submit" className="btn-full" disabled={pending}>{pending ? "Anmeldung …" : "Anmelden"}</button>
|
||||
</form>
|
||||
{demo ? (
|
||||
<div className="demo">
|
||||
|
||||
@@ -2,6 +2,13 @@ import { useContext, useState } from "react";
|
||||
import { NavLink, Outlet, useNavigate } from "react-router-dom";
|
||||
import { SessionContext } from "../session.js";
|
||||
|
||||
const NAV = [
|
||||
{ to: "/", end: true, label: "Übersicht", icon: "home" },
|
||||
{ to: "/cases", label: "Akten", icon: "folder" },
|
||||
{ to: "/matters", label: "Vorgänge", icon: "layers" },
|
||||
{ to: "/rooms", label: "Datenräume", icon: "rooms" },
|
||||
];
|
||||
|
||||
export function Shell() {
|
||||
const { session, changeScope, logout } = useContext(SessionContext);
|
||||
const navigate = useNavigate();
|
||||
@@ -26,41 +33,98 @@ export function Shell() {
|
||||
navigate(`/search?q=${encodeURIComponent(term)}`);
|
||||
}
|
||||
|
||||
function scopeSelect() {
|
||||
return (
|
||||
<select value={session.scope.id} onChange={onScope} aria-label="Datenraum">
|
||||
{session.rooms.map((room) => (
|
||||
<option key={room.id} value={room.id}>{room.name}</option>
|
||||
))}
|
||||
</select>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="app">
|
||||
<header className="top">
|
||||
<div className="brand">
|
||||
<NavLink to="/">Tsumugu</NavLink>
|
||||
<span>{session.account.display_name}</span>
|
||||
<div className="app-shell">
|
||||
<aside className="desktop-sidebar" aria-label="Hauptnavigation">
|
||||
<div className="desktop-sidebar__brand">
|
||||
<div className="desktop-sidebar__logo" aria-hidden="true" />
|
||||
<div className="desktop-sidebar__title">Tsumugu</div>
|
||||
</div>
|
||||
<label className="scope">
|
||||
Datenraum
|
||||
<select value={session.scope.id} onChange={onScope}>
|
||||
{session.rooms.map((room) => (
|
||||
<option key={room.id} value={room.id}>
|
||||
{room.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<form className="search" onSubmit={onSearch}>
|
||||
<input
|
||||
value={query}
|
||||
onChange={(event) => setQuery(event.target.value)}
|
||||
placeholder="Suchen"
|
||||
aria-label="Suchen"
|
||||
/>
|
||||
</form>
|
||||
<button type="button" className="quiet" onClick={logout}>Abmelden</button>
|
||||
</header>
|
||||
<nav className="nav">
|
||||
<NavLink to="/" end>Übersicht</NavLink>
|
||||
<NavLink to="/cases">Akten</NavLink>
|
||||
<NavLink to="/matters">Vorgänge</NavLink>
|
||||
<NavLink to="/rooms">Datenräume</NavLink>
|
||||
</nav>
|
||||
{error ? <p className="error banner">{error}</p> : null}
|
||||
<Outlet />
|
||||
<nav className="desktop-sidebar__nav">
|
||||
{NAV.map((item) => (
|
||||
<NavLink key={item.to} to={item.to} end={item.end} className={({ isActive }) => `desktop-sidebar__link${isActive ? " active" : ""}`}>
|
||||
<NavIcon name={item.icon} />
|
||||
<span>{item.label}</span>
|
||||
</NavLink>
|
||||
))}
|
||||
</nav>
|
||||
<div className="desktop-sidebar__scope">
|
||||
<label>
|
||||
Datenraum
|
||||
{scopeSelect()}
|
||||
</label>
|
||||
</div>
|
||||
<div className="desktop-sidebar__footer">
|
||||
<div className="desktop-sidebar__user-text">
|
||||
<span className="desktop-sidebar__user-name">{session.account.display_name}</span>
|
||||
<span className="desktop-sidebar__user-tier">{session.scope.name}</span>
|
||||
</div>
|
||||
<button type="button" className="desktop-sidebar__logout" onClick={logout} title="Abmelden">
|
||||
<NavIcon name="logout" />
|
||||
</button>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<div className="app-shell__column">
|
||||
<header className="app-header">
|
||||
<div className="app-header__bar mobile-only">
|
||||
<NavLink to="/" className="app-logo">Tsumugu</NavLink>
|
||||
<button type="button" className="quiet" onClick={logout}>Abmelden</button>
|
||||
</div>
|
||||
<label className="scope mobile-only">
|
||||
Datenraum
|
||||
{scopeSelect()}
|
||||
</label>
|
||||
<form className="search" onSubmit={onSearch}>
|
||||
<input
|
||||
value={query}
|
||||
onChange={(event) => setQuery(event.target.value)}
|
||||
placeholder="Suchen"
|
||||
aria-label="Suchen"
|
||||
/>
|
||||
<button type="submit">Suchen</button>
|
||||
</form>
|
||||
</header>
|
||||
{error ? <p className="error banner">{error}</p> : null}
|
||||
<div className="app-main">
|
||||
<Outlet />
|
||||
</div>
|
||||
<nav className="bottom-nav" aria-label="Hauptnavigation">
|
||||
{NAV.map((item) => (
|
||||
<NavLink key={item.to} to={item.to} end={item.end} className={({ isActive }) => `nav-item${isActive ? " active" : ""}`}>
|
||||
<NavIcon name={item.icon} />
|
||||
<span>{item.label}</span>
|
||||
</NavLink>
|
||||
))}
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function NavIcon({ name }) {
|
||||
const common = { width: 20, height: 20, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true };
|
||||
if (name === "home") {
|
||||
return <svg {...common}><path d="M4 10.5 12 4l8 6.5V20a1 1 0 0 1-1 1h-5v-6H10v6H5a1 1 0 0 1-1-1z" /></svg>;
|
||||
}
|
||||
if (name === "folder") {
|
||||
return <svg {...common}><path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" /></svg>;
|
||||
}
|
||||
if (name === "layers") {
|
||||
return <svg {...common}><path d="m12 3 9 5-9 5-9-5z" /><path d="m3 12 9 5 9-5" /><path d="m3 17 9 5 9-5" /></svg>;
|
||||
}
|
||||
if (name === "logout") {
|
||||
return <svg {...common}><path d="M9 6H5a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h4" /><path d="M14 16l4-4-4-4" /><path d="M18 12H9" /></svg>;
|
||||
}
|
||||
return <svg {...common}><path d="M4 8h16M4 12h16M4 16h10" /></svg>;
|
||||
}
|
||||
Reference in new issue
Block a user