2021-01-13 12:36:25 +00:00
|
|
|
<template>
|
|
|
|
<div class="top-box">
|
|
|
|
<div class="mode-wrap button-group">
|
|
|
|
<button
|
|
|
|
class="button clear button--reply"
|
|
|
|
:class="replyButtonClass"
|
|
|
|
@click="handleReplyClick"
|
|
|
|
>
|
|
|
|
<emoji-or-icon icon="" emoji="💬" />
|
|
|
|
{{ $t('CONVERSATION.REPLYBOX.REPLY') }}
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<button
|
|
|
|
class="button clear button--note"
|
|
|
|
:class="noteButtonClass"
|
|
|
|
@click="handleNoteClick"
|
|
|
|
>
|
|
|
|
<emoji-or-icon icon="" emoji="📝" />
|
|
|
|
{{ $t('CONVERSATION.REPLYBOX.PRIVATE_NOTE') }}
|
|
|
|
</button>
|
|
|
|
</div>
|
2021-01-13 13:46:45 +00:00
|
|
|
<div class="action-wrap">
|
|
|
|
<div v-if="isMessageLengthReachingThreshold" class="tabs-title">
|
|
|
|
<span :class="charLengthClass">
|
|
|
|
{{ characterLengthWarning }}
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-01-13 12:36:25 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2021-01-13 13:46:45 +00:00
|
|
|
import { REPLY_EDITOR_MODES, CHAR_LENGTH_WARNING } from './constants';
|
2021-01-13 12:36:25 +00:00
|
|
|
import EmojiOrIcon from 'shared/components/EmojiOrIcon';
|
|
|
|
export default {
|
|
|
|
name: 'ReplyTopPanel',
|
|
|
|
components: {
|
|
|
|
EmojiOrIcon,
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
mode: {
|
|
|
|
type: String,
|
|
|
|
default: REPLY_EDITOR_MODES.REPLY,
|
|
|
|
},
|
|
|
|
setReplyMode: {
|
|
|
|
type: Function,
|
|
|
|
default: () => {},
|
|
|
|
},
|
2021-01-13 13:46:45 +00:00
|
|
|
isMessageLengthReachingThreshold: {
|
|
|
|
type: Boolean,
|
|
|
|
default: () => false,
|
|
|
|
},
|
|
|
|
charactersRemaining: {
|
|
|
|
type: Number,
|
|
|
|
default: () => 0,
|
|
|
|
},
|
2021-01-13 12:36:25 +00:00
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
replyButtonClass() {
|
|
|
|
return {
|
|
|
|
'is-active': this.mode === REPLY_EDITOR_MODES.REPLY,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
noteButtonClass() {
|
|
|
|
return {
|
|
|
|
'is-active': this.mode === REPLY_EDITOR_MODES.NOTE,
|
|
|
|
};
|
|
|
|
},
|
2021-01-13 13:46:45 +00:00
|
|
|
charLengthClass() {
|
|
|
|
return this.charactersRemaining < 0 ? 'message-error' : 'message-length';
|
|
|
|
},
|
|
|
|
characterLengthWarning() {
|
|
|
|
return this.charactersRemaining < 0
|
|
|
|
? `${-this.charactersRemaining} ${CHAR_LENGTH_WARNING.NEGATIVE}`
|
|
|
|
: `${this.charactersRemaining} ${CHAR_LENGTH_WARNING.UNDER_50}`;
|
|
|
|
},
|
2021-01-13 12:36:25 +00:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
handleReplyClick() {
|
|
|
|
this.setReplyMode(REPLY_EDITOR_MODES.REPLY);
|
|
|
|
},
|
|
|
|
handleNoteClick() {
|
|
|
|
this.setReplyMode(REPLY_EDITOR_MODES.NOTE);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.top-box {
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
|
|
background: var(--b-100);
|
|
|
|
}
|
|
|
|
|
|
|
|
.button-group {
|
|
|
|
border: 0;
|
|
|
|
padding: 0;
|
|
|
|
margin: 0;
|
|
|
|
|
|
|
|
.button {
|
|
|
|
font-size: var(--font-size-small);
|
|
|
|
font-weight: var(--font-weight-medium);
|
|
|
|
padding: var(--space-one) var(--space-normal);
|
|
|
|
margin: 0;
|
|
|
|
position: relative;
|
|
|
|
z-index: 1;
|
|
|
|
|
|
|
|
&.is-active {
|
|
|
|
background: white;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.button--reply {
|
2021-01-17 19:24:20 +00:00
|
|
|
border-radius: 0;
|
2021-01-13 12:36:25 +00:00
|
|
|
border-right: 1px solid var(--color-border);
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
border-right: 1px solid var(--color-border);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.button--note {
|
2021-01-17 19:24:20 +00:00
|
|
|
border-radius: 0;
|
|
|
|
|
2021-01-13 12:36:25 +00:00
|
|
|
&.is-active {
|
|
|
|
border-right: 1px solid var(--color-border);
|
|
|
|
background: var(--y-50);
|
|
|
|
}
|
2021-01-17 19:24:20 +00:00
|
|
|
|
|
|
|
&:hover,
|
|
|
|
&:active {
|
|
|
|
color: var(--y-800);
|
|
|
|
}
|
2021-01-13 12:36:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.button--note {
|
|
|
|
color: var(--y-900);
|
|
|
|
}
|
|
|
|
|
|
|
|
.action-wrap {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
2021-01-13 13:46:45 +00:00
|
|
|
margin: 0 var(--space-normal);
|
|
|
|
font-size: var(--font-size-mini);
|
|
|
|
|
|
|
|
.message-error {
|
|
|
|
color: var(--r-600);
|
|
|
|
}
|
|
|
|
.message-length {
|
|
|
|
color: var(--s-600);
|
|
|
|
}
|
2021-01-13 12:36:25 +00:00
|
|
|
}
|
|
|
|
</style>
|