Skip to content

Open source personal finance application

refactor: enhance theme handling and improve UI consistency

Ilya Komichev8cf67e8baafc
diff --git a/app/app.config.ts b/app/app.config.ts
index 5eec1715..e7cbe158 100644
--- a/app/app.config.ts
+++ b/app/app.config.ts
@@ -6,6 +6,20 @@ export default defineAppConfig({
},
},
ui: {
+ button: {
+ color: {
+ blue: {
+ outline: 'border border-accent-1 hover:border-accent-1 hover:bg-accent-1/10 text-accent-1/90',
+ solid: 'bg-accent-1 hover:bg-accent-1/80 text-icon-primary',
+ },
+ pink: {
+ outline: 'border border-accent-1 hover:border-accent-1 hover:bg-accent-1/10 text-accent-1/90',
+ solid: 'bg-accent-1 hover:bg-accent-1/80 text-icon-primary',
+ },
+ },
+ },
+ gray: 'cool',
+
popover: {
background: 'bg-item-5 min-w-64',
popper: {
@@ -14,6 +28,7 @@ export default defineAppConfig({
ring: '!ring-2 !ring-item-3',
trigger: 'w-full cursor-default',
},
- strategy: 'override',
+ primary: 'pink',
+ strategy: 'merge',
},
})
diff --git a/app/assets/css/theme.css b/app/assets/css/theme.css
index 8530e761..af86fe58 100644
--- a/app/assets/css/theme.css
+++ b/app/assets/css/theme.css
@@ -1,74 +1,9 @@
@import 'others.css';
-html {
- --hue: 220;
- --c-blue-1: hsl(220, 100%, 61%);
- --alert-1: #b81414;
-
- --expense-1: #f92134;
- --expense-line: oklch(0.37 0.09 20.05);
-
- --income-1: #2cad22;
- --income-line: oklch(55.43% 0.13485 122.48);
-}
-
-/*
- * Light Theme
-*/
-html {
- color-scheme: light;
-
- --text-1: 0 0 0;
- --text-2: 64 64 64;
- --text-3: 64 64 64;
- --text-4: 100 100 100;
- --text-5: 200 200 200;
-
- --text-icon-primary: theme('colors.neutral.50');
- --accent-1: 0 122 255;
- --item-5: 255 255 255;
-
- /* Item */
- --c-item-2: theme('colors.neutral.500');
- --c-item-3: #edeef0;
- --c-item-4: theme('colors.neutral.100');
- --c-item-base: theme('colors.neutral.600');
- --item-6: 237 239 240;
- --item-7: rgba(190, 190, 190, 1);
- --item-9: 250 250 250;
- --item-active: 216 216 220;
- --item-hover: #ebecef;
-
- /* Colors */
- --c-red-1: #b81414;
- --c-blue-3: #2c74ff;
- --c-income-1: rgba(44, 173, 34, 1);
-
- /* Backgrounds */
- --c-bg-10: rgba(230, 230, 230, 1);
- --c-bg-11: rgba(0, 0, 0, 0.04);
- --c-bg-12: rgba(100, 100, 100, 1);
- --c-bg-13: rgba(120, 120, 120, 1);
- --c-bg-14: rgba(0, 0, 0, 0.6);
-
- --c-font-1: #fafafa;
- --c-font-2: #505050;
- --c-font-3: #323232;
- --c-font-4: #6e6e6e;
- --c-font-5: #969696;
-
- /* Chart */
- --chart-bg: var(--c-item-4);
- --chart-label: var(--c-font-5);
- --chart-line: var(--item-hover);
- --chart-selected: var(--c-item-3);
- --chart-splitLine: var(--item-3);
- --chart-tooltip: theme('colors.neutral.800');
-}
-
/*
* Dark Theme
*/
+html.dark,
html.dark-pink,
html.dark-blue {
color-scheme: dark;
@@ -78,12 +13,10 @@ html.dark-blue {
--text-2: 160 160 160;
--text-3: 200 200 200;
--text-4: 130 130 130;
- --text-5: 90 90 90;
--text-icon-primary: theme('colors.neutral.50');
- --accent-1: 56 148 2451;
+ --accent-1: 219 39 119;
- /* Item */
--c-item-2: #a3a3a3;
--c-item-3: #232323;
--c-item-4: #1c1c1c;
@@ -93,42 +26,67 @@ html.dark-blue {
--item-7: #878787;
--item-9: 23 23 23;
--item-hover: #262626;
+ --overlay: #000000cc;
+}
- /* Colors */
- --c-red-1: #b81414;
- --c-blue-3: #2c74ff;
- --c-income-1: #2cad22;
+/*
+* Light Theme
+*/
+html.light,
+html.light-pink,
+html.light-blue {
+ color-scheme: light;
- /* Backgrounds */
- --c-bg-10: #dcdcdc;
- --c-bg-14: #000000cc;
+ --accent-1: 219 39 119;
+ --c-item-2: theme('colors.neutral.500');
+ --c-item-4: theme('colors.neutral.100');
+ --c-item-base: theme('colors.neutral.600');
+ --item-3: #f0edef;
+ --item-5: 255 255 255;
+ --item-6: 240 237 240;
+ --item-7: rgba(190, 190, 190, 1);
+ --c-item-3: #f0edf0;
+ --item-9: 250 250 250;
+ --item-active: 216 216 220;
+ --item-hover: #f3eff2;
+ --overlay: #00000099;
+ --text-1: 0 0 0;
+ --text-2: 80 80 80;
+ --text-3: 64 64 64;
+ --text-4: 100 100 100;
+ --text-icon-primary: theme('colors.neutral.50');
+}
- --c-font-1: #fafafa;
- --c-font-2: #dcdcdc;
- --c-font-3: #bebebe;
- --c-font-4: #969696;
- --c-font-5: #646464;
+/*
+ * Blue Theme
+*/
+html.light,
+html.light-blue {
+ --c-item-3: #f0edf0;
+ --item-6: 237 239 240;
+ --item-hover: #ebecef;
+}
- /* Chart */
- --chart-bg: var(--item-hover);
- --chart-label: var(--c-font-5);
- --chart-line: var(--item-hover);
- --chart-selected: var(--item-hover);
- --chart-splitLine: theme('colors.neutral.700');
- --chart-tooltip: theme('colors.neutral.400');
+html.light-blue,
+html.dark-blue {
+ --accent-1: 0 122 255;
}
/*
- * Pink Theme
+ Common
*/
-html.light-pink {
- --item-hover: #f3eff2;
- --item-3: #f0edef;
- --item-6: 240 237 240;
-}
+html {
+ --expense-1: #f92134;
+ --expense-2: oklch(0.37 0.09 20.05);
+ --income-1: #2cad22;
+ --income-2: oklch(55.43% 0.13485 122.48);
-html.light-pink,
-html.dark-pink {
- --accent-1: 219 39 119;
- --c-blue-1: #ff1493;
+ --text-alert-1: #b81414;
+
+ /* Chart */
+ --chart-label: rgb(var(--text-4));
+ --chart-line: var(--item-hover);
+ --chart-splitLine: rgb(var(--item-6));
+ --chart-tooltip: rgb(var(--text-2));
+ --chart-axisLabel: rgb(var(--text-1));
}
diff --git a/app/components/app/Copyright.vue b/app/components/app/Copyright.vue
index 38019be9..2113b89c 100644
--- a/app/components/app/Copyright.vue
+++ b/app/components/app/Copyright.vue
@@ -7,7 +7,7 @@ const { t } = useI18n()
<template>
<a
:class="getStyles('item', ['center3', 'link', 'rounded'])"
- class="px-5 py-2"
+ class="px-5 py-2 text-2"
href="https://ilko.me"
>
{{ t('madeBy.text') }}
diff --git a/app/components/app/theme/useTheme.ts b/app/components/app/theme/useTheme.ts
index a508688f..cd349f4a 100644
--- a/app/components/app/theme/useTheme.ts
+++ b/app/components/app/theme/useTheme.ts
@@ -13,15 +13,15 @@ export function useTheme() {
}, {
label: t('theme.dark-pink'),
value: 'dark-pink',
+ }, {
+ label: t('theme.dark-blue'),
+ value: 'dark-blue',
}, {
label: t('theme.light-pink'),
value: 'light-pink',
}, {
label: t('theme.light-blue'),
value: 'light-blue',
- }, {
- label: t('theme.dark-blue'),
- value: 'dark-blue',
}] as const
function setTheme(theme: Theme) {
diff --git a/app/components/bottomSheet/BottomSheet.vue b/app/components/bottomSheet/BottomSheet.vue
index 7064c190..cba56aa6 100644
--- a/app/components/bottomSheet/BottomSheet.vue
+++ b/app/components/bottomSheet/BottomSheet.vue
@@ -450,7 +450,7 @@ const wrapClasses = computed(() => ({
<div
:class="overflowClasses"
:style="overlayStyles"
- class="absolute inset-0 z-10 size-full bg-[var(--c-bg-14)]"
+ class="absolute inset-0 z-10 size-full bg-[var(--overlay)]"
@click="close()"
/>
diff --git a/app/components/categories/StatPage.vue b/app/components/categories/StatPage.vue
index f548e4cd..18db0bfb 100644
--- a/app/components/categories/StatPage.vue
+++ b/app/components/categories/StatPage.vue
@@ -2,7 +2,7 @@
import { useStorage } from '@vueuse/core'
import type { CategoryId } from '~/components/categories/types'
-import type { MoneyTypeSlugNew } from '~/components/stat/types'
+import type { StatTabSlug } from '~/components/stat/types'
import { useCategoriesStore } from '~/components/categories/useCategoriesStore'
import { useStatDate } from '~/components/date/useStatDate'
@@ -26,7 +26,7 @@ const categoryId = computed(() => route.params.id) as ComputedRef<CategoryId>
const category = ref(categoriesStore.items[categoryId.value])
const categoriesIdsOrParent = computed(() => categoriesStore.getChildsIdsOrParent(categoryId.value))
-const activeTab = useStorage<MoneyTypeSlugNew>(`${categoryId.value}-tab`, 'netIncome')
+const activeTab = useStorage<StatTabSlug>(`${categoryId.value}-tab`, 'netIncome')
const storageKey = computed(() => `${categoryId.value}-${activeTab.value}`)
const trnsIds = computed(() => {
diff --git a/app/components/categories/page/id/Index.vue b/app/components/categories/page/id/Index.vue
index 86fbc651..050ed3ff 100644
--- a/app/components/categories/page/id/Index.vue
+++ b/app/components/categories/page/id/Index.vue
@@ -2,7 +2,7 @@
import { useStorage } from '@vueuse/core'
import type { CategoryId } from '~/components/categories/types'
-import type { MoneyTypeSlugNew } from '~/components/stat/types'
+import type { StatTabSlug } from '~/components/stat/types'
import { useCategoriesStore } from '~/components/categories/useCategoriesStore'
import { useStatDate } from '~/components/date/useStatDate'
@@ -27,7 +27,7 @@ const category = computed(() => categoriesStore.items[categoryId.value])
const preCategoriesIds = computed(() => categoriesStore.getChildsIds(categoryId.value))
const categoriesIdsOrParent = computed(() => categoriesStore.getChildsIdsOrParent(categoryId.value))
-const activeTab = useStorage<MoneyTypeSlugNew>(`${categoryId.value}-tab`, 'netIncome')
+const activeTab = useStorage<StatTabSlug>(`${categoryId.value}-tab`, 'netIncome')
const storageKey = computed(() => `${categoryId.value}-${activeTab.value}`)
const trnsIds = computed(() => {
diff --git a/app/components/categories/useCategoriesStore.ts b/app/components/categories/useCategoriesStore.ts
index 6b5205e5..8e1b02c1 100644
--- a/app/components/categories/useCategoriesStore.ts
+++ b/app/components/categories/useCategoriesStore.ts
@@ -14,7 +14,7 @@ import { useUserStore } from '~/components/user/useUserStore'
const transfer: CategoryItem = {
childIds: [],
- color: 'var(--c-blue-1)',
+ color: 'rgb(var(--accent-1))',
icon: 'mdi:repeat',
name: 'Transfer',
order: 9999,
diff --git a/app/components/categories/utils.test.ts b/app/components/categories/utils.test.ts
index 30d6926c..fe28ad1d 100644
--- a/app/components/categories/utils.test.ts
+++ b/app/components/categories/utils.test.ts
@@ -24,19 +24,19 @@ export const mockCategories: Categories = {
parentId: 0,
},
transfer: {
- color: 'var(--c-blue-1)',
+ color: 'rgb(var(--accent-1))',
icon: 'mdi:repeat',
name: 'Transfer',
parentId: 0,
},
transfer2: {
- color: 'var(--c-blue-1)',
+ color: 'rgb(var(--accent-1))',
icon: 'mdi:repeat',
name: 'перевод',
parentId: 0,
},
transfer3: {
- color: 'var(--c-blue-1)',
+ color: 'rgb(var(--accent-1))',
icon: 'mdi:repeat',
name: 'transfer',
parentId: 0,
@@ -83,7 +83,7 @@ const mockCategories2: Categories = {
},
'transfer': {
childIds: [],
- color: 'var(--c-blue-1)',
+ color: 'rgb(var(--accent-1))',
icon: 'mdi:repeat',
name: 'Transfer',
order: 9999,
diff --git a/app/components/date/Picker.vue b/app/components/date/Picker.vue
index c37461f5..ba56cdb6 100644
--- a/app/components/date/Picker.vue
+++ b/app/components/date/Picker.vue
@@ -31,6 +31,10 @@ const attrs = {
}
const matchTheme = {
+ 'dark': {
+ color: 'pink',
+ isDark: true,
+ },
'dark-blue': {
color: 'blue',
isDark: true,
@@ -39,6 +43,10 @@ const matchTheme = {
color: 'pink',
isDark: true,
},
+ 'light': {
+ color: 'pink',
+ isDark: false,
+ },
'light-blue': {
color: 'blue',
isDark: false,
@@ -48,7 +56,7 @@ const matchTheme = {
isDark: false,
},
'system': {
- color: 'blue',
+ color: 'pink',
isDark: colorMode.value === 'dark',
},
}
@@ -81,7 +89,7 @@ html .vc-light {
--vc-nav-item-active-bg: theme('colors.accent.1');
--vc-nav-hover-bg: theme('colors.item.hover');
--vc-color: theme('colors.1');
- --vc-day-content-disabled-color: theme('colors.5');
+ --vc-day-content-disabled-color: theme('colors.1/.40');
--vc-weekday-color: theme('colors.2');
--vc-header-title-color: theme('colors.3');
--vc-popover-content-color: theme('colors.2');
diff --git a/app/components/layout/SidebarMenuItem.vue b/app/components/layout/SidebarMenuItem.vue
index 040d73b5..db3b4388 100644
--- a/app/components/layout/SidebarMenuItem.vue
+++ b/app/components/layout/SidebarMenuItem.vue
@@ -19,7 +19,7 @@ const { checkIsActive, onClick } = useMenuData()
:class="[
getStyles('item', ['center', 'link', 'minh2', 'rounded', 'padding1']),
{
- '!text-1': checkIsActive(props.menuId),
+ '!text-accent-1/90': checkIsActive(props.menuId),
'gap-3': props.isShowText,
},
]"
diff --git a/app/components/stat/Dashboard.vue b/app/components/stat/Dashboard.vue
index 6819f022..01103d24 100644
--- a/app/components/stat/Dashboard.vue
+++ b/app/components/stat/Dashboard.vue
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { useStorage } from '@vueuse/core'
-import type { MoneyTypeSlugNew } from '~/components/stat/types'
+import type { StatTabSlug } from '~/components/stat/types'
import { useStatDate } from '~/components/date/useStatDate'
import { useFilter } from '~/components/filter/useFilter'
@@ -15,7 +15,7 @@ const trnsStore = useTrnsStore()
const filter = useFilter()
provide('filter', filter)
-const activeTab = useStorage<MoneyTypeSlugNew>(`dashboard-tab`, 'netIncome')
+const activeTab = useStorage<StatTabSlug>(`dashboard-tab`, 'netIncome')
const storageKey = computed(() => `dashboard-${activeTab.value}`)
const trnsIds = computed(() => trnsStore.getStoreTrnsIds({
diff --git a/app/components/stat/Header.vue b/app/components/stat/Header.vue
index b30beead..e14063bc 100644
--- a/app/components/stat/Header.vue
+++ b/app/components/stat/Header.vue
@@ -1,7 +1,7 @@
<script setup lang="ts">
import type { Range } from '~/components/date/types'
import type { FilterProvider } from '~/components/filter/types'
-import type { MoneyTypeSlugNew, StatConfigModal } from '~/components/stat/types'
+import type { StatConfigModal, StatTabSlug } from '~/components/stat/types'
import type { StatConfigProvider } from '~/components/stat/useStatConfig'
import type { WalletId } from '~/components/wallets/types'
@@ -21,8 +21,8 @@ const props = defineProps<{
}
maxRange?: Range
menu?: {
- active: MoneyTypeSlugNew
- click: (id: MoneyTypeSlugNew) => void
+ active: StatTabSlug
+ click: (id: StatTabSlug) => void
}
}>()
diff --git a/app/components/stat/Item.vue b/app/components/stat/Item.vue
index 522a1df6..21ca6d17 100644
--- a/app/components/stat/Item.vue
+++ b/app/components/stat/Item.vue
@@ -5,7 +5,7 @@ import { differenceInDays, differenceInMonths, differenceInWeeks } from 'date-fn
import type { CategoryId } from '~/components/categories/types'
import type { Range, StatDateProvider } from '~/components/date/types'
import type { FilterProvider } from '~/components/filter/types'
-import type { ChartSeries, IntervalData, MoneyTypeSlugNew } from '~/components/stat/types'
+import type { ChartSeries, IntervalData, StatTabSlug } from '~/components/stat/types'
import type { StatConfigProvider } from '~/components/stat/useStatConfig'
import type { TrnId } from '~/components/trns/types'
import type { WalletId } from '~/components/wallets/types'
@@ -24,7 +24,7 @@ const props = defineProps<{
preCategoriesIds?: CategoryId[]
storageKey: string
trnsIds: TrnId[]
- type: MoneyTypeSlugNew
+ type: StatTabSlug
walletId?: WalletId
}>()
@@ -42,7 +42,7 @@ const { addMarkArea, createSeriesItem } = useStatChart()
const isShowTrns = ref(false)
const newBaseStorageKey = computed(() => `finapp-${statDate.params.value.intervalsBy}-${props.storageKey}-${JSON.stringify(filter?.categoriesIds?.value)}`)
-const selectedType = useStorage<MoneyTypeSlugNew>(`selectedType-${props.type}-${newBaseStorageKey.value}`, 'summary')
+const selectedType = useStorage<StatTabSlug>(`selectedType-${props.type}-${newBaseStorageKey.value}`, 'summary')
const selectedTypesMapping = computed(() => {
const typeMapping = {
@@ -142,11 +142,11 @@ const chart = {
hasIncome: rangeTrnsIds.value.some(id => trnsStore.items?.[id]?.type === 1),
}
- const typesToShow = props.type === 'netIncome'
+ const typesToShow = props.type === 'netIncome' || props.type === 'periods'
? [
...(transactionTypes.hasIncome ? ['income'] : []),
...(transactionTypes.hasExpense ? ['expense'] : []),
- ] as MoneyTypeSlugNew[]
+ ] as StatTabSlug[]
: [props.type]
const intervalTotals = intervalsChartData.map(g => g.total)
@@ -190,7 +190,7 @@ function onClickCategory(categoryId: CategoryId) {
}
}
-function onClickSumItem(type: MoneyTypeSlugNew) {
+function onClickSumItem(type: StatTabSlug) {
if (type === 'summary') {
isShowTrns.value = !isShowTrns.value
return
diff --git a/app/components/stat/ItemWrap.vue b/app/components/stat/ItemWrap.vue
index 936d694e..0bc816dc 100644
--- a/app/components/stat/ItemWrap.vue
+++ b/app/components/stat/ItemWrap.vue
@@ -1,14 +1,14 @@
<script setup lang="ts">
import type { CategoryId } from '~/components/categories/types'
import type { StatDateProvider } from '~/components/date/types'
-import type { MoneyTypeSlugNew } from '~/components/stat/types'
+import type { StatTabSlug } from '~/components/stat/types'
import type { TrnId } from '~/components/trns/types'
import type { WalletId } from '~/components/wallets/types'
import { useTrnsStore } from '~/components/trns/useTrnsStore'
const props = defineProps<{
- activeTab: MoneyTypeSlugNew
+ activeTab: StatTabSlug
hasChildren?: boolean
isOneCategory?: boolean
preCategoriesIds?: CategoryId[]
diff --git a/app/components/stat/Menu.vue b/app/components/stat/Menu.vue
index e46397a3..4c01a2f9 100644
--- a/app/components/stat/Menu.vue
+++ b/app/components/stat/Menu.vue
@@ -1,14 +1,14 @@
<script setup lang="ts">
import { useWindowSize } from '@vueuse/core'
-import type { MoneyTypeSlugNew } from '~/components/stat/types'
+import type { StatTabSlug } from '~/components/stat/types'
const props = defineProps<{
- active: MoneyTypeSlugNew
+ active: StatTabSlug
}>()
const emit = defineEmits<{
- click: [id: MoneyTypeSlugNew]
+ click: [id: StatTabSlug]
}>()
const { t } = useI18n()
@@ -16,21 +16,21 @@ const { width } = useWindowSize()
const menu = computed(() => {
const all: {
- id: MoneyTypeSlugNew
+ id: StatTabSlug
name: string | unknown
}[] = [{
id: 'netIncome',
name: t('money.netIncome'),
- }]
-
- all.push({
+ }, {
id: 'expense',
name: t('money.expense'),
- })
- all.push({
+ }, {
id: 'income',
name: t('money.income'),
- })
+ }, {
+ id: 'periods',
+ name: t('periods.menu'),
+ }]
if (width.value > 766) {
all.push({
@@ -42,7 +42,7 @@ const menu = computed(() => {
return all
})
-function onClickStatMenu(tabName: MoneyTypeSlugNew) {
+function onClickStatMenu(tabName: StatTabSlug) {
emit('click', tabName)
}
diff --git a/app/components/stat/categories/Section.vue b/app/components/stat/categories/Section.vue
index e43611f6..0d23318a 100644
--- a/app/components/stat/categories/Section.vue
+++ b/app/components/stat/categories/Section.vue
@@ -3,7 +3,7 @@ import { useStorage } from '@vueuse/core'
import defu from 'defu'
import type { Categories, CategoryId } from '~/components/categories/types'
-import type { CategoryWithData, MoneyTypeSlugNew } from '~/components/stat/types'
+import type { CategoryWithData, StatTabSlug } from '~/components/stat/types'
import type { StatConfigProvider } from '~/components/stat/useStatConfig'
import type { TrnId } from '~/components/trns/types'
@@ -15,7 +15,7 @@ const props = defineProps<{
preCategoriesIds?: CategoryId[]
selectedTrnsIds?: TrnId[]
storageKey: string
- type: MoneyTypeSlugNew
+ type: StatTabSlug
}>()
defineEmits<{
diff --git a/app/components/stat/chart/config.ts b/app/components/stat/chart/config.ts
index 777bc9b2..361071bd 100644
--- a/app/components/stat/chart/config.ts
+++ b/app/components/stat/chart/config.ts
@@ -1,18 +1,18 @@
import type { ChartType } from '~/components/stat/chart/types'
-import type { MoneyTypeSlugNew } from '~/components/stat/types'
+import type { StatTabSlug } from '~/components/stat/types'
import { getCompactAmount, getLocalAmount } from '~/components/stat/chart/utils'
-export const seriesOptions: Record<MoneyTypeSlugNew, { color: string, colorLine?: string, localeKey: string, type: ChartType }> = {
+export const seriesOptions: Record<StatTabSlug, { color: string, colorLine?: string, localeKey: string, type: ChartType }> = {
expense: {
color: 'var(--expense-1)',
- colorLine: 'var(--expense-line)',
+ colorLine: 'var(--expense-2)',
localeKey: 'money.expense',
type: 'bar',
},
income: {
color: 'var(--income-1)',
- colorLine: 'var(--income-line)',
+ colorLine: 'var(--income-2)',
localeKey: 'money.expense',
type: 'bar',
},
@@ -45,11 +45,10 @@ export const config = {
type: 'cross',
},
- backgroundColor: 'var(--chart-bg)',
+ backgroundColor: 'var(--chart-line)',
borderWidth: 0,
- // formatter: '{b0}: {c0}<br />{b1}: {c1}',
label: {
- backgroundColor: 'var(--chart-bg)',
+ backgroundColor: 'var(--chart-line)',
color: 'red',
},
padding: 8,
@@ -69,20 +68,17 @@ export const config = {
axisLine: {
lineStyle: {
color: 'var(--chart-splitLine)',
- // color: 'transparent',
},
},
axisPointer: {
- label: {},
+ label: {
+ color: 'var(--chart-axisLabel)',
+ },
},
axisTick: {
interval: 0,
- lineStyle: {
- // color: 'transparent',
- },
},
- // boundaryGap: false,
type: 'category',
},
@@ -93,15 +89,21 @@ export const config = {
formatter: n => getCompactAmount(n),
// show: false,
},
+
+ axisLine: {
+ lineStyle: {
+ color: 'var(--chart-splitLine)',
+ },
+ },
axisPointer: {
label: {
+ color: 'var(--chart-axisLabel)',
formatter: props => getLocalAmount(props?.value),
},
snap: true,
},
minInterval: 1,
- // position: 'left',
position: 'right',
splitLine: {
lineStyle: {
diff --git a/app/components/stat/chart/useStatChart.ts b/app/components/stat/chart/useStatChart.ts
index e5625d39..dae67d86 100644
--- a/app/components/stat/chart/useStatChart.ts
+++ b/app/components/stat/chart/useStatChart.ts
@@ -1,7 +1,7 @@
import type { TotalReturns } from '~/components/amount/getTotal'
import type { DateUTC } from '~/components/date/types'
import type { ChartType } from '~/components/stat/chart/types'
-import type { ChartSeries, MoneyTypeSlugNew } from '~/components/stat/types'
+import type { ChartSeries, StatTabSlug } from '~/components/stat/types'
import { seriesOptions } from '~/components/stat/chart/config'
import { markArea } from '~/components/stat/chart/utils'
@@ -19,7 +19,7 @@ export function useStatChart() {
value: 'line',
}])
- function createSeriesItem(typeItem: MoneyTypeSlugNew, data: TotalReturns[], average?: number | false): ChartSeries {
+ function createSeriesItem(typeItem: StatTabSlug, data: TotalReturns[], average?: number | false): ChartSeries {
let markLine = {}
if (average) {
markLine = {
diff --git a/app/components/stat/chart/utils.ts b/app/components/stat/chart/utils.ts
index 309411b3..a459f4c2 100644
--- a/app/components/stat/chart/utils.ts
+++ b/app/components/stat/chart/utils.ts
@@ -1,7 +1,7 @@
export function markArea(value: number) {
return {
data: [[{ xAxis: `${value}` }, { xAxis: `${value}` }]],
- itemStyle: { color: 'var(--chart-selected)', opacity: 1 },
+ itemStyle: { color: 'var(--chart-line)', opacity: 1 },
}
}
diff --git a/app/components/stat/sum/Item.vue b/app/components/stat/sum/Item.vue
index 9384e207..29113b3f 100644
--- a/app/components/stat/sum/Item.vue
+++ b/app/components/stat/sum/Item.vue
@@ -1,6 +1,6 @@
<script setup lang="ts">
import type { AmountProps } from '~/components/amount/Amount.vue'
-import type { MoneyTypeSlugNew } from '~/components/stat/types'
+import type { StatTabSlug } from '~/components/stat/types'
import { useCurrenciesStore } from '~/components/currencies/useCurrenciesStore'
@@ -11,7 +11,7 @@ const props = defineProps<{
currencyCode?: string
isActive?: boolean
isTotal?: boolean
- type: MoneyTypeSlugNew
+ type: StatTabSlug
}>()
const emit = defineEmits<{
diff --git a/app/components/stat/sum/Wrap.vue b/app/components/stat/sum/Wrap.vue
index 8d84005b..d4e7ce3d 100644
--- a/app/components/stat/sum/Wrap.vue
+++ b/app/components/stat/sum/Wrap.vue
@@ -1,6 +1,6 @@
<script setup lang="ts">
import type { TotalReturns } from '~/components/amount/getTotal'
-import type { MoneyTypeSlugNew } from '~/components/stat/types'
+import type { StatTabSlug } from '~/components/stat/types'
import { getStyles } from '~/components/ui/getStyles'
@@ -8,13 +8,13 @@ const props = defineProps<{
averageTotal?: Record<string, number>
isShowExpense: boolean
isShowIncome: boolean
- selectedType: MoneyTypeSlugNew
+ selectedType: StatTabSlug
total: TotalReturns
- type: MoneyTypeSlugNew
+ type: StatTabSlug
}>()
const emit = defineEmits<{
- click: [type: MoneyTypeSlugNew]
+ click: [type: StatTabSlug]
}>()
const classes = computed(() => {
@@ -27,7 +27,7 @@ const classes = computed(() => {
return getStyles('item', params)
})
-function onClick(type: MoneyTypeSlugNew) {
+function onClick(type: StatTabSlug) {
if (props.isShowIncome && props.isShowExpense) {
emit('click', type)
}
diff --git a/app/components/stat/trns/Section.vue b/app/components/stat/trns/Section.vue
index 1a1bb199..c0750c54 100644
--- a/app/components/stat/trns/Section.vue
+++ b/app/components/stat/trns/Section.vue
@@ -1,12 +1,12 @@
<script setup lang="ts">
-import type { MoneyTypeSlugNew } from '~/components/stat/types'
+import type { StatTabSlug } from '~/components/stat/types'
import type { TrnId } from '~/components/trns/types'
defineProps<{
isPeriodOneDay: boolean
selectedTrnsIds: TrnId[]
storageKey: string
- type: MoneyTypeSlugNew
+ type: StatTabSlug
}>()
</script>
diff --git a/app/components/stat/types.ts b/app/components/stat/types.ts
index fea54e1d..8328a6ee 100644
--- a/app/components/stat/types.ts
+++ b/app/components/stat/types.ts
@@ -5,7 +5,7 @@ import type { ChartType } from '~/components/stat/chart/types'
import type { TrnId } from '~/components/trns/types'
export type MoneyTypeSlug = 'expense' | 'income'
-export type MoneyTypeSlugNew = 'income' | 'expense' | 'netIncome' | 'summary'
+export type StatTabSlug = 'income' | 'expense' | 'netIncome' | 'summary' | 'periods'
export type MoneyTypeNumber = 0 | 1 | 3
export type TotalCategories = {
diff --git a/app/components/stat/utils.ts b/app/components/stat/utils.ts
index 8f3868d5..02ab753b 100644
--- a/app/components/stat/utils.ts
+++ b/app/components/stat/utils.ts
@@ -1,4 +1,4 @@
-import type { CategoryWithData, MoneyTypeSlugNew } from '~/components/stat/types'
+import type { CategoryWithData, StatTabSlug } from '~/components/stat/types'
export function sortCategoriesByAmount(a: CategoryWithData, b: CategoryWithData) {
if (!a || !b)
@@ -19,7 +19,7 @@ export function sortCategoriesByAmount(a: CategoryWithData, b: CategoryWithData)
return a.value > 0 ? -1 : 1
}
-export function getTypesMapping(slug: MoneyTypeSlugNew) {
+export function getTypesMapping(slug: StatTabSlug) {
const typeMapping = {
expense: [0, 2],
income: [1, 2],
diff --git a/app/components/ui/ButtonAccent.vue b/app/components/ui/ButtonAccent.vue
index a7fe9625..e36f9e74 100644
--- a/app/components/ui/ButtonAccent.vue
+++ b/app/components/ui/ButtonAccent.vue
@@ -12,14 +12,14 @@ const colorMode = useColorMode()
<template>
<UButton
- v-if="colorMode.preference === 'dark-pink' || colorMode.preference === 'light-pink'"
+ v-if="colorMode.preference === 'dark-blue' || colorMode.preference === 'light-blue'"
:loading="props.loading"
:size="props.size || 'lg'"
:ui="{ rounded: props.rounded ? 'rounded-full' : 'rounded-lg' }"
:variant="props.variant"
block
class="transition-all duration-150 ease-in-out"
- color="pink"
+ color="blue"
@click="emit('click')"
>
<slot />
@@ -33,7 +33,7 @@ const colorMode = useColorMode()
:variant="props.variant"
block
class="transition-all duration-150 ease-in-out"
- color="blue"
+ color="pink"
@click="emit('click')"
>
<slot />
diff --git a/app/components/wallets/page/id/Index.vue b/app/components/wallets/page/id/Index.vue
index d9a8179a..68cf0556 100644
--- a/app/components/wallets/page/id/Index.vue
+++ b/app/components/wallets/page/id/Index.vue
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { useStorage } from '@vueuse/core'
-import type { MoneyTypeSlugNew } from '~/components/stat/types'
+import type { StatTabSlug } from '~/components/stat/types'
import type { WalletId } from '~/components/wallets/types'
import { useStatDate } from '~/components/date/useStatDate'
@@ -26,7 +26,7 @@ provide('filter', filter)
const walletId = computed(() => route.params.id as WalletId)
const wallet = computed(() => walletsStore.items?.[walletId.value])
-const activeTab = useStorage<MoneyTypeSlugNew>(`${walletId.value}-tab`, 'netIncome')
+const activeTab = useStorage<StatTabSlug>(`${walletId.value}-tab`, 'netIncome')
const storageKey = computed(() => `${walletId.value}-${activeTab.value}`)
const trnsIds = computed(() => trnsStore.getStoreTrnsIds({
diff --git a/app/pages/dev.vue b/app/pages/dev.vue
index 7706fa98..abe5650f 100644
--- a/app/pages/dev.vue
+++ b/app/pages/dev.vue
@@ -1,7 +1,4 @@
<script lang="ts" setup>
-import { useCategoriesStore } from '~/components/categories/useCategoriesStore'
-
-const categoriesStore = useCategoriesStore()
</script>
<template>
@@ -42,7 +39,6 @@ const categoriesStore = useCategoriesStore()
<div class="size-20 bg-3" />
<div class="size-20 bg-2" />
<div class="size-20 bg-4" />
- <div class="size-20 bg-5" />
</div>
</div>
@@ -71,10 +67,25 @@ const categoriesStore = useCategoriesStore()
</div>
<div class="flex flex-wrap gap-0">
<div class="size-20 bg-income-1" />
+ <div class="size-20 bg-income-2" />
<div class="size-20 bg-expense-1" />
+ <div class="size-20 bg-expense-2" />
</div>
</div>
</div>
+
+ <div>
+ <h1 class="mb-2 border-b border-item-6 pb-1">
+ Chart
+ </h1>
+
+ <div class="flex flex-wrap">
+ <div class="size-20 bg-[var(--chart-line)]" />
+ <div class="size-20 bg-[var(--chart-splitLine)]" />
+ <div class="size-20 bg-[var(--chart-label)]" />
+ <div class="size-20 bg-[var(--chart-tooltip)]" />
+ </div>
+ </div>
</div>
</div>
@@ -238,37 +249,20 @@ const categoriesStore = useCategoriesStore()
<div class="grid gap-4">
<DatePicker
:value="new Date().getTime()"
+ :maxDate="new Date()"
mode="date"
/>
<DatePicker
:value="{
- end: new Date().getTime(),
+ end: new Date().getTime() - 1000 * 60 * 60 * 24 * 4,
start: new Date().getTime() - 1000 * 60 * 60 * 24 * 14,
}"
mode="range"
+ :maxDate="new Date()"
:rows="2"
/>
</div>
</div>
-
- <div>
- <h1 class="mb-2 border-b border-item-6 pb-1">
- StatCategoriesLine
- </h1>
-
- <!-- <StatCategoriesLine
- isShowParent
- :item="{
- id: categoriesStore.items[Object.keys(categoriesStore.items)[0]].id,
- name: 'test',
- trnsIds: [],
- value: 1,
- }"
- :biggestCatNumber="{ income: 1, expense: 1 }"
- :lineWidth="1"
- class="grow"
- /> -->
- </div>
</div>
</div>
</UiPage>
diff --git a/i18n/locales/en-US.js b/i18n/locales/en-US.js
index d9ffa0d1..783a81fd 100644
--- a/i18n/locales/en-US.js
+++ b/i18n/locales/en-US.js
@@ -174,9 +174,9 @@ export default {
locale: {
toggle: 'Toggle locale',
},
+
loginWithGithub: 'Login with Github',
loginWithGoogle: 'Login with Google',
-
money: {
all: 'Total',
also: 'Also',
@@ -224,6 +224,10 @@ export default {
wallets: 'Wallets',
},
+ periods: {
+ menu: 'Periods',
+ },
+
settings: {
app: 'Application',
caution: 'With caution',
@@ -285,7 +289,6 @@ export default {
title: 'Wallets',
},
},
- periods: 'Periods',
title: 'Dashboard',
},
diff --git a/i18n/locales/ru-RU.js b/i18n/locales/ru-RU.js
index f2188679..d4bf8de8 100644
--- a/i18n/locales/ru-RU.js
+++ b/i18n/locales/ru-RU.js
@@ -225,6 +225,10 @@ export default {
wallets: 'Кошельки',
},
+ periods: {
+ menu: 'Периоды',
+ },
+
settings: {
app: 'Приложение',
caution: 'C осторожностью',
@@ -289,7 +293,6 @@ export default {
},
},
empty: 'Статистики по выбранным параметрам нет :)',
- periods: 'Периоды',
title: 'Статистика',
},
diff --git a/nuxt.config.ts b/nuxt.config.ts
index 44439764..5a27cefd 100644
--- a/nuxt.config.ts
+++ b/nuxt.config.ts
@@ -33,6 +33,7 @@ export default defineNuxtConfig({
colorMode: {
classSuffix: '',
+ fallback: 'dark-pink',
preference: 'system',
},
@@ -210,11 +211,6 @@ export default defineNuxtConfig({
telemetry: false,
- ui: {
- gray: 'neutral',
- primary: 'blue',
- },
-
vuefire: {
auth: {
enabled: true,
diff --git a/tailwind.config.ts b/tailwind.config.ts
index e8760c6b..35f8104c 100644
--- a/tailwind.config.ts
+++ b/tailwind.config.ts
@@ -30,19 +30,20 @@ export default <Partial<Config>>{
'2': 'rgb(var(--text-2))',
'3': 'rgb(var(--text-3))',
'4': 'rgb(var(--text-4))',
- '5': 'rgb(var(--text-5))',
'accent': {
1: 'rgb(var(--accent-1))',
},
'alert': {
- 1: 'var(--alert-1)',
+ 1: 'var(--text-alert-1)',
},
'expense': {
1: 'var(--expense-1)',
+ 2: 'var(--expense-2)',
},
'icon-primary': 'var(--text-icon-primary)',
'income': {
1: 'var(--income-1)',
+ 2: 'var(--income-2)',
},
'item': {
2: 'var(--c-item-2)',