Skip to content

A self-hosted media server and file management system

feat: generalise modal better

aminnausineaf478b2e95e
diff --git a/resources/js/components/dashboard/DashboardLibraries.vue b/resources/js/components/dashboard/DashboardLibraries.vue
index 828c73e8..52b7b9ea 100644
--- a/resources/js/components/dashboard/DashboardLibraries.vue
+++ b/resources/js/components/dashboard/DashboardLibraries.vue
@@ -271,17 +271,11 @@ onMounted(() => {});
/>
</section>
<ModalBase :modalData="confirmModal" :action="submitDelete">
- <template #content>
- <div class="relative w-auto pb-8">
- <p>Are you sure you want to delete this Library?</p>
- </div>
- </template>
+ <template #description> Are you sure you want to delete this Library? </template>
</ModalBase>
<ModalBase :modalData="editFolderModal" :useControls="false">
<template #content>
- <div class="pt-2">
- <EditFolder v-if="cachedFolder" :folder="cachedFolder" @handleFinish="handleSeriesUpdate" />
- </div>
+ <EditFolder v-if="cachedFolder" :folder="cachedFolder" @handleFinish="handleSeriesUpdate" />
</template>
</ModalBase>
</template>
diff --git a/resources/js/components/dashboard/DashboardLibraryFolders.vue b/resources/js/components/dashboard/DashboardLibraryFolders.vue
index 5b101723..8206a3a1 100644
--- a/resources/js/components/dashboard/DashboardLibraryFolders.vue
+++ b/resources/js/components/dashboard/DashboardLibraryFolders.vue
@@ -112,9 +112,7 @@ onMounted(() => {
/>
<ModalBase :modalData="editFolderModal" :useControls="false">
<template #content>
- <div class="pt-2">
- <EditFolder v-if="cachedFolder" :folder="cachedFolder" @handleFinish="handleSeriesUpdate" />
- </div>
+ <EditFolder v-if="cachedFolder" :folder="cachedFolder" @handleFinish="handleSeriesUpdate" />
</template>
</ModalBase>
</template>
diff --git a/resources/js/components/dashboard/DashboardTasks.vue b/resources/js/components/dashboard/DashboardTasks.vue
index 87c55475..e6da9849 100644
--- a/resources/js/components/dashboard/DashboardTasks.vue
+++ b/resources/js/components/dashboard/DashboardTasks.vue
@@ -255,17 +255,9 @@ onUnmounted(async () => {
/>
</section>
<ModalBase :modalData="cancelModal" :action="submitCancel">
- <template #content>
- <div class="relative w-auto pb-8">
- <p>Are you sure you want to cancel this task and all of its sub tasks?</p>
- </div>
- </template>
+ <template #description> Are you sure you want to cancel this task and all of its sub tasks? </template>
</ModalBase>
<ModalBase :modalData="deleteModal" :action="submitDelete">
- <template #content>
- <div class="relative w-auto pb-8">
- <p>Are you sure you want to delete this task and all of its sub tasks?</p>
- </div>
- </template>
+ <template #description>Are you sure you want to delete this task and all of its sub tasks? </template>
</ModalBase>
</template>
diff --git a/resources/js/components/dashboard/DashboardUsers.vue b/resources/js/components/dashboard/DashboardUsers.vue
index e392f0c6..c253625d 100644
--- a/resources/js/components/dashboard/DashboardUsers.vue
+++ b/resources/js/components/dashboard/DashboardUsers.vue
@@ -163,10 +163,6 @@ onMounted(() => {
/>
</section>
<ModalBase :modalData="confirmModal" :action="submitDelete">
- <template #content>
- <div class="relative w-auto pb-8">
- <p>Are you sure you want to remove this user?</p>
- </div>
- </template>
+ <template #description> Are you sure you want to remove this user? </template>
</ModalBase>
</template>
diff --git a/resources/js/components/panels/VideoSidebar.vue b/resources/js/components/panels/VideoSidebar.vue
index 06b1d463..48beaa16 100755
--- a/resources/js/components/panels/VideoSidebar.vue
+++ b/resources/js/components/panels/VideoSidebar.vue
@@ -99,18 +99,14 @@ watch(
<h3 v-show="stateRecords.length < 1" class="text-gray-500 dark:text-gray-400 tracking-wider w-full py-2">Nothing Yet...</h3>
</section>
<ModalBase :modalData="shareModal">
- <template #content>
- <div class="pb-2">Copy link to clipboard to share it.</div>
- </template>
+ <template #description> Copy link to clipboard to share it.</template>
<template #controls>
<ButtonClipboard :text="shareLink" />
</template>
</ModalBase>
<ModalBase :modalData="editFolderModal" :useControls="false">
<template #content>
- <div class="pt-2">
- <EditFolder v-if="cachedFolder" :folder="cachedFolder" @handleFinish="handleSeriesUpdate" />
- </div>
+ <EditFolder v-if="cachedFolder" :folder="cachedFolder" @handleFinish="handleSeriesUpdate" />
</template>
</ModalBase>
</div>
diff --git a/resources/js/components/pinesUI/ModalBase.vue b/resources/js/components/pinesUI/ModalBase.vue
index 19f4b245..daff17c9 100755
--- a/resources/js/components/pinesUI/ModalBase.vue
+++ b/resources/js/components/pinesUI/ModalBase.vue
@@ -1,10 +1,11 @@
<script setup lang="ts">
+import { ref, useTemplateRef, watch } from 'vue';
import { OnClickOutside } from '@vueuse/components';
import { UseFocusTrap } from '@vueuse/integrations/useFocusTrap/component';
import { useAppStore } from '@/stores/AppStore';
-import { ref, useTemplateRef, watch } from 'vue';
import ButtonCorner from '@/components/inputs/ButtonCorner.vue';
+import ButtonForm from '@/components/inputs/ButtonForm.vue';
const props = withDefaults(
defineProps<{
@@ -70,39 +71,24 @@ watch(
<OnClickOutside
@trigger="modalData.toggleModal(false)"
@keydown.esc="modalData.toggleModal(false)"
- class="drop-shadow-md m-auto w-full p-6 bg-white dark:bg-neutral-800/90 backdrop-blur-lg border shadow-lg border-neutral-200 dark:border-neutral-700 sm:max-w-lg xl:max-w-xl 3xl:max-w-2xl rounded-md sm:rounded-lg"
+ class="gap-4 flex flex-col drop-shadow-md m-auto w-full p-6 bg-white dark:bg-neutral-800/90 backdrop-blur-lg border shadow-lg border-neutral-200 dark:border-neutral-700 sm:max-w-lg xl:max-w-xl 3xl:max-w-2xl rounded-md sm:rounded-lg"
tabindex="-1"
>
- <div class="flex items-center justify-between pb-3">
- <h3 ref="modalTitle" class="text-xl font-semibold scroll-mt-16 sm:scroll-mt-12 me-8">{{ modalData?.title ?? 'Modal Title' }}</h3>
- <ButtonCorner @click="modalData.toggleModal(false)" />
- </div>
- <slot name="content">
- <div class="relative w-auto pb-8">
- <p>This is placeholder text. Replace it with your own content.</p>
- </div>
- </slot>
+ <section class="flex flex-wrap gap-2 items-center">
+ <h3 ref="modalTitle" class="text-xl font-semibold scroll-mt-16 sm:scroll-mt-12 flex-1">{{ modalData?.title ?? 'Modal Title' }}</h3>
+ <ButtonCorner @click="modalData.toggleModal(false)" class="!m-0 !static" />
+ <p class="text-neutral-500 dark:text-neutral-400 text-sm w-full" v-if="$slots.description">
+ <slot name="description"> </slot>
+ </p>
+ </section>
+ <slot name="content"> </slot>
<slot v-if="useControls" name="controls">
- <div class="relative flex flex-col-reverse sm:flex-row sm:justify-end gap-2">
- <button
- @click="modalData.toggleModal(false)"
- type="button"
- class="inline-flex items-center justify-center h-10 px-4 py-2 text-sm font-medium transition-colors border dark:border-neutral-600 rounded-md focus:outline-none"
- :class="'focus:ring-1 focus:ring-neutral-100 dark:focus:ring-neutral-400 focus:ring-offset-1 hover:bg-neutral-100 dark:hover:bg-neutral-900'"
- :disabled="processing || isProcessing"
- >
- Cancel
- </button>
- <button
- @click="submitModal(action, modalData)"
- type="button"
- class="inline-flex items-center justify-center h-10 px-4 py-2 text-sm font-medium text-white transition-colors border border-transparent rounded-md focus:outline-none"
- :class="'focus:ring-1 focus:ring-violet-900 focus:ring-offset-1 bg-neutral-950 hover:bg-neutral-800 dark:hover:bg-neutral-900 '"
- :disabled="processing || isProcessing"
- >
+ <section class="relative flex flex-col-reverse sm:flex-row sm:justify-end gap-2">
+ <ButtonForm type="button" variant="reset" @click="modalData.toggleModal(false)" :disabled="processing || isProcessing"> Cancel </ButtonForm>
+ <ButtonForm type="button" variant="submit" @click="submitModal(action, modalData)" :disabled="processing || isProcessing">
{{ modalData.submitText }}
- </button>
- </div>
+ </ButtonForm>
+ </section>
</slot>
</OnClickOutside>
</UseFocusTrap>
diff --git a/resources/js/components/video/VideoInfoPanel.vue b/resources/js/components/video/VideoInfoPanel.vue
index 10d034c4..e5b1c3e7 100755
--- a/resources/js/components/video/VideoInfoPanel.vue
+++ b/resources/js/components/video/VideoInfoPanel.vue
@@ -263,22 +263,17 @@ watch(
</section>
<ModalBase :modalData="editFolderModal" :useControls="false">
<template #content>
- <div class="pt-2">
- <EditFolder :folder="stateFolder" @handleFinish="handleSeriesUpdate" />
- </div>
+ <EditFolder :folder="stateFolder" @handleFinish="handleSeriesUpdate" />
</template>
</ModalBase>
<ModalBase :modalData="editVideoModal" :useControls="false">
<template #content>
- <div class="pt-2">
- <EditVideo :video="stateVideo" @handleFinish="handleVideoDetailsUpdate" />
- </div>
+ <EditVideo :video="stateVideo" @handleFinish="handleVideoDetailsUpdate" />
</template>
</ModalBase>
<ModalBase :modalData="shareVideoModal">
- <template #content>
- <div class="py-3">Copy link to clipboard to share it.</div>
- </template>
+ <template #description> Copy link to clipboard to share it.</template>
+
<template #controls>
<ButtonClipboard :text="videoURL" />
</template>
diff --git a/resources/js/components/video/VideoLyrics.vue b/resources/js/components/video/VideoLyrics.vue
index b9aeb89b..83ffb7c8 100644
--- a/resources/js/components/video/VideoLyrics.vue
+++ b/resources/js/components/video/VideoLyrics.vue
@@ -222,9 +222,7 @@ watch(() => stateVideo.value, resetComponent);
</div>
<ModalBase :modalData="editLyricsModal" :useControls="false">
<template #content>
- <div class="pt-2">
- <EditLyrics :video="stateVideo" @handleFinish="handleLyricsUpdated" />
- </div>
+ <EditLyrics :video="stateVideo" @handleFinish="handleLyricsUpdated" />
</template>
</ModalBase>
</template>
diff --git a/resources/js/views/HistoryView.vue b/resources/js/views/HistoryView.vue
index ed194d24..9bec79d5 100755
--- a/resources/js/views/HistoryView.vue
+++ b/resources/js/views/HistoryView.vue
@@ -106,11 +106,7 @@ onMounted(() => {
/>
</section>
<ModalBase :modalData="confirmModal" :action="submitDelete">
- <template #content>
- <div class="relative w-auto pb-8">
- <p>Are you sure you want to delete this record?</p>
- </div>
- </template>
+ <template #description> Are you sure you want to delete this record? </template>
</ModalBase>
</template>
<template v-slot:sidebar>
diff --git a/resources/js/views/VideoView.vue b/resources/js/views/VideoView.vue
index 0d0be58a..4070ae3e 100755
--- a/resources/js/views/VideoView.vue
+++ b/resources/js/views/VideoView.vue
@@ -210,15 +210,11 @@ watch(() => stateVideo.value, setVideoAsDocumentTitle, { immediate: true });
<ModalBase :modalData="editVideoModal" :useControls="false">
<template #content>
- <div class="pt-2">
- <EditVideo v-if="cachedVideo" :video="cachedVideo" @handleFinish="handleVideoDetailsUpdate" />
- </div>
+ <EditVideo v-if="cachedVideo" :video="cachedVideo" @handleFinish="handleVideoDetailsUpdate" />
</template>
</ModalBase>
<ModalBase :modalData="shareVideoModal">
- <template #content>
- <div class="py-3">Copy link to clipboard to share it.</div>
- </template>
+ <template #description> Copy link to clipboard to share it.</template>
<template #controls>
<ButtonClipboard :text="cachedVideoUrl" />
</template>