From 211107f025324a9af5546b46b27c53beb34f3613 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Sat, 4 Jan 2025 18:52:29 +0530 Subject: [PATCH 1/2] fix: moved theme related code to theme.js --- frontend/src/App.vue | 5 ++++- frontend/src/components/Layouts/AppSidebar.vue | 4 ++-- frontend/src/components/UserDropdown.vue | 18 ++---------------- frontend/src/stores/theme.js | 16 ++++++++++++++++ 4 files changed, 24 insertions(+), 19 deletions(-) create mode 100644 frontend/src/stores/theme.js diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 02c42926..210e93fa 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -9,8 +9,9 @@ diff --git a/frontend/src/components/Layouts/AppSidebar.vue b/frontend/src/components/Layouts/AppSidebar.vue index 3d44cb97..d4906834 100644 --- a/frontend/src/components/Layouts/AppSidebar.vue +++ b/frontend/src/components/Layouts/AppSidebar.vue @@ -115,9 +115,9 @@ import { unreadNotificationsCount, notificationsStore, } from '@/stores/notifications' -import { FeatherIcon, TrialBanner, createResource } from 'frappe-ui' +import { FeatherIcon } from 'frappe-ui' import { useStorage } from '@vueuse/core' -import { computed, h, provide } from 'vue' +import { computed, h } from 'vue' const { getPinnedViews, getPublicViews } = viewsStore() const { toggle: toggleNotificationPanel } = notificationsStore() diff --git a/frontend/src/components/UserDropdown.vue b/frontend/src/components/UserDropdown.vue index b049ba03..b659c159 100644 --- a/frontend/src/components/UserDropdown.vue +++ b/frontend/src/components/UserDropdown.vue @@ -56,8 +56,8 @@ import { usersStore } from '@/stores/users' import { getSettings } from '@/stores/settings' import { showSettings } from '@/composables/settings' import { Dropdown } from 'frappe-ui' -import { useStorage } from '@vueuse/core' -import { computed, h, markRaw, onMounted } from 'vue' +import { theme, toggleTheme } from '@/stores/theme' +import { computed, h, markRaw } from 'vue' const props = defineProps({ isCollapsed: { @@ -72,8 +72,6 @@ const { getUser } = usersStore() const user = computed(() => getUser() || {}) -const theme = useStorage('theme', 'light') - const dropdownItems = computed(() => { if (!settings.value?.dropdown_items) return [] @@ -165,16 +163,4 @@ function getStandardItem(item) { } } } - -function toggleTheme() { - const currentTheme = document.documentElement.getAttribute('data-theme') - theme.value = currentTheme === 'dark' ? 'light' : 'dark' - document.documentElement.setAttribute('data-theme', theme.value) -} - -onMounted(() => { - if (['light', 'dark'].includes(theme.value)) { - document.documentElement.setAttribute('data-theme', theme.value) - } -}) diff --git a/frontend/src/stores/theme.js b/frontend/src/stores/theme.js new file mode 100644 index 00000000..50d4e67d --- /dev/null +++ b/frontend/src/stores/theme.js @@ -0,0 +1,16 @@ +import { useStorage } from '@vueuse/core' + +export const theme = useStorage('theme', 'light') + +export function toggleTheme() { + const currentTheme = document.documentElement.getAttribute('data-theme') + theme.value = currentTheme === 'dark' ? 'light' : 'dark' + document.documentElement.setAttribute('data-theme', theme.value) +} + +export function setTheme(value) { + theme.value = value || theme.value + if (['light', 'dark'].includes(theme.value)) { + document.documentElement.setAttribute('data-theme', theme.value) + } +} From 9b5e596cb12b52b6ecee857cd99f563680a94d26 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Mon, 6 Jan 2025 13:26:41 +0530 Subject: [PATCH 2/2] fix: add contact in deal is not working --- frontend/src/components/SidePanelLayout.vue | 6 ++++-- frontend/src/pages/Deal.vue | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/SidePanelLayout.vue b/frontend/src/components/SidePanelLayout.vue index d13ce621..73a969b4 100644 --- a/frontend/src/components/SidePanelLayout.vue +++ b/frontend/src/components/SidePanelLayout.vue @@ -74,8 +74,7 @@ field.mandatory_via_depends_on) " class="text-ink-red-3" - > * + > *
@@ -413,6 +412,9 @@ const props = defineProps({ type: Boolean, default: false, }, + addContact: { + type: Function, + }, }) const { getFormattedPercent, getFormattedFloat, getFormattedCurrency } = diff --git a/frontend/src/pages/Deal.vue b/frontend/src/pages/Deal.vue index fb2af335..f5483c71 100644 --- a/frontend/src/pages/Deal.vue +++ b/frontend/src/pages/Deal.vue @@ -121,6 +121,7 @@