fix(Community): Updated create new channel popup

Closes #5636
This commit is contained in:
Alexandra Betouni 2022-05-12 20:18:25 +03:00 committed by Iuri Matias
parent 5f5272a58e
commit 54e2217c93
1 changed files with 19 additions and 13 deletions

View File

@ -2,6 +2,7 @@ import QtQuick 2.12
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import QtQuick.Dialogs 1.3 import QtQuick.Dialogs 1.3
import utils 1.0 import utils 1.0
import shared.panels 1.0
import StatusQ.Core 0.1 import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1 import StatusQ.Core.Theme 0.1
@ -48,15 +49,10 @@ StatusModal {
contentItem.channelDescription.input.text = popup.channelDescription contentItem.channelDescription.input.text = popup.channelDescription
if (popup.channelEmoji) { if (popup.channelEmoji) {
contentItem.channelName.input.icon.emoji = popup.channelEmoji contentItem.channelName.input.icon.emoji = popup.channelEmoji
} else {
// Assign a random emoji to channels who down't have one (from old versions)
contentItem.channelName.input.icon.emoji =
StatusQUtils.Emoji.getRandomEmoji(StatusQUtils.Emoji.size.verySmall)
} }
scrollView.channelColorDialog.color = popup.channelColor scrollView.channelColorDialog.color = popup.channelColor
} else { } else {
contentItem.channelName.input.icon.emoji = contentItem.channelName.input.icon.isLetterIdenticon = true;
StatusQUtils.Emoji.getRandomEmoji(StatusQUtils.Emoji.size.verySmall)
} }
} }
@ -67,6 +63,7 @@ StatusModal {
target: emojiPopup target: emojiPopup
onEmojiSelected: function (emojiText, atCursor) { onEmojiSelected: function (emojiText, atCursor) {
contentItem.channelName.input.icon.isLetterIdenticon = false;
scrollView.channelName.input.icon.emoji = emojiText scrollView.channelName.input.icon.emoji = emojiText
} }
onClosed: { onClosed: {
@ -114,16 +111,25 @@ StatusModal {
input.onTextChanged: { input.onTextChanged: {
input.text = Utils.convertSpacesToDashesAndUpperToLowerCase(input.text); input.text = Utils.convertSpacesToDashesAndUpperToLowerCase(input.text);
input.cursorPosition = input.text.length input.cursorPosition = input.text.length
if (popup.channelEmoji === "") {
input.letterIconName = text;
}
} }
input.isIconSelectable: true
input.icon.color: colorDialog.color.toString() input.icon.color: colorDialog.color.toString()
input.leftPadding: 16 input.leftPadding: 16
onIconClicked: { input.rightComponent: StatusRoundButton {
popup.emojiPopupOpened = true implicitWidth: 20
popup.emojiPopup.open() implicitHeight: 20
popup.emojiPopup.emojiSize = StatusQUtils.Emoji.size.verySmall icon.width: implicitWidth
popup.emojiPopup.x = popup.x + Style.current.padding icon.height: implicitHeight
popup.emojiPopup.y = popup.y + nameInput.height + 2*Style.current.xlPadding icon.name: "smiley"
onClicked: {
popup.emojiPopupOpened = true;
popup.emojiPopup.open();
popup.emojiPopup.emojiSize = StatusQUtils.Emoji.size.verySmall;
popup.emojiPopup.x = popup.width - 2*Style.current.xlPadding;
popup.emojiPopup.y = popup.y + nameInput.height + 2*Style.current.xlPadding;
}
} }
validationMode: StatusInput.ValidationMode.Always validationMode: StatusInput.ValidationMode.Always
validators: [ validators: [