Improve Time page responsiveness and compact tags, fixes #896

This commit is contained in:
Gregor Vostrak
2026-02-03 19:21:57 +01:00
parent 73c92fad47
commit bd2d57dfd1
14 changed files with 188 additions and 33 deletions

View File

@@ -114,7 +114,7 @@ function deleteSelected() {
:tags="tags" :tags="tags"
:currency="getOrganizationCurrencyString()" :currency="getOrganizationCurrencyString()"
:clients="clients" :clients="clients"
class="border-t border-default-background-separator" class="border-t border-default-background-separator hidden sm:block"
:update-time-entries=" :update-time-entries="
(args) => (args) =>
updateTimeEntries( updateTimeEntries(

View File

@@ -47,7 +47,7 @@ const tagClasses = computed(() => {
tagClasses, tagClasses,
badgeClasses[size], badgeClasses[size],
borderClasses, borderClasses,
'rounded transition inline-flex items-center font-medium text-text-primary disabled:text-text-quaternary outline-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring', 'rounded transition inline-flex items-center font-medium text-text-primary disabled:text-text-quaternary outline-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring min-w-0 overflow-hidden',
props.class props.class
) )
"> ">

View File

@@ -1,7 +1,7 @@
<script setup lang="ts"></script> <script setup lang="ts"></script>
<template> <template>
<div class="px-3 sm:px-4 lg:px-6 mx-auto"> <div class="px-2 sm:px-4 lg:px-6 mx-auto">
<slot></slot> <slot></slot>
</div> </div>
</template> </template>

View File

@@ -11,12 +11,14 @@ const props = withDefaults(
class?: string; class?: string;
color?: string; color?: string;
border?: boolean; border?: boolean;
showIcon?: boolean;
}>(), }>(),
{ {
size: 'base', size: 'base',
tag: 'div', tag: 'div',
color: 'var(--theme-color-icon-default)', color: 'var(--theme-color-icon-default)',
border: true, border: true,
showIcon: true,
} }
); );
@@ -28,7 +30,7 @@ const indicatorClasses = {
<template> <template>
<Badge :name :size :tag :class="props.class" :color :border> <Badge :name :size :tag :class="props.class" :color :border>
<TagIcon :class="twMerge(indicatorClasses[size])"></TagIcon> <TagIcon v-if="showIcon" :class="twMerge(indicatorClasses[size])"></TagIcon>
<span v-if="name"> <span v-if="name">
{{ name }} {{ name }}
</span> </span>

View File

@@ -23,9 +23,11 @@ const props = withDefaults(
tags: Tag[]; tags: Tag[];
createTag: (name: string) => Promise<Tag | undefined>; createTag: (name: string) => Promise<Tag | undefined>;
align?: 'center' | 'end' | 'start'; align?: 'center' | 'end' | 'start';
showNoTagOption?: boolean;
}>(), }>(),
{ {
align: 'start', align: 'start',
showNoTagOption: true,
} }
); );
@@ -55,6 +57,7 @@ const filteredTags = computed(() => {
}); });
const showNoTag = computed(() => { const showNoTag = computed(() => {
if (!props.showNoTagOption) return false;
const search = searchValue.value.toLowerCase().trim(); const search = searchValue.value.toLowerCase().trim();
if (!search) return true; if (!search) return true;
return NO_TAG_LABEL.toLowerCase().includes(search); return NO_TAG_LABEL.toLowerCase().includes(search);
@@ -101,7 +104,7 @@ const showCreateTagModal = ref(false);
<template #content> <template #content>
<ComboboxRoot <ComboboxRoot
v-model:search-term="searchValue" v-model:search-term="searchValue"
:open="open" :open="true"
class="p-2" class="p-2"
:filter-function="(val: string[]) => val"> :filter-function="(val: string[]) => val">
<ComboboxAnchor> <ComboboxAnchor>

View File

@@ -94,7 +94,8 @@ function onSelectChange(checked: boolean) {
data-testid="time_entry_row"> data-testid="time_entry_row">
<MainContainer class="min-w-0"> <MainContainer class="min-w-0">
<div class="@xl:flex py-2 items-center min-w-0 justify-between group"> <div class="@xl:flex py-2 items-center min-w-0 justify-between group">
<div class="flex space-x-3 items-center min-w-0"> <!-- Desktop layout -->
<div class="hidden @lg:flex space-x-3 items-center min-w-0">
<Checkbox <Checkbox
:checked=" :checked="
timeEntry.timeEntries.every((aggregateTimeEntry: TimeEntry) => timeEntry.timeEntries.every((aggregateTimeEntry: TimeEntry) =>
@@ -107,10 +108,11 @@ function onSelectChange(checked: boolean) {
{{ timeEntry?.timeEntries?.length }} {{ timeEntry?.timeEntries?.length }}
</GroupedItemsCountButton> </GroupedItemsCountButton>
<TimeEntryDescriptionInput <TimeEntryDescriptionInput
class="min-w-0 mr-4" class="min-w-0 mr-4 shrink"
:model-value="timeEntry.description" :model-value="timeEntry.description"
@changed="updateTimeEntryDescription"></TimeEntryDescriptionInput> @changed="updateTimeEntryDescription"></TimeEntryDescriptionInput>
<TimeTrackerProjectTaskDropdown <TimeTrackerProjectTaskDropdown
class="min-w-0 shrink"
:clients :clients
:create-project :create-project
:create-client :create-client
@@ -125,7 +127,8 @@ function onSelectChange(checked: boolean) {
@changed="updateProjectAndTask"></TimeTrackerProjectTaskDropdown> @changed="updateProjectAndTask"></TimeTrackerProjectTaskDropdown>
</div> </div>
</div> </div>
<div class="flex items-center font-medium space-x-1 @lg:space-x-2"> <div
class="hidden @lg:flex items-center font-medium space-x-1 @lg:space-x-2 shrink-0">
<TimeEntryRowTagDropdown <TimeEntryRowTagDropdown
:create-tag :create-tag
:tags="tags" :tags="tags"
@@ -180,6 +183,74 @@ function onSelectChange(checked: boolean) {
deleteTimeEntries(timeEntry?.timeEntries ?? []) deleteTimeEntries(timeEntry?.timeEntries ?? [])
"></TimeEntryMoreOptionsDropdown> "></TimeEntryMoreOptionsDropdown>
</div> </div>
<!-- Mobile layout -->
<div class="@lg:hidden">
<!-- First row: count + description + duration -->
<div class="flex items-center justify-between min-w-0">
<div class="flex items-center min-w-0 flex-1">
<GroupedItemsCountButton
:expanded="expanded"
@click="expanded = !expanded">
{{ timeEntry?.timeEntries?.length }}
</GroupedItemsCountButton>
<TimeEntryDescriptionInput
class="min-w-0 flex-1"
:model-value="timeEntry.description"
@changed="updateTimeEntryDescription"></TimeEntryDescriptionInput>
</div>
<button
class="text-text-primary min-w-[80px] px-1.5 py-1.5 bg-transparent text-right hover:bg-card-background rounded-lg border border-transparent hover:border-card-border text-sm font-medium focus-visible:outline-none focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:bg-tertiary"
@click="expanded = !expanded">
{{
formatHumanReadableDuration(
timeEntry.duration ?? 0,
organization?.interval_format,
organization?.number_format
)
}}
</button>
</div>
<!-- Second row: project/task - tags - billable - start - more -->
<div class="flex items-center justify-between mt-1">
<TimeTrackerProjectTaskDropdown
class="min-w-0"
:clients
:create-project
:create-client
:can-create-project
:projects="projects"
:tasks="tasks"
:show-badge-border="false"
:project="timeEntry.project_id"
:enable-estimated-time
:currency="currency"
:task="timeEntry.task_id"
@changed="updateProjectAndTask"></TimeTrackerProjectTaskDropdown>
<div class="flex items-center shrink-0">
<TimeEntryRowTagDropdown
:create-tag
:tags="tags"
:model-value="timeEntry.tags"
compact
@changed="updateTimeEntryTags"></TimeEntryRowTagDropdown>
<BillableToggleButton
:model-value="timeEntry.billable"
size="small"
@changed="updateTimeEntryBillable"></BillableToggleButton>
<TimeTrackerStartStop
:active="!!(timeEntry.start && !timeEntry.end)"
variant="secondary"
class="ml-2"
@changed="onStartStopClick(timeEntry)"></TimeTrackerStartStop>
<TimeEntryMoreOptionsDropdown
:show-edit="false"
:show-duplicate="false"
@delete="
deleteTimeEntries(timeEntry?.timeEntries ?? [])
"></TimeEntryMoreOptionsDropdown>
</div>
</div>
</div>
</div> </div>
</MainContainer> </MainContainer>
<div <div

View File

@@ -31,11 +31,11 @@ const displaysPlaceholder = computed(() => {
</script> </script>
<template> <template>
<div class="relative min-w-0 flex-1 text-ellipsis whitespace-nowrap overflow-hidden"> <div class="relative min-w-0 text-ellipsis whitespace-nowrap overflow-hidden">
<div class="relative text-sm font-medium min-w-0"> <div class="relative text-sm font-medium min-w-0">
<div <div
:class="[ :class="[
'opacity-0 h-4 text-sm whitespace-pre font-medium min-w-0 pl-3 pr-1', 'opacity-0 h-4 text-sm whitespace-pre font-medium min-w-0 pl-1.5 @lg:pl-3 pr-1',
{ 'min-w-[130px]': displaysPlaceholder }, { 'min-w-[130px]': displaysPlaceholder },
]"> ]">
{{ liveDataValue }} {{ liveDataValue }}
@@ -44,7 +44,7 @@ const displaysPlaceholder = computed(() => {
data-testid="time_entry_description" data-testid="time_entry_description"
:value="liveDataValue" :value="liveDataValue"
placeholder="Add a description" placeholder="Add a description"
class="absolute px-0 h-full min-w-0 pl-3 pr-1 left-0 top-0 w-full text-sm text-text-primary font-medium bg-transparent focus-visible:ring-0 rounded-lg border-0" class="absolute px-0 h-full min-w-0 pl-1.5 @lg:pl-3 pr-1 left-0 top-0 w-full text-sm text-text-primary font-medium bg-transparent focus-visible:ring-0 rounded-lg border-0"
@blur="onChange" @blur="onChange"
@input="onInput" @input="onInput"
@keydown.enter="onChange" /> @keydown.enter="onChange" />

View File

@@ -63,7 +63,7 @@ const showMassUpdateModal = ref(false);
:class=" :class="
twMerge( twMerge(
props.class, props.class,
'text-sm py-1.5 font-medium flex border-b border-border-primary items-center space-x-3' 'text-sm py-1.5 font-medium hidden sm:flex border-b border-border-primary items-center space-x-3'
) )
"> ">
<Checkbox <Checkbox

View File

@@ -113,14 +113,16 @@ async function handleDeleteTimeEntry() {
data-testid="time_entry_row"> data-testid="time_entry_row">
<MainContainer class="min-w-0"> <MainContainer class="min-w-0">
<div class="@xl:flex py-2 min-w-0 items-center justify-between group"> <div class="@xl:flex py-2 min-w-0 items-center justify-between group">
<div class="flex items-center min-w-0"> <!-- Desktop layout -->
<div class="hidden @lg:flex items-center min-w-0">
<Checkbox :checked="selected" @update:checked="onSelectChange" /> <Checkbox :checked="selected" @update:checked="onSelectChange" />
<div v-if="indent === true" class="w-10 h-7"></div> <div v-if="indent === true" class="w-10 h-7"></div>
<TimeEntryDescriptionInput <TimeEntryDescriptionInput
class="min-w-0 mr-4" class="min-w-0 mr-4 shrink"
:model-value="timeEntry.description" :model-value="timeEntry.description"
@changed="updateTimeEntryDescription"></TimeEntryDescriptionInput> @changed="updateTimeEntryDescription"></TimeEntryDescriptionInput>
<TimeTrackerProjectTaskDropdown <TimeTrackerProjectTaskDropdown
class="min-w-0 shrink"
:create-project :create-project
:create-client :create-client
:can-create-project :can-create-project
@@ -134,7 +136,8 @@ async function handleDeleteTimeEntry() {
:task="timeEntry.task_id" :task="timeEntry.task_id"
@changed="updateProjectAndTask"></TimeTrackerProjectTaskDropdown> @changed="updateProjectAndTask"></TimeTrackerProjectTaskDropdown>
</div> </div>
<div class="flex items-center font-medium space-x-1 @lg:space-x-2"> <div
class="hidden @lg:flex items-center font-medium space-x-1 @lg:space-x-2 shrink-0">
<div v-if="showMember && members" class="text-sm px-2"> <div v-if="showMember && members" class="text-sm px-2">
{{ memberName }} {{ memberName }}
</div> </div>
@@ -171,6 +174,58 @@ async function handleDeleteTimeEntry() {
@duplicate="duplicateTimeEntry" @duplicate="duplicateTimeEntry"
@delete="deleteTimeEntry"></TimeEntryMoreOptionsDropdown> @delete="deleteTimeEntry"></TimeEntryMoreOptionsDropdown>
</div> </div>
<!-- Mobile layout -->
<div class="@lg:hidden">
<!-- First row: description + duration -->
<div class="flex items-center justify-between min-w-0">
<TimeEntryDescriptionInput
class="min-w-0 flex-1"
:model-value="timeEntry.description"
@changed="updateTimeEntryDescription"></TimeEntryDescriptionInput>
<TimeEntryRowDurationInput
:start="timeEntry.start"
:end="timeEntry.end"
@changed="updateStartEndTime"></TimeEntryRowDurationInput>
</div>
<!-- Second row: project/task - tags - billable - start - more -->
<div class="flex items-center justify-between mt-1">
<TimeTrackerProjectTaskDropdown
class="min-w-0"
:create-project
:create-client
:can-create-project
:clients
:projects="projects"
:tasks="tasks"
:show-badge-border="false"
:project="timeEntry.project_id"
:currency="currency"
:enable-estimated-time
:task="timeEntry.task_id"
@changed="updateProjectAndTask"></TimeTrackerProjectTaskDropdown>
<div class="flex items-center shrink-0">
<TimeEntryRowTagDropdown
:create-tag
:tags="tags"
:model-value="timeEntry.tags"
compact
@changed="updateTimeEntryTags"></TimeEntryRowTagDropdown>
<BillableToggleButton
:model-value="timeEntry.billable"
size="small"
@changed="updateTimeEntryBillable"></BillableToggleButton>
<TimeTrackerStartStop
:active="!!(timeEntry.start && !timeEntry.end)"
variant="secondary"
class="ml-2"
@changed="onStartStopClick"></TimeTrackerStartStop>
<TimeEntryMoreOptionsDropdown
@edit="handleEdit"
@duplicate="duplicateTimeEntry"
@delete="deleteTimeEntry"></TimeEntryMoreOptionsDropdown>
</div>
</div>
</div>
</div> </div>
</MainContainer> </MainContainer>
</div> </div>

View File

@@ -36,8 +36,8 @@ function selectUnselectAll(value: boolean) {
class="bg-background dark:bg-secondary border-b border-border-primary py-1 text-xs @sm:text-sm"> class="bg-background dark:bg-secondary border-b border-border-primary py-1 text-xs @sm:text-sm">
<MainContainer> <MainContainer>
<div class="flex group justify-between items-center"> <div class="flex group justify-between items-center">
<div class="flex items-center space-x-2"> <div class="flex items-center @lg:space-x-2 pl-1.5 @lg:pl-0">
<div class="w-5"> <div class="w-5 hidden @lg:block">
<CalendarIcon <CalendarIcon
class="w-3 @sm:w-4 text-icon-default group-hover:hidden block"> class="w-3 @sm:w-4 text-icon-default group-hover:hidden block">
</CalendarIcon> </CalendarIcon>
@@ -50,11 +50,11 @@ function selectUnselectAll(value: boolean) {
<span class="font-medium text-text-secondary"> <span class="font-medium text-text-secondary">
{{ formatWeekday(date) }} {{ formatWeekday(date) }}
</span> </span>
<span class="text-text-tertiary"> <span class="text-text-tertiary ml-2">
{{ formatDate(date, organization?.date_format) }} {{ formatDate(date, organization?.date_format) }}
</span> </span>
</div> </div>
<div class="text-text-secondary pr-[87px] @lg:pr-[92px]"> <div class="text-text-secondary pr-2 @lg:pr-[92px]">
<span class="font-medium"> <span class="font-medium">
{{ {{
formatHumanReadableDuration( formatHumanReadableDuration(

View File

@@ -4,10 +4,16 @@ import { computed } from 'vue';
import TagBadge from '@/packages/ui/src/Tag/TagBadge.vue'; import TagBadge from '@/packages/ui/src/Tag/TagBadge.vue';
import type { Tag } from '@/packages/api/src'; import type { Tag } from '@/packages/api/src';
const props = defineProps<{ const props = withDefaults(
tags: Tag[]; defineProps<{
createTag: (name: string) => Promise<Tag | undefined>; tags: Tag[];
}>(); createTag: (name: string) => Promise<Tag | undefined>;
compact?: boolean;
}>(),
{
compact: false,
}
);
const emit = defineEmits<{ const emit = defineEmits<{
changed: [model: string[]]; changed: [model: string[]];
@@ -20,23 +26,41 @@ const model = defineModel<string[]>({
const timeEntryTags = computed<Tag[]>(() => { const timeEntryTags = computed<Tag[]>(() => {
return props.tags.filter((tag) => model.value.includes(tag.id)); return props.tags.filter((tag) => model.value.includes(tag.id));
}); });
const displayName = computed(() => {
if (props.compact && timeEntryTags.value.length > 0) {
const count = timeEntryTags.value.length;
return count === 1 ? '1 tag' : `${count} tags`;
}
if (timeEntryTags.value.length >= 3) {
const firstTag = timeEntryTags.value[0]?.name || '';
const remaining = timeEntryTags.value.length - 1;
return `${firstTag} + ${remaining} more`;
}
return timeEntryTags.value.map((tag: Tag) => tag.name).join(', ');
});
</script> </script>
<template> <template>
<TagDropdown <TagDropdown
v-model="model" v-model="model"
:tags="tags" :tags="tags"
align="end" align="end"
:show-no-tag-option="false"
:create-tag :create-tag
@changed="emit('changed', model)"> @changed="emit('changed', model)">
<template #trigger> <template #trigger>
<button <button
data-testid="time_entry_tag_dropdown" data-testid="time_entry_tag_dropdown"
class="opacity-50 group-hover:opacity-100 group/dropdown focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:opacity-100 transition focus:bg-card-background-separator hover:bg-card-background-separator rounded-full flex items-center justify-center"> :class="[
'group/dropdown focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:opacity-100 transition focus:bg-card-background-separator hover:bg-card-background-separator rounded-full flex items-center justify-center',
compact ? '' : 'opacity-50 group-hover:opacity-100',
]">
<TagBadge <TagBadge
:border="false" :border="false"
size="large" size="large"
class="border-0 sm:px-1.5 text-icon-default group-focus-within/dropdown:text-text-primary" :show-icon="!(compact && timeEntryTags.length > 0)"
:name="timeEntryTags.map((tag: Tag) => tag.name).join(', ')"></TagBadge> class="border-0 sm:px-1.5 text-icon-default group-focus-within/dropdown:text-text-primary whitespace-nowrap"
:name="displayName"></TagBadge>
</button> </button>
</template> </template>
</TagDropdown> </TagDropdown>

View File

@@ -222,7 +222,7 @@ useSelectEvents(
<div <div
v-if="showDropdown && filteredRecentlyTrackedTimeEntries.length > 0" v-if="showDropdown && filteredRecentlyTrackedTimeEntries.length > 0"
ref="floating" ref="floating"
class="z-50 w-[min(500px,100vw-2rem)]" class="z-50 w-[min(640px,100vw-2rem)]"
:style="floatingStyles"> :style="floatingStyles">
<div <div
class="rounded-lg w-full border border-card-border overflow-hidden shadow-dropdown bg-card-background"> class="rounded-lg w-full border border-card-border overflow-hidden shadow-dropdown bg-card-background">

View File

@@ -515,14 +515,14 @@ const showCreateProject = ref(false);
props.class props.class
) )
"> ">
<div class="flex items-center lg:space-x-1 min-w-0"> <div class="flex items-center lg:space-x-1 min-w-0 overflow-hidden">
<span class="whitespace-nowrap text-xs lg:text-sm"> <span class="text-xs lg:text-sm shrink-0">
{{ selectedProjectName }} {{ selectedProjectName }}
</span> </span>
<ChevronRightIcon <ChevronRightIcon
v-if="currentTask" v-if="currentTask"
class="w-4 lg:w-5 text-text-secondary shrink-0"></ChevronRightIcon> class="w-4 lg:w-5 text-text-secondary shrink-0"></ChevronRightIcon>
<div v-if="currentTask" class="min-w-0 shrink text-xs lg:text-sm truncate"> <div v-if="currentTask" class="min-w-0 text-xs lg:text-sm truncate shrink">
{{ currentTask.name }} {{ currentTask.name }}
</div> </div>
</div> </div>

View File

@@ -42,15 +42,15 @@ const task = computed(() => {
ref="projectDropdownTrigger" ref="projectDropdownTrigger"
:color="project?.color" :color="project?.color"
:name="project?.name" :name="project?.name"
class="shrink-0"> class="shrink min-w-0 max-w-[50%]">
<div v-if="project" class="flex items-center lg:space-x-1 min-w-0"> <div v-if="project" class="flex items-center lg:space-x-1 min-w-0">
<span class="whitespace-nowrap text-xs"> <span class="text-xs whitespace-nowrap shrink-0">
{{ project?.name }} {{ project?.name }}
</span> </span>
<ChevronRightIcon <ChevronRightIcon
v-if="task" v-if="task"
class="w-4 lg:w-5 text-text-secondary shrink-0"></ChevronRightIcon> class="w-4 lg:w-5 text-text-secondary shrink-0"></ChevronRightIcon>
<div v-if="task" class="min-w-0 shrink text-xs truncate"> <div v-if="task" class="min-w-0 text-xs truncate">
{{ task.name }} {{ task.name }}
</div> </div>
</div> </div>