mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 23:27:26 +01:00
add markdown-formatting link - hide textarea if guidelines not accepting - chat ui
This commit is contained in:
@@ -1,9 +1,10 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
.row.chat-row
|
.row.chat-row
|
||||||
.col-12
|
.col-12
|
||||||
h3(v-once) {{ label }}
|
h3.float-left.label(:class="{accepted: communityGuidelinesAccepted }") {{ label }}
|
||||||
|
div.float-right(v-markdown='$t("markdownFormattingHelp")')
|
||||||
|
|
||||||
.row
|
.row(v-if="communityGuidelinesAccepted")
|
||||||
textarea(:placeholder='placeholder',
|
textarea(:placeholder='placeholder',
|
||||||
v-model='newMessage',
|
v-model='newMessage',
|
||||||
ref='user-entry',
|
ref='user-entry',
|
||||||
@@ -22,14 +23,14 @@
|
|||||||
:caretPosition = 'caretPosition',
|
:caretPosition = 'caretPosition',
|
||||||
:chat='group.chat')
|
:chat='group.chat')
|
||||||
|
|
||||||
|
community-guidelines
|
||||||
|
|
||||||
.row.chat-actions
|
.row.chat-actions
|
||||||
.col-6.chat-receive-actions
|
.col-6.chat-receive-actions
|
||||||
button.btn.btn-secondary.float-left.fetch(v-once, @click='fetchRecentMessages()') {{ $t('fetchRecentMessages') }}
|
button.btn.btn-secondary.float-left.fetch(v-once, @click='fetchRecentMessages()') {{ $t('fetchRecentMessages') }}
|
||||||
button.btn.btn-secondary.float-left(v-once, @click='reverseChat()') {{ $t('reverseChat') }}
|
button.btn.btn-secondary.float-left(v-once, @click='reverseChat()') {{ $t('reverseChat') }}
|
||||||
.col-6.chat-send-actions
|
.col-6.chat-send-actions
|
||||||
button.btn.btn-secondary.send-chat.float-right(v-once, @click='sendMessage()') {{ $t('send') }}
|
button.btn.btn-primary.send-chat.float-right(:disabled="!communityGuidelinesAccepted", @click='sendMessage()') {{ $t('send') }}
|
||||||
|
|
||||||
community-guidelines
|
|
||||||
|
|
||||||
slot(
|
slot(
|
||||||
name="additionRow",
|
name="additionRow",
|
||||||
@@ -46,9 +47,14 @@
|
|||||||
import autocomplete from '../chat/autoComplete';
|
import autocomplete from '../chat/autoComplete';
|
||||||
import communityGuidelines from './communityGuidelines';
|
import communityGuidelines from './communityGuidelines';
|
||||||
import chatMessage from '../chat/chatMessages';
|
import chatMessage from '../chat/chatMessages';
|
||||||
|
import { mapState } from 'client/libs/store';
|
||||||
|
import markdownDirective from 'client/directives/markdown';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['label', 'group', 'placeholder'],
|
props: ['label', 'group', 'placeholder'],
|
||||||
|
directives: {
|
||||||
|
markdown: markdownDirective,
|
||||||
|
},
|
||||||
components: {
|
components: {
|
||||||
autocomplete,
|
autocomplete,
|
||||||
communityGuidelines,
|
communityGuidelines,
|
||||||
@@ -71,9 +77,13 @@
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
...mapState({user: 'user.data'}),
|
||||||
currentLength () {
|
currentLength () {
|
||||||
return this.newMessage.length;
|
return this.newMessage.length;
|
||||||
},
|
},
|
||||||
|
communityGuidelinesAccepted () {
|
||||||
|
return this.user.flags.communityGuidelinesAccepted;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// https://medium.com/@_jh3y/how-to-where-s-the-caret-getting-the-xy-position-of-the-caret-a24ba372990a
|
// https://medium.com/@_jh3y/how-to-where-s-the-caret-getting-the-xy-position-of-the-caret-a24ba372990a
|
||||||
@@ -196,6 +206,16 @@
|
|||||||
.chat-row {
|
.chat-row {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
|
.label:not(.accepted) {
|
||||||
|
color: #a5a1ac;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row {
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 0;
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
textarea {
|
textarea {
|
||||||
min-height: 150px;
|
min-height: 150px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -204,7 +224,7 @@
|
|||||||
font-style: italic;
|
font-style: italic;
|
||||||
line-height: 1.43;
|
line-height: 1.43;
|
||||||
color: $gray-300;
|
color: $gray-300;
|
||||||
padding: .5em;
|
padding: 10px 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-entry {
|
.user-entry {
|
||||||
|
|||||||
@@ -11,17 +11,31 @@
|
|||||||
|
|
||||||
.community-guidelines {
|
.community-guidelines {
|
||||||
background-color: rgba(135, 129, 144, 0.84);
|
background-color: rgba(135, 129, 144, 0.84);
|
||||||
padding: 1em;
|
padding-left: 0;
|
||||||
|
padding-right: 0;
|
||||||
color: $white;
|
color: $white;
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
height: 150px;
|
|
||||||
margin-top: 2.3em;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
// width: calc(100% - 24px);
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
||||||
|
.col {
|
||||||
|
padding: 20px 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
text-decoration: underline;
|
||||||
|
color: $white;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
margin: 20px 12px;
|
||||||
|
padding-top: 5px;
|
||||||
|
padding-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
.btn-follow-guidelines {
|
.btn-follow-guidelines {
|
||||||
white-space: pre-line;
|
white-space: pre-line;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user