Compare commits

..

2 Commits

Author SHA1 Message Date
3454951b96 fix update app settings dark mode 2023-03-31 13:04:47 +05:30
94836d3cb6 fix view sidebar and customer dropdown dark issue 2023-03-31 12:18:38 +05:30
11 changed files with 80 additions and 126 deletions

View File

@ -30,22 +30,7 @@
<template v-if="userStore.hasAbilities(ability)" #action>
<button
type="button"
class="
flex
items-center
justify-center
w-full
px-2
py-2
bg-gray-200
border-none
outline-none
cursor-pointer
dark:bg-gray-600/70
dark:backdrop-blur-xl
dark:shadow-glass
dark:hover:bg-gray-600/80
"
class="flex items-center justify-center w-full px-2 py-2 bg-gray-200 border-none outline-none cursor-pointer "
@click="openTaxModal"
>
<BaseIcon name="CheckCircleIcon" class="h-5 text-primary-400" />
@ -68,7 +53,7 @@
<BaseIcon
v-if="taxes.length && index !== taxes.length - 1"
name="TrashIcon"
class="h-5 text-gray-700 dark:text-red-400 cursor-pointer"
class="h-5 text-gray-700 cursor-pointer"
@click="removeTax(index)"
/>
</div>

View File

@ -15,26 +15,12 @@
<thead
class="
bg-white
border
border-gray-200
border-solid
border border-gray-200 border-solid
dark:shadow-glass dark:border dark:border-white/10 dark:bg-gray-800/70
"
>
"
>
<tr>
<th
class="
px-5
py-3
text-sm
not-italic
font-medium
leading-5
text-left text-gray-700
border-t border-b border-gray-200 border-solid
dark:text-white dark:border-white/10
"
>
<th class="text-left" :class="theadClass">
<BaseContentPlaceholders v-if="isLoading">
<BaseContentPlaceholdersText :lines="1" class="w-16 h-5" />
</BaseContentPlaceholders>
@ -42,19 +28,7 @@
{{ $tc('items.item', 2) }}
</span>
</th>
<th
class="
px-5
py-3
text-sm
not-italic
font-medium
leading-5
text-right text-gray-700
border-t border-b border-gray-200 border-solid
dark:text-white dark:border-white/10
"
>
<th class="text-right" :class="theadClass">
<BaseContentPlaceholders v-if="isLoading">
<BaseContentPlaceholdersText :lines="1" class="w-16 h-5" />
</BaseContentPlaceholders>
@ -62,19 +36,7 @@
{{ $t('invoices.item.quantity') }}
</span>
</th>
<th
class="
px-5
py-3
text-sm
not-italic
font-medium
leading-5
text-left text-gray-700
border-t border-b border-gray-200 border-solid
dark:text-white dark:border-white/10
"
>
<th class="text-left" :class="theadClass">
<BaseContentPlaceholders v-if="isLoading">
<BaseContentPlaceholdersText :lines="1" class="w-16 h-5" />
</BaseContentPlaceholders>
@ -83,18 +45,9 @@
</span>
</th>
<th
v-if="store[storeProp].discount_per_item === 'YES'"
class="
px-5
py-3
text-sm
not-italic
font-medium
leading-5
text-left text-gray-700
border-t border-b border-gray-200 border-solid
dark:text-white dark:border-white/10
"
v-if="store[storeProp].discount_per_item_enabled"
class="text-left"
:class="theadClass"
>
<BaseContentPlaceholders v-if="isLoading">
<BaseContentPlaceholdersText :lines="1" class="w-16 h-5" />
@ -103,19 +56,7 @@
{{ $t('invoices.item.discount') }}
</span>
</th>
<th
class="
px-5
py-3
text-sm
not-italic
font-medium
leading-5
text-right text-gray-700
border-t border-b border-gray-200 border-solid
dark:text-white dark:border-white/10
"
>
<th class="text-right" :class="theadClass">
<BaseContentPlaceholders v-if="isLoading">
<BaseContentPlaceholdersText :lines="1" class="w-16 h-5" />
</BaseContentPlaceholders>
@ -197,6 +138,11 @@ const props = defineProps({
type: String,
default: '',
},
theadClass: {
type: String,
default: `px-5 py-3 text-sm not-italic font-medium leading-5
text-gray-700 border-t border-b border-gray-200 border-solid dark:text-white dark:border-white/10`
},
})
const companyStore = useCompanyStore()

View File

@ -40,6 +40,7 @@
px-4
md:px-8
py-1.5
dark:text-gray-200
"
>
{{ $tc('settings.roles.permission', 2) }}

View File

@ -68,8 +68,10 @@
</TransitionChild>
<div class="flex-1 h-0 pt-5 pb-4 overflow-y-auto">
<div class="flex items-center shrink-0 px-4 mb-10">
<img class="h-auto max-w-full w-36 hidden dark:block" :src="getDarkLogo"/>
<img class="h-auto max-w-full w-36 block dark:hidden" :src="getLightLogo"/>
<MainLogo
class="block h-auto max-w-full w-36 text-primary-400"
alt="Crater Logo"
/>
</div>
<nav
@ -165,7 +167,8 @@
</template>
<script setup>
import { computed } from 'vue'
import MainLogo from '@/scripts/components/icons/MainLogo.vue'
import {
Dialog,
DialogOverlay,
@ -180,9 +183,6 @@ import LightDarkSwitch from '@/scripts/components/LightDarkSwitcher.vue'
const route = useRoute()
const globalStore = useGlobalStore()
const getDarkLogo = computed(() => new URL('/img/logo-white.png', import.meta.url))
const getLightLogo = computed(() => new URL('/img/crater-logo.png', import.meta.url))
function hasActiveUrl(url) {
return route.path.indexOf(url) > -1
}

View File

@ -34,7 +34,8 @@ export const useGlobalStore = (useWindow = false) => {
isAppLoaded: false,
isSidebarOpen: false,
areCurrenciesLoading: false,
isDarkModeOn: localStorage.getItem('theme') === 'dark' || document.documentElement.classList.contains('dark'),
isDarkModeOn: false,
downloadReport: null,
}),

View File

@ -34,8 +34,8 @@
v-if="userStore.hasAbilities(abilities.CREATE_ESTIMATE)"
:to="`/admin/estimates/create?customer=${$route.params.id}`"
>
<BaseDropdownItem class="">
<BaseIcon name="DocumentIcon" class="mr-3 text-gray-600" />
<BaseDropdownItem v-slot="slotProps">
<BaseIcon name="DocumentIcon" :class="slotProps.class" />
{{ $t('estimates.new_estimate') }}
</BaseDropdownItem>
</router-link>
@ -44,8 +44,8 @@
v-if="userStore.hasAbilities(abilities.CREATE_INVOICE)"
:to="`/admin/invoices/create?customer=${$route.params.id}`"
>
<BaseDropdownItem>
<BaseIcon name="DocumentTextIcon" class="mr-3 text-gray-600" />
<BaseDropdownItem v-slot="slotProps">
<BaseIcon name="DocumentTextIcon" :class="slotProps.class" />
{{ $t('invoices.new_invoice') }}
</BaseDropdownItem>
</router-link>
@ -54,8 +54,8 @@
v-if="userStore.hasAbilities(abilities.CREATE_PAYMENT)"
:to="`/admin/payments/create?customer=${$route.params.id}`"
>
<BaseDropdownItem>
<BaseIcon name="CreditCardIcon" class="mr-3 text-gray-600" />
<BaseDropdownItem v-slot="slotProps">
<BaseIcon name="CreditCardIcon" :class="slotProps.class" />
{{ $t('payments.new_payment') }}
</BaseDropdownItem>
</router-link>
@ -64,8 +64,8 @@
v-if="userStore.hasAbilities(abilities.CREATE_EXPENSE)"
:to="`/admin/expenses/create?customer=${$route.params.id}`"
>
<BaseDropdownItem>
<BaseIcon name="CalculatorIcon" class="mr-3 text-gray-600" />
<BaseDropdownItem v-slot="slotProps">
<BaseIcon name="CalculatorIcon" :class="slotProps.class" />
{{ $t('expenses.new_expense') }}
</BaseDropdownItem>
</router-link>

View File

@ -13,6 +13,7 @@
xl:ml-64
w-88
xl:block
dark:bg-gray-800
"
>
<div
@ -25,6 +26,7 @@
pb-2
border border-gray-200 border-solid
height-full
dark:border-gray-600
"
>
<BaseInput
@ -59,6 +61,7 @@
mb-2
text-sm
border-b border-gray-200 border-solid
dark:border-gray-600
"
>
{{ $t('general.sort_by') }}
@ -114,6 +117,7 @@
border-l border-gray-200 border-solid
sidebar
base-scroll
dark:border-gray-600
"
>
<div v-for="(customer, index) in customerList" :key="index">
@ -122,9 +126,9 @@
:id="'customer-' + customer.id"
:to="`/admin/customers/${customer.id}/view`"
:class="[
'flex justify-between p-4 items-center cursor-pointer hover:bg-gray-100 border-l-4 border-transparent',
'flex justify-between p-4 items-center cursor-pointer hover:bg-gray-100 border-l-4 border-transparent dark:hover:bg-gray-700',
{
'bg-gray-100 border-l-4 border-primary-500 border-solid':
'bg-gray-100 border-l-4 border-primary-500 border-solid dark:border-primary-400 dark:bg-gray-700':
hasActiveUrl(customer.id),
},
]"
@ -143,6 +147,7 @@
text-black
capitalize
truncate
dark:text-white
"
/>
@ -157,6 +162,7 @@
font-medium
leading-5
text-gray-600
dark:text-gray-400
"
/>
</div>
@ -175,7 +181,7 @@
</div>
<p
v-if="!customerList?.length && !isFetching"
class="flex justify-center px-4 mt-5 text-sm text-gray-600"
class="flex justify-center px-4 mt-5 text-sm text-gray-600 dark:text-gray-300"
>
{{ $t('customers.no_matching_customers') }}
</p>

View File

@ -92,7 +92,7 @@
<tr
v-for="(ext, i) in requiredExtentions"
:key="i"
class="p-2 border-2 border-gray-200"
class="p-2 border-2 border-gray-200 dark:border-gray-600"
>
<td width="70%" class="p-2 text-sm truncate">
{{ i }}
@ -121,7 +121,7 @@
{{ $t('settings.update_app.update_progress') }}
</h6>
<p
class="mb-8 text-sm leading-snug text-gray-500"
class="mb-8 text-sm leading-snug text-gray-500 dark:text-gray-400"
style="max-width: 480px"
>
{{ $t('settings.update_app.progress_text') }}
@ -135,11 +135,11 @@
<li
v-for="step in updateSteps"
:key="step.stepUrl"
class="flex justify-between w-full py-3 border-b border-gray-200 border-solid last:border-b-0"
class="flex justify-between w-full py-3 border-b border-gray-200 dark:border-gray-600 border-solid last:border-b-0"
>
<p class="m-0 text-sm leading-8">{{ $t(step.translationKey) }}</p>
<p class="m-0 text-sm dark:text-gray-300 leading-8">{{ $t(step.translationKey) }}</p>
<div class="flex flex-row items-center">
<span v-if="step.time" class="mr-3 text-xs text-gray-500">
<span v-if="step.time" class="mr-3 text-xs text-gray-500 dark:text-gray-300">
{{ step.time }}
</span>
<span
@ -275,7 +275,7 @@ function statusClass(step) {
case 'running':
return 'text-blue-400 bg-blue-100'
case 'error':
return 'text-danger bg-red-200'
return 'text-red-400 bg-red-200'
default:
return ''
}

View File

@ -24,6 +24,14 @@ import { useGlobalStore } from '@/scripts/customer/stores/global'
const globalStore = useGlobalStore()
const enabled = computed(
()=>
localStorage.getItem('theme') === 'dark' ||
document.documentElement.classList.contains('dark')
)
globalStore.isDarkModeOn = enabled.value
function onChange() {
globalStore.isDarkModeOn = !globalStore.isDarkModeOn
@ -35,6 +43,7 @@ function onChange() {
localStorage.theme = 'light'
document.documentElement.classList.remove('dark')
document.documentElement.style.setProperty('color-scheme', 'light')
}
}
</script>

View File

@ -16,21 +16,26 @@ defineProps({
const globalStore = useGlobalStore()
const enabled = computed({
get: () => globalStore.isDarkModeOn,
set: (value) => {
if (value) {
localStorage.theme = 'dark'
document.documentElement.classList.add('dark')
document.documentElement.style.setProperty('color-scheme', 'dark')
} else {
localStorage.theme = 'light'
document.documentElement.classList.remove('dark')
document.documentElement.style.setProperty('color-scheme', 'light')
}
globalStore.isDarkModeOn = value
},
})
const enabled = ref(
localStorage.getItem('theme') === 'dark' ||
document.documentElement.classList.contains('dark')
)
globalStore.isDarkModeOn = enabled
function onChange(val) {
if (val) {
localStorage.theme = 'dark'
document.documentElement.classList.add('dark')
document.documentElement.style.setProperty('color-scheme', 'dark')
globalStore.isDarkModeOn = true
} else {
localStorage.theme = 'light'
document.documentElement.classList.remove('dark')
document.documentElement.style.setProperty('color-scheme', 'light')
globalStore.isDarkModeOn = false
}
}
</script>
<template>
@ -44,6 +49,7 @@ const enabled = computed({
v-model="enabled"
class="relative inline-flex flex-shrink-0 h-6 w-11 border-2 border-transparent rounded-full cursor-pointer transition-colors ease-in-out duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500 dark:ring-offset-gray-700"
:class="[enabled ? 'bg-primary-600' : 'bg-gray-200']"
@update:modelValue="onChange"
>
<span class="sr-only">Use setting</span>
<span

View File

@ -14,7 +14,7 @@ export const useGlobalStore = defineStore({
companySlug: '',
mainMenu: null,
enabledModules: [],
isDarkModeOn: localStorage.getItem('theme') === 'dark' || document.documentElement.classList.contains('dark')
isDarkModeOn: false
}),
actions: {