|
1 | 1 | import QtQuick |
| 2 | +import QtQuick.Controls |
2 | 3 | import QtQuick.Layouts |
| 4 | +import QtQml |
3 | 5 |
|
4 | 6 | import StatusQ |
5 | 7 | import StatusQ.Core |
@@ -51,6 +53,9 @@ StatusSectionLayout { |
51 | 53 | readonly property int preventShadowClipMargin: Theme.padding |
52 | 54 |
|
53 | 55 | readonly property bool searchMode: searcher.text.length > 0 |
| 56 | + |
| 57 | + // Read-only flag that turns true when the component enters a “compact” layout automatically on resize. |
| 58 | + readonly property bool compactMode: root.width < 600 |
54 | 59 | } |
55 | 60 |
|
56 | 61 | SortFilterProxyModel { |
@@ -107,49 +112,41 @@ StatusSectionLayout { |
107 | 112 | color: Theme.palette.directColor1 |
108 | 113 | } |
109 | 114 |
|
110 | | - RowLayout { |
111 | | - Layout.fillWidth: true |
112 | | - Layout.preferredHeight: 38 |
113 | | - spacing: Theme.bigPadding |
| 115 | + ColumnLayout { |
| 116 | + spacing: Theme.padding |
| 117 | + |
| 118 | + RowLayout { |
| 119 | + SearchBox { |
| 120 | + id: searcher |
| 121 | + Layout.fillWidth: true |
| 122 | + Layout.maximumWidth: 327 |
| 123 | + Layout.preferredHeight: 38 |
| 124 | + Layout.alignment: Qt.AlignVCenter |
| 125 | + topPadding: 0 |
| 126 | + bottomPadding: 0 |
| 127 | + } |
114 | 128 |
|
115 | | - SearchBox { |
116 | | - id: searcher |
117 | | - Layout.fillWidth: true |
118 | | - Layout.maximumWidth: 327 |
119 | | - Layout.preferredHeight: 38 |
120 | | - Layout.alignment: Qt.AlignVCenter |
121 | | - topPadding: 0 |
122 | | - bottomPadding: 0 |
123 | | - } |
| 129 | + // filler |
| 130 | + Item { |
| 131 | + Layout.fillWidth: true |
| 132 | + } |
124 | 133 |
|
125 | | - // Just a row filler to fit design |
126 | | - Item { Layout.fillWidth: true } |
| 134 | + LayoutItemProxy { |
| 135 | + visible: !d.compactMode |
127 | 136 |
|
128 | | - StatusButton { |
129 | | - Layout.fillWidth: true |
130 | | - Layout.preferredHeight: 38 |
131 | | - Layout.maximumWidth: implicitWidth |
132 | | - text: qsTr("Join Community") |
133 | | - verticalPadding: 0 |
134 | | - onClicked: Global.importCommunityPopupRequested() |
135 | | - } |
| 137 | + Layout.fillWidth: true |
| 138 | + Layout.alignment: Qt.AlignHCenter |
136 | 139 |
|
137 | | - StatusButton { |
138 | | - objectName: "createCommunityButton" |
139 | | - visible: root.createCommunityEnabled |
140 | | - Layout.preferredHeight: 38 |
141 | | - verticalPadding: 0 |
142 | | - text: qsTr("Create New Community") |
143 | | - type: StatusBaseButton.Type.Primary |
144 | | - onClicked: { |
145 | | - // Global.openPopup(chooseCommunityCreationTypePopupComponent) // hidden as part of https://github.com/status-im/status-desktop/issues/17726 |
146 | | - root.communitiesStore.setCreateCommunityPopupSeen() |
147 | | - Global.createCommunityPopupRequested(false /*isDiscordImport*/) |
| 140 | + target: buttonsRow |
148 | 141 | } |
| 142 | + } |
149 | 143 |
|
150 | | - StatusNewBadge { |
151 | | - visible: root.createCommunityBadgeVisible |
152 | | - } |
| 144 | + LayoutItemProxy { |
| 145 | + visible: d.compactMode |
| 146 | + |
| 147 | + Layout.fillWidth: true |
| 148 | + |
| 149 | + target: buttonsRow |
153 | 150 | } |
154 | 151 | } |
155 | 152 |
|
@@ -191,6 +188,42 @@ StatusSectionLayout { |
191 | 188 | } |
192 | 189 | } |
193 | 190 |
|
| 191 | + RowLayout { |
| 192 | + id: buttonsRow |
| 193 | + Layout.fillWidth: true |
| 194 | + Layout.preferredHeight: 38 |
| 195 | + spacing: Theme.bigPadding |
| 196 | + |
| 197 | + StatusButton { |
| 198 | + Layout.fillWidth: true |
| 199 | + Layout.preferredHeight: 38 |
| 200 | + Layout.maximumWidth: implicitWidth |
| 201 | + text: qsTr("Join Community") |
| 202 | + verticalPadding: 0 |
| 203 | + onClicked: Global.importCommunityPopupRequested() |
| 204 | + } |
| 205 | + |
| 206 | + StatusButton { |
| 207 | + objectName: "createCommunityButton" |
| 208 | + Layout.fillWidth: true |
| 209 | + Layout.preferredHeight: 38 |
| 210 | + Layout.maximumWidth: implicitWidth |
| 211 | + visible: root.createCommunityEnabled |
| 212 | + verticalPadding: 0 |
| 213 | + text: qsTr("Create New Community") |
| 214 | + type: StatusBaseButton.Type.Primary |
| 215 | + onClicked: { |
| 216 | + // Global.openPopup(chooseCommunityCreationTypePopupComponent) // hidden as part of https://github.com/status-im/status-desktop/issues/17726 |
| 217 | + root.communitiesStore.setCreateCommunityPopupSeen() |
| 218 | + Global.createCommunityPopupRequested(false /*isDiscordImport*/) |
| 219 | + } |
| 220 | + |
| 221 | + StatusNewBadge { |
| 222 | + visible: root.createCommunityBadgeVisible |
| 223 | + } |
| 224 | + } |
| 225 | + } |
| 226 | + |
194 | 227 | Component { |
195 | 228 | id: chooseCommunityCreationTypePopupComponent |
196 | 229 | StatusDialog { |
|
0 commit comments