A self-hosted media server and file management system
Vue ffmpegfile-serverjellyfinlaravelmediamedia-playermedia-servermediabrowsermediaservermusicmusic-librarymusic-playermusicplayerself-hostedvuejs
fix: code smells
aminnausin8fd23777acd8
diff --git a/resources/js/components/cards/data/LibraryCard.vue b/resources/js/components/cards/data/LibraryCard.vueindex 9056effc..56ed6746 100644--- a/resources/js/components/cards/data/LibraryCard.vue+++ b/resources/js/components/cards/data/LibraryCard.vue@@ -31,20 +31,19 @@ const handleSetDefaultFolder = async (newFolder: { value: number }) => {try {processing.value = true;- const res = await updateCategory(props.data.id, { default_folder_id: newFolder.value });+ await updateCategory(props.data.id, { default_folder_id: newFolder.value });- if (res?.status !== 403) toast('Default Folder Updated', { type: 'success' });- else {- toast('Unable to set Default Folder', { type: 'danger' });- }await queryClient.invalidateQueries({queryKey: ['categories'],});+ toast.success(`Default folder set to ${defaultFolder.value?.title}.`);+processing.value = false;} catch (error) {console.log(error);- toast('Update Failed', { type: 'danger' });+ toast('Unable to set Default Folder', { type: 'danger', description: `${error}` });+processing.value = false;}};@@ -73,18 +72,13 @@ const handleTogglePrivacy = async (id: number, currentValue: boolean) => {try {processing.value = true;- const res = await toggleCategoryPrivacy(id, !currentValue);-- if (res?.status !== 403) toast.success(`Library set to ${currentValue ? 'Public' : 'Private'}.`);- else {- toast.error('You do not have permission to set the privacy of libraries.');- }-+ await toggleCategoryPrivacy(id, !currentValue);await queryClient.invalidateQueries({ queryKey: ['categories'] });+ toast.success(`Library set to ${currentValue ? 'Public' : 'Private'}.`);processing.value = false;} catch (error) {- toast('Failure', { type: 'danger', description: `Unable to set privacy.` });+ toast('Failure', { type: 'danger', description: 'Unable to set privacy. You may not have permission to set the privacy of libraries.' });console.error(error);processing.value = false;}@@ -120,7 +114,7 @@ watch(<span class="flex gap-2 text-sm *:h-6"><BasePopover popoverClass="max-w-56! rounded-lg mt-8" :buttonClass="'p-1! ml-auto'" ref="popover"><template #buttonIcon>- <ProiconsMoreVertical class="h-4 w-4" />+ <ProiconsMoreVertical class="size-4" /></template><template #content><LibraryCardMenudiff --git a/resources/js/components/cards/pulse/PulseSlowOutgoingRequests.vue b/resources/js/components/cards/pulse/PulseSlowOutgoingRequests.vueindex ff29695e..1b336cf8 100644--- a/resources/js/components/cards/pulse/PulseSlowOutgoingRequests.vue+++ b/resources/js/components/cards/pulse/PulseSlowOutgoingRequests.vue@@ -128,7 +128,7 @@ function getDomainFromUrl(input: string): string | null {v-if="getDomainFromUrl(slowRequest.uri)":src="`https://unavatar.io/${getDomainFromUrl(slowRequest.uri)}?fallback=false`"loading="lazy"- class="mr-2 h-4 w-4"+ class="mr-2 size-4"onerror="this.style.display='none'"alt="URL favicon"/>diff --git a/resources/js/components/cedar-ui/button/ButtonBase.vue b/resources/js/components/cedar-ui/button/ButtonBase.vueindex f10a530d..5fa61d83 100644--- a/resources/js/components/cedar-ui/button/ButtonBase.vue+++ b/resources/js/components/cedar-ui/button/ButtonBase.vue@@ -27,7 +27,12 @@ const props = withDefaults(},);-const wrapper = computed(() => props.as ?? (props.to ? RouterLink : props.href ? 'a' : 'button')); // Component is set here but props are set 1 level above+const wrapper = computed(() => {+ if (props.as) return props.as;+ if (props.to) return RouterLink;+ if (props.href) return 'a';+ return 'button';+}); // Component is set here but props are set 1 level aboveconst wrapperProps = computed(() => (props.to ? { to: props.to } : { href: props.href }));defineExpose({diff --git a/resources/js/components/cedar-ui/dropdown-menu/DropdownItem.vue b/resources/js/components/cedar-ui/dropdown-menu/DropdownItem.vueindex ee618a73..98a62e6f 100644--- a/resources/js/components/cedar-ui/dropdown-menu/DropdownItem.vue+++ b/resources/js/components/cedar-ui/dropdown-menu/DropdownItem.vue@@ -22,12 +22,12 @@ const wrapperProps = computed(() => {<ButtonBaserole="menuitem"v-bind="wrapperProps"- :class="['hover:bg-overlay-accent relative w-full rounded px-2 py-1.5 text-sm select-none', { 'text-primary dark:text-primary-muted font-bold': selected }]"+ :class="['hover:bg-overlay-accent relative w-full rounded-sm px-2 py-1.5 text-sm select-none', { 'text-primary dark:text-primary-muted font-bold': selected }]":disabled="disabled":title="linkData.title"><slot name="icon">- <span class="mr-2 h-4 w-4"></span>+ <span class="size-4"></span></slot><span class="mr-auto text-nowrap">diff --git a/resources/js/components/cedar-ui/dropdown-menu/DropdownMenu.vue b/resources/js/components/cedar-ui/dropdown-menu/DropdownMenu.vueindex c72847ab..24aa154c 100644--- a/resources/js/components/cedar-ui/dropdown-menu/DropdownMenu.vue+++ b/resources/js/components/cedar-ui/dropdown-menu/DropdownMenu.vue@@ -88,7 +88,7 @@ onUnmounted(() => {"><template #icon>- <component :is="item.icon" :class="['mr-2 size-4', item.iconStrokeWidth ? `[&>*]:stroke-[${item.iconStrokeWidth}]` : '']" />+ <component :is="item.icon" :class="['size-4', item.iconStrokeWidth ? `[&>*]:stroke-[${item.iconStrokeWidth}]` : '']" /></template></DropdownItem></section>diff --git a/resources/js/components/cedar-ui/select/InputSelect.vue b/resources/js/components/cedar-ui/select/InputSelect.vueindex 898abd46..65b00316 100644--- a/resources/js/components/cedar-ui/select/InputSelect.vue+++ b/resources/js/components/cedar-ui/select/InputSelect.vue@@ -1,6 +1,6 @@<script setup lang="ts">// Needs to be converted to TypeScript and use library elements but this is a lot of work-import type { SelectItem, SelectProps } from '@aminnausin/cedar-ui';+import type { SelectProps } from '@aminnausin/cedar-ui';import { onMounted, ref, useTemplateRef, watch } from 'vue';import { CedarCheckMark, CedarChevronUpDown } from '../icons';diff --git a/resources/js/components/cedar-ui/toast/ToastNotification.vue b/resources/js/components/cedar-ui/toast/ToastNotification.vueindex 65327dda..9d4cfc5d 100644--- a/resources/js/components/cedar-ui/toast/ToastNotification.vue+++ b/resources/js/components/cedar-ui/toast/ToastNotification.vue@@ -220,7 +220,7 @@ onBeforeUnmount(() => {@reference '../../../../css/app.css';.toast-icon {- @apply size-4 shrink-0;+ @apply -mt-0.5 size-4 shrink-0;}.toast {diff --git a/resources/js/components/video/VideoInfoPanel.vue b/resources/js/components/video/VideoInfoPanel.vueindex 1e701093..24b5a3b1 100755--- a/resources/js/components/video/VideoInfoPanel.vue+++ b/resources/js/components/video/VideoInfoPanel.vue@@ -126,7 +126,7 @@ onMounted(() => {ref="popover"><template #buttonIcon>- <ProiconsMoreVertical class="h-4 w-4" />+ <ProiconsMoreVertical class="size-4" /></template><template #content><ContextMenuItem@@ -287,7 +287,7 @@ onMounted(() => {<HoverCard :content="`You have viewed this ${personalViewCount} time${personalViewCount == 1 ? '' : 's'}`"><template #trigger>- <ProiconsEye class="h-4 w-4 scale-90 transition-all hover:scale-100 hover:text-neutral-400 dark:hover:text-white" v-if="personalViewCount > 0" />+ <ProiconsEye class="size-4 scale-90 transition-all hover:scale-100 hover:text-neutral-400 dark:hover:text-white" v-if="personalViewCount > 0" /></template></HoverCard><template v-if="stateVideo?.metadata?.resolution_height">diff --git a/resources/js/components/video/VideoPartyPanel.vue b/resources/js/components/video/VideoPartyPanel.vueindex b74f616e..ecb37bff 100644--- a/resources/js/components/video/VideoPartyPanel.vue+++ b/resources/js/components/video/VideoPartyPanel.vue@@ -53,7 +53,7 @@ const handleKickUser = (id: number) => {title="Watch Party"><template #buttonIcon>- <ProiconsEye class="h-4 w-4" />+ <ProiconsEye class="size-4" /><p>{{ 1 + partyUsers.length }}</p></template><template #content>diff --git a/resources/js/components/video/VideoPopover.vue b/resources/js/components/video/VideoPopover.vueindex cdaaaec2..c0910755 100644--- a/resources/js/components/video/VideoPopover.vue+++ b/resources/js/components/video/VideoPopover.vue@@ -110,7 +110,7 @@ onUnmounted(() => {><template #icon><slot name="buttonIcon">- <svg class="h-4 w-4" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">+ <svg class="size-4" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg"><pathd="M5.5 3C4.67157 3 4 3.67157 4 4.5C4 5.32843 4.67157 6 5.5 6C6.32843 6 7 5.32843 7 4.5C7 3.67157 6.32843 3 5.5 3ZM3 5C3.01671 5 3.03323 4.99918 3.04952 4.99758C3.28022 6.1399 4.28967 7 5.5 7C6.71033 7 7.71978 6.1399 7.95048 4.99758C7.96677 4.99918 7.98329 5 8 5H13.5C13.7761 5 14 4.77614 14 4.5C14 4.22386 13.7761 4 13.5 4H8C7.98329 4 7.96677 4.00082 7.95048 4.00242C7.71978 2.86009 6.71033 2 5.5 2C4.28967 2 3.28022 2.86009 3.04952 4.00242C3.03323 4.00082 3.01671 4 3 4H1.5C1.22386 4 1 4.22386 1 4.5C1 4.77614 1.22386 5 1.5 5H3ZM11.9505 10.9976C11.7198 12.1399 10.7103 13 9.5 13C8.28967 13 7.28022 12.1399 7.04952 10.9976C7.03323 10.9992 7.01671 11 7 11H1.5C1.22386 11 1 10.7761 1 10.5C1 10.2239 1.22386 10 1.5 10H7C7.01671 10 7.03323 10.0008 7.04952 10.0024C7.28022 8.8601 8.28967 8 9.5 8C10.7103 8 11.7198 8.8601 11.9505 10.0024C11.9668 10.0008 11.9833 10 12 10H13.5C13.7761 10 14 10.2239 14 10.5C14 10.7761 13.7761 11 13.5 11H12C11.9833 11 11.9668 10.9992 11.9505 10.9976ZM8 10.5C8 9.67157 8.67157 9 9.5 9C10.3284 9 11 9.67157 11 10.5C11 11.3284 10.3284 12 9.5 12C8.67157 12 8 11.3284 8 10.5Z"fill="currentColor"diff --git a/resources/js/components/video/VideoPopoverSlider.vue b/resources/js/components/video/VideoPopoverSlider.vueindex 3436220f..00404820 100644--- a/resources/js/components/video/VideoPopoverSlider.vue+++ b/resources/js/components/video/VideoPopoverSlider.vue@@ -12,7 +12,7 @@ const model = defineModel();@wheel="wheelAction"v-show="!hidden">- <component v-if="icon" :is="icon" class="mr-2 h-4 w-4 shrink-0" />+ <component v-if="icon" :is="icon" class="mr-2 size-4 shrink-0" /><span class="text-nowrap">{{ text }}</span><span class="ml-auto text-xs tracking-wide opacity-60">{{ shortcut ?? '' }}</span>