From fe61a54c3580d0c57c90cd9634ec5afd7f9df892 Mon Sep 17 00:00:00 2001 From: Gregor Vostrak Date: Tue, 16 Apr 2024 16:28:37 +0200 Subject: [PATCH] fix billable toggle on time tracker, add billable toggle on time entries row --- e2e/profile.spec.ts | 5 +++- e2e/timetracker.spec.ts | 2 ++ .../Common/BillableToggleButton.vue | 29 +++++++++++++++++-- .../js/Components/Common/Tag/TagDropdown.vue | 2 +- .../Common/TimeEntry/TimeEntryRow.vue | 10 +++++++ .../TimeTracker/TimeTrackerTagDropdown.vue | 4 +-- resources/js/Components/TimeTracker.vue | 6 +++- .../Teams/Partials/UpdateTeamNameForm.vue | 2 +- 8 files changed, 52 insertions(+), 8 deletions(-) diff --git a/e2e/profile.spec.ts b/e2e/profile.spec.ts index 2f66648f..dc0fd707 100644 --- a/e2e/profile.spec.ts +++ b/e2e/profile.spec.ts @@ -4,7 +4,10 @@ import { PLAYWRIGHT_BASE_URL } from '../playwright/config'; test('test that user name can be updated', async ({ page }) => { await page.goto(PLAYWRIGHT_BASE_URL + '/user/profile'); await page.getByLabel('Name').fill('NEW NAME'); - await page.getByRole('button', { name: 'Save' }).first().click(); + await Promise.all([ + page.getByRole('button', { name: 'Save' }).first().click(), + page.waitForResponse('**/user/profile-information'), + ]); await page.reload(); await expect(page.getByLabel('Name')).toHaveValue('NEW NAME'); }); diff --git a/e2e/timetracker.spec.ts b/e2e/timetracker.spec.ts index 77276a1f..fbb11494 100644 --- a/e2e/timetracker.spec.ts +++ b/e2e/timetracker.spec.ts @@ -276,3 +276,5 @@ test('test that adding a new tag when the timer is running', async ({ // test that sidebar timetracker starts and stops timer // test that sidebar timetracker changes state when tmer on dashboard is started + +// test billable toggle diff --git a/resources/js/Components/Common/BillableToggleButton.vue b/resources/js/Components/Common/BillableToggleButton.vue index e6378fb9..b284b49c 100644 --- a/resources/js/Components/Common/BillableToggleButton.vue +++ b/resources/js/Components/Common/BillableToggleButton.vue @@ -2,10 +2,21 @@ import { computed } from 'vue'; import { twMerge } from 'tailwind-merge'; const active = defineModel({ default: false }); +const emit = defineEmits(['changed']); function toggleBillable() { active.value = !active.value; + emit('changed', active.value); } +const props = withDefaults( + defineProps<{ + size: 'small' | 'base'; + }>(), + { + size: 'base', + } +); + const iconColorClasses = computed(() => { if (active.value) { return 'text-accent-200/80 focus:text-accent-200 hover:text-accent-200'; @@ -13,6 +24,19 @@ const iconColorClasses = computed(() => { return 'text-icon-default focus:text-icon-active hover:text-icon-active'; } }); + +const iconSizeClasses = computed(() => { + if (props.size === 'small') { + return 'w-5 h-5'; + } else { + return 'w-5 sm:w-6 h-5 sm:h-6'; + } +}); + +const iconSizeWrapperClasses = + props.size === 'small' + ? 'w-6 sm:w-8 h-6 sm:h-8' + : 'w-7 sm:w-10 h-7 sm:h-10';