Skip to content

A self-hosted media server and file management system

standardise buttons

aminnausin8ecf1f3cbb95
diff --git a/resources/js/components/inputs/ButtonIcon.vue b/resources/js/components/inputs/ButtonIcon.vue
new file mode 100644
index 00000000..403a3354
--- /dev/null
+++ b/resources/js/components/inputs/ButtonIcon.vue
@@ -0,0 +1,6 @@
+<template>
+ <button class="p-2 flex items-center justify-center h-10 w-10 shadow-sm rounded-md cursor-pointer focus:outline-none ring-inset ring-[1px] ring-neutral-200 dark:ring-neutral-700 hocus:ring-[0.125rem] focus:ring-indigo-400 dark:focus:ring-indigo-500 hover:ring-violet-400 hover:dark:ring-violet-700 text-gray-900 dark:text-neutral-100 bg-white dark:bg-neutral-800">
+ <slot name="icon">
+ </slot>
+ </button>
+</template>
\ No newline at end of file
diff --git a/resources/js/components/inputs/ButtonText.vue b/resources/js/components/inputs/ButtonText.vue
new file mode 100644
index 00000000..8411b65f
--- /dev/null
+++ b/resources/js/components/inputs/ButtonText.vue
@@ -0,0 +1,6 @@
+<template>
+ <button class="p-2 flex items-center justify-center h-full shadow-sm rounded-md focus:outline-none cursor-pointer ring-inset ring-[1px] ring-neutral-200 dark:ring-neutral-700 hocus:ring-[0.125rem] focus:ring-indigo-400 dark:focus:ring-indigo-500 hover:ring-violet-400 hover:dark:ring-violet-700 text-gray-900 dark:text-neutral-100 bg-white dark:bg-neutral-800">
+ <slot name="text">
+ </slot>
+ </button>
+</template>
\ No newline at end of file
diff --git a/resources/js/components/video/VideoInfoPanel.vue b/resources/js/components/video/VideoInfoPanel.vue
index d0b5e654..a6fbdbbe 100644
--- a/resources/js/components/video/VideoInfoPanel.vue
+++ b/resources/js/components/video/VideoInfoPanel.vue
@@ -10,10 +10,13 @@ import CircumShare1 from '~icons/circum/share-1';
import { watch } from 'vue';
import { storeToRefs } from 'pinia';
import { useContentStore } from '../../stores/ContentStore';
+import ButtonIcon from '../inputs/ButtonIcon.vue';
+import ButtonText from '../inputs/ButtonText.vue';
const ContentStore = useContentStore();
const { stateVideo } = storeToRefs(ContentStore);
+const { updateVideoData } = ContentStore;
const defaultDescription = `After defeating the
Demon Lord, Himmel the Hero, priest Heiter, dwarf warrior Eisen, and elf mage
@@ -42,7 +45,10 @@ const handlePropsUpdate = () => {
}
const handleVideoDetailsUpdate = (res) => {
- if(res?.data) stateVideo.value = {index: stateVideo.index, ...res.data}
+ if(res?.data){
+ stateVideo.value = {index: stateVideo.value.index, ...res.data}
+ updateVideoData({index: stateVideo.value.index, ...res.data}, stateVideo.value.index);
+ }
editModal.toggleModal(false);
}
@@ -75,13 +81,24 @@ watch(() => stateVideo.value, handlePropsUpdate, { immediate: true, deep: true }
class="container flex sm:w-auto sm:flex-col justify-between lg:min-w-32 items-center sm:items-end gap-3 flex-wrap flex-1 w-full"
role="group">
<section class="flex gap-2">
- <button aria-label="edit details" title="Edit Video Details" @click="editModal.toggleModal()"
- class="p-2 bg-button-100 dark:bg-button-900 rounded-lg ring-violet-500 hover:ring-violet-700 hover:bg-violet-400/50 ring-[0.125rem] ring-inset shadow">Edit
- Details</button>
- <button aria-label="share" title="Share Video" @click="shareModal.toggleModal()"
+ <ButtonText aria-label="edit details" title="Edit Video Details" @click="editModal.toggleModal()">
+ <template #text>
+ Edit Details
+ </template>
+ </ButtonText>
+ <!-- <button
+ class="p-2 bg-button-100 dark:bg-button-900 rounded-lg ring-violet-500 hover:ring-violet-700 hover:bg-violet-400/50 ring-[0.125rem] ring-inset shadow">
+ Edit Details
+ </button> -->
+ <!-- <button aria-label="share" title="Share Video" @click="shareModal.toggleModal()"
class="p-2 bg-button-100 dark:bg-button-900 rounded-lg ring-neutral-700 hover:ring-violet-700 hover:bg-violet-400/50 dark:ring-[0.125rem] hover:ring-[0.125rem] ring-inset shadow">
<CircumShare1 height="24" width="24" />
- </button>
+ </button> -->
+ <ButtonIcon aria-label="share" title="Share Video" @click="shareModal.toggleModal()">
+ <template #icon>
+ <CircumShare1 height="24" width="24" />
+ </template>
+ </ButtonIcon>
</section>
<section
class="flex gap flex-col items-end text-sm dark:text-slate-400 text-slate-500 justify-between max-w-full">
diff --git a/resources/js/components/video/VideoTable.vue b/resources/js/components/video/VideoTable.vue
index d4bef1e5..b42999b5 100644
--- a/resources/js/components/video/VideoTable.vue
+++ b/resources/js/components/video/VideoTable.vue
@@ -11,6 +11,7 @@ import PhSortDescendingLight from '~icons/ph/sort-descending-light';
import { useContentStore } from '../../stores/ContentStore';
import { storeToRefs } from 'pinia';
import { computed, ref, watch } from 'vue';
+import ButtonIcon from '../inputs/ButtonIcon.vue';
const ContentStore = useContentStore();
@@ -37,9 +38,9 @@ const handlePageReset = () => {
};
const handleSortChange = (sortKey) => {
- if(sortKey?.value) lastSortKey.value = sortKey?.value;
+ if (sortKey?.value) lastSortKey.value = sortKey?.value;
- if(!lastSortKey.value) return;
+ if (!lastSortKey.value) return;
playlistSort(lastSortKey.value, sortAscending.value ? 1 : -1)
}
@@ -92,14 +93,16 @@ watch(stateFolder, handlePageReset, { immediate: true })
:id="'table-search'" class="w-full sm:w-80" />
<span class="flex items-end gap-2">
<div class="flex gap-2 flex-col w-full sm:w-40">
- <FormInputLabel :field="{name: 'sort', text: 'Sort by:'}"/>
- <InputSelect :placeholder="'None'" :options="sortingOptions" :label="'Sort by:'" class="w-full" @selectItem="handleSortChange" :defaultItem="0"/>
+ <FormInputLabel :field="{ name: 'sort', text: 'Sort by:' }" />
+ <InputSelect :placeholder="'None'" :options="sortingOptions" :label="'Sort by:'" class="w-full"
+ @selectItem="handleSortChange" :defaultItem="0" />
</div>
- <button @click="sortAscending = !sortAscending; handleSortChange()"
- class="flex items-center justify-center h-10 w-10 shadow-sm rounded-md border cursor-pointer focus:border-none focus:ring-2 focus:ring-indigo-400 dark:focus:ring-indigo-500 text-gray-900 dark:text-neutral-100 border-neutral-200/70 bg-white dark:bg-neutral-800 text-sm">
- <PhSortAscendingLight v-if="sortAscending" width="24" height="24"/>
- <PhSortDescendingLight v-else width="24" height="24"/>
- </button>
+ <ButtonIcon @click="sortAscending = !sortAscending; handleSortChange()">
+ <template #icon>
+ <PhSortAscendingLight v-if="sortAscending" width="24" height="24" />
+ <PhSortDescendingLight v-else width="24" height="24" />
+ </template>
+ </ButtonIcon>
</span>
</section>
<hr>
diff --git a/resources/js/composables/useMetaData.js b/resources/js/composables/useMetaData.js
index 6998e423..9e0964cd 100644
--- a/resources/js/composables/useMetaData.js
+++ b/resources/js/composables/useMetaData.js
@@ -19,7 +19,7 @@ export default function useMetaData(data) {
this.fields.title = props?.title ?? props?.name,
this.fields.duration = toFormattedDuration(props?.duration) ?? 'N/A',
this.fields.views = props?.view_count ? `${props?.view_count} View${props?.view_count !== 1 ? 's' : ''}` : '0 Views',
- this.fields.description = props.description ?? '',
+ this.fields.description = props?.description ?? '',
this.fields.url = document.location.origin + route.path + `?video=${props.id}`
}
});