Skip to content

A self-hosted media server and file management system

feat: replace components in lyrics editor

aminnausin088630538ec9
diff --git a/resources/css/cedar-base.css b/resources/css/cedar-base.css
index 52ef47a4..c4d98bd5 100644
--- a/resources/css/cedar-base.css
+++ b/resources/css/cedar-base.css
@@ -44,6 +44,26 @@
/* Scrollbar */
+@layer utilities {
+ .scrollbar-hover {
+ scrollbar-width: none;
+ }
+
+ .group:hover .scrollbar-hover {
+ scrollbar-width: var(--width-scrollbar);
+ }
+
+ .scrollable-input {
+ --color-scrollbar-thumb: var(--color-scrollbar-thumb-2);
+ --color-scrollbar-track: var(--color-scrollbar-track-2);
+ }
+
+ .scrollbar-thin {
+ /* --width-scrollbar: thin; */
+ scrollbar-width: var(--width-scrollbar);
+ }
+}
+
/* @layer base {
::-webkit-scrollbar {
width: var(--scrollbar-width);
diff --git a/resources/js/components/cards/data/LrcLibCard.vue b/resources/js/components/cards/data/LrcLibCard.vue
index bf1a56ca..80ec8cce 100644
--- a/resources/js/components/cards/data/LrcLibCard.vue
+++ b/resources/js/components/cards/data/LrcLibCard.vue
@@ -4,13 +4,13 @@ import type { LrcLibResult } from '@/types/types';
import { toFormattedDuration } from '@/service/util';
import { useLyricStore } from '@/stores/LyricStore';
import { storeToRefs } from 'pinia';
+import { ButtonIcon } from '@/components/cedar-ui/button';
import { computed } from 'vue';
-
-import ButtonIcon from '@/components/inputs/ButtonIcon.vue';
-import ChipTag from '@/components/labels/ChipTag.vue';
+import { cn } from '@aminnausin/cedar-ui';
import ProiconsEye from '~icons/proicons/eye';
import PrimeSave from '~icons/prime/save';
+import MediaTag from '@/components/labels/MediaTag.vue';
const { dirtyLyric } = storeToRefs(useLyricStore());
@@ -24,7 +24,7 @@ const tags = computed(() => {
},
{
name: props.data.syncedLyrics ? 'Synced' : 'Plain',
- class: props.data.syncedLyrics ? 'bg-violet-600! dark:bg-white! dark:text-neutral-900 shadow-md' : 'bg-neutral-800! opacity-70',
+ class: props.data.syncedLyrics ? 'bg-primary! dark:bg-white! text-foreground-i!' : '',
},
];
});
@@ -33,43 +33,34 @@ const tags = computed(() => {
<div
:class="[
'relative flex flex-wrap items-center justify-between gap-2',
- 'w-full rounded-lg p-3 shadow-sm transition',
- 'dark:bg-primary-dark-800/70 hover:bg-primary-800 dark:hover:bg-primary-active/70 bg-neutral-50',
- 'text-foreground-1 dark:text-neutral-100',
+ 'w-full rounded-lg p-3 text-sm shadow-sm transition',
+ 'data-card dark:hover:bg-primary-active/70',
`ring-2 ${data.id === dirtyLyric?.id ? 'ring-primary-active/60' : 'ring-transparent dark:ring-neutral-700/20'}`,
]"
>
<section class="flex w-full items-center justify-between gap-2">
- <h3 class="min-w-[30%] flex-1 truncate text-gray-900 dark:text-white" :title="data.trackName">
+ <h3 class="min-w-[30%] flex-1 truncate" :title="data.trackName">
{{ data.trackName }}
</h3>
<ButtonIcon
- class="h-6! w-6! rounded-md p-1! ring-0 transition"
+ class="size-6 bg-transparent p-1 shadow-none ring-transparent"
type="button"
- :variant="'transparent'"
:title="data.id === dirtyLyric?.id ? 'Already Selected' : 'Select'"
:disabled="data.id === dirtyLyric?.id"
@click="$emit('select')"
>
<template #icon>
- <PrimeSave class="h-4 w-4" />
+ <PrimeSave class="size-4" />
</template>
</ButtonIcon>
- <ButtonIcon
- v-if="data.syncedLyrics"
- class="h-6! w-6! rounded-md p-1! ring-0 transition"
- type="button"
- :variant="'transparent'"
- :title="'Preview'"
- @click="$emit('preview')"
- >
+ <ButtonIcon v-if="data.syncedLyrics" class="size-6 bg-transparent p-1 shadow-none ring-transparent" type="button" title="Preview" @click="$emit('preview')">
<template #icon>
- <ProiconsEye class="h-4 w-4" />
+ <ProiconsEye class="size-4" />
</template>
</ButtonIcon>
</section>
- <section class="flex w-full flex-wrap items-start justify-between gap-x-4 gap-y-2 text-sm">
- <span class="flex w-full flex-1 items-center gap-2">
+ <section class="text-foreground-1 flex w-full flex-wrap items-start justify-between gap-x-4 gap-y-2 dark:text-inherit">
+ <div class="flex w-full flex-1 items-center gap-2">
<span class="flex flex-1 gap-1 truncate">
<h4 class="truncate text-start text-nowrap" title="Album">
{{ data.albumName }}
@@ -82,28 +73,32 @@ const tags = computed(() => {
</span>
<span class="hidden max-h-[22px] justify-end gap-1 overflow-clip [overflow-clip-margin:4px] sm:flex">
- <ChipTag
+ <MediaTag
v-for="(tag, index) in tags"
:key="index"
:label="tag.name"
- :textClass="'text-xs'"
- :colour="
- tag.class ??
- 'bg-neutral-200 leading-none text-neutral-500 shadow-sm dark:bg-neutral-900 hover:bg-violet-600 hover:text-neutral-50 dark:hover:bg-violet-600/90'
+ :class="
+ cn(
+ 'flex items-center text-xs',
+ tag.class ??
+ 'hover:bg-primary dark:hover:bg-primary/90 hover:text-foreground-i text-foreground-7 bg-neutral-200 leading-none shadow-sm dark:bg-neutral-900',
+ )
"
/>
</span>
- </span>
+ </div>
- <span class="flex w-full flex-wrap gap-1 overflow-clip [overflow-clip-margin:4px] sm:hidden">
- <ChipTag
+ <span class="flex w-full flex-wrap gap-1 overflow-clip text-xs [overflow-clip-margin:4px] sm:hidden">
+ <MediaTag
v-for="(tag, index) in tags"
:key="index"
:label="tag.name"
- :textClass="'text-xs'"
- :colour="
- tag.class ??
- 'bg-neutral-200 leading-none text-neutral-500 shadow-sm dark:bg-neutral-900 hover:bg-violet-600 hover:text-neutral-50 dark:hover:bg-violet-600/90'
+ :class="
+ cn(
+ 'text-xs',
+ tag.class ??
+ 'hover:bg-primary dark:hover:bg-primary/90 hover:text-foreground-i text-foreground-7 bg-neutral-200 leading-none shadow-sm dark:bg-neutral-900',
+ )
"
/>
</span>
diff --git a/resources/js/components/forms/EditFolder.vue b/resources/js/components/forms/EditFolder.vue
index fd8366bb..a5463fa1 100644
--- a/resources/js/components/forms/EditFolder.vue
+++ b/resources/js/components/forms/EditFolder.vue
@@ -6,6 +6,7 @@ import type { SeriesUpdateRequest } from '@/types/requests';
import { handleStorageURL, toCalendarFormattedDate } from '@/service/util';
import { computed, reactive, ref, watch } from 'vue';
import { useGetAllTags } from '@/service/queries';
+import { FormTextArea } from '@/components/cedar-ui/textarea';
import { UseCreateTag } from '@/service/mutations';
import { toast } from '@aminnausin/cedar-ui';
@@ -13,7 +14,6 @@ import FormInputNumber from '@/components/inputs/FormInputNumber.vue';
import InputMultiChip from '@/components/pinesUI/InputMultiChip.vue';
import FormInputLabel from '@/components/labels/FormInputLabel.vue';
import FormErrorList from '@/components/labels/FormErrorList.vue';
-import FormTextArea from '@/components/inputs/FormTextArea.vue';
import DatePicker from '@/components/pinesUI/DatePicker.vue';
import FormInput from '@/components/inputs/FormInput.vue';
import mediaAPI from '@/service/mediaAPI.ts';
diff --git a/resources/js/components/forms/EditLyrics.vue b/resources/js/components/forms/EditLyrics.vue
index 39b33beb..8699daa1 100644
--- a/resources/js/components/forms/EditLyrics.vue
+++ b/resources/js/components/forms/EditLyrics.vue
@@ -4,24 +4,21 @@ import type { VideoResource } from '@/types/resources';
import type { FormField } from '@/types/types';
import { generateLyricsSearchQuery, updateLyrics } from '@/service/lyricsService';
-import { onMounted, reactive, watch } from 'vue';
+import { computed, onMounted, reactive, watch } from 'vue';
+import { FormInput, FormLabel, FormErrorList } from '@/components/cedar-ui/form';
+import { ButtonForm, ButtonText } from '@/components/cedar-ui/button';
+import { TableLoadingSpinner } from '@/components/cedar-ui/table';
import { toFormattedDuration } from '@/service/util';
import { useLyricStore } from '@/stores/LyricStore';
+import { FormTextArea } from '@/components/cedar-ui/textarea';
import { storeToRefs } from 'pinia';
-import { ButtonForm } from '@/components/cedar-ui/button';
import { toast } from '@aminnausin/cedar-ui';
import FormInputNumber from '@/components/inputs/FormInputNumber.vue';
-import FormInputLabel from '@/components/labels/FormInputLabel.vue';
-import FormErrorList from '@/components/labels/FormErrorList.vue';
-import FormTextArea from '@/components/inputs/FormTextArea.vue';
import LrcLibCard from '@/components/cards/data/LrcLibCard.vue';
import DatePicker from '@/components/pinesUI/DatePicker.vue';
-import FormInput from '@/components/inputs/FormInput.vue';
import useForm from '@/composables/useForm';
-import SvgSpinners90RingWithBg from '~icons/svg-spinners/90-ring-with-bg';
-
const { isLoadingLyrics, stateLyrics, searchResults, hasSearchedForLyrics, dirtyLyric } = storeToRefs(useLyricStore());
const { handlePreviewLyrics, handleSelectLyrics, handleSearchSyncedLyrics, resetLyrics } = useLyricStore();
@@ -83,6 +80,16 @@ const form = useForm<LyricsUpdateRequest>({
album: props.video.metadata?.album ?? '',
});
+const changedMetadata = computed(() => {
+ const changes = {
+ lyrics: !!(props.video.metadata?.lyrics && form.fields.lyrics !== props.video.metadata.lyrics),
+ artist: !!(props.video.metadata?.artist && form.fields.artist !== props.video.metadata.artist),
+ album: !!(props.video.metadata?.album && form.fields.album !== props.video.metadata.album),
+ };
+
+ return { isDirty: changes.lyrics || changes.artist || changes.album, ...changes };
+});
+
const handleSubmit = async () => {
form.submit(
async (fields) => {
@@ -128,8 +135,8 @@ watch(
<template>
<form class="flex flex-col flex-wrap gap-4 text-sm sm:flex-row sm:justify-between" @submit.prevent="handleSubmit">
- <div v-for="(field, index) in fields.filter((field) => !field.disabled)" :key="index" class="w-full text-sm" :class="field.class">
- <FormInputLabel :field="field" />
+ <div v-for="(field, index) in fields.filter((field) => !field.disabled)" :key="index" class="w-full" :class="field.class">
+ <FormLabel :for="field.name" :text="field.text" :subtext="field.subtext" />
<FormInput v-if="field.name === 'duration'" :field="field" v-model="field.value" disabled title="Song Duration" />
<FormTextArea v-else-if="field.type === 'textArea'" v-model="form.fields[field.name]" :field="field" />
<DatePicker v-else-if="field.type === 'date'" v-model="form.fields[field.name]" :field="field" />
@@ -138,77 +145,49 @@ watch(
<FormErrorList :errors="form.errors" :field-name="field.name" />
</div>
- <div class="xs:flex-nowrap flex w-full flex-wrap items-center gap-4">
- <div class="flex flex-wrap items-center gap-2">
- <ButtonForm
- class="focus:ring-primary dark:focus:ring-primary-muted line-clamp-1 overflow-clip rounded-full py-0"
- :disabled="isLoadingLyrics"
- @click="handleSearchSyncedLyrics(generateLyricsSearchQuery(video.metadata, form.fields.track, form.fields.album, form.fields.artist))"
- >
- Search for Lyrics
- </ButtonForm>
- <ButtonForm class="focus:ring-primary dark:focus:ring-primary-muted rounded-full py-0" :disabled="isLoadingLyrics" @click="resetLyrics"> Reset </ButtonForm>
- </div>
- <p class="ml-auto min-w-fit text-nowrap" v-show="hasSearchedForLyrics">Results: {{ searchResults.length }}</p>
+ <div class="xs:*:w-fit xs:flex-row flex w-full flex-col items-center gap-2 *:w-full">
+ <ButtonText
+ class="*:text-center sm:px-3"
+ :disabled="isLoadingLyrics"
+ @click="handleSearchSyncedLyrics(generateLyricsSearchQuery(video.metadata, form.fields.track, form.fields.album, form.fields.artist))"
+ text="Search for Lyrics"
+ title="Search for Lyrics"
+ />
+ <ButtonText :disabled="isLoadingLyrics" @click="resetLyrics" class="*:text-center sm:px-3" text="Reset Lyrics" title="Reset Lyrics" />
+
+ <p class="xs:ml-auto min-w-fit text-center text-nowrap" v-show="hasSearchedForLyrics && searchResults.length">Results: {{ searchResults.length }}</p>
</div>
<div class="flex w-full flex-col gap-2" v-if="isLoadingLyrics || hasSearchedForLyrics || searchResults.length !== 0">
- <div class="flex w-full flex-col gap-2">
- <LrcLibCard v-for="result in searchResults" :key="result.id" :data="result" @preview="handlePreviewLyrics(result)" @select="handleSelectLyrics(result)" />
- <div
- v-if="isLoadingLyrics || (hasSearchedForLyrics && searchResults.length === 0)"
- class="text-foreground-2 col-span-full flex w-full items-center justify-center gap-2 text-center text-sm tracking-wider uppercase"
- >
- <p>{{ isLoadingLyrics ? '...Loading' : 'No Results' }}</p>
- <SvgSpinners90RingWithBg v-show="isLoadingLyrics" class="size-3.5" />
- </div>
- </div>
- <ButtonForm
- v-show="!isLoadingLyrics && !hasSearchedForLyrics && searchResults.length !== 0"
- :class="'mx-auto h-8 rounded-full!'"
- :disabled="isLoadingLyrics"
- @click="handleSearchSyncedLyrics(generateLyricsSearchQuery(video.metadata, form.fields.track, form.fields.album, form.fields.artist))"
- >
- <template #text> show more </template>
- </ButtonForm>
+ <LrcLibCard v-for="result in searchResults" :key="result.id" :data="result" @preview="handlePreviewLyrics(result)" @select="handleSelectLyrics(result)" />
+
+ <TableLoadingSpinner v-if="isLoadingLyrics || (hasSearchedForLyrics && searchResults.length === 0)" :is-loading="isLoadingLyrics" class="text-sm" />
</div>
- <p class="text-danger-2 w-full text-center text-sm dark:text-rose-400" v-if="form.fields.lyrics !== video.metadata?.lyrics && video.metadata?.lyrics">
- Overwriting Existing Lyrics!
- </p>
+ <div class="text-danger-2 w-full text-center dark:text-rose-400" v-if="changedMetadata.isDirty">
+ <p v-show="changedMetadata.lyrics">Overwriting Existing Lyrics!</p>
- <p class="text-danger-2 w-full text-center text-sm dark:text-rose-400" v-if="form.fields.artist !== video.metadata?.artist && video.metadata?.artist">
- Overwriting Existing Artist Name!
- </p>
+ <p v-show="changedMetadata.artist">Overwriting Existing Artist Name!</p>
- <p class="text-danger-2 w-full text-center text-sm dark:text-rose-400" v-if="form.fields.album !== video.metadata?.album && video.metadata?.album">
- Overwriting Existing Album Name!
- </p>
+ <p v-show="changedMetadata.album">Overwriting Existing Album Name!</p>
+ </div>
- <div class="relative flex w-full flex-col-reverse gap-2 sm:flex-row sm:justify-end">
- <button
+ <div class="*:hocus:ring-foreground-0 *:hocus:ring-offset-0 relative mt-4 flex w-full flex-col-reverse gap-2 sm:flex-row sm:justify-end">
+ <ButtonForm
@click="
() => {
$emit('handleFinish');
resetLyrics();
}
"
- type="button"
- class="inline-flex h-10 items-center justify-center rounded-md border px-4 py-2 text-sm font-medium transition-colors focus:outline-hidden dark:border-neutral-600"
- :class="'hover:bg-neutral-100 focus:ring-1 focus:ring-neutral-100 focus:ring-offset-1 dark:hover:bg-neutral-900 dark:focus:ring-neutral-400'"
:disabled="form.processing"
+ variant="reset"
+ class="dark:bg-surface-1"
>
Cancel
- </button>
- <button
- @click="handleSubmit"
- type="button"
- class="inline-flex h-10 items-center justify-center rounded-md border border-transparent px-4 py-2 text-sm font-medium text-white transition-colors focus:outline-hidden"
- :class="'bg-neutral-950 hover:bg-neutral-800 focus:ring-1 focus:ring-violet-900 focus:ring-offset-1 dark:hover:bg-neutral-900'"
- :disabled="form.processing"
- >
- Save Changes
- </button>
+ </ButtonForm>
+
+ <ButtonForm @click="handleSubmit" :disabled="form.processing" variant="submit"> Save Changes </ButtonForm>
</div>
</form>
</template>
diff --git a/resources/js/components/forms/EditVideo.vue b/resources/js/components/forms/EditVideo.vue
index 9e5ef4f2..2f6d439b 100755
--- a/resources/js/components/forms/EditVideo.vue
+++ b/resources/js/components/forms/EditVideo.vue
@@ -6,6 +6,7 @@ import type { MetadataUpdateRequest } from '@/types/requests';
import { computed, reactive, ref, watch } from 'vue';
import { toCalendarFormattedDate } from '@/service/util';
import { useContentStore } from '@/stores/ContentStore';
+import { FormTextArea } from '@/components/cedar-ui/textarea';
import { useGetAllTags } from '@/service/queries';
import { UseCreateTag } from '@/service/mutations';
import { storeToRefs } from 'pinia';
@@ -16,7 +17,6 @@ import FormInputNumber from '@/components/inputs/FormInputNumber.vue';
import InputMultiChip from '@/components/pinesUI/InputMultiChip.vue';
import FormInputLabel from '@/components/labels/FormInputLabel.vue';
import FormErrorList from '@/components/labels/FormErrorList.vue';
-import FormTextArea from '@/components/inputs/FormTextArea.vue';
import DatePicker from '@/components/pinesUI/DatePicker.vue';
import FormInput from '@/components/inputs/FormInput.vue';
import mediaAPI from '@/service/mediaAPI.ts';