Merge pull request #516 from frappe/develop

This commit is contained in:
Shariq Ansari 2025-01-06 13:28:03 +05:30 committed by GitHub
commit f335cea2f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 29 additions and 21 deletions

View File

@ -9,8 +9,9 @@
<script setup> <script setup>
import { Dialogs } from '@/utils/dialogs' import { Dialogs } from '@/utils/dialogs'
import { sessionStore as session } from '@/stores/session' import { sessionStore as session } from '@/stores/session'
import { setTheme } from '@/stores/theme'
import { Toasts, setConfig } from 'frappe-ui' import { Toasts, setConfig } from 'frappe-ui'
import { computed, defineAsyncComponent } from 'vue' import { computed, defineAsyncComponent, onMounted } from 'vue'
const MobileLayout = defineAsyncComponent( const MobileLayout = defineAsyncComponent(
() => import('./components/Layouts/MobileLayout.vue'), () => import('./components/Layouts/MobileLayout.vue'),
@ -26,6 +27,8 @@ const Layout = computed(() => {
} }
}) })
onMounted(() => setTheme())
setConfig('systemTimezone', window.timezone?.system || null) setConfig('systemTimezone', window.timezone?.system || null)
setConfig('localTimezone', window.timezone?.user || null) setConfig('localTimezone', window.timezone?.user || null)
</script> </script>

View File

@ -115,9 +115,9 @@ import {
unreadNotificationsCount, unreadNotificationsCount,
notificationsStore, notificationsStore,
} from '@/stores/notifications' } from '@/stores/notifications'
import { FeatherIcon, TrialBanner, createResource } from 'frappe-ui' import { FeatherIcon } from 'frappe-ui'
import { useStorage } from '@vueuse/core' import { useStorage } from '@vueuse/core'
import { computed, h, provide } from 'vue' import { computed, h } from 'vue'
const { getPinnedViews, getPublicViews } = viewsStore() const { getPinnedViews, getPublicViews } = viewsStore()
const { toggle: toggleNotificationPanel } = notificationsStore() const { toggle: toggleNotificationPanel } = notificationsStore()

View File

@ -74,8 +74,7 @@
field.mandatory_via_depends_on) field.mandatory_via_depends_on)
" "
class="text-ink-red-3" class="text-ink-red-3"
> *</span > *</span>
>
</div> </div>
</Tooltip> </Tooltip>
<div class="flex items-center justify-between w-[65%]"> <div class="flex items-center justify-between w-[65%]">
@ -413,6 +412,9 @@ const props = defineProps({
type: Boolean, type: Boolean,
default: false, default: false,
}, },
addContact: {
type: Function,
},
}) })
const { getFormattedPercent, getFormattedFloat, getFormattedCurrency } = const { getFormattedPercent, getFormattedFloat, getFormattedCurrency } =

View File

@ -56,8 +56,8 @@ import { usersStore } from '@/stores/users'
import { getSettings } from '@/stores/settings' import { getSettings } from '@/stores/settings'
import { showSettings } from '@/composables/settings' import { showSettings } from '@/composables/settings'
import { Dropdown } from 'frappe-ui' import { Dropdown } from 'frappe-ui'
import { useStorage } from '@vueuse/core' import { theme, toggleTheme } from '@/stores/theme'
import { computed, h, markRaw, onMounted } from 'vue' import { computed, h, markRaw } from 'vue'
const props = defineProps({ const props = defineProps({
isCollapsed: { isCollapsed: {
@ -72,8 +72,6 @@ const { getUser } = usersStore()
const user = computed(() => getUser() || {}) const user = computed(() => getUser() || {})
const theme = useStorage('theme', 'light')
const dropdownItems = computed(() => { const dropdownItems = computed(() => {
if (!settings.value?.dropdown_items) return [] 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)
}
})
</script> </script>

View File

@ -121,6 +121,7 @@
<SidePanelLayout <SidePanelLayout
v-model="deal.data" v-model="deal.data"
:sections="sections.data" :sections="sections.data"
:addContact="addContact"
doctype="CRM Deal" doctype="CRM Deal"
v-slot="{ section }" v-slot="{ section }"
@update="updateField" @update="updateField"

View File

@ -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)
}
}