Skip to content

Enhance UI/UX of time-tracker #3101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 45 commits into from
Jun 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
5664c09
feat(time-tracker): enhance UX with user task prioritization
Adinorio Jun 16, 2025
94f4b5f
feat: enhance time tracker UX with assignee filtering and persistence
Adinorio Jun 16, 2025
cf3cf84
fix(time-tracker): add missing files
Adinorio Jun 16, 2025
9a795a0
feat(time-tracker): added quick option for recent task
Adinorio Jun 16, 2025
615c614
fix(time-tracker): resolved issues and comments
Adinorio Jun 16, 2025
1873c3f
style: apply prettier formatting
Adinorio Jun 16, 2025
b50046d
style: apply prettier formatting for feat/time-tracker/ux-improvement…
vhpx Jun 16, 2025
882ca18
Merge branch 'main' into feat/time-tracker/ux-improvement-v2
Adinorio Jun 17, 2025
d273dbc
fix(time-tracker): inconsistent UI when switching users
Adinorio Jun 17, 2025
e5fbd0d
feat(time-tracker): new filter for session history status
Adinorio Jun 17, 2025
c025440
feat(time-tracker): enhance analytics and fix task assignment issues
Adinorio Jun 17, 2025
b3b7629
feat(time-tracker): better controls for tracking time
Adinorio Jun 17, 2025
0e855a8
chore(time-tracker): edit errors
Adinorio Jun 17, 2025
cfa2af4
refactor(time-tracker): fixing issues
Adinorio Jun 17, 2025
c5f785e
chore(time-tracker): fixing errors
Adinorio Jun 17, 2025
3cfb2f2
chore(time-tracker): fixing errors
Adinorio Jun 17, 2025
9813bd3
Merge branch 'main' into feat/time-tracker/ux-improvement-v2
Adinorio Jun 17, 2025
2319d4d
fix(time-tracker): better UI for dark mode
Adinorio Jun 17, 2025
88e0d14
Merge remote-tracking branch 'origin/feat/time-tracker/ux-improvement…
Adinorio Jun 17, 2025
ae75a26
Merge branch 'main' into feat/time-tracker/ux-improvement-v2
Adinorio Jun 17, 2025
07f3ac7
feat(time-tracker): new heatmaps + settings config
Adinorio Jun 17, 2025
89ffcec
Merge remote-tracking branch 'origin/feat/time-tracker/ux-improvement…
Adinorio Jun 17, 2025
982a10c
fix(time-tracker): enhance onboarding tips with smart dismissal
Adinorio Jun 17, 2025
4ff7b73
feat(time-tracker): new time tracking features
Adinorio Jun 17, 2025
fc7cad8
Merge branch 'main' into feat/time-tracker/ux-improvement-v2
Adinorio Jun 17, 2025
58d3435
feat(time-tracker): enhance timer UX with consistent settings
Adinorio Jun 17, 2025
68bfc0b
Merge remote-tracking branch 'origin/feat/time-tracker/ux-improvement…
Adinorio Jun 17, 2025
b86e353
feat(time-tracker): implement session protection
Adinorio Jun 18, 2025
c30b9f3
fix(time-tracker): implemented limited list for session history
Adinorio Jun 18, 2025
b9e712e
fix(api): improve type safety in tasks API route
Adinorio Jun 18, 2025
de43646
fix(time-tracker): fix interval recreation causing heavy CPU churn
Adinorio Jun 18, 2025
0fa84a5
fix(time-tracker): prevent NaN in progress bar width calculation
Adinorio Jun 18, 2025
64bfd17
fix(time-tracker): prevent AudioContext resource leak notification sound
Adinorio Jun 18, 2025
ca1e210
fix(time-tracker): prevent PII exposure in localStorage for paused se…
Adinorio Jun 18, 2025
0f5e39d
refactor(time-tracker): replace magic string - was_resumed boolean field
Adinorio Jun 18, 2025
6366c76
refactor(time-tracker): session filtering guard and heatmap proper fix
Adinorio Jun 18, 2025
562746a
refactor(time-tracker): improve code quality
Adinorio Jun 18, 2025
7b39922
refactor: improve code quality
Adinorio Jun 18, 2025
8bc1806
style: apply prettier formatting
Adinorio Jun 18, 2025
9e20921
style: apply prettier formatting for feat/time-tracker/ux-improvement…
vhpx Jun 18, 2025
6eb032d
fix(api): improve type safety in tasks API route with proper interfaces
Adinorio Jun 18, 2025
db073d4
fix(time-tracker): resolve all comments and errors
Adinorio Jun 18, 2025
fb348b8
style: apply prettier formatting
Adinorio Jun 18, 2025
27b13ea
style: apply prettier formatting for feat/time-tracker/ux-improvement…
vhpx Jun 18, 2025
37b6d71
feat(database): add was_resumed field to time_tracking_sessions and u…
vhpx Jun 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
-- Add was_resumed field to time_tracking_sessions table
-- This field tracks whether a session was created by resuming a previous session

ALTER TABLE public.time_tracking_sessions
ADD COLUMN was_resumed boolean DEFAULT false;

-- Back-fill existing rows to ensure no NULL values
UPDATE public.time_tracking_sessions
SET was_resumed = false
WHERE was_resumed IS NULL;

-- Add NOT NULL constraint to prevent tri-state logic
ALTER TABLE public.time_tracking_sessions
ALTER COLUMN was_resumed SET NOT NULL;

-- Add index for analytics queries that filter by was_resumed
CREATE INDEX idx_time_tracking_sessions_was_resumed
ON public.time_tracking_sessions USING btree (was_resumed)
WHERE was_resumed = true;

drop view time_tracking_session_analytics;

-- Update the time_tracking_session_analytics view to include was_resumed
CREATE OR REPLACE VIEW time_tracking_session_analytics AS
SELECT
tts.*,
ttc.name as category_name,
ttc.color as category_color,
t.name as task_name,
EXTRACT(HOUR FROM tts.start_time) as start_hour,
EXTRACT(DOW FROM tts.start_time) as day_of_week,
DATE_TRUNC('day', tts.start_time) as session_date,
DATE_TRUNC('week', tts.start_time) as session_week,
DATE_TRUNC('month', tts.start_time) as session_month,
CASE
WHEN tts.duration_seconds >= 7200 THEN 'long' -- 2+ hours
WHEN tts.duration_seconds >= 1800 THEN 'medium' -- 30min - 2 hours
WHEN tts.duration_seconds >= 300 THEN 'short' -- 5-30 minutes
ELSE 'micro' -- < 5 minutes
END as session_length_category
FROM time_tracking_sessions tts
LEFT JOIN time_tracking_categories ttc ON tts.category_id = ttc.id
LEFT JOIN tasks t ON tts.task_id = t.id;
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import Chat from '../../chat/chat';
import { TaskBoardForm } from '../../tasks/boards/form';
import type { ExtendedWorkspaceTask } from '../../time-tracker/types';
import QuickTaskTimer from './quick-task-timer';
import { TaskForm } from './task-form';
import { TaskListForm } from './task-list-form';
Expand Down Expand Up @@ -186,11 +187,59 @@ export default function TasksSidebarContent({

// Get all tasks from all boards for time tracker
const allTasks = useMemo(() => {
const tasks: Partial<WorkspaceTask>[] = [];
const tasks: ExtendedWorkspaceTask[] = [];
initialTaskBoards.forEach((board) => {
board.lists?.forEach((list) => {
if (list.tasks) {
tasks.push(...list.tasks);
// Transform Partial<WorkspaceTask> to ExtendedWorkspaceTask
interface TaskWithAssigneeMeta extends Partial<WorkspaceTask> {
assignee_name?: string;
assignee_avatar?: string;
is_assigned_to_current_user?: boolean;
assignees?: ExtendedWorkspaceTask['assignees'];
}

const extendedTasks = list.tasks.map(
(task): ExtendedWorkspaceTask => {
const taskMeta = task as TaskWithAssigneeMeta;

// Type-safe conversion from Partial<WorkspaceTask> to ExtendedWorkspaceTask
// Convert undefined values to null to match the expected type constraints
const extendedTask: ExtendedWorkspaceTask = {
// Required fields (these should always be present)
id: task.id!,
name: task.name!,
list_id: task.list_id!,

// Optional fields with proper null conversion
description: task.description ?? null,
priority: task.priority ?? null,
start_date: task.start_date ?? null,
end_date: task.end_date ?? null,
created_at: task.created_at ?? null,
creator_id: task.creator_id ?? null,

// Boolean fields that should be boolean | null (not undefined)
archived: task.archived ?? null,
completed: task.completed ?? null,
deleted: task.deleted ?? null,

// Extended fields for context
board_name: board.name ?? undefined,
list_name: list.name ?? undefined,

// Keep existing assignee metadata if present
assignee_name: taskMeta.assignee_name || undefined,
assignee_avatar: taskMeta.assignee_avatar || undefined,
is_assigned_to_current_user:
taskMeta.is_assigned_to_current_user || undefined,
assignees: taskMeta.assignees || undefined,
};

return extendedTask;
}
);
tasks.push(...extendedTasks);
}
});
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
'use client';

import type {
TimeTrackingCategory,
TimeTrackingSession,
WorkspaceTask,
} from '@tuturuuu/types/db';
ExtendedWorkspaceTask,
SessionWithRelations,
TimerStats,
} from '../../time-tracker/types';
import type { TimeTrackingCategory, WorkspaceTask } from '@tuturuuu/types/db';
import {
AlertDialog,
AlertDialogAction,
Expand Down Expand Up @@ -71,28 +72,11 @@ import { Textarea } from '@tuturuuu/ui/textarea';
import { cn } from '@tuturuuu/utils/format';
import { useCallback, useEffect, useState } from 'react';

interface ExtendedWorkspaceTask extends Partial<WorkspaceTask> {
board_name?: string;
list_name?: string;
}

interface TimeTrackerProps {
wsId: string;
tasks?: ExtendedWorkspaceTask[];
}

interface TimerStats {
todayTime: number;
weekTime: number;
monthTime: number;
streak: number;
}

interface SessionWithRelations extends TimeTrackingSession {
category?: TimeTrackingCategory;
task?: WorkspaceTask;
}

interface SessionTemplate {
title: string;
description?: string;
Expand Down Expand Up @@ -1131,7 +1115,7 @@ export default function TimeTracker({ wsId, tasks = [] }: TimeTrackerProps) {
<Button
onClick={startTimer}
disabled={isLoading}
className="w-full"
className="w-full border border-border bg-muted text-foreground hover:border-accent hover:bg-muted/80 dark:bg-muted dark:text-foreground dark:hover:bg-accent"
size="lg"
>
<Play className="mr-2 h-4 w-4" />
Expand Down Expand Up @@ -1309,7 +1293,7 @@ export default function TimeTracker({ wsId, tasks = [] }: TimeTrackerProps) {
<Button
onClick={startTimer}
disabled={!newSessionTitle.trim() || isLoading}
className="w-full"
className="w-full border border-border bg-muted text-foreground hover:border-accent hover:bg-muted/80 dark:bg-muted dark:text-foreground dark:hover:bg-accent"
size="lg"
>
<Play className="mr-2 h-4 w-4" />
Expand Down Expand Up @@ -1976,7 +1960,7 @@ export default function TimeTracker({ wsId, tasks = [] }: TimeTrackerProps) {
disabled={
isCreatingTask || !newTaskName.trim() || !selectedListId
}
className="flex-1"
className="flex-1 border border-border bg-muted text-foreground hover:border-accent hover:bg-muted/80 dark:bg-muted dark:text-foreground dark:hover:bg-accent"
>
{isCreatingTask ? (
<>
Expand Down
Loading