|
| 1 | +pragma ComponentBehavior: Bound |
| 2 | + |
1 | 3 | import qs.components |
| 4 | +import qs.components.containers |
| 5 | +import qs.components.controls |
2 | 6 | import qs.services |
3 | 7 | import qs.config |
4 | 8 | import QtQuick |
@@ -29,6 +33,111 @@ Item { |
29 | 33 | } |
30 | 34 | } |
31 | 35 |
|
| 36 | + // Upcoming events |
| 37 | + StyledRect { |
| 38 | + Layout.fillWidth: true |
| 39 | + Layout.preferredHeight: Math.min(upcomingCol.implicitHeight, 300) |
| 40 | + |
| 41 | + visible: Config.sidebar.showUpcoming && GCalendar.enabled && GCalendar.upcomingSidebar.length > 0 |
| 42 | + radius: Appearance.rounding.normal |
| 43 | + color: Colours.tPalette.m3surfaceContainerLow |
| 44 | + |
| 45 | + ColumnLayout { |
| 46 | + id: upcomingHeader |
| 47 | + |
| 48 | + anchors.top: parent.top |
| 49 | + anchors.left: parent.left |
| 50 | + anchors.right: parent.right |
| 51 | + anchors.margins: Appearance.padding.normal |
| 52 | + |
| 53 | + StyledText { |
| 54 | + Layout.topMargin: Appearance.padding.small |
| 55 | + text: qsTr("Upcoming Events") |
| 56 | + color: Colours.palette.m3primary |
| 57 | + font.pointSize: Appearance.font.size.small |
| 58 | + font.weight: 600 |
| 59 | + } |
| 60 | + } |
| 61 | + |
| 62 | + StyledFlickable { |
| 63 | + id: upcomingView |
| 64 | + |
| 65 | + clip: true |
| 66 | + anchors.top: upcomingHeader.bottom |
| 67 | + anchors.left: parent.left |
| 68 | + anchors.right: parent.right |
| 69 | + anchors.bottom: parent.bottom |
| 70 | + anchors.margins: Appearance.padding.normal |
| 71 | + anchors.topMargin: Appearance.spacing.small |
| 72 | + |
| 73 | + flickableDirection: Flickable.VerticalFlick |
| 74 | + contentWidth: width |
| 75 | + contentHeight: upcomingCol.implicitHeight |
| 76 | + |
| 77 | + StyledScrollBar.vertical: StyledScrollBar { |
| 78 | + flickable: upcomingView |
| 79 | + } |
| 80 | + |
| 81 | + ColumnLayout { |
| 82 | + id: upcomingCol |
| 83 | + |
| 84 | + width: parent.width |
| 85 | + spacing: Appearance.spacing.small |
| 86 | + |
| 87 | + Repeater { |
| 88 | + model: GCalendar.upcomingSidebar |
| 89 | + |
| 90 | + RowLayout { |
| 91 | + id: sidebarEventRow |
| 92 | + |
| 93 | + required property var modelData |
| 94 | + |
| 95 | + Layout.fillWidth: true |
| 96 | + spacing: Appearance.spacing.small |
| 97 | + |
| 98 | + Rectangle { |
| 99 | + width: 3 |
| 100 | + Layout.fillHeight: true |
| 101 | + radius: 1.5 |
| 102 | + color: Colours.palette.m3tertiary |
| 103 | + } |
| 104 | + |
| 105 | + ColumnLayout { |
| 106 | + Layout.fillWidth: true |
| 107 | + spacing: 0 |
| 108 | + |
| 109 | + StyledText { |
| 110 | + Layout.fillWidth: true |
| 111 | + text: sidebarEventRow.modelData.summary |
| 112 | + color: Colours.palette.m3onSurface |
| 113 | + font.pointSize: Appearance.font.size.small |
| 114 | + font.weight: 500 |
| 115 | + elide: Text.ElideRight |
| 116 | + } |
| 117 | + |
| 118 | + StyledText { |
| 119 | + Layout.fillWidth: true |
| 120 | + text: { |
| 121 | + let line = GCalendar.formatEventTime(sidebarEventRow.modelData, Config.services.calendar.sidebarUpcomingHours); |
| 122 | + if (sidebarEventRow.modelData.location) |
| 123 | + line += ` · ${sidebarEventRow.modelData.location}`; |
| 124 | + return line; |
| 125 | + } |
| 126 | + color: Colours.palette.m3onSurfaceVariant |
| 127 | + font.pointSize: Appearance.font.size.small * 0.9 |
| 128 | + elide: Text.ElideRight |
| 129 | + } |
| 130 | + } |
| 131 | + } |
| 132 | + } |
| 133 | + |
| 134 | + Item { |
| 135 | + Layout.preferredHeight: Appearance.padding.small |
| 136 | + } |
| 137 | + } |
| 138 | + } |
| 139 | + } |
| 140 | + |
32 | 141 | StyledRect { |
33 | 142 | Layout.topMargin: Appearance.padding.large - layout.spacing |
34 | 143 | Layout.fillWidth: true |
|
0 commit comments