Merge pull request #516 from frappe/develop
This commit is contained in:
commit
f335cea2f1
@ -9,8 +9,9 @@
|
||||
<script setup>
|
||||
import { Dialogs } from '@/utils/dialogs'
|
||||
import { sessionStore as session } from '@/stores/session'
|
||||
import { setTheme } from '@/stores/theme'
|
||||
import { Toasts, setConfig } from 'frappe-ui'
|
||||
import { computed, defineAsyncComponent } from 'vue'
|
||||
import { computed, defineAsyncComponent, onMounted } from 'vue'
|
||||
|
||||
const MobileLayout = defineAsyncComponent(
|
||||
() => import('./components/Layouts/MobileLayout.vue'),
|
||||
@ -26,6 +27,8 @@ const Layout = computed(() => {
|
||||
}
|
||||
})
|
||||
|
||||
onMounted(() => setTheme())
|
||||
|
||||
setConfig('systemTimezone', window.timezone?.system || null)
|
||||
setConfig('localTimezone', window.timezone?.user || null)
|
||||
</script>
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -74,8 +74,7 @@
|
||||
field.mandatory_via_depends_on)
|
||||
"
|
||||
class="text-ink-red-3"
|
||||
> *</span
|
||||
>
|
||||
> *</span>
|
||||
</div>
|
||||
</Tooltip>
|
||||
<div class="flex items-center justify-between w-[65%]">
|
||||
@ -413,6 +412,9 @@ const props = defineProps({
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
addContact: {
|
||||
type: Function,
|
||||
},
|
||||
})
|
||||
|
||||
const { getFormattedPercent, getFormattedFloat, getFormattedCurrency } =
|
||||
|
||||
@ -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)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
@ -121,6 +121,7 @@
|
||||
<SidePanelLayout
|
||||
v-model="deal.data"
|
||||
:sections="sections.data"
|
||||
:addContact="addContact"
|
||||
doctype="CRM Deal"
|
||||
v-slot="{ section }"
|
||||
@update="updateField"
|
||||
|
||||
16
frontend/src/stores/theme.js
Normal file
16
frontend/src/stores/theme.js
Normal 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)
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user