This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
@translated="handleTranslatedText"
|
@translated="handleTranslatedText"
|
||||||
/>
|
/>
|
||||||
<div v-if="data.chat.length > 0" class="chat-history mt-2">
|
<div v-if="data.chat.length > 0" class="chat-history mt-2">
|
||||||
<table class="table table-borderless">
|
<table id="chat" :style="`max-width: ${data.clientWidth}px; width: ${data.clientWidth}px`" class="table table-borderless">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="(m, id) in data.chat" :key="id">
|
<tr v-for="(m, id) in data.chat" :key="id">
|
||||||
<td class="td-time">
|
<td class="td-time">
|
||||||
@@ -79,23 +79,20 @@ export default {
|
|||||||
const data = reactive({
|
const data = reactive({
|
||||||
chat: [],
|
chat: [],
|
||||||
translatedText: [],
|
translatedText: [],
|
||||||
originalChat: []
|
originalChat: [],
|
||||||
|
clientWidth: 0
|
||||||
})
|
})
|
||||||
|
|
||||||
const handleTranslatedText = async (e) => {
|
const handleTranslatedText = async (e) => {
|
||||||
const res = await e
|
const [res, toggle] = await e
|
||||||
|
|
||||||
if (res === 'original' && data.originalChat.length > 0) {
|
|
||||||
data.chat = data.originalChat
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (res === 'already translated' && data.translatedText.length > 0) {
|
|
||||||
data.chat = data.translatedText
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (res !== null) {
|
if (res !== null) {
|
||||||
|
if (toggle === 'translated') {
|
||||||
data.translatedText = await setPlayer(sortChatHistory(res, true))
|
data.translatedText = await setPlayer(sortChatHistory(res, true))
|
||||||
data.chat = data.translatedText
|
data.chat = data.translatedText
|
||||||
|
} else if (toggle === 'original') {
|
||||||
|
data.chat = data.originalChat
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,8 +155,21 @@ export default {
|
|||||||
return arr
|
return arr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const sizeTable = () => {
|
||||||
|
if (document.documentElement.clientWidth <= 768) {
|
||||||
|
data.clientWidth = document.documentElement.clientWidth - 32
|
||||||
|
} else {
|
||||||
|
data.clientWidth = 700
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.onresize = () => {
|
||||||
|
sizeTable()
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getChatHistory()
|
getChatHistory()
|
||||||
|
sizeTable()
|
||||||
})
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -188,29 +198,27 @@ export default {
|
|||||||
margin-top: .5rem;
|
margin-top: .5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
table {
|
td {
|
||||||
width: 700px;
|
|
||||||
max-width: 700px;
|
|
||||||
td {
|
|
||||||
padding: .5rem;
|
padding: .5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.td-time {
|
.td-time {
|
||||||
width: 80px;
|
width: 80px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.td-avatar {
|
.td-avatar {
|
||||||
width: 30px;
|
width: 30px;
|
||||||
|
|
||||||
.avatar {
|
.avatar {
|
||||||
width: 20px;
|
width: 20px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.td-name {
|
.td-name {
|
||||||
width: 250px;
|
width: 200px;
|
||||||
max-width: 250px;
|
max-width: 200px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
@@ -226,31 +234,41 @@ table {
|
|||||||
color: red;
|
color: red;
|
||||||
text-shadow: 0 0 1rem orangered;
|
text-shadow: 0 0 1rem orangered;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.td-icon {
|
.td-icon {
|
||||||
width: 20px;
|
width: 20px;
|
||||||
|
|
||||||
.fa-caret-right {
|
.fa-caret-right {
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.td-message {
|
||||||
|
width: 400px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 768px) {
|
||||||
|
.container {
|
||||||
|
justify-content: flex-start;
|
||||||
|
align-items: flex-start;
|
||||||
|
margin-left: 1rem;
|
||||||
|
}
|
||||||
|
.td-name {
|
||||||
|
width: 120px !important;
|
||||||
|
max-width: 120px !important;
|
||||||
|
}
|
||||||
.td-message {
|
.td-message {
|
||||||
width: 320px;
|
width: auto !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 576px) {
|
@media screen and (max-width: 576px) {
|
||||||
|
.container {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
.td-avatar {
|
.td-avatar {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
.td-name {
|
|
||||||
width: 120px;
|
|
||||||
max-width: 120px;
|
|
||||||
}
|
|
||||||
.td-message {
|
|
||||||
width: auto;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@@ -33,7 +33,7 @@ export default {
|
|||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setup(props) {
|
setup() {
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
|
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
@@ -67,18 +67,12 @@ export default {
|
|||||||
|
|
||||||
toggleShow()
|
toggleShow()
|
||||||
|
|
||||||
if (!props.translated && toggle.value === 'translated') {
|
|
||||||
response = await GetChatHistoryTranslated(store, store.state.matchDetails.match_id)
|
response = await GetChatHistoryTranslated(store, store.state.matchDetails.match_id)
|
||||||
}
|
|
||||||
if (props.translated && toggle.value === 'translated')
|
|
||||||
response = 'already translated'
|
|
||||||
if (toggle.value === 'original')
|
|
||||||
response = 'original'
|
|
||||||
|
|
||||||
if (refreshButton.classList.contains('show'))
|
if (refreshButton.classList.contains('show'))
|
||||||
refreshButton.classList.remove('show')
|
refreshButton.classList.remove('show')
|
||||||
|
|
||||||
return response
|
return [response, toggle.value]
|
||||||
}
|
}
|
||||||
|
|
||||||
const toggleShow = () => {
|
const toggleShow = () => {
|
||||||
@@ -108,6 +102,7 @@ export default {
|
|||||||
.toggle-btn {
|
.toggle-btn {
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
.fa {
|
.fa {
|
||||||
display: none;
|
display: none;
|
||||||
|
Reference in New Issue
Block a user