-
Notifications
You must be signed in to change notification settings - Fork 97
Expand file tree
/
Copy pathPrimaryNavSidebarPage.qml
More file actions
314 lines (266 loc) ยท 11 KB
/
Copy pathPrimaryNavSidebarPage.qml
File metadata and controls
314 lines (266 loc) ยท 11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtWebView
import StatusQ
import StatusQ.Core
import StatusQ.Core.Theme
import StatusQ.Controls
import StatusQ.Components
import StatusQ.Popups
import Models
import Storybook
import shared.controls.chat.menuItems
import utils
import AppLayouts.Profile.stores as ProfileStores
import mainui
SplitView {
id: root
orientation: Qt.Vertical
Logs { id: logs }
QtObject {
id: d
readonly property var sectionsModel: SectionsModel {}
property bool acVisible
property int activeSectionType: Constants.appSection.wallet
property string activeSectionId: "id2"
}
Item {
SplitView.fillWidth: true
SplitView.fillHeight: true
Label {
anchors.centerIn: parent
visible: secondaryWindow.visible
text: "Interact with the sidebar in the secondary window"
}
Button {
anchors.centerIn: parent
text: "Reopen"
visible: !secondaryWindow.visible
onClicked: secondaryWindow.visible = true
}
}
Window {
id: secondaryWindow
visible: true
width: 800
height: 640
title: "PrimaryNavSidebar"
color: Theme.palette.baseColor4 // doesn't get the proper StatusQ palette w/o Theme.xxx
ColumnLayout {
anchors.fill: parent
anchors.margins: 2
anchors.leftMargin: sidebar.alwaysVisible ? sidebar.width : 2
Behavior on anchors.leftMargin {PropertyAnimation {duration: ThemeUtils.AnimationDuration.Fast}}
WebView {
Layout.fillWidth: true
Layout.fillHeight: true
url: "https://status.app"
}
StatusButton {
icon.name: "more"
enabled: !sidebar.alwaysVisible
onClicked: sidebar.open()
tooltip.text: "Open sidebar"
tooltip.orientation: StatusToolTip.Orientation.Bottom
}
StatusBaseText {
Layout.fillWidth: true
wrapMode: Text.Wrap
text: "Active section type/id: %1/\"%2\"".arg(d.activeSectionType).arg(d.activeSectionId)
}
StatusBaseText {
Layout.fillWidth: true
wrapMode: Text.Wrap
text: "Window size: %1x%2".arg(secondaryWindow.width).arg(secondaryWindow.height)
}
StatusBaseText {
Layout.fillWidth: true
wrapMode: Text.Wrap
text: sidebar.alwaysVisible ? "alwaysVisible: <b>true</b> (%1)".arg("pushes the content; background not dimmed")
: "alwaysVisible: <b>false</b> (%1)".arg("open the sidebar by dragging on the left edge, or click the above button; background dimmed")
}
StatusBaseText {
Layout.fillWidth: true
wrapMode: Text.Wrap
text: "Sidebar position: %1".arg(sidebar.position)
}
}
PrimaryNavSidebar {
id: sidebar
height: parent.height
sectionsModel: d.sectionsModel
acVisible: d.acVisible
acHasUnseenNotifications: ctrlAcHasUnseenNotifications.checked // <- ActivityCenterStore.hasUnseenNotifications
acUnreadNotificationsCount: ctrlAcUnreadNotificationsCount.value // <- ActivityCenterStore.unreadNotificationsCount
profileStore: ProfileStores.ProfileStore {
id: profileStore
readonly property string pubKey: "0xdeadbeef"
readonly property string compressedPubKey: "zxDeadBeef"
readonly property string name: "John Doe"
readonly property string icon: ModelsData.icons.rarible
readonly property int colorId: 7
readonly property bool usesDefaultName: false
property int currentUserStatus: Constants.currentUserStatus.automatic
}
getEmojiHashFn: function(pubKey) { // <- root.utilsStore.getEmojiHash(pubKey)
if (pubKey === "")
return ""
return["๐จ๐ปโ๐ผ", "๐๐ฟโโ๏ธ", "๐", "๐คถ๐ฟ", "๐ฎ","๐คท๐ปโโ๏ธ", "๐คฆ๐ป", "๐ฃ", "๐ค", "๐ท๐ฝ", "๐บ", "๐ฅ", "๐", "๐ง๐ฝโโ๏ธ"]
}
getLinkToProfileFn: function(pubKey) { // <- root.rootStore.contactsStore.getLinkToProfile(pubKey)
return Constants.userLinkPrefix + pubKey
}
communityPopupMenu: Component {
StatusMenu {
id: communityContextMenu
required property var model
required property int index
readonly property bool isSpectator: model.spectated && !model.joined
onClosed: destroy()
StatusAction {
text: qsTr("Invite People")
icon.name: "share-ios"
objectName: "invitePeople"
}
StatusAction {
text: qsTr("Community Info")
icon.name: "info"
}
StatusAction {
text: qsTr("Community Rules")
icon.name: "text"
}
StatusMenuSeparator {}
MuteChatMenuItem {
enabled: !model.muted
title: qsTr("Mute Community")
}
StatusAction {
enabled: model.muted
text: qsTr("Unmute Community")
icon.name: "notification"
}
StatusAction {
text: qsTr("Mark as read")
icon.name: "check-circle"
}
StatusAction {
text: qsTr("Edit Shared Addresses")
icon.name: "wallet"
enabled: {
if (model.memberRole === Constants.memberRole.owner || communityContextMenu.isSpectator)
return false
return true
}
}
StatusMenuSeparator { visible: leaveCommunityMenuItem.enabled }
StatusAction {
id: leaveCommunityMenuItem
objectName: "leaveCommunityMenuItem"
// allow to leave community for the owner in non-production builds
enabled: model.memberRole !== Constants.memberRole.owner || !production
text: {
if (communityContextMenu.isSpectator)
return qsTr("Close Community")
return qsTr("Leave Community")
}
icon.name: communityContextMenu.isSpectator ? "close-circle" : "arrow-left"
type: StatusAction.Type.Danger
}
}
}
showEnabledSectionsOnly: ctrlShowEnabledSectionsOnly.checked
marketEnabled: ctrlMarketEnabled.checked
browserEnabled: ctrlBrowserEnabled.checked
nodeEnabled: ctrlNodeEnabled.checked
thirdpartyServicesEnabled: ctrlThirdPartyServices.checked
showCreateCommunityBadge: ctrlShowCreateCommunityBadge.checked
profileSectionHasNotification: ctrlSettingsHasNotification.checked
onItemActivated: function (sectionType, id) {
logs.logEvent("onItemActivated", ["sectionType", "sectionId"], arguments)
sectionsModel.setActiveSection(id)
d.activeSectionType = sectionType
d.activeSectionId = id
}
onActivityCenterRequested: function (shouldShow) {
logs.logEvent("onActivityCenterRequested", ["shouldShow"], arguments)
d.acVisible = shouldShow
}
onSetCurrentUserStatusRequested: function (status) {
profileStore.currentUserStatus = status
logs.logEvent("onSetCurrentUserStatusRequested", ["status"], arguments) // <- root.rootStore.setCurrentUserStatus(status)
}
onViewProfileRequested: logs.logEvent("onViewProfileRequested", ["pubKey"], arguments) // <- Global.openProfilePopup(pubKey)
}
}
LogsAndControlsPanel {
SplitView.minimumHeight: 330
SplitView.preferredHeight: 330
SplitView.fillWidth: true
logsView.logText: logs.logText
RowLayout {
anchors.fill: parent
ColumnLayout {
Label { text: "Sections config:" }
Switch {
id: ctrlShowEnabledSectionsOnly
text: "Show enabled sections only"
checked: true
}
Switch {
id: ctrlMarketEnabled
text: "Market enabled"
checked: true
}
Switch {
id: ctrlBrowserEnabled
text: "Browser enabled"
checked: true
}
Switch {
id: ctrlNodeEnabled
text: "Node mgmt enabled"
checked: false
}
Switch {
id: ctrlThirdPartyServices
text: "Third party services enabled"
checked: true
}
Switch {
id: ctrlSettingsHasNotification
text: "Settings has notification"
}
Switch {
id: ctrlShowCreateCommunityBadge
text: "Show create community badge"
}
}
ColumnLayout {
Layout.fillWidth: true
Label { text: "Activity Center:" }
Switch {
id: ctrlAcHasUnseenNotifications
text: "Has unseen notifications"
checked: true
}
RowLayout {
Label { text: "Notifications count:" }
SpinBox {
id: ctrlAcUnreadNotificationsCount
from: 0
to: 101
value: 4
editable: true
}
}
Item { Layout.fillHeight: true }
}
}
}
}
// category: Panels
// status: good
// https://www.figma.com/design/pJgiysu3rw8XvL4wS2Us7W/DS?node-id=4185-86833&t=lNokXnXl5AHjxHan-0
// https://www.figma.com/design/pJgiysu3rw8XvL4wS2Us7W/DS?node-id=4185-86833&t=hN6bacud6gPREDcH-0