chore: minor Discord import related UI fixes

- correct plural in qsTr()
- readonly properties
- remove obsolete/dead/unused code
This commit is contained in:
Lukáš Tinkl 2022-10-20 08:56:11 +02:00 committed by r4bbit.eth
parent c53264b124
commit 8e307d6c35
3 changed files with 7 additions and 13 deletions

View File

@ -29,7 +29,6 @@ StatusSectionLayout {
property CommunitiesStore communitiesStore: CommunitiesStore {} property CommunitiesStore communitiesStore: CommunitiesStore {}
property var importCommunitiesPopup: importCommunitiesPopupComponent property var importCommunitiesPopup: importCommunitiesPopupComponent
property var createCommunitiesPopup: createCommunitiesPopupComponent property var createCommunitiesPopup: createCommunitiesPopupComponent
property int contentPrefferedWidth: 100
property var discordImportProgressPopup: discordImportProgressDialog property var discordImportProgressPopup: discordImportProgressDialog
notificationCount: root.communitiesStore.unreadNotificationsCount notificationCount: root.communitiesStore.unreadNotificationsCount
@ -234,13 +233,13 @@ StatusSectionLayout {
} }
} }
CommunityBanner { CommunityBanner {
property bool importInProgress: root.communitiesStore.discordImportInProgress && !root.communitiesStore.discordImportCancelled readonly property bool importInProgress: root.communitiesStore.discordImportInProgress && !root.communitiesStore.discordImportCancelled
text: importInProgress ? text: importInProgress ?
qsTr("'%1' import in progress...").arg(root.communitiesStore.discordImportCommunityName) : qsTr("'%1' import in progress...").arg(root.communitiesStore.discordImportCommunityName) :
qsTr("Import existing Discord community into Status") qsTr("Import existing Discord community into Status")
buttonText: qsTr("Import existing") buttonText: qsTr("Import existing")
icon.name: "download" icon.name: "download"
buttonTooltipText: qsTr("Your current import must finished or be cancelled before a new import can be started.") buttonTooltipText: qsTr("Your current import must be finished or cancelled before a new import can be started.")
buttonLoading: importInProgress buttonLoading: importInProgress
onButtonClicked: { onButtonClicked: {
chooseCommunityCreationTypePopup.close() chooseCommunityCreationTypePopup.close()

View File

@ -39,7 +39,6 @@ StatusScrollView {
visible: d.status === DiscordImportProgressContents.ImportStatus.CompletedWithWarnings || visible: d.status === DiscordImportProgressContents.ImportStatus.CompletedWithWarnings ||
d.status === DiscordImportProgressContents.ImportStatus.StoppedWithErrors d.status === DiscordImportProgressContents.ImportStatus.StoppedWithErrors
type: StatusButton.Danger type: StatusButton.Danger
font.weight: Font.Medium
text: qsTr("Delete community & restart import") text: qsTr("Delete community & restart import")
onClicked: { onClicked: {
// TODO display a confirmation and open CreateCommunityPopup again // TODO display a confirmation and open CreateCommunityPopup again
@ -49,7 +48,6 @@ StatusScrollView {
StatusButton { StatusButton {
visible: d.status === DiscordImportProgressContents.ImportStatus.InProgress visible: d.status === DiscordImportProgressContents.ImportStatus.InProgress
type: StatusButton.Danger type: StatusButton.Danger
font.weight: Font.Medium
text: qsTr("Cancel import") text: qsTr("Cancel import")
onClicked: { onClicked: {
Global.openPopup(cancelConfirmationPopupCmp) Global.openPopup(cancelConfirmationPopupCmp)
@ -58,7 +56,6 @@ StatusScrollView {
StatusButton { StatusButton {
visible: d.status === DiscordImportProgressContents.ImportStatus.Stopped // TODO find out exactly when to display this button visible: d.status === DiscordImportProgressContents.ImportStatus.Stopped // TODO find out exactly when to display this button
type: StatusButton.Danger type: StatusButton.Danger
font.weight: Font.Medium
text: qsTr("Restart import") text: qsTr("Restart import")
onClicked: { onClicked: {
// TODO open CreateCommunityPopup again // TODO open CreateCommunityPopup again
@ -68,14 +65,12 @@ StatusScrollView {
}, },
StatusButton { StatusButton {
visible: d.status === DiscordImportProgressContents.ImportStatus.InProgress visible: d.status === DiscordImportProgressContents.ImportStatus.InProgress
font.weight: Font.Medium
text: qsTr("Hide window") text: qsTr("Hide window")
onClicked: root.close() onClicked: root.close()
}, },
StatusButton { StatusButton {
visible: d.status === DiscordImportProgressContents.ImportStatus.CompletedSuccessfully || visible: d.status === DiscordImportProgressContents.ImportStatus.CompletedSuccessfully ||
d.status === DiscordImportProgressContents.ImportStatus.CompletedWithWarnings d.status === DiscordImportProgressContents.ImportStatus.CompletedWithWarnings
font.weight: Font.Medium
text: qsTr("Visit your new community") text: qsTr("Visit your new community")
onClicked: { onClicked: {
root.close() root.close()
@ -111,6 +106,7 @@ StatusScrollView {
} }
readonly property int importProgress: root.store.discordImportProgress // FIXME for now it is 0..100 readonly property int importProgress: root.store.discordImportProgress // FIXME for now it is 0..100
readonly property bool importInProgress: root.store.discordImportInProgress || (importProgress > 0 && importProgress < 100)
readonly property bool importStopped: root.store.discordImportProgressStopped readonly property bool importStopped: root.store.discordImportProgressStopped
readonly property bool hasErrors: root.store.discordImportErrorsCount readonly property bool hasErrors: root.store.discordImportErrorsCount
readonly property bool hasWarnings: root.store.discordImportWarningsCount readonly property bool hasWarnings: root.store.discordImportWarningsCount
@ -126,7 +122,7 @@ StatusScrollView {
return DiscordImportProgressContents.ImportStatus.CompletedWithWarnings return DiscordImportProgressContents.ImportStatus.CompletedWithWarnings
return DiscordImportProgressContents.ImportStatus.CompletedSuccessfully return DiscordImportProgressContents.ImportStatus.CompletedSuccessfully
} }
if (importProgress > 0 && importProgress < 100) if (importInProgress)
return DiscordImportProgressContents.ImportStatus.InProgress return DiscordImportProgressContents.ImportStatus.InProgress
return DiscordImportProgressContents.ImportStatus.Unknown return DiscordImportProgressContents.ImportStatus.Unknown
} }
@ -141,7 +137,7 @@ StatusScrollView {
if (progress <= 0.0) if (progress <= 0.0)
return qsTr("Pending...") return qsTr("Pending...")
return state == "import.taskState.saving" ? return state === "import.taskState.saving" ?
qsTr("Saving... This can take a moment, almost done!") : qsTr("Saving... This can take a moment, almost done!") :
qsTr("Working...") qsTr("Working...")
} }
@ -242,7 +238,7 @@ StatusScrollView {
bgCornerRadius: 8 bgCornerRadius: 8
visible: text visible: text
type: IssuePill.Type.Warning type: IssuePill.Type.Warning
text: qsTr("%1 more issue(s) downloading assets").arg(errorsAndWarningsCount - 3) text: qsTr("%n more issue(s) downloading assets", "", subtaskDelegate.errorsAndWarningsCount - 3)
} }
} }
} }

View File

@ -551,7 +551,7 @@ Item {
ModuleWarning { ModuleWarning {
Layout.fillWidth: true Layout.fillWidth: true
readonly property int progress: communitiesPortalLayoutContainer.communitiesStore.discordImportProgress readonly property int progress: communitiesPortalLayoutContainer.communitiesStore.discordImportProgress
readonly property bool inProgress: progress > 0 && progress < 100 readonly property bool inProgress: (progress > 0 && progress < 100) || communitiesPortalLayoutContainer.communitiesStore.discordImportInProgress
readonly property bool finished: progress >= 100 readonly property bool finished: progress >= 100
readonly property bool cancelled: communitiesPortalLayoutContainer.communitiesStore.discordImportCancelled readonly property bool cancelled: communitiesPortalLayoutContainer.communitiesStore.discordImportCancelled
readonly property bool stopped: communitiesPortalLayoutContainer.communitiesStore.discordImportProgressStopped readonly property bool stopped: communitiesPortalLayoutContainer.communitiesStore.discordImportProgressStopped
@ -794,7 +794,6 @@ Item {
CommunitiesPortalLayout { CommunitiesPortalLayout {
id: communitiesPortalLayoutContainer id: communitiesPortalLayoutContainer
contentPrefferedWidth: appView.width
} }
Loader { Loader {