Skip to content

A self-hosted media server and file management system

sorting

aminnausin28691d885864
diff --git a/package-lock.json b/package-lock.json
index a839fa39..23ddce21 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -22,6 +22,7 @@
"@iconify-json/circum": "^1.1.11",
"@iconify-json/lucide": "^1.1.202",
"@iconify-json/material-symbols-light": "^1.1.25",
+ "@iconify-json/ph": "^1.1.13",
"@vitejs/plugin-vue": "^5.0.5",
"autoprefixer": "^10.4.19",
"axios": "^1.6.4",
@@ -647,6 +648,15 @@
"@iconify/types": "*"
}
},
+ "node_modules/@iconify-json/ph": {
+ "version": "1.1.13",
+ "resolved": "https://registry.npmjs.org/@iconify-json/ph/-/ph-1.1.13.tgz",
+ "integrity": "sha512-xtM4JJ63HCKj09WRqrBswXiHrpliBlqboWSZH8odcmqYXbvIFceU9/Til4V+MQr6+MoUC+KB72cxhky2+A6r/g==",
+ "dev": true,
+ "dependencies": {
+ "@iconify/types": "*"
+ }
+ },
"node_modules/@iconify/types": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@iconify/types/-/types-2.0.0.tgz",
diff --git a/package.json b/package.json
index d4aea086..44eae170 100644
--- a/package.json
+++ b/package.json
@@ -11,6 +11,7 @@
"@iconify-json/circum": "^1.1.11",
"@iconify-json/lucide": "^1.1.202",
"@iconify-json/material-symbols-light": "^1.1.25",
+ "@iconify-json/ph": "^1.1.13",
"@vitejs/plugin-vue": "^5.0.5",
"autoprefixer": "^10.4.19",
"axios": "^1.6.4",
diff --git a/resources/js/components/EditDetails.vue b/resources/js/components/EditDetails.vue
deleted file mode 100644
index e69de29b..00000000
diff --git a/resources/js/components/inputs/FormTextArea.vue b/resources/js/components/inputs/FormTextArea.vue
index 6a62ecc8..b8bab023 100644
--- a/resources/js/components/inputs/FormTextArea.vue
+++ b/resources/js/components/inputs/FormTextArea.vue
@@ -14,7 +14,7 @@ const resize = () => {
<template>
<div class="block mt-1 w-full">
<textarea @input="resize()" type="text" ref="$el"
- class="flex w-full h-auto min-h-[80px] px-3 py-2 text-sm bg-white border rounded-md border-neutral-300 ring-offset-background placeholder:text-neutral-400 focus:border-neutral-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-400 disabled:cursor-not-allowed disabled:opacity-50"
+ class="flex w-full h-auto min-h-[80px] px-3 py-2 text-sm border rounded-md bg-white border-gray-300 dark:border-gray-600 dark:text-gray-300 dark:bg-input-900 ring-offset-background placeholder:text-neutral-400 focus:border-neutral-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-400 disabled:cursor-not-allowed disabled:opacity-50"
:name="field.name"
:title="field.name"
:required="field.required"
diff --git a/resources/js/components/inputs/LabelledTextInput.vue b/resources/js/components/inputs/LabelledTextInput.vue
index 67fefa59..85e49bdc 100644
--- a/resources/js/components/inputs/LabelledTextInput.vue
+++ b/resources/js/components/inputs/LabelledTextInput.vue
@@ -1,11 +1,13 @@
<script setup>
+import FormInputLabel from '../labels/FormInputLabel.vue';
+
const model = defineModel();
const { text, placeholder, id } = defineProps(['text', 'placeholder', 'id'])
</script>
<template>
- <div class="flex justify-start items-center gap-2">
- <label class="text-neutral-950 dark:text-white" :for="id">{{ text }}:</label>
+ <div class="flex flex-col justify-center gap-2 text-sm">
+ <FormInputLabel :field="{name: id, text}"/>
<input type="text" v-model="model" :name="id" :id="id" :placeholder="placeholder"
- class="p-2 text-neutral-950 dark:text-white bg-input-100 border-input-200 shadow-sm leading-none dark:bg-input-800 dark:border-indigo-800 rounded-lg w-full">
+ class="h-10 p-2 shadow-sm rounded-md w-full 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">
</div>
</template>
\ No newline at end of file
diff --git a/resources/js/components/labels/FormInputLabel.vue b/resources/js/components/labels/FormInputLabel.vue
index 29f17953..9dcd1164 100644
--- a/resources/js/components/labels/FormInputLabel.vue
+++ b/resources/js/components/labels/FormInputLabel.vue
@@ -3,8 +3,8 @@
</script>
<template>
- <label class="block font-medium text-gray-700 dark:text-gray-300" :for="field.name" :class="{textSize : textSize, 'text-sm': !textSize}">
- {{ field.text }}
+ <label class="block font-medium text-gray-700 dark:text-gray-300" :for="field?.name" :class="{textSize : textSize, 'text-sm': !textSize}">
+ {{ field?.text }}
</label>
- <p v-if="field.subtext" class="text-sm/6 text-gray-500 dark:text-gray-400">{{ field.subtext }}</p>
+ <p v-if="field?.subtext" class="text-sm/6 text-gray-500 dark:text-gray-400">{{ field.subtext }}</p>
</template>
\ No newline at end of file
diff --git a/resources/js/components/pinesUI/DropdownMenu.vue b/resources/js/components/pinesUI/DropdownMenu.vue
new file mode 100644
index 00000000..f24b2b82
--- /dev/null
+++ b/resources/js/components/pinesUI/DropdownMenu.vue
@@ -0,0 +1,214 @@
+<template>
+ <div x-data="{
+ dropdownOpen: false
+ }" class="relative">
+
+ <button @click="dropdownOpen = true"
+ class="inline-flex items-center justify-center h-12 py-2 pl-3 pr-12 text-sm font-medium transition-colors bg-white border rounded-md text-neutral-700 hover:bg-neutral-100 active:bg-white focus:bg-white focus:outline-none disabled:opacity-50 disabled:pointer-events-none">
+ <img src="https://cdn.devdojo.com/images/may2023/adam.jpeg"
+ class="object-cover w-8 h-8 border rounded-full border-neutral-200" />
+ <span class="flex flex-col items-start flex-shrink-0 h-full ml-2 leading-none translate-y-px">
+ <span>Adam Wathan</span>
+ <span class="text-xs font-light text-neutral-400">@adamwathan</span>
+ </span>
+ <svg class="absolute right-0 w-5 h-5 mr-3" xmlns="http://www.w3.org/2000/svg" fill="none"
+ viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
+ <path stroke-linecap="round" stroke-linejoin="round"
+ d="M8.25 15L12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9" />
+ </svg>
+ </button>
+
+ <div x-show="dropdownOpen" @click.away="dropdownOpen = false" x-transition:enter="ease-out duration-200"
+ x-transition:enter-start="-translate-y-2" x-transition:enter-end="translate-y-0"
+ class="absolute top-0 z-50 w-56 mt-12 -translate-x-1/2 left-1/2" x-cloak>
+ <div class="p-1 mt-1 bg-white border rounded-md shadow-md border-neutral-200/70 text-neutral-700">
+ <div class="px-2 py-1.5 text-sm font-semibold">My Account</div>
+ <div class="h-px my-1 -mx-1 bg-neutral-200"></div>
+ <a href="#_"
+ class="relative flex cursor-default select-none hover:bg-neutral-100 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
+ stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
+ class="w-4 h-4 mr-2">
+ <path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"></path>
+ <circle cx="12" cy="7" r="4"></circle>
+ </svg>
+ <span>Profile</span>
+ <span class="ml-auto text-xs tracking-widest opacity-60">⇧⌘P</span>
+ </a>
+ <a href="#_"
+ class="relative flex cursor-default select-none hover:bg-neutral-100 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
+ stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
+ class="w-4 h-4 mr-2">
+ <rect width="20" height="14" x="2" y="5" rx="2"></rect>
+ <line x1="2" x2="22" y1="10" y2="10"></line>
+ </svg>
+ <span>Billing</span><span class="ml-auto text-xs tracking-widest opacity-60">⌘B</span>
+ </a>
+ <a href="#_"
+ class="relative flex cursor-default select-none hover:bg-neutral-100 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
+ stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
+ class="w-4 h-4 mr-2">
+ <path
+ d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z">
+ </path>
+ <circle cx="12" cy="12" r="3"></circle>
+ </svg>
+ <span>Settings</span>
+ <span class="ml-auto text-xs tracking-widest opacity-60">⌘S</span>
+ </a>
+ <a href="#_"
+ class="relative flex cursor-default select-none hover:bg-neutral-100 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
+ stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
+ class="w-4 h-4 mr-2">
+ <rect width="20" height="16" x="2" y="4" rx="2" ry="2"></rect>
+ <path d="M6 8h.001"></path>
+ <path d="M10 8h.001"></path>
+ <path d="M14 8h.001"></path>
+ <path d="M18 8h.001"></path>
+ <path d="M8 12h.001"></path>
+ <path d="M12 12h.001"></path>
+ <path d="M16 12h.001"></path>
+ <path d="M7 16h10"></path>
+ </svg>
+ <span>Keyboard shortcuts</span>
+ <span class="ml-auto text-xs tracking-widest opacity-60">⌘K</span>
+ </a>
+ <div class="h-px my-1 -mx-1 bg-neutral-200"></div>
+ <div
+ class="relative flex cursor-default select-none hover:bg-neutral-100 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
+ stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
+ class="w-4 h-4 mr-2">
+ <path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"></path>
+ <circle cx="9" cy="7" r="4"></circle>
+ <path d="M22 21v-2a4 4 0 0 0-3-3.87"></path>
+ <path d="M16 3.13a4 4 0 0 1 0 7.75"></path>
+ </svg>
+ <span>Team</span>
+ </div>
+ <div class="relative group">
+ <div
+ class="relative flex cursor-default select-none hover:bg-neutral-100 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
+ stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
+ class="w-4 h-4 mr-2">
+ <path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"></path>
+ <circle cx="9" cy="7" r="4"></circle>
+ <line x1="19" x2="19" y1="8" y2="14"></line>
+ <line x1="22" x2="16" y1="11" y2="11"></line>
+ </svg>
+ <span>Invite users</span>
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
+ stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
+ class="w-4 h-4 ml-auto">
+ <polyline points="9 18 15 12 9 6"></polyline>
+ </svg>
+ </div>
+ <div data-submenu
+ class="absolute top-0 right-0 invisible mr-1 duration-200 ease-out translate-x-full opacity-0 group-hover:mr-0 group-hover:visible group-hover:opacity-100">
+ <div
+ class="z-50 min-w-[8rem] overflow-hidden rounded-md border bg-white p-1 shadow-md animate-in slide-in-from-left-1 w-40">
+ <div @click="dropdownOpen = false"
+ class="relative flex cursor-default select-none items-center rounded px-2 py-1.5 hover:bg-neutral-100 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
+ <svg class="w-4 h-4 mr-2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"
+ fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
+ stroke-linejoin="round">
+ <rect width="20" height="16" x="2" y="4" rx="2"></rect>
+ <path d="m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"></path>
+ </svg>
+ <span>Email</span>
+ </div>
+ <div @click="dropdownOpen = false"
+ class="relative flex cursor-default select-none items-center rounded px-2 py-1.5 hover:bg-neutral-100 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
+ <svg class="w-4 h-4 mr-2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"
+ fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
+ stroke-linejoin="round">
+ <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path>
+ </svg>
+ <span>Message</span>
+ </div>
+ <div class="h-px my-1 -mx-1 bg-neutral-200"></div>
+ <div @click="dropdownOpen = false"
+ class="relative flex cursor-default select-none items-center rounded px-2 py-1.5 hover:bg-neutral-100 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
+ <svg class="w-4 h-4 mr-2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"
+ fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
+ stroke-linejoin="round">
+ <circle cx="12" cy="12" r="10"></circle>
+ <line x1="12" x2="12" y1="8" y2="16"></line>
+ <line x1="8" x2="16" y1="12" y2="12"></line>
+ </svg>
+ <span>More...</span>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div
+ class="relative flex cursor-default select-none hover:bg-neutral-100 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
+ stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
+ class="w-4 h-4 mr-2">
+ <line x1="12" x2="12" y1="5" y2="19"></line>
+ <line x1="5" x2="19" y1="12" y2="12"></line>
+ </svg>
+ <span>New Team</span>
+ <span class="ml-auto text-xs tracking-widest opacity-60">⌘+T</span>
+ </div>
+ <div class="h-px my-1 -mx-1 bg-neutral-200"></div>
+ <a href="#_"
+ class="relative flex cursor-default select-none hover:bg-neutral-100 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
+ stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
+ class="w-4 h-4 mr-2">
+ <path
+ d="M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4">
+ </path>
+ <path d="M9 18c-4.51 2-5-2-7-2"></path>
+ </svg>
+ <span>GitHub</span>
+ </a>
+ <a href="#_"
+ class="relative flex cursor-default select-none hover:bg-neutral-100 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
+ stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
+ class="w-4 h-4 mr-2">
+ <circle cx="12" cy="12" r="10"></circle>
+ <circle cx="12" cy="12" r="4"></circle>
+ <line x1="4.93" x2="9.17" y1="4.93" y2="9.17"></line>
+ <line x1="14.83" x2="19.07" y1="14.83" y2="19.07"></line>
+ <line x1="14.83" x2="19.07" y1="9.17" y2="4.93"></line>
+ <line x1="14.83" x2="18.36" y1="9.17" y2="5.64"></line>
+ <line x1="4.93" x2="9.17" y1="19.07" y2="14.83"></line>
+ </svg>
+ <span>Support</span>
+ </a>
+ <a href="#_"
+ class="relative flex cursor-default select-none hover:bg-neutral-100 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50"
+ data-disabled>
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
+ stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
+ class="w-4 h-4 mr-2">
+ <path d="M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z"></path>
+ </svg>
+ <span>API</span>
+ </a>
+ <div class="h-px my-1 -mx-1 bg-neutral-200"></div>
+ <a href="#_"
+ class="relative flex cursor-default select-none hover:bg-neutral-100 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
+ stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
+ class="w-4 h-4 mr-2">
+ <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path>
+ <polyline points="16 17 21 12 16 7"></polyline>
+ <line x1="21" x2="9" y1="12" y2="12"></line>
+ </svg>
+ <span>Log out</span>
+ <span class="ml-auto text-xs tracking-widest opacity-60">⇧⌘Q</span>
+ </a>
+ </div>
+ </div>
+ </div>
+
+</template>
\ No newline at end of file
diff --git a/resources/js/components/pinesUI/InputSelect.vue b/resources/js/components/pinesUI/InputSelect.vue
index ebdf7e6c..a8ee009f 100644
--- a/resources/js/components/pinesUI/InputSelect.vue
+++ b/resources/js/components/pinesUI/InputSelect.vue
@@ -1,81 +1,72 @@
<script setup>
import useSelect from '../../composables/useSelect';
-import { ref, watch, watchEffect } from 'vue';
+import { onMounted, ref, watch } from 'vue';
import { OnClickOutside } from '@vueuse/components'
-defineProps({
+const props = defineProps({
+ // label: {
+ // type: String,
+ // default: 'Select:'
+ // },
placeholder: {
type: String,
default: 'Select Item'
+ },
+ defaultItem: {
+ type: Number,
+ default: null
+ },
+ options: {
+ type: Array,
+ default: () => {
+ return [
+ {
+ title: 'Title',
+ value: "title",
+ disabled: false
+ },
+ {
+ title: 'Date Uploaded',
+ value: "date",
+ disabled: false
+ },
+ {
+ title: 'Date released',
+ value: "date_released",
+ disabled: false
+ },
+ {
+ title: 'Episode',
+ value: "episode",
+ disabled: true
+ },
+ {
+ title: 'Season',
+ value: "season",
+ disabled: true
+ },
+ ];
+ }
}
})
+
+const emit = defineEmits(['selectItem']);
const selectButton = ref(null);
const selectableItemsList = ref(null);
-const select = useSelect([
- {
- title: "Milk",
- value: "milk",
- disabled: false,
- },
- {
- title: "Eggs",
- value: "eggs",
- disabled: false,
- },
- {
- title: "Cheese",
- value: "cheese",
- disabled: false,
- },
- {
- title: "Bread",
- value: "bread",
- disabled: false,
- },
- {
- title: "Apples",
- value: "apples",
- disabled: false,
- },
- {
- title: "Bananas",
- value: "bananas",
- disabled: false,
- },
- {
- title: "Yogurt",
- value: "yogurt",
- disabled: false,
- },
- {
- title: "Sugar",
- value: "sugar",
- disabled: false,
- },
- {
- title: "Salt",
- value: "salt",
- disabled: false,
- },
- {
- title: "Coffee",
- value: "coffee",
- disabled: false,
- },
- {
- title: "Tea",
- value: "tea",
- disabled: false,
- },
-],
- { selectableItemsList, selectButton }
-);
+const select = useSelect(props.options, { selectableItemsList, selectButton });
const handleItemClick = (item) => {
select.selectedItem = item; select.toggleSelect(false); selectButton.value?.focus();
+ emit('selectItem', select.selectedItem);
}
+onMounted(() => {
+ if(props.defaultItem != undefined && props.defaultItem < props.options.length && props.defaultItem >=0){
+ handleItemClick(props.options[props.defaultItem]);
+ }
+})
+
watch(selectButton, () => { select.selectButton = selectButton; }, { immediate: true })
watch(selectableItemsList, () => { select.selectableItemsList = selectableItemsList; }, { immediate: true })
</script>
@@ -84,12 +75,12 @@ watch(selectableItemsList, () => { select.selectableItemsList = selectableItemsL
@keydown.down="if (select.selectOpen) { select.selectableItemActiveNext(); } else { select.toggleSelect(true); } event.preventDefault();"
@keydown.up="if (select.selectOpen) { select.selectableItemActivePrevious(); } else { select.toggleSelect(true); } event.preventDefault();"
@keydown.enter="select.selectedItem = select.selectableItemActive; select.toggleSelect(false);"
- @keydown="select.selectKeydown($event);" class="relative w-64">
+ @keydown="select.selectKeydown($event);" class="relative">
<OnClickOutside @trigger="select.toggleSelect(false);">
<button ref="selectButton" @click="select.toggleSelect();"
- :class="{ 'focus:ring-2 focus:ring-offset-2 focus:ring-neutral-400': !select.selectOpen }"
- class="relative min-h-[38px] flex items-center justify-between w-full py-2 pl-3 pr-10 text-left bg-white border rounded-md shadow-sm cursor-default border-neutral-200/70 focus:outline-none text-sm">
+ :class="{ 'focus:ring-2 focus:ring-indigo-400': !select.selectOpen }"
+ class="relative h-10 flex items-center justify-between w-full py-2 pl-3 pr-10 text-left border rounded-md shadow-sm cursor-default focus:outline-none text-sm bg-white dark:bg-neutral-800 border-neutral-200/70">
<span class="truncate">{{ select.selectedItem ? select.selectedItem.title : placeholder }}</span>
<span class="absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"
@@ -108,15 +99,15 @@ watch(selectableItemsList, () => { select.selectableItemsList = selectableItemsL
<ul v-show="select.selectOpen" ref="selectableItemsList"
:class="{ 'bottom-0 mb-10': select.selectDropdownPosition == 'top', 'top-0 mt-10': select.selectDropdownPosition == 'bottom' }"
- class="absolute w-full mt-1 overflow-auto text-sm bg-white rounded-md shadow-md max-h-56 ring-1 ring-black ring-opacity-5 focus:outline-none"
+ class="absolute w-full mt-1 overflow-auto text-sm rounded-md shadow-md max-h-56 focus:outline-none ring-1 ring-opacity-5 ring-black dark:ring-neutral-700 bg-white dark:bg-neutral-800"
v-cloak>
<template v-for="item in select.selectableItems" :key="item.value">
<li @click="handleItemClick(item)" :id="item.value + '-' + select.selectId"
:data-disabled="item.disabled ? item.disabled : ''"
- :class="{ 'bg-neutral-100 text-gray-900': select.selectableItemIsActive(item), '': !select.selectableItemIsActive(item) }"
+ :class="{ 'bg-neutral-100 dark:bg-neutral-900 text-gray-900 dark:text-neutral-100': select.selectableItemIsActive(item), 'text-gray-700 dark:text-neutral-300': !select.selectableItemIsActive(item) }"
@mousemove="select.selectableItemActive = item"
- class="relative flex items-center h-full py-2 pl-8 text-gray-700 cursor-default select-none data-[disabled=true]:opacity-50 data-[disabled=true]:pointer-events-none">
+ class="relative flex items-center h-full py-2 pl-8 cursor-default select-none data-[disabled=true]:opacity-50 data-[disabled=true]:pointer-events-none">
<svg v-if="select.selectedItem.value == item.value"
class="absolute left-0 w-4 h-4 ml-2 stroke-current text-neutral-400"
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
diff --git a/resources/js/components/pinesUI/ToastNotification.vue b/resources/js/components/pinesUI/ToastNotification.vue
new file mode 100644
index 00000000..5bd61088
--- /dev/null
+++ b/resources/js/components/pinesUI/ToastNotification.vue
@@ -0,0 +1,510 @@
+<template>
+ <div class="relative w-auto h-auto">
+ <div x-data="{
+ title: 'Default Toast Notification',
+ description: '',
+ type: 'default',
+ position: 'top-center',
+ expanded: false,
+ popToast (custom){
+ let html = '';
+ if(typeof custom != 'undefined'){
+ html = custom;
+ }
+ toast(this.title, { description: this.description, type: this.type, position: this.position, html: html })
+ }
+ }" x-init="
+ window.toast = function(message, options = {}){
+ let description = '';
+ let type = 'default';
+ let position = 'top-center';
+ let html = '';
+ if(typeof options.description != 'undefined') description = options.description;
+ if(typeof options.type != 'undefined') type = options.type;
+ if(typeof options.position != 'undefined') position = options.position;
+ if(typeof options.html != 'undefined') html = options.html;
+
+ window.dispatchEvent(new CustomEvent('toast-show', { detail : { type: type, message: message, description: description, position : position, html: html }}));
+ }
+
+ window.customToastHTML = `
+ <div class='relative flex items-start justify-center p-4'>
+ <img src='https://cdn.devdojo.com/images/august2023/headshot-new.jpeg' class='w-10 h-10 mr-2 rounded-full'>
+ <div class='flex flex-col'>
+ <p class='text-sm font-medium text-gray-800'>New Friend Request</p>
+ <p class='mt-1 text-xs leading-none text-gray-800'>Friend request from John Doe.</p>
+ <div class='flex mt-3'>
+ <button type='button' @click='burnToast(toast.id)' class='inline-flex items-center px-2 py-1 text-xs font-semibold text-white bg-indigo-600 rounded shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600'>Accept</button>
+ <button type='button' @click='burnToast(toast.id)' class='inline-flex items-center px-2 py-1 ml-3 text-xs font-semibold text-gray-900 bg-white rounded shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50'>Decline</button>
+ </div>
+ </div>
+ </div>
+ `
+ " class="relative space-y-5">
+ <div class="relative">
+ <p class="mb-2 text-xs font-medium text-center text-gray-500 sm:text-left">Types</p>
+ <div class="relative flex flex-col px-10 space-y-2 sm:space-x-5 sm:space-y-0 sm:flex-row sm:px-0">
+ <button @click="title = 'Default Toast Notification'; type = 'default'; description = ''; popToast()"
+ :class="{ 'ring-2 ring-neutral-200/60': type == 'default' && description == '' }"
+ class="inline-flex items-center justify-center flex-shrink-0 px-3 py-1 text-xs font-medium transition-colors border rounded-md h-9 hover:bg-gray-50 active:bg-white focus:bg-white focus:outline-none">Default</button>
+ <button
+ @click="title = 'Toast Notification'; type = 'default'; description = 'This is an example toast notification'; popToast()"
+ :class="{ 'ring-2 ring-neutral-200/60': type == 'default' && description != '' }"
+ class="inline-flex items-center justify-center flex-shrink-0 px-3 py-1 text-xs font-medium transition-colors border rounded-md h-9 hover:bg-gray-50 active:bg-white focus:bg-white focus:outline-none">With
+ Description</button>
+ <button @click="title = 'Success Notification'; type = 'success'; popToast()"
+ :class="{ 'ring-2 ring-neutral-200/60': type == 'success' }"
+ class="inline-flex items-center justify-center flex-shrink-0 px-3 py-1 text-xs font-medium transition-colors border rounded-md h-9 hover:bg-gray-50 active:bg-white focus:bg-white focus:outline-none">Success</button>
+ <button @click="title = 'Info Notification'; type = 'info'; popToast()"
+ :class="{ 'ring-2 ring-neutral-200/60': type == 'info' }"
+ class="inline-flex items-center justify-center flex-shrink-0 px-3 py-1 text-xs font-medium transition-colors border rounded-md h-9 hover:bg-gray-50 active:bg-white focus:bg-white focus:outline-none">Info</button>
+ <button @click="title = 'Warning Notification'; type = 'warning'; popToast()"
+ :class="{ 'ring-2 ring-neutral-200/60': type == 'warning' }"
+ class="inline-flex items-center justify-center flex-shrink-0 px-3 py-1 text-xs font-medium transition-colors border rounded-md h-9 hover:bg-gray-50 active:bg-white focus:bg-white focus:outline-none">Warning</button>
+ <button @click="title = 'Danger Notification'; type = 'danger'; popToast()"
+ :class="{ 'ring-2 ring-neutral-200/60': type == 'danger' }"
+ class="inline-flex items-center justify-center flex-shrink-0 px-3 py-1 text-xs font-medium transition-colors border rounded-md h-9 hover:bg-gray-50 active:bg-white focus:bg-white focus:outline-none">Danger</button>
+
+ <button @click="popToast(customToastHTML)"
+ :class="{ 'ring-2 ring-neutral-200/60': type == 'success' }"
+ class="inline-flex items-center justify-center flex-shrink-0 px-3 py-1 text-xs font-medium transition-colors border rounded-md h-9 hover:bg-gray-50 active:bg-white focus:bg-white focus:outline-none">Custom</button>
+ </div>
+ </div>
+ <div class="relative">
+ <p class="mb-2 text-xs font-medium text-center text-gray-500 sm:text-left">Position</p>
+ <div class="relative flex flex-col px-10 space-y-2 sm:space-x-5 sm:space-y-0 sm:flex-row sm:px-0">
+
+ <button @click="position = 'top-left'; popToast()"
+ :class="{ 'ring-2 ring-neutral-200/60': position == 'top-left' }"
+ class="inline-flex items-center justify-center flex-shrink-0 px-3 py-1 text-xs font-medium transition-colors border rounded-md h-9 hover:bg-gray-50 active:bg-white focus:bg-white focus:outline-none">Top
+ Left</button>
+ <button @click="position = 'top-center'; popToast()"
+ :class="{ 'ring-2 ring-neutral-200/60': position == 'top-center' }"
+ class="inline-flex items-center justify-center flex-shrink-0 px-3 py-1 text-xs font-medium transition-colors border rounded-md h-9 hover:bg-gray-50 active:bg-white focus:bg-white focus:outline-none">Top
+ Center</button>
+ <button @click="position = 'top-right'; popToast()"
+ :class="{ 'ring-2 ring-neutral-200/60': position == 'top-right' }"
+ class="inline-flex items-center justify-center flex-shrink-0 px-3 py-1 text-xs font-medium transition-colors border rounded-md h-9 hover:bg-gray-50 active:bg-white focus:bg-white focus:outline-none">Top
+ Right</button>
+ <button @click="position = 'bottom-right'; popToast()"
+ :class="{ 'ring-2 ring-neutral-200/60': position == 'bottom-right' }"
+ class="inline-flex items-center justify-center flex-shrink-0 px-3 py-1 text-xs font-medium transition-colors border rounded-md h-9 hover:bg-gray-50 active:bg-white focus:bg-white focus:outline-none">Bottom
+ Right</button>
+ <button @click="position = 'bottom-center'; popToast()"
+ :class="{ 'ring-2 ring-neutral-200/60': position == 'bottom-center' }"
+ class="inline-flex items-center justify-center flex-shrink-0 px-3 py-1 text-xs font-medium transition-colors border rounded-md h-9 hover:bg-gray-50 active:bg-white focus:bg-white focus:outline-none">Bottom
+ Center</button>
+ <button @click="position = 'bottom-left'; popToast()"
+ :class="{ 'ring-2 ring-neutral-200/60': position == 'bottom-left' }"
+ class="inline-flex items-center justify-center flex-shrink-0 px-3 py-1 text-xs font-medium transition-colors border rounded-md h-9 hover:bg-gray-50 active:bg-white focus:bg-white focus:outline-none">Bottom
+ Left</button>
+ </div>
+ </div>
+ <div class="relative">
+ <p class="mb-2 text-xs font-medium text-center text-gray-500 sm:text-left">Layout</p>
+ <div class="relative flex flex-col px-10 space-y-2 sm:space-x-5 sm:space-y-0 sm:flex-row sm:px-0">
+ <button
+ @click="expanded = false; window.dispatchEvent(new CustomEvent('set-toasts-layout', { detail: { layout: 'default' } }));"
+ :class="{ 'ring-2 ring-neutral-200/60': !expanded }"
+ class="inline-flex items-center justify-center flex-shrink-0 px-3 py-1 text-xs font-medium transition-colors border rounded-md h-9 hover:bg-gray-50 active:bg-white focus:bg-white focus:outline-none">Default</button>
+ <button
+ @click="expanded = true; window.dispatchEvent(new CustomEvent('set-toasts-layout', { detail: { layout: 'expanded' } }));"
+ :class="{ 'ring-2 ring-neutral-200/60': expanded }"
+ class="inline-flex items-center justify-center flex-shrink-0 px-3 py-1 text-xs font-medium transition-colors border rounded-md h-9 hover:bg-gray-50 active:bg-white focus:bg-white focus:outline-none">Expanded</button>
+ </div>
+ </div>
+ </div>
+ <template x-teleport="body">
+ <ul x-data="{
+ toasts: [],
+ toastsHovered: false,
+ expanded: false,
+ layout: 'default',
+ position: 'top-center',
+ paddingBetweenToasts: 15,
+ deleteToastWithId (id){
+ for(let i = 0; i < this.toasts.length; i++){
+ if(this.toasts[i].id === id){
+ this.toasts.splice(i, 1);
+ break;
+ }
+ }
+ },
+ burnToast(id){
+ burnToast = this.getToastWithId(id);
+ 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');
+ let that = this;
+ setTimeout(function(){
+ that.deleteToastWithId(id);
+ setTimeout(function(){
+ that.stackToasts();
+ }, 1)
+ }, 300);
+ }
+ },
+ getToastWithId(id){
+ for(let i = 0; i < this.toasts.length; i++){
+ if(this.toasts[i].id === id){
+ return this.toasts[i];
+ }
+ }
+ },
+ stackToasts(){
+ this.positionToasts();
+ this.calculateHeightOfToastsContainer();
+ let that = this;
+ setTimeout(function(){
+ that.calculateHeightOfToastsContainer();
+ }, 300);
+ },
+ positionToasts(){
+ if(this.toasts.length == 0) return;
+ let topToast = document.getElementById( this.toasts[0].id );
+ 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);
+
+ if(this.toasts.length == 1) return;
+ let middleToast = document.getElementById( this.toasts[1].id );
+ middleToast.style.zIndex = 90;
+
+ if(this.expanded){
+ 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 );
+ bottomToast.style.zIndex = 80;
+ if(this.expanded){
+ 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 );
+ burnToast.style.zIndex = 70;
+ if(this.expanded){
+ 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');
+
+ let that = this;
+ // Burn 🔥 (remove) last toast
+ setTimeout(function(){
+ that.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.style.height = '0px';
+ return;
+ }
+
+ lastToast = this.toasts[this.toasts.length - 1];
+ lastToastRectangle = document.getElementById(lastToast.id).getBoundingClientRect();
+
+ firstToast = this.toasts[0];
+ firstToastRectangle = document.getElementById(firstToast.id).getBoundingClientRect();
+
+ if(this.toastsHovered){
+ if(this.position.includes('bottom')){
+ $el.style.height = ((firstToastRectangle.top + firstToastRectangle.height) - lastToastRectangle.top) + 'px';
+ } else {
+ $el.style.height = ((lastToastRectangle.top + lastToastRectangle.height) - firstToastRectangle.top) + 'px';
+ }
+ } else {
+ $el.style.height = firstToastRectangle.height + 'px';
+ }
+ }
+ }" @set-toasts-layout.window="
+ layout = event.detail.layout;
+ if (layout == 'expanded') {
+ expanded = true;
+ } else {
+ expanded = false;
+ }
+ stackToasts();
+ " @toast-show.window="
+ event.stopPropagation();
+ if (event.detail.position) {
+ position = event.detail.position;
+ }
+ toasts.unshift({
+ id: 'toast-' + Math.random().toString(16).slice(2),
+ show: false,
+ message: event.detail.message,
+ description: event.detail.description,
+ type: event.detail.type,
+ html: event.detail.html
+ });
+ " @mouseenter="toastsHovered = true;" @mouseleave="toastsHovered = false" x-init="
+ if(layout == 'expanded'){
+ expanded = true;
+ }
+ stackToasts();
+ $watch('toastsHovered', function(value){
+
+ if(layout == 'default'){
+ if(position.includes('bottom')){
+ resetBottom();
+ } else {
+ resetTop();
+ }
+
+ if(value){
+ // calculate the new positions
+ expanded = true;
+ if(layout == 'default'){
+ stackToasts();
+ }
+ } else {
+ if(layout == 'default'){
+ expanded = false;
+ //setTimeout(function(){
+ stackToasts();
+ //}, 10);
+ setTimeout(function(){
+ stackToasts();
+ }, 10)
+ }
+ }
+ }
+ });
+ " class="fixed block w-full group z-[99] sm:max-w-xs"
+ :class="{ 'right-0 top-0 sm:mt-6 sm:mr-6': position == 'top-right', 'left-0 top-0 sm:mt-6 sm:ml-6': position == 'top-left', 'left-1/2 -translate-x-1/2 top-0 sm:mt-6': position == 'top-center', 'right-0 bottom-0 sm:mr-6 sm:mb-6': position == 'bottom-right', 'left-0 bottom-0 sm:ml-6 sm:mb-6': position == 'bottom-left', 'left-1/2 -translate-x-1/2 bottom-0 sm:mb-6': position == 'bottom-center' }"
+ x-cloak>
+
+ <template x-for="(toast, index) in toasts" :key="toast.id">
+ <li :id="toast.id" x-data="{
+ toastHovered: false
+ }" x-init="
+
+ if(position.includes('bottom')){
+ $el.firstElementChild.classList.add('toast-bottom');
+ $el.firstElementChild.classList.add('opacity-0', 'translate-y-full');
+ } else {
+ $el.firstElementChild.classList.add('opacity-0', '-translate-y-full');
+ }
+ setTimeout(function(){
+
+ setTimeout(function(){
+ if(position.includes('bottom')){
+ $el.firstElementChild.classList.remove('opacity-0', 'translate-y-full');
+ } else {
+ $el.firstElementChild.classList.remove('opacity-0', '-translate-y-full');
+ }
+ $el.firstElementChild.classList.add('opacity-100', 'translate-y-0');
+
+ setTimeout(function(){
+ stackToasts();
+ }, 10);
+ }, 5);
+ }, 50);
+
+ setTimeout(function(){
+ setTimeout(function(){
+ $el.firstElementChild.classList.remove('opacity-100');
+ $el.firstElementChild.classList.add('opacity-0');
+ if(toasts.length == 1){
+ $el.firstElementChild.classList.remove('translate-y-0');
+ $el.firstElementChild.classList.add('-translate-y-full');
+ }
+ setTimeout(function(){
+ deleteToastWithId(toast.id)
+ }, 300);
+ }, 5);
+ }, 4000);
+ " @mouseover="toastHovered = true" @mouseout="toastHovered = false"
+ class="absolute w-full duration-300 ease-out select-none sm:max-w-xs"
+ :class="{ 'toast-no-description': !toast.description }">
+ <span
+ class="relative flex flex-col items-start shadow-[0_5px_15px_-3px_rgb(0_0_0_/_0.08)] w-full transition-all duration-300 ease-out bg-white border border-gray-100 sm:rounded-md sm:max-w-xs group"
+ :class="{ 'p-4': !toast.html, 'p-0': toast.html }">
+ <template x-if="!toast.html">
+ <div class="relative">
+ <div class="flex items-center"
+ :class="{ 'text-green-500': toast.type == 'success', 'text-blue-500': toast.type == 'info', 'text-orange-400': toast.type == 'warning', 'text-red-500': toast.type == 'danger', 'text-gray-800': toast.type == 'default' }">
+
+ <svg x-show="toast.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"
+ d="M12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM16.7744 9.63269C17.1238 9.20501 17.0604 8.57503 16.6327 8.22559C16.2051 7.87615 15.5751 7.93957 15.2256 8.36725L10.6321 13.9892L8.65936 12.2524C8.24484 11.8874 7.61295 11.9276 7.248 12.3421C6.88304 12.7566 6.92322 13.3885 7.33774 13.7535L9.31046 15.4903C10.1612 16.2393 11.4637 16.1324 12.1808 15.2547L16.7744 9.63269Z"
+ fill="currentColor"></path>
+ </svg>
+ <svg x-show="toast.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"
+ d="M12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM12 9C12.5523 9 13 8.55228 13 8C13 7.44772 12.5523 7 12 7C11.4477 7 11 7.44772 11 8C11 8.55228 11.4477 9 12 9ZM13 12C13 11.4477 12.5523 11 12 11C11.4477 11 11 11.4477 11 12V16C11 16.5523 11.4477 17 12 17C12.5523 17 13 16.5523 13 16V12Z"
+ fill="currentColor"></path>
+ </svg>
+ <svg x-show="toast.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"
+ d="M9.44829 4.46472C10.5836 2.51208 13.4105 2.51168 14.5464 4.46401L21.5988 16.5855C22.7423 18.5509 21.3145 21 19.05 21L4.94967 21C2.68547 21 1.25762 18.5516 2.4004 16.5862L9.44829 4.46472ZM11.9995 8C12.5518 8 12.9995 8.44772 12.9995 9V13C12.9995 13.5523 12.5518 14 11.9995 14C11.4473 14 10.9995 13.5523 10.9995 13V9C10.9995 8.44772 11.4473 8 11.9995 8ZM12.0009 15.99C11.4486 15.9892 11.0003 16.4363 10.9995 16.9886L10.9995 16.9986C10.9987 17.5509 11.4458 17.9992 11.9981 18C12.5504 18.0008 12.9987 17.5537 12.9995 17.0014L12.9995 16.9914C13.0003 16.4391 12.5532 15.9908 12.0009 15.99Z"
+ fill="currentColor"></path>
+ </svg>
+ <svg x-show="toast.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"
+ d="M2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12ZM11.9996 7C12.5519 7 12.9996 7.44772 12.9996 8V12C12.9996 12.5523 12.5519 13 11.9996 13C11.4474 13 10.9996 12.5523 10.9996 12V8C10.9996 7.44772 11.4474 7 11.9996 7ZM12.001 14.99C11.4488 14.9892 11.0004 15.4363 10.9997 15.9886L10.9996 15.9986C10.9989 16.5509 11.446 16.9992 11.9982 17C12.5505 17.0008 12.9989 16.5537 12.9996 16.0014L12.9996 15.9914C13.0004 15.4391 12.5533 14.9908 12.001 14.99Z"
+ fill="currentColor"></path>
+ </svg>
+ <p class="text-[13px] font-medium leading-none text-gray-800"
+ x-text="toast.message"></p>
+ </div>
+ <p x-show="toast.description" :class="{ 'pl-5': toast.type != 'default' }"
+ class="mt-1.5 text-xs leading-none opacity-70" x-text="toast.description"></p>
+ </div>
+ </template>
+ <template x-if="toast.html">
+ <div x-html="toast.html"></div>
+ </template>
+ <span @click="burnToast(toast.id)"
+ class="absolute right-0 p-1.5 mr-2.5 text-gray-400 duration-100 ease-in-out rounded-full opacity-0 cursor-pointer hover:bg-gray-50 hover:text-gray-500"
+ :class="{ 'top-1/2 -translate-y-1/2': !toast.description && !toast.html, 'top-0 mt-2.5': (toast.description || toast.html), 'opacity-100': toastHovered, 'opacity-0': !toastHovered }">
+ <svg class="w-3 h-3" fill="currentColor" viewBox="0 0 20 20"
+ xmlns="http://www.w3.org/2000/svg">
+ <path fill-rule="evenodd"
+ d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
+ clip-rule="evenodd"></path>
+ </svg>
+ </span>
+ </span>
+ </li>
+ </template>
+ </ul>
+ </template>
+ </div>
+</template>
\ No newline at end of file
diff --git a/resources/js/components/video/VideoTable.vue b/resources/js/components/video/VideoTable.vue
index 6589b061..d4bef1e5 100644
--- a/resources/js/components/video/VideoTable.vue
+++ b/resources/js/components/video/VideoTable.vue
@@ -1,12 +1,16 @@
<script setup>
import LabelledTextInput from '../inputs/LabelledTextInput.vue';
+import FormInputLabel from '../labels/FormInputLabel.vue';
import TablePagination from '../table/TablePagination.vue';
+import InputSelect from '../pinesUI/InputSelect.vue';
import VideoCard from '../cards/VideoCard.vue';
+import PhSortAscendingLight from '~icons/ph/sort-ascending-light';
+import PhSortDescendingLight from '~icons/ph/sort-descending-light';
+
import { useContentStore } from '../../stores/ContentStore';
import { storeToRefs } from 'pinia';
import { computed, ref, watch } from 'vue';
-import InputSelect from '../pinesUI/InputSelect.vue';
const ContentStore = useContentStore();
@@ -18,9 +22,11 @@ const itemsPerPage = ref(10);
const filteredPage = computed(() => {
const minIndex = itemsPerPage.value * (currentPage.value - 1);
const maxIndex = Math.min(itemsPerPage.value * (currentPage.value), stateFilteredPlaylist.value.length);
-
+
return stateFilteredPlaylist.value.slice(minIndex, maxIndex);
});
+const sortAscending = ref(true);
+const lastSortKey = ref('');
const handlePageChange = (page) => {
currentPage.value = page;
@@ -30,40 +36,79 @@ const handlePageReset = () => {
currentPage.value = 1
};
-const tableColumnGroups = [
- [{ name: 'Title', colspan: '2', minWidth: 'lg:min-w-48', colName: 'name' },
- { name: 'Length', colspan: '1', minWidth: 'xl:min-w-6', colName: 'name' }],
- [{ name: 'Views', colspan: '1', minWidth: 'xl:min-w-6', colName: 'date' },
- { name: 'Date', colspan: '2', minWidth: 'xl:min-w-40', colName: 'date' }],
-];
+const handleSortChange = (sortKey) => {
+ if(sortKey?.value) lastSortKey.value = sortKey?.value;
+
+ if(!lastSortKey.value) return;
+ playlistSort(lastSortKey.value, sortAscending.value ? 1 : -1)
+}
+
+const sortingOptions = ref([
+ {
+ title: 'Title',
+ value: 'title',
+ disabled: false
+ },
+ {
+ title: 'Duration',
+ value: 'duration',
+ disabled: false
+ },
+ {
+ title: 'Views',
+ value: 'view_count',
+ disabled: false
+ },
+ {
+ title: 'Date Uploaded',
+ value: 'date',
+ disabled: false
+ },
+ {
+ title: 'Date released',
+ value: 'date_released',
+ disabled: true
+ },
+ {
+ title: 'Episode',
+ value: 'episode',
+ disabled: true
+ },
+ {
+ title: 'Season',
+ value: 'season',
+ disabled: true
+ },
+]);
-watch(stateFolder, handlePageReset, {immediate: true})
+watch(stateFolder, handlePageReset, { immediate: true })
</script>
<template>
<table class="w-full flex flex-col gap-2">
- <section class="flex justify-center sm:justify-between p-2">
+ <section class="flex justify-center sm:justify-between py-2 flex-col sm:flex-row gap-2">
<!-- <h2 class="text-2xl py-4">Episodes</h2> -->
- <LabelledTextInput v-model="searchQuery" :text="'Search'" :placeholder="'Enter search query'" :id="'table-search'" class="w-80"/>
- <InputSelect :placeholder="'Sort By'"/>
+ <LabelledTextInput v-model="searchQuery" :text="'Search:'" :placeholder="'Enter Search Query...'"
+ :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"/>
+ </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>
+ </span>
</section>
<hr>
- <thead class="w-full flex-col hidden sm:flex">
- <tr class="w-full flex justify-between gap-12 text-left" >
- <th class="px-3 flex gap-12 w-full items-center">
- <span v-for="(column, idx) in tableColumnGroups[0]" :key="idx" :class="column.minWidth" @click="playlistSort(column.colName, 0)">{{column.name }}</span>
- </th>
- <th class="px-3 flex gap-12 w-full justify-end text-right items-center">
- <span v-for="(column, idx) in tableColumnGroups[1]" :key="idx" :class="column.minWidth" @click="playlistSort(column.colName, 0)">{{ column.name }}</span>
- </th>
- </tr>
- </thead>
- <tbody
- class="flex w-full flex-wrap gap-2">
+ <tbody class="flex w-full flex-wrap gap-2">
<VideoCard v-for="(video, index) in filteredPage" :key="index" :video="video" :index="index"
:currentID="stateVideo?.id" @playByID="playlistFind" />
</tbody>
<hr>
- <TablePagination :listLength="stateFilteredPlaylist?.length ?? 0" :itemsPerPage="itemsPerPage" :currentPage="currentPage" @setPage="handlePageChange"/>
+ <TablePagination :listLength="stateFilteredPlaylist?.length ?? 0" :itemsPerPage="itemsPerPage"
+ :currentPage="currentPage" @setPage="handlePageChange" />
</table>
</template>
\ No newline at end of file
diff --git a/resources/js/composables/useSelect.js b/resources/js/composables/useSelect.js
index cdf4399f..19d7f22e 100644
--- a/resources/js/composables/useSelect.js
+++ b/resources/js/composables/useSelect.js
@@ -3,7 +3,7 @@ import { reactive, watch } from "vue";
export default function useSelect(options, refs) {
const select = reactive({
selectOpen: false,
- selectedItem: "",
+ selectedItem: '',
selectableItems: options,
selectableItemActive: null,
selectId: 'select-12',
@@ -110,21 +110,21 @@ export default function useSelect(options, refs) {
},
});
- // watch(() => select.selectOpen,
- // function () {
- // if (!select.selectedItem) {
- // select.selectableItemActive = select.selectableItems[0];
- // } else {
- // select.selectableItemActive = select.selectedItem;
- // }
- // setTimeout(function () {
- // select.selectScrollToActiveItem();
- // }, 10);
- // select.selectPositionUpdate();
- // window.addEventListener("resize", (event) => {
- // select.selectPositionUpdate();
- // });
- // }, {immediate: false});
+ watch(() => select.selectOpen,
+ function () {
+ if (!select.selectedItem) {
+ select.selectableItemActive = select.selectableItems[0];
+ } else {
+ select.selectableItemActive = select.selectedItem;
+ }
+ setTimeout(function () {
+ select.selectScrollToActiveItem();
+ }, 10);
+ select.selectPositionUpdate();
+ window.addEventListener("resize", () => {
+ select.selectPositionUpdate();
+ });
+ }, {immediate: false});
return select;
}
diff --git a/resources/js/stores/ContentStore.js b/resources/js/stores/ContentStore.js
index c9fd03e2..e2f4af56 100644
--- a/resources/js/stores/ContentStore.js
+++ b/resources/js/stores/ContentStore.js
@@ -30,7 +30,6 @@ export const useContentStore = defineStore('Content', () => {
const searchQuery = ref('');
const filterQuery = ref({search: '', season: -1, tag: ''});
- const sortQuery = ref({name: 0, date: 0});
async function updateViewCount(id){
const { data, error } = await mediaAPI.viewVideo(id);
@@ -167,7 +166,6 @@ export const useContentStore = defineStore('Content', () => {
// InitPlaylist (set up playlist with indexes and current video)
async function InitPlaylist(){
filterQuery.value = {search: '', season: -1, tag: ''};
- sortQuery.value = {name: 0, date: 0};
if(!stateFolder.value.id){
// eslint-disable-next-line no-undef
toastr["error"](`The folder '${stateFolder.value.name}' does not exist.`, "Invalid folder");
@@ -181,23 +179,23 @@ export const useContentStore = defineStore('Content', () => {
}
const playlistSort = (column = 'name', dir = 1) => {
- if(dir === 0 && sortQuery.value[column] === 0) dir = 1; // If never used, sort ascending
- else if(dir === 0) dir = -sortQuery.value[column]; // if toggle, set negative order
-
+ // if(dir === 0 && sortQuery.value[column] === 0) dir = 1; // If never used, sort ascending
+ // else if(dir === 0) dir = -sortQuery.value[column]; // if toggle, set negative order
let tempList = statePlaylist.value.sort((videoA, videoB) => {
if(column === 'date'){
let dateA = new Date(videoA?.attributes[column]);
let dateB = new Date(videoB?.attributes[column]);
return (dateB - dateA) * dir;
}
- return videoA?.attributes[column].localeCompare(videoB?.attributes[column]) * dir;
+ if(column === 'name' || column === 'title') return videoA?.attributes[column].localeCompare(videoB?.attributes[column]) * dir;
+ return (videoB?.attributes[column] - videoA?.attributes[column]) * dir;
});
stateFilteredPlaylist.value = tempList;
- let tempQuery = sortQuery.value;
- tempQuery[column] = dir;
- sortQuery.value = tempQuery;
+ // let tempQuery = sortQuery.value;
+ // tempQuery[column] = dir;
+ // sortQuery.value = tempQuery;
return tempList;
}
diff --git a/resources/js/views/ProfileView.vue b/resources/js/views/ProfileView.vue
index bf26a4da..f036097d 100644
--- a/resources/js/views/ProfileView.vue
+++ b/resources/js/views/ProfileView.vue
@@ -1,3 +1,14 @@
+<script setup lang="ts">
+import DropdownMenu from '../components/pinesUI/DropdownMenu.vue';
+import LayoutBase from '../components/layout/LayoutBase.vue';
+</script>
+
<template>
- Profile
+ <LayoutBase>
+ <template v-slot:content>
+ <section class="min-h-[80vh]">
+ <DropdownMenu />
+ </section>
+ </template>
+ </LayoutBase>
</template>
\ No newline at end of file