diff --git a/apis/hadithaApi.js b/apis/hadithaApi.js index 1e66d06..b935e4f 100644 --- a/apis/hadithaApi.js +++ b/apis/hadithaApi.js @@ -2,5 +2,25 @@ export default { search: { list: "repo/monir/search/@index_key/@search_type/@type_key/@listkey/@field_collapsed/@offset/@limit/@q=none", show: "repo/public/get/byid/@index_key/@id", + synonym: "synonym/get/words", + prevNextHadith: "monir/next/@index_key/@vol_id/@parag_order/@step", + }, + favorite: { + add: "favorite/add/{{data_type}}/{{ref_key}}", + delete: "favorite/delete/{{data_type}}/{{id}}", //id = portal_meet_22569 + deleteByRefid: "favorite/delete/{{data_type}}/{{index_key}}/{{ref_id}}", //id = portal_meet_22569 + // getListSearch: "favorite/list/{{data_type}}/{{offset}}/{{limit}}", //offset=0 , limit=10 + // counts: "favorite/counts/@data_type", // get + + setFavoritesCat: "favorite/tags/@data_type/set/doc/@id", + getCategories: "favorite/tags/@data_type/get", + setCategories: "favorite/tags/@data_type/set", + getCounts: "favorite/tags/@data_type/counts", + + getList: "favorite/list/@data_type/@offset/@limit/@filter", + }, + library: { + list: "monir/book/volume/@field_collapsed/@offset/@limit/@q", + show: "@appname/book/page/@page_start/@page_end/@vol_id", }, }; diff --git a/assets/haditha/font-icons/tag-active.svg b/assets/haditha/font-icons/tag-active.svg new file mode 100644 index 0000000..a7ebc6c --- /dev/null +++ b/assets/haditha/font-icons/tag-active.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/haditha/images/background-1.webp b/assets/haditha/images/background-1.webp new file mode 100644 index 0000000..9cd5100 Binary files /dev/null and b/assets/haditha/images/background-1.webp differ diff --git a/assets/haditha/images/background.png b/assets/haditha/images/background.png deleted file mode 100644 index 7ec7756..0000000 Binary files a/assets/haditha/images/background.png and /dev/null differ diff --git a/assets/haditha/images/background.svg b/assets/haditha/images/background.svg deleted file mode 100644 index 82fef6b..0000000 --- a/assets/haditha/images/background.svg +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/haditha/images/background.webp b/assets/haditha/images/background.webp new file mode 100644 index 0000000..f08545d Binary files /dev/null and b/assets/haditha/images/background.webp differ diff --git a/assets/haditha/images/box-1-bgi.svg b/assets/haditha/images/box-1-bgi.svg deleted file mode 100644 index 12f51e8..0000000 --- a/assets/haditha/images/box-1-bgi.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/assets/haditha/images/card-one-bgi.webp b/assets/haditha/images/card-one-bgi.webp new file mode 100644 index 0000000..bb918b3 Binary files /dev/null and b/assets/haditha/images/card-one-bgi.webp differ diff --git a/assets/haditha/images/card-one.webp b/assets/haditha/images/card-one.webp new file mode 100644 index 0000000..6706581 Binary files /dev/null and b/assets/haditha/images/card-one.webp differ diff --git a/assets/haditha/images/card-three-bgi.webp b/assets/haditha/images/card-three-bgi.webp new file mode 100644 index 0000000..aba5d6b Binary files /dev/null and b/assets/haditha/images/card-three-bgi.webp differ diff --git a/assets/haditha/images/card-three.webp b/assets/haditha/images/card-three.webp new file mode 100644 index 0000000..7d5e991 Binary files /dev/null and b/assets/haditha/images/card-three.webp differ diff --git a/assets/haditha/images/card-two-bgi.webp b/assets/haditha/images/card-two-bgi.webp new file mode 100644 index 0000000..4b64a18 Binary files /dev/null and b/assets/haditha/images/card-two-bgi.webp differ diff --git a/assets/haditha/images/card-two.webp b/assets/haditha/images/card-two.webp new file mode 100644 index 0000000..523072d Binary files /dev/null and b/assets/haditha/images/card-two.webp differ diff --git a/assets/haditha/images/location.webp b/assets/haditha/images/location.webp new file mode 100644 index 0000000..3fa6374 Binary files /dev/null and b/assets/haditha/images/location.webp differ diff --git a/assets/haditha/images/logo.svg b/assets/haditha/images/logo.svg deleted file mode 100644 index 5cad894..0000000 --- a/assets/haditha/images/logo.svg +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/haditha/images/logo.webp b/assets/haditha/images/logo.webp new file mode 100644 index 0000000..62c2a06 Binary files /dev/null and b/assets/haditha/images/logo.webp differ diff --git a/assets/haditha/images/modal-bottom-left-bgi.webp b/assets/haditha/images/modal-bottom-left-bgi.webp new file mode 100644 index 0000000..525fa39 Binary files /dev/null and b/assets/haditha/images/modal-bottom-left-bgi.webp differ diff --git a/assets/haditha/images/modal-bttom-right-bgi.webp b/assets/haditha/images/modal-bttom-right-bgi.webp new file mode 100644 index 0000000..81ded2e Binary files /dev/null and b/assets/haditha/images/modal-bttom-right-bgi.webp differ diff --git a/assets/haditha/images/modal-top-bgi.webp b/assets/haditha/images/modal-top-bgi.webp new file mode 100644 index 0000000..f0470f3 Binary files /dev/null and b/assets/haditha/images/modal-top-bgi.webp differ diff --git a/assets/haditha/images/section-three-bgi.png b/assets/haditha/images/section-three-bgi.png deleted file mode 100644 index 4e45d9e..0000000 Binary files a/assets/haditha/images/section-three-bgi.png and /dev/null differ diff --git a/assets/haditha/images/section-three-bgi.svg b/assets/haditha/images/section-three-bgi.svg deleted file mode 100644 index 4c6fd5c..0000000 --- a/assets/haditha/images/section-three-bgi.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/assets/haditha/images/section-three-bgi.webp b/assets/haditha/images/section-three-bgi.webp new file mode 100644 index 0000000..a7ea6cd Binary files /dev/null and b/assets/haditha/images/section-three-bgi.webp differ diff --git a/assets/haditha/images/sub-header-bgi.webp b/assets/haditha/images/sub-header-bgi.webp new file mode 100644 index 0000000..10f2b4f Binary files /dev/null and b/assets/haditha/images/sub-header-bgi.webp differ diff --git a/components/haditha/AutoComplation.vue b/components/haditha/AutoComplation.vue index e6ebe47..048285c 100644 --- a/components/haditha/AutoComplation.vue +++ b/components/haditha/AutoComplation.vue @@ -3,8 +3,20 @@ import type { InputMenuItem } from "@nuxt/ui"; import hadithaApi from "../../apis/hadithaApi"; import { useStorage } from "@vueuse/core"; import * as z from "zod"; -import type { FormSubmitEvent } from "@nuxt/ui"; +import routeGlobal from "~/middleware/route.global"; +// import type { FormSubmitEvent } from "@nuxt/ui"; +export type Synonym = { + title: string; + enable: boolean; + enableForm: boolean; + subTitles: [ + { + title: string; + active: boolean; + } + ]; +}; // #region props const props = defineProps({ showFilter: { @@ -26,15 +38,22 @@ const userSearchHistory = useStorage( new Set() // Initial value ); const searchTerm = useStorage("searchPhrase", ""); +// when comming from main page search. +const route = useRoute(); +if (route.query.q) { + searchTerm.value = route.query.q; + route.query.q = undefined +} + const open = ref(false); +const typeDropdownOpen = ref(false); const loading = ref(false); const httpService = useNuxtApp()["$http"]; const search_type = ref("normal"); const type_key = ref("hadith"); - -const synonymOne = ref(false); -const synonymTwo = ref(false); +const typeModelValue = ref("normal"); +const typeModelValueFa = ref(""); // If you want to share state across multiple components, // you can use the same key in useState. Nuxt will ensure @@ -60,27 +79,57 @@ const state = reactive({ items: [ { label: "جستجو در همه", + value: "normal", + class: "", onSelect(e: Event) { console.info(e); search_type.value = "normal"; + state.type.label = e.explicitOriginalTarget?.innerText; + sendQuery(); + state.type.items[0].class = "active"; }, }, { label: "فقط در متن عربی حدیث", + value: "arabic", + valueFa: "عربی", + + class: "", onSelect(e: Event) { search_type.value = "arabic"; + state.type.label = e.explicitOriginalTarget?.innerText; + console.info(e); + state.type.items[0].class = "active"; + + sendQuery(); }, }, { label: "فقط در ترجمه ها", + value: "translations", + valueFa: "ترجمه", + onSelect(e: Event) { search_type.value = "translations"; + state.type.label = e.explicitOriginalTarget?.innerText; + console.info(e); + state.type.items[0].class = "active"; + + sendQuery(); }, }, { label: "فقط در شروح", + value: "descriptions", + valueFa: "شروح", + onSelect(e: Event) { search_type.value = "descriptions"; + state.type.label = e.explicitOriginalTarget?.innerText; + state.type.items[0].class = "active"; + console.info(e); + + sendQuery(); }, }, ], @@ -89,24 +138,7 @@ const state = reactive({ value: "synonym", label: "مترادف", icon: "i-haditha-chevron-down", - items: [ - { - label: "جستجو در همه", - slot: "arabic", - }, - { - label: "فقط در متن عربی حدیث", - slot: "arabic", - }, - { - label: "فقط در ترجمه ها", - slot: "arabic", - }, - { - label: "فقط در شروح", - slot: "arabic", - }, - ], + items: [], }, type_key: { label: "ترجمه", @@ -130,9 +162,6 @@ const state = reactive({ // ); // #endregion emits -onMounted(() => { - if (searchTerm.value.length) sendQuery(); -}); // #region methods const clearSimilar = () => { @@ -162,7 +191,7 @@ const setKey = (type: string) => { sendQuery(); }; -const sendQuery = async () => { +const sendQuery = async (payload = {}) => { if (loading.value) return; loading.value = true; @@ -175,9 +204,20 @@ const sendQuery = async () => { url = url.replace("@limit", "10"); url = url.replace("@listkey", "normal"); url = url.replace("@field_collapsed", "normal"); + + // اگر نوع انتخاب شود. + const isTypeSelected = + typeModelValue.value == "arabic" || + typeModelValue.value == "translations" || + typeModelValue.value == "descriptions"; + url = url.replace( "@q=none", - searchTerm.value.length ? `q=${searchTerm.value}` : "q=none" + searchTerm.value.length + ? `q=${isTypeSelected ? "#" + typeModelValueFa.value + " " : ""}${ + searchTerm.value + }` + : "q=none" ); // const baseURL = @@ -185,7 +225,7 @@ const sendQuery = async () => { // fetch search list from backend(ssr) return await httpService - .postRequest(url) + .postRequest(url, payload) .then((res) => { // pass res and search query to the parent. emit("response-ready", { @@ -211,35 +251,127 @@ const sendQuery = async () => { }); }; // ------------------- form ------------------- -type Schema = z.output; -const toast = useToast(); + const schema = z.object({ - name: z.string(), + name: z.string().min(1, "این فیلد ضروری است"), }); -const showForm = ref(false); + const isSynonymPopupOpen = ref(false); const Formstate = reactive({ name: "", }); -async function onSubmit(event: FormSubmitEvent) { - toast.add({ - title: "Success", - description: "The form has been submitted.", - color: "success", - }); - console.log(event.data); -} +// async function onSubmit(event: FormSubmitEvent) { +// toast.add({ +// title: "Success", +// description: "The form has been submitted.", +// color: "success", +// }); +// console.log(event.data); +// } // get synonyms +const synonymIsSwitchedOn = computed(() => { + return state.synonym.items.filter((i) => i.enable).length; +}); +const onClearSynonymClear = () => { + search_type.value = "normal"; + state.synonym.items.forEach((element) => { + element.enable = false; + }); +}; async function openSynonymPopup(type: string) { search_type.value = type; + console.info("openSynonymPopup"); - sendQuery().then(() => { + getSynonyms().then(() => { isSynonymPopupOpen.value = true; }); } +const onTypeSelectChanged = (value: string) => { + console.info(value); + + if (value == "translations") typeModelValueFa.value = "ترجمه"; + else if (value == "arabic") typeModelValueFa.value = "عربی"; + else if (value == "descriptions") typeModelValueFa.value = "شروح"; + else typeModelValueFa.value = "همه"; + + sendQuery(); +}; + +const getSynonyms = async () => { + let url = repoUrl() + hadithaApi.search.synonym; + const payload = { + query: searchTerm.value, + }; + // fetch search list from backend(ssr) + return await httpService.postRequest(url, payload).then((res) => { + state.synonym.items = []; + + Object.entries(res.data).forEach((item, index) => { + const synonyms = {} as Synonym; + synonyms.title = item[0]; + synonyms.enable = false; + synonyms.enableForm = false; + + const subTitlesStrList = item[1].value.split(","); + const subTitlesObjList = subTitlesStrList + .filter((i) => i) + .map((i) => { + return { + title: i, + active: false, + }; + }); + synonyms.subTitles = subTitlesObjList; + state.synonym.items.push(synonyms); + }); + }); +}; +const prepareSynonym = () => { + const enabledSwitches = state.synonym.items.filter((i) => i.enable); + const res = {}; + + console.info(enabledSwitches); + + enabledSwitches.forEach((item) => { + console.info(item); + + if (item.subTitles.length) + res[item.title] = item.subTitles + .filter((i) => i.active) + .map((i) => i.title) + .join(","); + }); + + console.info(res); + + return { + synonym: res, + }; +}; +const onUpdateSwitch = () => { + sendQuery(prepareSynonym()); +}; +const onUpdateSubTitle = (subTitle) => { + subTitle.active = !subTitle.active; + + sendQuery(prepareSynonym()); +}; +const onAddNewTitle = (subTitles) => { + subTitles.push({ + active: true, + title: Formstate.name, + }); + Formstate.name = ""; + + sendQuery(prepareSynonym()); +}; // #endregion methods + +onMounted(() => { + if (searchTerm.value.length) sendQuery(); +}); @@ -542,7 +668,8 @@ async function openSynonymPopup(type: string) { backdrop-filter: blur(60px); background: linear-gradient(137.41deg, #ffffff -42.82%, #e5e0ff 87.9%); filter: blur(60px); - width: 626px; + max-width: 626px; + width:100%; height: 68px; z-index: 0; } @@ -730,6 +857,7 @@ async function openSynonymPopup(type: string) { } } .popover-root-content { + overflow-y: auto; width: 20.5em; height: 17.75em; /* gap: 8px; */ @@ -782,6 +910,10 @@ async function openSynonymPopup(type: string) { border: 0.3px solid #29d985; color: #626b84; } + + &[disabled="true"] { + filter: grayscale(0.7); + } } .add-button { width: 48; diff --git a/components/haditha/CardList.vue b/components/haditha/CardList.vue index 98f986d..03821d8 100644 --- a/components/haditha/CardList.vue +++ b/components/haditha/CardList.vue @@ -18,7 +18,7 @@ const props = defineProps({
diff --git a/components/haditha/NavigationMenu.vue b/components/haditha/NavigationMenu.vue index 1f3299a..d1d86a1 100644 --- a/components/haditha/NavigationMenu.vue +++ b/components/haditha/NavigationMenu.vue @@ -59,13 +59,17 @@ const items = ref([ { label: "خروج از حساب", icon: "i-haditha-logout", - to: "/haditha/logout", + type: "button" as const, + onSelect(e: Event) { + e.preventDefault(); + logout(); + }, }, ], }, ]); -const leftItem = ref([ +const leftItem = computed(() => [ { label: "نشان شده ها", icon: "i-haditha-bookmark", @@ -94,7 +98,11 @@ const leftItem = ref([ { label: "خروج از حساب", icon: "i-haditha-logout", - to: "/haditha/logout", + type: "button" as const, + onSelect(e: Event) { + e.preventDefault(); + logout(); + }, }, ], }, @@ -186,22 +194,22 @@ onMounted(() => { .fixed { z-index: 999; .my-navbar { - max-width: 1200px; - height: 68px; - border-radius: 16px; + max-width: 75em; //1200px + height: 4.25em; // 68px; + border-radius: 1em; border-width: 0.3px; // justify-content: space-between; - padding-top: 4px; - padding-right: 16px; - padding-bottom: 4px; - padding-left: 16px; + padding-top: 0.25em; + padding-right: 1em; + padding-bottom: 0.25em; + padding-left: 1em; background-color: #fff; border: 0.3px solid #e0e0e0; box-shadow: 0px 4px 15px 0px #0000001a; @media screen and (max-width: 991.99px) { - height: 76px; + height: 5em; // 76px; } nav > div { @@ -226,23 +234,23 @@ onMounted(() => { &::before { background-color: color-mix(in oklab, #00a762 50%, transparent); box-shadow: 0px 4px 10px 0px #00745933; - border-radius: 12px; + border-radius: 0.75em; //12px; } } // max-width: 112px; - height: 48px; + height: 3.5em; gap: 4px; - border-radius: 12px; - padding-top: 6px; - padding-right: 16px; - padding-bottom: 6px; - padding-left: 16px; + border-radius: 0.75em; + padding-top: 0.37em; /*6px*/ + padding-right: 1.2em; + padding-bottom: 0.37em; /*6px*/ + padding-left: 1.2em; font-family: IRANSansX; font-weight: 400; - font-size: 14px; - line-height: 21px; + font-size: 0.87rem; /*14px*/ + line-height: 1.3rem; /*6px*/ letter-spacing: 0%; text-align: center; @@ -260,7 +268,7 @@ onMounted(() => { } @media screen and (max-width: 991.99px) { - height: 60px; + height: 5em; } } @@ -285,10 +293,10 @@ onMounted(() => { gap: 4px; border-radius: 12px; - padding-top: 14px; - padding-right: 16px; - padding-bottom: 14px; - padding-left: 16px; + padding-top: 0.875em; /*14px*/ + padding-right: 1em; /*16px*/ + padding-bottom: 0.875em; /*14px*/ + padding-left: 1em; /*16px*/ background: linear-gradient(102.02deg, #4be8ae 7.38%, #00a762 91.78%); box-shadow: 0px 4px 10px 0px #00745933; diff --git a/components/haditha/hero-page/SectionFive.vue b/components/haditha/hero-page/SectionFive.vue index e73c0c9..d41a7c4 100644 --- a/components/haditha/hero-page/SectionFive.vue +++ b/components/haditha/hero-page/SectionFive.vue @@ -40,7 +40,7 @@ const state = reactive({
تجربه شما با - - -
+
امکانات - -
+

{{ item.title }}

@@ -91,8 +88,8 @@ const state = reactive({ .title { font-family: IRANSansX; font-weight: 300; - font-size: 20px; - line-height: 30px; + font-size: 1.25rem; /* 20px;*/ + line-height: 1.87rem; /* 30px;*/ letter-spacing: 0%; text-align: center; @@ -106,16 +103,16 @@ const state = reactive({ .title { font-family: IRANSansX; font-weight: 600; - font-size: 16px; - line-height: 24px; + font-size: 1rem; + line-height: 1.5rem; /* 24px;*/ letter-spacing: 0%; text-align: center; } .description { font-family: IRANSansX; font-weight: 300; - font-size: 14px; - line-height: 21px; + font-size: 0.87rem; /* 14px;*/ + line-height: 1.31rem; /* 21px;*/ letter-spacing: 0%; text-align: center; } diff --git a/components/haditha/hero-page/SectionOne.vue b/components/haditha/hero-page/SectionOne.vue index 30b2473..de4a9c8 100644 --- a/components/haditha/hero-page/SectionOne.vue +++ b/components/haditha/hero-page/SectionOne.vue @@ -1,9 +1,11 @@ + + diff --git a/components/haditha/search-page/SearchList.vue b/components/haditha/search-page/SearchList.vue index a7a68c7..d909a49 100644 --- a/components/haditha/search-page/SearchList.vue +++ b/components/haditha/search-page/SearchList.vue @@ -62,17 +62,23 @@ function openModal(selectedItem) { :key="index" >

- {{ item._source.meta.hadith_masoum ?? "بدون عنوان" }} + {{ + item?._source?.meta?.hadith_masoum ?? + item?._source?.meta?.hadith_sanad ?? + "بدون عنوان" + }} +

+

+ {{ item?._source?.content_ar }}

-

بدون متن عربی

- {{ item._source.address.vol_title }}، صفحه - {{ item._source.address.page_num }} + {{ item?._source?.address?.vol_title }}، صفحه + {{ item?._source?.address?.page_num }}

@@ -81,7 +87,7 @@ function openModal(selectedItem) { class="h-full w-full flex flex-col justify-center items-center" v-else > - +

{{ props.noDataText }}

@@ -113,7 +119,7 @@ function openModal(selectedItem) {