mirror of
https://github.com/FreeTubeApp/FreeTube
synced 2024-12-13 04:59:33 +01:00
Show message when the live chat is unavailable (#3327)
* Show message when the live chat is unavailable * Dynamically size live chat card when an error is shown
This commit is contained in:
parent
a53e7f0598
commit
8366ec9f79
@ -1,3 +1,8 @@
|
||||
.card.hasError {
|
||||
height: auto !important;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.relative {
|
||||
position: relative;
|
||||
}
|
||||
@ -12,6 +17,11 @@
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.messageContainer.hasError {
|
||||
flex-direction: column;
|
||||
row-gap: 16px;
|
||||
}
|
||||
|
||||
.message {
|
||||
font-size: 18px;
|
||||
color: var(--tertiary-text-color);
|
||||
|
@ -88,8 +88,12 @@ export default defineComponent({
|
||||
} else {
|
||||
switch (this.backendPreference) {
|
||||
case 'local':
|
||||
this.liveChatInstance = this.liveChat
|
||||
this.startLiveChatLocal()
|
||||
if (this.liveChat) {
|
||||
this.liveChatInstance = this.liveChat
|
||||
this.startLiveChatLocal()
|
||||
} else {
|
||||
this.showLiveChatUnavailable()
|
||||
}
|
||||
break
|
||||
case 'invidious':
|
||||
if (this.backendFallback) {
|
||||
@ -114,9 +118,21 @@ export default defineComponent({
|
||||
|
||||
getLiveChatLocal: async function () {
|
||||
const videoInfo = await getLocalVideoInfo(this.videoId)
|
||||
this.liveChatInstance = videoInfo.getLiveChat()
|
||||
|
||||
this.startLiveChatLocal()
|
||||
if (videoInfo.livechat) {
|
||||
this.liveChatInstance = videoInfo.getLiveChat()
|
||||
|
||||
this.startLiveChatLocal()
|
||||
} else {
|
||||
this.showLiveChatUnavailable()
|
||||
}
|
||||
},
|
||||
|
||||
showLiveChatUnavailable: function () {
|
||||
this.hasError = true
|
||||
this.errorMessage = this.$t('Video["Live Chat is unavailable for this stream. It may have been disabled by the uploader."]')
|
||||
this.isLoading = false
|
||||
this.showEnableChat = false
|
||||
},
|
||||
|
||||
startLiveChatLocal: function () {
|
||||
|
@ -1,6 +1,7 @@
|
||||
<template>
|
||||
<ft-card
|
||||
class="relative"
|
||||
class="card relative"
|
||||
:class="{ hasError }"
|
||||
>
|
||||
<ft-loader
|
||||
v-if="isLoading"
|
||||
@ -8,6 +9,7 @@
|
||||
<div
|
||||
v-else-if="hasError"
|
||||
class="messageContainer"
|
||||
:class="{ hasError }"
|
||||
>
|
||||
<p
|
||||
class="message"
|
||||
|
@ -601,6 +601,7 @@ Video:
|
||||
'Live Chat is currently not supported with the Invidious API. A direct connection to YouTube is required.': Live
|
||||
Chat is currently not supported with the Invidious API. A direct connection to
|
||||
YouTube is required.
|
||||
'Live Chat is unavailable for this stream. It may have been disabled by the uploader.': 'Live Chat is unavailable for this stream. It may have been disabled by the uploader.'
|
||||
Show Super Chat Comment: Show Super Chat Comment
|
||||
Scroll to Bottom: Scroll to Bottom
|
||||
Download Video: Download Video
|
||||
|
Loading…
Reference in New Issue
Block a user