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 var importCommunitiesPopup: importCommunitiesPopupComponent
property var createCommunitiesPopup: createCommunitiesPopupComponent
property int contentPrefferedWidth: 100
property var discordImportProgressPopup: discordImportProgressDialog
notificationCount: root.communitiesStore.unreadNotificationsCount
@ -234,13 +233,13 @@ StatusSectionLayout {
}
}
CommunityBanner {
property bool importInProgress: root.communitiesStore.discordImportInProgress && !root.communitiesStore.discordImportCancelled
readonly property bool importInProgress: root.communitiesStore.discordImportInProgress && !root.communitiesStore.discordImportCancelled
text: importInProgress ?
qsTr("'%1' import in progress...").arg(root.communitiesStore.discordImportCommunityName) :
qsTr("Import existing Discord community into Status")
buttonText: qsTr("Import existing")
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
onButtonClicked: {
chooseCommunityCreationTypePopup.close()

View File

@ -39,7 +39,6 @@ StatusScrollView {
visible: d.status === DiscordImportProgressContents.ImportStatus.CompletedWithWarnings ||
d.status === DiscordImportProgressContents.ImportStatus.StoppedWithErrors
type: StatusButton.Danger
font.weight: Font.Medium
text: qsTr("Delete community & restart import")
onClicked: {
// TODO display a confirmation and open CreateCommunityPopup again
@ -49,7 +48,6 @@ StatusScrollView {
StatusButton {
visible: d.status === DiscordImportProgressContents.ImportStatus.InProgress
type: StatusButton.Danger
font.weight: Font.Medium
text: qsTr("Cancel import")
onClicked: {
Global.openPopup(cancelConfirmationPopupCmp)
@ -58,7 +56,6 @@ StatusScrollView {
StatusButton {
visible: d.status === DiscordImportProgressContents.ImportStatus.Stopped // TODO find out exactly when to display this button
type: StatusButton.Danger
font.weight: Font.Medium
text: qsTr("Restart import")
onClicked: {
// TODO open CreateCommunityPopup again
@ -68,14 +65,12 @@ StatusScrollView {
},
StatusButton {
visible: d.status === DiscordImportProgressContents.ImportStatus.InProgress
font.weight: Font.Medium
text: qsTr("Hide window")
onClicked: root.close()
},
StatusButton {
visible: d.status === DiscordImportProgressContents.ImportStatus.CompletedSuccessfully ||
d.status === DiscordImportProgressContents.ImportStatus.CompletedWithWarnings
font.weight: Font.Medium
text: qsTr("Visit your new community")
onClicked: {
root.close()
@ -111,6 +106,7 @@ StatusScrollView {
}
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 hasErrors: root.store.discordImportErrorsCount
readonly property bool hasWarnings: root.store.discordImportWarningsCount
@ -126,7 +122,7 @@ StatusScrollView {
return DiscordImportProgressContents.ImportStatus.CompletedWithWarnings
return DiscordImportProgressContents.ImportStatus.CompletedSuccessfully
}
if (importProgress > 0 && importProgress < 100)
if (importInProgress)
return DiscordImportProgressContents.ImportStatus.InProgress
return DiscordImportProgressContents.ImportStatus.Unknown
}
@ -141,7 +137,7 @@ StatusScrollView {
if (progress <= 0.0)
return qsTr("Pending...")
return state == "import.taskState.saving" ?
return state === "import.taskState.saving" ?
qsTr("Saving... This can take a moment, almost done!") :
qsTr("Working...")
}
@ -242,7 +238,7 @@ StatusScrollView {
bgCornerRadius: 8
visible: text
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 {
Layout.fillWidth: true
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 cancelled: communitiesPortalLayoutContainer.communitiesStore.discordImportCancelled
readonly property bool stopped: communitiesPortalLayoutContainer.communitiesStore.discordImportProgressStopped
@ -794,7 +794,6 @@ Item {
CommunitiesPortalLayout {
id: communitiesPortalLayoutContainer
contentPrefferedWidth: appView.width
}
Loader {