Skip to content

Commit

Permalink
move disabled text back to above the input area - re-enable input area
Browse files Browse the repository at this point in the history
  • Loading branch information
negue committed Jan 5, 2025
1 parent ba6a591 commit 3cbe855
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
26 changes: 17 additions & 9 deletions website/client/src/pages/private-messages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,6 @@
@newMessageClicked="showStartNewConversationInput = true"
/>

<pm-disabled-state
v-if="uiState === UI_STATES.DISABLED"
:disabled-texts="disabledTexts"
/>
<pm-new-message-started
v-if="uiState === UI_STATES.START_NEW_CONVERSATION && selectedConversation.userStyles"
:member-obj="selectedConversation.userStyles"
Expand Down Expand Up @@ -124,6 +120,10 @@
@triggerLoad="infiniteScrollTrigger"
/>

<pm-disabled-state
v-if="disabledTexts"
:disabled-texts="disabledTexts"
/>
<div
v-if="shouldShowInputPanel"
class="full-width"
Expand Down Expand Up @@ -723,13 +723,15 @@ export default defineComponent({
disabledTexts () {
if (this.user.flags.chatRevoked) {
return {
enableInput: false,
title: this.$t('PMPlaceholderTitleRevoked'),
description: this.$t('chatPrivilegesRevoked'),
};
}
if (this.user.inbox.optOut) {
return {
enableInput: true,
title: this.$t('PMDisabledCaptionTitle'),
description: this.$t('PMDisabledCaptionText'),
};
Expand All @@ -738,13 +740,15 @@ export default defineComponent({
if (this.selectedConversation?.key) {
if (this.user.inbox.blocks.includes(this.selectedConversation.key)) {
return {
enableInput: false,
title: this.$t('PMDisabledCaptionTitle'),
description: this.$t('PMUnblockUserToSendMessages'),
};
}
if (!this.selectedConversation.canReceive) {
return {
enableInput: false,
title: this.$t('PMCanNotReply'),
description: this.$t('PMUserDoesNotReceiveMessages'),
};
Expand Down Expand Up @@ -772,6 +776,10 @@ export default defineComponent({
return '';
},
newMessageDisabled () {
if (this.uiState === UI_STATES.DISABLED) {
return !this.disabledTexts.enableInput;
}
return [
UI_STATES.NO_CONVERSATIONS_SELECTED,
UI_STATES.DISABLED,
Expand Down Expand Up @@ -809,12 +817,13 @@ export default defineComponent({
const currentUiState = this.uiState;
switch (currentUiState) {
case UI_STATES.START_NEW_CONVERSATION: {
return true;
}
case UI_STATES.CONVERSATION_SELECTED: {
case UI_STATES.CONVERSATION_SELECTED:
case UI_STATES.START_NEW_CONVERSATION:
case UI_STATES.DISABLED:
{
return true;
}
default: {
return false;
}
Expand Down Expand Up @@ -994,7 +1003,6 @@ export default defineComponent({
Vue.nextTick(() => {
if (!this.$refs.chatscroll) {
alert('NO SCROLL');
return;
}
const chatscroll = this.$refs.chatscroll.$el;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
@import '~@/assets/scss/colors.scss';
.pm-disabled-caption {
padding-top: 1em;
padding-top: 1.5em;
z-index: 2;
h4, p {
Expand Down

0 comments on commit 3cbe855

Please sign in to comment.