Skip to content

A self-hosted media server and file management system

chore: low severity code smells

aminnausin08c016197573
diff --git a/resources/js/app.ts b/resources/js/app.ts
index e3a4c661..01a6eb2c 100644
--- a/resources/js/app.ts
+++ b/resources/js/app.ts
@@ -6,13 +6,11 @@ import { createApp } from 'vue';
import router from './router';
import App from './App.vue';
-// import toastService from './service/toaster/toastService.ts';
const application = createApp(App);
const pinia = createPinia();
application.use(router);
application.use(pinia);
-// application.use(toastService);
application.use(VueQueryPlugin);
application.mount('#app');
diff --git a/resources/js/components/pinesUI/InputMultiChip.vue b/resources/js/components/pinesUI/InputMultiChip.vue
index 2c1730d1..286778ab 100644
--- a/resources/js/components/pinesUI/InputMultiChip.vue
+++ b/resources/js/components/pinesUI/InputMultiChip.vue
@@ -1,5 +1,5 @@
<script setup lang="ts">
-import { computed, onMounted, onUnmounted, ref, useTemplateRef, watch } from 'vue';
+import { computed, onMounted, ref, useTemplateRef, watch } from 'vue';
import { OnClickOutside } from '@vueuse/components';
import { UseFocusTrap } from '@vueuse/integrations/useFocusTrap/component.mjs';
diff --git a/resources/js/components/pinesUI/ToastController.vue b/resources/js/components/pinesUI/ToastController.vue
index e50eb260..454b4925 100755
--- a/resources/js/components/pinesUI/ToastController.vue
+++ b/resources/js/components/pinesUI/ToastController.vue
@@ -37,33 +37,11 @@ const layout = ref<ToastLayout>(props.layout);
const position = ref<ToastPostion>(props.position);
const toastsHovered = ref(false);
-const expanded = ref(props.layout === 'expanded' ? true : false);
+const expanded = ref(props.layout === 'expanded');
const paddingBetweenToasts = ref(props.paddingBetweenToasts);
const heightRecalculateTimeout = ref<null | number>(null);
const burnTimeout = ref<null | number>(null);
-// function UniqueComponentId(prefix = 'pv_id_') {
-// return prefix + Math.random().toString(16).slice(2);
-// }
-
-// function onAdd(toast) {
-// console.log(toast);
-
-// if (toast.options.position) position.value = toast.options.position;
-
-// if (toast.options.id == null) {
-// toast.options.id = UniqueComponentId('toast_');
-// }
-// messages.value.unshift({
-// ...toast.options,
-// id: toast.options.id ?? UniqueComponentId('toast_'),
-// type: toast.options.type ?? 'default',
-// position: toast.options.position ?? position.value,
-// life: toast.options.life ?? props.defaultLife,
-// title: toast.title,
-// });
-// }
-
function deleteToastWithId(id: string) {
messages.value = messages.value.filter((msg) => msg.id !== id);
ToastState.dismiss(id);
@@ -107,21 +85,14 @@ function positionToasts() {
toast.style.bottom = totalHeight + 'px';
} else toast.style.top = totalHeight + 'px';
- // console.log('scale', toast.style.scale);
-
totalHeight += toast.offsetHeight;
- // toast.style.scale === '1'
- // ? toast.getBoundingClientRect().height
- // : Math.round(toast.getBoundingClientRect().height / scaleBuffer);
- // totalHeight += toast.getBoundingClientRect().height;
- // console.log('totalHeight', i + 1, totalHeight);
toast.style.scale = `1`;
toast.style.transform = `translateY(0px)`;
} else if (i > 0) {
toast.style.scale = `${scaleBuffer}`;
- if (bottomFlag && !(i >= props.maxVisibleToasts)) {
+ if (bottomFlag && i < props.maxVisibleToasts) {
toast.style.transform = `translateY(-${yBuffer}px)`;
} else {
alignBottom(toastElements[0], toast);
@@ -203,8 +174,8 @@ function alignBottom(element1: HTMLElement, element2: HTMLElement) {
}
function resetBottom() {
- for (let i = 0; i < messages.value.length; i++) {
- let toastElement = document.getElementById(`${messages.value[i]?.id}`);
+ for (const message of messages.value) {
+ let toastElement = document.getElementById(`${message?.id}`);
if (toastElement) {
toastElement.style.bottom = '0px';
}
@@ -212,49 +183,14 @@ function resetBottom() {
}
function resetTop() {
- for (let i = 0; i < messages.value.length; i++) {
- let toastElement = document.getElementById(`${messages.value[i]?.id}`);
+ for (const message of messages.value) {
+ let toastElement = document.getElementById(`${message?.id}`);
if (toastElement) {
toastElement.style.top = '0px';
}
}
}
-//#region Old Toast Event Bus Code
-
-// onMounted(() => {
-// ToastEventBus.on('add', onAdd);
-// ToastEventBus.on('remove', onRemove);
-// stackToasts();
-// });
-
-// onBeforeUnmount(() => {
-// ToastEventBus.off('add', onAdd);
-// ToastEventBus.off('remove', onRemove);
-// });
-
-// function onRemove(message: Message) {
-// console.log('remove');
-
-// let params = { message, type: 'close' };
-// if (!params.message.id) return; // This is slow and causes issues. Every second remove is not called because the last one is blocking the event somehow. Doing it right in the event watcher makes it work correctly.
-// // for (let i = 0; i < this.messages.length; i++) {
-// // if (this.messages[i].idx === params.message.idx) {
-// // console.log('found ' + params.message.idx);
-
-// // this.messages.splice(i, 1);
-// // break;
-// // }
-// // }
-// // if (this.messages[params.message.idx]) {
-// // // delete this.messages[params.message.idx]
-// // // this.$emit(params.type, { message: params.message });
-// // }
-// deleteToastWithId(params.message.id);
-// }
-
-//#endregion
-
onMounted(() => {
stackToasts();
});
diff --git a/resources/js/components/pinesUI/ToastNotification.vue b/resources/js/components/pinesUI/ToastNotification.vue
index 73522b9d..7345002b 100755
--- a/resources/js/components/pinesUI/ToastNotification.vue
+++ b/resources/js/components/pinesUI/ToastNotification.vue
@@ -4,7 +4,7 @@ import type { ToastProps } from '@/types/pinesTypes';
import { onBeforeUnmount, onMounted, ref } from 'vue';
const emit = defineEmits<{
- (e: 'close', id: string): void; // removeToast
+ (e: 'close', id: string): () => void; // removeToast
}>();
const props = withDefaults(defineProps<ToastProps>(), {
@@ -99,13 +99,7 @@ onBeforeUnmount(() => {
'dark:text-neutral-100 text-gray-800': props.type == 'default',
}"
>
- <svg
- v-show="props.type == 'success'"
- class="w-[18px] h-[18px] mr-1.5 -ml-1"
- viewBox="0 0 24 24"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg v-show="props.type == 'success'" class="w-[18px] h-[18px] mr-1.5 -ml-1" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
fill-rule="evenodd"
clip-rule="evenodd"
@@ -113,13 +107,7 @@ onBeforeUnmount(() => {
fill="currentColor"
></path>
</svg>
- <svg
- v-show="props.type == 'info'"
- class="w-[18px] h-[18px] mr-1.5 -ml-1"
- viewBox="0 0 24 24"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg v-show="props.type == 'info'" class="w-[18px] h-[18px] mr-1.5 -ml-1" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
fill-rule="evenodd"
clip-rule="evenodd"
@@ -127,13 +115,7 @@ onBeforeUnmount(() => {
fill="currentColor"
></path>
</svg>
- <svg
- v-show="props.type == 'warning'"
- class="w-[18px] h-[18px] mr-1.5 -ml-1"
- viewBox="0 0 24 24"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg v-show="props.type == 'warning'" class="w-[18px] h-[18px] mr-1.5 -ml-1" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
fill-rule="evenodd"
clip-rule="evenodd"
@@ -141,13 +123,7 @@ onBeforeUnmount(() => {
fill="currentColor"
></path>
</svg>
- <svg
- v-show="props.type == 'danger'"
- class="w-[18px] h-[18px] mr-1.5 -ml-1"
- viewBox="0 0 24 24"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg v-show="props.type == 'danger'" class="w-[18px] h-[18px] mr-1.5 -ml-1" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
fill-rule="evenodd"
clip-rule="evenodd"
@@ -157,11 +133,7 @@ onBeforeUnmount(() => {
</svg>
<p class="text-[13px] font-medium leading-none">{{ props.title }}</p>
</div>
- <p
- v-show="props.description"
- :class="{ 'pl-5': props.type !== 'default' }"
- class="mt-1.5 text-xs leading-none opacity-70"
- >
+ <p v-show="props.description" :class="{ 'pl-5': props.type !== 'default' }" class="mt-1.5 text-xs leading-none opacity-70">
{{ props.description }}
</p>
</div>
diff --git a/resources/js/components/pulseCards/PulseUsage.vue b/resources/js/components/pulseCards/PulseUsage.vue
index a0507570..f01870ce 100644
--- a/resources/js/components/pulseCards/PulseUsage.vue
+++ b/resources/js/components/pulseCards/PulseUsage.vue
@@ -1,7 +1,7 @@
<script setup lang="ts">
-import type { PulseQueueResponse, PulseResponse, PulseServerResponse, PulseUsageResponse } from '@/types/types';
+import type { PulseResponse, PulseUsageResponse } from '@/types/types';
-import { format_number, periodForHumans, pulseFormatDate } from '@/service/util';
+import { format_number, periodForHumans } from '@/service/util';
import { ref, watch } from 'vue';
import DashboardCard from '@/components/cards/DashboardCard.vue';
diff --git a/resources/js/components/table/TableBase.vue b/resources/js/components/table/TableBase.vue
index 1fd453be..3d5f4339 100755
--- a/resources/js/components/table/TableBase.vue
+++ b/resources/js/components/table/TableBase.vue
@@ -1,5 +1,5 @@
<script setup lang="ts">
-import { onMounted, ref, watch, type Component } from 'vue';
+import { onMounted, ref, type Component } from 'vue';
import TextInputLabelled from '@/components/inputs/TextInputLabelled.vue';
import TablePagination from '@/components/table/TablePagination.vue';
@@ -8,9 +8,9 @@ import InputSelect from '@/components/pinesUI/InputSelect.vue';
import ButtonIcon from '@/components/inputs/ButtonIcon.vue';
import useTable from '@/composables/useTable.ts';
+import SvgSpinners90RingWithBg from '~icons/svg-spinners/90-ring-with-bg';
import PhSortDescendingLight from '~icons/ph/sort-descending-light';
import PhSortAscendingLight from '~icons/ph/sort-ascending-light';
-import SvgSpinners90RingWithBg from '~icons/svg-spinners/90-ring-with-bg';
const props = withDefaults(
defineProps<{
diff --git a/resources/js/components/video/VideoButton.vue b/resources/js/components/video/VideoButton.vue
index f5824afb..9cc3e805 100644
--- a/resources/js/components/video/VideoButton.vue
+++ b/resources/js/components/video/VideoButton.vue
@@ -36,7 +36,7 @@ const tooltipToggle = (event: MouseEvent, state: boolean = true) => {
watch(
() => props.controls,
() => {
- if (props.controls == false) tooltipToggle(new MouseEvent('mouseleave'), false);
+ if (!props.controls) tooltipToggle(new MouseEvent('mouseleave'), false);
},
);
</script>
diff --git a/resources/js/components/video/VideoPlayer.vue b/resources/js/components/video/VideoPlayer.vue
index 86a707a9..882d5eec 100755
--- a/resources/js/components/video/VideoPlayer.vue
+++ b/resources/js/components/video/VideoPlayer.vue
@@ -376,11 +376,13 @@ const onPlayerPlay = async (override = false, recordProgress = true) => {
const onPlayerPause = () => {
if (!player.value) return;
+
player.value.pause();
isPaused.value = true;
+
emit('pause');
+
if (isMediaSession.value) navigator.mediaSession.playbackState = 'paused';
- return;
};
const onPlayerEnded = () => {
diff --git a/resources/js/components/video/VideoPopover.vue b/resources/js/components/video/VideoPopover.vue
index ffc752c3..e60e16a8 100644
--- a/resources/js/components/video/VideoPopover.vue
+++ b/resources/js/components/video/VideoPopover.vue
@@ -1,5 +1,5 @@
<script setup lang="ts">
-import { nextTick, onMounted, onUnmounted, ref, useTemplateRef, watch, type Component, type ComponentPublicInstance } from 'vue';
+import { nextTick, onMounted, onUnmounted, ref, useTemplateRef, watch, type ComponentPublicInstance } from 'vue';
import { OnClickOutside } from '@vueuse/components';
import { UseFocusTrap } from '@vueuse/integrations/useFocusTrap/component';
diff --git a/resources/js/components/video/VideoSlider.vue b/resources/js/components/video/VideoSlider.vue
index 8d654866..1e627b95 100644
--- a/resources/js/components/video/VideoSlider.vue
+++ b/resources/js/components/video/VideoSlider.vue
@@ -40,7 +40,7 @@ const tooltipToggle = (event: MouseEvent, state: boolean = true) => {
watch(
() => props.controls,
() => {
- if (props.controls == false) tooltipToggle(new MouseEvent('mouseleave'), false);
+ if (!props.controls) tooltipToggle(new MouseEvent('mouseleave'), false);
},
);
</script>
diff --git a/resources/js/composables/useDatePicker.js b/resources/js/composables/useDatePicker.js
index d54cb777..61ef9283 100644
--- a/resources/js/composables/useDatePicker.js
+++ b/resources/js/composables/useDatePicker.js
@@ -10,20 +10,7 @@ export default function useDatePicker(props, refs) {
datePickerDay: '',
datePickerDaysInMonth: [],
datePickerBlankDaysInMonth: [],
- datePickerMonthNames: [
- 'January',
- 'February',
- 'March',
- 'April',
- 'May',
- 'June',
- 'July',
- 'August',
- 'September',
- 'October',
- 'November',
- 'December',
- ],
+ datePickerMonthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
datePickerDays: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
datePickerInput: refs.datePickerInput,
datePickerCalendar: refs.datePickerCalendar,
@@ -64,12 +51,12 @@ export default function useDatePicker(props, refs) {
},
datePickerIsSelectedDate(day) {
const d = new Date(this.datePickerYear, this.datePickerMonth, day);
- return this.datePickerValue === this.datePickerFormatDate(d) ? true : false;
+ return this.datePickerValue === this.datePickerFormatDate(d);
},
datePickerIsToday(day) {
const today = new Date();
const d = new Date(this.datePickerYear, this.datePickerMonth, day);
- return today.toDateString() === d.toDateString() ? true : false;
+ return today.toDateString() === d.toDateString();
},
datePickerCalculateDays() {
let daysInMonth = new Date(this.datePickerYear, this.datePickerMonth + 1, 0).getDate();
@@ -119,8 +106,7 @@ export default function useDatePicker(props, refs) {
return `${formattedMonth} ${formattedDate}, ${formattedYear}`;
},
datePickerPositionUpdate() {
- let datePickerBottomPos =
- this.datePickerInput.getBoundingClientRect().top + this.datePickerInput.offsetHeight + this.datePickerCalendar.offsetHeight;
+ let datePickerBottomPos = this.datePickerInput.getBoundingClientRect().top + this.datePickerInput.offsetHeight + this.datePickerCalendar.offsetHeight;
if (window.innerHeight < datePickerBottomPos) {
this.datePickerPosition = 'top';
diff --git a/resources/js/composables/useForm.ts b/resources/js/composables/useForm.ts
index 64d7ec02..8ba2bd91 100644
--- a/resources/js/composables/useForm.ts
+++ b/resources/js/composables/useForm.ts
@@ -1,5 +1,3 @@
-import type { FormField } from '@/types/types';
-
import { reactive, watch } from 'vue';
import cloneDeep from 'lodash.clonedeep';
diff --git a/resources/js/composables/useMultiSelect.js b/resources/js/composables/useMultiSelect.js
index a7e43b8f..c1bc816d 100644
--- a/resources/js/composables/useMultiSelect.js
+++ b/resources/js/composables/useMultiSelect.js
@@ -74,11 +74,11 @@ export default function useMultiSelect({ options, defaultItems }, refs) {
let typedValue = this.selectKeydownValue.toLowerCase();
let bestMatch = null;
let bestMatchIndex = -1;
- for (let i = 0; i < this.selectableItems.length; i++) {
- let name = this.selectableItems[i].name.toLowerCase();
+ for (const selectableItem of this.selectableItems) {
+ let name = selectableItem.name.toLowerCase();
let index = name.indexOf(typedValue);
- if (index > -1 && (bestMatchIndex == -1 || index < bestMatchIndex) && !this.selectableItems[i].disabled) {
- bestMatch = this.selectableItems[i];
+ if (index > -1 && (bestMatchIndex == -1 || index < bestMatchIndex) && !selectableItem.disabled) {
+ bestMatch = selectableItem;
bestMatchIndex = index;
}
}
diff --git a/resources/js/composables/useSelect.js b/resources/js/composables/useSelect.js
index de5e3b7b..d21f7851 100755
--- a/resources/js/composables/useSelect.js
+++ b/resources/js/composables/useSelect.js
@@ -72,11 +72,12 @@ export default function useSelect(options, refs) {
let typedValue = this.selectKeydownValue.toLowerCase();
let bestMatch = null;
let bestMatchIndex = -1;
- for (let i = 0; i < this.selectableItems.length; i++) {
- let title = this.selectableItems[i].title.toLowerCase();
+
+ for (const selectableItem of this.selectableItems) {
+ let title = selectableItem.title.toLowerCase();
let index = title.indexOf(typedValue);
- if (index > -1 && (bestMatchIndex == -1 || index < bestMatchIndex) && !this.selectableItems[i].disabled) {
- bestMatch = this.selectableItems[i];
+ if (index > -1 && (bestMatchIndex == -1 || index < bestMatchIndex) && !selectableItem.disabled) {
+ bestMatch = selectableItem;
bestMatchIndex = index;
}
}
diff --git a/resources/js/composables/useToastController.js b/resources/js/composables/useToastController.js
deleted file mode 100755
index a597bbdf..00000000
--- a/resources/js/composables/useToastController.js
+++ /dev/null
@@ -1,423 +0,0 @@
-import { reactive, watch } from 'vue';
-
-/*
- UNUSED -> Left for reference only
-*/
-export default function useToastController($el = document.querySelector('#toastRoot'), layout = 'default', position = 'top-center') {
- const toast = reactive({
- toasts: [],
- toastsHovered: false,
- expanded: false,
- layout: layout,
- position: position,
- paddingBetweenToasts: 16,
- deleteToastWithId(id) {
- for (let i = 0; i < this.toasts.length; i++) {
- if (this.toasts[i].id === id) {
- this.toasts.splice(i, 1);
- break;
- }
- }
- },
- getToastWithId(id) {
- for (let i = 0; i < this.toasts.length; i++) {
- if (this.toasts[i].id === id) {
- return this.toasts[i];
- }
- }
- },
- burnToast(id) {
- let burnToast = this.getToastWithId(id);
- let burnToastElement = document.getElementById(burnToast.id);
- if (burnToastElement) {
- if (this.toasts.length == 1) {
- if (this.layout == 'default') {
- this.expanded = false;
- }
- burnToastElement.classList.remove('translate-y-0');
- if (this.position.includes('bottom')) {
- burnToastElement.classList.add('translate-y-full');
- } else {
- burnToastElement.classList.add('-translate-y-full');
- }
- burnToastElement.classList.add('-translate-y-full');
- }
- burnToastElement.classList.add('opacity-0');
- setTimeout(function () {
- that.deleteToastWithId(id);
- setTimeout(function () {
- this.stackToasts();
- }, 1);
- }, 300);
- }
- },
- stackToasts() {
- this.positionToasts();
- this.calculateHeightOfToastsContainer();
- setTimeout(function () {
- this.calculateHeightOfToastsContainer();
- }, 300);
- },
- positionToasts() {
- if (this.toasts.length == 0) return;
- let topToast = document.getElementById(this.toasts[0].id);
-
- //Custom Addition
- if (!topToast) return;
-
- topToast.style.zIndex = 100;
- if (this.expanded) {
- if (this.position.includes('bottom')) {
- topToast.style.top = 'auto';
- topToast.style.bottom = '0px';
- } else {
- topToast.style.top = '0px';
- }
- }
-
- // let bottomPositionOfFirstToast = this.getBottomPositionOfElement(topToast); Not used
-
- if (this.toasts.length == 1) return;
-
- let middleToast = document.getElementById(this.toasts[1].id);
-
- //Custom Addition
- if (!middleToast) return;
-
- middleToast.style.zIndex = 90;
-
- if (this.expanded) {
- let middleToastPosition = topToast.getBoundingClientRect().height + this.paddingBetweenToasts + 'px';
-
- if (this.position.includes('bottom')) {
- middleToast.style.top = 'auto';
- middleToast.style.bottom = middleToastPosition;
- } else {
- middleToast.style.top = middleToastPosition;
- }
-
- middleToast.style.scale = '100%';
- middleToast.style.transform = 'translateY(0px)';
- } else {
- middleToast.style.scale = '94%';
- if (this.position.includes('bottom')) {
- middleToast.style.transform = 'translateY(-16px)';
- } else {
- this.alignBottom(topToast, middleToast);
- middleToast.style.transform = 'translateY(16px)';
- }
- }
-
- if (this.toasts.length == 2) return;
-
- let bottomToast = document.getElementById(this.toasts[2].id);
-
- //Custom Addition
- if (!bottomToast) return;
-
- bottomToast.style.zIndex = 80;
- if (this.expanded) {
- let bottomToastPosition =
- topToast.getBoundingClientRect().height +
- this.paddingBetweenToasts +
- middleToast.getBoundingClientRect().height +
- this.paddingBetweenToasts +
- 'px';
-
- if (this.position.includes('bottom')) {
- bottomToast.style.top = 'auto';
- bottomToast.style.bottom = bottomToastPosition;
- } else {
- bottomToast.style.top = bottomToastPosition;
- }
-
- bottomToast.style.scale = '100%';
- bottomToast.style.transform = 'translateY(0px)';
- } else {
- bottomToast.style.scale = '88%';
- if (this.position.includes('bottom')) {
- bottomToast.style.transform = 'translateY(-32px)';
- } else {
- this.alignBottom(topToast, bottomToast);
- bottomToast.style.transform = 'translateY(32px)';
- }
- }
-
- if (this.toasts.length == 3) return;
- let burnToast = document.getElementById(this.toasts[3].id);
-
- //Custom Addition
- if (!burnToast) return;
-
- burnToast.style.zIndex = 70;
- if (this.expanded) {
- let burnToastPosition =
- topToast.getBoundingClientRect().height +
- this.paddingBetweenToasts +
- middleToast.getBoundingClientRect().height +
- this.paddingBetweenToasts +
- bottomToast.getBoundingClientRect().height +
- this.paddingBetweenToasts +
- 'px';
-
- if (this.position.includes('bottom')) {
- burnToast.style.top = 'auto';
- burnToast.style.bottom = burnToastPosition;
- } else {
- burnToast.style.top = burnToastPosition;
- }
-
- burnToast.style.scale = '100%';
- burnToast.style.transform = 'translateY(0px)';
- } else {
- burnToast.style.scale = '82%';
- this.alignBottom(topToast, burnToast);
- burnToast.style.transform = 'translateY(48px)';
- }
-
- burnToast.firstElementChild.classList.remove('opacity-100');
- burnToast.firstElementChild.classList.add('opacity-0');
-
- // Burn 🔥 (remove) last toast
- setTimeout(function () {
- this.toasts.pop();
- }, 300);
-
- if (this.position.includes('bottom')) {
- middleToast.style.top = 'auto';
- }
-
- return;
- },
- alignBottom(element1, element2) {
- // Get the top position and height of the first element
- let top1 = element1.offsetTop;
- let height1 = element1.offsetHeight;
-
- // Get the height of the second element
- let height2 = element2.offsetHeight;
-
- // Calculate the top position for the second element
- let top2 = top1 + (height1 - height2);
-
- // Apply the calculated top position to the second element
- element2.style.top = top2 + 'px';
- },
- alignTop(element1, element2) {
- // Get the top position of the first element
- let top1 = element1.offsetTop;
-
- // Apply the same top position to the second element
- element2.style.top = top1 + 'px';
- },
- resetBottom() {
- for (let i = 0; i < this.toasts.length; i++) {
- if (document.getElementById(this.toasts[i].id)) {
- let toastElement = document.getElementById(this.toasts[i].id);
- toastElement.style.bottom = '0px';
- }
- }
- },
- resetTop() {
- for (let i = 0; i < this.toasts.length; i++) {
- if (document.getElementById(this.toasts[i].id)) {
- let toastElement = document.getElementById(this.toasts[i].id);
- toastElement.style.top = '0px';
- }
- }
- },
- getBottomPositionOfElement(el) {
- return el.getBoundingClientRect().height + el.getBoundingClientRect().top;
- },
- calculateHeightOfToastsContainer() {
- if (this.toasts.length == 0) {
- $el.value.style.height = '0px';
- return;
- }
-
- let lastToast = this.toasts[this.toasts.length - 1];
- let lastToastRectangle = document.getElementById(lastToast.id).getBoundingClientRect();
-
- let firstToast = this.toasts[0];
- let firstToastRectangle = document.getElementById(firstToast.id).getBoundingClientRect();
-
- if (this.toastsHovered) {
- if (this.position.includes('bottom')) {
- $el.value.style.height = firstToastRectangle.top + firstToastRectangle.height - lastToastRectangle.top + 'px';
- } else {
- $el.value.style.height = lastToastRectangle.top + lastToastRectangle.height - firstToastRectangle.top + 'px';
- }
- } else {
- $el.value.style.height = firstToastRectangle.height + 'px';
- }
- },
- });
-
- watch(
- () => toast.toastsHovered,
- function (value) {
- if (toast.layout == 'default') {
- if (toast.position.includes('bottom')) {
- toast.resetBottom();
- } else {
- toast.resetTop();
- }
-
- if (value) {
- // calculate the new positions
- toast.expanded = true;
- if (toast.layout == 'default') {
- toast.stackToasts();
- }
- } else {
- if (toast.layout == 'default') {
- toast.expanded = false;
- // setTimeout(function(){
- toast.stackToasts();
- // }, 10);
- setTimeout(function () {
- toast.stackToasts();
- }, 10);
- }
- }
- }
- },
- );
- return toast;
-}
-
-function positionToast() {
- if (messages.value.length == 0 || !messages.value[0].id) return;
- let topToast = document.getElementById(messages.value[0].id);
-
- if (!topToast) return;
-
- topToast.style.zIndex = `${100}`;
- if (expanded.value) {
- if (position.value.includes('bottom')) {
- topToast.style.top = 'auto';
- topToast.style.bottom = '0px';
- } else {
- topToast.style.top = '0px';
- }
- }
- console.log('totalHeight', 1, 0);
-
- if (messages.value.length == 1 || !messages.value[1].id) return;
-
- let middleToast = document.getElementById(messages.value[1].id);
-
- if (!middleToast) return;
-
- middleToast.style.zIndex = `${90}`;
-
- if (expanded.value) {
- console.log(topToast.getBoundingClientRect().height);
-
- let middleToastPosition = topToast.getBoundingClientRect().height + paddingBetweenToasts.value + 'px';
-
- if (position.value.includes('bottom')) {
- middleToast.style.top = 'auto';
- middleToast.style.bottom = middleToastPosition;
- } else {
- middleToast.style.top = middleToastPosition;
- }
- console.log('totalHeight', 2, middleToastPosition);
-
- middleToast.style.scale = '100%';
- middleToast.style.transform = 'translateY(0px)';
- } else {
- middleToast.style.scale = '94%';
- if (position.value.includes('bottom')) {
- middleToast.style.transform = 'translateY(-16px)';
- } else {
- alignBottom(topToast, middleToast);
- middleToast.style.transform = 'translateY(16px)';
- }
- }
-
- if (messages.value.length == 2 || !messages.value[2].id) return;
-
- let bottomToast = document.getElementById(messages.value[2].id);
-
- if (!bottomToast) return;
-
- bottomToast.style.zIndex = `${80}`;
- if (expanded.value) {
- console.log(middleToast.getBoundingClientRect().height);
- let bottomToastPosition =
- topToast.getBoundingClientRect().height +
- paddingBetweenToasts.value +
- middleToast.getBoundingClientRect().height +
- paddingBetweenToasts.value +
- 'px';
-
- console.log('totalHeight', 3, bottomToastPosition);
- if (position.value.includes('bottom')) {
- bottomToast.style.top = 'auto';
- bottomToast.style.bottom = bottomToastPosition;
- } else {
- bottomToast.style.top = bottomToastPosition;
- }
-
- bottomToast.style.scale = '100%';
- bottomToast.style.transform = 'translateY(0px)';
- } else {
- bottomToast.style.scale = '88%';
- if (position.value.includes('bottom')) {
- bottomToast.style.transform = 'translateY(-32px)';
- } else {
- alignBottom(topToast, bottomToast);
- bottomToast.style.transform = 'translateY(32px)';
- }
- }
-
- if (messages.value.length == 3 || !messages.value[3].id) return;
-
- let burnToast = document.getElementById(messages.value[3].id);
-
- if (!burnToast) return;
-
- burnToast.style.zIndex = `${70}`;
- if (expanded.value) {
- console.log(bottomToast.getBoundingClientRect().height);
- let burnToastPosition =
- topToast.getBoundingClientRect().height +
- paddingBetweenToasts.value +
- middleToast.getBoundingClientRect().height +
- paddingBetweenToasts.value +
- bottomToast.getBoundingClientRect().height +
- paddingBetweenToasts.value +
- 'px';
-
- console.log('totalHeight', 4, burnToastPosition);
-
- if (position.value.includes('bottom')) {
- burnToast.style.top = 'auto';
- burnToast.style.bottom = burnToastPosition;
- } else {
- burnToast.style.top = burnToastPosition;
- }
-
- burnToast.style.scale = '100%';
- burnToast.style.transform = 'translateY(0px)';
- } else {
- burnToast.style.scale = '82%';
- alignBottom(topToast, burnToast);
- burnToast.style.transform = 'translateY(48px)';
- }
-
- burnToast.firstElementChild?.classList.remove('opacity-100');
- burnToast.firstElementChild?.classList.add('opacity-0');
-
- // Burn 🔥 (remove) last toast
- setTimeout(function () {
- messages.value.pop();
- }, 300);
-
- if (position.value.includes('bottom')) {
- middleToast.style.top = 'auto';
- }
-
- return;
-}
diff --git a/resources/js/layouts/LayoutBase.vue b/resources/js/layouts/LayoutBase.vue
index b198fa17..b2edfdee 100755
--- a/resources/js/layouts/LayoutBase.vue
+++ b/resources/js/layouts/LayoutBase.vue
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { useAppStore } from '@/stores/AppStore';
import { storeToRefs } from 'pinia';
-import { nextTick, ref, watch } from 'vue';
+import { ref, watch } from 'vue';
import NavBar from '@/components/panels/NavBar.vue';
diff --git a/resources/js/service/mutations.ts b/resources/js/service/mutations.ts
index 0f8cbd71..eb544cfe 100644
--- a/resources/js/service/mutations.ts
+++ b/resources/js/service/mutations.ts
@@ -1,8 +1,8 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
-import { useMutation, useQueryClient, type UseMutationReturnType } from '@tanstack/vue-query';
+import { useMutation, useQueryClient } from '@tanstack/vue-query';
import { API } from './api';
-import mediaAPI, { updateCategory } from './mediaAPI';
+import mediaAPI from './mediaAPI';
export const UseCreatePlayback = () => {
const queryClient = useQueryClient();
diff --git a/resources/js/service/toaster/toastService.ts b/resources/js/service/toaster/toastService.ts
index c6844b53..c9e5c9ef 100644
--- a/resources/js/service/toaster/toastService.ts
+++ b/resources/js/service/toaster/toastService.ts
@@ -1,4 +1,4 @@
-import type { ExternalToast, Message, ToastOptions, ToastToDismiss, ToastType } from '@/types/pinesTypes';
+import type { Message, ToastOptions, ToastToDismiss } from '@/types/pinesTypes';
function UniqueComponentId(prefix = 'pv_id_') {
return prefix + Math.random().toString(16).slice(2);
diff --git a/resources/js/service/toaster/toastServiceOld.ts b/resources/js/service/toaster/toastServiceOld.ts
deleted file mode 100644
index e3ead314..00000000
--- a/resources/js/service/toaster/toastServiceOld.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import type { Plugin } from 'vue';
-import { ToastSymbol } from '@/composables/useToast';
-import ToastEventBus from '../toastEventBus';
-import type { ToastOptions } from '@/types/pinesTypes';
-// import { toast } from './state';
-
-// export { toast };
-
-export default {
- // install: (app: any) => {
- // const ToastService = {
- // add: (title: string, options: ToastOptions) => {
- // ToastEventBus.emit('add', { title, options });
- // },
- // remove: (id: string) => {
- // ToastEventBus.emit('close', id);
- // },
- // };
- // app.config.globalProperties.$toast = ToastService;
- // app.provide(ToastSymbol, ToastService);
- // app.component('ToastController');
- // },
-};
diff --git a/resources/js/service/util.ts b/resources/js/service/util.ts
index b01217f0..3f4991a6 100644
--- a/resources/js/service/util.ts
+++ b/resources/js/service/util.ts
@@ -94,7 +94,7 @@ export function toCalendarFormattedDate(date: string) {
* @returns
*/
export function pulseFormatDate(value: string = '') {
- if (value.match(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/) === null) {
+ if (/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/.exec(value) === null) {
throw new Error(`Unknown date format [${value}].`);
}
diff --git a/resources/js/stores/ContentStore.js b/resources/js/stores/ContentStore.js
index 6753356d..a950d799 100755
--- a/resources/js/stores/ContentStore.js
+++ b/resources/js/stores/ContentStore.js
@@ -1,7 +1,7 @@
import { defineStore, storeToRefs } from 'pinia';
import { computed, ref } from 'vue';
-import { useAuthStore } from './AuthStore';
-import { useAppStore } from './AppStore';
+import { useAuthStore } from '@/stores/AuthStore';
+import { useAppStore } from '@/stores/AppStore';
import { useRoute } from 'vue-router';
import { toast } from '@/service/toaster/toastService';
@@ -32,27 +32,25 @@ export const useContentStore = defineStore('Content', () => {
let searchedList = searchQuery.value
? list.filter((video) => {
- {
- try {
- let strRepresentation = [
- video.name,
- video.title,
- video.date,
- video.description,
- video.episode ?? '',
- video.season ?? '',
- video.views,
- video.video_tags?.length ? video.video_tags.reduce((tags, tag) => `${tags} ${tag?.name ?? ''}`, '') : '',
- ]
- .join(' ')
- .toLowerCase();
- // console.log(strRepresentation);
-
- return strRepresentation.includes(searchQuery.value.toLowerCase());
- } catch (error) {
- console.log(error);
- return false;
- }
+ try {
+ let strRepresentation = [
+ video.name,
+ video.title,
+ video.date,
+ video.description,
+ video.episode ?? '',
+ video.season ?? '',
+ video.views,
+ video.video_tags?.length ? video.video_tags.reduce((tags, tag) => `${tags} ${tag?.name ?? ''}`, '') : '',
+ ]
+ .join(' ')
+ .toLowerCase();
+ // console.log(strRepresentation);
+
+ return strRepresentation.includes(searchQuery.value.toLowerCase());
+ } catch (error) {
+ console.log(error);
+ return false;
}
})
: list;
diff --git a/resources/js/types/resources.ts b/resources/js/types/resources.ts
index 2c6c65c5..edfc62bb 100644
--- a/resources/js/types/resources.ts
+++ b/resources/js/types/resources.ts
@@ -1,5 +1,5 @@
-import type { Category, Folder, Metadata, User } from './model';
-import type { TaskStatus } from './types';
+import type { Category, Folder, Metadata } from '@/types/model';
+import type { TaskStatus } from '@/types/types';
export interface UserResource {
id: number;
diff --git a/resources/js/views/DashboardView.vue b/resources/js/views/DashboardView.vue
index 54524480..50d9437d 100644
--- a/resources/js/views/DashboardView.vue
+++ b/resources/js/views/DashboardView.vue
@@ -16,14 +16,14 @@ import DashboardTasks from '@/components/dashboard/DashboardTasks.vue';
import SidebarCard from '@/components/cards/SidebarCard.vue';
import LayoutBase from '@/layouts/LayoutBase.vue';
-import LucideChartNoAxesColumnIncreasing from '~icons/lucide/chart-no-axes-column-increasing';
-import ProiconsAddSquareMultiple from '~icons/proicons/add-square-multiple';
-import ProiconsBookAdd2 from '~icons/proicons/book-add-2';
+// import LucideChartNoAxesColumnIncreasing from '~icons/lucide/chart-no-axes-column-increasing';
+// import ProiconsAddSquareMultiple from '~icons/proicons/add-square-multiple';
+// import ProiconsBookAdd2 from '~icons/proicons/book-add-2';
import ProiconsLibrary from '~icons/proicons/library';
-import ProiconsHistory from '~icons/proicons/history';
-import CircumDatabase from '~icons/circum/database';
+// import ProiconsHistory from '~icons/proicons/history';
+// import CircumDatabase from '~icons/circum/database';
import ProiconsGraph from '~icons/proicons/graph';
-import LucideImages from '~icons/lucide/images';
+// import LucideImages from '~icons/lucide/images';
import CircumServer from '~icons/circum/server';
import LucideUsers from '~icons/lucide/users';
diff --git a/resources/js/views/SetupView.vue b/resources/js/views/SetupView.vue
index 5874c7c9..92df196b 100644
--- a/resources/js/views/SetupView.vue
+++ b/resources/js/views/SetupView.vue
@@ -6,8 +6,6 @@ import { onMounted } from 'vue';
import LayoutBase from '@/layouts/LayoutBase.vue';
-import LucideFolder from '~icons/lucide/folder';
-
const { pageTitle, selectedSideBar } = storeToRefs(useAppStore());
const { auth } = useAuthStore();
diff --git a/resources/views/error.blade.php b/resources/views/error.blade.php
index 7d3c284c..9a7dfacd 100755
--- a/resources/views/error.blade.php
+++ b/resources/views/error.blade.php
@@ -3,11 +3,11 @@
<div class="max-w-xl mx-auto sm:px-6 lg:px-8">
<div class="flex items-center pt-8 sm:justify-start sm:pt-0">
<div class="px-4 text-lg text-gray-500 border-r border-gray-400 tracking-wider">
- 404
+ 404
</div>
<div class="ml-4 text-lg text-gray-500 uppercase tracking-wider">
- <?php echo $message ?? "Not Found"?>
+ <?php echo $message ?? "Not Found" ?>
</div>
</div>
</div>