summaryrefslogtreecommitdiff
path: root/src/components/TaskList.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/TaskList.tsx')
-rw-r--r--src/components/TaskList.tsx9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/components/TaskList.tsx b/src/components/TaskList.tsx
index 6ecce42..6cd9c3f 100644
--- a/src/components/TaskList.tsx
+++ b/src/components/TaskList.tsx
@@ -10,10 +10,12 @@ export function TaskList() {
const [newName, setNewName] = useState('');
const [newSessions, setNewSessions] = useState(4);
+ const clampSessions = (value: number) => Math.min(20, Math.max(1, value));
+
const handleAdd = async () => {
const name = newName.trim();
if (!name) return;
- await addTask(name, newSessions);
+ await addTask(name, clampSessions(newSessions));
setNewName('');
setNewSessions(4);
setShowForm(false);
@@ -133,7 +135,7 @@ export function TaskList() {
min={1}
max={20}
value={newSessions}
- onChange={(e) => setNewSessions(Math.max(1, parseInt(e.target.value) || 1))}
+ onChange={(e) => setNewSessions(clampSessions(parseInt(e.target.value, 10) || 1))}
style={{
fontFamily: 'var(--font-mono)',
fontSize: '14px',
@@ -185,9 +187,10 @@ export function TaskList() {
fontFamily: 'var(--font-sans)',
fontSize: '13px',
color: 'var(--fg-4)',
+ lineHeight: 1.5,
}}
>
- No tasks yet
+ No tasks yet. Add one to track deliberate focus sessions.
</div>
)}
{tasks.map((task) => {