// "Create folder" modal — a name field + Create. Opened from the // sidebar's "New folder" action (CreateFolderState.open). import { Theme } from "../foundation/semantic-colors.slint"; import { Typography } from "../foundation/typography.slint"; import { Radius } from "../foundation/radius.slint"; import { CreateFolderState, CreateFolderActions } from "../state.slint"; import { QbzIcon } from "QbzIcon.slint"; import { LineEdit } from "std-widgets.slint"; export component CreateFolderModal inherits Rectangle { visible: CreateFolderState.open; if CreateFolderState.open: Rectangle { background: #000000bf; TouchArea { mouse-cursor: default; clicked => { CreateFolderActions.close(); } } Rectangle { width: Math.min(root.width - 80px, 400px); height: panel.preferred-height; x: (parent.width - self.width) / 2; y: (parent.height - self.height) / 2; 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: 20px; spacing: 16px; HorizontalLayout { Text { text: @tr("New folder"); color: Theme.text-primary; font-size: Typography.heading; font-weight: Typography.semibold; horizontal-stretch: 1; vertical-alignment: center; } close-x := TouchArea { width: 28px; height: 28px; mouse-cursor: pointer; clicked => { CreateFolderActions.close(); } QbzIcon { source: @image-url("../assets/icons/x.svg"); width: 17px; height: 17px; x: (parent.width - self.width) / 2; y: (parent.height - self.height) / 2; tint: close-x.has-hover ? Theme.text-primary : Theme.text-muted; } } } name-input := LineEdit { placeholder-text: @tr("Folder name"); text <=> CreateFolderState.name; accepted => { CreateFolderActions.submit(); } } HorizontalLayout { alignment: end; Rectangle { width: create-label.preferred-width + 36px; height: 36px; border-radius: Radius.sm; opacity: (CreateFolderState.name != "" && !CreateFolderState.creating) ? 1.0 : 0.5; background: create-ta.has-hover ? #ffffffd6 : Theme.accent; create-label := Text { text: CreateFolderState.creating ? @tr("Creating...") : @tr("Create"); color: #ffffff; font-size: Typography.body; font-weight: Typography.semibold; x: (parent.width - self.width) / 2; y: (parent.height - self.height) / 2; } create-ta := TouchArea { mouse-cursor: (CreateFolderState.name != "" && !CreateFolderState.creating) ? pointer : default; clicked => { if (CreateFolderState.name != "" && !CreateFolderState.creating) { CreateFolderActions.submit(); } } } } } } } } }