Skip to content

A self-hosted media server and file management system

Fix video card id was not reactive

aminnausinb85cb2a9b33d
diff --git a/resources/js/components/VideoCard.vue b/resources/js/components/VideoCard.vue
deleted file mode 100644
index 6bcf6c30..00000000
--- a/resources/js/components/VideoCard.vue
+++ /dev/null
@@ -1,25 +0,0 @@
-<script setup>
- import { toFormattedDate } from '../service/util';
- const { video, index, currentID = -1 } = defineProps(['video', 'index', 'currentID']);
- const rawDate = new Date(video.attributes.date + ' GMT');
- const emit = defineEmits(['playByID']);
-
- const handlePlay = () => {
- // console.log(`handlePlay ${currentID} ${video.id}`);
- // if(currentID.id !== video.id) emit('playByID', video.id);
- emit('playByID', video.id);
- }
-</script>
-
-<template>
- <tr :class="{ 'ring-violet-600/50 ring': (currentID === video.id)}" class="vid-row w-full rounded-md dark:bg-neutral-800 dark:hover:bg-indigo-900 bg-violet-100 hover:bg-violet-300 p-3 flex ring-inset" :data-id="video.id" :data-path="`../${video.attributes.path}`" @click="handlePlay">
- <td class="flex gap-12 w-full">
- <span class="vid-row-title truncate min-w-48">{{ video.attributes.name }}</span>
- <span class="vid-row-duration truncate">20m 30s</span>
- </td>
- <td class="flex gap-12 w-full justify-end">
- <span class="vid-row-title">{{ currentID === video.id }} {{ index }}</span>
- <span class="vid-row-date truncate overflow-hidden min-w-36">{{ toFormattedDate(rawDate) }}</span>
- </td>
- </tr>
-</template>
\ No newline at end of file
diff --git a/resources/js/components/cards/VideoCard.vue b/resources/js/components/cards/VideoCard.vue
new file mode 100644
index 00000000..9a35ede9
--- /dev/null
+++ b/resources/js/components/cards/VideoCard.vue
@@ -0,0 +1,29 @@
+<script setup>
+import { toFormattedDate } from '../../service/util';
+
+
+const props = defineProps(['video', 'index', 'currentID']);
+const rawDate = new Date(props.video.attributes.date + ' GMT');
+
+const emit = defineEmits(['playByID']);
+const handlePlay = () => {
+ // console.log(`handlePlay ${currentID} ${video.id}`);
+ // if(currentID.id !== video.id) emit('playByID', video.id);
+ emit('playByID', props.video.id);
+}
+</script>
+
+<template>
+ <tr :class="{ 'ring-violet-600/50 ring': (props.currentID === props.video.id) }"
+ class="vid-row w-full rounded-md dark:bg-neutral-800 dark:hover:bg-indigo-900 bg-violet-100 hover:bg-violet-300 odd:bg-violet-200 hover:odd:bg-violet-300 dark:odd:bg-zinc-700 dark:hover:odd:bg-indigo-900 p-3 flex ring-inset flex-wrap flex-col sm:flex-row sm:flex-nowrap"
+ :data-id="props.video.id" :data-path="`../${props.video.attributes.path}`" @click="handlePlay">
+ <td class="flex gap-12 w-full">
+ <span class="vid-row-title truncate xl:min-w-48">{{ props.video.attributes.name }}</span>
+ <span class="vid-row-duration truncate hidden sm:block">20m 30s</span>
+ </td>
+ <td class="flex gap-12 w-full sm:justify-end">
+ <span class="vid-row-title hidden sm:block">{{ currentID === props.video.id }} {{ index }}</span>
+ <span class="vid-row-date truncate overflow-hidden xl:min-w-36">{{ toFormattedDate(rawDate) }}</span>
+ </td>
+ </tr>
+</template>
\ No newline at end of file