Skip to content
This repository has been archived by the owner on Oct 14, 2024. It is now read-only.

Commit

Permalink
crater-invoice-inc#227: Improved dark-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsdrost7 committed Jan 27, 2024
1 parent b681fba commit 683694b
Show file tree
Hide file tree
Showing 198 changed files with 3,682 additions and 3,022 deletions.
16 changes: 9 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build",
"build": "vite build --target=es2020",
"serve": "vite preview",
"test": "eslint ./resources/scripts --ext .js,.vue"
},
Expand All @@ -18,22 +18,22 @@
"eslint": "^7.27.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-vue": "^7.0.0-beta.4",
"laravel-vite": "^0.0.7",
"postcss": "^8.4.5",
"prettier": "^2.3.0",
"sass": "^1.32.12",
"tailwind-scrollbar": "^1.3.1",
"tailwindcss": "^3.0.6",
"vite": "^2.6.1"
"vite": "^2.5"
},
"dependencies": {
"@headlessui/vue": "^1.4.0",
"@headlessui/vue": "^1.5.0",
"@heroicons/vue": "^1.0.1",
"@popperjs/core": "^2.9.2",
"@stripe/stripe-js": "^1.21.2",
"@tailwindcss/line-clamp": "^0.3.0",
"@tiptap/core": "^2.0.0-beta.85",
"@tiptap/extension-text-align": "^2.0.0-beta.29",
"@tiptap/pm": "^2.0.0-beta.220",
"@tiptap/starter-kit": "^2.0.0-beta.81",
"@tiptap/vue-3": "^2.0.0-beta.38",
"@vuelidate/components": "^1.1.12",
Expand All @@ -43,16 +43,18 @@
"axios": "^0.19",
"chart.js": "^2.7.3",
"guid": "0.0.12",
"laravel-vite-plugin": "^0.0.1",
"lodash": "^4.17.13",
"maska": "^1.4.6",
"mini-svg-data-uri": "^1.3.3",
"moment": "^2.29.1",
"pinia": "^2.0.4",
"v-money3": "^3.13.5",
"v-calendar": "3.0.0-alpha.8",
"v-money3": "3.16.1",
"v-tooltip": "^4.0.0-alpha.1",
"vue": "^3.2.0-beta.5",
"vue": "^3.2",
"vue-flatpickr-component": "^9.0.3",
"vue-i18n": "^9.1.7",
"vue-i18n": "9.1",
"vue-router": "^4.0.8",
"vue3-colorpicker": "^1.0.5",
"vuedraggable": "^4.1.0"
Expand Down
2 changes: 2 additions & 0 deletions resources/scripts/admin/components/CopyInputField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
py-2
rounded-lg
bg-opacity-40 bg-gray-300
dark:bg-gray-700 dark:border-gray-600
whitespace-nowrap
flex-col
mt-1
Expand All @@ -19,6 +20,7 @@
text-sm
font-medium
text-black
dark:text-white
truncate
select-all select-color
"
Expand Down
17 changes: 15 additions & 2 deletions resources/scripts/admin/components/SelectNotePopup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@
max-w-full
left-0
top-3
bg-white
dark:border
dark:border-white/10
dark:text-white
dark:bg-gray-800
dark:shadow-glass
"
>
<div
Expand All @@ -53,7 +59,7 @@
ring-1 ring-black ring-opacity-5
"
>
<div class="relative grid bg-white">
<div class="relative grid bg-white dark:bg-gray-800">
<div class="relative p-4">
<BaseInput
v-model="textSearch"
Expand All @@ -66,7 +72,7 @@

<div
v-if="filteredNotes.length > 0"
class="relative flex flex-col overflow-auto list max-h-36"
class="relative flex flex-col overflow-auto list max-h-36 dark:border-white/10"
>
<div
v-for="(note, index) in filteredNotes"
Expand All @@ -79,6 +85,8 @@
cursor-pointer
hover:bg-gray-100 hover:cursor-pointer
last:border-b-0
dark:border-gray-600
dark:border-white/10 dark:hover:bg-gray-700/30
"
@click="selectNote(index, close)"
>
Expand All @@ -91,6 +99,7 @@
leading-tight
text-gray-700
cursor-pointer
dark:text-gray-400
"
>
{{ note.name }}
Expand Down Expand Up @@ -118,6 +127,10 @@
bg-gray-200
border-none
outline-none
dark:bg-gray-600/70
dark:backdrop-blur-xl
dark:shadow-glass
dark:hover:bg-gray-600/80
"
@click="openNoteModal"
>
Expand Down
37 changes: 33 additions & 4 deletions resources/scripts/admin/components/charts/LineChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,17 @@

<script setup>
import Chart from 'chart.js'
import { ref, reactive, computed, onMounted, watchEffect, inject } from 'vue'
import {
ref,
reactive,
computed,
onMounted,
watchEffect,
inject,
watch,
} from 'vue'
import { useCompanyStore } from '@/scripts/admin/stores/company'
import { useGlobalStore } from '@/scripts/admin/stores/global'
const utils = inject('utils')
Expand Down Expand Up @@ -44,9 +53,11 @@ const props = defineProps({
},
})
const isDarkModeOn = document.documentElement.classList.contains('dark')
let myLineChart = null
const graph = ref(null)
const companyStore = useCompanyStore()
const globalStore = useGlobalStore()
const defaultCurrency = computed(() => {
return companyStore.selectedCompanyCurrency
})
Expand All @@ -60,6 +71,14 @@ watchEffect(() => {
}
})
watch(
() => globalStore.isDarkModeOn,
() => {
myLineChart.reset()
updateColors()
}
)
onMounted(() => {
let context = graph.value.getContext('2d')
let options = reactive({
Expand All @@ -81,6 +100,8 @@ onMounted(() => {
},
})
const salesColor = globalStore.isDarkModeOn ? '#ffffff' : '#040405'
let data = reactive({
labels: props.labels,
datasets: [
Expand All @@ -89,16 +110,16 @@ onMounted(() => {
fill: false,
lineTension: 0.3,
backgroundColor: 'rgba(230, 254, 249)',
borderColor: '#040405',
borderColor: salesColor,
borderCapStyle: 'butt',
borderDash: [],
borderDashOffset: 0.0,
borderJoinStyle: 'miter',
pointBorderColor: '#040405',
pointBorderColor: salesColor,
pointBackgroundColor: '#fff',
pointBorderWidth: 1,
pointHoverRadius: 5,
pointHoverBackgroundColor: '#040405',
pointHoverBackgroundColor: salesColor,
pointHoverBorderColor: 'rgba(220,220,220,1)',
pointHoverBorderWidth: 2,
pointRadius: 4,
Expand Down Expand Up @@ -194,4 +215,12 @@ function update() {
lazy: true,
})
}
function updateColors() {
const newColor = globalStore.isDarkModeOn ? '#ffffff' : '#040405'
myLineChart.data.datasets[0].borderColor = newColor
myLineChart.data.datasets[0].pointBorderColor = newColor
myLineChart.data.datasets[0].pointHoverBackgroundColor = newColor
}
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,11 @@
</BaseInputGroup>
</template>
</ValidateEach>
<div
slot="footer"
class="
z-0
flex
justify-end
mt-4
pt-4
border-t border-gray-200 border-solid border-modal-bg
"
>
<BaseModalFooter>
<BaseButton :loading="isSaving" variant="primary" type="submit">
{{ $t('general.save') }}
</BaseButton>
</div>
</BaseModalFooter>
</form>
</BaseCard>
</template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function mergeExistingValues() {
if (props.isEdit) {
props.store[props.storeProp].fields.forEach((field) => {
const existingIndex = props.store[props.storeProp].customFields.findIndex(
(f) => f.id === field.custom_field_id
(f) => f.id == field.custom_field_id
)
if (existingIndex > -1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { computed } from 'vue'
const props = defineProps({
modelValue: {
type: String,
default: moment().format('YYYY-MM-DD hh:MM'),
default: moment().format('YYYY-MM-DD HH:mm'),
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,25 @@
<!-- edit customField -->
<BaseDropdownItem
v-if="userStore.hasAbilities(abilities.EDIT_CUSTOM_FIELDS)"
v-slot="slotProps"
@click="editCustomField(row.id)"
>
<BaseIcon
name="PencilIcon"
class="w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500"
:class="slotProps.class"
/>
{{ $t('general.edit') }}
</BaseDropdownItem>

<!-- delete customField -->
<BaseDropdownItem
v-if="userStore.hasAbilities(abilities.DELETE_CUSTOM_FIELDS)"
v-slot="slotProps"
@click="removeCustomField(row.id)"
>
<BaseIcon
name="TrashIcon"
class="w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500"
:class="slotProps.class"
/>
{{ $t('general.delete') }}
</BaseDropdownItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
v-if="userStore.hasAbilities(abilities.EDIT_CUSTOMER)"
:to="`/admin/customers/${row.id}/edit`"
>
<BaseDropdownItem>
<BaseDropdownItem v-slot="slotProps">
<BaseIcon
name="PencilIcon"
class="w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500"
:class="slotProps.class"
/>
{{ $t('general.edit') }}
</BaseDropdownItem>
Expand All @@ -29,10 +29,10 @@
"
:to="`customers/${row.id}/view`"
>
<BaseDropdownItem>
<BaseDropdownItem v-slot="slotProps">
<BaseIcon
name="EyeIcon"
class="w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500"
:class="slotProps.class"
/>
{{ $t('general.view') }}
</BaseDropdownItem>
Expand All @@ -41,11 +41,12 @@
<!-- Delete Customer -->
<BaseDropdownItem
v-if="userStore.hasAbilities(abilities.DELETE_CUSTOMER)"
v-slot="slotProps"
@click="removeCustomer(row.id)"
>
<BaseIcon
name="TrashIcon"
class="w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500"
:class="slotProps.class"
/>
{{ $t('general.delete') }}
</BaseDropdownItem>
Expand Down
Loading

0 comments on commit 683694b

Please sign in to comment.