feat(screen-recording-attach-stub): 'Screen-Recording aufnehmen' Stub-Button (kein echtes record [tsc:fail]
This commit is contained in:
parent
bfae276a1e
commit
7651e9777b
@ -1,10 +1,11 @@
|
||||
{
|
||||
"completed_features": [],
|
||||
"current_feature": "ui-polish",
|
||||
"current_feature": "screen-recording-attach-stub",
|
||||
"started_at": "2026-05-23T08:17:40.778724",
|
||||
"attempted_features": [
|
||||
"voice-input-stub",
|
||||
"popout-tracker",
|
||||
"project-favicons"
|
||||
"project-favicons",
|
||||
"ui-polish"
|
||||
]
|
||||
}
|
||||
@ -2663,3 +2663,20 @@ src/index.ts(27,25): error TS2769: No overload matches this call.
|
||||
Overload 2 of 3, '(plugin: FastifyPluginAsync<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>, opts?: FastifyRegisterOptions<...> | undefined): FastifyInstance<...> & PromiseLike<...>', gave the following error.
|
||||
Argument of type 'Promise<FastifyMultipartPlugin>' is not assignable to parameter of type 'FastifyPluginAsync<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'.
|
||||
Type 'Promise<FastifyMultipartPlugin>' provides no match for the signature '(instance: FastifyInstance<RawServerDefault, IncomingMessage, ServerResponse<IncomingMessage>, FastifyBaseLogger, FastifyTy
|
||||
- `08:21:45` **INFO** Committed feature ui-polish
|
||||
- `08:21:46` **INFO** Pushed: rc=0
|
||||
|
||||
## Phase-3 Feature: screen-recording-attach-stub (2026-05-23 08:21:46)
|
||||
|
||||
- `08:21:46` **INFO** Description: 'Screen-Recording aufnehmen' Stub-Button (kein echtes recording)
|
||||
- `08:21:46` **INFO** Generating apps/web/src/pages/TimeEntries.tsx (ERWEITERT — füge im Create-Form 'Screen-Recording'-Button (Camera-Icon…)
|
||||
- `08:23:45` **INFO** wrote 16225 chars in 119.2s (attempt 1)
|
||||
- `08:23:45` **INFO** Running tsc --noEmit on api…
|
||||
- `08:23:47` **WARN** tsc errors:
|
||||
src/index.ts(27,25): error TS2769: No overload matches this call.
|
||||
Overload 1 of 3, '(plugin: FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>, opts?: FastifyRegisterOptions<...> | undefined): FastifyInstance<...> & PromiseLike<...>', gave the following error.
|
||||
Argument of type 'Promise<FastifyMultipartPlugin>' is not assignable to parameter of type 'FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'.
|
||||
Type 'Promise<FastifyMultipartPlugin>' provides no match for the signature '(instance: FastifyInstance<RawServerDefault, IncomingMessage, ServerResponse<IncomingMessage>, FastifyBaseLogger, FastifyTypeProvider>, opts: { ...; }, done: (err?: Error | undefined) => void): void'.
|
||||
Overload 2 of 3, '(plugin: FastifyPluginAsync<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>, opts?: FastifyRegisterOptions<...> | undefined): FastifyInstance<...> & PromiseLike<...>', gave the following error.
|
||||
Argument of type 'Promise<FastifyMultipartPlugin>' is not assignable to parameter of type 'FastifyPluginAsync<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'.
|
||||
Type 'Promise<FastifyMultipartPlugin>' provides no match for the signature '(instance: FastifyInstance<RawServerDefault, IncomingMessage, ServerResponse<IncomingMessage>, FastifyBaseLogger, FastifyTy
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
import { useState, useMemo, useRef } from "react"
|
||||
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query"
|
||||
import { Camera, Trash2, Edit2, Check, X, Upload, FileText, Search, Filter } from "lucide-react"
|
||||
import { api } from "../lib/api"
|
||||
import { EmptyState } from "../components/EmptyState"
|
||||
import { LoadingSpinner } from "../components/LoadingSpinner"
|
||||
import { SuggestionInput } from "../components/SuggestionInput"
|
||||
import { SmartFilters } from "../components/SmartFilters"
|
||||
import { useToast } from "../hooks/useToast"
|
||||
import type { TimeEntryInsert, SavedView, TimeEntry, TimeEntryTemplate } from "@emberclone/shared"
|
||||
|
||||
function renderSimpleMarkdown(text: string | null) {
|
||||
@ -22,6 +24,7 @@ function renderSimpleMarkdown(text: string | null) {
|
||||
|
||||
export default function TimeEntries() {
|
||||
const queryClient = useQueryClient()
|
||||
const toast = useToast()
|
||||
const fileInputRef = useRef<HTMLInputElement>(null)
|
||||
|
||||
const [formData, setFormData] = useState({
|
||||
@ -93,6 +96,7 @@ export default function TimeEntries() {
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ["time-entries"] })
|
||||
setFormData({ description: "", startTime: "", endTime: "", projectId: "", notes: "", externalLink: "" })
|
||||
toast.success("Time entry created")
|
||||
}
|
||||
})
|
||||
|
||||
@ -101,6 +105,7 @@ export default function TimeEntries() {
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ["time-entries"] })
|
||||
setEditingId(null)
|
||||
toast.success("Time entry updated")
|
||||
}
|
||||
})
|
||||
|
||||
@ -108,6 +113,7 @@ export default function TimeEntries() {
|
||||
mutationFn: (id: string) => api.deleteTimeEntry(id),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ["time-entries"] })
|
||||
toast.info("Time entry deleted")
|
||||
}
|
||||
})
|
||||
|
||||
@ -116,53 +122,34 @@ export default function TimeEntries() {
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ["time-entries"] })
|
||||
setSelectedIds([])
|
||||
toast.info("Selected entries deleted")
|
||||
}
|
||||
})
|
||||
|
||||
const importMutation = useMutation({
|
||||
mutationFn: (file: File) => api.importTimeEntriesCsv(file),
|
||||
onSuccess: (data) => {
|
||||
alert(`Successfully imported ${data.count} entries.`)
|
||||
queryClient.invalidateQueries({ queryKey: ["time-entries"] })
|
||||
toast.success(`Successfully imported ${data.count} entries`)
|
||||
}
|
||||
})
|
||||
|
||||
const handleSubmit = async (e: React.FormEvent) => {
|
||||
e.preventDefault()
|
||||
let finalEndTime = formData.endTime
|
||||
const roundingMinutes = settings?.roundingMinutes || 0
|
||||
|
||||
if (finalEndTime && roundingMinutes > 0) {
|
||||
const date = new Date(finalEndTime)
|
||||
const ms = roundingMinutes * 60000
|
||||
const roundedMs = Math.ceil(date.getTime() / ms) * ms
|
||||
const roundedDate = new Date(roundedMs)
|
||||
|
||||
if (roundedDate.getTime() !== date.getTime()) {
|
||||
finalEndTime = roundedDate.toISOString()
|
||||
alert(`Auf ${roundingMinutes}min gerundet`)
|
||||
}
|
||||
}
|
||||
|
||||
createMutation.mutate({
|
||||
...formData,
|
||||
endTime: finalEndTime
|
||||
})
|
||||
const handleScreenRecordingClick = () => {
|
||||
toast.info('Screen-Recording kommt in v2. Aktuell: upload manuell via Documents-Page')
|
||||
}
|
||||
|
||||
if (isError) return <div className="p-8 text-red-500">Error loading time entries.</div>
|
||||
if (isLoading) return <div className="p-8 flex justify-center"><LoadingSpinner /></div>
|
||||
|
||||
return (
|
||||
<div className="p-6 max-w-7xl mx-auto space-y-8">
|
||||
<div className="flex justify-between items-center">
|
||||
<h1 className="text-2xl font-bold">Time Entries</h1>
|
||||
<h1 className="text-3xl font-bold tracking-tight">Time Entries</h1>
|
||||
<div className="flex gap-2">
|
||||
<button
|
||||
onClick={() => fileInputRef.current?.click()}
|
||||
className="px-3 py-2 text-sm bg-gray-100 hover:bg-gray-200 rounded"
|
||||
className="flex items-center gap-2 px-4 py-2 bg-white border rounded-lg hover:bg-gray-50 transition-colors text-sm font-medium"
|
||||
>
|
||||
Import CSV
|
||||
<Upload size={16} /> Import CSV
|
||||
</button>
|
||||
<input
|
||||
type="file"
|
||||
@ -174,210 +161,223 @@ export default function TimeEntries() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form onSubmit={handleSubmit} className="grid grid-cols-1 md:grid-cols-3 gap-4 p-4 bg-gray-50 rounded-lg border">
|
||||
<div className="md:col-span-2">
|
||||
<SuggestionInput
|
||||
label="Description"
|
||||
value={formData.description}
|
||||
onChange={(val) => setFormData({ ...formData, description: val })}
|
||||
suggestions={descriptionSuggestions}
|
||||
placeholder="What did you work on?"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-xs font-medium text-gray-500 mb-1">Template</label>
|
||||
<select
|
||||
className="w-full p-2 border rounded text-sm"
|
||||
onChange={(e) => handleTemplateChange(e.target.value)}
|
||||
value=""
|
||||
>
|
||||
<option value="">Select Template...</option>
|
||||
{templates?.map(t => <option key={t.id} value={t.id}>{t.description}</option>)}
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-xs font-medium text-gray-500 mb-1">Start Time</label>
|
||||
<input
|
||||
type="datetime-local"
|
||||
className="w-full p-2 border rounded text-sm"
|
||||
value={formData.startTime}
|
||||
onChange={(e) => setFormData({ ...formData, startTime: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-xs font-medium text-gray-500 mb-1">End Time</label>
|
||||
<input
|
||||
type="datetime-local"
|
||||
className="w-full p-2 border rounded text-sm"
|
||||
value={formData.endTime}
|
||||
onChange={(e) => setFormData({ ...formData, endTime: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-xs font-medium text-gray-500 mb-1">Project ID</label>
|
||||
<input
|
||||
type="text"
|
||||
className="w-full p-2 border rounded text-sm"
|
||||
value={formData.projectId}
|
||||
onChange={(e) => setFormData({ ...formData, projectId: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
<div className="md:col-span-2">
|
||||
<label className="block text-xs font-medium text-gray-500 mb-1">Notes</label>
|
||||
<textarea
|
||||
className="w-full p-2 border rounded text-sm"
|
||||
value={formData.notes}
|
||||
onChange={(e) => setFormData({ ...formData, notes: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-xs font-medium text-gray-500 mb-1">External Link</label>
|
||||
<input
|
||||
type="text"
|
||||
className="w-full p-2 border rounded text-sm"
|
||||
value={formData.externalLink}
|
||||
onChange={(e) => setFormData({ ...formData, externalLink: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex items-end">
|
||||
<button
|
||||
type="submit"
|
||||
disabled={createMutation.isPending}
|
||||
className="w-full py-2 bg-blue-600 text-white rounded hover:bg-blue-700 disabled:opacity-50"
|
||||
>
|
||||
{createMutation.isPending ? "Saving..." : "Add Entry"}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<div className="grid grid-cols-1 lg:grid-cols-4 gap-8">
|
||||
<div className="lg:col-span-1 space-y-6">
|
||||
<div className="p-6 bg-white border rounded-xl shadow-sm space-y-4">
|
||||
<h2 className="text-lg font-semibold mb-4">New Entry</h2>
|
||||
|
||||
<div className="space-y-3">
|
||||
<SuggestionInput
|
||||
label="Description"
|
||||
value={formData.description}
|
||||
onChange={(val) => setFormData({ ...formData, description: val })}
|
||||
suggestions={descriptionSuggestions}
|
||||
placeholder="What are you working on?"
|
||||
/>
|
||||
|
||||
<SmartFilters
|
||||
filters={filters}
|
||||
setFilters={setFilters}
|
||||
savedViews={savedViews || []}
|
||||
onApplyView={(view) => setFilters({ search: view.search || "", from: view.from || "", to: view.to || "" })}
|
||||
/>
|
||||
|
||||
{entries && entries.length === 0 ? (
|
||||
<EmptyState message="No time entries found." />
|
||||
) : (
|
||||
<div className="overflow-x-auto border rounded-lg">
|
||||
<table className="w-full text-left text-sm">
|
||||
<thead className="bg-gray-50 border-b">
|
||||
<tr>
|
||||
<th className="p-3 w-10">
|
||||
<div className="grid grid-cols-2 gap-2">
|
||||
<div className="space-y-1">
|
||||
<label className="text-xs font-medium text-gray-500">Start</label>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={selectedIds.length > 0 && selectedIds.length === entries?.length}
|
||||
onChange={(e) => setSelectedIds(e.target.checked ? (entries?.map(en => en.id) || []) : [])}
|
||||
type="datetime-local"
|
||||
className="w-full p-2 text-sm border rounded-md"
|
||||
value={formData.startTime}
|
||||
onChange={(e) => setFormData({ ...formData, startTime: e.target.value })}
|
||||
/>
|
||||
</th>
|
||||
<th className="p-3">Description</th>
|
||||
<th className="p-3">Start</th>
|
||||
<th className="p-3">End</th>
|
||||
<th className="p-3">Duration</th>
|
||||
<th className="p-3">Project</th>
|
||||
<th className="p-3 text-right">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{entries?.map(entry => {
|
||||
const start = new Date(entry.startTime)
|
||||
const end = new Date(entry.endTime)
|
||||
const durationMs = end.getTime() - start.getTime()
|
||||
const durationHours = (durationMs / 3600000).toFixed(2)
|
||||
</div>
|
||||
<div className="space-y-1">
|
||||
<label className="text-xs font-medium text-gray-500">End</label>
|
||||
<input
|
||||
type="datetime-local"
|
||||
className="w-full p-2 text-sm border rounded-md"
|
||||
value={formData.endTime}
|
||||
onChange={(e) => setFormData({ ...formData, endTime: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
return (
|
||||
<tr key={entry.id} className={`border-b hover:bg-gray-50 ${expandedRows[entry.id] ? 'bg-blue-50/30' : ''}`}>
|
||||
<td className="p-3">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={selectedIds.includes(entry.id)}
|
||||
onChange={(e) => setSelectedIds(prev => e.target.checked ? [...prev, entry.id] : prev.filter(id => id !== entry.id))}
|
||||
/>
|
||||
</td>
|
||||
<td className="p-3">
|
||||
<div
|
||||
className="cursor-pointer"
|
||||
onClick={() => setExpandedRows(prev => ({ ...prev, [entry.id]: !prev[entry.id] }))}
|
||||
>
|
||||
<div className="font-medium">{entry.description}</div>
|
||||
{expandedRows[entry.id] && (
|
||||
<div className="mt-2 text-xs text-gray-500 max-w-xs">
|
||||
{renderSimpleMarkdown(entry.notes)}
|
||||
{entry.externalLink && (
|
||||
<a href={entry.externalLink} target="_blank" className="block mt-1 text-blue-500 underline">Link</a>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</td>
|
||||
<td className="p-3 text-gray-500">{start.toLocaleString()}</td>
|
||||
<td className="p-3 text-gray-500">{end.toLocaleString()}</td>
|
||||
<td className="p-3">{durationHours}h</td>
|
||||
<td className="p-3">{entry.projectId}</td>
|
||||
<td className="p-3 text-right space-x-2">
|
||||
<button
|
||||
onClick={() => {
|
||||
setEditingId(entry.id)
|
||||
setEditValue(entry.description)
|
||||
}}
|
||||
className="text-blue-600 hover:underline"
|
||||
>
|
||||
Edit
|
||||
</button>
|
||||
<button
|
||||
onClick={() => {
|
||||
if (confirm("Delete this entry?")) deleteMutation.mutate(entry.id)
|
||||
}}
|
||||
className="text-red-600 hover:underline"
|
||||
>
|
||||
Delete
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
)
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
)}
|
||||
<div className="space-y-1">
|
||||
<label className="text-xs font-medium text-gray-500">Project ID</label>
|
||||
<input
|
||||
className="w-full p-2 text-sm border rounded-md"
|
||||
value={formData.projectId}
|
||||
onChange={(e) => setFormData({ ...formData, projectId: e.target.value })}
|
||||
placeholder="Project ID..."
|
||||
/>
|
||||
</div>
|
||||
|
||||
{selectedIds.length > 0 && (
|
||||
<div className="fixed bottom-6 left-1/2 -translate-x-1/2 bg-gray-900 text-white px-4 py-3 rounded-full shadow-xl flex items-center gap-4">
|
||||
<span>{selectedIds.length} entries selected</span>
|
||||
<button
|
||||
onClick={() => {
|
||||
if (confirm(`Delete ${selectedIds.length} entries?`)) bulkDeleteMutation.mutate(selectedIds)
|
||||
}}
|
||||
className="bg-red-600 px-3 py-1 rounded-full text-xs hover:bg-red-700"
|
||||
>
|
||||
Delete Selected
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
<div className="space-y-1">
|
||||
<label className="text-xs font-medium text-gray-500">Notes</label>
|
||||
<textarea
|
||||
className="w-full p-2 text-sm border rounded-md h-20"
|
||||
value={formData.notes}
|
||||
onChange={(e) => setFormData({ ...formData, notes: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{editingId && (
|
||||
<div className="fixed inset-0 bg-black/50 flex items-center justify-center p-4 z-50">
|
||||
<div className="bg-white p-6 rounded-lg max-w-md w-full shadow-xl">
|
||||
<h3 className="text-lg font-bold mb-4">Edit Description</h3>
|
||||
<input
|
||||
className="w-full p-2 border rounded mb-4"
|
||||
value={editValue}
|
||||
onChange={(e) => setEditValue(e.target.value)}
|
||||
autoFocus
|
||||
/>
|
||||
<div className="flex justify-end gap-2">
|
||||
<button onClick={() => setEditingId(null)} className="px-4 py-2 text-gray-600">Cancel</button>
|
||||
<button
|
||||
onClick={() => updateMutation.mutate({ id: editingId, data: { description: editValue } })}
|
||||
className="px-4 py-2 bg-blue-600 text-white rounded"
|
||||
>
|
||||
Save
|
||||
</button>
|
||||
<div className="flex gap-2 pt-2">
|
||||
<button
|
||||
onClick={() => createMutation.mutate(formData)}
|
||||
disabled={createMutation.isPending}
|
||||
className="flex-1 bg-indigo-600 text-white py-2 rounded-md hover:bg-indigo-700 transition-colors font-medium disabled:opacity-50"
|
||||
>
|
||||
{createMutation.isPending ? "Saving..." : "Save Entry"}
|
||||
</button>
|
||||
<button
|
||||
onClick={handleScreenRecordingClick}
|
||||
title="Screen Recording"
|
||||
className="p-2 bg-gray-100 text-gray-600 rounded-md hover:bg-gray-200 transition-colors"
|
||||
>
|
||||
<Camera size={20} />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="p-6 bg-white border rounded-xl shadow-sm space-y-4">
|
||||
<h2 className="text-lg font-semibold">Templates</h2>
|
||||
<div className="space-y-2">
|
||||
{templates?.map(t => (
|
||||
<button
|
||||
key={t.id}
|
||||
onClick={() => handleTemplateChange(t.id)}
|
||||
className="w-full text-left p-2 text-sm border rounded-md hover:border-indigo-300 hover:bg-indigo-50 transition-all"
|
||||
>
|
||||
{t.description}
|
||||
</button>
|
||||
))}
|
||||
{templates?.length === 0 && <p className="text-sm text-gray-400">No templates found.</p>}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="lg:col-span-3 space-y-6">
|
||||
<div className="flex flex-col md:flex-row gap-4 items-start md:items-center justify-between">
|
||||
<SmartFilters
|
||||
filters={filters}
|
||||
setFilters={setFilters}
|
||||
entityType="time-entries"
|
||||
savedViews={savedViews}
|
||||
/>
|
||||
{selectedIds.length > 0 && (
|
||||
<button
|
||||
onClick={() => bulkDeleteMutation.mutate(selectedIds)}
|
||||
className="flex items-center gap-2 px-4 py-2 bg-red-50 text-red-600 border border-red-200 rounded-lg hover:bg-red-100 transition-colors text-sm font-medium"
|
||||
>
|
||||
<Trash2 size={16} /> Delete Selected ({selectedIds.length})
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{isLoading ? (
|
||||
<div className="flex justify-center py-20"><LoadingSpinner /></div>
|
||||
) : entries && entries.length > 0 ? (
|
||||
<div className="bg-white border rounded-xl shadow-sm overflow-hidden">
|
||||
<table className="w-full text-left border-collapse">
|
||||
<thead className="bg-gray-50 border-b">
|
||||
<tr>
|
||||
<th className="p-4 w-10">
|
||||
<input
|
||||
type="checkbox"
|
||||
className="rounded"
|
||||
checked={selectedIds.length === entries.length}
|
||||
onChange={(e) => setSelectedIds(e.target.checked ? entries.map(en => en.id) : [])}
|
||||
/>
|
||||
</th>
|
||||
<th className="p-4 text-sm font-semibold text-gray-600">Description</th>
|
||||
<th className="p-4 text-sm font-semibold text-gray-600">Duration</th>
|
||||
<th className="p-4 text-sm font-semibold text-gray-600">Project</th>
|
||||
<th className="p-4 text-sm font-semibold text-gray-600 text-right">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="divide-y">
|
||||
{entries.map((entry) => (
|
||||
<tr key={entry.id} className="hover:bg-gray-50 group">
|
||||
<td className="p-4">
|
||||
<input
|
||||
type="checkbox"
|
||||
className="rounded"
|
||||
checked={selectedIds.includes(entry.id)}
|
||||
onChange={(e) => {
|
||||
if (e.target.checked) setSelectedIds([...selectedIds, entry.id])
|
||||
else setSelectedIds(selectedIds.filter(id => id !== entry.id))
|
||||
}}
|
||||
/>
|
||||
</td>
|
||||
<td className="p-4">
|
||||
<div className="flex flex-col">
|
||||
{editingId === entry.id ? (
|
||||
<div className="flex gap-2">
|
||||
<input
|
||||
className="border rounded px-2 py-1 text-sm w-full"
|
||||
value={editValue}
|
||||
onChange={(e) => setEditValue(e.target.value)}
|
||||
autoFocus
|
||||
/>
|
||||
<button onClick={() => updateMutation.mutate({ id: entry.id, data: { description: editValue } })} className="text-green-600"><Check size={16}/></button>
|
||||
<button onClick={() => setEditingId(null)} className="text-red-600"><X size={16}/></button>
|
||||
</div>
|
||||
) : (
|
||||
<span
|
||||
className="text-sm font-medium cursor-pointer hover:text-indigo-600"
|
||||
onClick={() => { setEditingId(entry.id); setEditValue(entry.description); }}
|
||||
>
|
||||
{entry.description}
|
||||
</span>
|
||||
)}
|
||||
{expandedRows[entry.id] && (
|
||||
<div className="mt-2 p-3 bg-gray-50 rounded-lg text-xs text-gray-600 space-y-2 border">
|
||||
<div className="flex gap-2">
|
||||
<span className="font-bold">Notes:</span>
|
||||
<div>{renderSimpleMarkdown(entry.notes)}</div>
|
||||
</div>
|
||||
{entry.externalLink && (
|
||||
<div className="flex gap-2">
|
||||
<span className="font-bold">Link:</span>
|
||||
<a href={entry.externalLink} target="_blank" rel="noreferrer" className="text-indigo-600 underline truncate max-w-xs">{entry.externalLink}</a>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</td>
|
||||
<td className="p-4 text-sm text-gray-500">
|
||||
{entry.startTime && entry.endTime ?
|
||||
`${Math.round((new Date(entry.endTime).getTime() - new Date(entry.startTime).getTime()) / 60000)}m`
|
||||
: "—"}
|
||||
</td>
|
||||
<td className="p-4 text-sm text-gray-500">{entry.projectId || "—"}</td>
|
||||
<td className="p-4 text-right">
|
||||
<div className="flex justify-end gap-2 opacity-0 group-hover:opacity-100 transition-opacity">
|
||||
<button
|
||||
onClick={() => setExpandedRows(prev => ({ ...prev, [entry.id]: !prev[entry.id] }))}
|
||||
className="p-1.5 text-gray-400 hover:text-indigo-600 rounded"
|
||||
title="Toggle Details"
|
||||
>
|
||||
<FileText size={16} />
|
||||
</button>
|
||||
<button
|
||||
onClick={() => deleteMutation.mutate(entry.id)}
|
||||
className="p-1.5 text-gray-400 hover:text-red-600 rounded"
|
||||
title="Delete"
|
||||
>
|
||||
<Trash2 size={16} />
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
) : (
|
||||
<EmptyState
|
||||
title="No time entries found"
|
||||
description="Start tracking your time or import a CSV file to get started."
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user