import { AppModels, TaskData } from "../../../shared/Models.slint"; import { AppActions } from "../../../shared/Actions.slint"; import { VButton, ToggleButton, VActionButton, VText, Svg, Palette } from "@selenite"; import { EditSourceModal } from "../../../modals/EditSourceModal.slint"; import { AddSourceModal } from "../../../modals/AddSourceModal.slint"; export component SideBar inherits Rectangle { function open-edit-source-window(source-id: int) { editSourcePopup.edit(source-id) } addSourcePopup := AddSourceModal{} editSourcePopup := EditSourceModal {} VerticalLayout { height: parent.height; padding: 16px; spacing: 16px; HorizontalLayout { alignment: stretch; VText { text: "Sources"; font-size: 1.5rem; horizontal-stretch: 0; } Rectangle { horizontal-stretch: 1; } VActionButton { horizontal-stretch: 0; icon-svg: Svg.plus; icon-colorize: Palette.green; background: transparent; clicked => { addSourcePopup.open() } } } VerticalLayout { alignment: space-between; vertical-stretch: 1; VerticalLayout { vertical-stretch: 1; spacing: 4px; ToggleButton { text: "All"; text-alignment: left; active: AppModels.no-source-selected; clicked => { AppActions.source-clicked(-1) } } for item[index] in AppModels.sources-selected: ToggleButton { text: item.name; text-alignment: left; active: item.selected; clicked => { AppActions.source-clicked(item.id) } right-clicked => { editSourcePopup.edit(item.id) } } } VerticalLayout { spacing: 4px; /*VButton { icon-svg: Svg.cog; text: "Settings"; background: transparent; clicked => { AppModels.open-settings-window() } }*/ } } } }