Rework frontend

This commit is contained in:
F4ilji
2025-03-23 00:38:16 +05:00
parent 17518ceed2
commit 49072e50c7
438 changed files with 14375 additions and 20015 deletions
@@ -0,0 +1,54 @@
<template>
<component
v-for="(filter, index) in filters"
:key="index"
:is="getComponent(filter.type)"
:filter="filter"
/>
</template>
<script>
import {Link} from "@inertiajs/vue3";
import SearchBadge from "@/componentss/shared/badge/badges/SearchBadge.vue";
import CategoryBadge from "@/componentss/shared/badge/badges/CategoryBadge.vue";
import TagBadge from "@/componentss/shared/badge/badges/TagBadge.vue";
import SortingByBadge from "@/componentss/shared/badge/badges/SortingByBadge.vue";
import IsOnlineBadge from "@/componentss/shared/badge/badges/IsOnlineBadge.vue";
export default {
name: "BasicListBadge",
components: {
Link,
SearchBadge,
CategoryBadge,
TagBadge,
SortingByBadge,
IsOnlineBadge
},
data() {
return {
}
},
methods: {
getComponent(type) {
const componentMap = {
search: 'SearchBadge',
category: 'CategoryBadge',
tag: 'TagBadge',
sort: 'SortingByBadge',
is_online: 'IsOnlineBadge'
};
return componentMap[type] || null;
},
},
props: {
filters: {
type: Object,
},
},
}
</script>
<style scoped>
</style>
@@ -0,0 +1,56 @@
<template>
<span v-if="this.filter.value !== null" class="inline-flex items-center gap-x-1.5 py-1.5 ps-3 pe-2 rounded-full text-xs font-medium bg-blue-100 text-blue-800">
{{ (filter.value.length > 1) ? filter.value.length + ' категории' : filter.content[filter.value[0]].data.title }}
<button @click.prevent="clearFilter" type="button" class="shrink-0 size-4 inline-flex items-center justify-center rounded-full hover:bg-blue-200 focus:outline-none focus:bg-blue-200 focus:text-blue-500">
<span class="sr-only">Remove badge</span>
<svg class="shrink-0 size-3" 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">
<path d="M18 6 6 18"></path>
<path d="m6 6 12 12"></path>
</svg>
</button>
</span>
</template>
<script>
import { Link } from "@inertiajs/vue3";
import slugify from "slugify";
export default {
name: "CategoryBadge",
components: { Link },
data() {
return {};
},
methods: {
clearFilter() {
let url = new URL(window.location.href);
// Создаем массив для хранения всех ключей, которые нужно удалить
const keysToDelete = [];
// Перебираем все параметры и добавляем ключи, начинающиеся с 'category', в массив
for (const [key] of url.searchParams) {
if (key.startsWith(this.filter.param)) {
keysToDelete.push(key);
}
}
// Удаляем все ключи из массива
keysToDelete.forEach(key => url.searchParams.delete(key));
let newUrl = url.toString();
this.$inertia.visit(newUrl, {
method: 'get',
});
},
},
props: {
filter: {
type: Object,
},
},
}
</script>
<style scoped>
</style>
@@ -0,0 +1,46 @@
<template>
<span v-if="filter.value !== null" class="inline-flex items-center gap-x-1.5 py-1.5 ps-3 pe-2 rounded-full text-xs font-medium bg-blue-100 text-blue-800">
Мероприятие: {{ filter.value }}
<button @click.prevent="clearFilter" type="button" class="shrink-0 size-4 inline-flex items-center justify-center rounded-full hover:bg-blue-200 focus:outline-none focus:bg-blue-200 focus:text-blue-500">
<span class="sr-only">Remove badge</span>
<svg class="shrink-0 size-3" 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">
<path d="M18 6 6 18"></path>
<path d="m6 6 12 12"></path>
</svg>
</button>
</span>
</template>
<script>
import {Link} from "@inertiajs/vue3";
import slugify from "slugify";
export default {
name: "IsOnlineBadge",
components: {Link},
data() {
return {
}
},
methods: {
clearFilter() {
let url = new URL(window.location.href);
url.searchParams.delete(this.filter.param);
let newUrl = url.toString();
this.$inertia.visit(newUrl,{
method: 'get',
});
},
},
props: {
filter: {
type: Object,
},
},
}
</script>
<style scoped>
</style>
@@ -0,0 +1,46 @@
<template>
<span v-if="filter.value !== null" class="inline-flex items-center gap-x-1.5 py-1.5 ps-3 pe-2 rounded-full text-xs font-medium bg-blue-100 text-blue-800">
Поиск: {{ filter.value }}
<button @click.prevent="clearFilter" type="button" class="shrink-0 size-4 inline-flex items-center justify-center rounded-full hover:bg-blue-200 focus:outline-none focus:bg-blue-200 focus:text-blue-500">
<span class="sr-only">Remove badge</span>
<svg class="shrink-0 size-3" 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">
<path d="M18 6 6 18"></path>
<path d="m6 6 12 12"></path>
</svg>
</button>
</span>
</template>
<script>
import {Link} from "@inertiajs/vue3";
import slugify from "slugify";
export default {
name: "SearchBadge",
components: {Link},
data() {
return {
}
},
methods: {
clearFilter() {
let url = new URL(window.location.href);
url.searchParams.delete(this.filter.param);
let newUrl = url.toString();
this.$inertia.visit(newUrl,{
method: 'get',
});
},
},
props: {
filter: {
type: Object,
},
},
}
</script>
<style scoped>
</style>
@@ -0,0 +1,46 @@
<template>
<span v-if="filter.value !== null" class="inline-flex items-center gap-x-1.5 py-1.5 ps-3 pe-2 rounded-full text-xs font-medium bg-blue-100 text-blue-800">
Сортировка: {{ filter.value }}
<button @click.prevent="clearFilter" type="button" class="shrink-0 size-4 inline-flex items-center justify-center rounded-full hover:bg-blue-200 focus:outline-none focus:bg-blue-200 focus:text-blue-500">
<span class="sr-only">Remove badge</span>
<svg class="shrink-0 size-3" 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">
<path d="M18 6 6 18"></path>
<path d="m6 6 12 12"></path>
</svg>
</button>
</span>
</template>
<script>
import {Link} from "@inertiajs/vue3";
import slugify from "slugify";
export default {
name: "SortingByBadge",
components: {Link},
data() {
return {
}
},
methods: {
clearFilter() {
let url = new URL(window.location.href);
url.searchParams.delete(this.filter.param);
let newUrl = url.toString();
this.$inertia.visit(newUrl,{
method: 'get',
});
},
},
props: {
filter: {
type: Object,
},
},
}
</script>
<style scoped>
</style>
@@ -0,0 +1,59 @@
<template>
<span v-if="this.filter.value !== null" class="inline-flex items-center gap-x-1.5 py-1.5 ps-3 pe-2 rounded-full text-xs font-medium bg-blue-100 text-blue-800">
{{ (filter.value.length > 1) ? 'Тэг: ' + filter.value.length + ' значений' : '#' + JSON.parse(filter.content[filter.value].data.name).ru }}
<button @click.prevent="clearFilter" type="button" class="shrink-0 size-4 inline-flex items-center justify-center rounded-full hover:bg-blue-200 focus:outline-none focus:bg-blue-200 focus:text-blue-500">
<span class="sr-only">Remove badge</span>
<svg class="shrink-0 size-3" 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">
<path d="M18 6 6 18"></path>
<path d="m6 6 12 12"></path>
</svg>
</button>
</span>
</template>
<script>
import {Link} from "@inertiajs/vue3";
import slugify from "slugify";
export default {
name: "TagBadge",
components: {Link},
data() {
return {
}
},
methods: {
clearFilter() {
let url = new URL(window.location.href);
// Создаем массив для хранения всех ключей, которые нужно удалить
const keysToDelete = [];
// Перебираем все параметры и добавляем ключи, начинающиеся с 'category', в массив
for (const [key] of url.searchParams) {
if (key.startsWith(this.filter.param)) {
keysToDelete.push(key);
}
}
// Удаляем все ключи из массива
keysToDelete.forEach(key => url.searchParams.delete(key));
let newUrl = url.toString();
this.$inertia.visit(newUrl, {
method: 'get',
});
},
},
props: {
filter: {
type: Object,
},
},
}
</script>
<style scoped>
</style>