Merge branch 'player-table'

This commit is contained in:
jb-alvarado 2024-04-15 20:25:50 +02:00
commit 02a134ad1e
9 changed files with 2964 additions and 3975 deletions

6
eslint.config.mjs Normal file
View File

@ -0,0 +1,6 @@
// @ts-check
import withNuxt from './.nuxt/eslint.config.mjs'
export default withNuxt(
// Your custom configs here
)

View File

@ -45,7 +45,14 @@ export default defineNuxtConfig({
},
},
modules: ['@nuxtjs/color-mode', '@nuxtjs/i18n', '@pinia/nuxt', '@vueuse/nuxt', '@nuxtjs/tailwindcss'],
modules: [
'@nuxt/eslint',
'@nuxtjs/color-mode',
'@nuxtjs/i18n',
'@pinia/nuxt',
'@vueuse/nuxt',
'@nuxtjs/tailwindcss',
],
css: ['@/assets/scss/main.scss'],
colorMode: {
@ -75,23 +82,23 @@ export default defineNuxtConfig({
],
customRoutes: 'config',
pages: {
'player': {
player: {
de: '/wiedergabe',
en: '/player',
},
'media': {
media: {
de: '/medien',
en: '/media',
},
'message': {
message: {
de: '/nachrichten',
en: '/message',
},
'logging': {
logging: {
de: '/protokollierung',
en: '/logging',
},
'configure': {
configure: {
de: '/einstellungen',
en: '/configure',
},

6603
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -13,14 +13,11 @@
"postinstall": "nuxt prepare"
},
"dependencies": {
"@nuxt/types": "^2.17.3",
"@nuxtjs/color-mode": "^3.3.3",
"@nuxtjs/color-mode": "^3.4.0",
"@pinia/nuxt": "^0.5.1",
"@popperjs/core": "^2.11.8",
"@vuepic/vue-datepicker": "^8.4.0",
"@vueuse/nuxt": "^10.9.0",
"bootstrap-icons": "^1.11.3",
"cookie-universal-nuxt": "^2.2.2",
"dayjs": "^1.11.10",
"jwt-decode": "^4.0.0",
"lodash": "^4.17.21",
@ -29,22 +26,22 @@
"pinia": "^2.1.7",
"sortablejs-vue3": "^1.2.11",
"splitpanes": "^3.1.5",
"video.js": "^8.10.0",
"vue": "^3.4.21",
"vue-router": "^4.3.0"
"video.js": "^8.10.0"
},
"devDependencies": {
"@nuxtjs/eslint-config": "^12.0.0",
"@nuxt/eslint": "^0.3.6",
"@nuxtjs/i18n": "^8.3.0",
"@nuxtjs/tailwindcss": "^6.11.4",
"@types/lodash": "^4.17.0",
"@types/video.js": "^7.3.57",
"@types/video.js": "^7.3.58",
"daisyui": "^4.10.1",
"eslint": "^8.57.0",
"eslint-plugin-nuxt": "^4.0.0",
"postcss": "^8.4.38",
"postcss-loader": "^8.1.1",
"sass": "^1.74.1",
"sass-loader": "^14.1.1"
"sass": "^1.75.0",
"sass-loader": "^14.2.0",
"vue": "^3.4.21",
"vue-router": "^4.3.0"
}
}

View File

@ -49,7 +49,7 @@ watch([listDate, configID], () => {
})
const calendarFormat = (date: Date) => {
return $dayjs(date).locale(locale.value).format('dddd LL')
return $dayjs(date).locale(locale.value).format('dddd - LL')
}
async function getLog() {
@ -79,20 +79,20 @@ async function getLog() {
}
.log-number {
color: #e2c317;
color: var(--my-yellow);
}
.log-addr {
color: #ad7fa8;
color: var(--my-purple);
font-weight: 500;
}
.log-cmd {
color: #6c95c2;
color: var(--my-blue);
}
.log-info {
color: #8ae234;
color: var(--my-green);
}
.log-warning {

View File

@ -21,10 +21,11 @@
<div class="p-1 min-h-[260px] h-[calc(100vh-800px)] xl:h-[calc(100vh-480px)]">
<splitpanes class="border border-my-gray rounded shadow">
<pane
v-if="width > 768"
class="relative h-full !bg-base-300 rounded-s"
min-size="0"
max-size="80"
:size="width > 768 ? '20' : '0'"
size="20"
>
<div
v-if="mediaStore.isLoading"
@ -51,8 +52,8 @@
</div>
</div>
<ul class="h-[calc(100%-48px)] overflow-auto m-1">
<li class="flex px-1" v-for="folder in mediaStore.folderTree.folders" :key="folder.uid">
<div class="w-full h-[calc(100%-48px)] overflow-auto m-1">
<div class="flex px-1" v-for="folder in mediaStore.folderTree.folders" :key="folder.uid">
<button
class="truncate"
@click="mediaStore.getTree(`/${mediaStore.folderTree.source}/${folder.name}`)"
@ -60,16 +61,22 @@
<i class="bi-folder-fill" />
{{ folder.name }}
</button>
</li>
<Sortable :list="mediaStore.folderTree.files" :options="browserSortOptions" item-key="name">
</div>
<Sortable
:list="mediaStore.folderTree.files"
:options="browserSortOptions"
item-key="name"
tag="table"
class="w-full table table-fixed"
>
<template #item="{ element, index }">
<li
:id="`file_${index}`"
class="px-1 grid grid-cols-[auto_110px]"
<tr
:id="`file-${index}`"
class="w-full"
:class="{ 'grabbing cursor-grab': width > 768 }"
:key="element.name"
>
<div class="truncate">
<td class="ps-1 py-1 w-[20px]">
<i v-if="mediaType(element.name) === 'audio'" class="bi-music-note-beamed" />
<i v-else-if="mediaType(element.name) === 'video'" class="bi-film" />
<i
@ -77,83 +84,127 @@
class="bi-file-earmark-image"
/>
<i v-else class="bi-file-binary" />
</td>
<td class="px-[1px] py-1 truncate">
{{ element.name }}
</div>
<div>
<button
class="w-7"
@click=";(showPreviewModal = true), setPreviewData(element.name)"
>
</td>
<td class="px-1 py-1 w-[30px] text-center leading-3">
<button @click=";(showPreviewModal = true), setPreviewData(element.name)">
<i class="bi-play-fill" />
</button>
<div class="inline-block w-[82px]">{{ toMin(element.duration) }}</div>
</div>
</li>
</td>
<td class="px-0 py-1 w-[65px] text-nowrap">
{{ secToHMS(element.duration) }}
</td>
<td class="py-1 hidden">00:00:00</td>
<td class="py-1 hidden">{{ secToHMS(element.duration) }}</td>
<td class="py-1 hidden">&nbsp;</td>
<td class="py-1 hidden">&nbsp;</td>
<td class="py-1 hidden">&nbsp;</td>
</tr>
</template>
</Sortable>
</ul>
</div>
</pane>
<pane>
<div class="relative w-full h-full !bg-base-300 rounded-e">
<div id="playlist-container" class="relative w-full h-full !bg-base-300 rounded-e overflow-auto">
<div
v-if="playlistStore.isLoading"
class="w-full h-full absolute z-10 flex justify-center bg-base-100/70"
>
<span class="loading loading-spinner loading-lg" />
</div>
<div
class="grid grid-cols-[80px_auto_90px_80px_80px] md:grid-cols-[80px_auto_90px_80px_80px_80px_85px_100px_80px] bg-base-100 rounded-tr-lg border-b border-my-gray"
>
<div class="px-3 py-2">{{ $t('player.start') }}</div>
<div class="px-3 py-2">{{ $t('player.file') }}</div>
<div class="px-3 py-2 text-center">{{ $t('player.play') }}</div>
<div class="px-3 py-2">{{ $t('player.duration') }}</div>
<div class="px-3 py-2 hidden md:flex">{{ $t('player.in') }}</div>
<div class="px-3 py-2 hidden md:flex">{{ $t('player.out') }}</div>
<div class="px-3 py-2 hidden md:flex justify-center">{{ $t('player.ad') }}</div>
<div class="px-3 py-2 text-center">{{ $t('player.edit') }}</div>
<div class="px-3 py-2 hidden md:flex justify-center">{{ $t('player.delete') }}</div>
</div>
<div id="scroll-container" class="h-[calc(100%-44px)] overflow-auto">
<table class="table table-zebra table-fixed">
<thead class="top-0 sticky z-10">
<tr class="bg-base-100 rounded-tr-lg">
<th class="w-[85px] p-0 text-left">
<div class="border-b border-my-gray px-4 py-3 -mb-[2px]">
{{ $t('player.start') }}
</div>
</th>
<th class="w-auto p-0 text-left">
<div class="border-b border-my-gray px-4 py-3 -mb-[2px]">
{{ $t('player.file') }}
</div>
</th>
<th class="w-[90px] p-0 text-center">
<div class="border-b border-my-gray px-4 py-3 -mb-[2px]">
{{ $t('player.play') }}
</div>
</th>
<th class="w-[85px] p-0 text-center">
<div class="border-b border-my-gray px-4 py-3 -mb-[2px]">
{{ $t('player.duration') }}
</div>
</th>
<th class="w-[85px] p-0 text-center hidden xl:table-cell">
<div class="border-b border-my-gray px-4 py-3 -mb-[2px]">
{{ $t('player.in') }}
</div>
</th>
<th class="w-[85px] p-0 text-center hidden xl:table-cell">
<div class="border-b border-my-gray px-4 py-3 -mb-[2px]">
{{ $t('player.out') }}
</div>
</th>
<th class="w-[85px] p-0 text-center hidden xl:table-cell justify-center">
<div class="border-b border-my-gray px-4 py-3 -mb-[2px]">
{{ $t('player.ad') }}
</div>
</th>
<th class="w-[95px] p-0 text-center">
<div class="border-b border-my-gray px-4 py-3 -mb-[2px]">
{{ $t('player.edit') }}
</div>
</th>
<th class="w-[85px] p-0 text-center hidden xl:table-cell justify-center">
<div class="border-b border-my-gray px-4 py-3 -mb-[2px]">
{{ $t('player.delete') }}
</div>
</th>
</tr>
</thead>
<Sortable
:list="playlistStore.playlist"
item-key="uid"
:style="`height: ${
playlistStore.playlist ? playlistStore.playlist.length * 38 + 38 : 300
}px`"
tag="ul"
tag="tbody"
:options="playlistSortOptions"
@add="cloneClip"
@add="addClip"
@start="addBG"
@end="moveItemInArray"
>
<template #item="{ element, index }">
<li
:id="`clip_${index}`"
class="draggable grid grid-cols-[80px_auto_90px_80px_80px] md:grid-cols-[80px_auto_90px_80px_80px_80px_85px_100px_80px] h-[38px]"
:class="
index === playlistStore.currentClipIndex && listDate === todayDate
? 'bg-lime-500/30'
: 'bg-base-300 even:bg-base-100'
"
<tr
:id="`clip-${index}`"
class="draggable border-t border-b border-base-content/20 duration-1000 transition-all"
:class="{
'!bg-lime-500/30':
playlistStore.playoutIsRunning &&
listDate === todayDate &&
index === playlistStore.currentClipIndex,
}"
:key="element.uid"
>
<div class="px-3 py-2">{{ secondsToTime(element.begin) }}</div>
<div
class="px-3 py-2 truncate"
<td class="ps-4 py-2 text-left">{{ secondsToTime(element.begin) }}</td>
<td
class="py-2 text-left truncate"
:class="{ 'grabbing cursor-grab': width > 768 }"
>
{{ filename(element.source) }}
</div>
<div class="px-3 py-2 text-center">
</td>
<td class="py-2 text-center hover:text-base-content/70">
<button @click=";(showPreviewModal = true), setPreviewData(element.source)">
<i class="bi-play-fill" />
</button>
</div>
<div class="px-3 py-2">{{ secToHMS(element.duration) }}</div>
<div class="px-3 py-2 hidden md:flex">{{ secToHMS(element.in) }}</div>
<div class="px-3 py-2 hidden md:flex">{{ secToHMS(element.out) }}</div>
<div class="px-3 py-[11px] hidden md:flex justify-center">
</td>
<td class="py-2 text-center">{{ secToHMS(element.duration) }}</td>
<td class="py-2 text-center hidden xl:table-cell">
{{ secToHMS(element.in) }}
</td>
<td class="py-2 text-center hidden xl:table-cell">
{{ secToHMS(element.out) }}
</td>
<td class="py-2 text-center hidden xl:table-cell leading-3">
<input
class="checkbox checkbox-xs rounded"
type="checkbox"
@ -164,23 +215,23 @@
"
@change="setCategory($event, element)"
/>
</div>
<div class="px-3 py-2 text-center">
</td>
<td class="py-2 text-center hover:text-base-content/70">
<button @click=";(showSourceModal = true), editPlaylistItem(index)">
<i class="bi-pencil-square" />
</button>
</div>
<div
class="px-3 py-2 text-center hidden md:flex justify-center hover:text-base-content/70"
</td>
<td
class="py-2 text-center hidden xl:table-cell justify-center hover:text-base-content/70"
>
<button @click="deletePlaylistItem(index)">
<i class="bi-x-circle-fill" />
</button>
</div>
</li>
</td>
</tr>
</template>
</Sortable>
</div>
</table>
</div>
</pane>
</splitpanes>
@ -396,22 +447,25 @@ const newSource = ref({
uid: '',
} as PlaylistItem)
onMounted(async () => {
onMounted(() => {
if (!mediaStore.folderTree.parent) {
await mediaStore.getTree('')
mediaStore.getTree('')
}
getPlaylist()
})
watch([listDate, configID], async () => {
watch([configID], () => {
mediaStore.getTree('')
})
watch([listDate], async () => {
await getPlaylist()
})
function scrollTo(index: number) {
const child = document.getElementById(`clip_${index}`)
const parent = document.getElementById('scroll-container')
const child = document.getElementById(`clip-${index}`)
const parent = document.getElementById('playlist-container')
if (child && parent) {
const topPos = child.offsetTop
@ -420,7 +474,7 @@ function scrollTo(index: number) {
}
const calendarFormat = (date: Date) => {
return $dayjs(date).locale(locale.value).format('dddd LL')
return $dayjs(date).locale(locale.value).format('dddd - LL')
}
async function getPlaylist() {
@ -461,9 +515,24 @@ function onFileChange(evt: any) {
textFile.value = files
}
function cloneClip(event: any) {
function addBG(obj: any) {
if (obj.item) {
obj.item.classList.add('!bg-fuchsia-900/30')
} else {
obj.classList.add('!bg-fuchsia-900/30')
}
}
function removeBG(item: any) {
setTimeout(() => {
item.classList.remove('!bg-fuchsia-900/30')
}, 100)
}
function addClip(event: any) {
const o = event.oldIndex
const n = event.newIndex
const uid = genUID()
event.item.remove()
@ -474,7 +543,7 @@ function cloneClip(event: any) {
)
playlistStore.playlist.splice(n, 0, {
uid: genUID(),
uid,
begin: 0,
source: sourcePath,
in: 0,
@ -488,6 +557,12 @@ function cloneClip(event: any) {
playlistStore.playlist,
false
)
nextTick(() => {
const newNode = document.getElementById(`clip-${n}`)
addBG(newNode)
removeBG(newNode)
})
}
function moveItemInArray(event: any) {
@ -499,6 +574,8 @@ function moveItemInArray(event: any) {
playlistStore.playlist,
false
)
removeBG(event.item)
}
function setPreviewData(path: string) {
@ -626,6 +703,7 @@ function loopClips() {
while (length < configStore.playlistLength && playlistStore.playlist.length > 0) {
for (const item of playlistStore.playlist) {
if (length < configStore.playlistLength) {
item.uid = genUID()
tempList.push($_.cloneDeep(item))
length += item.out - item.in
} else {
@ -726,3 +804,24 @@ async function deletePlaylist(del: boolean) {
}
}
</script>
<style>
/*
format dragging element
*/
#playlist-container .sortable-ghost {
background-color: #701a754b !important;
min-height: 37px !important;
height: 37px !important;
}
#playlist-container .sortable-ghost td {
padding-left: 1rem;
padding-right: 1rem;
padding-top: 0.5rem;
padding-bottom: 0.5rem;
}
#playlist-container .sortable-ghost td:nth-last-child(-n+5) {
display: table-cell !important;
}
</style>

View File

@ -10,7 +10,6 @@ export const useMedia = defineStore('media', {
folderList: {} as FolderObject,
folderCrumbs: [] as Crumb[],
isLoading: false,
notExist: useNuxtApp().$i18n.t('media.notExists'),
}),
getters: {},
@ -37,7 +36,7 @@ export const useMedia = defineStore('media', {
if (response.status === 200) {
return response.json()
} else {
indexStore.msgAlert('error', this.notExist, 3)
indexStore.msgAlert('error', useNuxtApp().$i18n.t('media.notExists'), 3)
return {
source: '',

View File

@ -13,7 +13,7 @@ const { processPlaylist } = playlistOperations()
export const usePlaylist = defineStore('playlist', {
state: () => ({
playlist: [] as PlaylistItem[],
isLoading: false,
isLoading: true,
listDate: dayjs().format('YYYY-MM-DD'),
progressValue: 0,
currentClip: '',

View File

@ -10,14 +10,6 @@ module.exports = {
},
colors: {
'my-gray': 'var(--my-gray)',
'my-gray-text': 'var(--my-gray-text)',
'my-text': 'var(--my-text)',
'my-shadow': 'var(--my-shadow)',
'my-shadow-dark': 'var(--my-shadow-dark)',
'my-black': '#141414',
'link-hover': 'var(--link-hover)',
'light-accent': 'var(--light-accent)',
'base-100-odd': 'var(--base-100-odd)',
},
fontFamily: {
sans: ['Source Sans Pro', 'Segoe UI', 'Helvetica Neue', 'Arial', 'sans-serif'],
@ -62,15 +54,12 @@ module.exports = {
'--base-100': '#ffffff',
'--base-200': '#F2F5F7',
'--base-300': '#E5E6E6',
'--base-100-odd': '#ececec',
'--my-accent': '#f28c1b',
'--link-hover': '#f4ae61',
'--my-gray': '#888888',
'--my-gray-text': '#6a6a6a',
'--my-text': '#141414',
'--my-shadow': '#e6e6e6',
'--my-shadow-dark': '#9f9f9f',
'--light-accent': '#9c6a0c',
'--my-purple': '#701a75',
'--my-yellow': '#bea203',
'--my-blue': '#436e9c',
'--my-green': '#68b31e',
},
dark: {
'color-scheme': 'dark',
@ -90,15 +79,12 @@ module.exports = {
'--base-100': '#313131',
'--base-200': '#222222',
'--base-300': '#1c1c1c',
'--base-100-odd': '#3d3d3d',
'--my-accent': '#f28c1b',
'--link-hover': '#f4ae61',
'--my-gray': '#919191',
'--my-gray-text': '#bababa',
'--my-text': '#eeeeee',
'--my-shadow': '#111',
'--my-shadow-dark': '#000',
'--light-accent': '#f1a312',
'--my-purple': '#ad7fa8;',
'--my-yellow': '#e2c317',
'--my-blue': '#6c95c2',
'--my-green': '#8ae234',
},
},
],