diff --git a/package.json b/package.json index 3731f09..86f96b5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bouayadapp-front", - "version": "0.6.0", + "version": "0.7.0", "private": true, "scripts": { "dev": "vite", diff --git a/src/components/TheDay.vue b/src/components/TheDay.vue index 506c954..537ff49 100644 --- a/src/components/TheDay.vue +++ b/src/components/TheDay.vue @@ -72,20 +72,20 @@ - + - {{ city.name }} + {{ city.name_ar }} - + - {{ city.name }} + {{ city.name_ar }} @@ -127,7 +127,9 @@ import {ref, computed, toRefs, onMounted} from "vue"; import SalateElement from "@/components/partials/salateElement.vue"; import { useCityStore } from "@/stores/city" +import {useSettingsStore} from "@/stores/settings"; +const settingsStore = useSettingsStore(); const store = useCityStore(); const props = defineProps({ data: { @@ -144,18 +146,22 @@ const currentTime = ref(new Date()); const showBack = ref(false); const showFirstHikma = ref(true); const defaultCities = ref([ - {id: 1, name: "الرباط"}, - {id: 99, name: "مكناس"}, - {id: 81, name: "فاس"}, - {id: 31, name: "وجدة"}, - {id: 156, name: "العيون"}, - {id: 117, name: "أغادير"}, - {id: 107, name: "مراكش"}, - {id: 58, name: "البيضاء"}, + {id: 1, name_ar: "الرباط"}, + {id: 99, name_ar: "مكناس"}, + {id: 81, name_ar: "فاس"}, + {id: 31, name_ar: "وجدة"}, + {id: 156, name_ar: "العيون"}, + {id: 117, name_ar: "أغادير"}, + {id: 107, name_ar: "مراكش"}, + {id: 58, name_ar: "البيضاء"}, ]) +const selectedCities = ref(settingsStore.selectedCities) -const RTLCities = computed(() => defaultCities.value.slice(0).reverse()) - +const RTLCities = computed(() => { + return selectedCities.value.length > 0 + ? selectedCities.value.slice(0).reverse() + : defaultCities.value.slice(0).reverse() +}) const countHikamsFront = computed(() => data.value.events.hikams_front.length) const firstHikmaF = computed(() => data.value.events.hikams_front[0]) const secondHikmaF = computed(() => data.value.events.hikams_front[1]) diff --git a/src/components/partials/CitiesDropdown.vue b/src/components/partials/CitiesDropdown.vue new file mode 100644 index 0000000..7161f23 --- /dev/null +++ b/src/components/partials/CitiesDropdown.vue @@ -0,0 +1,92 @@ + + + diff --git a/src/components/partials/Nav/SectionsNav.vue b/src/components/partials/Nav/SectionsNav.vue index 51e26d7..e82398f 100644 --- a/src/components/partials/Nav/SectionsNav.vue +++ b/src/components/partials/Nav/SectionsNav.vue @@ -3,7 +3,7 @@
import SectionsNavElement from "@/components/partials/Nav/SectionsNavElement.vue"; -import {ref} from "vue"; +import {onMounted, ref} from "vue"; import {useSettingsStore} from "@/stores/settings"; const settingsStore = useSettingsStore(); const selected = ref(settingsStore.selectedSection) const menuItems = [ {id: 1, label: "مواقيت الصلوات", route: "#", name: "salatetimes"}, - // {id: 2, label: "رمضان", route: "#", name: "ramadanmode"}, - // {id: 3, label: "الإعدادات", route: "#", name: "settings"}, + {id: 2, label: "الإعدادات", route: "#", name: "settings"}, ] -const selectNavItem = (i) => selected.value = i; +onMounted(() => { + selectItem(settingsStore.selectedSection) +}) + +const selectItem = (i) => { + i === false ? i = 1 : null; + + selected.value = i + settingsStore.updateSelectedSection(i) + + settingsStore.hideVisibilitySalateTimes() + settingsStore.hideVisibilitySettings() + + switch (i) { + case 1: + settingsStore.showVisibilitySalateTimes() + break + case 2: + settingsStore.showVisibilitySettings() + break + default: + settingsStore.showVisibilitySalateTimes() + } +} diff --git a/src/components/partials/Nav/SectionsNavElement.vue b/src/components/partials/Nav/SectionsNavElement.vue index a9332d5..91d32a7 100644 --- a/src/components/partials/Nav/SectionsNavElement.vue +++ b/src/components/partials/Nav/SectionsNavElement.vue @@ -1,26 +1,20 @@ \ No newline at end of file diff --git a/src/components/sections/Settings.vue b/src/components/sections/Settings.vue index 9ee173a..723a7dd 100644 --- a/src/components/sections/Settings.vue +++ b/src/components/sections/Settings.vue @@ -1,10 +1,37 @@ diff --git a/src/stores/settings.js b/src/stores/settings.js index 4eee9a5..2e2929b 100644 --- a/src/stores/settings.js +++ b/src/stores/settings.js @@ -4,23 +4,22 @@ import { useLocalStorage } from "@vueuse/core" export const useSettingsStore = defineStore("settings", () => { const selectedSection = ref(useLocalStorage('selectedSection', 1)); + const selectedCities = ref(useLocalStorage('selectedCities', [])); const displayMode = ref(useLocalStorage('displayMode', displayModes.isFull)); - const showRamadanDashboard = ref(useLocalStorage('showRamadanDashboard', false)); const showSalateTimes = ref(useLocalStorage('showSalateTimes', false)); const showSettings = ref(useLocalStorage('showSettings', false)); const updateSelectedSection = (id) => { selectedSection.value = id } + const updateSelectedCities = (cities) => { + selectedCities.value = cities + } const switchDisplayMode = () => displayMode.value = !displayMode.value; // const showDisplayMode = () => displayMode.value = true; // const hideDisplayMode = () => displayMode.value = false; - const switchVisibilityRamadanDashboard = () => showRamadanDashboard.value = !showRamadanDashboard.value; - const showVisibilityRamadanDashboard = () => showRamadanDashboard.value = true; - const hideVisibilityRamadanDashboard = () => showRamadanDashboard.value = false; - const switchVisibilitySalateTimes = () => showSalateTimes.value = !showSalateTimes.value; const showVisibilitySalateTimes = () => showSalateTimes.value = true; const hideVisibilitySalateTimes = () => showSalateTimes.value = false; @@ -31,9 +30,9 @@ export const useSettingsStore = defineStore("settings", () => { return { displayMode, switchDisplayMode, - showRamadanDashboard, switchVisibilityRamadanDashboard, showVisibilityRamadanDashboard, hideVisibilityRamadanDashboard, showSalateTimes, switchVisibilitySalateTimes, showVisibilitySalateTimes, hideVisibilitySalateTimes, showSettings, switchVisibilitySettings, showVisibilitySettings, hideVisibilitySettings, selectedSection, updateSelectedSection, + selectedCities, updateSelectedCities, }; }); diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index 293f3de..e6ff4b6 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -1,9 +1,10 @@