From 892ca87fe1b62515309a7ef7cc54cc8e02428fb9 Mon Sep 17 00:00:00 2001 From: 18alantom <2.alan.tom@gmail.com> Date: Fri, 4 Nov 2022 13:59:24 +0530 Subject: [PATCH 01/11] feat: hideable sidebar --- src/components/PageHeader.vue | 37 ++++++++++++++++++++- src/components/Sidebar.vue | 28 +++++++++++++--- src/pages/Desk.vue | 61 ++++++++++++++++++++++++++++++++--- src/styles/index.css | 1 + 4 files changed, 117 insertions(+), 10 deletions(-) diff --git a/src/components/PageHeader.vue b/src/components/PageHeader.vue index 130ffa11..f343ac72 100644 --- a/src/components/PageHeader.vue +++ b/src/components/PageHeader.vue @@ -6,6 +6,13 @@ platform !== 'Windows' ? 'window-drag' : '', ]" > + +
+

{{ title }}

@@ -18,10 +25,12 @@
+ diff --git a/src/components/Sidebar.vue b/src/components/Sidebar.vue index a223465a..743f5193 100644 --- a/src/components/Sidebar.vue +++ b/src/components/Sidebar.vue @@ -1,6 +1,6 @@ + + diff --git a/src/styles/index.css b/src/styles/index.css index 4dfb2c28..dc07c494 100644 --- a/src/styles/index.css +++ b/src/styles/index.css @@ -64,6 +64,7 @@ input[type='number']::-webkit-inner-spin-button { --w-desk-fixed: calc(var(--w-app) - var(--w-sidebar)); --w-quick-edit: 22rem; --w-scrollbar: 0.6rem; + --w-trafficlights: 72px; /* Row Heights */ --h-row-smallest: 2rem; From 88f601511d03ec16a2c619c5832ed9855c106a99 Mon Sep 17 00:00:00 2001 From: 18alantom <2.alan.tom@gmail.com> Date: Fri, 4 Nov 2022 19:38:29 +0530 Subject: [PATCH 02/11] fix(ui): transition on quick edit display --- src/components/Sidebar.vue | 2 +- src/pages/Desk.vue | 59 ++++++++++++++++++++++--------------- src/pages/QuickEditForm.vue | 2 +- src/utils/ui.ts | 2 +- 4 files changed, 38 insertions(+), 27 deletions(-) diff --git a/src/components/Sidebar.vue b/src/components/Sidebar.vue index 743f5193..2ef26155 100644 --- a/src/components/Sidebar.vue +++ b/src/components/Sidebar.vue @@ -150,7 +150,7 @@ " @click="$emit('toggle-sidebar')" > - + diff --git a/src/pages/Desk.vue b/src/pages/Desk.vue index 80e8eba4..4f5707fa 100644 --- a/src/pages/Desk.vue +++ b/src/pages/Desk.vue @@ -3,8 +3,7 @@ @@ -17,17 +16,18 @@ -
- + + - +
+ +
-
-
+
+ @@ -43,18 +43,17 @@ p-1 m-4 opacity-0 - hover:opacity-100 - hover:shadow-md + hover:opacity-100 hover:shadow-md " @click="sidebar = !sidebar" > - + @@ -83,12 +73,14 @@ export default { .sidebar-enter-from, .sidebar-leave-to { opacity: 0; + transform: translateX(calc(-1 * var(--w-sidebar))); width: 0px; } .sidebar-enter-to, .sidebar-leave-from { opacity: 1; + transform: translateX(0px); width: var(--w-sidebar); } @@ -96,4 +88,23 @@ export default { .sidebar-leave-active { transition: all 250ms ease-out; } + +.quickedit-enter-from, +.quickedit-leave-to { + transform: translateX(var(--w-quick-edit)); + width: 0px; + opacity: 0; +} + +.quickedit-enter-to, +.quickedit-leave-from { + transform: translateX(0px); + width: var(--w-quick-edit); + opacity: 1; +} + +.quickedit-enter-active, +.quickedit-leave-active { + transition: all 250ms ease-out; +} diff --git a/src/pages/QuickEditForm.vue b/src/pages/QuickEditForm.vue index 6fb4648c..e5a0ac5b 100644 --- a/src/pages/QuickEditForm.vue +++ b/src/pages/QuickEditForm.vue @@ -1,6 +1,6 @@ diff --git a/src/pages/Dashboard/Cashflow.vue b/src/pages/Dashboard/Cashflow.vue index 1632d12c..f62f16c6 100644 --- a/src/pages/Dashboard/Cashflow.vue +++ b/src/pages/Dashboard/Cashflow.vue @@ -20,7 +20,7 @@
@@ -51,23 +51,22 @@ import { formatXLabels, getYMax } from 'src/utils/chart'; import { uicolors } from 'src/utils/colors'; import { getDatesAndPeriodList } from 'src/utils/misc'; import { getMapFromList } from 'utils/'; -import PeriodSelector from './PeriodSelector'; +import DashboardChartBase from './BaseDashboardChart.vue'; +import PeriodSelector from './PeriodSelector.vue'; export default { name: 'Cashflow', + extends: DashboardChartBase, components: { PeriodSelector, LineChart, }, data: () => ({ - period: 'This Year', data: [], periodList: [], + periodOptions: ['This Year', 'This Quarter'], hasData: false, }), - watch: { - period: 'setData', - }, async activated() { await this.setData(); if (!this.hasData) { diff --git a/src/pages/Dashboard/Dashboard.vue b/src/pages/Dashboard/Dashboard.vue index 44bae392..0ea5b376 100644 --- a/src/pages/Dashboard/Dashboard.vue +++ b/src/pages/Dashboard/Dashboard.vue @@ -1,19 +1,61 @@ diff --git a/src/pages/Dashboard/Expenses.vue b/src/pages/Dashboard/Expenses.vue index 4f750536..7a4bdb1d 100644 --- a/src/pages/Dashboard/Expenses.vue +++ b/src/pages/Dashboard/Expenses.vue @@ -58,26 +58,22 @@ import { fyo } from 'src/initFyo'; import { uicolors } from 'src/utils/colors'; import { getDatesAndPeriodList } from 'src/utils/misc'; import DonutChart from '../../components/Charts/DonutChart.vue'; -import PeriodSelector from './PeriodSelector'; -import SectionHeader from './SectionHeader'; +import DashboardChartBase from './BaseDashboardChart.vue'; +import PeriodSelector from './PeriodSelector.vue'; +import SectionHeader from './SectionHeader.vue'; export default { name: 'Expenses', + extends: DashboardChartBase, components: { DonutChart, PeriodSelector, SectionHeader, }, data: () => ({ - period: 'This Year', active: null, expenses: [], }), - watch: { - period() { - this.setData(); - }, - }, activated() { this.setData(); }, diff --git a/src/pages/Dashboard/PeriodSelector.vue b/src/pages/Dashboard/PeriodSelector.vue index 3fbcd931..774f1035 100644 --- a/src/pages/Dashboard/PeriodSelector.vue +++ b/src/pages/Dashboard/PeriodSelector.vue @@ -13,7 +13,6 @@ text-sm flex focus:outline-none - text-gray-900 hover:text-gray-800 focus:text-gray-800 items-center @@ -22,6 +21,7 @@ leading-relaxed cursor-pointer " + :class="!value ? 'text-gray-600' : 'text-gray-900'" @click="toggleDropdown()" tabindex="0" @keydown.down="highlightItemDown" @@ -37,7 +37,7 @@ diff --git a/src/utils/misc.ts b/src/utils/misc.ts index 6680e088..4e06b252 100644 --- a/src/utils/misc.ts +++ b/src/utils/misc.ts @@ -7,10 +7,13 @@ import SetupWizardSchema from 'schemas/app/SetupWizard.json'; import { Schema } from 'schemas/types'; import { fyo } from 'src/initFyo'; import { QueryFilter } from 'utils/db/types'; +import { PeriodKey } from './types'; -export function getDatesAndPeriodList( - period: 'This Year' | 'This Quarter' | 'This Month' -): { periodList: DateTime[]; fromDate: DateTime; toDate: DateTime } { +export function getDatesAndPeriodList(period: PeriodKey): { + periodList: DateTime[]; + fromDate: DateTime; + toDate: DateTime; +} { const toDate: DateTime = DateTime.now().plus({ days: 1 }); let fromDate: DateTime; diff --git a/src/utils/types.ts b/src/utils/types.ts index 3ece3d1d..b1b1ba60 100644 --- a/src/utils/types.ts +++ b/src/utils/types.ts @@ -69,4 +69,5 @@ export interface ExportTableField { fields: ExportField[]; } -export type ExportFormat = 'csv' | 'json'; \ No newline at end of file +export type ExportFormat = 'csv' | 'json'; +export type PeriodKey = 'This Year' | 'This Quarter' | 'This Month' \ No newline at end of file