mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-08 08:12:17 +01:00
Compare commits
1 Commits
feature/br
...
feature/fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1e7de6022a |
@@ -17,7 +17,7 @@ import {
|
|||||||
TooltipComponent,
|
TooltipComponent,
|
||||||
} from 'echarts/components';
|
} from 'echarts/components';
|
||||||
import type { AggregatedTimeEntries, Organization } from '@/packages/api/src';
|
import type { AggregatedTimeEntries, Organization } from '@/packages/api/src';
|
||||||
import { useCssVar } from '@vueuse/core';
|
import { useCssVariable } from '@/utils/useCssVariable';
|
||||||
|
|
||||||
use([
|
use([
|
||||||
CanvasRenderer,
|
CanvasRenderer,
|
||||||
@@ -47,8 +47,10 @@ const xAxisLabels = computed(() => {
|
|||||||
formatDate(el.key ?? '', organization?.value?.date_format)
|
formatDate(el.key ?? '', organization?.value?.date_format)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
const accentColor = useCssVar('--theme-color-chart', null, { observe: true });
|
const accentColor = useCssVariable('--theme-color-chart');
|
||||||
const labelColor = useCssVar('--color-text-secondary', null, { observe: true });
|
const labelColor = useCssVariable('--color-text-secondary');
|
||||||
|
const markLineColor = useCssVariable('--color-border-secondary');
|
||||||
|
const splitLineColor = useCssVariable('--color-border-tertiary');
|
||||||
|
|
||||||
const seriesData = computed(() => {
|
const seriesData = computed(() => {
|
||||||
return props?.groupedData?.map((el) => {
|
return props?.groupedData?.map((el) => {
|
||||||
@@ -111,7 +113,7 @@ const option = computed(() => ({
|
|||||||
data: xAxisLabels.value,
|
data: xAxisLabels.value,
|
||||||
markLine: {
|
markLine: {
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
color: 'rgba(125,156,188,0.1)',
|
color: markLineColor.value,
|
||||||
type: 'dashed',
|
type: 'dashed',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -135,9 +137,13 @@ const option = computed(() => ({
|
|||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
type: 'value',
|
type: 'value',
|
||||||
|
axisLabel: {
|
||||||
|
color: labelColor.value,
|
||||||
|
fontFamily: 'Outfit, sans-serif',
|
||||||
|
},
|
||||||
splitLine: {
|
splitLine: {
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
color: 'rgba(125,156,188,0.2)', // Set desired color here
|
color: splitLineColor.value,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import {
|
|||||||
TooltipComponent,
|
TooltipComponent,
|
||||||
} from 'echarts/components';
|
} from 'echarts/components';
|
||||||
import { formatHumanReadableDuration } from '@/packages/ui/src/utils/time';
|
import { formatHumanReadableDuration } from '@/packages/ui/src/utils/time';
|
||||||
import { useCssVar } from '@vueuse/core';
|
import { useCssVariable } from '@/utils/useCssVariable';
|
||||||
import type { Organization } from '@/packages/api/src';
|
import type { Organization } from '@/packages/api/src';
|
||||||
|
|
||||||
use([
|
use([
|
||||||
@@ -36,7 +36,7 @@ type ReportingChartDataEntry = {
|
|||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
data: ReportingChartDataEntry | null;
|
data: ReportingChartDataEntry | null;
|
||||||
}>();
|
}>();
|
||||||
const labelColor = useCssVar('--color-text-secondary', null, { observe: true });
|
const labelColor = useCssVariable('--color-text-secondary');
|
||||||
|
|
||||||
const seriesData = computed(() => {
|
const seriesData = computed(() => {
|
||||||
return props.data?.map((el) => {
|
return props.data?.map((el) => {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import {
|
|||||||
formatHumanReadableDuration,
|
formatHumanReadableDuration,
|
||||||
getDayJsInstance,
|
getDayJsInstance,
|
||||||
} from '@/packages/ui/src/utils/time';
|
} from '@/packages/ui/src/utils/time';
|
||||||
import { useCssVar } from '@vueuse/core';
|
import { useCssVariable } from '@/utils/useCssVariable';
|
||||||
import { useQuery } from '@tanstack/vue-query';
|
import { useQuery } from '@tanstack/vue-query';
|
||||||
import { getCurrentOrganizationId } from '@/utils/useUser';
|
import { getCurrentOrganizationId } from '@/utils/useUser';
|
||||||
import { api, type Organization } from '@/packages/api/src';
|
import { api, type Organization } from '@/packages/api/src';
|
||||||
@@ -64,12 +64,9 @@ const max = computed(() => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const backgroundColor = useCssVar('--color-card-background', null, {
|
const backgroundColor = useCssVariable('--theme-color-card-background');
|
||||||
observe: true,
|
const itemBackgroundColor = useCssVariable('--color-bg-tertiary');
|
||||||
});
|
const borderColor = useCssVariable('--color-border');
|
||||||
const itemBackgroundColor = useCssVar('--color-bg-tertiary', null, {
|
|
||||||
observe: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
const option = computed(() => {
|
const option = computed(() => {
|
||||||
return {
|
return {
|
||||||
@@ -120,7 +117,7 @@ const option = computed(() => {
|
|||||||
[],
|
[],
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
borderRadius: 5,
|
borderRadius: 5,
|
||||||
borderColor: 'rgba(255,255,255,0.05)',
|
borderColor: borderColor.value,
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
},
|
},
|
||||||
tooltip: {
|
tooltip: {
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import VChart from 'vue-echarts';
|
import VChart from 'vue-echarts';
|
||||||
import { computed, ref } from 'vue';
|
import { computed } from 'vue';
|
||||||
import { useCssVar } from '@vueuse/core';
|
import { useCssVariable } from '@/utils/useCssVariable';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
history: number[];
|
history: number[];
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const accentColor = useCssVar('--theme-color-chart', null, { observe: true });
|
const accentColor = useCssVariable('--theme-color-chart');
|
||||||
|
const markLineColor = useCssVariable('--color-border-secondary');
|
||||||
|
|
||||||
const seriesData = computed(() => props.history.map((el) => {
|
const seriesData = computed(() => props.history.map((el) => {
|
||||||
return {
|
return {
|
||||||
@@ -22,7 +23,7 @@ const seriesData = computed(() => props.history.map((el) => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
}));
|
}));
|
||||||
const option = ref({
|
const option = computed(() => ({
|
||||||
grid: {
|
grid: {
|
||||||
top: 0,
|
top: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
@@ -35,7 +36,7 @@ const option = ref({
|
|||||||
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
|
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
|
||||||
markLine: {
|
markLine: {
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
color: 'rgba(125,156,188,0.1)',
|
color: markLineColor.value,
|
||||||
type: 'dashed',
|
type: 'dashed',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -66,11 +67,11 @@ const option = ref({
|
|||||||
},
|
},
|
||||||
series: [
|
series: [
|
||||||
{
|
{
|
||||||
data: seriesData,
|
data: seriesData.value,
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
}));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import {
|
|||||||
TooltipComponent,
|
TooltipComponent,
|
||||||
} from 'echarts/components';
|
} from 'echarts/components';
|
||||||
import { formatHumanReadableDuration } from '@/packages/ui/src/utils/time';
|
import { formatHumanReadableDuration } from '@/packages/ui/src/utils/time';
|
||||||
import { useCssVar } from "@vueuse/core";
|
import { useCssVariable } from '@/utils/useCssVariable';
|
||||||
import type { Organization } from "@/packages/api/src";
|
import type { Organization } from "@/packages/api/src";
|
||||||
|
|
||||||
use([
|
use([
|
||||||
@@ -24,7 +24,7 @@ use([
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
provide(THEME_KEY, 'dark');
|
provide(THEME_KEY, 'dark');
|
||||||
const labelColor = useCssVar('--color-text-secondary', null, { observe: true });
|
const labelColor = useCssVariable('--color-text-secondary');
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
weeklyProjectOverview: {
|
weeklyProjectOverview: {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import ProjectsChartCard from '@/Components/Dashboard/ProjectsChartCard.vue';
|
|||||||
import { formatHumanReadableDuration } from '@/packages/ui/src/utils/time';
|
import { formatHumanReadableDuration } from '@/packages/ui/src/utils/time';
|
||||||
import { formatCents } from '@/packages/ui/src/utils/money';
|
import { formatCents } from '@/packages/ui/src/utils/money';
|
||||||
import { getWeekStart } from '@/packages/ui/src/utils/settings';
|
import { getWeekStart } from '@/packages/ui/src/utils/settings';
|
||||||
import { useCssVar } from '@vueuse/core';
|
import { useCssVariable } from '@/utils/useCssVariable';
|
||||||
import { getOrganizationCurrencyString } from '@/utils/money';
|
import { getOrganizationCurrencyString } from '@/utils/money';
|
||||||
import { useQuery } from '@tanstack/vue-query';
|
import { useQuery } from '@tanstack/vue-query';
|
||||||
import { getCurrentOrganizationId } from '@/utils/useUser';
|
import { getCurrentOrganizationId } from '@/utils/useUser';
|
||||||
@@ -60,7 +60,7 @@ const weekdays = computed(() => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const accentColor = useCssVar('--theme-color-chart', null, { observe: true });
|
const accentColor = useCssVariable('--theme-color-chart');
|
||||||
|
|
||||||
// Get the organization ID using the utility function
|
// Get the organization ID using the utility function
|
||||||
const organizationId = computed(() => getCurrentOrganizationId());
|
const organizationId = computed(() => getCurrentOrganizationId());
|
||||||
@@ -176,10 +176,8 @@ const seriesData = computed(() => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const markLineColor = useCssVar('--color-border-secondary', null, {
|
const markLineColor = useCssVariable('--color-border-secondary');
|
||||||
observe: true,
|
const labelColor = useCssVariable('--color-text-secondary');
|
||||||
});
|
|
||||||
const labelColor = useCssVar('--color-text-secondary', null, { observe: true });
|
|
||||||
const option = computed(() => {
|
const option = computed(() => {
|
||||||
return {
|
return {
|
||||||
tooltip: {
|
tooltip: {
|
||||||
@@ -215,6 +213,10 @@ const option = computed(() => {
|
|||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
type: 'value',
|
type: 'value',
|
||||||
|
axisLabel: {
|
||||||
|
color: labelColor.value,
|
||||||
|
fontFamily: 'Outfit, sans-serif',
|
||||||
|
},
|
||||||
splitLine: {
|
splitLine: {
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
color: markLineColor.value,
|
color: markLineColor.value,
|
||||||
|
|||||||
@@ -3,13 +3,6 @@ import { computed, watch } from "vue";
|
|||||||
|
|
||||||
type themeOption = "system" | "light" | "dark";
|
type themeOption = "system" | "light" | "dark";
|
||||||
const themeSetting = useStorage<themeOption>("theme", "system");
|
const themeSetting = useStorage<themeOption>("theme", "system");
|
||||||
// reload page when themeSettingChanges
|
|
||||||
watch(
|
|
||||||
themeSetting,
|
|
||||||
() => {
|
|
||||||
location.reload();
|
|
||||||
}
|
|
||||||
)
|
|
||||||
const preferredColor = usePreferredColorScheme();
|
const preferredColor = usePreferredColorScheme();
|
||||||
const theme = computed(() => {
|
const theme = computed(() => {
|
||||||
if(themeSetting.value === "system"){
|
if(themeSetting.value === "system"){
|
||||||
|
|||||||
49
resources/js/utils/useCssVariable.ts
Normal file
49
resources/js/utils/useCssVariable.ts
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
import { ref, onMounted, onUnmounted } from 'vue'
|
||||||
|
|
||||||
|
export function useCssVariable(variableName: string) {
|
||||||
|
const value = ref('')
|
||||||
|
let observer: MutationObserver | null = null
|
||||||
|
let mediaQuery: MediaQueryList | null = null
|
||||||
|
|
||||||
|
const updateValue = () => {
|
||||||
|
const computedStyle = getComputedStyle(document.documentElement)
|
||||||
|
const cssValue = computedStyle.getPropertyValue(variableName).trim()
|
||||||
|
value.value = cssValue
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
// Initialize with current value
|
||||||
|
updateValue()
|
||||||
|
|
||||||
|
// Watch for class changes on document.documentElement (where theme classes are applied)
|
||||||
|
observer = new MutationObserver((mutations) => {
|
||||||
|
mutations.forEach((mutation) => {
|
||||||
|
if (mutation.type === 'attributes' && mutation.attributeName === 'class') {
|
||||||
|
updateValue()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
observer.observe(document.documentElement, {
|
||||||
|
attributes: true,
|
||||||
|
attributeFilter: ['class']
|
||||||
|
})
|
||||||
|
|
||||||
|
// Also watch for system color scheme changes
|
||||||
|
if (window.matchMedia) {
|
||||||
|
mediaQuery = window.matchMedia('(prefers-color-scheme: dark)')
|
||||||
|
mediaQuery.addEventListener('change', updateValue)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
if (observer) {
|
||||||
|
observer.disconnect()
|
||||||
|
}
|
||||||
|
if (mediaQuery) {
|
||||||
|
mediaQuery.removeEventListener('change', updateValue)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return value
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user