// "Create Mixtape / Collection" modal — 1:1 with Tauri's inline create // modal in `+page.svelte` (spec 30 §3). A Name field, a Kind radio toggle // (Mixtape / Collection — artist_collection is built via the Discography // Builder, not here), and Cancel / Create buttons. The title and the Create // button label switch on `kind` ("Create Mixtape" + "+ New Mixtape" vs // "Create Collection" + "+ New Collection"). // // Opened from either grid's "+ New" CTA / empty-state button // (MyQbzCreateState.open). Backdrop click and Cancel close without creating; // Enter / Create submit. Create is disabled while busy or the name is blank. import { Theme } from "../foundation/semantic-colors.slint"; import { Typography } from "../foundation/typography.slint"; import { Radius } from "../foundation/radius.slint"; import { MyQbzCreateState, MyQbzCreateActions } from "../state.slint"; import { QbzIcon } from "../primitives/QbzIcon.slint"; import { QbzPrimaryButton } from "../primitives/QbzPrimaryButton.slint"; import { SecondaryButton } from "../primitives/SecondaryButton.slint"; import { LineEdit } from "std-widgets.slint"; // A single labelled radio option in the Kind toggle. component KindRadio inherits TouchArea { in property label; in property selected; mouse-cursor: pointer; horizontal-stretch: 0; HorizontalLayout { spacing: 6px; // Radio dot. Rectangle { width: 18px; height: 18px; y: Math.round((parent.height - self.height) / 2 / 1px) * 1px; border-radius: 9px; border-width: root.selected ? 0px : 1.5px; border-color: Theme.text-muted; background: root.selected ? Theme.accent : transparent; Rectangle { width: 7px; height: 7px; x: Math.round((parent.width - self.width) / 2 / 1px) * 1px; y: Math.round((parent.height - self.height) / 2 / 1px) * 1px; border-radius: 3.5px; background: #ffffff; visible: root.selected; } } Text { text: root.label; color: Theme.text-primary; font-size: Typography.body; vertical-alignment: center; } } } export component CreateMyQbzModal inherits Rectangle { visible: MyQbzCreateState.open; property is-mixtape: MyQbzCreateState.kind == "mixtape"; property can-create: MyQbzCreateState.name != "" && !MyQbzCreateState.creating; if MyQbzCreateState.open: Rectangle { background: #000000bf; TouchArea { mouse-cursor: default; clicked => { MyQbzCreateActions.close(); } } Rectangle { width: Math.min(root.width - 80px, 420px); height: panel.preferred-height; x: Math.round((parent.width - self.width) / 2 / 1px) * 1px; y: Math.round((parent.height - self.height) / 2 / 1px) * 1px; border-radius: Radius.md; background: Theme.surface-card; border-width: 1px; border-color: Theme.border-subtle; drop-shadow-blur: 32px; drop-shadow-color: #00000080; TouchArea { } panel := VerticalLayout { padding: 24px; spacing: 16px; HorizontalLayout { Text { text: root.is-mixtape ? @tr("Create Mixtape") : @tr("Create Collection"); color: Theme.text-primary; font-size: Typography.heading; font-weight: Typography.bold; horizontal-stretch: 1; vertical-alignment: center; } close-x := TouchArea { width: 28px; height: 28px; mouse-cursor: pointer; clicked => { MyQbzCreateActions.close(); } QbzIcon { source: @image-url("../assets/icons/x.svg"); width: 17px; height: 17px; x: Math.round((parent.width - self.width) / 2 / 1px) * 1px; y: Math.round((parent.height - self.height) / 2 / 1px) * 1px; tint: close-x.has-hover ? Theme.text-primary : Theme.text-muted; } } } // Name. VerticalLayout { spacing: 8px; Text { // Uppercase eyebrow (Tauri .field-label text-transform). text: @tr("NAME"); color: Theme.text-muted; font-size: Typography.legal; font-weight: Typography.semibold; letter-spacing: 1.5px; } name-input := LineEdit { text <=> MyQbzCreateState.name; accepted => { MyQbzCreateActions.submit(); } } } // Kind toggle (Mixtape / Collection). VerticalLayout { spacing: 8px; Text { text: @tr("KIND"); color: Theme.text-muted; font-size: Typography.legal; font-weight: Typography.semibold; letter-spacing: 1.5px; } HorizontalLayout { spacing: 12px; alignment: start; KindRadio { label: @tr("Mixtapes"); selected: root.is-mixtape; clicked => { if (!MyQbzCreateState.creating) { MyQbzCreateState.kind = "mixtape"; } } } KindRadio { label: @tr("Collections"); selected: !root.is-mixtape; clicked => { if (!MyQbzCreateState.creating) { MyQbzCreateState.kind = "collection"; } } } } } // Cancel + Create — the app's shared labeled primitives // (auto-width, 38px footer chips). HorizontalLayout { alignment: end; spacing: 8px; // Cancel (secondary). SecondaryButton { label: @tr("Cancel"); height: 38px; clicked => { MyQbzCreateActions.close(); } } // Create (primary) — label reuses the empty-state CTA. QbzPrimaryButton { label: root.is-mixtape ? @tr("+ New Mixtape") : @tr("+ New Collection"); height: 38px; enabled: root.can-create; clicked => { MyQbzCreateActions.submit(); } } } } } } }