import { AppModels } 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.sidebar-view.all-active; clicked => { AppActions.source-clicked(-1) } } for source[index] in AppModels.sidebar-view.sources: ToggleButton { text: source.name; text-alignment: left; active: source.active; clicked => { AppActions.source-clicked(source.id) } right-clicked => { editSourcePopup.edit(source.id) } } } VerticalLayout { spacing: 4px; /*VButton { icon-svg: Svg.cog; text: "Settings"; background: transparent; clicked => { AppModels.open-settings-window() } }*/ } } } }