From 7dcb4acb6d4697462c08a5730ee2e4b8d49283ec Mon Sep 17 00:00:00 2001 From: moghwan Date: Sun, 30 Apr 2023 20:00:40 +0100 Subject: [PATCH 01/15] multiple panels support --- src/components/partials/Nav/SectionsNav.vue | 34 ++++++++++++++++--- .../partials/Nav/SectionsNavElement.vue | 32 +++-------------- src/stores/settings.js | 6 ---- src/views/HomeView.vue | 3 ++ 4 files changed, 37 insertions(+), 38 deletions(-) diff --git a/src/components/partials/Nav/SectionsNav.vue b/src/components/partials/Nav/SectionsNav.vue index 51e26d7..f5efdf0 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 + console.info('i', 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..19ab602 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/stores/settings.js b/src/stores/settings.js index 4eee9a5..8682e4b 100644 --- a/src/stores/settings.js +++ b/src/stores/settings.js @@ -6,7 +6,6 @@ export const useSettingsStore = defineStore("settings", () => { const selectedSection = ref(useLocalStorage('selectedSection', 1)); 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)); @@ -17,10 +16,6 @@ export const useSettingsStore = defineStore("settings", () => { // 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,7 +26,6 @@ export const useSettingsStore = defineStore("settings", () => { return { displayMode, switchDisplayMode, - showRamadanDashboard, switchVisibilityRamadanDashboard, showVisibilityRamadanDashboard, hideVisibilityRamadanDashboard, showSalateTimes, switchVisibilitySalateTimes, showVisibilitySalateTimes, hideVisibilitySalateTimes, showSettings, switchVisibilitySettings, showVisibilitySettings, hideVisibilitySettings, selectedSection, updateSelectedSection, diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index 293f3de..cc324e4 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -3,6 +3,7 @@
+
@@ -20,6 +21,7 @@ import Spinner from "@/components/partials/SpinnerLoader.vue"; import {useCityStore} from "@/stores/city" import {useSettingsStore} from "@/stores/settings" import SalateTimes from "@/components/sections/SalateTimes.vue"; +import Settings from "@/components/sections/Settings.vue"; import SectionsNav from "@/components/partials/Nav/SectionsNav.vue"; import { IconLayoutCards } from '@tabler/icons-vue'; @@ -56,5 +58,6 @@ const isTooSmall = computed(() => windowWidth.value <= 500) const refreshTheDay = (cityId) => cityId ? fetchData(cityId) : fetchData(selectedCityId.value) const showPanel = computed(() => settingsStore.displayMode) const showSalateTimes = computed(() => settingsStore.showSalateTimes) +const showSettings = computed(() => settingsStore.showSettings) From 0ab2f1ab08fad79e9cbcd0020814dff0df79c2ac Mon Sep 17 00:00:00 2001 From: moghwan Date: Sun, 30 Apr 2023 20:01:13 +0100 Subject: [PATCH 02/15] responsive ui improved --- src/components/partials/Nav/SectionsNav.vue | 2 -- src/components/partials/Nav/SectionsNavElement.vue | 2 +- src/views/HomeView.vue | 10 +++++----- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/components/partials/Nav/SectionsNav.vue b/src/components/partials/Nav/SectionsNav.vue index f5efdf0..e82398f 100644 --- a/src/components/partials/Nav/SectionsNav.vue +++ b/src/components/partials/Nav/SectionsNav.vue @@ -31,12 +31,10 @@ onMounted(() => { selectItem(settingsStore.selectedSection) }) - const selectItem = (i) => { i === false ? i = 1 : null; selected.value = i - console.info('i', i) settingsStore.updateSelectedSection(i) settingsStore.hideVisibilitySalateTimes() diff --git a/src/components/partials/Nav/SectionsNavElement.vue b/src/components/partials/Nav/SectionsNavElement.vue index 19ab602..91d32a7 100644 --- a/src/components/partials/Nav/SectionsNavElement.vue +++ b/src/components/partials/Nav/SectionsNavElement.vue @@ -5,7 +5,7 @@ :class="parseInt(selected) === id ? 'bg-white shadow' : null" class="flex items-center rounded-md py-4 px-4 text-sm font-semibold lg:pr-3" > - {{ label }} + {{ label }} diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index cc324e4..a1b3ed1 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -1,10 +1,10 @@