Skip to content

Commit 850a81b

Browse files
committed
fix(CommunitiesPortal): improve responsive layout on small viewports
- Slightly reduce card size on compact screens to prevent cuts. - Reorder header in compact mode to prioritize title & primary actions; move secondary info. - No API changes; larger screens unaffected. Fixes #18838
1 parent cfaf664 commit 850a81b

File tree

2 files changed

+79
-38
lines changed

2 files changed

+79
-38
lines changed

ui/app/AppLayouts/Communities/CommunitiesPortalLayout.qml

Lines changed: 74 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import QtQuick
2+
import QtQuick.Controls
23
import QtQuick.Layouts
4+
import QtQml
35

46
import StatusQ
57
import StatusQ.Core
@@ -51,6 +53,9 @@ StatusSectionLayout {
5153
readonly property int preventShadowClipMargin: Theme.padding
5254

5355
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
5459
}
5560

5661
SortFilterProxyModel {
@@ -107,49 +112,45 @@ StatusSectionLayout {
107112
color: Theme.palette.directColor1
108113
}
109114

110-
RowLayout {
111-
Layout.fillWidth: true
112-
Layout.preferredHeight: 38
113-
spacing: Theme.bigPadding
115+
ColumnLayout {
116+
spacing: Theme.padding
117+
118+
RowLayout {
119+
LayoutItemProxy {
120+
Layout.fillWidth: true
121+
122+
target: SearchBox {
123+
id: searcher
124+
Layout.fillWidth: true
125+
Layout.maximumWidth: 327
126+
Layout.preferredHeight: 38
127+
Layout.alignment: Qt.AlignVCenter
128+
topPadding: 0
129+
bottomPadding: 0
130+
}
131+
}
114132

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-
}
133+
// filler
134+
Item {
135+
Layout.fillWidth: true
136+
}
124137

125-
// Just a row filler to fit design
126-
Item { Layout.fillWidth: true }
138+
LayoutItemProxy {
139+
visible: !d.compactMode
127140

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-
}
141+
Layout.fillWidth: true
142+
Layout.alignment: Qt.AlignHCenter
136143

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*/)
144+
target: buttonsRow
148145
}
146+
}
149147

150-
StatusNewBadge {
151-
visible: root.createCommunityBadgeVisible
152-
}
148+
LayoutItemProxy {
149+
visible: d.compactMode
150+
151+
Layout.fillWidth: true
152+
153+
target: buttonsRow
153154
}
154155
}
155156

@@ -191,6 +192,42 @@ StatusSectionLayout {
191192
}
192193
}
193194

195+
RowLayout {
196+
id: buttonsRow
197+
Layout.fillWidth: true
198+
Layout.preferredHeight: 38
199+
spacing: Theme.bigPadding
200+
201+
StatusButton {
202+
Layout.fillWidth: true
203+
Layout.preferredHeight: 38
204+
Layout.maximumWidth: implicitWidth
205+
text: qsTr("Join Community")
206+
verticalPadding: 0
207+
onClicked: Global.importCommunityPopupRequested()
208+
}
209+
210+
StatusButton {
211+
objectName: "createCommunityButton"
212+
Layout.fillWidth: true
213+
Layout.preferredHeight: 38
214+
Layout.maximumWidth: implicitWidth
215+
visible: root.createCommunityEnabled
216+
verticalPadding: 0
217+
text: qsTr("Create New Community")
218+
type: StatusBaseButton.Type.Primary
219+
onClicked: {
220+
// Global.openPopup(chooseCommunityCreationTypePopupComponent) // hidden as part of https://github.com/status-im/status-desktop/issues/17726
221+
root.communitiesStore.setCreateCommunityPopupSeen()
222+
Global.createCommunityPopupRequested(false /*isDiscordImport*/)
223+
}
224+
225+
StatusNewBadge {
226+
visible: root.createCommunityBadgeVisible
227+
}
228+
}
229+
}
230+
194231
Component {
195232
id: chooseCommunityCreationTypePopupComponent
196233
StatusDialog {

ui/app/AppLayouts/Communities/views/CommunitiesGridView.qml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ StatusScrollView {
3939
readonly property int subtitlePixelSize: 17
4040
readonly property int promotionalCardPosition: Math.max(gridLayout.delegateCountPerRow - 1, 1)
4141

42-
readonly property int delegateWidth: 335
42+
readonly property int baseDelegateWidth: 335
43+
readonly property int delegateWidth: d.baseDelegateWidth > root.contentWidth - 2 * Theme.padding ?
44+
root.contentWidth - 2 * Theme.padding : d.delegateWidth
4345

4446
// URLs:
4547
readonly property string learnAboutCommunitiesVoteLink: Constants.statusHelpLinkPrefix + "communities/vote-to-feature-a-status-community#step-2-initiate-a-round-of-vote"
@@ -214,6 +216,8 @@ StatusScrollView {
214216
}
215217

216218
PromotionalCommunityCard {
219+
width: d.delegateWidth
220+
217221
onLearnMore: Global.openLinkWithConfirmation(d.learnAboutCommunitiesVoteLink,
218222
StringUtils.extractDomainFromLink(d.learnAboutCommunitiesVoteLink))
219223
onInitiateVote: Global.openLinkWithConfirmation(d.voteCommunityLink,

0 commit comments

Comments
 (0)