mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-10-17 02:03:16 +01:00
Compare commits
4 Commits
68a6b059e5
...
feature/fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
104d9ee3c2 | ||
|
|
c1e2ccb495 | ||
|
|
c1dce20902 | ||
|
|
45c7377802 |
@@ -1579,6 +1579,57 @@ test('test that project selection works in create modal', async ({ page, ctx })
|
|||||||
expect(createBody.data.project_id).not.toBeNull();
|
expect(createBody.data.project_id).not.toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('test that ctrl+enter submits the create modal after selecting a project via keyboard', async ({
|
||||||
|
page,
|
||||||
|
ctx,
|
||||||
|
}) => {
|
||||||
|
// Regression test for https://github.com/solidtime-io/solidtime/issues/1238
|
||||||
|
const projectName = 'Keyboard Submit Project ' + Math.floor(1 + Math.random() * 10000);
|
||||||
|
await createProjectViaApi(ctx, { name: projectName });
|
||||||
|
|
||||||
|
await goToTimeOverview(page);
|
||||||
|
|
||||||
|
await page.getByRole('button', { name: 'Time entry actions' }).click();
|
||||||
|
await page.getByRole('menuitem', { name: 'Manual time entry' }).click();
|
||||||
|
await expect(page.getByRole('dialog')).toBeVisible();
|
||||||
|
// The menu that opened the modal animates out and only then hands focus back to its
|
||||||
|
// own trigger.
|
||||||
|
await expect(page.locator('[role="menu"]')).toHaveCount(0);
|
||||||
|
|
||||||
|
// Fill the description, then move to the project dropdown and select a project purely via keyboard
|
||||||
|
const description = page.getByRole('dialog').getByRole('textbox', { name: 'Description' });
|
||||||
|
await description.fill('Keyboard submit test');
|
||||||
|
await description.press('Tab');
|
||||||
|
await expect(
|
||||||
|
page.getByRole('dialog').getByRole('button', { name: 'No Project' })
|
||||||
|
).toBeFocused();
|
||||||
|
await page.keyboard.press('Enter');
|
||||||
|
await page.getByTestId('client_dropdown_search').fill(projectName);
|
||||||
|
await expect(page.getByRole('option', { name: projectName })).toBeVisible();
|
||||||
|
await page.keyboard.press('Enter');
|
||||||
|
const projectTrigger = page.getByRole('dialog').getByRole('button', { name: projectName });
|
||||||
|
await expect(projectTrigger).toBeVisible();
|
||||||
|
// The trigger label updates on the next tick, but the dropdown keeps focus until its
|
||||||
|
// exit animation has finished and reka-ui hands focus back to the trigger.
|
||||||
|
await expect(projectTrigger).toBeFocused();
|
||||||
|
|
||||||
|
// Ctrl+Enter must submit even though focus is no longer on the description input
|
||||||
|
const [createResponse] = await Promise.all([
|
||||||
|
page.waitForResponse(
|
||||||
|
(response) => response.url().includes('/time-entries') && response.status() === 201
|
||||||
|
),
|
||||||
|
page.keyboard.press('Control+Enter'),
|
||||||
|
]);
|
||||||
|
const createBody = await createResponse.json();
|
||||||
|
expect(createBody.data.description).toBe('Keyboard submit test');
|
||||||
|
expect(createBody.data.project_id).not.toBeNull();
|
||||||
|
await expect(page.getByRole('dialog')).toBeHidden();
|
||||||
|
const newTimeEntry = page.locator('[data-testid="time_entry_row"]').first();
|
||||||
|
await expect(newTimeEntry.getByTestId('time_entry_description').first()).toHaveValue(
|
||||||
|
'Keyboard submit test'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
test('test that tag selection works in create modal', async ({ page }) => {
|
test('test that tag selection works in create modal', async ({ page }) => {
|
||||||
await goToTimeOverview(page);
|
await goToTimeOverview(page);
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,6 @@
|
|||||||
},
|
},
|
||||||
"Invoicing": {
|
"Invoicing": {
|
||||||
"repository": "solidtime-io/extension-invoicing",
|
"repository": "solidtime-io/extension-invoicing",
|
||||||
"ref": "v0.0.4"
|
"ref": "v0.0.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
4029
package-lock.json
generated
4029
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
28
package.json
28
package.json
@@ -26,13 +26,13 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/eslintrc": "^3.3.5",
|
"@eslint/eslintrc": "^3.3.5",
|
||||||
"@eslint/js": "^10.0.1",
|
"@eslint/js": "^9.39.4",
|
||||||
"@inertiajs/vue3": "^3.7.0",
|
"@inertiajs/vue3": "^2.3.23",
|
||||||
"@playwright/test": "^1.60.0",
|
"@playwright/test": "^1.60.0",
|
||||||
"@tailwindcss/forms": "^0.5.11",
|
"@tailwindcss/forms": "^0.5.11",
|
||||||
"@tailwindcss/typography": "^0.5.19",
|
"@tailwindcss/typography": "^0.5.19",
|
||||||
"@types/chroma-js": "^3.1.2",
|
"@types/chroma-js": "^3.1.2",
|
||||||
"@types/node": "^26.2.0",
|
"@types/node": "^22.19.19",
|
||||||
"@vitejs/plugin-vue": "^6.0.6",
|
"@vitejs/plugin-vue": "^6.0.6",
|
||||||
"@vue/test-utils": "^2.4.6",
|
"@vue/test-utils": "^2.4.6",
|
||||||
"@vue/tsconfig": "^0.8.1",
|
"@vue/tsconfig": "^0.8.1",
|
||||||
@@ -40,14 +40,14 @@
|
|||||||
"axios": "^1.16.0",
|
"axios": "^1.16.0",
|
||||||
"eslint-plugin-unused-imports": "^4.4.1",
|
"eslint-plugin-unused-imports": "^4.4.1",
|
||||||
"happy-dom": "^20.8.9",
|
"happy-dom": "^20.8.9",
|
||||||
"laravel-vite-plugin": "^3.2.0",
|
"laravel-vite-plugin": "^2.1.0",
|
||||||
"openapi-zod-client": "^1.18.3",
|
"openapi-zod-client": "^1.18.3",
|
||||||
"postcss": "^8.5.14",
|
"postcss": "^8.5.14",
|
||||||
"postcss-import": "^17.0.0",
|
"postcss-import": "^15.1.0",
|
||||||
"postcss-nesting": "^14.0.1",
|
"postcss-nesting": "^12.1.5",
|
||||||
"tailwindcss": "^4.3.3",
|
"tailwindcss": "^3.4.19",
|
||||||
"typescript": "^7.0.2",
|
"typescript": "^5.9.3",
|
||||||
"vite": "^8.2.2",
|
"vite": "^7.3.3",
|
||||||
"vite-plugin-checker": "^0.12.0",
|
"vite-plugin-checker": "^0.12.0",
|
||||||
"vitest": "^4.1.4",
|
"vitest": "^4.1.4",
|
||||||
"vue": "^3.5.34",
|
"vue": "^3.5.34",
|
||||||
@@ -55,15 +55,15 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@floating-ui/core": "^1.7.5",
|
"@floating-ui/core": "^1.7.5",
|
||||||
"@floating-ui/vue": "^2.0.1",
|
"@floating-ui/vue": "^1.1.11",
|
||||||
"@heroicons/vue": "^2.2.0",
|
"@heroicons/vue": "^2.2.0",
|
||||||
"@lucide/vue": "^1.28.0",
|
"@lucide/vue": "^1.28.0",
|
||||||
"@rushstack/eslint-patch": "^1.16.1",
|
"@rushstack/eslint-patch": "^1.16.1",
|
||||||
"@tailwindcss/container-queries": "^0.1.1",
|
"@tailwindcss/container-queries": "^0.1.1",
|
||||||
"@tanstack/vue-form": "^1.32.0",
|
"@tanstack/vue-form": "^1.32.0",
|
||||||
"@tanstack/vue-query": "^5.100.10",
|
"@tanstack/vue-query": "^5.100.10",
|
||||||
"@tanstack/vue-query-devtools": "^6.1.42",
|
"@tanstack/vue-query-devtools": "^5.91.0",
|
||||||
"@tanstack/vue-table": "^9.1.2",
|
"@tanstack/vue-table": "^8.21.3",
|
||||||
"@tanstack/vue-virtual": "^3.13.24",
|
"@tanstack/vue-virtual": "^3.13.24",
|
||||||
"@vue/eslint-config-prettier": "^10.2.0",
|
"@vue/eslint-config-prettier": "^10.2.0",
|
||||||
"@vue/eslint-config-typescript": "^14.7.0",
|
"@vue/eslint-config-typescript": "^14.7.0",
|
||||||
@@ -77,10 +77,10 @@
|
|||||||
"echarts": "^6.0.0",
|
"echarts": "^6.0.0",
|
||||||
"focus-trap": "^8.2.0",
|
"focus-trap": "^8.2.0",
|
||||||
"parse-duration": "^2.1.6",
|
"parse-duration": "^2.1.6",
|
||||||
"pinia": "^4.0.3",
|
"pinia": "^3.0.4",
|
||||||
"radix-vue": "^1.9.17",
|
"radix-vue": "^1.9.17",
|
||||||
"reka-ui": "^2.10.1",
|
"reka-ui": "^2.10.1",
|
||||||
"tailwind-merge": "^3.6.0",
|
"tailwind-merge": "^2.6.1",
|
||||||
"tailwindcss-animate": "^1.0.7",
|
"tailwindcss-animate": "^1.0.7",
|
||||||
"vue-draggable-plus": "^0.6.1",
|
"vue-draggable-plus": "^0.6.1",
|
||||||
"vue-echarts": "^8.0.1",
|
"vue-echarts": "^8.0.1",
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ useFocus(clientNameInput, { initialValue: true });
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<DialogModal closeable :show="show" @close="show = false">
|
<DialogModal closeable :show="show" @close="show = false" @submit="submit">
|
||||||
<template #title>
|
<template #title>
|
||||||
<div class="flex space-x-2">
|
<div class="flex space-x-2">
|
||||||
<span> Create Client </span>
|
<span> Create Client </span>
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ useFocus(clientNameInput, { initialValue: true });
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<DialogModal closeable :show="show" @close="show = false">
|
<DialogModal closeable :show="show" @close="show = false" @submit="submit">
|
||||||
<template #title>
|
<template #title>
|
||||||
<div class="flex space-x-2">
|
<div class="flex space-x-2">
|
||||||
<span> Update Client </span>
|
<span> Update Client </span>
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ const roleDescription = computed(() => {
|
|||||||
v-model:show="showOwnershipTransferConfirmModal"
|
v-model:show="showOwnershipTransferConfirmModal"
|
||||||
:member-name="member.name"
|
:member-name="member.name"
|
||||||
@submit="submit"></MemberOwnershipTransferConfirmModal>
|
@submit="submit"></MemberOwnershipTransferConfirmModal>
|
||||||
<DialogModal closeable :show="show" @close="show = false">
|
<DialogModal closeable :show="show" @close="show = false" @submit="saveWithChecks()">
|
||||||
<template #title>
|
<template #title>
|
||||||
<div class="flex space-x-2">
|
<div class="flex space-x-2">
|
||||||
<span> Update Member </span>
|
<span> Update Member </span>
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ useFocus(clientNameInput, { initialValue: true });
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<DialogModal closeable :show="show" @close="show = false">
|
<DialogModal closeable :show="show" @close="show = false" @submit="submit">
|
||||||
<template #title>
|
<template #title>
|
||||||
<div class="flex space-x-2">
|
<div class="flex space-x-2">
|
||||||
<span> Invite Member </span>
|
<span> Invite Member </span>
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ async function submitBillableRate() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<DialogModal closeable :show="show" @close="show = false">
|
<DialogModal closeable :show="show" @close="show = false" @submit="submit">
|
||||||
<template #title>
|
<template #title>
|
||||||
<div class="flex space-x-2">
|
<div class="flex space-x-2">
|
||||||
<span> Edit Project {{ props.originalProject.name }} </span>
|
<span> Edit Project {{ props.originalProject.name }} </span>
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ useFocus(projectNameInput, { initialValue: true });
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<DialogModal closeable :show="show" @close="show = false">
|
<DialogModal closeable :show="show" @close="show = false" @submit="submit">
|
||||||
<template #title>
|
<template #title>
|
||||||
<div class="flex space-x-2">
|
<div class="flex space-x-2">
|
||||||
<span>Add Project Member</span>
|
<span>Add Project Member</span>
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ useFocus(projectNameInput, { initialValue: true });
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<DialogModal closeable :show="show" @close="show = false">
|
<DialogModal closeable :show="show" @close="show = false" @submit="submit">
|
||||||
<template #title>
|
<template #title>
|
||||||
<div class="flex space-x-2">
|
<div class="flex space-x-2">
|
||||||
<span>Edit Project Member</span>
|
<span>Edit Project Member</span>
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ async function submit() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<DialogModal closeable :show="show" @close="show = false">
|
<DialogModal closeable :show="show" @close="show = false" @submit="submit">
|
||||||
<template #title>
|
<template #title>
|
||||||
<div class="flex space-x-2">
|
<div class="flex space-x-2">
|
||||||
<span> Create Report </span>
|
<span> Create Report </span>
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ async function submit() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<DialogModal closeable :show="show" @close="show = false">
|
<DialogModal closeable :show="show" @close="show = false" @submit="submit">
|
||||||
<template #title>
|
<template #title>
|
||||||
<div class="flex space-x-2">
|
<div class="flex space-x-2">
|
||||||
<span> Create Report </span>
|
<span> Create Report </span>
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ useFocus(tagNameInput, { initialValue: true });
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<DialogModal closeable :show="show" @close="show = false">
|
<DialogModal closeable :show="show" @close="show = false" @submit="submit">
|
||||||
<template #title>
|
<template #title>
|
||||||
<div class="flex space-x-2">
|
<div class="flex space-x-2">
|
||||||
<span> Update Tag </span>
|
<span> Update Tag </span>
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ useFocus(taskNameInput, { initialValue: true });
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<DialogModal closeable :show="show" @close="show = false">
|
<DialogModal closeable :show="show" @close="show = false" @submit="submit">
|
||||||
<template #title>
|
<template #title>
|
||||||
<div class="flex space-x-2">
|
<div class="flex space-x-2">
|
||||||
<span> Create Task </span>
|
<span> Create Task </span>
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ useFocus(taskNameInput, { initialValue: true });
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<DialogModal closeable :show="show" @close="show = false">
|
<DialogModal closeable :show="show" @close="show = false" @submit="submit">
|
||||||
<template #title>
|
<template #title>
|
||||||
<div class="flex space-x-2">
|
<div class="flex space-x-2">
|
||||||
<span> Update Task </span>
|
<span> Update Task </span>
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ async function submit() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<DialogModal closeable :show="show" @close="emit('cancel')">
|
<DialogModal closeable :show="show" @close="emit('cancel')" @submit="submit">
|
||||||
<template #title>
|
<template #title>
|
||||||
<div class="flex items-center space-x-2">
|
<div class="flex items-center space-x-2">
|
||||||
<Coffee class="w-5 h-5 text-text-secondary" />
|
<Coffee class="w-5 h-5 text-text-secondary" />
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
"author": "solidtime",
|
"author": "solidtime",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"vite-plugin-dts": "^5.0.3"
|
"vite-plugin-dts": "^4.5.4"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@zodios/core": "^10.9.6",
|
"@zodios/core": "^10.9.6",
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/chroma-js": "^3.1.2",
|
"@types/chroma-js": "^3.1.2",
|
||||||
"@zodios/core": "^10.9.6",
|
"@zodios/core": "^10.9.6",
|
||||||
"vite-plugin-dts": "^5.0.3",
|
"vite-plugin-dts": "^4.5.4",
|
||||||
"zod": "^3.25.76"
|
"zod": "^3.25.76"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import Modal from './Modal.vue';
|
import Modal from './Modal.vue';
|
||||||
|
|
||||||
const emit = defineEmits(['close']);
|
const emit = defineEmits(['close', 'submit']);
|
||||||
|
|
||||||
defineProps({
|
defineProps({
|
||||||
show: {
|
show: {
|
||||||
@@ -24,7 +24,12 @@ const close = () => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Modal :show="show" :max-width="maxWidth" :closeable="closeable" @close="close">
|
<Modal
|
||||||
|
:show="show"
|
||||||
|
:max-width="maxWidth"
|
||||||
|
:closeable="closeable"
|
||||||
|
@close="close"
|
||||||
|
@submit="emit('submit')">
|
||||||
<div class="px-4 lg:px-6 py-4">
|
<div class="px-4 lg:px-6 py-4">
|
||||||
<div class="text-lg font-medium text-text-primary" role="heading">
|
<div class="text-lg font-medium text-text-primary" role="heading">
|
||||||
<slot name="title" />
|
<slot name="title" />
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { Dialog, DialogContent, DialogFooter } from './dialog/index';
|
import { Dialog, DialogContent, DialogFooter } from './dialog/index';
|
||||||
import { computed } from 'vue';
|
import { computed, nextTick } from 'vue';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
show: {
|
show: {
|
||||||
@@ -17,7 +17,7 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['close']);
|
const emit = defineEmits(['close', 'submit']);
|
||||||
|
|
||||||
const close = () => {
|
const close = () => {
|
||||||
if (props.closeable) {
|
if (props.closeable) {
|
||||||
@@ -25,6 +25,25 @@ const close = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Ctrl+Enter (Cmd+Enter on macOS) submits the modal from any focused element inside it.
|
||||||
|
// Handled in the capture phase so child elements (buttons, dropdown triggers, inputs with
|
||||||
|
// their own Enter handlers) never see the keystroke and cannot open or double-submit.
|
||||||
|
async function onKeydownCapture(event: KeyboardEvent) {
|
||||||
|
if (event.key !== 'Enter' || !(event.ctrlKey || event.metaKey) || event.isComposing) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
// Inputs like the time and duration fields commit their value on blur, so blur first
|
||||||
|
// and let the resulting model updates settle before submitting.
|
||||||
|
const active = document.activeElement;
|
||||||
|
if (active instanceof HTMLElement) {
|
||||||
|
active.blur();
|
||||||
|
}
|
||||||
|
await nextTick();
|
||||||
|
emit('submit');
|
||||||
|
}
|
||||||
|
|
||||||
const maxWidthClass = computed(() => {
|
const maxWidthClass = computed(() => {
|
||||||
return {
|
return {
|
||||||
sm: 'sm:max-w-sm',
|
sm: 'sm:max-w-sm',
|
||||||
@@ -39,7 +58,7 @@ const maxWidthClass = computed(() => {
|
|||||||
<template>
|
<template>
|
||||||
<Dialog :open="show" @update:open="close">
|
<Dialog :open="show" @update:open="close">
|
||||||
<DialogContent :class="maxWidthClass">
|
<DialogContent :class="maxWidthClass">
|
||||||
<div class="min-w-0">
|
<div class="min-w-0" @keydown.capture="onKeydownCapture">
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ const currentClientName = computed(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<DialogModal closeable :show="show" @close="show = false">
|
<DialogModal closeable :show="show" @close="show = false" @submit="submit">
|
||||||
<template #title>
|
<template #title>
|
||||||
<div class="flex space-x-2">
|
<div class="flex space-x-2">
|
||||||
<span> Create Project </span>
|
<span> Create Project </span>
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ useFocus(tagNameInput, { initialValue: true });
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<DialogModal closeable :show="show" @close="show = false">
|
<DialogModal closeable :show="show" @close="show = false" @submit="submit">
|
||||||
<template #title>
|
<template #title>
|
||||||
<div class="flex space-x-2">
|
<div class="flex space-x-2">
|
||||||
<span> Create Tags </span>
|
<span> Create Tags </span>
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ async function submit() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<DialogModal closeable :show="show" @close="show = false">
|
<DialogModal closeable :show="show" @close="show = false" @submit="submit">
|
||||||
<template #title>
|
<template #title>
|
||||||
<div class="flex items-center space-x-2 text-amber-600 dark:text-amber-400">
|
<div class="flex items-center space-x-2 text-amber-600 dark:text-amber-400">
|
||||||
<Coffee class="w-5 h-5" />
|
<Coffee class="w-5 h-5" />
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ const billableProxy = computed({
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<DialogModal closeable :show="show" @close="show = false">
|
<DialogModal closeable :show="show" @close="show = false" @submit="submit">
|
||||||
<template #title>
|
<template #title>
|
||||||
<div class="flex space-x-2">
|
<div class="flex space-x-2">
|
||||||
<span> Create manual time entry </span>
|
<span> Create manual time entry </span>
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ const typeProxy = computed({
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<DialogModal closeable :show="show" @close="show = false">
|
<DialogModal closeable :show="show" @close="show = false" @submit="submit">
|
||||||
<template #title>
|
<template #title>
|
||||||
<div class="flex space-x-2">
|
<div class="flex space-x-2">
|
||||||
<span> Edit time entry </span>
|
<span> Edit time entry </span>
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import {
|
|||||||
} from '@/packages/api/src';
|
} from '@/packages/api/src';
|
||||||
import { Checkbox } from '@/packages/ui/src';
|
import { Checkbox } from '@/packages/ui/src';
|
||||||
import { TagIcon, ExclamationTriangleIcon } from '@heroicons/vue/20/solid';
|
import { TagIcon, ExclamationTriangleIcon } from '@heroicons/vue/20/solid';
|
||||||
|
import { XMarkIcon } from '@heroicons/vue/16/solid';
|
||||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '..';
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '..';
|
||||||
import { Button } from '@/packages/ui/src/Buttons';
|
import { Button } from '@/packages/ui/src/Buttons';
|
||||||
import TagDropdown from '@/packages/ui/src/Tag/TagDropdown.vue';
|
import TagDropdown from '@/packages/ui/src/Tag/TagDropdown.vue';
|
||||||
@@ -60,6 +61,13 @@ const projectId = ref<string | null>(null);
|
|||||||
const billable = ref<boolean | undefined>(undefined);
|
const billable = ref<boolean | undefined>(undefined);
|
||||||
const selectedTags = ref<string[]>([]);
|
const selectedTags = ref<string[]>([]);
|
||||||
|
|
||||||
|
// Clearing the project puts both fields back to "leave unchanged", the same state the form
|
||||||
|
// returns to after a successful submit.
|
||||||
|
function resetProject() {
|
||||||
|
projectId.value = null;
|
||||||
|
taskId.value = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
const timeEntryBillable = computed({
|
const timeEntryBillable = computed({
|
||||||
get: () => {
|
get: () => {
|
||||||
if (billable.value === undefined) {
|
if (billable.value === undefined) {
|
||||||
@@ -147,7 +155,7 @@ const showBreakWarning = computed(
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<DialogModal closeable :show="show" @close="show = false">
|
<DialogModal closeable :show="show" @close="show = false" @submit="submit">
|
||||||
<template #title>
|
<template #title>
|
||||||
<div class="flex space-x-2">
|
<div class="flex space-x-2">
|
||||||
<span> Update {{ timeEntries.length }} time entries </span>
|
<span> Update {{ timeEntries.length }} time entries </span>
|
||||||
@@ -182,42 +190,59 @@ const showBreakWarning = computed(
|
|||||||
</Field>
|
</Field>
|
||||||
<Field>
|
<Field>
|
||||||
<FieldLabel for="project">Project</FieldLabel>
|
<FieldLabel for="project">Project</FieldLabel>
|
||||||
<TimeTrackerProjectTaskDropdown
|
<div class="flex items-center gap-1 min-w-0">
|
||||||
v-model:project="projectId"
|
<!-- the dropdown declares its own `class` prop, which goes to the
|
||||||
v-model:task="taskId"
|
trigger button, so the growing has to happen on a wrapper -->
|
||||||
variant="input"
|
<div class="flex-1 min-w-0">
|
||||||
align="start"
|
<TimeTrackerProjectTaskDropdown
|
||||||
size="default"
|
v-model:project="projectId"
|
||||||
:clients
|
v-model:task="taskId"
|
||||||
:create-project
|
variant="input"
|
||||||
:create-client
|
align="start"
|
||||||
:currency="currency"
|
size="default"
|
||||||
:organization-billable-rate="organizationBillableRate"
|
:clients
|
||||||
:can-create-project
|
:create-project
|
||||||
empty-placeholder="Select project..."
|
:create-client
|
||||||
allow-reset
|
:currency="currency"
|
||||||
:enable-estimated-time
|
:organization-billable-rate="organizationBillableRate"
|
||||||
:projects="projects"
|
:can-create-project
|
||||||
:tasks="tasks"></TimeTrackerProjectTaskDropdown>
|
empty-placeholder="Select project..."
|
||||||
|
:enable-estimated-time
|
||||||
|
:projects="projects"
|
||||||
|
:tasks="tasks"></TimeTrackerProjectTaskDropdown>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
v-if="projectId !== null"
|
||||||
|
type="button"
|
||||||
|
data-testid="project_reset_button"
|
||||||
|
class="p-1 rounded hover:bg-quaternary text-text-tertiary hover:text-text-primary"
|
||||||
|
@click="resetProject">
|
||||||
|
<XMarkIcon class="w-4 h-4" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</Field>
|
</Field>
|
||||||
<Field>
|
<Field>
|
||||||
<FieldLabel>Tag</FieldLabel>
|
<FieldLabel>Tag</FieldLabel>
|
||||||
<div class="flex space-x-5">
|
<div class="flex items-center space-x-5">
|
||||||
<TagDropdown
|
<!-- the dropdown root is `min-w-0`, so as a flex item it would shrink
|
||||||
v-model="selectedTags"
|
below its trigger and let the button overflow into the checkbox -->
|
||||||
:create-tag
|
<div class="shrink-0">
|
||||||
:tags="tags"
|
<TagDropdown
|
||||||
:show-no-tag-option="false">
|
v-model="selectedTags"
|
||||||
<template #trigger>
|
:create-tag
|
||||||
<Button variant="input" :disabled="removeAllTags">
|
:tags="tags"
|
||||||
<TagIcon class="h-4 text-icon-default" />
|
:show-no-tag-option="false">
|
||||||
<span v-if="selectedTags.length > 0">
|
<template #trigger>
|
||||||
Set {{ selectedTags.length }} tags
|
<Button variant="input" :disabled="removeAllTags">
|
||||||
</span>
|
<TagIcon class="h-4 text-icon-default" />
|
||||||
<span v-else>Select Tags...</span>
|
<span v-if="selectedTags.length > 0">
|
||||||
</Button>
|
Set {{ selectedTags.length }} tags
|
||||||
</template>
|
</span>
|
||||||
</TagDropdown>
|
<span v-else>Select Tags...</span>
|
||||||
|
</Button>
|
||||||
|
</template>
|
||||||
|
</TagDropdown>
|
||||||
|
</div>
|
||||||
<Field orientation="horizontal">
|
<Field orientation="horizontal">
|
||||||
<Checkbox id="no_tags" v-model:checked="removeAllTags"></Checkbox>
|
<Checkbox id="no_tags" v-model:checked="removeAllTags"></Checkbox>
|
||||||
<FieldLabel for="no_tags">Remove all tags</FieldLabel>
|
<FieldLabel for="no_tags">Remove all tags</FieldLabel>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import type {
|
|||||||
Client,
|
Client,
|
||||||
} from '@/packages/api/src';
|
} from '@/packages/api/src';
|
||||||
|
|
||||||
import { PlusCircleIcon, MinusIcon, XMarkIcon } from '@heroicons/vue/16/solid';
|
import { PlusCircleIcon, MinusIcon } from '@heroicons/vue/16/solid';
|
||||||
import ProjectCreateModal from '@/packages/ui/src/Project/ProjectCreateModal.vue';
|
import ProjectCreateModal from '@/packages/ui/src/Project/ProjectCreateModal.vue';
|
||||||
import { twMerge } from 'tailwind-merge';
|
import { twMerge } from 'tailwind-merge';
|
||||||
import { Button } from '@/packages/ui/src/Buttons';
|
import { Button } from '@/packages/ui/src/Buttons';
|
||||||
@@ -58,7 +58,6 @@ const props = withDefaults(
|
|||||||
createClient: (client: CreateClientBody) => Promise<Client | undefined>;
|
createClient: (client: CreateClientBody) => Promise<Client | undefined>;
|
||||||
currency: string;
|
currency: string;
|
||||||
emptyPlaceholder?: string;
|
emptyPlaceholder?: string;
|
||||||
allowReset?: boolean;
|
|
||||||
noProjectValue?: string | null;
|
noProjectValue?: string | null;
|
||||||
enableEstimatedTime: boolean;
|
enableEstimatedTime: boolean;
|
||||||
organizationBillableRate: number | null;
|
organizationBillableRate: number | null;
|
||||||
@@ -70,7 +69,6 @@ const props = withDefaults(
|
|||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
emptyPlaceholder: 'No Project',
|
emptyPlaceholder: 'No Project',
|
||||||
allowReset: false,
|
|
||||||
noProjectValue: NO_PROJECT_ID,
|
noProjectValue: NO_PROJECT_ID,
|
||||||
variant: 'ghost',
|
variant: 'ghost',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
@@ -558,12 +556,6 @@ function selectProject(projectId: string) {
|
|||||||
emit('changed', project.value, task.value);
|
emit('changed', project.value, task.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetProject() {
|
|
||||||
project.value = null;
|
|
||||||
task.value = null;
|
|
||||||
emit('changed', project.value, task.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
const showCreateProject = ref(false);
|
const showCreateProject = ref(false);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -571,40 +563,28 @@ const showCreateProject = ref(false);
|
|||||||
<Dropdown v-model="open" :close-on-content-click="false" :align="props.align">
|
<Dropdown v-model="open" :close-on-content-click="false" :align="props.align">
|
||||||
<template #trigger>
|
<template #trigger>
|
||||||
<slot name="trigger">
|
<slot name="trigger">
|
||||||
<div class="flex items-center gap-1">
|
<Button
|
||||||
<Button
|
:variant="props.variant"
|
||||||
:variant="props.variant"
|
:size="props.size"
|
||||||
:size="props.size"
|
:class="twMerge('w-full justify-start overflow-hidden', props.class)">
|
||||||
:class="twMerge('w-full justify-start overflow-hidden', props.class)">
|
<div
|
||||||
<div
|
class="w-2.5 h-2.5 rounded-full shrink-0"
|
||||||
class="w-2.5 h-2.5 rounded-full shrink-0"
|
:style="{ backgroundColor: selectedProjectColor }"></div>
|
||||||
:style="{ backgroundColor: selectedProjectColor }"></div>
|
<span class="truncate shrink-[1] text-text-primary">{{
|
||||||
<span class="truncate shrink-[1] text-text-primary">{{
|
selectedProjectName
|
||||||
selectedProjectName
|
}}</span>
|
||||||
}}</span>
|
<template v-if="currentTask">
|
||||||
<template v-if="currentTask">
|
<ChevronRightIcon class="!size-3 text-text-primary shrink-0 -mx-1" />
|
||||||
<ChevronRightIcon class="!size-3 text-text-primary shrink-0 -mx-1" />
|
<span class="truncate shrink-[100]">{{ currentTask.name }}</span>
|
||||||
<span class="truncate shrink-[100]">{{ currentTask.name }}</span>
|
</template>
|
||||||
</template>
|
<template v-if="selectedClientName">
|
||||||
<template v-if="selectedClientName">
|
<span class="dark:text-text-tertiary text-text-quaternary shrink-0">•</span>
|
||||||
<span class="dark:text-text-tertiary text-text-quaternary shrink-0"
|
<span
|
||||||
>•</span
|
class="truncate shrink-[200] dark:text-text-tertiary text-text-quaternary"
|
||||||
>
|
>{{ selectedClientName }}</span
|
||||||
<span
|
>
|
||||||
class="truncate shrink-[200] dark:text-text-tertiary text-text-quaternary"
|
</template>
|
||||||
>{{ selectedClientName }}</span
|
</Button>
|
||||||
>
|
|
||||||
</template>
|
|
||||||
</Button>
|
|
||||||
<button
|
|
||||||
v-if="allowReset && project !== null"
|
|
||||||
type="button"
|
|
||||||
data-testid="project_reset_button"
|
|
||||||
class="p-1 rounded hover:bg-quaternary text-text-tertiary hover:text-text-primary"
|
|
||||||
@click.stop="resetProject">
|
|
||||||
<XMarkIcon class="w-4 h-4" />
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</slot>
|
</slot>
|
||||||
</template>
|
</template>
|
||||||
<template #content>
|
<template #content>
|
||||||
|
|||||||
Reference in New Issue
Block a user