Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: dark mode (improved) #1280

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/ISSUE_TEMPLATE/pull_request.md
@@ -0,0 +1,30 @@
## Description
<!--
Please check the following steps to submit your pull request. If you have any questions please read the contribution guide available at https://go.invoiceplane.com/contribguide or join the community forums or the Slack channel.
You can check items by changing `[ ]` to `[x]`.
If you can't check all checklist items please add `[WIP]` in front of your title.
Remove this first paragraph but please keep the following checklist even if it's incomplete.
-->

## Related Issue
<!--- Please make sure there's an accomanying issue in the issues list -->
<!--- Please try and link to an accompanying thread on the forums, if there is one -->

## Motivation and Context
<!--- Why would you like this change? Does it solve a provlem or is it an improvement? -->
<!--- If it fixes an open issue, please link to the issue here. -->

## Screenshots (if appropriate):

## Pull Request Checklist

* [ ] My code follows the code formatting guidelines.
* [ ] I have an issue ID for this pull request.
* [ ] I selected the corresponding branch.
* [ ] I have rebased my changes on top of the corresponding branch.

## Issue Type (Please check one or more)

* [ ] Bugfix
* [ ] Improvement of an existing Feature
* [ ] New Feature
15 changes: 9 additions & 6 deletions package.json
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 @@ -24,16 +24,17 @@
"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 +44,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
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
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
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>
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
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
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
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
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