Migrate backend to Porto architecture and fix minor bugs

- Fully transitioned the backend to the Porto architectural pattern
- Improved code organization and maintainability
- Fixed minor bugs and inconsistencies
This commit is contained in:
F4ilji
2025-05-12 08:47:43 +05:00
parent 76deaf75f3
commit c01016a154
620 changed files with 16218 additions and 6073 deletions
+1 -1
View File
@@ -65,7 +65,7 @@
<div class="flex w-full sm:items-center gap-x-5 sm:gap-x-3">
<div class="grow">
<div class="grid sm:flex sm:justify-between sm:items-center gap-2">
<FacultyItemBreadcrumbs :faculty-title="faculty.data.title" />
<FacultyItemBreadcrumbs :faculty-title="faculty.data.shortTitle" />
</div>
</div>
</div>
+39 -3
View File
@@ -1,5 +1,5 @@
<script>
import {Head, Link} from "@inertiajs/vue3";
import {Head, Link, WhenVisible} from "@inertiajs/vue3";
import MainPageNavBar from "@/Navbars/MainPageNavbar.vue";
import PostListBreadcrumbs from "@/componentss/features/posts/components/PostListBreadcrumbs.vue.vue";
import HeadItemsWrapper from "@/componentss/ui/wrappers/HeadItemsWrapper.vue";
@@ -22,6 +22,7 @@ import EventListSearch from "@/componentss/features/events/components/EventListS
export default {
name: "Index",
components: {
WhenVisible,
EventListSearch, IsOnlineFilter, BasicPagination, EventArchiveListBreadcrumbs, BasicPageWrapper, BasicPageContainer,
BasicListBadge,
TagFilter,
@@ -43,6 +44,9 @@ export default {
posts: {
type: Object,
},
posts_pagination: {
type: Object,
},
filters: {
type: Object,
},
@@ -95,12 +99,15 @@ export default {
<div>
<h3 class="text-sm text-gray-500 mb-4">Найдено новостей: {{ posts.meta.total }}</h3>
<h3 class="text-sm text-gray-500 mb-4">Найдено новостей: {{ posts_pagination.total }}</h3>
<div v-if="hasActiveFilters" class="flex-wrap flex gap-3 md:items-center">
<BasicListBadge :filters="filters" />
</div>
</div>
<div class="space-y-5 md:space-y-4">
<div class="space-y-5 md:space-y-4">
<div>
@@ -110,7 +117,36 @@ export default {
<PostListItem :post="post" />
</template>
</div>
<BasicPagination :links="posts.meta" />
<div class="mt-5" v-if="posts_pagination.total === 0">
<div class="h-full flex flex-col items-center justify-center gap-1">
<p class="font-light">Извините, ничего не найдено</p>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-5 text-gray-700">
<path stroke-linecap="round" stroke-linejoin="round" d="M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 5.25h.008v.008H12v-.008Z" />
</svg>
</div>
</div>
<div v-if="!(posts_pagination.current_page >= posts_pagination.last_page)">
<WhenVisible always :params="{
data: {
page: posts_pagination.current_page + 1
},
only: ['posts', 'posts_pagination']
}"
/>
<div class="text-center mt-10">
<div role="status">
<svg aria-hidden="true" class="inline w-8 h-8 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor"/>
<path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentFill"/>
</svg>
<span class="sr-only">Loading...</span>
</div>
</div>
</div>
<!-- <BasicPagination :links="posts_pagination" />-->
</div>
</div>
</div>
+55 -33
View File
@@ -1,7 +1,7 @@
<script>
import MainNavbar from "@/Navbars/MainNavbar.vue";
import { debounce } from "lodash";
import { Link } from "@inertiajs/vue3";
import {Link, WhenVisible} from "@inertiajs/vue3";
import MainPageNavBar from "@/Navbars/MainPageNavbar.vue";
import ScheduleListTitle from "@/componentss/features/schedules/components/ScheduleListTitle.vue";
import ScheduleListFilter from "@/componentss/features/schedules/components/ScheduleListFilter.vue";
@@ -23,6 +23,7 @@ export default {
};
},
components: {
WhenVisible,
MetaTags,
FormEducationalFilter,
BasicListFilter,
@@ -43,6 +44,9 @@ export default {
schedulesByFaculty: {
type: Object
},
schedules_paginator: {
type: Object
},
seo: {
type: Object
}
@@ -207,45 +211,46 @@ export default {
</div>
</div>
<div class="mx-auto max-w-2xl hs-accordion-group grid gap-3">
<div class="mx-auto max-w-2xl hs-accordion-group grid gap-3">
<div class="space-y-4">
<template v-for="(faculty, title) in schedulesByFaculty">
<div>
<h2 class="text-center text-gray-800 font-medium">{{ title }}</h2>
<hr class="mt-2 mb-4">
<template v-for="educationalGroup in faculty" :key="educationalGroup.data.id">
<div class="hs-accordion hs-accordion-active:border-gray-200 bg-white border border-transparent rounded-xl" id="hs-active-bordered-heading-one">
<div class="flex py-4 px-5 gap-x-3">
<button @click="toggleFavorite(educationalGroup.data.id)">
<transition name="heart" mode="out-in">
<BasicIcon
v-if="isFavorite(educationalGroup.data.id)"
name="heart_filled"
class="shrink-0 size-4 text-red-500"
key="filled"
/>
<BasicIcon
v-else
name="heart"
class="shrink-0 size-4"
key="outline"
/>
</transition>
<div class="hs-accordion hs-accordion-active:border-gray-200 bg-white border border-transparent rounded-xl" :id="'hs-basic-id-' + educationalGroup.data.id">
<div class="flex py-4 px-5 gap-x-3 hs-accordion-toggle">
<button @click.stop="toggleFavorite(educationalGroup.data.id)">
<transition name="heart" mode="out-in">
<BasicIcon
v-if="isFavorite(educationalGroup.data.id)"
name="heart_filled"
class="shrink-0 size-4 text-red-500"
key="filled"
/>
<BasicIcon
v-else
name="heart"
class="shrink-0 size-4"
key="outline"
/>
</transition>
</button>
<button class="hs-accordion-toggle hs-accordion-active:text-primary inline-flex justify-between items-center gap-x-3 w-full font-semibold text-start text-gray-800 hover:text-gray-500 disabled:opacity-50 disabled:pointer-events-none" aria-expanded="false" aria-controls="hs-basic-active-bordered-collapse-one">
<span class="flex items-center gap-x-2">{{ educationalGroup.data.title }}</span>
<svg class="hs-accordion-active:hidden block size-3.5" 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="M5 12h14"></path>
<path d="M12 5v14"></path>
</svg>
<svg class="hs-accordion-active:block hidden size-3.5" 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="M5 12h14"></path>
</svg>
</button>
</button>
<button class="hs-accordion-active:text-primary inline-flex justify-between items-center gap-x-3 w-full font-semibold text-start text-gray-800 hover:text-gray-500 disabled:opacity-50 disabled:pointer-events-none" aria-expanded="false" :aria-controls="'hs-basic-' + educationalGroup.data.id">
<span class="flex items-center gap-x-2">{{ educationalGroup.data.title }}</span>
<svg class="hs-accordion-active:hidden block size-3.5" 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="M5 12h14"></path>
<path d="M12 5v14"></path>
</svg>
<svg class="hs-accordion-active:block hidden size-3.5" 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="M5 12h14"></path>
</svg>
</button>
</div>
<div id="hs-basic-active-bordered-collapse-one" class="hs-accordion-content hidden w-full overflow-hidden transition-[height] duration-300" role="region" aria-labelledby="hs-active-bordered-heading-one">
<div :id="'hs-basic-' + educationalGroup.data.id" class="hs-accordion-content hidden w-full overflow-hidden transition-[height] duration-300" role="region" :aria-labelledby="'hs-basic-id-' + educationalGroup.data.id">
<div class="pb-4 px-5 grid gap-3 grid-cols-1">
<template v-for="schedule in educationalGroup.data.schedules" :key="schedule.id">
<template v-for="file in schedule.file">
@@ -269,7 +274,24 @@ export default {
</svg>
</div>
</div>
<div v-if="!(schedules_paginator.current_page >= schedules_paginator.last_page)">
<WhenVisible always :params="{
data: {
page: schedules_paginator.current_page + 1
},
only: ['schedulesByFaculty', 'schedules_paginator']
}"
/>
<div class="text-center mt-10">
<div>
<svg aria-hidden="true" class="inline w-8 h-8 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor"/>
<path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentFill"/>
</svg>
<span class="sr-only">Loading...</span>
</div>
</div>
</div>
</div>
</div>
</article>
-2
View File
@@ -17,14 +17,12 @@
<script>
import {Head, Link} from "@inertiajs/vue3";
import MainPageNavBar from "@/Navbars/MainPageNavbar.vue";
import LevelEducational from "../Enum/LevelEducational.js";
import Slider from "@/componentss/features/sliders/Slider.vue";
import PostListItem from "@/componentss/features/posts/components/PostListItem.vue";
import BasicFooter from "@/footers/BasicFooter.vue";
import MetaTags from "@/componentss/shared/SEO/MetaTags.vue";
import PageResourceList from "@/componentss/shared/pageResource/PageResourceList.vue";
import ContactSectionBlock from "@/componentss/shared/contactSection/ContactSectionBlock.vue";
import EventListItem from "@/componentss/features/events/components/EventListItem.vue";
import PostSection from "@/componentss/features/mainPage/PostSection.vue";
import EventSection from "@/componentss/features/mainPage/EventSection.vue";
import EducationSection from "@/componentss/features/mainPage/EducationSection.vue";
+9 -11
View File
@@ -52,17 +52,15 @@ import SortingByFilter from "@/componentss/shared/filter/filters/SortingByFilter
export default {
name: "Page",
data() {
return {
headerNavs: this.page.data.content.filter(block => block.type === 'heading').map(block => ({
id: block.data.id,
text: block.data.content
})),
settings: this.page.data.settings
}
},
data() {
return {
headerNavs: (this.page?.data?.content || []).filter(block => block?.type === 'heading').map(block => ({
id: block?.data?.id,
text: block?.data?.content
})),
settings: this.page?.data?.settings || {}
}
},
props: {
navigation: {
type: Object,
@@ -36,14 +36,14 @@ export default {
url.searchParams.delete('search');
let newUrl = url.toString();
this.$inertia.visit(newUrl,{
method: 'get',
preserveState: true,
replace: true,
});
method: 'get',
preserveState: true,
replace: true,
});
} else {
let url = new URL(window.location.href);
url.searchParams.delete('page');
let newUrl = url.toString();
let url = new URL(window.location.href);
url.searchParams.delete('page');
let newUrl = url.toString();
this.$inertia.visit(newUrl,{
method: 'get',
data: {
@@ -1,19 +1,17 @@
<template>
<div v-if="isServer && serverSideBuilder">
<component :is="serverSideBuilder" :blocks="blocks" />
</div>
<div v-else>
<transition name="fade" mode="out-in">
<PageSkeleton v-if="loading" key="skeleton" />
<div class="space-y-6" v-else key="content">
<component
v-for="(block, index) in blocks"
:key="index"
:is="getComponent(block.type)"
:block="block"
/>
</div>
</transition>
<transition name="fade" mode="out-in">
<PageSkeleton v-if="loading" key="skeleton" />
<div class="space-y-6" v-else key="content">
<component
v-for="(block, index) in blocks"
:key="index"
:is="getComponent(block.type)"
:block="block"
/>
</div>
</transition>
<div v-if="isServer">
<ServerSideBuilder :blocks="blocks" />
</div>
</template>
@@ -23,11 +21,11 @@ import PageSkeleton from "@/componentss/shared/builder/pageBuilder/skeletons/Pag
import ServerSideBuilder from "@/componentss/shared/builder/pageBuilder/ServerSideBuilder.vue";
export default {
name: "Builder",
components: {ServerSideBuilder, PageSkeleton},
data() {
return {
loading: true,
name: "Builder",
components: {ServerSideBuilder, PageSkeleton},
data() {
return {
loading: true,
isServer: typeof window === 'undefined',
serverSideBuilder: null,
componentMap: {
@@ -49,34 +47,34 @@ export default {
slider: () => import('@/componentss/features/sliders/shared/SliderBlock.vue')
},
};
},
methods: {
async loadAllComponents() {
// Создайте массив промисов для загрузки всех компонентов
const promises = Object.values(this.componentMap).map(load => load());
},
methods: {
async loadAllComponents() {
// Создайте массив промисов для загрузки всех компонентов
const promises = Object.values(this.componentMap).map(load => load());
// Дождитесь завершения всех загрузок
await Promise.all(promises);
this.loading = false; // Установите флаг загрузки в false
},
getComponent(type) {
return defineAsyncComponent(this.componentMap[type] || null);
},
},
props: {
blocks: {
type: Object,
required: true,
},
},
async created() {
// Дождитесь завершения всех загрузок
await Promise.all(promises);
this.loading = false; // Установите флаг загрузки в false
},
getComponent(type) {
return defineAsyncComponent(this.componentMap[type] || null);
},
},
props: {
blocks: {
type: Object,
required: true,
},
},
async created() {
if (this.isServer) {
// Динамически импортируем только на сервере
const module = await import('@/componentss/shared/builder/pageBuilder/ServerSideBuilder.vue');
this.serverSideBuilder = module.default;
}
await this.loadAllComponents(); // Загрузить все компоненты при создании
},
await this.loadAllComponents(); // Загрузить все компоненты при создании
},
}
</script>
@@ -1,5 +1,5 @@
<template>
<div role="status" class="space-y-2.5 animate-pulse w-full">
<div class="space-y-2.5 animate-pulse w-full">
<div v-for="slide in 16" :key="slide" class="flex items-center w-full">
<div
class="h-2.5 rounded-full"