Skip to content

An open-source, self-hosted system for apps built with web technologies.

Taskbar in sections: Start, the Map, the Windows and Sign out, one distance from every separator and one button size

zohayrslileh0749610b6eb3
diff --git a/source/client/view/structure/desktop/layers/shell/taskbar/taskbar.tsx b/source/client/view/structure/desktop/layers/shell/taskbar/taskbar.tsx
index c145b06..7a8d25d 100644
--- a/source/client/view/structure/desktop/layers/shell/taskbar/taskbar.tsx
+++ b/source/client/view/structure/desktop/layers/shell/taskbar/taskbar.tsx
@@ -12,6 +12,16 @@ export default function Taskbar({ leading, navigation, trailing, taskbar, spacin
const horizontal = taskbar.position === "top" || taskbar.position === "bottom"
const orientation = horizontal ? "horizontal" : "vertical"
+ // Every section stands the same distance from the separators beside it, and across a vertical Taskbar its buttons share one width.
+ const room = spacing / 4
+ const section = (before: boolean, after: boolean): CSSProperties => ({
+ flexShrink: 0,
+ minWidth: 0,
+ alignItems: horizontal ? "center" : "stretch",
+ alignSelf: horizontal ? "center" : "stretch",
+ [horizontal ? "paddingInlineStart" : "paddingBlockStart"]: before ? room : 0,
+ [horizontal ? "paddingInlineEnd" : "paddingBlockEnd"]: after ? room : 0
+ })
const transaction = useAppearance().transaction
const reducedMotion = useReducedMotion()
const [revealed, setRevealed] = useState(false)
@@ -78,17 +88,18 @@ export default function Taskbar({ leading, navigation, trailing, taskbar, spacin
>
- <Toolbar.Group style={{ flexShrink: 0 }}>{leading}</Toolbar.Group>
+ <Toolbar.Group style={section(false, true)}>{leading}</Toolbar.Group>
<Toolbar.Separator className="shadow-taskbar-separator" />
{/* Where this Desktop looks, between what starts Programs and the Windows they open. */}
{navigation && <>
- <Toolbar.Group style={{ flexShrink: 0 }}>{navigation}</Toolbar.Group>
+ <Toolbar.Group style={section(true, true)}>{navigation}</Toolbar.Group>
<Toolbar.Separator className="shadow-taskbar-separator" />
</>}
- <Toolbar.Group style={{ flex: "1 1 0", alignSelf: "stretch", minWidth: 0, minHeight: 0, overflow: "hidden" }}>
+ {/* Clipped only along the Taskbar, and a little past its ends, so the items' shadows and focus show whole. */}
+ <Toolbar.Group style={{ ...section(true, true), flex: "1 1 0", alignSelf: "stretch", minHeight: 0, overflowClipMargin: room, ...(horizontal ? { overflowX: "clip" } : { overflowY: "clip" }) }}>
{children}
@@ -96,7 +107,7 @@ export default function Taskbar({ leading, navigation, trailing, taskbar, spacin
<Toolbar.Separator className="shadow-taskbar-separator" />
- <Toolbar.Group style={{ flexShrink: 0 }}>{trailing}</Toolbar.Group>
+ <Toolbar.Group style={section(true, false)}>{trailing}</Toolbar.Group>
</Surface>
@@ -109,7 +120,7 @@ interface TaskbarProps extends Omit<SurfaceProps<typeof Toolbar>, "as" | "childr
leading: ReactNode
- /** Where this Desktop looks on the plane of standard Windows, between the leading items and the Windows. */
+ /** Where this Desktop looks on the plane of standard Windows, a section of its own before the Windows. */
navigation?: ReactNode
trailing: ReactNode
diff --git a/source/client/view/structure/desktop/layers/shell/taskbar/viewport/viewport-control.tsx b/source/client/view/structure/desktop/layers/shell/taskbar/viewport/viewport-control.tsx
index 7222c5c..a65a1f7 100644
--- a/source/client/view/structure/desktop/layers/shell/taskbar/viewport/viewport-control.tsx
+++ b/source/client/view/structure/desktop/layers/shell/taskbar/viewport/viewport-control.tsx
@@ -10,7 +10,7 @@ import { motion } from "motion/react"
import { cssEasing } from "@client/view/appearance/motion"
import { surfaceLifecyclePose, surfacePresenceTransition } from "@client/view/appearance/surface-presence"
import { shellSurfaceClassName } from "../../shell-surface"
-import { wellMaterial } from "../../start-menu/start-menu-panel"
+import { floatingShadow } from "@client/view/appearance/floating-shadow"
import { type ViewportControl as Viewport } from "../../../../viewport-offset"
/** A standard Window as the map shows it: where it is on the plane. */
@@ -163,7 +163,7 @@ export default function ViewportControl({ viewport, windows, taskbar, spacing, o
{/* Showing its icon alone, it names itself on hover and focus. */}
<TaskbarTooltip label={centered ? "Map" : `Map, near ${place}`} iconOnly={centered || vertical}>
- <Button ref={trigger} size="small" iconOnly={centered || vertical} color={centered ? undefined : "primary:soft"}
+ <Button ref={trigger} size="small" iconOnly={centered && !vertical} className={vertical ? "px-0" : undefined} color={centered ? undefined : "primary:soft"}
aria-label={centered ? "Map" : `Map, near ${place}`} aria-controls={id} aria-expanded={open} aria-haspopup="dialog"
onPressStart={() => { openAtPressStart.current = surface.current?.matches(":popover-open") ?? false }}
onPress={toggle}>
@@ -195,7 +195,7 @@ export default function ViewportControl({ viewport, windows, taskbar, spacing, o
>
{/* Always drawn, like the Start Menu, so it leaves as it came. */}
- <Panel><ViewMap labelId={`${id}-label`} viewport={viewport} windows={windows} centered={centered} menus={surface.current} room={room} /></Panel>
+ <Panel shadow={floatingShadow}><ViewMap labelId={`${id}-label`} viewport={viewport} windows={windows} centered={centered} menus={surface.current} room={room} /></Panel>
</motion.div>
@@ -359,7 +359,7 @@ function ViewMap({ labelId, viewport, windows, centered, menus, room }: Readonly
<div className="relative">
{/* The plane, a well recessed into the Panel like the Start Menu's; views and Windows sit on it, and the frame above them. */}
- <Surface depth="recessed" color="background" material={wellMaterial} className="relative overflow-hidden" style={{ width: columns * cell.width, height: rows * cell.height }}>
+ <Surface depth="recessed" color="background" material="extended" className="relative overflow-hidden" style={{ width: columns * cell.width, height: rows * cell.height }}>
{/* One clear cell per view, so the well shows as it does in the Start Menu. */}
<div className="absolute inset-0 grid" style={{ gridTemplateColumns: `repeat(${columns}, ${cell.width}px)`, gridTemplateRows: `repeat(${rows}, ${cell.height}px)` }}>