Skip to content

Commit ff846ff

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 ff846ff

File tree

2 files changed

+86
-40
lines changed

2 files changed

+86
-40
lines changed

ui/app/AppLayouts/Communities/CommunitiesPortalLayout.qml

Lines changed: 70 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,41 @@ 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+
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+
}
114128

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+
}
124133

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

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
136139

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
148141
}
142+
}
149143

150-
StatusNewBadge {
151-
visible: root.createCommunityBadgeVisible
152-
}
144+
LayoutItemProxy {
145+
visible: d.compactMode
146+
147+
Layout.fillWidth: true
148+
149+
target: buttonsRow
153150
}
154151
}
155152

@@ -191,6 +188,42 @@ StatusSectionLayout {
191188
}
192189
}
193190

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+
194227
Component {
195228
id: chooseCommunityCreationTypePopupComponent
196229
StatusDialog {

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

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,27 @@ StatusScrollView {
3030
signal cardClicked(string communityId)
3131

3232
clip: false
33+
contentWidth: availableWidth
34+
contentItem.scale: d.scale
35+
contentItem.width: availableWidth / contentItem.scale
36+
contentItem.height: availableHeight / contentItem.scale
37+
contentItem.transformOrigin: Item.TopLeft
3338

3439
QtObject {
3540
id: d
3641

37-
// values from the design
42+
// Values from the design
3843
readonly property int scrollViewTopMargin: 20
3944
readonly property int subtitlePixelSize: 17
4045
readonly property int promotionalCardPosition: Math.max(gridLayout.delegateCountPerRow - 1, 1)
41-
42-
readonly property int delegateWidth: 335
46+
property int delegateWidth: 335
47+
48+
readonly property real minWidth: d.delegateWidth + root.rightPadding + root.leftPadding + 2 * Theme.padding
49+
readonly property real scale: Math.min(1, root.availableWidth / minWidth)
50+
51+
Behavior on delegateWidth {
52+
PropertyAnimation { duration: Theme.AnimationDuration.Fast }
53+
}
4354

4455
// URLs:
4556
readonly property string learnAboutCommunitiesVoteLink: Constants.statusHelpLinkPrefix + "communities/vote-to-feature-a-status-community#step-2-initiate-a-round-of-vote"
@@ -214,6 +225,8 @@ StatusScrollView {
214225
}
215226

216227
PromotionalCommunityCard {
228+
width: d.delegateWidth
229+
217230
onLearnMore: Global.openLinkWithConfirmation(d.learnAboutCommunitiesVoteLink,
218231
StringUtils.extractDomainFromLink(d.learnAboutCommunitiesVoteLink))
219232
onInitiateVote: Global.openLinkWithConfirmation(d.voteCommunityLink,

0 commit comments

Comments
 (0)