0
Fork 0
mirror of https://codeberg.org/SafeTwitch/safetwitch.git synced 2024-12-22 13:22:58 -05:00

feat(theatremode): added new action buttons

This commit is contained in:
Seraph91P 2024-08-10 13:28:46 +02:00
parent 467f16824c
commit ad0578d2c0
3 changed files with 51 additions and 62 deletions

View file

@ -1,28 +1,16 @@
<template> <template>
<button @click="toggleTheatreMode" class="px-2 py-1.5 rounded-lg bg-purple"> <button @click="toggleTheatreMode" class="invisible xl:visible px-2 py-1.5 rounded-lg bg-purple">
<v-icon name="fa-expand"></v-icon> <v-icon name="fa-expand"></v-icon>
<span>{{ isTheatreMode ? 'Exit Theatre Mode' : 'Theatre Mode' }}</span>
</button> </button>
</template> </template>
<script lang="ts"> <script lang="ts">
import { ref } from 'vue'
export default { export default {
emits: ['toggle'], emits: ['toggle'],
setup(props, { emit }) { methods: {
const isTheatreMode = ref(false) toggleTheatreMode() {
this.$emit('toggle')
function toggleTheatreMode() {
isTheatreMode.value = !isTheatreMode.value
emit('toggle', isTheatreMode.value)
}
return {
isTheatreMode,
toggleTheatreMode
} }
} }
} }
</script> </script>

View file

@ -9,7 +9,7 @@ import LoadingScreen from '@/components/LoadingScreen.vue'
import AboutTab from '@/components/user/AboutTab.vue' import AboutTab from '@/components/user/AboutTab.vue'
import ShareModal from '@/components/popups/ShareButtonModal.vue' import ShareModal from '@/components/popups/ShareButtonModal.vue'
import VueTitle from '@/components/VueTitle.vue' import VueTitle from '@/components/VueTitle.vue'
import TheatreModeToggle from '@/components/TheatreModeToggle.vue' import ActionButtons from '@/components/ActionButtons.vue'
import type { Video } from '@/types' import type { Video } from '@/types'
import { truncate, abbreviate, getEndpoint } from '@/mixins' import { truncate, abbreviate, getEndpoint } from '@/mixins'
@ -21,6 +21,7 @@ export default {
const clipSlug = route.params.slug const clipSlug = route.params.slug
const data = ref<Video>() const data = ref<Video>()
const status = ref<'ok' | 'error'>() const status = ref<'ok' | 'error'>()
const isTheatreMode = ref(false)
let srcUrl let srcUrl
await getEndpoint(`api/clips/cliplink/${clipSlug}`) await getEndpoint(`api/clips/cliplink/${clipSlug}`)
@ -31,8 +32,6 @@ export default {
status.value = 'error' status.value = 'error'
}) })
console.log(srcUrl)
const videoOptions = { const videoOptions = {
autoplay: true, autoplay: true,
controls: true, controls: true,
@ -52,7 +51,7 @@ export default {
time: ref(0), time: ref(0),
srcUrl, srcUrl,
shareModalVisible: ref(false), shareModalVisible: ref(false),
isTheatreMode: ref(false) isTheatreMode
} }
}, },
async mounted() { async mounted() {
@ -74,7 +73,7 @@ export default {
AboutTab, AboutTab,
ShareModal, ShareModal,
VueTitle, VueTitle,
TheatreModeToggle ActionButtons
}, },
methods: { methods: {
truncate, truncate,
@ -101,8 +100,10 @@ export default {
<VueTitle :title=" 'Clip - ' + data.title"></VueTitle> <VueTitle :title=" 'Clip - ' + data.title"></VueTitle>
<div <div
:class="[ :class="[
'flex bg-crust flex-col p-6 rounded-lg w-[99vw] text-contrast', 'flex bg-crust flex-col p-6 rounded-lg w-full text-contrast',
isTheatreMode ? 'md:max-w-[95rem] lg:max-w-[100rem] xl:max-w-[120rem] 2x:max-w-[140rem]' : 'md:max-w-prose md:min-w-[65ch] lg:max-w-[70rem] xl:max-w-[80rem] 2x:max-w-[90rem]' isTheatreMode
? 'md:w-[62vw] lg:w-[75vw] xl:w-[75vw] 2xl:w-[68vw]'
: 'md:w-[80vw] lg:w-[70vw] xl:w-[60vw] 2xl:w-[50vw] max-w-[1200px]'
]" ]"
> >
<div class="w-full mx-auto rounded-lg mb-5"> <div class="w-full mx-auto rounded-lg mb-5">
@ -137,19 +138,14 @@ export default {
</p> </p>
</div> </div>
<div class="space-x-1"> <action-buttons
<button @click="toggleTheatreMode" class="px-2 py-1.5 rounded-lg bg-purple"> :showDownload="true"
<v-icon name="fa-expand"></v-icon> :showTheatreMode="true"
</button> :showShare="true"
<a :href="srcUrl" download> @toggleTheatreMode="toggleTheatreMode"
<button class="px-2 py-1.5 rounded-lg bg-purple"> @toggleShareModal="toggleShareModal"
<v-icon name="md-download-round"></v-icon> :downloadUrl="srcUrl"
</button> />
</a>
<button @click="toggleShareModal" class="px-2 py-1.5 rounded-lg bg-purple">
<v-icon name="fa-share-alt"></v-icon>
</button>
</div>
</div> </div>
</div> </div>

View file

@ -12,7 +12,7 @@ import AudioPlayer from '@/components/AudioPlayer.vue'
import AboutTab from '@/components/user/AboutTab.vue' import AboutTab from '@/components/user/AboutTab.vue'
import ShareModal from '@/components/popups/ShareButtonModal.vue' import ShareModal from '@/components/popups/ShareButtonModal.vue'
import VueTitle from '@/components/VueTitle.vue' import VueTitle from '@/components/VueTitle.vue'
import TheatreModeToggle from '@/components/TheatreModeToggle.vue' import ActionButtons from '@/components/ActionButtons.vue'
import type { StreamerData } from '@/types' import type { StreamerData } from '@/types'
import { truncate, abbreviate, getEndpoint } from '@/mixins' import { truncate, abbreviate, getEndpoint } from '@/mixins'
@ -26,6 +26,7 @@ export default {
const data = ref<StreamerData>() const data = ref<StreamerData>()
const status = ref<'ok' | 'error'>() const status = ref<'ok' | 'error'>()
const rootBackendUrl = inject('rootBackendUrl') const rootBackendUrl = inject('rootBackendUrl')
const isTheatreMode = ref(false)
const videoOptions = { const videoOptions = {
autoplay: getSetting('autoplay'), autoplay: getSetting('autoplay'),
controls: true, controls: true,
@ -45,7 +46,7 @@ export default {
videoOptions, videoOptions,
audioOptions, audioOptions,
shareModalVisible: ref(false), shareModalVisible: ref(false),
isTheatreMode: ref(false) isTheatreMode
} }
}, },
async mounted() { async mounted() {
@ -76,7 +77,7 @@ export default {
AboutTab, AboutTab,
ShareModal, ShareModal,
VueTitle, VueTitle,
TheatreModeToggle ActionButtons
}, },
methods: { methods: {
truncate, truncate,
@ -109,8 +110,10 @@ export default {
<vue-title :title="data.username"></vue-title> <vue-title :title="data.username"></vue-title>
<div <div
:class="[ :class="[
'flex bg-crust flex-col p-6 rounded-lg w-[99vw] text-contrast', 'flex bg-crust flex-col p-6 rounded-lg w-full text-contrast',
isTheatreMode ? 'md:max-w-[95rem] lg:max-w-[100rem] xl:max-w-[120rem] 2x:max-w-[140rem]' : 'md:max-w-prose md:min-w-[65ch] lg:max-w-[70rem] xl:max-w-[80rem] 2x:max-w-[90rem]' isTheatreMode
? 'md:w-[62vw] lg:w-[75vw] xl:w-[75vw] 2xl:w-[68vw]'
: 'md:w-[80vw] lg:w-[70vw] xl:w-[60vw] 2xl:w-[50vw] max-w-[1200px]'
]" ]"
> >
<div v-if="data.isLive" class="w-full mx-auto rounded-lg mb-5"> <div v-if="data.isLive" class="w-full mx-auto rounded-lg mb-5">
@ -184,19 +187,21 @@ export default {
</div> </div>
</div> </div>
<div class="pt-2 space-x-2 items-center inline-flex"> <div class="flex justify-between items-center">
<div class="pt-2 inline-flex">
<follow-button :username="data.login"></follow-button> <follow-button :username="data.login"></follow-button>
<p class="align-baseline font-bold ml-3"> <p class="align-baseline font-bold ml-3">
{{ abbreviate(data.followers) }} {{ $t('main.followers') }} {{ abbreviate(data.followers) }} {{ $t('main.followers') }}
</p> </p>
</div>
<button @click="toggleShareModal" class="px-2 py-1.5 rounded-lg bg-purple"> <action-buttons
<v-icon name="fa-share-alt"></v-icon> :showDownload="false"
</button> :showTheatreMode="true"
<button @click="toggleTheatreMode" class="px-2 py-1.5 rounded-lg bg-purple"> :showShare="true"
<v-icon name="fa-expand"></v-icon> @toggleTheatreMode="toggleTheatreMode"
</button> @toggleShareModal="toggleShareModal"
/>
</div> </div>
</div> </div>