Round dashboards: one face at a time, a face per widget type, paged by swipe, dots and keys; slider reading; face row in the editor
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
CommandList,
|
||||
} from "@/components/ui/command"
|
||||
import { dashboardsQueryOptions } from "./queries"
|
||||
import { ROUND_TYPES } from "./RoundFace"
|
||||
import {
|
||||
INPUT_WIDGETS,
|
||||
WIDGET_DESCRIPTIONS,
|
||||
@@ -19,20 +20,6 @@ import {
|
||||
|
||||
const KINDS = Object.keys(WIDGET_LABELS) as WidgetKind[]
|
||||
|
||||
/**
|
||||
* What a round face draws badly: a row of controls or text, a plot or a strip
|
||||
* that wants the width a circle only has across its middle, and a page in a
|
||||
* tile. Offered all the same — a soft mark, not a refusal.
|
||||
*/
|
||||
const POOR_ON_ROUND = new Set<WidgetKind>([
|
||||
"input",
|
||||
"buttons",
|
||||
"chart",
|
||||
"forecast",
|
||||
"agenda",
|
||||
"embed",
|
||||
])
|
||||
|
||||
const GROUPS = [
|
||||
["Show a value", KINDS.filter((kind) => !INPUT_WIDGETS.has(kind))],
|
||||
["Control something", KINDS.filter((kind) => INPUT_WIDGETS.has(kind))],
|
||||
@@ -56,7 +43,7 @@ export function DashboardPalette({
|
||||
onSettings: () => void
|
||||
/** Absent while there is nothing to publish. */
|
||||
onPublish?: () => void
|
||||
/** The dashboard is round: the types that draw badly on it say so. */
|
||||
/** The dashboard is round: the types with no face of their own say so. */
|
||||
round?: boolean
|
||||
}) {
|
||||
const navigate = useNavigate()
|
||||
@@ -96,7 +83,7 @@ export function DashboardPalette({
|
||||
<span>{WIDGET_LABELS[kind]}</span>
|
||||
<span className="text-xs text-muted-foreground">
|
||||
{WIDGET_DESCRIPTIONS[kind]}
|
||||
{round && POOR_ON_ROUND.has(kind)
|
||||
{round && !ROUND_TYPES.has(kind)
|
||||
? " · Poor fit for round"
|
||||
: ""}
|
||||
</span>
|
||||
|
||||
Reference in New Issue
Block a user