From eaa3944fd56cc31c17aee11eb83689fa0a4b752e Mon Sep 17 00:00:00 2001 From: mustafa-rezae Date: Sun, 13 Apr 2025 16:05:06 +0330 Subject: [PATCH] Work on favorites Work on library show --- apis/hadithaApi.js | 3 +- components/haditha/AutoComplation.vue | 71 ++-- components/haditha/hero-page/SectionOne.vue | 16 +- components/haditha/hero-page/SectionThree.vue | 14 +- pages/haditha/chat-bot.vue | 84 +++++ pages/haditha/favorites/index.vue | 137 ++++++-- pages/haditha/library/[id]/[slug]/index.vue | 303 ++++++++++++------ pages/haditha/library/index.vue | 84 +++++ pages/haditha/login.vue | 84 +++++ pages/haditha/public-pages/index.vue | 84 +++++ pages/haditha/search/[id]/[slug]/index.vue | 115 ++++++- pages/haditha/search/index.vue | 104 +++++- types/hadithType.ts | 13 +- 13 files changed, 923 insertions(+), 189 deletions(-) diff --git a/apis/hadithaApi.js b/apis/hadithaApi.js index 9866e85..c8c8d44 100644 --- a/apis/hadithaApi.js +++ b/apis/hadithaApi.js @@ -4,6 +4,7 @@ export default { show: "repo/public/get/byid/@index_key/@id", synonym: "synonym/get/words", prevNextHadith: "monir/next/@index_key/@vol_id/@parag_order/@step", + getDataTree: "@appname/book/tree/@offset/@limit/@vol_id/@q" }, favorite: { add: "favorite/add/{{data_type}}/{{ref_key}}", @@ -17,7 +18,7 @@ export default { setCategories: "favorite/tags/@data_type/set", getCounts: "favorite/tags/@data_type/counts", - getList: "favorite/list/@data_type/@offset/@limit", + getList: "favorite/list/@data_type/@time_key/@source/@offset/@limit/@q", }, library: { list: "monir/book/volume/@field_collapsed/@offset/@limit/@q", diff --git a/components/haditha/AutoComplation.vue b/components/haditha/AutoComplation.vue index fb8cea3..a1abf17 100644 --- a/components/haditha/AutoComplation.vue +++ b/components/haditha/AutoComplation.vue @@ -42,7 +42,7 @@ const searchTerm = useStorage("searchPhrase", ""); const route = useRoute(); if (route.query.q) { searchTerm.value = route.query.q; - route.query.q = undefined + route.query.q = undefined; } const open = ref(false); @@ -81,12 +81,12 @@ const state = reactive({ label: "جستجو در همه", value: "normal", class: "", - onSelect(e: Event) { - search_type.value = "normal"; - state.type.label = e.explicitOriginalTarget?.innerText; - sendQuery(); - state.type.items[0].class = "active"; - }, + // onSelect(e: Event) { + // search_type.value = "normal"; + // state.type.label = e.explicitOriginalTarget?.innerText; + // sendQuery(); + // state.type.items[0].class = "active"; + // }, }, { label: "فقط در متن عربی حدیث", @@ -94,38 +94,38 @@ const state = reactive({ valueFa: "عربی", class: "", - onSelect(e: Event) { - search_type.value = "arabic"; - state.type.label = e.explicitOriginalTarget?.innerText; - state.type.items[0].class = "active"; + // onSelect(e: Event) { + // search_type.value = "arabic"; + // state.type.label = e.explicitOriginalTarget?.innerText; + // state.type.items[0].class = "active"; - sendQuery(); - }, + // sendQuery(); + // }, }, { label: "فقط در ترجمه ها", value: "translations", valueFa: "ترجمه", - onSelect(e: Event) { - search_type.value = "translations"; - state.type.label = e.explicitOriginalTarget?.innerText; - state.type.items[0].class = "active"; + // onSelect(e: Event) { + // search_type.value = "translations"; + // state.type.label = e.explicitOriginalTarget?.innerText; + // state.type.items[0].class = "active"; - sendQuery(); - }, + // sendQuery(); + // }, }, { label: "فقط در شروح", value: "descriptions", valueFa: "شروح", - onSelect(e: Event) { - search_type.value = "descriptions"; - state.type.label = e.explicitOriginalTarget?.innerText; - state.type.items[0].class = "active"; - sendQuery(); - }, + // onSelect(e: Event) { + // search_type.value = "descriptions"; + // state.type.label = e.explicitOriginalTarget?.innerText; + // state.type.items[0].class = "active"; + // sendQuery(); + // }, }, ], }, @@ -162,9 +162,9 @@ const clearSimilar = () => { console.info("clearSimilar"); }; -const onUpdateModel = (newVal: boolean | InputMenuItem | any) => { - console.info("onUpdateModel", newVal); -}; +// const onUpdateModel = (newVal: boolean | InputMenuItem | any) => { +// console.info("onUpdateModel", newVal); +// }; const onKeyDown = () => { clearTimeout(typingTimer.value); @@ -180,10 +180,10 @@ const setType = (type: string) => { search_type.value = type; sendQuery(); }; -const setKey = (type: string) => { - type_key.value = type; - sendQuery(); -}; +// const setKey = (type: string) => { +// type_key.value = type; +// sendQuery(); +// }; const sendQuery = async (payload = {}) => { if (loading.value) return; @@ -225,6 +225,7 @@ const sendQuery = async (payload = {}) => { emit("response-ready", { res: res, searchQuery: searchTerm.value, + disableAutoRedirect:true }); loading.value = false; @@ -400,12 +401,12 @@ onMounted(() => { @focus="open = true" @blur="open = false" @change="sendQuery" - @update:modelValue="onUpdateModel" - @update:searchTerm="onUpdateModel" @keydown="onKeyDown" @keyup="onKeyUp" @keydown.enter="sendQuery" > + + { background: linear-gradient(137.41deg, #ffffff -42.82%, #e5e0ff 87.9%); filter: blur(60px); max-width: 626px; - width:100%; + width: 100%; height: 68px; z-index: 0; } diff --git a/components/haditha/hero-page/SectionOne.vue b/components/haditha/hero-page/SectionOne.vue index de4a9c8..fcc922d 100644 --- a/components/haditha/hero-page/SectionOne.vue +++ b/components/haditha/hero-page/SectionOne.vue @@ -4,14 +4,16 @@ const router = useRouter(); import { useStorage } from "@vueuse/core"; const backgroundImageStyle = computed(() => { - // Use $img to generate an optimized image URL - const optimizedImageUrl = img("/img/haditha/background.webp", { - quality: 80, - fit: "auto", - }); - + // // Use $img to generate an optimized image URL + // const optimizedImageUrl = img("/img/haditha/background.webp", { + // quality: 80, + // fit: "auto", + // }); + // return { + // backgroundImage: `url(${optimizedImageUrl}), linear-gradient(199.05deg, #ffffff 9.99%, #e4fff7 42.07%, #ffffff 97.12%)`, + // }; return { - backgroundImage: `url(${optimizedImageUrl}), linear-gradient(199.05deg, #ffffff 9.99%, #e4fff7 42.07%, #ffffff 97.12%)`, + backgroundImage: `url(/img/haditha/background.webp), linear-gradient(199.05deg, #ffffff 9.99%, #e4fff7 42.07%, #ffffff 97.12%)`, }; }); diff --git a/components/haditha/hero-page/SectionThree.vue b/components/haditha/hero-page/SectionThree.vue index 5433579..680116d 100644 --- a/components/haditha/hero-page/SectionThree.vue +++ b/components/haditha/hero-page/SectionThree.vue @@ -3,13 +3,15 @@ const img = useImage(); const backgroundImageStyle = computed(() => { // Use $img to generate an optimized image URL - const optimizedImageUrl = img("/img/haditha/section-three-bgi.webp", { - quality: 30, - fit: "auto", - }); - + // const optimizedImageUrl = img("/img/haditha/section-three-bgi.webp", { + // quality: 30, + // fit: "auto", + // }); + // return { + // backgroundImage: `url(${optimizedImageUrl})`, + // }; return { - backgroundImage: `url(${optimizedImageUrl})`, + backgroundImage: `url(/img/haditha/section-three-bgi.webp)`, }; }); diff --git a/pages/haditha/chat-bot.vue b/pages/haditha/chat-bot.vue index 1daed5b..0ca73f6 100644 --- a/pages/haditha/chat-bot.vue +++ b/pages/haditha/chat-bot.vue @@ -8,10 +8,94 @@ useHead({ title: `${import.meta.env.VITE_HADITH_PAGE_TITLE} | جستجو`, meta: [ { name: "description", content: "کاوش با هوش مصنوعی در احادیث اسلامی" }, + { + name: "msapplication-TileImage", + content: "/img/haditha/fav-icons/ms-icon-144x144.png", + }, + { name: "theme-color", content: "#ffffff" }, ], bodyAttrs: { class: import.meta.env.VITE_HADITH_SYSTEM, }, + link: [ + { + rel: "icon", + type: "image/x-icon", + href: "/img/haditha/fav-icons/favicon.ico", + }, + { rel: "manifest", href: "/img/haditha/fav-icons/manifest.json" }, + // rel: icon + { + rel: "icon", + type: "image/png", + sizes: "16x16", + href: "/img/haditha/fav-icons/favicon-16x16.png", + }, + { + rel: "icon", + type: "image/png", + sizes: "32x32", + href: "/img/haditha/fav-icons/favicon-32x32.png", + }, + { + rel: "icon", + type: "image/png", + sizes: "96x96", + href: "/img/haditha/fav-icons/favicon-96x96.png", + }, + { + rel: "icon", + sizes: "192x192", + type: "image/png", + href: "/img/haditha/fav-icons/android-icon-192x192.png", + }, + // rel: apple + { + rel: "apple-touch-icon", + sizes: "57x57", + href: "/img/haditha/fav-icons/apple-icon-57x57.png", + }, + { + rel: "apple-touch-icon", + sizes: "60x60", + href: "/img/haditha/fav-icons/android-icon-60x60.png", + }, + { + rel: "apple-touch-icon", + sizes: "72x72", + href: "/img/haditha/fav-icons/android-icon-72x72.png", + }, + { + rel: "apple-touch-icon", + sizes: "76x76", + href: "/img/haditha/fav-icons/android-icon-76x76.png", + }, + { + rel: "apple-touch-icon", + sizes: "114x114", + href: "/img/haditha/fav-icons/android-icon-114x114.png", + }, + { + rel: "apple-touch-icon", + sizes: "120x120", + href: "/img/haditha/fav-icons/android-icon-120x120.png", + }, + { + rel: "apple-touch-icon", + sizes: "144x144", + href: "/img/haditha/fav-icons/android-icon-144x144.png", + }, + { + rel: "apple-touch-icon", + sizes: "152x152", + href: "/img/haditha/fav-icons/android-icon-152x152.png", + }, + { + rel: "apple-touch-icon", + sizes: "180x180", + href: "/img/haditha/fav-icons/android-icon-180x180.png", + }, + ], }); const state = reactive({ diff --git a/pages/haditha/favorites/index.vue b/pages/haditha/favorites/index.vue index fe2587a..1f64719 100644 --- a/pages/haditha/favorites/index.vue +++ b/pages/haditha/favorites/index.vue @@ -10,10 +10,94 @@ useHead({ title: `${import.meta.env.VITE_HADITH_PAGE_TITLE} | ذخیره ها`, meta: [ { name: "description", content: "کاوش با هوش مصنوعی در احادیث اسلامی" }, + { + name: "msapplication-TileImage", + content: "/img/haditha/fav-icons/ms-icon-144x144.png", + }, + { name: "theme-color", content: "#ffffff" }, ], bodyAttrs: { class: import.meta.env.VITE_HADITH_SYSTEM, }, + link: [ + { + rel: "icon", + type: "image/x-icon", + href: "/img/haditha/fav-icons/favicon.ico", + }, + { rel: "manifest", href: "/img/haditha/fav-icons/manifest.json" }, + // rel: icon + { + rel: "icon", + type: "image/png", + sizes: "16x16", + href: "/img/haditha/fav-icons/favicon-16x16.png", + }, + { + rel: "icon", + type: "image/png", + sizes: "32x32", + href: "/img/haditha/fav-icons/favicon-32x32.png", + }, + { + rel: "icon", + type: "image/png", + sizes: "96x96", + href: "/img/haditha/fav-icons/favicon-96x96.png", + }, + { + rel: "icon", + sizes: "192x192", + type: "image/png", + href: "/img/haditha/fav-icons/android-icon-192x192.png", + }, + // rel: apple + { + rel: "apple-touch-icon", + sizes: "57x57", + href: "/img/haditha/fav-icons/apple-icon-57x57.png", + }, + { + rel: "apple-touch-icon", + sizes: "60x60", + href: "/img/haditha/fav-icons/android-icon-60x60.png", + }, + { + rel: "apple-touch-icon", + sizes: "72x72", + href: "/img/haditha/fav-icons/android-icon-72x72.png", + }, + { + rel: "apple-touch-icon", + sizes: "76x76", + href: "/img/haditha/fav-icons/android-icon-76x76.png", + }, + { + rel: "apple-touch-icon", + sizes: "114x114", + href: "/img/haditha/fav-icons/android-icon-114x114.png", + }, + { + rel: "apple-touch-icon", + sizes: "120x120", + href: "/img/haditha/fav-icons/android-icon-120x120.png", + }, + { + rel: "apple-touch-icon", + sizes: "144x144", + href: "/img/haditha/fav-icons/android-icon-144x144.png", + }, + { + rel: "apple-touch-icon", + sizes: "152x152", + href: "/img/haditha/fav-icons/android-icon-152x152.png", + }, + { + rel: "apple-touch-icon", + sizes: "180x180", + href: "/img/haditha/fav-icons/android-icon-180x180.png", + }, + ], }); // #region refs @@ -28,6 +112,12 @@ const state = reactive({ list: [], counts: [], totalCounts: [], + pagination: { + page: 1, + pages: 1, + offset: 0, + limit: 10, + }, }); // #endregion reactive @@ -40,40 +130,44 @@ const getCategories = async (dataType = "bookmark") => { let url = repoUrl() + hadithaApi.favorite.getList; url = url.replace("@data_type", dataType); - url = url.replace("@offset", 0); - url = url.replace("@limit", 20); - // url = url.replace("@filter", "get"); + url = url.replace("@time_key", "all"); + url = url.replace("@source", "main"); + url = url.replace("@offset", state.pagination.offset); + url = url.replace("@limit", state.pagination.limit); + url = url.replace("@q", "none"); return await httpService .getRequest(url) .then((res) => { state.list = res.hits.hits; - getCounts(); - }) - .catch((err) => { - console.info(err); - loading.value = false; - }); -}; - -const getCounts = async () => { - let url = repoUrl() + hadithaApi.favorite.getCounts; - url = url.replace("@data_type", "bookmark"); - - await httpService - .getRequest(url) - .then((res) => { state.totalCounts = res.hits.total.value; - state.counts = res.aggregations.result.buckets; loading.value = false; + // getCounts(); }) .catch((err) => { console.info(err); - }) - .finally(() => { loading.value = false; }); }; + +// const getCounts = async () => { +// let url = repoUrl() + hadithaApi.favorite.getCounts; +// url = url.replace("@data_type", "bookmark"); + +// await httpService +// .getRequest(url) +// .then((res) => { +// state.totalCounts = res.hits.total.value; +// state.counts = res.aggregations.result.buckets; +// loading.value = false; +// }) +// .catch((err) => { +// console.info(err); +// }) +// .finally(() => { +// loading.value = false; +// }); +// }; // #endregion methods // #region hooks @@ -106,6 +200,7 @@ const SearchList = defineAsyncComponent(() => no-data-text="هنوز چیزی ذخیره نکرده‌اید!" no-data-icon="/img/haditha/save.png" :list="state.list" + :total="state.totalCounts" > diff --git a/pages/haditha/library/[id]/[slug]/index.vue b/pages/haditha/library/[id]/[slug]/index.vue index a69da7c..063f863 100644 --- a/pages/haditha/library/[id]/[slug]/index.vue +++ b/pages/haditha/library/[id]/[slug]/index.vue @@ -14,6 +14,7 @@ const router = useRouter(); // #region imports import hadithaApi from "@haditha/apis/hadithaApi"; import type { HadithResponseModel, Hits } from "@haditha/types/hadithType"; +import type { Hit } from "~/systems/hadith_ui/types/hadithType"; // #endregion imports // #region meta @@ -27,10 +28,94 @@ useHead({ title: `${import.meta.env.VITE_HADITH_PAGE_TITLE} | ${route.params.slug}`, meta: [ { name: "description", content: "کاوش با هوش مصنوعی در احادیث اسلامی" }, + { + name: "msapplication-TileImage", + content: "/img/haditha/fav-icons/ms-icon-144x144.png", + }, + { name: "theme-color", content: "#ffffff" }, ], bodyAttrs: { class: import.meta.env.VITE_HADITH_SYSTEM, }, + link: [ + { + rel: "icon", + type: "image/x-icon", + href: "/img/haditha/fav-icons/favicon.ico", + }, + { rel: "manifest", href: "/img/haditha/fav-icons/manifest.json" }, + // rel: icon + { + rel: "icon", + type: "image/png", + sizes: "16x16", + href: "/img/haditha/fav-icons/favicon-16x16.png", + }, + { + rel: "icon", + type: "image/png", + sizes: "32x32", + href: "/img/haditha/fav-icons/favicon-32x32.png", + }, + { + rel: "icon", + type: "image/png", + sizes: "96x96", + href: "/img/haditha/fav-icons/favicon-96x96.png", + }, + { + rel: "icon", + sizes: "192x192", + type: "image/png", + href: "/img/haditha/fav-icons/android-icon-192x192.png", + }, + // rel: apple + { + rel: "apple-touch-icon", + sizes: "57x57", + href: "/img/haditha/fav-icons/apple-icon-57x57.png", + }, + { + rel: "apple-touch-icon", + sizes: "60x60", + href: "/img/haditha/fav-icons/android-icon-60x60.png", + }, + { + rel: "apple-touch-icon", + sizes: "72x72", + href: "/img/haditha/fav-icons/android-icon-72x72.png", + }, + { + rel: "apple-touch-icon", + sizes: "76x76", + href: "/img/haditha/fav-icons/android-icon-76x76.png", + }, + { + rel: "apple-touch-icon", + sizes: "114x114", + href: "/img/haditha/fav-icons/android-icon-114x114.png", + }, + { + rel: "apple-touch-icon", + sizes: "120x120", + href: "/img/haditha/fav-icons/android-icon-120x120.png", + }, + { + rel: "apple-touch-icon", + sizes: "144x144", + href: "/img/haditha/fav-icons/android-icon-144x144.png", + }, + { + rel: "apple-touch-icon", + sizes: "152x152", + href: "/img/haditha/fav-icons/android-icon-152x152.png", + }, + { + rel: "apple-touch-icon", + sizes: "180x180", + href: "/img/haditha/fav-icons/android-icon-180x180.png", + }, + ], }); // #endregion imports // #region props @@ -52,25 +137,6 @@ const props = defineProps({ // #region refs and reactives -const prevIsDisabled = computed(() => { - console.info("prevIsDisabled"); - let isDisabled = true; - if (state.selectedItem[0]._source.address.page_num) - return !(state.selectedItem[0]._source.address.page_num - 1 > 1); - return isDisabled; -}); -const nextIsDisabled = computed(() => { - console.info("prevIsDisabled"); - - let isDisabled = true; - if (state.selectedItem[0]._source.address.page_num) - return !( - state.selectedItem[0]._source.address.page_num + 1 < - +route.query.page_count - ); - return isDisabled; -}); - // const page_num = computed({ // // getter // get() { @@ -86,66 +152,88 @@ const nextIsDisabled = computed(() => { // }, // }); -const treeItems = [ - { - title: "فصل اول", - icon: "lucide:plus", - children: [ - { title: "useAuth.ts", icon: "vscode-icons:file-type-typescript" }, - { title: "useUser.ts", icon: "vscode-icons:file-type-typescript" }, - ], - }, - { - title: "فصل دوم", - icon: "lucide:plus", - children: [ - { title: "useAuth.ts", icon: "vscode-icons:file-type-typescript" }, - { title: "useUser.ts", icon: "vscode-icons:file-type-typescript" }, - ], - }, - { - title: "فصل سوم", - icon: "lucide:plus", - children: [ - { - title: "بخش اول", - icon: "lucide:plus", - children: [ - { title: "بخش اول-یک", icon: "vscode-icons:file-type-vue" }, - { - title: "بخش اول-دو", - icon: "vscode-icons:file-type-vue", - children: [ - { title: "بخش اول-یک-یک", icon: "vscode-icons:file-type-vue" }, - { title: "بخش اول-یک-دو", icon: "vscode-icons:file-type-vue" }, - ], - }, - ], - }, - { - title: "بخش دوم", - icon: "lucide:plus", - children: [ - { title: "Card.vue", icon: "vscode-icons:file-type-vue" }, - { - title: "Button.vue", - icon: "vscode-icons:file-type-vue", - }, - ], - }, - ], - }, - { title: "فصل چهارم", icon: "vscode-icons:file-type-vue" }, - { title: "فصل پنجم", icon: "vscode-icons:file-type-nuxt" }, -]; const isModalOpen = ref(false); const loading = ref(false); const httpService = useNuxtApp()["$http"]; const state = reactive({ - selectedItem: {} as Hits, + selectedItem: [] as Hit[], + treeItems: [ + { + title: "فصل اول", + icon: "lucide:plus", + children: [ + { title: "useAuth.ts", icon: "vscode-icons:file-type-typescript" }, + { title: "useUser.ts", icon: "vscode-icons:file-type-typescript" }, + ], + }, + { + title: "فصل دوم", + icon: "lucide:plus", + children: [ + { title: "useAuth.ts", icon: "vscode-icons:file-type-typescript" }, + { title: "useUser.ts", icon: "vscode-icons:file-type-typescript" }, + ], + }, + { + title: "فصل سوم", + icon: "lucide:plus", + children: [ + { + title: "بخش اول", + icon: "lucide:plus", + children: [ + { title: "بخش اول-یک", icon: "vscode-icons:file-type-vue" }, + { + title: "بخش اول-دو", + icon: "vscode-icons:file-type-vue", + children: [ + { title: "بخش اول-یک-یک", icon: "vscode-icons:file-type-vue" }, + { title: "بخش اول-یک-دو", icon: "vscode-icons:file-type-vue" }, + ], + }, + ], + }, + { + title: "بخش دوم", + icon: "lucide:plus", + children: [ + { title: "Card.vue", icon: "vscode-icons:file-type-vue" }, + { + title: "Button.vue", + icon: "vscode-icons:file-type-vue", + }, + ], + }, + ], + }, + { title: "فصل چهارم", icon: "vscode-icons:file-type-vue" }, + { title: "فصل پنجم", icon: "vscode-icons:file-type-nuxt" }, + ], }); +const pageIsLessThanOne = computed(() => { + console.info("pageIsLessThanOne"); + let isDisabled = true; + if (state.selectedItem.length) + return state.selectedItem[0]._source.address.page_num <= 1; + return isDisabled; +}); +const pageIsBiggerThanTotal = computed(() => { + console.info("pageIsBiggerThanTotal"); + + let isDisabled = true; + if ( + state.selectedItem.length && + state.selectedItem[0]._source.address.page_num + ) + return ( + state.selectedItem?.[0]._source.address.page_num + 1 >= + +route.query.page_count + ); + + return isDisabled; +}); const page_num = ref(1); // #endregion refs and reactives @@ -167,7 +255,7 @@ const fetchData = async () => { }); if (status.value == "success") { - state.selectedItem = data.value.hits.hits; + state.selectedItem = data.value.hits.hits; } loading.value = false; @@ -187,8 +275,8 @@ const onOpenList = () => { const onSearch = () => { // console.info("onSearch"); router.push({ - name:'hadithaSearch' - }) + name: "hadithaSearch", + }); }; const onClose = () => { console.info("onClose"); @@ -198,34 +286,36 @@ const onClose = () => { }; const handlePagination = ( - prevNextIndicator: number | string, - pageNumber: number | string | undefined = undefined + prevNextIndicator: number, + pageNumber: number | undefined = undefined ) => { if (loading.value) return; loading.value = true; - if ( - !( - state.selectedItem[0]._source.address.page_num + prevNextIndicator > 1 && + if (state.selectedItem?.length) { + const isPageBiggerThanOne = + state.selectedItem[0]._source.address.page_num + prevNextIndicator > 0; + const isPageLessThanTotal = state.selectedItem[0]._source.address.page_num + prevNextIndicator < - +route.query.page_count - ) - ) - return; + +route.query.page_count; + + if (!(isPageBiggerThanOne && isPageLessThanTotal)) return; + } let url = repoUrl() + hadithaApi.library.prevNextHadith; url = url.replace("@index_key", "dhparag"); - url = url.replace("@vol_id", state.selectedItem[0]._source.address.vol_id); + url = url.replace("@vol_id", state.selectedItem?.[0]._source.address.vol_id); url = url.replace( "@page_num", - pageNumber ?? state.selectedItem[0]._source.address.page_num + (pageNumber ?? state.selectedItem?.[0]._source.address.page_num).toString() ); - url = url.replace("@step", prevNextIndicator); + url = url.replace("@step", prevNextIndicator.toString()); httpService .getRequest(url) .then((res: HadithResponseModel) => { state.selectedItem = res.hits.hits; + page_num.value = res.hits.hits[0]._source.address.page_num ?? 1; }) .finally(() => (loading.value = false)); }; @@ -233,6 +323,33 @@ const handlePageChange = () => { handlePagination(1, page_num.value); }; +const getDataTree = () => { + let id = route.params.id; + + let url = repoUrl() + hadithaApi.search.getDataTree; + url = url.replace("@appname", "monir"); + url = url.replace("@offset", 0); + url = url.replace("@limit", 10000); + url = url.replace("@vol_id", id); + url = url.replace("@q", "none"); + + httpService.getRequest(url).then((res) => { + state.treeItems = prepareTreeData(res.hits.hits); + }); +}; + +const prepareTreeData = (data) => { + return data.map((item) => { + return { + ...item, + ...item._source, + title: item._source.content, + }; + }); +}; + +getDataTree(); + // #endregion methods // components declaration @@ -295,6 +412,7 @@ const UTree = defineAsyncComponent(

{{ route.query.page_count }} @@ -337,11 +455,11 @@ const UTree = defineAsyncComponent(
@@ -357,7 +475,6 @@ const UTree = defineAsyncComponent( overlay: 'modal-overlay', content: 'modal-content accordion-menu h-10', header: 'modal-header', - wrapper: 'modal-wrapper', body: 'modal-body', title: 'modal-title', description: 'modal-description', @@ -373,7 +490,7 @@ const UTree = defineAsyncComponent( diff --git a/pages/haditha/library/index.vue b/pages/haditha/library/index.vue index 81ed651..dae0e9c 100644 --- a/pages/haditha/library/index.vue +++ b/pages/haditha/library/index.vue @@ -10,10 +10,94 @@ useHead({ title: `${import.meta.env.VITE_HADITH_PAGE_TITLE} | کتابخانه`, meta: [ { name: "description", content: "کاوش با هوش مصنوعی در احادیث اسلامی" }, + { + name: "msapplication-TileImage", + content: "/img/haditha/fav-icons/ms-icon-144x144.png", + }, + { name: "theme-color", content: "#ffffff" }, ], bodyAttrs: { class: import.meta.env.VITE_HADITH_SYSTEM, }, + link: [ + { + rel: "icon", + type: "image/x-icon", + href: "/img/haditha/fav-icons/favicon.ico", + }, + { rel: "manifest", href: "/img/haditha/fav-icons/manifest.json" }, + // rel: icon + { + rel: "icon", + type: "image/png", + sizes: "16x16", + href: "/img/haditha/fav-icons/favicon-16x16.png", + }, + { + rel: "icon", + type: "image/png", + sizes: "32x32", + href: "/img/haditha/fav-icons/favicon-32x32.png", + }, + { + rel: "icon", + type: "image/png", + sizes: "96x96", + href: "/img/haditha/fav-icons/favicon-96x96.png", + }, + { + rel: "icon", + sizes: "192x192", + type: "image/png", + href: "/img/haditha/fav-icons/android-icon-192x192.png", + }, + // rel: apple + { + rel: "apple-touch-icon", + sizes: "57x57", + href: "/img/haditha/fav-icons/apple-icon-57x57.png", + }, + { + rel: "apple-touch-icon", + sizes: "60x60", + href: "/img/haditha/fav-icons/android-icon-60x60.png", + }, + { + rel: "apple-touch-icon", + sizes: "72x72", + href: "/img/haditha/fav-icons/android-icon-72x72.png", + }, + { + rel: "apple-touch-icon", + sizes: "76x76", + href: "/img/haditha/fav-icons/android-icon-76x76.png", + }, + { + rel: "apple-touch-icon", + sizes: "114x114", + href: "/img/haditha/fav-icons/android-icon-114x114.png", + }, + { + rel: "apple-touch-icon", + sizes: "120x120", + href: "/img/haditha/fav-icons/android-icon-120x120.png", + }, + { + rel: "apple-touch-icon", + sizes: "144x144", + href: "/img/haditha/fav-icons/android-icon-144x144.png", + }, + { + rel: "apple-touch-icon", + sizes: "152x152", + href: "/img/haditha/fav-icons/android-icon-152x152.png", + }, + { + rel: "apple-touch-icon", + sizes: "180x180", + href: "/img/haditha/fav-icons/android-icon-180x180.png", + }, + ], }); // #region refs diff --git a/pages/haditha/login.vue b/pages/haditha/login.vue index df36fe4..47e7abe 100644 --- a/pages/haditha/login.vue +++ b/pages/haditha/login.vue @@ -7,10 +7,94 @@ useHead({ title: `${import.meta.env.VITE_HADITH_PAGE_TITLE} | ورود`, meta: [ { name: "description", content: "کاوش با هوش مصنوعی در احادیث اسلامی" }, + { + name: "msapplication-TileImage", + content: "/img/haditha/fav-icons/ms-icon-144x144.png", + }, + { name: "theme-color", content: "#ffffff" }, ], bodyAttrs: { class: import.meta.env.VITE_HADITH_SYSTEM, }, + link: [ + { + rel: "icon", + type: "image/x-icon", + href: "/img/haditha/fav-icons/favicon.ico", + }, + { rel: "manifest", href: "/img/haditha/fav-icons/manifest.json" }, + // rel: icon + { + rel: "icon", + type: "image/png", + sizes: "16x16", + href: "/img/haditha/fav-icons/favicon-16x16.png", + }, + { + rel: "icon", + type: "image/png", + sizes: "32x32", + href: "/img/haditha/fav-icons/favicon-32x32.png", + }, + { + rel: "icon", + type: "image/png", + sizes: "96x96", + href: "/img/haditha/fav-icons/favicon-96x96.png", + }, + { + rel: "icon", + sizes: "192x192", + type: "image/png", + href: "/img/haditha/fav-icons/android-icon-192x192.png", + }, + // rel: apple + { + rel: "apple-touch-icon", + sizes: "57x57", + href: "/img/haditha/fav-icons/apple-icon-57x57.png", + }, + { + rel: "apple-touch-icon", + sizes: "60x60", + href: "/img/haditha/fav-icons/android-icon-60x60.png", + }, + { + rel: "apple-touch-icon", + sizes: "72x72", + href: "/img/haditha/fav-icons/android-icon-72x72.png", + }, + { + rel: "apple-touch-icon", + sizes: "76x76", + href: "/img/haditha/fav-icons/android-icon-76x76.png", + }, + { + rel: "apple-touch-icon", + sizes: "114x114", + href: "/img/haditha/fav-icons/android-icon-114x114.png", + }, + { + rel: "apple-touch-icon", + sizes: "120x120", + href: "/img/haditha/fav-icons/android-icon-120x120.png", + }, + { + rel: "apple-touch-icon", + sizes: "144x144", + href: "/img/haditha/fav-icons/android-icon-144x144.png", + }, + { + rel: "apple-touch-icon", + sizes: "152x152", + href: "/img/haditha/fav-icons/android-icon-152x152.png", + }, + { + rel: "apple-touch-icon", + sizes: "180x180", + href: "/img/haditha/fav-icons/android-icon-180x180.png", + }, + ], }); const stepOne = ref(true); diff --git a/pages/haditha/public-pages/index.vue b/pages/haditha/public-pages/index.vue index e0a916a..379a63f 100644 --- a/pages/haditha/public-pages/index.vue +++ b/pages/haditha/public-pages/index.vue @@ -10,10 +10,94 @@ useHead({ title: `${import.meta.env.VITE_HADITH_PAGE_TITLE} | در باره حدیثا`, meta: [ { name: "description", content: "کاوش با هوش مصنوعی در احادیث اسلامی" }, + { + name: "msapplication-TileImage", + content: "/img/haditha/fav-icons/ms-icon-144x144.png", + }, + { name: "theme-color", content: "#ffffff" }, ], bodyAttrs: { class: import.meta.env.VITE_HADITH_SYSTEM, }, + link: [ + { + rel: "icon", + type: "image/x-icon", + href: "/img/haditha/fav-icons/favicon.ico", + }, + { rel: "manifest", href: "/img/haditha/fav-icons/manifest.json" }, + // rel: icon + { + rel: "icon", + type: "image/png", + sizes: "16x16", + href: "/img/haditha/fav-icons/favicon-16x16.png", + }, + { + rel: "icon", + type: "image/png", + sizes: "32x32", + href: "/img/haditha/fav-icons/favicon-32x32.png", + }, + { + rel: "icon", + type: "image/png", + sizes: "96x96", + href: "/img/haditha/fav-icons/favicon-96x96.png", + }, + { + rel: "icon", + sizes: "192x192", + type: "image/png", + href: "/img/haditha/fav-icons/android-icon-192x192.png", + }, + // rel: apple + { + rel: "apple-touch-icon", + sizes: "57x57", + href: "/img/haditha/fav-icons/apple-icon-57x57.png", + }, + { + rel: "apple-touch-icon", + sizes: "60x60", + href: "/img/haditha/fav-icons/android-icon-60x60.png", + }, + { + rel: "apple-touch-icon", + sizes: "72x72", + href: "/img/haditha/fav-icons/android-icon-72x72.png", + }, + { + rel: "apple-touch-icon", + sizes: "76x76", + href: "/img/haditha/fav-icons/android-icon-76x76.png", + }, + { + rel: "apple-touch-icon", + sizes: "114x114", + href: "/img/haditha/fav-icons/android-icon-114x114.png", + }, + { + rel: "apple-touch-icon", + sizes: "120x120", + href: "/img/haditha/fav-icons/android-icon-120x120.png", + }, + { + rel: "apple-touch-icon", + sizes: "144x144", + href: "/img/haditha/fav-icons/android-icon-144x144.png", + }, + { + rel: "apple-touch-icon", + sizes: "152x152", + href: "/img/haditha/fav-icons/android-icon-152x152.png", + }, + { + rel: "apple-touch-icon", + sizes: "180x180", + href: "/img/haditha/fav-icons/android-icon-180x180.png", + }, + ], }); const componentName = ref(""); diff --git a/pages/haditha/search/[id]/[slug]/index.vue b/pages/haditha/search/[id]/[slug]/index.vue index a502f29..b5bcaa0 100644 --- a/pages/haditha/search/[id]/[slug]/index.vue +++ b/pages/haditha/search/[id]/[slug]/index.vue @@ -24,10 +24,94 @@ useHead({ title: `${import.meta.env.VITE_HADITH_PAGE_TITLE}`, meta: [ { name: "description", content: "کاوش با هوش مصنوعی در احادیث اسلامی" }, + { + name: "msapplication-TileImage", + content: "/img/haditha/fav-icons/ms-icon-144x144.png", + }, + { name: "theme-color", content: "#ffffff" }, ], bodyAttrs: { class: import.meta.env.VITE_HADITH_SYSTEM, }, + link: [ + { + rel: "icon", + type: "image/x-icon", + href: "/img/haditha/fav-icons/favicon.ico", + }, + { rel: "manifest", href: "/img/haditha/fav-icons/manifest.json" }, + // rel: icon + { + rel: "icon", + type: "image/png", + sizes: "16x16", + href: "/img/haditha/fav-icons/favicon-16x16.png", + }, + { + rel: "icon", + type: "image/png", + sizes: "32x32", + href: "/img/haditha/fav-icons/favicon-32x32.png", + }, + { + rel: "icon", + type: "image/png", + sizes: "96x96", + href: "/img/haditha/fav-icons/favicon-96x96.png", + }, + { + rel: "icon", + sizes: "192x192", + type: "image/png", + href: "/img/haditha/fav-icons/android-icon-192x192.png", + }, + // rel: apple + { + rel: "apple-touch-icon", + sizes: "57x57", + href: "/img/haditha/fav-icons/apple-icon-57x57.png", + }, + { + rel: "apple-touch-icon", + sizes: "60x60", + href: "/img/haditha/fav-icons/android-icon-60x60.png", + }, + { + rel: "apple-touch-icon", + sizes: "72x72", + href: "/img/haditha/fav-icons/android-icon-72x72.png", + }, + { + rel: "apple-touch-icon", + sizes: "76x76", + href: "/img/haditha/fav-icons/android-icon-76x76.png", + }, + { + rel: "apple-touch-icon", + sizes: "114x114", + href: "/img/haditha/fav-icons/android-icon-114x114.png", + }, + { + rel: "apple-touch-icon", + sizes: "120x120", + href: "/img/haditha/fav-icons/android-icon-120x120.png", + }, + { + rel: "apple-touch-icon", + sizes: "144x144", + href: "/img/haditha/fav-icons/android-icon-144x144.png", + }, + { + rel: "apple-touch-icon", + sizes: "152x152", + href: "/img/haditha/fav-icons/android-icon-152x152.png", + }, + { + rel: "apple-touch-icon", + sizes: "180x180", + href: "/img/haditha/fav-icons/android-icon-180x180.png", + }, + ], }); // #endregion imports @@ -89,16 +173,16 @@ const goToTheChatbot = () => { }); }; -const handleFavorite = async (item = {}) => { - addToFavorites(); +const handleFavorite = async () => { + addToFavorites(state.selectedItem); // // add - // if (!item._source.tbookmark) { - // addToFavorites(); + // if (!state.selectedItem._source.tbookmark) { + // addToFavorites(state.selectedItem); // } // // delete // else { - // removeToFavorites(); + // removeFromFavorites(state.selectedItem); // } }; @@ -107,10 +191,8 @@ const addToFavorites = async (item = {}) => { url = url.replace("{{data_type}}", "bookmark"); url = url.replace("{{ref_key}}", "dhparag"); const formData = { - // ref_id: item._id, - ref_id: "pdh388_2113", - title: "عنوان تست_حدیثا بوک مارک", - // title: item._source.title, + ref_id: item._id, + title: item._source.content, }; httpService.postRequest(url, formData).then((res) => { // this.updateListAnswer(index, "tbookmark", 1); @@ -121,7 +203,7 @@ const removeFromFavorites = async (item = {}, index = 0) => { let url = repoUrl() + hadithaApi.favorite.deleteByRefid; url = url.replace("{{data_type}}", "bookmark"); url = url.replace("{{index_key}}", "dhparag"); - url = url.replace("{{ref_id}}", "pdh388_2113"); + url = url.replace("{{ref_id}}", item._id); const formData = { ref_id: item._id, @@ -173,12 +255,13 @@ const localCopyTextToClipboard = (text: string) => {