@burdenoff/microfe-timecampus 2026.1202.1 → 2026.1203.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/timecampus/components/Toast.js +1 -1
  2. package/dist/timecampus/components/Toast.js.map +1 -1
  3. package/dist/timecampus/components/charts/Heatmap.js +1 -1
  4. package/dist/timecampus/components/charts/Heatmap.js.map +1 -1
  5. package/dist/timecampus/components/maps/LocationGeofenceMap.js +3 -3
  6. package/dist/timecampus/components/maps/LocationGeofenceMap.js.map +1 -1
  7. package/dist/timecampus/pages/HomePage.js +1 -1
  8. package/dist/timecampus/pages/HomePage.js.map +1 -1
  9. package/dist/timecampus/pages/admin/AdminPage.js +20 -20
  10. package/dist/timecampus/pages/admin/AdminPage.js.map +1 -1
  11. package/dist/timecampus/pages/application-usage/ApplicationUsagePage.js +1 -1
  12. package/dist/timecampus/pages/application-usage/ApplicationUsagePage.js.map +1 -1
  13. package/dist/timecampus/pages/channels/ChannelsPage.js +8 -8
  14. package/dist/timecampus/pages/channels/ChannelsPage.js.map +1 -1
  15. package/dist/timecampus/pages/client-portal/ClientPortalPage.js +2 -2
  16. package/dist/timecampus/pages/client-portal/ClientPortalPage.js.map +1 -1
  17. package/dist/timecampus/pages/extend/AppletDeveloperPage.js +15 -15
  18. package/dist/timecampus/pages/extend/AppletDeveloperPage.js.map +1 -1
  19. package/dist/timecampus/pages/extend/AppletReviewPage.js +2 -2
  20. package/dist/timecampus/pages/extend/AppletReviewPage.js.map +1 -1
  21. package/dist/timecampus/pages/extend/AppletStorePage.js +2 -2
  22. package/dist/timecampus/pages/extend/AppletStorePage.js.map +1 -1
  23. package/dist/timecampus/pages/extend/MarketplaceCertificationPage.js +2 -2
  24. package/dist/timecampus/pages/extend/MarketplaceCertificationPage.js.map +1 -1
  25. package/dist/timecampus/pages/extend/TimeTriggersPage.js +1 -1
  26. package/dist/timecampus/pages/extend/TimeTriggersPage.js.map +1 -1
  27. package/dist/timecampus/pages/focus/FocusProtectionPage.js +4 -4
  28. package/dist/timecampus/pages/focus/FocusProtectionPage.js.map +1 -1
  29. package/dist/timecampus/pages/geofencing/GeofencingPage.js +6 -6
  30. package/dist/timecampus/pages/geofencing/GeofencingPage.js.map +1 -1
  31. package/dist/timecampus/pages/lifetime/LifeBalancePage.js +3 -3
  32. package/dist/timecampus/pages/lifetime/LifeBalancePage.js.map +1 -1
  33. package/dist/timecampus/pages/lifetime/RecommendationsPage.js +1 -1
  34. package/dist/timecampus/pages/lifetime/RecommendationsPage.js.map +1 -1
  35. package/dist/timecampus/pages/location-tracking/LocationTrackingPage.js +2 -2
  36. package/dist/timecampus/pages/location-tracking/LocationTrackingPage.js.map +1 -1
  37. package/dist/timecampus/pages/meetings/MeetingDetailPage.js +1 -1
  38. package/dist/timecampus/pages/meetings/MeetingDetailPage.js.map +1 -1
  39. package/dist/timecampus/pages/meetings/MeetingFormModal.js +1 -1
  40. package/dist/timecampus/pages/meetings/MeetingFormModal.js.map +1 -1
  41. package/dist/timecampus/pages/meetings/MeetingsPage.js +1 -1
  42. package/dist/timecampus/pages/meetings/MeetingsPage.js.map +1 -1
  43. package/dist/timecampus/pages/mobile/MobileScreen.js +1 -1
  44. package/dist/timecampus/pages/mobile/MobileScreen.js.map +1 -1
  45. package/dist/timecampus/pages/mobile/MobileTimelinePage.js +8 -8
  46. package/dist/timecampus/pages/mobile/MobileTimelinePage.js.map +1 -1
  47. package/dist/timecampus/pages/pomodoro/PomodoroAnalyticsPage.js +1 -1
  48. package/dist/timecampus/pages/pomodoro/PomodoroAnalyticsPage.js.map +1 -1
  49. package/dist/timecampus/pages/pomodoro/PomodoroSettingsPage.js +3 -3
  50. package/dist/timecampus/pages/pomodoro/PomodoroSettingsPage.js.map +1 -1
  51. package/dist/timecampus/pages/resource-planning/ResourcePlanningPage.js +6 -6
  52. package/dist/timecampus/pages/resource-planning/ResourcePlanningPage.js.map +1 -1
  53. package/dist/timecampus/pages/settings/SettingsPage.js +3 -3
  54. package/dist/timecampus/pages/settings/SettingsPage.js.map +1 -1
  55. package/dist/timecampus/pages/team/TeamMembersPage.js +1 -1
  56. package/dist/timecampus/pages/team/TeamMembersPage.js.map +1 -1
  57. package/dist/timecampus/pages/time/TimeEntriesPage.js +6 -6
  58. package/dist/timecampus/pages/time/TimeEntriesPage.js.map +1 -1
  59. package/dist/timecampus/pages/time/TimerPage.js +1 -1
  60. package/dist/timecampus/pages/time/TimerPage.js.map +1 -1
  61. package/dist/timecampus/pages/time-approval/SubmitTimesheetModal.js +1 -1
  62. package/dist/timecampus/pages/time-approval/SubmitTimesheetModal.js.map +1 -1
  63. package/dist/timecampus/pages/timeline/TimelinePage.js +4 -4
  64. package/dist/timecampus/pages/timeline/TimelinePage.js.map +1 -1
  65. package/package.json +5 -3
@@ -1 +1 @@
1
- {"version":3,"file":"TimeEntriesPage.js","names":["_Fragment","PAGE_SIZE","toLocalInput","iso","d","toISO","local","emptyForm","now","EntryFormFields","form","onChange","projects","project","TimeEntriesPage","filter","setFilter","useState","filterOpen","setFilterOpen","draftBillable","setDraftBillable","draftProjectId","setDraftProjectId","draftSearch","setDraftSearch","createOpen","setCreateOpen","createForm","setCreateForm","editEntry","setEditEntry","editForm","setEditForm","deleteEntry","setDeleteEntry","hasFilter","useListTimeEntriesQuery","projectsData","useListProjectsQuery","entries","useMemo","data","hasMore","total","createEntry","creating","createError","useCreateTimeEntryMutation","analytics","useTimeCampusAnalytics","updateEntry","updating","updateError","useUpdateTimeEntryMutation","removeEntry","deleting","useDeleteTimeEntryMutation","duplicateEntry","duplicating","useDuplicateTimeEntryMutation","loadingMore","setLoadingMore","handleLoadMore","fetchMore","fetchMoreResult","prev","openCreate","handleCreate","startTime","created","refetch","openEdit","entry","handleUpdate","handleDuplicate","error","PageLayout","Filter","header","rows","formatDate","escape","value","csv","row","cell","blob","url","link","Download","Plus","loading","LoadingSkeleton","EmptyState","Fragment","GlassCard","getInitials","formatHours","StatusBadge","Pencil","Copy","Trash2","Modal","f","patch","next"],"sources":["../../../../src/timecampus/pages/time/TimeEntriesPage.tsx"],"sourcesContent":["import { useMemo, useState } from \"react\";\nimport { Plus, Filter, Download, Pencil, Copy, Trash2 } from \"lucide-react\";\nimport { GlassCard } from \"@burdenoff/fe-libs/ui\";\nimport { PageLayout } from \"../../components/PageLayout\";\nimport { Modal } from \"../../components/Modal\";\nimport { EmptyState } from \"../../components/EmptyState\";\nimport { LoadingSkeleton } from \"../../components/LoadingSkeleton\";\nimport { StatusBadge } from \"../../components/StatusBadge\";\nimport { formatHours, formatDate, getInitials } from \"../../utils/helpers\";\nimport {\n useListTimeEntriesQuery,\n useCreateTimeEntryMutation,\n useUpdateTimeEntryMutation,\n useDeleteTimeEntryMutation,\n useDuplicateTimeEntryMutation,\n useListProjectsQuery,\n type TimeEntryFieldsFragment,\n type ListProjectsQuery,\n type ListTimeEntriesQuery,\n} from \"@/generated/wspace-operations\";\nimport { useTimeCampusAnalytics } from \"../../analytics\";\nimport type { TimeEntryFilterInput } from \"@/generated/wspace-types\";\n\ntype ProjectOption = ListProjectsQuery[\"projects\"][\"items\"][number];\n\nconst PAGE_SIZE = 50;\n\n/** Convert an ISO datetime to a value usable by <input type=\"datetime-local\">. */\nfunction toLocalInput(iso?: string | null): string {\n if (!iso) return \"\";\n const d = new Date(iso);\n if (Number.isNaN(d.getTime())) return \"\";\n const local = new Date(d.getTime() - d.getTimezoneOffset() * 60000);\n return local.toISOString().slice(0, 16);\n}\n\n/** Convert a datetime-local value to an ISO string, or undefined if empty. */\nfunction toISO(local: string): string | undefined {\n if (!local) return undefined;\n const d = new Date(local);\n if (Number.isNaN(d.getTime())) return undefined;\n return d.toISOString();\n}\n\ninterface EntryFormState {\n description: string;\n projectId: string;\n startTime: string;\n endTime: string;\n billable: boolean;\n}\n\nfunction emptyForm(): EntryFormState {\n const now = new Date();\n const local = new Date(now.getTime() - now.getTimezoneOffset() * 60000);\n return {\n description: \"\",\n projectId: \"\",\n startTime: local.toISOString().slice(0, 16),\n endTime: \"\",\n billable: false,\n };\n}\n\ninterface EntryFormFieldsProps {\n form: EntryFormState;\n onChange: (patch: Partial<EntryFormState>) => void;\n projects: ProjectOption[];\n}\n\nfunction EntryFormFields({ form, onChange, projects }: EntryFormFieldsProps) {\n return (\n <div className=\"space-y-4\">\n <div>\n <label className=\"block text-sm font-medium text-text-primary\">\n Description\n </label>\n <input\n type=\"text\"\n placeholder=\"What did you work on?\"\n value={form.description}\n onChange={(e) => onChange({ description: e.target.value })}\n className=\"mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary\"\n />\n </div>\n <div>\n <label className=\"block text-sm font-medium text-text-primary\">\n Project\n </label>\n <select\n value={form.projectId}\n onChange={(e) => onChange({ projectId: e.target.value })}\n className=\"mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n >\n <option value=\"\">No Project</option>\n {projects.map((project) => (\n <option key={project.id} value={project.id}>\n {project.name}\n </option>\n ))}\n </select>\n </div>\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <div>\n <label className=\"block text-sm font-medium text-text-primary\">\n Start\n </label>\n <input\n type=\"datetime-local\"\n value={form.startTime}\n onChange={(e) => onChange({ startTime: e.target.value })}\n className=\"mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n />\n </div>\n <div>\n <label className=\"block text-sm font-medium text-text-primary\">\n End\n </label>\n <input\n type=\"datetime-local\"\n value={form.endTime}\n onChange={(e) => onChange({ endTime: e.target.value })}\n className=\"mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n />\n </div>\n </div>\n <label className=\"flex items-center gap-2 text-sm text-text-primary\">\n <input\n type=\"checkbox\"\n checked={form.billable}\n onChange={(e) => onChange({ billable: e.target.checked })}\n className=\"h-4 w-4 rounded border-border-subtle\"\n />\n Billable\n </label>\n </div>\n );\n}\n\nexport function TimeEntriesPage() {\n // Filters\n const [filter, setFilter] = useState<TimeEntryFilterInput>({});\n const [filterOpen, setFilterOpen] = useState(false);\n const [draftBillable, setDraftBillable] = useState<\"all\" | \"yes\" | \"no\">(\n \"all\",\n );\n const [draftProjectId, setDraftProjectId] = useState(\"\");\n const [draftSearch, setDraftSearch] = useState(\"\");\n\n // Create / edit / delete modal state\n const [createOpen, setCreateOpen] = useState(false);\n const [createForm, setCreateForm] = useState<EntryFormState>(emptyForm);\n const [editEntry, setEditEntry] = useState<TimeEntryFieldsFragment | null>(\n null,\n );\n const [editForm, setEditForm] = useState<EntryFormState>(emptyForm);\n const [deleteEntry, setDeleteEntry] =\n useState<TimeEntryFieldsFragment | null>(null);\n\n const hasFilter = Object.keys(filter).length > 0;\n\n const { data, loading, error, fetchMore, refetch } = useListTimeEntriesQuery({\n variables: {\n pagination: { limit: PAGE_SIZE, offset: 0 },\n filter: hasFilter ? filter : undefined,\n },\n notifyOnNetworkStatusChange: true,\n });\n\n const { data: projectsData } = useListProjectsQuery({\n variables: { pagination: { limit: 100 } },\n });\n const projects: ProjectOption[] = projectsData?.projects?.items ?? [];\n\n const entries: TimeEntryFieldsFragment[] = useMemo(\n () => data?.timeEntries?.items ?? [],\n [data?.timeEntries?.items],\n );\n const hasMore = data?.timeEntries?.hasMore ?? false;\n const total = data?.timeEntries?.total ?? 0;\n\n const [createEntry, { loading: creating, error: createError }] =\n useCreateTimeEntryMutation();\n const analytics = useTimeCampusAnalytics();\n const [updateEntry, { loading: updating, error: updateError }] =\n useUpdateTimeEntryMutation();\n const [removeEntry, { loading: deleting }] = useDeleteTimeEntryMutation();\n const [duplicateEntry, { loading: duplicating }] =\n useDuplicateTimeEntryMutation();\n\n const [loadingMore, setLoadingMore] = useState(false);\n\n const handleLoadMore = async () => {\n setLoadingMore(true);\n try {\n await fetchMore({\n variables: { pagination: { limit: PAGE_SIZE, offset: entries.length } },\n updateQuery: (\n prev: ListTimeEntriesQuery,\n { fetchMoreResult }: { fetchMoreResult?: ListTimeEntriesQuery },\n ) => {\n if (!fetchMoreResult) return prev;\n return {\n ...fetchMoreResult,\n timeEntries: {\n ...fetchMoreResult.timeEntries,\n items: [\n ...prev.timeEntries.items,\n ...fetchMoreResult.timeEntries.items,\n ],\n },\n };\n },\n });\n } finally {\n setLoadingMore(false);\n }\n };\n\n const openCreate = () => {\n setCreateForm(emptyForm());\n setCreateOpen(true);\n };\n\n const handleCreate = async () => {\n const startTime = toISO(createForm.startTime);\n if (!startTime) return;\n const result = await createEntry({\n variables: {\n input: {\n description: createForm.description.trim() || undefined,\n projectId: createForm.projectId || undefined,\n startTime,\n endTime: toISO(createForm.endTime),\n billable: createForm.billable,\n source: \"manual\",\n },\n },\n });\n const created = result.data?.createTimeEntry;\n // Keep the dialog open on failure so the error banner stays visible.\n if (!created) return;\n analytics.timeEntryCreated({\n timeEntryId: created.id,\n surface: \"time_entries_page\",\n hasProject: Boolean(created.projectId),\n });\n setCreateOpen(false);\n await refetch();\n };\n\n const openEdit = (entry: TimeEntryFieldsFragment) => {\n setEditEntry(entry);\n setEditForm({\n description: entry.description ?? \"\",\n projectId: entry.projectId ?? \"\",\n startTime: toLocalInput(entry.startTime),\n endTime: toLocalInput(entry.endTime),\n billable: entry.billable,\n });\n };\n\n const handleUpdate = async () => {\n if (!editEntry) return;\n const startTime = toISO(editForm.startTime);\n if (!startTime) return;\n await updateEntry({\n variables: {\n id: editEntry.id,\n input: {\n description: editForm.description.trim() || undefined,\n projectId: editForm.projectId || undefined,\n startTime,\n endTime: toISO(editForm.endTime),\n billable: editForm.billable,\n },\n },\n });\n setEditEntry(null);\n await refetch();\n };\n\n const handleDuplicate = async (entry: TimeEntryFieldsFragment) => {\n await duplicateEntry({ variables: { id: entry.id } });\n await refetch();\n };\n\n const handleDelete = async () => {\n if (!deleteEntry) return;\n await removeEntry({ variables: { id: deleteEntry.id } });\n setDeleteEntry(null);\n await refetch();\n };\n\n const applyFilter = () => {\n const next: TimeEntryFilterInput = {};\n if (draftBillable !== \"all\") next.billable = draftBillable === \"yes\";\n if (draftProjectId) next.projectId = draftProjectId;\n if (draftSearch.trim()) next.search = draftSearch.trim();\n setFilter(next);\n setFilterOpen(false);\n };\n\n const clearFilter = () => {\n setDraftBillable(\"all\");\n setDraftProjectId(\"\");\n setDraftSearch(\"\");\n setFilter({});\n setFilterOpen(false);\n };\n\n // Client-side CSV export of the currently loaded rows. There is no backend\n // export operation, so this exports what has been fetched into the table.\n const handleExport = () => {\n const header = [\n \"Date\",\n \"Project\",\n \"Task/Description\",\n \"Duration (hours)\",\n \"Billable\",\n \"Status\",\n ];\n const rows = entries.map((entry) => [\n formatDate(entry.startTime),\n entry.project?.name ?? \"No Project\",\n entry.task?.title ?? entry.description ?? \"\",\n ((entry.duration ?? 0) / 3600).toFixed(2),\n entry.billable ? \"Yes\" : \"No\",\n entry.isRunning ? \"running\" : \"completed\",\n ]);\n const escape = (value: string) => `\"${value.replace(/\"/g, '\"\"')}\"`;\n const csv = [header, ...rows]\n .map((row) => row.map((cell: string) => escape(String(cell))).join(\",\"))\n .join(\"\\n\");\n const blob = new Blob([csv], { type: \"text/csv;charset=utf-8;\" });\n const url = URL.createObjectURL(blob);\n const link = document.createElement(\"a\");\n link.href = url;\n link.download = `time-entries-${new Date().toISOString().slice(0, 10)}.csv`;\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n URL.revokeObjectURL(url);\n };\n\n if (error) {\n return (\n <PageLayout\n title=\"Time Entries\"\n description=\"View and manage all time entries\"\n >\n <div className=\"rounded-xl border border-status-error-bg/40 bg-status-error-bg p-6 text-sm text-status-error-text\">\n Failed to load time entries. Please try again later.\n </div>\n </PageLayout>\n );\n }\n\n return (\n <PageLayout\n title=\"Time Entries\"\n description=\"View and manage all time entries\"\n purpose=\"Every tracked block of work in one auditable list — filter, correct and confirm entries here before they roll into timesheets, approvals and client invoices.\"\n actions={\n <div className=\"flex items-center gap-2\">\n <button\n onClick={() => {\n setDraftBillable(\n filter.billable === undefined\n ? \"all\"\n : filter.billable\n ? \"yes\"\n : \"no\",\n );\n setDraftProjectId(filter.projectId ?? \"\");\n setDraftSearch(filter.search ?? \"\");\n setFilterOpen(true);\n }}\n className={`inline-flex items-center gap-1.5 rounded-md border px-3 py-2 text-sm font-medium hover:bg-bg-sunken/50 ${hasFilter ? \"border-action-primary-border text-primary\" : \"border-border-subtle text-text-primary\"}`}\n >\n <Filter className=\"h-4 w-4\" />\n Filter{hasFilter ? ` (${Object.keys(filter).length})` : \"\"}\n </button>\n <button\n onClick={handleExport}\n disabled={entries.length === 0}\n className=\"inline-flex items-center gap-1.5 rounded-md border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken/50 disabled:opacity-50\"\n >\n <Download className=\"h-4 w-4\" />\n Export\n </button>\n <button\n onClick={openCreate}\n className=\"inline-flex items-center gap-1.5 rounded-md bg-action-primary-bg px-3 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90\"\n >\n <Plus className=\"h-4 w-4\" />\n New Entry\n </button>\n </div>\n }\n >\n {loading && entries.length === 0 ? (\n <LoadingSkeleton variant=\"table\" count={5} />\n ) : entries.length === 0 ? (\n <EmptyState\n illustration=\"empty-data\"\n title=\"No time entries found\"\n description=\"Track time with a timer or add a manual entry — your entries will appear here.\"\n action={\n <button\n onClick={openCreate}\n className=\"inline-flex items-center gap-1.5 rounded-md bg-action-primary-bg px-3 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90\"\n >\n <Plus className=\"h-4 w-4\" />\n New Entry\n </button>\n }\n />\n ) : (\n <>\n <GlassCard treatment=\"glass\" glow className=\"overflow-hidden\">\n <div className=\"overflow-x-auto\">\n <table className=\"w-full\">\n <thead>\n <tr className=\"border-b border-border-subtle\">\n <th className=\"px-4 py-3 text-left text-xs font-medium text-text-secondary\">\n Entry\n </th>\n <th className=\"px-4 py-3 text-left text-xs font-medium text-text-secondary\">\n Project\n </th>\n <th className=\"px-4 py-3 text-left text-xs font-medium text-text-secondary\">\n Duration\n </th>\n <th className=\"px-4 py-3 text-left text-xs font-medium text-text-secondary\">\n Billable\n </th>\n <th className=\"px-4 py-3 text-left text-xs font-medium text-text-secondary\">\n Status\n </th>\n <th className=\"px-4 py-3 text-right text-xs font-medium text-text-secondary\">\n Actions\n </th>\n </tr>\n </thead>\n <tbody className=\"divide-y divide-border\">\n {entries.map((entry: TimeEntryFieldsFragment) => (\n <tr\n key={entry.id}\n className=\"hover:bg-bg-sunken/50 transition-colors\"\n >\n <td className=\"px-4 py-3\">\n <p className=\"text-sm font-medium text-text-primary\">\n {entry.task?.title ??\n entry.description ??\n \"No description\"}\n </p>\n <p className=\"text-xs text-text-secondary\">\n {formatDate(entry.startTime)}\n </p>\n </td>\n <td className=\"px-4 py-3\">\n <div className=\"flex items-center gap-2\">\n <span className=\"flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-action-primary-bg/10 text-xs font-semibold text-primary\">\n {getInitials(entry.project?.name ?? \"No Project\")}\n </span>\n <span className=\"text-sm font-medium text-text-primary\">\n {entry.project?.name ?? \"No Project\"}\n </span>\n </div>\n </td>\n <td className=\"px-4 py-3 text-sm font-mono text-text-primary\">\n {formatHours((entry.duration ?? 0) / 3600)}\n </td>\n <td className=\"px-4 py-3\">\n <StatusBadge\n label={entry.billable ? \"Billable\" : \"Non-billable\"}\n variant={entry.billable ? \"success\" : \"muted\"}\n />\n </td>\n <td className=\"px-4 py-3\">\n <StatusBadge\n status={entry.isRunning ? \"running\" : \"completed\"}\n dot={entry.isRunning}\n label={entry.isRunning ? \"running\" : \"completed\"}\n />\n </td>\n <td className=\"px-4 py-3\">\n <div className=\"flex items-center justify-end gap-1\">\n <button\n onClick={() => openEdit(entry)}\n title=\"Edit entry\"\n aria-label=\"Edit entry\"\n className=\"rounded-md p-1.5 text-text-secondary hover:bg-bg-sunken hover:text-text-primary\"\n >\n <Pencil className=\"h-4 w-4\" />\n </button>\n <button\n onClick={() => handleDuplicate(entry)}\n disabled={duplicating}\n title=\"Duplicate entry\"\n aria-label=\"Duplicate entry\"\n className=\"rounded-md p-1.5 text-text-secondary hover:bg-bg-sunken hover:text-text-primary disabled:opacity-50\"\n >\n <Copy className=\"h-4 w-4\" />\n </button>\n <button\n onClick={() => setDeleteEntry(entry)}\n title=\"Delete entry\"\n aria-label=\"Delete entry\"\n className=\"rounded-md p-1.5 text-status-error-text hover:bg-status-error-bg\"\n >\n <Trash2 className=\"h-4 w-4\" />\n </button>\n </div>\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </GlassCard>\n\n <div className=\"mt-4 flex items-center justify-between\">\n <p className=\"text-xs text-text-secondary\">\n Showing {entries.length} of {total}\n </p>\n {hasMore && (\n <button\n onClick={handleLoadMore}\n disabled={loadingMore}\n className=\"inline-flex items-center gap-1.5 rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken/50 disabled:opacity-50\"\n >\n {loadingMore ? \"Loading...\" : \"Load more\"}\n </button>\n )}\n </div>\n </>\n )}\n\n {/* Create modal */}\n <Modal\n open={createOpen}\n onClose={() => setCreateOpen(false)}\n title=\"New Time Entry\"\n description=\"Manually log a block of work.\"\n size=\"lg\"\n footer={\n <>\n <button\n onClick={() => setCreateOpen(false)}\n className=\"rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken/50\"\n >\n Cancel\n </button>\n <button\n onClick={handleCreate}\n disabled={creating || !createForm.startTime}\n className=\"rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-50\"\n >\n {creating ? \"Saving...\" : \"Create Entry\"}\n </button>\n </>\n }\n >\n {createError && (\n <div className=\"mb-4 rounded-lg border border-status-error-bg/40 bg-status-error-bg p-3 text-sm text-status-error-text\">\n Failed to create entry. Please try again.\n </div>\n )}\n <EntryFormFields\n form={createForm}\n onChange={(patch) => setCreateForm((f) => ({ ...f, ...patch }))}\n projects={projects}\n />\n </Modal>\n\n {/* Edit modal */}\n <Modal\n open={Boolean(editEntry)}\n onClose={() => setEditEntry(null)}\n title=\"Edit Time Entry\"\n description=\"Correct the details of this logged block.\"\n size=\"lg\"\n footer={\n <>\n <button\n onClick={() => setEditEntry(null)}\n className=\"rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken/50\"\n >\n Cancel\n </button>\n <button\n onClick={handleUpdate}\n disabled={updating || !editForm.startTime}\n className=\"rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-50\"\n >\n {updating ? \"Saving...\" : \"Save Changes\"}\n </button>\n </>\n }\n >\n {updateError && (\n <div className=\"mb-4 rounded-lg border border-status-error-bg/40 bg-status-error-bg p-3 text-sm text-status-error-text\">\n Failed to update entry. Please try again.\n </div>\n )}\n <EntryFormFields\n form={editForm}\n onChange={(patch) => setEditForm((f) => ({ ...f, ...patch }))}\n projects={projects}\n />\n </Modal>\n\n {/* Delete confirm modal */}\n <Modal\n open={Boolean(deleteEntry)}\n onClose={() => setDeleteEntry(null)}\n title=\"Delete time entry?\"\n description=\"This permanently removes the entry. It cannot be undone.\"\n footer={\n <>\n <button\n onClick={() => setDeleteEntry(null)}\n className=\"rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken/50\"\n >\n Cancel\n </button>\n <button\n onClick={handleDelete}\n disabled={deleting}\n className=\"rounded-md bg-action-danger-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-danger-bg/90 disabled:opacity-50\"\n >\n {deleting ? \"Deleting...\" : \"Delete\"}\n </button>\n </>\n }\n >\n <p className=\"text-sm text-text-secondary\">\n Delete the entry for{\" \"}\n <span className=\"font-medium text-text-primary\">\n {deleteEntry?.project?.name ??\n deleteEntry?.description ??\n \"this block of work\"}\n </span>\n ?\n </p>\n </Modal>\n\n {/* Filter modal */}\n <Modal\n open={filterOpen}\n onClose={() => setFilterOpen(false)}\n title=\"Filter entries\"\n description=\"Narrow the list to what you need.\"\n footer={\n <>\n <button\n onClick={clearFilter}\n className=\"rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken/50\"\n >\n Clear\n </button>\n <button\n onClick={applyFilter}\n className=\"rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90\"\n >\n Apply\n </button>\n </>\n }\n >\n <div className=\"space-y-4\">\n <div>\n <label className=\"block text-sm font-medium text-text-primary\">\n Search\n </label>\n <input\n type=\"text\"\n placeholder=\"Description contains...\"\n value={draftSearch}\n onChange={(e) => setDraftSearch(e.target.value)}\n className=\"mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary\"\n />\n </div>\n <div>\n <label className=\"block text-sm font-medium text-text-primary\">\n Project\n </label>\n <select\n value={draftProjectId}\n onChange={(e) => setDraftProjectId(e.target.value)}\n className=\"mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n >\n <option value=\"\">All Projects</option>\n {projects.map((project) => (\n <option key={project.id} value={project.id}>\n {project.name}\n </option>\n ))}\n </select>\n </div>\n <div>\n <label className=\"block text-sm font-medium text-text-primary\">\n Billable\n </label>\n <select\n value={draftBillable}\n onChange={(e) =>\n setDraftBillable(e.target.value as \"all\" | \"yes\" | \"no\")\n }\n className=\"mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n >\n <option value=\"all\">All</option>\n <option value=\"yes\">Billable only</option>\n <option value=\"no\">Non-billable only</option>\n </select>\n </div>\n </div>\n </Modal>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAyBA,IAAMC,IAAY;AAGlB,SAASC,EAAa,GAA6B;CACjD,IAAI,CAACC,GAAK,OAAO;CACjB,IAAMC,IAAI,IAAI,KAAKD,CAAG;CAGtB,OAFI,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AQ;OACH,GAFKA,EAAQ,EAEb,CACT,CACK;MACL,CAAA,CAAA,EAAA,CAAA;MACL,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,SAAD;OAAO,WAAU;OAA8C,UAAA;MAExD,CAAA,GACP,kBAAC,UAAD;OACE,OAAOO;OACP,WAAW,MACTC,EAAiB,EAAE,OAAO,KAA6B;OAEzD,WAAU;OALZ,UAAA;QAOE,kBAAC,UAAD;SAAQ,OAAM;SAAM,UAAA;QAAW,CAAA;QAC/B,kBAAC,UAAD;SAAQ,OAAM;SAAM,UAAA;QAAqB,CAAA;QACzC,kBAAC,UAAD;SAAQ,OAAM;SAAK,UAAA;QAAyB,CAAA;OACtC;MACL,CAAA,CAAA,EAAA,CAAA;KACF;;GACA,CAAA;EACG;;AAEhB"}
1
+ {"version":3,"file":"TimeEntriesPage.js","names":["_Fragment","PAGE_SIZE","toLocalInput","iso","d","toISO","local","emptyForm","now","EntryFormFields","form","onChange","projects","project","TimeEntriesPage","filter","setFilter","useState","filterOpen","setFilterOpen","draftBillable","setDraftBillable","draftProjectId","setDraftProjectId","draftSearch","setDraftSearch","createOpen","setCreateOpen","createForm","setCreateForm","editEntry","setEditEntry","editForm","setEditForm","deleteEntry","setDeleteEntry","hasFilter","useListTimeEntriesQuery","projectsData","useListProjectsQuery","entries","useMemo","data","hasMore","total","createEntry","creating","createError","useCreateTimeEntryMutation","analytics","useTimeCampusAnalytics","updateEntry","updating","updateError","useUpdateTimeEntryMutation","removeEntry","deleting","useDeleteTimeEntryMutation","duplicateEntry","duplicating","useDuplicateTimeEntryMutation","loadingMore","setLoadingMore","handleLoadMore","fetchMore","fetchMoreResult","prev","openCreate","handleCreate","startTime","created","refetch","openEdit","entry","handleUpdate","handleDuplicate","error","PageLayout","Filter","header","rows","formatDate","escape","value","csv","row","cell","blob","url","link","Download","Plus","loading","LoadingSkeleton","EmptyState","Fragment","GlassCard","getInitials","formatHours","StatusBadge","Pencil","Copy","Trash2","Modal","f","patch","next"],"sources":["../../../../src/timecampus/pages/time/TimeEntriesPage.tsx"],"sourcesContent":["import { useMemo, useState } from \"react\";\nimport { Plus, Filter, Download, Pencil, Copy, Trash2 } from \"lucide-react\";\nimport { GlassCard } from \"@burdenoff/fe-libs/ui\";\nimport { PageLayout } from \"../../components/PageLayout\";\nimport { Modal } from \"../../components/Modal\";\nimport { EmptyState } from \"../../components/EmptyState\";\nimport { LoadingSkeleton } from \"../../components/LoadingSkeleton\";\nimport { StatusBadge } from \"../../components/StatusBadge\";\nimport { formatHours, formatDate, getInitials } from \"../../utils/helpers\";\nimport {\n useListTimeEntriesQuery,\n useCreateTimeEntryMutation,\n useUpdateTimeEntryMutation,\n useDeleteTimeEntryMutation,\n useDuplicateTimeEntryMutation,\n useListProjectsQuery,\n type TimeEntryFieldsFragment,\n type ListProjectsQuery,\n type ListTimeEntriesQuery,\n} from \"@/generated/wspace-operations\";\nimport { useTimeCampusAnalytics } from \"../../analytics\";\nimport type { TimeEntryFilterInput } from \"@/generated/wspace-types\";\n\ntype ProjectOption = ListProjectsQuery[\"projects\"][\"items\"][number];\n\nconst PAGE_SIZE = 50;\n\n/** Convert an ISO datetime to a value usable by <input type=\"datetime-local\">. */\nfunction toLocalInput(iso?: string | null): string {\n if (!iso) return \"\";\n const d = new Date(iso);\n if (Number.isNaN(d.getTime())) return \"\";\n const local = new Date(d.getTime() - d.getTimezoneOffset() * 60000);\n return local.toISOString().slice(0, 16);\n}\n\n/** Convert a datetime-local value to an ISO string, or undefined if empty. */\nfunction toISO(local: string): string | undefined {\n if (!local) return undefined;\n const d = new Date(local);\n if (Number.isNaN(d.getTime())) return undefined;\n return d.toISOString();\n}\n\ninterface EntryFormState {\n description: string;\n projectId: string;\n startTime: string;\n endTime: string;\n billable: boolean;\n}\n\nfunction emptyForm(): EntryFormState {\n const now = new Date();\n const local = new Date(now.getTime() - now.getTimezoneOffset() * 60000);\n return {\n description: \"\",\n projectId: \"\",\n startTime: local.toISOString().slice(0, 16),\n endTime: \"\",\n billable: false,\n };\n}\n\ninterface EntryFormFieldsProps {\n form: EntryFormState;\n onChange: (patch: Partial<EntryFormState>) => void;\n projects: ProjectOption[];\n}\n\nfunction EntryFormFields({ form, onChange, projects }: EntryFormFieldsProps) {\n return (\n <div className=\"space-y-4\">\n <div>\n <label className=\"block text-sm font-medium text-text-primary\">\n Description\n </label>\n <input\n type=\"text\"\n placeholder=\"What did you work on?\"\n value={form.description}\n onChange={(e) => onChange({ description: e.target.value })}\n className=\"mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary\"\n />\n </div>\n <div>\n <label className=\"block text-sm font-medium text-text-primary\">\n Project\n </label>\n <select\n value={form.projectId}\n onChange={(e) => onChange({ projectId: e.target.value })}\n className=\"mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n >\n <option value=\"\">No Project</option>\n {projects.map((project) => (\n <option key={project.id} value={project.id}>\n {project.name}\n </option>\n ))}\n </select>\n </div>\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <div>\n <label className=\"block text-sm font-medium text-text-primary\">\n Start\n </label>\n <input\n type=\"datetime-local\"\n value={form.startTime}\n onChange={(e) => onChange({ startTime: e.target.value })}\n className=\"mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n />\n </div>\n <div>\n <label className=\"block text-sm font-medium text-text-primary\">\n End\n </label>\n <input\n type=\"datetime-local\"\n value={form.endTime}\n onChange={(e) => onChange({ endTime: e.target.value })}\n className=\"mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n />\n </div>\n </div>\n <label className=\"flex items-center gap-2 text-sm text-text-primary\">\n <input\n type=\"checkbox\"\n checked={form.billable}\n onChange={(e) => onChange({ billable: e.target.checked })}\n className=\"h-4 w-4 rounded border-border-subtle\"\n />\n Billable\n </label>\n </div>\n );\n}\n\nexport function TimeEntriesPage() {\n // Filters\n const [filter, setFilter] = useState<TimeEntryFilterInput>({});\n const [filterOpen, setFilterOpen] = useState(false);\n const [draftBillable, setDraftBillable] = useState<\"all\" | \"yes\" | \"no\">(\n \"all\",\n );\n const [draftProjectId, setDraftProjectId] = useState(\"\");\n const [draftSearch, setDraftSearch] = useState(\"\");\n\n // Create / edit / delete modal state\n const [createOpen, setCreateOpen] = useState(false);\n const [createForm, setCreateForm] = useState<EntryFormState>(emptyForm);\n const [editEntry, setEditEntry] = useState<TimeEntryFieldsFragment | null>(\n null,\n );\n const [editForm, setEditForm] = useState<EntryFormState>(emptyForm);\n const [deleteEntry, setDeleteEntry] =\n useState<TimeEntryFieldsFragment | null>(null);\n\n const hasFilter = Object.keys(filter).length > 0;\n\n const { data, loading, error, fetchMore, refetch } = useListTimeEntriesQuery({\n variables: {\n pagination: { limit: PAGE_SIZE, offset: 0 },\n filter: hasFilter ? filter : undefined,\n },\n notifyOnNetworkStatusChange: true,\n });\n\n const { data: projectsData } = useListProjectsQuery({\n variables: { pagination: { limit: 100 } },\n });\n const projects: ProjectOption[] = projectsData?.projects?.items ?? [];\n\n const entries: TimeEntryFieldsFragment[] = useMemo(\n () => data?.timeEntries?.items ?? [],\n [data?.timeEntries?.items],\n );\n const hasMore = data?.timeEntries?.hasMore ?? false;\n const total = data?.timeEntries?.total ?? 0;\n\n const [createEntry, { loading: creating, error: createError }] =\n useCreateTimeEntryMutation();\n const analytics = useTimeCampusAnalytics();\n const [updateEntry, { loading: updating, error: updateError }] =\n useUpdateTimeEntryMutation();\n const [removeEntry, { loading: deleting }] = useDeleteTimeEntryMutation();\n const [duplicateEntry, { loading: duplicating }] =\n useDuplicateTimeEntryMutation();\n\n const [loadingMore, setLoadingMore] = useState(false);\n\n const handleLoadMore = async () => {\n setLoadingMore(true);\n try {\n await fetchMore({\n variables: { pagination: { limit: PAGE_SIZE, offset: entries.length } },\n updateQuery: (\n prev: ListTimeEntriesQuery,\n { fetchMoreResult }: { fetchMoreResult?: ListTimeEntriesQuery },\n ) => {\n if (!fetchMoreResult) return prev;\n return {\n ...fetchMoreResult,\n timeEntries: {\n ...fetchMoreResult.timeEntries,\n items: [\n ...prev.timeEntries.items,\n ...fetchMoreResult.timeEntries.items,\n ],\n },\n };\n },\n });\n } finally {\n setLoadingMore(false);\n }\n };\n\n const openCreate = () => {\n setCreateForm(emptyForm());\n setCreateOpen(true);\n };\n\n const handleCreate = async () => {\n const startTime = toISO(createForm.startTime);\n if (!startTime) return;\n const result = await createEntry({\n variables: {\n input: {\n description: createForm.description.trim() || undefined,\n projectId: createForm.projectId || undefined,\n startTime,\n endTime: toISO(createForm.endTime),\n billable: createForm.billable,\n source: \"manual\",\n },\n },\n });\n const created = result.data?.createTimeEntry;\n // Keep the dialog open on failure so the error banner stays visible.\n if (!created) return;\n analytics.timeEntryCreated({\n timeEntryId: created.id,\n surface: \"time_entries_page\",\n hasProject: Boolean(created.projectId),\n });\n setCreateOpen(false);\n await refetch();\n };\n\n const openEdit = (entry: TimeEntryFieldsFragment) => {\n setEditEntry(entry);\n setEditForm({\n description: entry.description ?? \"\",\n projectId: entry.projectId ?? \"\",\n startTime: toLocalInput(entry.startTime),\n endTime: toLocalInput(entry.endTime),\n billable: entry.billable,\n });\n };\n\n const handleUpdate = async () => {\n if (!editEntry) return;\n const startTime = toISO(editForm.startTime);\n if (!startTime) return;\n await updateEntry({\n variables: {\n id: editEntry.id,\n input: {\n description: editForm.description.trim() || undefined,\n projectId: editForm.projectId || undefined,\n startTime,\n endTime: toISO(editForm.endTime),\n billable: editForm.billable,\n },\n },\n });\n setEditEntry(null);\n await refetch();\n };\n\n const handleDuplicate = async (entry: TimeEntryFieldsFragment) => {\n await duplicateEntry({ variables: { id: entry.id } });\n await refetch();\n };\n\n const handleDelete = async () => {\n if (!deleteEntry) return;\n await removeEntry({ variables: { id: deleteEntry.id } });\n setDeleteEntry(null);\n await refetch();\n };\n\n const applyFilter = () => {\n const next: TimeEntryFilterInput = {};\n if (draftBillable !== \"all\") next.billable = draftBillable === \"yes\";\n if (draftProjectId) next.projectId = draftProjectId;\n if (draftSearch.trim()) next.search = draftSearch.trim();\n setFilter(next);\n setFilterOpen(false);\n };\n\n const clearFilter = () => {\n setDraftBillable(\"all\");\n setDraftProjectId(\"\");\n setDraftSearch(\"\");\n setFilter({});\n setFilterOpen(false);\n };\n\n // Client-side CSV export of the currently loaded rows. There is no backend\n // export operation, so this exports what has been fetched into the table.\n const handleExport = () => {\n const header = [\n \"Date\",\n \"Project\",\n \"Task/Description\",\n \"Duration (hours)\",\n \"Billable\",\n \"Status\",\n ];\n const rows = entries.map((entry) => [\n formatDate(entry.startTime),\n entry.project?.name ?? \"No Project\",\n entry.task?.title ?? entry.description ?? \"\",\n ((entry.duration ?? 0) / 3600).toFixed(2),\n entry.billable ? \"Yes\" : \"No\",\n entry.isRunning ? \"running\" : \"completed\",\n ]);\n const escape = (value: string) => `\"${value.replace(/\"/g, '\"\"')}\"`;\n const csv = [header, ...rows]\n .map((row) => row.map((cell: string) => escape(String(cell))).join(\",\"))\n .join(\"\\n\");\n const blob = new Blob([csv], { type: \"text/csv;charset=utf-8;\" });\n const url = URL.createObjectURL(blob);\n const link = document.createElement(\"a\");\n link.href = url;\n link.download = `time-entries-${new Date().toISOString().slice(0, 10)}.csv`;\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n URL.revokeObjectURL(url);\n };\n\n if (error) {\n return (\n <PageLayout\n title=\"Time Entries\"\n description=\"View and manage all time entries\"\n >\n <div className=\"rounded-xl border border-status-error-bg/40 bg-status-error-bg p-6 text-sm text-status-error-text\">\n Failed to load time entries. Please try again later.\n </div>\n </PageLayout>\n );\n }\n\n return (\n <PageLayout\n title=\"Time Entries\"\n description=\"View and manage all time entries\"\n purpose=\"Every tracked block of work in one auditable list — filter, correct and confirm entries here before they roll into timesheets, approvals and client invoices.\"\n actions={\n <div className=\"flex items-center gap-2\">\n <button\n onClick={() => {\n setDraftBillable(\n filter.billable === undefined\n ? \"all\"\n : filter.billable\n ? \"yes\"\n : \"no\",\n );\n setDraftProjectId(filter.projectId ?? \"\");\n setDraftSearch(filter.search ?? \"\");\n setFilterOpen(true);\n }}\n className={`inline-flex items-center gap-1.5 rounded-md border px-3 py-2 text-sm font-medium hover:bg-bg-sunken/50 ${hasFilter ? \"border-action-primary-border text-primary\" : \"border-border-subtle text-text-primary\"}`}\n >\n <Filter className=\"h-4 w-4\" />\n Filter{hasFilter ? ` (${Object.keys(filter).length})` : \"\"}\n </button>\n <button\n onClick={handleExport}\n disabled={entries.length === 0}\n className=\"inline-flex items-center gap-1.5 rounded-md border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken/50 disabled:opacity-50\"\n >\n <Download className=\"h-4 w-4\" />\n Export\n </button>\n <button\n onClick={openCreate}\n className=\"inline-flex items-center gap-1.5 rounded-md bg-action-primary-bg px-3 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90\"\n >\n <Plus className=\"h-4 w-4\" />\n New Entry\n </button>\n </div>\n }\n >\n {loading && entries.length === 0 ? (\n <LoadingSkeleton variant=\"table\" count={5} />\n ) : entries.length === 0 ? (\n <EmptyState\n illustration=\"empty-data\"\n title=\"No time entries found\"\n description=\"Track time with a timer or add a manual entry — your entries will appear here.\"\n action={\n <button\n onClick={openCreate}\n className=\"inline-flex items-center gap-1.5 rounded-md bg-action-primary-bg px-3 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90\"\n >\n <Plus className=\"h-4 w-4\" />\n New Entry\n </button>\n }\n />\n ) : (\n <>\n <GlassCard treatment=\"glass\" glow className=\"overflow-hidden\">\n <div className=\"overflow-x-auto\">\n <table className=\"w-full\">\n <thead>\n <tr className=\"border-b border-border-subtle\">\n <th className=\"px-4 py-3 text-start text-xs font-medium text-text-secondary\">\n Entry\n </th>\n <th className=\"px-4 py-3 text-start text-xs font-medium text-text-secondary\">\n Project\n </th>\n <th className=\"px-4 py-3 text-start text-xs font-medium text-text-secondary\">\n Duration\n </th>\n <th className=\"px-4 py-3 text-start text-xs font-medium text-text-secondary\">\n Billable\n </th>\n <th className=\"px-4 py-3 text-start text-xs font-medium text-text-secondary\">\n Status\n </th>\n <th className=\"px-4 py-3 text-end text-xs font-medium text-text-secondary\">\n Actions\n </th>\n </tr>\n </thead>\n <tbody className=\"divide-y divide-border\">\n {entries.map((entry: TimeEntryFieldsFragment) => (\n <tr\n key={entry.id}\n className=\"hover:bg-bg-sunken/50 transition-colors\"\n >\n <td className=\"px-4 py-3\">\n <p className=\"text-sm font-medium text-text-primary\">\n {entry.task?.title ??\n entry.description ??\n \"No description\"}\n </p>\n <p className=\"text-xs text-text-secondary\">\n {formatDate(entry.startTime)}\n </p>\n </td>\n <td className=\"px-4 py-3\">\n <div className=\"flex items-center gap-2\">\n <span className=\"flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-action-primary-bg/10 text-xs font-semibold text-primary\">\n {getInitials(entry.project?.name ?? \"No Project\")}\n </span>\n <span className=\"text-sm font-medium text-text-primary\">\n {entry.project?.name ?? \"No Project\"}\n </span>\n </div>\n </td>\n <td className=\"px-4 py-3 text-sm font-mono text-text-primary\">\n {formatHours((entry.duration ?? 0) / 3600)}\n </td>\n <td className=\"px-4 py-3\">\n <StatusBadge\n label={entry.billable ? \"Billable\" : \"Non-billable\"}\n variant={entry.billable ? \"success\" : \"muted\"}\n />\n </td>\n <td className=\"px-4 py-3\">\n <StatusBadge\n status={entry.isRunning ? \"running\" : \"completed\"}\n dot={entry.isRunning}\n label={entry.isRunning ? \"running\" : \"completed\"}\n />\n </td>\n <td className=\"px-4 py-3\">\n <div className=\"flex items-center justify-end gap-1\">\n <button\n onClick={() => openEdit(entry)}\n title=\"Edit entry\"\n aria-label=\"Edit entry\"\n className=\"rounded-md p-1.5 text-text-secondary hover:bg-bg-sunken hover:text-text-primary\"\n >\n <Pencil className=\"h-4 w-4\" />\n </button>\n <button\n onClick={() => handleDuplicate(entry)}\n disabled={duplicating}\n title=\"Duplicate entry\"\n aria-label=\"Duplicate entry\"\n className=\"rounded-md p-1.5 text-text-secondary hover:bg-bg-sunken hover:text-text-primary disabled:opacity-50\"\n >\n <Copy className=\"h-4 w-4\" />\n </button>\n <button\n onClick={() => setDeleteEntry(entry)}\n title=\"Delete entry\"\n aria-label=\"Delete entry\"\n className=\"rounded-md p-1.5 text-status-error-text hover:bg-status-error-bg\"\n >\n <Trash2 className=\"h-4 w-4\" />\n </button>\n </div>\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </GlassCard>\n\n <div className=\"mt-4 flex items-center justify-between\">\n <p className=\"text-xs text-text-secondary\">\n Showing {entries.length} of {total}\n </p>\n {hasMore && (\n <button\n onClick={handleLoadMore}\n disabled={loadingMore}\n className=\"inline-flex items-center gap-1.5 rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken/50 disabled:opacity-50\"\n >\n {loadingMore ? \"Loading...\" : \"Load more\"}\n </button>\n )}\n </div>\n </>\n )}\n\n {/* Create modal */}\n <Modal\n open={createOpen}\n onClose={() => setCreateOpen(false)}\n title=\"New Time Entry\"\n description=\"Manually log a block of work.\"\n size=\"lg\"\n footer={\n <>\n <button\n onClick={() => setCreateOpen(false)}\n className=\"rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken/50\"\n >\n Cancel\n </button>\n <button\n onClick={handleCreate}\n disabled={creating || !createForm.startTime}\n className=\"rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-50\"\n >\n {creating ? \"Saving...\" : \"Create Entry\"}\n </button>\n </>\n }\n >\n {createError && (\n <div className=\"mb-4 rounded-lg border border-status-error-bg/40 bg-status-error-bg p-3 text-sm text-status-error-text\">\n Failed to create entry. Please try again.\n </div>\n )}\n <EntryFormFields\n form={createForm}\n onChange={(patch) => setCreateForm((f) => ({ ...f, ...patch }))}\n projects={projects}\n />\n </Modal>\n\n {/* Edit modal */}\n <Modal\n open={Boolean(editEntry)}\n onClose={() => setEditEntry(null)}\n title=\"Edit Time Entry\"\n description=\"Correct the details of this logged block.\"\n size=\"lg\"\n footer={\n <>\n <button\n onClick={() => setEditEntry(null)}\n className=\"rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken/50\"\n >\n Cancel\n </button>\n <button\n onClick={handleUpdate}\n disabled={updating || !editForm.startTime}\n className=\"rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-50\"\n >\n {updating ? \"Saving...\" : \"Save Changes\"}\n </button>\n </>\n }\n >\n {updateError && (\n <div className=\"mb-4 rounded-lg border border-status-error-bg/40 bg-status-error-bg p-3 text-sm text-status-error-text\">\n Failed to update entry. Please try again.\n </div>\n )}\n <EntryFormFields\n form={editForm}\n onChange={(patch) => setEditForm((f) => ({ ...f, ...patch }))}\n projects={projects}\n />\n </Modal>\n\n {/* Delete confirm modal */}\n <Modal\n open={Boolean(deleteEntry)}\n onClose={() => setDeleteEntry(null)}\n title=\"Delete time entry?\"\n description=\"This permanently removes the entry. It cannot be undone.\"\n footer={\n <>\n <button\n onClick={() => setDeleteEntry(null)}\n className=\"rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken/50\"\n >\n Cancel\n </button>\n <button\n onClick={handleDelete}\n disabled={deleting}\n className=\"rounded-md bg-action-danger-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-danger-bg/90 disabled:opacity-50\"\n >\n {deleting ? \"Deleting...\" : \"Delete\"}\n </button>\n </>\n }\n >\n <p className=\"text-sm text-text-secondary\">\n Delete the entry for{\" \"}\n <span className=\"font-medium text-text-primary\">\n {deleteEntry?.project?.name ??\n deleteEntry?.description ??\n \"this block of work\"}\n </span>\n ?\n </p>\n </Modal>\n\n {/* Filter modal */}\n <Modal\n open={filterOpen}\n onClose={() => setFilterOpen(false)}\n title=\"Filter entries\"\n description=\"Narrow the list to what you need.\"\n footer={\n <>\n <button\n onClick={clearFilter}\n className=\"rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken/50\"\n >\n Clear\n </button>\n <button\n onClick={applyFilter}\n className=\"rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90\"\n >\n Apply\n </button>\n </>\n }\n >\n <div className=\"space-y-4\">\n <div>\n <label className=\"block text-sm font-medium text-text-primary\">\n Search\n </label>\n <input\n type=\"text\"\n placeholder=\"Description contains...\"\n value={draftSearch}\n onChange={(e) => setDraftSearch(e.target.value)}\n className=\"mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary\"\n />\n </div>\n <div>\n <label className=\"block text-sm font-medium text-text-primary\">\n Project\n </label>\n <select\n value={draftProjectId}\n onChange={(e) => setDraftProjectId(e.target.value)}\n className=\"mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n >\n <option value=\"\">All Projects</option>\n {projects.map((project) => (\n <option key={project.id} value={project.id}>\n {project.name}\n </option>\n ))}\n </select>\n </div>\n <div>\n <label className=\"block text-sm font-medium text-text-primary\">\n Billable\n </label>\n <select\n value={draftBillable}\n onChange={(e) =>\n setDraftBillable(e.target.value as \"all\" | \"yes\" | \"no\")\n }\n className=\"mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n >\n <option value=\"all\">All</option>\n <option value=\"yes\">Billable only</option>\n <option value=\"no\">Non-billable only</option>\n </select>\n </div>\n </div>\n </Modal>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAyBA,IAAMC,IAAY;AAGlB,SAASC,EAAa,GAA6B;CACjD,IAAI,CAACC,GAAK,OAAO;CACjB,IAAMC,IAAI,IAAI,KAAKD,CAAG;CAGtB,OAFI,OAAO,MAAMC,EAAE,QAAQ,C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,EAEb,CACT,CACK;MACL,CAAA,CAAA,EAAA,CAAA;MACL,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,SAAD;OAAO,WAAU;OAA8C,UAAA;MAExD,CAAA,GACP,kBAAC,UAAD;OACE,OAAOO;OACP,WAAW,MACTC,EAAiB,EAAE,OAAO,KAA6B;OAEzD,WAAU;OALZ,UAAA;QAOE,kBAAC,UAAD;SAAQ,OAAM;SAAM,UAAA;QAAW,CAAA;QAC/B,kBAAC,UAAD;SAAQ,OAAM;SAAM,UAAA;QAAqB,CAAA;QACzC,kBAAC,UAAD;SAAQ,OAAM;SAAK,UAAA;QAAyB,CAAA;OACtC;MACL,CAAA,CAAA,EAAA,CAAA;KACF;;GACA,CAAA;EACG;;AAEhB"}
@@ -174,7 +174,7 @@ function w() {
174
174
  })]
175
175
  }),
176
176
  /* @__PURE__ */ b("p", {
177
- className: "ml-2 shrink-0 font-mono text-sm font-medium text-text-primary",
177
+ className: "ms-2 shrink-0 font-mono text-sm font-medium text-text-primary",
178
178
  children: s(e.elapsedSeconds)
179
179
  })
180
180
  ]
@@ -1 +1 @@
1
- {"version":3,"file":"TimerPage.js","names":["_Fragment","TimerPage","useTimeCampusStore","navigate","useTimeCampusNavigate","t","useTr","startOpen","setStartOpen","useState","description","setDescription","projectId","setProjectId","billable","setBillable","resetTarget","setResetTarget","runningData","runningLoading","refetchRunning","useListRunningTimersQuery","projectsData","useListProjectsQuery","projects","runningTimers","serverTimer","refetchAll","ListRunningTimersDocument","ListTimeEntriesDocument","GetTimeEntryStatsDocument","startTimerMutation","starting","startError","useStartTimerMutation","stopTimerMutation","stopping","useStopTimerMutation","analytics","useTimeCampusAnalytics","deleteTimeEntry","deleting","useDeleteTimeEntryMutation","useEffect","syncTimerFromServer","activeTimer","interval","tickTimer","handleStart","started","handleStop","stopped","handleReset","isRunning","PageLayout","PhoneViewLink","NextSteps","GlassCard","formatTimerDuration","Square","Play","RotateCcw","StatusBadge","LoadingSkeleton","EmptyState","getInitials","timer","Modal","Fragment","project"],"sources":["../../../../src/timecampus/pages/time/TimerPage.tsx"],"sourcesContent":["import { useEffect, useState } from \"react\";\nimport { PhoneViewLink } from \"../mobile/MobileScreen\";\nimport { Play, Square, RotateCcw } from \"lucide-react\";\nimport { GlassCard, NextSteps } from \"@burdenoff/fe-libs/ui\";\nimport { PageLayout } from \"../../components/PageLayout\";\nimport { Modal } from \"../../components/Modal\";\nimport { EmptyState } from \"../../components/EmptyState\";\nimport { LoadingSkeleton } from \"../../components/LoadingSkeleton\";\nimport { StatusBadge } from \"../../components/StatusBadge\";\nimport { useTimeCampusNavigate } from \"../../providers/TimeCampusProvider\";\nimport { formatTimerDuration, getInitials } from \"../../utils/helpers\";\nimport { useTimeCampusStore } from \"../../store/timecampusStore\";\nimport { useTr } from \"../../hooks\";\nimport {\n useListRunningTimersQuery,\n useStartTimerMutation,\n useStopTimerMutation,\n useDeleteTimeEntryMutation,\n useListProjectsQuery,\n ListRunningTimersDocument,\n ListTimeEntriesDocument,\n GetTimeEntryStatsDocument,\n type ListRunningTimersQuery,\n type ListProjectsQuery,\n} from \"@/generated/wspace-operations\";\nimport { useTimeCampusAnalytics } from \"../../analytics\";\n\ntype RunningTimerItem = ListRunningTimersQuery[\"runningTimers\"][number];\ntype ProjectOption = ListProjectsQuery[\"projects\"][\"items\"][number];\n\nexport function TimerPage() {\n const { activeTimer, tickTimer, syncTimerFromServer } = useTimeCampusStore();\n const navigate = useTimeCampusNavigate();\n const t = useTr();\n\n const [startOpen, setStartOpen] = useState(false);\n const [description, setDescription] = useState(\"\");\n const [projectId, setProjectId] = useState(\"\");\n const [billable, setBillable] = useState(false);\n const [resetTarget, setResetTarget] = useState<RunningTimerItem | null>(null);\n\n const {\n data: runningData,\n loading: runningLoading,\n refetch: refetchRunning,\n } = useListRunningTimersQuery({ fetchPolicy: \"cache-and-network\" });\n\n const { data: projectsData } = useListProjectsQuery({\n variables: { pagination: { limit: 50 } },\n });\n const projects: ProjectOption[] = projectsData?.projects?.items ?? [];\n\n const runningTimers = runningData?.runningTimers ?? [];\n const serverTimer = runningTimers[0] ?? null;\n\n const refetchAll = [\n { query: ListRunningTimersDocument },\n {\n query: ListTimeEntriesDocument,\n variables: { pagination: { limit: 50 } },\n },\n { query: GetTimeEntryStatsDocument },\n ];\n\n const [startTimerMutation, { loading: starting, error: startError }] =\n useStartTimerMutation({ refetchQueries: refetchAll });\n const [stopTimerMutation, { loading: stopping }] = useStopTimerMutation({\n refetchQueries: refetchAll,\n });\n const analytics = useTimeCampusAnalytics();\n const [deleteTimeEntry, { loading: deleting }] = useDeleteTimeEntryMutation({\n refetchQueries: refetchAll,\n });\n\n // Backend is the source of truth for whether a timer is running — mirror the\n // server running timer into the local display store whenever it changes.\n useEffect(() => {\n if (serverTimer) {\n syncTimerFromServer({\n timeEntryId: serverTimer.timeEntry.id,\n elapsedSeconds: serverTimer.elapsedSeconds,\n projectId: serverTimer.timeEntry.projectId ?? undefined,\n taskId: serverTimer.timeEntry.taskId ?? undefined,\n description: serverTimer.timeEntry.description ?? undefined,\n });\n } else if (!runningLoading) {\n syncTimerFromServer(null);\n }\n // Only re-sync when the server's running timer identity/elapsed changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [serverTimer?.timeEntry.id, serverTimer?.elapsedSeconds, runningLoading]);\n\n // Local ticking display for the live seconds counter.\n useEffect(() => {\n if (!activeTimer?.isRunning) return;\n const interval = setInterval(() => tickTimer(), 1000);\n return () => clearInterval(interval);\n }, [activeTimer?.isRunning, tickTimer]);\n\n const handleStart = async () => {\n const result = await startTimerMutation({\n variables: {\n input: {\n description: description.trim() || undefined,\n projectId: projectId || undefined,\n billable,\n source: \"timer\",\n },\n },\n });\n const started = result.data?.startTimer;\n if (started) {\n analytics.timerStarted({\n timeEntryId: started.id,\n surface: \"timer_page\",\n hasProject: Boolean(started.projectId),\n });\n }\n setStartOpen(false);\n setDescription(\"\");\n setProjectId(\"\");\n setBillable(false);\n await refetchRunning();\n };\n\n const handleStop = async () => {\n if (!serverTimer) return;\n const result = await stopTimerMutation({\n variables: { id: serverTimer.timeEntry.id },\n });\n const stopped = result.data?.stopTimer;\n if (stopped) {\n analytics.timerStopped({\n timeEntryId: stopped.id,\n surface: \"timer_page\",\n hasProject: Boolean(stopped.projectId),\n });\n }\n await refetchRunning();\n };\n\n const handleReset = async () => {\n if (!resetTarget) return;\n // Discard the in-progress session: stop it, then delete the entry.\n await stopTimerMutation({ variables: { id: resetTarget.timeEntry.id } });\n await deleteTimeEntry({ variables: { id: resetTarget.timeEntry.id } });\n setResetTarget(null);\n await refetchRunning();\n };\n\n const isRunning = Boolean(serverTimer);\n\n return (\n <PageLayout\n title={t(\"timecampus.timer.title\", \"Timer\")}\n description={t(\n \"timecampus.timer.description\",\n \"Focus timer for deep work sessions\",\n )}\n purpose={t(\n \"timecampus.timer.purpose\",\n \"A single, distraction-free stopwatch for the task in front of you — start it when you begin focused work and it logs the session as a time entry you can attribute to a project later.\",\n )}\n >\n <div className=\"mx-auto max-w-lg\">\n <PhoneViewLink path=\"/mobile/timer\" />\n <NextSteps\n storageKey=\"timecampus-timer\"\n className=\"mb-6\"\n steps={[\n {\n id: \"start\",\n label: isRunning\n ? t(\n \"timecampus.timer.nextSteps.stopRunning\",\n \"Stop the running timer\",\n )\n : t(\"timecampus.timer.nextSteps.start\", \"Start the timer\"),\n description: isRunning\n ? t(\n \"timecampus.timer.nextSteps.stopDescription\",\n \"End this session and save it as a time entry.\",\n )\n : t(\n \"timecampus.timer.nextSteps.startDescription\",\n \"Begin tracking the task you're working on right now.\",\n ),\n onClick: () => (isRunning ? handleStop() : setStartOpen(true)),\n },\n {\n id: \"assign-project\",\n label: t(\n \"timecampus.timer.nextSteps.assignProject\",\n \"Assign work to a project\",\n ),\n description: t(\n \"timecampus.timer.nextSteps.assignDescription\",\n \"Pick a project so this time bills correctly.\",\n ),\n onClick: () => navigate(\"/projects\"),\n },\n {\n id: \"review-entries\",\n label: t(\n \"timecampus.timer.nextSteps.review\",\n \"Review your time entries\",\n ),\n description: t(\n \"timecampus.timer.nextSteps.reviewDescription\",\n \"Check and tidy everything you've logged.\",\n ),\n onClick: () => navigate(\"/time/entries\"),\n },\n ]}\n />\n <GlassCard treatment=\"glass\" glow className=\"p-6 text-center sm:p-8\">\n <p className=\"font-mono text-5xl font-bold tabular-nums text-text-primary sm:text-6xl\">\n {activeTimer\n ? formatTimerDuration(activeTimer.seconds)\n : t(\"timecampus.timer.elapsedDefault\", \"00:00:00\")}\n </p>\n {activeTimer?.description && (\n <p className=\"mt-2 text-sm text-text-secondary\">\n {activeTimer.description}\n </p>\n )}\n <div className=\"mt-6 flex flex-wrap items-center justify-center gap-3\">\n {isRunning ? (\n <button\n onClick={handleStop}\n disabled={stopping}\n className=\"inline-flex items-center gap-2 rounded-md bg-action-danger-bg px-6 py-3 text-sm font-medium text-action-primary-text hover:bg-action-danger-bg/90 disabled:opacity-50\"\n >\n <Square className=\"h-4 w-4\" />\n {stopping\n ? t(\"timecampus.timer.stopping\", \"Stopping...\")\n : t(\"timecampus.timer.stop\", \"Stop\")}\n </button>\n ) : (\n <button\n onClick={() => setStartOpen(true)}\n disabled={starting}\n className=\"inline-flex items-center gap-2 rounded-md bg-action-primary-bg px-6 py-3 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-50\"\n >\n <Play className=\"h-4 w-4\" />\n {t(\"timecampus.timer.start\", \"Start\")}\n </button>\n )}\n <button\n onClick={() => serverTimer && setResetTarget(serverTimer)}\n disabled={!isRunning || deleting}\n className=\"inline-flex items-center gap-2 rounded-md border border-border-subtle px-4 py-3 text-sm font-medium text-text-primary hover:bg-bg-sunken/50 disabled:opacity-50\"\n title={t(\n \"timecampus.timer.resetTooltip\",\n \"Discard the running timer without saving\",\n )}\n >\n <RotateCcw className=\"h-4 w-4\" />\n {t(\"timecampus.timer.reset\", \"Reset\")}\n </button>\n </div>\n </GlassCard>\n\n {/* Server-side running timers */}\n <GlassCard treatment=\"glass\" className=\"mt-6 p-6\">\n <div className=\"mb-4 flex items-center justify-between\">\n <h3 className=\"text-sm font-semibold text-text-primary\">\n {t(\"timecampus.timer.runningTimers.title\", \"Running Timers\")}\n </h3>\n {runningTimers.length > 0 && (\n <StatusBadge\n label={t(\n \"timecampus.timer.runningTimers.active\",\n \"{{count}} active\",\n { count: runningTimers.length },\n )}\n variant=\"success\"\n dot\n />\n )}\n </div>\n {runningLoading && runningTimers.length === 0 ? (\n <LoadingSkeleton variant=\"list\" count={2} />\n ) : runningTimers.length === 0 ? (\n <EmptyState\n illustration=\"empty-sessions\"\n title={t(\n \"timecampus.timer.runningTimers.emptyTitle\",\n \"No active timers on the server\",\n )}\n description={t(\n \"timecampus.timer.runningTimers.emptyDescription\",\n \"Timers you start sync here so you can pick them up on any device.\",\n )}\n />\n ) : (\n <div className=\"flex flex-col gap-2\">\n {runningTimers.map((timer: RunningTimerItem) => (\n <div\n key={timer.timeEntry.id}\n className=\"flex items-center gap-3 rounded-lg border border-border-subtle bg-bg-surface p-3\"\n >\n <span className=\"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-action-primary-bg/10 text-xs font-semibold text-primary\">\n {getInitials(\n timer.timeEntry.project?.name ??\n t(\n \"timecampus.timer.runningTimers.noProject\",\n \"No Project\",\n ),\n )}\n </span>\n <div className=\"min-w-0 flex-1\">\n <p className=\"truncate text-sm font-medium text-text-primary\">\n {timer.timeEntry.project?.name ??\n t(\n \"timecampus.timer.runningTimers.noProject\",\n \"No Project\",\n )}\n </p>\n <p className=\"truncate text-xs text-text-secondary\">\n {timer.timeEntry.description ??\n t(\n \"timecampus.timer.runningTimers.noDescription\",\n \"No description\",\n )}\n </p>\n </div>\n <p className=\"ml-2 shrink-0 font-mono text-sm font-medium text-text-primary\">\n {formatTimerDuration(timer.elapsedSeconds)}\n </p>\n </div>\n ))}\n </div>\n )}\n </GlassCard>\n </div>\n\n {/* Start timer modal */}\n <Modal\n open={startOpen}\n onClose={() => setStartOpen(false)}\n title={t(\"timecampus.timer.modal.startTitle\", \"Start a timer\")}\n description={t(\n \"timecampus.timer.modal.startDescription\",\n \"Track the task you're working on right now.\",\n )}\n footer={\n <>\n <button\n onClick={() => setStartOpen(false)}\n className=\"rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken/50\"\n >\n {t(\"timecampus.timer.modal.cancel\", \"Cancel\")}\n </button>\n <button\n onClick={handleStart}\n disabled={starting}\n className=\"rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-50\"\n >\n {starting\n ? t(\"timecampus.timer.modal.starting\", \"Starting...\")\n : t(\"timecampus.timer.modal.startTimer\", \"Start Timer\")}\n </button>\n </>\n }\n >\n {startError && (\n <div className=\"mb-4 rounded-lg border border-status-error-bg/40 bg-status-error-bg p-3 text-sm text-status-error-text\">\n {t(\n \"timecampus.timer.modal.startError\",\n \"Failed to start the timer. Please try again.\",\n )}\n </div>\n )}\n <div className=\"space-y-4\">\n <div>\n <label className=\"block text-sm font-medium text-text-primary\">\n {t(\n \"timecampus.timer.modal.descriptionLabel\",\n \"What are you working on?\",\n )}\n </label>\n <input\n type=\"text\"\n placeholder={t(\n \"timecampus.timer.modal.descriptionPlaceholder\",\n \"Description\",\n )}\n value={description}\n onChange={(e) => setDescription(e.target.value)}\n className=\"mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary\"\n />\n </div>\n <div>\n <label className=\"block text-sm font-medium text-text-primary\">\n {t(\"timecampus.timer.modal.projectLabel\", \"Project\")}\n </label>\n <select\n value={projectId}\n onChange={(e) => setProjectId(e.target.value)}\n className=\"mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n >\n <option value=\"\">\n {t(\"timecampus.timer.modal.noProject\", \"No Project\")}\n </option>\n {projects.map((project) => (\n <option key={project.id} value={project.id}>\n {project.name}\n </option>\n ))}\n </select>\n </div>\n <label className=\"flex items-center gap-2 text-sm text-text-primary\">\n <input\n type=\"checkbox\"\n checked={billable}\n onChange={(e) => setBillable(e.target.checked)}\n className=\"h-4 w-4 rounded border-border-subtle\"\n />\n {t(\"timecampus.timer.modal.billable\", \"Billable\")}\n </label>\n </div>\n </Modal>\n\n {/* Reset / discard confirm modal */}\n <Modal\n open={Boolean(resetTarget)}\n onClose={() => setResetTarget(null)}\n title={t(\n \"timecampus.timer.modal.discardTitle\",\n \"Discard running timer?\",\n )}\n description={t(\n \"timecampus.timer.modal.discardDescription\",\n \"This stops the timer and deletes the in-progress entry. It cannot be undone.\",\n )}\n footer={\n <>\n <button\n onClick={() => setResetTarget(null)}\n className=\"rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken/50\"\n >\n {t(\"timecampus.timer.modal.cancel\", \"Cancel\")}\n </button>\n <button\n onClick={handleReset}\n disabled={stopping || deleting}\n className=\"rounded-md bg-action-danger-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-danger-bg/90 disabled:opacity-50\"\n >\n {stopping || deleting\n ? t(\"timecampus.timer.modal.discarding\", \"Discarding...\")\n : t(\"timecampus.timer.modal.discard\", \"Discard\")}\n </button>\n </>\n }\n >\n <p className=\"text-sm text-text-secondary\">\n {t(\"timecampus.timer.modal.discardMessagePrefix\", \"The timer for\")}{\" \"}\n <span className=\"font-medium text-text-primary\">\n {resetTarget?.timeEntry.project?.name ??\n resetTarget?.timeEntry.description ??\n t(\"timecampus.timer.modal.sessionFallback\", \"this session\")}\n </span>{\" \"}\n {t(\n \"timecampus.timer.modal.discardMessageSuffix\",\n \"will be discarded.\",\n )}\n </p>\n </Modal>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA8BA,SAAgBC,IAAY;CAC1B,IAAM,EAAE,gBAAa,cAAW,2BAAwBC,EAAmB,GACrEC,IAAWC,EAAsB,GACjCC,IAAIC,EAAM,GAEV,CAACC,IAAWC,KA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AAC,UAAD;QAAyB,OAAO6C,EAAQ;QACrC,UAAAA,EAAQ;OACH,GAFKA,EAAQ,EAEb,CACT,CACK;MACL,CAAA,CAAA,EAAA,CAAA;MACL,kBAAC,SAAD;OAAO,WAAU;OAAjB,UAAA,CACE,kBAAC,SAAD;QACE,MAAK;QACL,SAASvD;QACT,WAAW,MAAMC,EAAY,EAAE,OAAO,OAAO;QAC7C,WAAU;OACX,CAAA,GACAV,EAAE,mCAAmC,UAAU,CAC3C;;KACJ;IACA,CAAA,CAAA;;GAGP,kBAAC8D,GAAD;IACE,MAAM,EAAQnD;IACd,eAAeC,EAAe,IAAI;IAClC,OAAOZ,EACL,uCACA,wBACF;IACA,aAAaA,EACX,6CACA,8EACF;IACA,QACE,kBAAAL,GAAA,EAAA,UAAA,CACE,kBAAC,UAAD;KACE,eAAeiB,EAAe,IAAI;KAClC,WAAU;KAET,UAAAZ,EAAE,iCAAiC,QAAQ;IACtC,CAAA,GACR,kBAAC,UAAD;KACE,SAAS+C;KACT,UAAUhB,KAAYK;KACtB,WAAU;KAET,UAAAL,KAAYK,IACTpC,EAAE,qCAAqC,eAAe,IACtDA,EAAE,kCAAkC,SAAS;IAC3C,CAAA,CACR,EAAA,CAAA;IAGJ,UAAA,kBAAC,KAAD;KAAG,WAAU;KAAb,UAAA;MACGA,EAAE,+CAA+C,eAAe;MAAG;MACpE,kBAAC,QAAD;OAAM,WAAU;OACb,UAAAW,GAAa,UAAU,SAAS,QAC/BA,GAAa,UAAU,eACvBX,EAAE,0CAA0C,cAAc;MACxD,CAAA;MAAE;MACPA,EACC,+CACA,oBACF;KACC;;GACE,CAAA;EACG;;AAEhB"}
1
+ {"version":3,"file":"TimerPage.js","names":["_Fragment","TimerPage","useTimeCampusStore","navigate","useTimeCampusNavigate","t","useTr","startOpen","setStartOpen","useState","description","setDescription","projectId","setProjectId","billable","setBillable","resetTarget","setResetTarget","runningData","runningLoading","refetchRunning","useListRunningTimersQuery","projectsData","useListProjectsQuery","projects","runningTimers","serverTimer","refetchAll","ListRunningTimersDocument","ListTimeEntriesDocument","GetTimeEntryStatsDocument","startTimerMutation","starting","startError","useStartTimerMutation","stopTimerMutation","stopping","useStopTimerMutation","analytics","useTimeCampusAnalytics","deleteTimeEntry","deleting","useDeleteTimeEntryMutation","useEffect","syncTimerFromServer","activeTimer","interval","tickTimer","handleStart","started","handleStop","stopped","handleReset","isRunning","PageLayout","PhoneViewLink","NextSteps","GlassCard","formatTimerDuration","Square","Play","RotateCcw","StatusBadge","LoadingSkeleton","EmptyState","getInitials","timer","Modal","Fragment","project"],"sources":["../../../../src/timecampus/pages/time/TimerPage.tsx"],"sourcesContent":["import { useEffect, useState } from \"react\";\nimport { PhoneViewLink } from \"../mobile/MobileScreen\";\nimport { Play, Square, RotateCcw } from \"lucide-react\";\nimport { GlassCard, NextSteps } from \"@burdenoff/fe-libs/ui\";\nimport { PageLayout } from \"../../components/PageLayout\";\nimport { Modal } from \"../../components/Modal\";\nimport { EmptyState } from \"../../components/EmptyState\";\nimport { LoadingSkeleton } from \"../../components/LoadingSkeleton\";\nimport { StatusBadge } from \"../../components/StatusBadge\";\nimport { useTimeCampusNavigate } from \"../../providers/TimeCampusProvider\";\nimport { formatTimerDuration, getInitials } from \"../../utils/helpers\";\nimport { useTimeCampusStore } from \"../../store/timecampusStore\";\nimport { useTr } from \"../../hooks\";\nimport {\n useListRunningTimersQuery,\n useStartTimerMutation,\n useStopTimerMutation,\n useDeleteTimeEntryMutation,\n useListProjectsQuery,\n ListRunningTimersDocument,\n ListTimeEntriesDocument,\n GetTimeEntryStatsDocument,\n type ListRunningTimersQuery,\n type ListProjectsQuery,\n} from \"@/generated/wspace-operations\";\nimport { useTimeCampusAnalytics } from \"../../analytics\";\n\ntype RunningTimerItem = ListRunningTimersQuery[\"runningTimers\"][number];\ntype ProjectOption = ListProjectsQuery[\"projects\"][\"items\"][number];\n\nexport function TimerPage() {\n const { activeTimer, tickTimer, syncTimerFromServer } = useTimeCampusStore();\n const navigate = useTimeCampusNavigate();\n const t = useTr();\n\n const [startOpen, setStartOpen] = useState(false);\n const [description, setDescription] = useState(\"\");\n const [projectId, setProjectId] = useState(\"\");\n const [billable, setBillable] = useState(false);\n const [resetTarget, setResetTarget] = useState<RunningTimerItem | null>(null);\n\n const {\n data: runningData,\n loading: runningLoading,\n refetch: refetchRunning,\n } = useListRunningTimersQuery({ fetchPolicy: \"cache-and-network\" });\n\n const { data: projectsData } = useListProjectsQuery({\n variables: { pagination: { limit: 50 } },\n });\n const projects: ProjectOption[] = projectsData?.projects?.items ?? [];\n\n const runningTimers = runningData?.runningTimers ?? [];\n const serverTimer = runningTimers[0] ?? null;\n\n const refetchAll = [\n { query: ListRunningTimersDocument },\n {\n query: ListTimeEntriesDocument,\n variables: { pagination: { limit: 50 } },\n },\n { query: GetTimeEntryStatsDocument },\n ];\n\n const [startTimerMutation, { loading: starting, error: startError }] =\n useStartTimerMutation({ refetchQueries: refetchAll });\n const [stopTimerMutation, { loading: stopping }] = useStopTimerMutation({\n refetchQueries: refetchAll,\n });\n const analytics = useTimeCampusAnalytics();\n const [deleteTimeEntry, { loading: deleting }] = useDeleteTimeEntryMutation({\n refetchQueries: refetchAll,\n });\n\n // Backend is the source of truth for whether a timer is running — mirror the\n // server running timer into the local display store whenever it changes.\n useEffect(() => {\n if (serverTimer) {\n syncTimerFromServer({\n timeEntryId: serverTimer.timeEntry.id,\n elapsedSeconds: serverTimer.elapsedSeconds,\n projectId: serverTimer.timeEntry.projectId ?? undefined,\n taskId: serverTimer.timeEntry.taskId ?? undefined,\n description: serverTimer.timeEntry.description ?? undefined,\n });\n } else if (!runningLoading) {\n syncTimerFromServer(null);\n }\n // Only re-sync when the server's running timer identity/elapsed changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [serverTimer?.timeEntry.id, serverTimer?.elapsedSeconds, runningLoading]);\n\n // Local ticking display for the live seconds counter.\n useEffect(() => {\n if (!activeTimer?.isRunning) return;\n const interval = setInterval(() => tickTimer(), 1000);\n return () => clearInterval(interval);\n }, [activeTimer?.isRunning, tickTimer]);\n\n const handleStart = async () => {\n const result = await startTimerMutation({\n variables: {\n input: {\n description: description.trim() || undefined,\n projectId: projectId || undefined,\n billable,\n source: \"timer\",\n },\n },\n });\n const started = result.data?.startTimer;\n if (started) {\n analytics.timerStarted({\n timeEntryId: started.id,\n surface: \"timer_page\",\n hasProject: Boolean(started.projectId),\n });\n }\n setStartOpen(false);\n setDescription(\"\");\n setProjectId(\"\");\n setBillable(false);\n await refetchRunning();\n };\n\n const handleStop = async () => {\n if (!serverTimer) return;\n const result = await stopTimerMutation({\n variables: { id: serverTimer.timeEntry.id },\n });\n const stopped = result.data?.stopTimer;\n if (stopped) {\n analytics.timerStopped({\n timeEntryId: stopped.id,\n surface: \"timer_page\",\n hasProject: Boolean(stopped.projectId),\n });\n }\n await refetchRunning();\n };\n\n const handleReset = async () => {\n if (!resetTarget) return;\n // Discard the in-progress session: stop it, then delete the entry.\n await stopTimerMutation({ variables: { id: resetTarget.timeEntry.id } });\n await deleteTimeEntry({ variables: { id: resetTarget.timeEntry.id } });\n setResetTarget(null);\n await refetchRunning();\n };\n\n const isRunning = Boolean(serverTimer);\n\n return (\n <PageLayout\n title={t(\"timecampus.timer.title\", \"Timer\")}\n description={t(\n \"timecampus.timer.description\",\n \"Focus timer for deep work sessions\",\n )}\n purpose={t(\n \"timecampus.timer.purpose\",\n \"A single, distraction-free stopwatch for the task in front of you — start it when you begin focused work and it logs the session as a time entry you can attribute to a project later.\",\n )}\n >\n <div className=\"mx-auto max-w-lg\">\n <PhoneViewLink path=\"/mobile/timer\" />\n <NextSteps\n storageKey=\"timecampus-timer\"\n className=\"mb-6\"\n steps={[\n {\n id: \"start\",\n label: isRunning\n ? t(\n \"timecampus.timer.nextSteps.stopRunning\",\n \"Stop the running timer\",\n )\n : t(\"timecampus.timer.nextSteps.start\", \"Start the timer\"),\n description: isRunning\n ? t(\n \"timecampus.timer.nextSteps.stopDescription\",\n \"End this session and save it as a time entry.\",\n )\n : t(\n \"timecampus.timer.nextSteps.startDescription\",\n \"Begin tracking the task you're working on right now.\",\n ),\n onClick: () => (isRunning ? handleStop() : setStartOpen(true)),\n },\n {\n id: \"assign-project\",\n label: t(\n \"timecampus.timer.nextSteps.assignProject\",\n \"Assign work to a project\",\n ),\n description: t(\n \"timecampus.timer.nextSteps.assignDescription\",\n \"Pick a project so this time bills correctly.\",\n ),\n onClick: () => navigate(\"/projects\"),\n },\n {\n id: \"review-entries\",\n label: t(\n \"timecampus.timer.nextSteps.review\",\n \"Review your time entries\",\n ),\n description: t(\n \"timecampus.timer.nextSteps.reviewDescription\",\n \"Check and tidy everything you've logged.\",\n ),\n onClick: () => navigate(\"/time/entries\"),\n },\n ]}\n />\n <GlassCard treatment=\"glass\" glow className=\"p-6 text-center sm:p-8\">\n <p className=\"font-mono text-5xl font-bold tabular-nums text-text-primary sm:text-6xl\">\n {activeTimer\n ? formatTimerDuration(activeTimer.seconds)\n : t(\"timecampus.timer.elapsedDefault\", \"00:00:00\")}\n </p>\n {activeTimer?.description && (\n <p className=\"mt-2 text-sm text-text-secondary\">\n {activeTimer.description}\n </p>\n )}\n <div className=\"mt-6 flex flex-wrap items-center justify-center gap-3\">\n {isRunning ? (\n <button\n onClick={handleStop}\n disabled={stopping}\n className=\"inline-flex items-center gap-2 rounded-md bg-action-danger-bg px-6 py-3 text-sm font-medium text-action-primary-text hover:bg-action-danger-bg/90 disabled:opacity-50\"\n >\n <Square className=\"h-4 w-4\" />\n {stopping\n ? t(\"timecampus.timer.stopping\", \"Stopping...\")\n : t(\"timecampus.timer.stop\", \"Stop\")}\n </button>\n ) : (\n <button\n onClick={() => setStartOpen(true)}\n disabled={starting}\n className=\"inline-flex items-center gap-2 rounded-md bg-action-primary-bg px-6 py-3 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-50\"\n >\n <Play className=\"h-4 w-4\" />\n {t(\"timecampus.timer.start\", \"Start\")}\n </button>\n )}\n <button\n onClick={() => serverTimer && setResetTarget(serverTimer)}\n disabled={!isRunning || deleting}\n className=\"inline-flex items-center gap-2 rounded-md border border-border-subtle px-4 py-3 text-sm font-medium text-text-primary hover:bg-bg-sunken/50 disabled:opacity-50\"\n title={t(\n \"timecampus.timer.resetTooltip\",\n \"Discard the running timer without saving\",\n )}\n >\n <RotateCcw className=\"h-4 w-4\" />\n {t(\"timecampus.timer.reset\", \"Reset\")}\n </button>\n </div>\n </GlassCard>\n\n {/* Server-side running timers */}\n <GlassCard treatment=\"glass\" className=\"mt-6 p-6\">\n <div className=\"mb-4 flex items-center justify-between\">\n <h3 className=\"text-sm font-semibold text-text-primary\">\n {t(\"timecampus.timer.runningTimers.title\", \"Running Timers\")}\n </h3>\n {runningTimers.length > 0 && (\n <StatusBadge\n label={t(\n \"timecampus.timer.runningTimers.active\",\n \"{{count}} active\",\n { count: runningTimers.length },\n )}\n variant=\"success\"\n dot\n />\n )}\n </div>\n {runningLoading && runningTimers.length === 0 ? (\n <LoadingSkeleton variant=\"list\" count={2} />\n ) : runningTimers.length === 0 ? (\n <EmptyState\n illustration=\"empty-sessions\"\n title={t(\n \"timecampus.timer.runningTimers.emptyTitle\",\n \"No active timers on the server\",\n )}\n description={t(\n \"timecampus.timer.runningTimers.emptyDescription\",\n \"Timers you start sync here so you can pick them up on any device.\",\n )}\n />\n ) : (\n <div className=\"flex flex-col gap-2\">\n {runningTimers.map((timer: RunningTimerItem) => (\n <div\n key={timer.timeEntry.id}\n className=\"flex items-center gap-3 rounded-lg border border-border-subtle bg-bg-surface p-3\"\n >\n <span className=\"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-action-primary-bg/10 text-xs font-semibold text-primary\">\n {getInitials(\n timer.timeEntry.project?.name ??\n t(\n \"timecampus.timer.runningTimers.noProject\",\n \"No Project\",\n ),\n )}\n </span>\n <div className=\"min-w-0 flex-1\">\n <p className=\"truncate text-sm font-medium text-text-primary\">\n {timer.timeEntry.project?.name ??\n t(\n \"timecampus.timer.runningTimers.noProject\",\n \"No Project\",\n )}\n </p>\n <p className=\"truncate text-xs text-text-secondary\">\n {timer.timeEntry.description ??\n t(\n \"timecampus.timer.runningTimers.noDescription\",\n \"No description\",\n )}\n </p>\n </div>\n <p className=\"ms-2 shrink-0 font-mono text-sm font-medium text-text-primary\">\n {formatTimerDuration(timer.elapsedSeconds)}\n </p>\n </div>\n ))}\n </div>\n )}\n </GlassCard>\n </div>\n\n {/* Start timer modal */}\n <Modal\n open={startOpen}\n onClose={() => setStartOpen(false)}\n title={t(\"timecampus.timer.modal.startTitle\", \"Start a timer\")}\n description={t(\n \"timecampus.timer.modal.startDescription\",\n \"Track the task you're working on right now.\",\n )}\n footer={\n <>\n <button\n onClick={() => setStartOpen(false)}\n className=\"rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken/50\"\n >\n {t(\"timecampus.timer.modal.cancel\", \"Cancel\")}\n </button>\n <button\n onClick={handleStart}\n disabled={starting}\n className=\"rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-50\"\n >\n {starting\n ? t(\"timecampus.timer.modal.starting\", \"Starting...\")\n : t(\"timecampus.timer.modal.startTimer\", \"Start Timer\")}\n </button>\n </>\n }\n >\n {startError && (\n <div className=\"mb-4 rounded-lg border border-status-error-bg/40 bg-status-error-bg p-3 text-sm text-status-error-text\">\n {t(\n \"timecampus.timer.modal.startError\",\n \"Failed to start the timer. Please try again.\",\n )}\n </div>\n )}\n <div className=\"space-y-4\">\n <div>\n <label className=\"block text-sm font-medium text-text-primary\">\n {t(\n \"timecampus.timer.modal.descriptionLabel\",\n \"What are you working on?\",\n )}\n </label>\n <input\n type=\"text\"\n placeholder={t(\n \"timecampus.timer.modal.descriptionPlaceholder\",\n \"Description\",\n )}\n value={description}\n onChange={(e) => setDescription(e.target.value)}\n className=\"mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary\"\n />\n </div>\n <div>\n <label className=\"block text-sm font-medium text-text-primary\">\n {t(\"timecampus.timer.modal.projectLabel\", \"Project\")}\n </label>\n <select\n value={projectId}\n onChange={(e) => setProjectId(e.target.value)}\n className=\"mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n >\n <option value=\"\">\n {t(\"timecampus.timer.modal.noProject\", \"No Project\")}\n </option>\n {projects.map((project) => (\n <option key={project.id} value={project.id}>\n {project.name}\n </option>\n ))}\n </select>\n </div>\n <label className=\"flex items-center gap-2 text-sm text-text-primary\">\n <input\n type=\"checkbox\"\n checked={billable}\n onChange={(e) => setBillable(e.target.checked)}\n className=\"h-4 w-4 rounded border-border-subtle\"\n />\n {t(\"timecampus.timer.modal.billable\", \"Billable\")}\n </label>\n </div>\n </Modal>\n\n {/* Reset / discard confirm modal */}\n <Modal\n open={Boolean(resetTarget)}\n onClose={() => setResetTarget(null)}\n title={t(\n \"timecampus.timer.modal.discardTitle\",\n \"Discard running timer?\",\n )}\n description={t(\n \"timecampus.timer.modal.discardDescription\",\n \"This stops the timer and deletes the in-progress entry. It cannot be undone.\",\n )}\n footer={\n <>\n <button\n onClick={() => setResetTarget(null)}\n className=\"rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken/50\"\n >\n {t(\"timecampus.timer.modal.cancel\", \"Cancel\")}\n </button>\n <button\n onClick={handleReset}\n disabled={stopping || deleting}\n className=\"rounded-md bg-action-danger-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-danger-bg/90 disabled:opacity-50\"\n >\n {stopping || deleting\n ? t(\"timecampus.timer.modal.discarding\", \"Discarding...\")\n : t(\"timecampus.timer.modal.discard\", \"Discard\")}\n </button>\n </>\n }\n >\n <p className=\"text-sm text-text-secondary\">\n {t(\"timecampus.timer.modal.discardMessagePrefix\", \"The timer for\")}{\" \"}\n <span className=\"font-medium text-text-primary\">\n {resetTarget?.timeEntry.project?.name ??\n resetTarget?.timeEntry.description ??\n t(\"timecampus.timer.modal.sessionFallback\", \"this session\")}\n </span>{\" \"}\n {t(\n \"timecampus.timer.modal.discardMessageSuffix\",\n \"will be discarded.\",\n )}\n </p>\n </Modal>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA8BA,SAAgBC,IAAY;CAC1B,IAAM,EAAE,gBAAa,cAAW,2BAAwBC,EAAmB,GACrEC,IAAWC,EAAsB,GACjCC,IAAIC,EAAM,GAEV,CAACC,IAAWC,KAAgBC,EAAS,EAAK,GAC1C,CAACC,GAAaC,KAAkBF,EAAS,EAAE,GAC3C,CAACG,GAAWC,KAAgBJ,EAAS,EAAE,GACvC,CAACK,GAAUC,KAAeN,EAAS,EAAK,GACxC,CAACO,GAAaC,KAAkBR,EAAkC,IAAI,GAEtE,EACJ,MAAMS,GACN,SAASC,GACT,SAASC,MACPC,GAA0B,EAAE,aAAa,oBAAoB,CAAC,GAE5D,EAAE,MAAMC,MAAiBC,GAAqB,EAClD,WAAW,EAAE,YAAY,EAAE,OAAO,GAAG,EAAE,EACzC,CAAC,GACKC,IAA4BF,GAAc,UAAU,SAAS,CAAC,GAE9DG,IAAgBP,GAAa,iBAAiB,CAAC,GAC/CQ,IAAcD,EAAc,MAAM,MAElCE,IAAa;EACjB,EAAE,OAAOC,EAA0B;EACnC;GACE,OAAOC;GACP,WAAW,EAAE,YAAY,EAAE,OAAO,GAAG,EAAE;EACzC;EACA,EAAE,OAAOC,EAA0B;CACrC,GAEM,CAACC,GAAoB,EAAE,SAASC,GAAU,OAAOC,QACrDC,GAAsB,EAAE,gBAAgBP,EAAW,CAAC,GAChD,CAACQ,GAAmB,EAAE,SAASC,OAAcC,GAAqB,EACtE,gBAAgBV,EAClB,CAAC,GACKW,IAAYC,EAAuB,GACnC,CAACC,IAAiB,EAAE,SAASC,OAAcC,EAA2B,EAC1E,gBAAgBf,EAClB,CAAC;CAqBD,AAjBAgB,QAAgB;EACd,AAAIj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,SAAS,QAC/BA,GAAa,UAAU,eACvBX,EAAE,0CAA0C,cAAc;MACxD,CAAA;MAAE;MACPA,EACC,+CACA,oBACF;KACC;;GACE,CAAA;EACG;;AAEhB"}
@@ -172,7 +172,7 @@ function E({ open: E, onClose: D, onSubmitted: O, onError: k }) {
172
172
  q ? /* @__PURE__ */ x("p", {
173
173
  className: "text-sm font-medium text-text-primary",
174
174
  children: [q.label, /* @__PURE__ */ x("span", {
175
- className: "ml-2 text-xs font-normal text-text-secondary",
175
+ className: "ms-2 text-xs font-normal text-text-secondary",
176
176
  children: [
177
177
  n(q.start),
178
178
  " – ",
@@ -1 +1 @@
1
- {"version":3,"file":"SubmitTimesheetModal.js","names":["_Fragment","ENTRY_PAGE_SIZE","MAX_ENTRY_PAGES","inputClass","PERIOD_OPTIONS","SubmitTimesheetModal","useTimeCampus","userId","currentUser","loadTimesheetEntries","useListTimesheetEntriesLazyQuery","analytics","useTimeCampusAnalytics","submitApprovalRequest","submitting","useSubmitApprovalRequestMutation","kind","setKind","useState","customFrom","setCustomFrom","customTo","setCustomTo","totalsState","setTotalsState","open","today","toDateInputValue","myRequestsData","myRequestsLoading","useListMyApprovalRequestsQuery","periodResult","useMemo","customPeriod","weekPeriod","period","periodStartIso","periodEndIso","cancelled","entries","page","result","data","summarizeEntries","err","overlapping","findOverlappingRequest","totals","blockedReason","canSubmit","Modal","Fragment","onClose","request","submitted","onSubmitted","Send","option","cn","formatDate","formatHours","AlertTriangle"],"sources":["../../../../src/timecampus/pages/time-approval/SubmitTimesheetModal.tsx"],"sourcesContent":["/**\n * \"Submit for approval\" for a timesheet period (BOFF-10584).\n *\n * The submitter picks this week, last week or a custom range; the modal sums\n * their own finished time entries in that range (the same `createdBy` +\n * `startTime` rule the backend uses to list a request's entries), refuses a\n * period that already has a pending or approved request, and calls\n * `submitApprovalRequest`. Analytics fire only after the mutation succeeds.\n */\nimport { useEffect, useMemo, useState } from \"react\";\nimport { AlertTriangle, Send } from \"lucide-react\";\n\nimport { Modal } from \"../../components/Modal\";\nimport { formatDate, formatHours, cn } from \"../../utils/helpers\";\nimport { useTimeCampus } from \"../../providers/TimeCampusProvider\";\nimport { useTimeCampusAnalytics } from \"../../analytics\";\nimport {\n useListMyApprovalRequestsQuery,\n useListTimesheetEntriesLazyQuery,\n useSubmitApprovalRequestMutation,\n type ApprovalRequestFieldsFragment,\n} from \"@/generated/wspace-operations\";\nimport {\n customPeriod,\n findOverlappingRequest,\n summarizeEntries,\n toDateInputValue,\n weekPeriod,\n type TimesheetEntryLike,\n type TimesheetPeriod,\n type TimesheetPeriodKind,\n type TimesheetTotals,\n} from \"./timesheetPeriod\";\n\n/** The svc caps a page at 200 rows. */\nconst ENTRY_PAGE_SIZE = 200;\n/** 25 pages = 5,000 entries, far beyond a 31-day timesheet. */\nconst MAX_ENTRY_PAGES = 25;\n\nconst inputClass =\n \"mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\";\n\nconst PERIOD_OPTIONS: Array<{ kind: TimesheetPeriodKind; label: string }> = [\n { kind: \"this_week\", label: \"This week\" },\n { kind: \"last_week\", label: \"Last week\" },\n { kind: \"custom\", label: \"Custom range\" },\n];\n\ntype TotalsState =\n | { status: \"idle\" }\n | { status: \"loading\" }\n | { status: \"ready\"; totals: TimesheetTotals }\n | { status: \"error\" };\n\nexport interface SubmitTimesheetModalProps {\n open: boolean;\n onClose: () => void;\n /**\n * Called with the new request after a successful submit. It handles its own\n * follow-up failures (such as a list refresh); the submit already worked.\n */\n onSubmitted: (request: ApprovalRequestFieldsFragment) => Promise<void>;\n /** Called when the mutation fails, with a message safe to show. */\n onError: (message: string) => void;\n}\n\nexport function SubmitTimesheetModal({\n open,\n onClose,\n onSubmitted,\n onError,\n}: SubmitTimesheetModalProps) {\n const { currentUser } = useTimeCampus();\n const userId = currentUser?.id ?? \"\";\n const [loadTimesheetEntries] = useListTimesheetEntriesLazyQuery({\n fetchPolicy: \"no-cache\",\n });\n const analytics = useTimeCampusAnalytics();\n const [submitApprovalRequest, { loading: submitting }] =\n useSubmitApprovalRequestMutation();\n\n const [kind, setKind] = useState<TimesheetPeriodKind>(\"this_week\");\n const [customFrom, setCustomFrom] = useState(\"\");\n const [customTo, setCustomTo] = useState(\"\");\n const [totalsState, setTotalsState] = useState<TotalsState>({\n status: \"idle\",\n });\n\n // Reset to this week each time the modal opens.\n useEffect(() => {\n if (!open) return;\n const today = toDateInputValue(new Date());\n setKind(\"this_week\");\n setCustomFrom(today);\n setCustomTo(today);\n }, [open]);\n\n const { data: myRequestsData, loading: myRequestsLoading } =\n useListMyApprovalRequestsQuery({\n skip: !open || !userId,\n fetchPolicy: \"network-only\",\n });\n\n const periodResult = useMemo<\n { ok: true; period: TimesheetPeriod } | { ok: false; error: string }\n >(() => {\n if (kind === \"custom\") return customPeriod(customFrom, customTo);\n return { ok: true, period: weekPeriod(new Date(), kind) };\n }, [kind, customFrom, customTo]);\n\n const period = periodResult.ok ? periodResult.period : null;\n const periodStartIso = period?.start.toISOString();\n const periodEndIso = period?.end.toISOString();\n\n // Sum the submitter's own entries in the period, paging through every row.\n useEffect(() => {\n if (!open || !userId || !periodStartIso || !periodEndIso) {\n setTotalsState({ status: \"idle\" });\n return;\n }\n let cancelled = false;\n setTotalsState({ status: \"loading\" });\n (async () => {\n const entries: TimesheetEntryLike[] = [];\n for (let page = 0; page < MAX_ENTRY_PAGES; page += 1) {\n const { data } = await loadTimesheetEntries({\n variables: {\n filter: {\n createdBy: userId,\n startDate: periodStartIso,\n endDate: periodEndIso,\n },\n pagination: {\n limit: ENTRY_PAGE_SIZE,\n offset: page * ENTRY_PAGE_SIZE,\n },\n },\n });\n const result = data?.timeEntries;\n if (!result) throw new Error(\"timeEntries returned no data\");\n entries.push(...result.items);\n if (!result.hasMore || result.items.length === 0) break;\n }\n return summarizeEntries(entries);\n })()\n .then((totals) => {\n if (!cancelled) setTotalsState({ status: \"ready\", totals });\n })\n .catch((err: unknown) => {\n console.warn(\"[TimeCampus] Could not load timesheet entries\", err);\n if (!cancelled) setTotalsState({ status: \"error\" });\n });\n return () => {\n cancelled = true;\n };\n }, [open, userId, periodStartIso, periodEndIso, loadTimesheetEntries]);\n\n const overlapping = useMemo(\n () =>\n period\n ? findOverlappingRequest(\n myRequestsData?.myApprovalRequests ?? [],\n period,\n )\n : undefined,\n [period, myRequestsData],\n );\n\n const totals = totalsState.status === \"ready\" ? totalsState.totals : null;\n const blockedReason = !userId\n ? \"Sign in again to submit a timesheet.\"\n : !periodResult.ok\n ? periodResult.error\n : overlapping\n ? `You already have a ${overlapping.status.toLowerCase()} timesheet for ${overlapping.period}. Withdraw it before submitting this period again.`\n : totals && totals.entryCount === 0\n ? \"No finished time entries in this period yet.\"\n : null;\n\n const canSubmit =\n !submitting &&\n !myRequestsLoading &&\n totals !== null &&\n blockedReason === null;\n\n const handleSubmit = async () => {\n if (!canSubmit || !period || !totals) return;\n let request: ApprovalRequestFieldsFragment;\n try {\n const result = await submitApprovalRequest({\n variables: {\n input: {\n period: period.label,\n startDate: period.start.toISOString(),\n endDate: period.end.toISOString(),\n totalHours: totals.totalHours,\n billableHours: totals.billableHours,\n },\n },\n });\n const submitted = result.data?.submitApprovalRequest;\n if (!submitted) throw new Error(\"submitApprovalRequest returned no data\");\n request = submitted;\n } catch (err) {\n onError(\n err instanceof Error && err.message\n ? err.message\n : \"Failed to submit timesheet\",\n );\n return;\n }\n // Only a request the svc accepted counts as a submission.\n analytics.timesheetSubmitted({\n approvalId: request.id,\n periodKind: period.kind,\n });\n analytics.approvalSubmitted({ approvalId: request.id, kind: \"timesheet\" });\n await onSubmitted(request);\n };\n\n return (\n <Modal\n open={open}\n onClose={onClose}\n title=\"Submit timesheet for approval\"\n description=\"Send your tracked hours for a period to a reviewer.\"\n size=\"md\"\n footer={\n <>\n <button\n onClick={onClose}\n className=\"rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken/50\"\n >\n Cancel\n </button>\n <button\n onClick={handleSubmit}\n disabled={!canSubmit}\n data-testid=\"submit-timesheet-confirm\"\n className=\"inline-flex items-center gap-1.5 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-50\"\n >\n <Send className=\"h-4 w-4\" />\n {submitting ? \"Submitting...\" : \"Submit for approval\"}\n </button>\n </>\n }\n >\n <div className=\"space-y-4\">\n <fieldset>\n <legend className=\"text-sm font-medium text-text-primary\">\n Period\n </legend>\n <div\n role=\"radiogroup\"\n aria-label=\"Timesheet period\"\n className=\"mt-2 grid grid-cols-3 gap-2\"\n >\n {PERIOD_OPTIONS.map((option) => (\n <button\n key={option.kind}\n type=\"button\"\n role=\"radio\"\n aria-checked={kind === option.kind}\n onClick={() => setKind(option.kind)}\n className={cn(\n \"rounded-md border px-3 py-2 text-sm font-medium\",\n kind === option.kind\n ? \"border-action-primary-bg bg-action-primary-bg/10 text-primary\"\n : \"border-border-subtle bg-bg-surface text-text-secondary hover:bg-bg-sunken\",\n )}\n >\n {option.label}\n </button>\n ))}\n </div>\n </fieldset>\n\n {kind === \"custom\" && (\n <div className=\"grid grid-cols-2 gap-3\">\n <label className=\"block text-sm font-medium text-text-primary\">\n From\n <input\n type=\"date\"\n value={customFrom}\n max={toDateInputValue(new Date())}\n onChange={(e) => setCustomFrom(e.target.value)}\n className={inputClass}\n />\n </label>\n <label className=\"block text-sm font-medium text-text-primary\">\n To\n <input\n type=\"date\"\n value={customTo}\n max={toDateInputValue(new Date())}\n onChange={(e) => setCustomTo(e.target.value)}\n className={inputClass}\n />\n </label>\n </div>\n )}\n\n <div\n className=\"rounded-lg border border-border-seam bg-bg-sunken/40 p-4\"\n data-testid=\"submit-timesheet-summary\"\n >\n {period ? (\n <p className=\"text-sm font-medium text-text-primary\">\n {period.label}\n <span className=\"ml-2 text-xs font-normal text-text-secondary\">\n {formatDate(period.start)} – {formatDate(period.end)}\n </span>\n </p>\n ) : (\n <p className=\"text-sm text-text-secondary\">Pick a valid period.</p>\n )}\n\n {totalsState.status === \"loading\" && (\n <p className=\"mt-3 text-sm text-text-secondary\">\n Adding up your hours...\n </p>\n )}\n {totalsState.status === \"error\" && (\n <p className=\"mt-3 text-sm text-status-error-text\">\n Could not load your time entries for this period.\n </p>\n )}\n {totals && (\n <div className=\"mt-3 grid grid-cols-3 gap-3\">\n <div>\n <p className=\"text-[11px] font-medium uppercase tracking-wide text-text-secondary\">\n Total\n </p>\n <p className=\"text-lg font-semibold tabular-nums text-text-primary\">\n {formatHours(totals.totalHours)}\n </p>\n </div>\n <div>\n <p className=\"text-[11px] font-medium uppercase tracking-wide text-text-secondary\">\n Billable\n </p>\n <p className=\"text-lg font-semibold tabular-nums text-text-primary\">\n {formatHours(totals.billableHours)}\n </p>\n </div>\n <div>\n <p className=\"text-[11px] font-medium uppercase tracking-wide text-text-secondary\">\n Entries\n </p>\n <p className=\"text-lg font-semibold tabular-nums text-text-primary\">\n {totals.entryCount}\n </p>\n </div>\n </div>\n )}\n {totals && totals.runningCount > 0 && (\n <p className=\"mt-3 text-xs text-status-warning-text\">\n {totals.runningCount === 1\n ? \"1 timer is still running in this period and is not included.\"\n : `${totals.runningCount} timers are still running in this period and are not included.`}\n </p>\n )}\n </div>\n\n {blockedReason && (\n <div\n role=\"alert\"\n className=\"flex items-start gap-2 rounded-md border border-status-warning-bg bg-status-warning-bg/60 p-3 text-sm text-status-warning-text\"\n >\n <AlertTriangle className=\"mt-0.5 h-4 w-4 shrink-0\" />\n <span>{blockedReason}</span>\n </div>\n )}\n </div>\n </Modal>\n );\n}\n"],"mappings":";;;;;;;;;;;AAmCA,IAAMC,IAAkB,KAElBC,IAAkB,IAElBC,IACJ,wGAEIC,IAAsE;CAC1E;EAAE,MAAM;EAAa,OAAO;CAAY;CACxC;EAAE,MAAM;EAAa,OAAO;CAAY;CACxC;EAAE,MAAM;EAAU,OAAO;CAAe;AAC1C;AAoBA,SAAgBC,EAAqB,EACnC,SACA,YACA,gBACA,cAC4B;CAC5B,IAAM,E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AAC,OAAD,EAAA,UAAA,CACE,kBAAC,KAAD;SAAG,WAAU;SAAsE,UAAA;QAEhF,CAAA,GACH,kBAAC,KAAD;SAAG,WAAU;SACV,UAAAa,EAAYb,EAAO,aAAa;QAChC,CAAA,CACA,EAAA,CAAA;QACL,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,KAAD;SAAG,WAAU;SAAsE,UAAA;QAEhF,CAAA,GACH,kBAAC,KAAD;SAAG,WAAU;SACV,UAAAA,EAAO;QACP,CAAA,CACA,EAAA,CAAA;OACF;;MAENA,KAAUA,EAAO,eAAe,KAC/B,kBAAC,KAAD;OAAG,WAAU;OACV,UAAAA,EAAO,iBAAiB,IACrB,iEACA,GAAGA,EAAO,aAAa;MAC1B,CAAA;KAEF;;IAEJC,KACC,kBAAC,OAAD;KACE,MAAK;KACL,WAAU;KAFZ,UAAA,CAIE,kBAACa,GAAD,EAAe,WAAU,0BAA2B,CAAA,GACpD,kBAAC,QAAD,EAAA,UAAOb,EAAoB,CAAA,CACxB;;GAEJ;;CACA,CAAA;AAEX"}
1
+ {"version":3,"file":"SubmitTimesheetModal.js","names":["_Fragment","ENTRY_PAGE_SIZE","MAX_ENTRY_PAGES","inputClass","PERIOD_OPTIONS","SubmitTimesheetModal","useTimeCampus","userId","currentUser","loadTimesheetEntries","useListTimesheetEntriesLazyQuery","analytics","useTimeCampusAnalytics","submitApprovalRequest","submitting","useSubmitApprovalRequestMutation","kind","setKind","useState","customFrom","setCustomFrom","customTo","setCustomTo","totalsState","setTotalsState","open","today","toDateInputValue","myRequestsData","myRequestsLoading","useListMyApprovalRequestsQuery","periodResult","useMemo","customPeriod","weekPeriod","period","periodStartIso","periodEndIso","cancelled","entries","page","result","data","summarizeEntries","err","overlapping","findOverlappingRequest","totals","blockedReason","canSubmit","Modal","Fragment","onClose","request","submitted","onSubmitted","Send","option","cn","formatDate","formatHours","AlertTriangle"],"sources":["../../../../src/timecampus/pages/time-approval/SubmitTimesheetModal.tsx"],"sourcesContent":["/**\n * \"Submit for approval\" for a timesheet period (BOFF-10584).\n *\n * The submitter picks this week, last week or a custom range; the modal sums\n * their own finished time entries in that range (the same `createdBy` +\n * `startTime` rule the backend uses to list a request's entries), refuses a\n * period that already has a pending or approved request, and calls\n * `submitApprovalRequest`. Analytics fire only after the mutation succeeds.\n */\nimport { useEffect, useMemo, useState } from \"react\";\nimport { AlertTriangle, Send } from \"lucide-react\";\n\nimport { Modal } from \"../../components/Modal\";\nimport { formatDate, formatHours, cn } from \"../../utils/helpers\";\nimport { useTimeCampus } from \"../../providers/TimeCampusProvider\";\nimport { useTimeCampusAnalytics } from \"../../analytics\";\nimport {\n useListMyApprovalRequestsQuery,\n useListTimesheetEntriesLazyQuery,\n useSubmitApprovalRequestMutation,\n type ApprovalRequestFieldsFragment,\n} from \"@/generated/wspace-operations\";\nimport {\n customPeriod,\n findOverlappingRequest,\n summarizeEntries,\n toDateInputValue,\n weekPeriod,\n type TimesheetEntryLike,\n type TimesheetPeriod,\n type TimesheetPeriodKind,\n type TimesheetTotals,\n} from \"./timesheetPeriod\";\n\n/** The svc caps a page at 200 rows. */\nconst ENTRY_PAGE_SIZE = 200;\n/** 25 pages = 5,000 entries, far beyond a 31-day timesheet. */\nconst MAX_ENTRY_PAGES = 25;\n\nconst inputClass =\n \"mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\";\n\nconst PERIOD_OPTIONS: Array<{ kind: TimesheetPeriodKind; label: string }> = [\n { kind: \"this_week\", label: \"This week\" },\n { kind: \"last_week\", label: \"Last week\" },\n { kind: \"custom\", label: \"Custom range\" },\n];\n\ntype TotalsState =\n | { status: \"idle\" }\n | { status: \"loading\" }\n | { status: \"ready\"; totals: TimesheetTotals }\n | { status: \"error\" };\n\nexport interface SubmitTimesheetModalProps {\n open: boolean;\n onClose: () => void;\n /**\n * Called with the new request after a successful submit. It handles its own\n * follow-up failures (such as a list refresh); the submit already worked.\n */\n onSubmitted: (request: ApprovalRequestFieldsFragment) => Promise<void>;\n /** Called when the mutation fails, with a message safe to show. */\n onError: (message: string) => void;\n}\n\nexport function SubmitTimesheetModal({\n open,\n onClose,\n onSubmitted,\n onError,\n}: SubmitTimesheetModalProps) {\n const { currentUser } = useTimeCampus();\n const userId = currentUser?.id ?? \"\";\n const [loadTimesheetEntries] = useListTimesheetEntriesLazyQuery({\n fetchPolicy: \"no-cache\",\n });\n const analytics = useTimeCampusAnalytics();\n const [submitApprovalRequest, { loading: submitting }] =\n useSubmitApprovalRequestMutation();\n\n const [kind, setKind] = useState<TimesheetPeriodKind>(\"this_week\");\n const [customFrom, setCustomFrom] = useState(\"\");\n const [customTo, setCustomTo] = useState(\"\");\n const [totalsState, setTotalsState] = useState<TotalsState>({\n status: \"idle\",\n });\n\n // Reset to this week each time the modal opens.\n useEffect(() => {\n if (!open) return;\n const today = toDateInputValue(new Date());\n setKind(\"this_week\");\n setCustomFrom(today);\n setCustomTo(today);\n }, [open]);\n\n const { data: myRequestsData, loading: myRequestsLoading } =\n useListMyApprovalRequestsQuery({\n skip: !open || !userId,\n fetchPolicy: \"network-only\",\n });\n\n const periodResult = useMemo<\n { ok: true; period: TimesheetPeriod } | { ok: false; error: string }\n >(() => {\n if (kind === \"custom\") return customPeriod(customFrom, customTo);\n return { ok: true, period: weekPeriod(new Date(), kind) };\n }, [kind, customFrom, customTo]);\n\n const period = periodResult.ok ? periodResult.period : null;\n const periodStartIso = period?.start.toISOString();\n const periodEndIso = period?.end.toISOString();\n\n // Sum the submitter's own entries in the period, paging through every row.\n useEffect(() => {\n if (!open || !userId || !periodStartIso || !periodEndIso) {\n setTotalsState({ status: \"idle\" });\n return;\n }\n let cancelled = false;\n setTotalsState({ status: \"loading\" });\n (async () => {\n const entries: TimesheetEntryLike[] = [];\n for (let page = 0; page < MAX_ENTRY_PAGES; page += 1) {\n const { data } = await loadTimesheetEntries({\n variables: {\n filter: {\n createdBy: userId,\n startDate: periodStartIso,\n endDate: periodEndIso,\n },\n pagination: {\n limit: ENTRY_PAGE_SIZE,\n offset: page * ENTRY_PAGE_SIZE,\n },\n },\n });\n const result = data?.timeEntries;\n if (!result) throw new Error(\"timeEntries returned no data\");\n entries.push(...result.items);\n if (!result.hasMore || result.items.length === 0) break;\n }\n return summarizeEntries(entries);\n })()\n .then((totals) => {\n if (!cancelled) setTotalsState({ status: \"ready\", totals });\n })\n .catch((err: unknown) => {\n console.warn(\"[TimeCampus] Could not load timesheet entries\", err);\n if (!cancelled) setTotalsState({ status: \"error\" });\n });\n return () => {\n cancelled = true;\n };\n }, [open, userId, periodStartIso, periodEndIso, loadTimesheetEntries]);\n\n const overlapping = useMemo(\n () =>\n period\n ? findOverlappingRequest(\n myRequestsData?.myApprovalRequests ?? [],\n period,\n )\n : undefined,\n [period, myRequestsData],\n );\n\n const totals = totalsState.status === \"ready\" ? totalsState.totals : null;\n const blockedReason = !userId\n ? \"Sign in again to submit a timesheet.\"\n : !periodResult.ok\n ? periodResult.error\n : overlapping\n ? `You already have a ${overlapping.status.toLowerCase()} timesheet for ${overlapping.period}. Withdraw it before submitting this period again.`\n : totals && totals.entryCount === 0\n ? \"No finished time entries in this period yet.\"\n : null;\n\n const canSubmit =\n !submitting &&\n !myRequestsLoading &&\n totals !== null &&\n blockedReason === null;\n\n const handleSubmit = async () => {\n if (!canSubmit || !period || !totals) return;\n let request: ApprovalRequestFieldsFragment;\n try {\n const result = await submitApprovalRequest({\n variables: {\n input: {\n period: period.label,\n startDate: period.start.toISOString(),\n endDate: period.end.toISOString(),\n totalHours: totals.totalHours,\n billableHours: totals.billableHours,\n },\n },\n });\n const submitted = result.data?.submitApprovalRequest;\n if (!submitted) throw new Error(\"submitApprovalRequest returned no data\");\n request = submitted;\n } catch (err) {\n onError(\n err instanceof Error && err.message\n ? err.message\n : \"Failed to submit timesheet\",\n );\n return;\n }\n // Only a request the svc accepted counts as a submission.\n analytics.timesheetSubmitted({\n approvalId: request.id,\n periodKind: period.kind,\n });\n analytics.approvalSubmitted({ approvalId: request.id, kind: \"timesheet\" });\n await onSubmitted(request);\n };\n\n return (\n <Modal\n open={open}\n onClose={onClose}\n title=\"Submit timesheet for approval\"\n description=\"Send your tracked hours for a period to a reviewer.\"\n size=\"md\"\n footer={\n <>\n <button\n onClick={onClose}\n className=\"rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken/50\"\n >\n Cancel\n </button>\n <button\n onClick={handleSubmit}\n disabled={!canSubmit}\n data-testid=\"submit-timesheet-confirm\"\n className=\"inline-flex items-center gap-1.5 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-50\"\n >\n <Send className=\"h-4 w-4\" />\n {submitting ? \"Submitting...\" : \"Submit for approval\"}\n </button>\n </>\n }\n >\n <div className=\"space-y-4\">\n <fieldset>\n <legend className=\"text-sm font-medium text-text-primary\">\n Period\n </legend>\n <div\n role=\"radiogroup\"\n aria-label=\"Timesheet period\"\n className=\"mt-2 grid grid-cols-3 gap-2\"\n >\n {PERIOD_OPTIONS.map((option) => (\n <button\n key={option.kind}\n type=\"button\"\n role=\"radio\"\n aria-checked={kind === option.kind}\n onClick={() => setKind(option.kind)}\n className={cn(\n \"rounded-md border px-3 py-2 text-sm font-medium\",\n kind === option.kind\n ? \"border-action-primary-bg bg-action-primary-bg/10 text-primary\"\n : \"border-border-subtle bg-bg-surface text-text-secondary hover:bg-bg-sunken\",\n )}\n >\n {option.label}\n </button>\n ))}\n </div>\n </fieldset>\n\n {kind === \"custom\" && (\n <div className=\"grid grid-cols-2 gap-3\">\n <label className=\"block text-sm font-medium text-text-primary\">\n From\n <input\n type=\"date\"\n value={customFrom}\n max={toDateInputValue(new Date())}\n onChange={(e) => setCustomFrom(e.target.value)}\n className={inputClass}\n />\n </label>\n <label className=\"block text-sm font-medium text-text-primary\">\n To\n <input\n type=\"date\"\n value={customTo}\n max={toDateInputValue(new Date())}\n onChange={(e) => setCustomTo(e.target.value)}\n className={inputClass}\n />\n </label>\n </div>\n )}\n\n <div\n className=\"rounded-lg border border-border-seam bg-bg-sunken/40 p-4\"\n data-testid=\"submit-timesheet-summary\"\n >\n {period ? (\n <p className=\"text-sm font-medium text-text-primary\">\n {period.label}\n <span className=\"ms-2 text-xs font-normal text-text-secondary\">\n {formatDate(period.start)} – {formatDate(period.end)}\n </span>\n </p>\n ) : (\n <p className=\"text-sm text-text-secondary\">Pick a valid period.</p>\n )}\n\n {totalsState.status === \"loading\" && (\n <p className=\"mt-3 text-sm text-text-secondary\">\n Adding up your hours...\n </p>\n )}\n {totalsState.status === \"error\" && (\n <p className=\"mt-3 text-sm text-status-error-text\">\n Could not load your time entries for this period.\n </p>\n )}\n {totals && (\n <div className=\"mt-3 grid grid-cols-3 gap-3\">\n <div>\n <p className=\"text-[11px] font-medium uppercase tracking-wide text-text-secondary\">\n Total\n </p>\n <p className=\"text-lg font-semibold tabular-nums text-text-primary\">\n {formatHours(totals.totalHours)}\n </p>\n </div>\n <div>\n <p className=\"text-[11px] font-medium uppercase tracking-wide text-text-secondary\">\n Billable\n </p>\n <p className=\"text-lg font-semibold tabular-nums text-text-primary\">\n {formatHours(totals.billableHours)}\n </p>\n </div>\n <div>\n <p className=\"text-[11px] font-medium uppercase tracking-wide text-text-secondary\">\n Entries\n </p>\n <p className=\"text-lg font-semibold tabular-nums text-text-primary\">\n {totals.entryCount}\n </p>\n </div>\n </div>\n )}\n {totals && totals.runningCount > 0 && (\n <p className=\"mt-3 text-xs text-status-warning-text\">\n {totals.runningCount === 1\n ? \"1 timer is still running in this period and is not included.\"\n : `${totals.runningCount} timers are still running in this period and are not included.`}\n </p>\n )}\n </div>\n\n {blockedReason && (\n <div\n role=\"alert\"\n className=\"flex items-start gap-2 rounded-md border border-status-warning-bg bg-status-warning-bg/60 p-3 text-sm text-status-warning-text\"\n >\n <AlertTriangle className=\"mt-0.5 h-4 w-4 shrink-0\" />\n <span>{blockedReason}</span>\n </div>\n )}\n </div>\n </Modal>\n );\n}\n"],"mappings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OAAsC,UAAA;MAEhD,CAAA;MAEJwB,KACC,kBAAC,OAAD;OAAK,WAAU;OAAf,UAAA;QACE,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,KAAD;SAAG,WAAU;SAAsE,UAAA;QAEhF,CAAA,GACH,kBAAC,KAAD;SAAG,WAAU;SACV,UAAAa,EAAYb,EAAO,UAAU;QAC7B,CAAA,CACA,EAAA,CAAA;QACL,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,KAAD;SAAG,WAAU;SAAsE,UAAA;QAEhF,CAAA,GACH,kBAAC,KAAD;SAAG,WAAU;SACV,UAAAa,EAAYb,EAAO,aAAa;QAChC,CAAA,CACA,EAAA,CAAA;QACL,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,KAAD;SAAG,WAAU;SAAsE,UAAA;QAEhF,CAAA,GACH,kBAAC,KAAD;SAAG,WAAU;SACV,UAAAA,EAAO;QACP,CAAA,CACA,EAAA,CAAA;OACF;;MAENA,KAAUA,EAAO,eAAe,KAC/B,kBAAC,KAAD;OAAG,WAAU;OACV,UAAAA,EAAO,iBAAiB,IACrB,iEACA,GAAGA,EAAO,aAAa;MAC1B,CAAA;KAEF;;IAEJC,KACC,kBAAC,OAAD;KACE,MAAK;KACL,WAAU;KAFZ,UAAA,CAIE,kBAACa,GAAD,EAAe,WAAU,0BAA2B,CAAA,GACpD,kBAAC,QAAD,EAAA,UAAOb,EAAoB,CAAA,CACxB;;GAEJ;;CACA,CAAA;AAEX"}
@@ -210,7 +210,7 @@ function Pe({ suggestion: e, busy: t, onAccept: n, onReject: r }) {
210
210
  ]
211
211
  }),
212
212
  /* @__PURE__ */ L("span", {
213
- className: "ml-auto flex items-center gap-1",
213
+ className: "ms-auto flex items-center gap-1",
214
214
  children: [/* @__PURE__ */ L("button", {
215
215
  type: "button",
216
216
  disabled: t,
@@ -313,7 +313,7 @@ function H({ segment: e, busy: t, onSplit: n, onCancel: r }) {
313
313
  children: o.reason
314
314
  }),
315
315
  /* @__PURE__ */ L("span", {
316
- className: "ml-auto flex items-center gap-1",
316
+ className: "ms-auto flex items-center gap-1",
317
317
  children: [/* @__PURE__ */ L("button", {
318
318
  type: "submit",
319
319
  disabled: t || !o.ok,
@@ -840,7 +840,7 @@ function G() {
840
840
  type: "button",
841
841
  disabled: Ke || j,
842
842
  onClick: () => void Xe(Q),
843
- className: "ml-auto inline-flex items-center gap-1 rounded-md bg-action-primary-bg px-3 py-1 text-xs font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-50",
843
+ className: "ms-auto inline-flex items-center gap-1 rounded-md bg-action-primary-bg px-3 py-1 text-xs font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-50",
844
844
  children: [/* @__PURE__ */ I(ge, { className: "h-3.5 w-3.5" }), "Approve all"]
845
845
  })
846
846
  ]
@@ -870,7 +870,7 @@ function G() {
870
870
  type: "button",
871
871
  disabled: H,
872
872
  onClick: () => void it(),
873
- className: "ml-auto inline-flex items-center gap-1 rounded-md bg-action-primary-bg px-3 py-1 text-xs font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-50",
873
+ className: "ms-auto inline-flex items-center gap-1 rounded-md bg-action-primary-bg px-3 py-1 text-xs font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-50",
874
874
  children: [/* @__PURE__ */ I(ve, { className: "h-3.5 w-3.5" }), "Accept all"]
875
875
  })
876
876
  ]