Skip to content

Show last 3 recently viewed tasks in navbar 馃晲#337

Description

@anoopcodehack

Show last 3 recently viewed tasks in navbar 馃晲
File: client/src/pages/Dashboard.jsx

No way to quickly jump back to a task
you were just looking at 馃拃 fr!!

Fix: save to localStorage on task click:
const handleSelectTask = (task) => {
const recent = JSON.parse(
localStorage.getItem('recent_tasks') || '[]'
)
const updated = [task,
...recent.filter(t => t._id !== task._id)
].slice(0, 3)
localStorage.setItem('recent_tasks', JSON.stringify(updated))
setSelectedTask(task)
}

Show in navbar as small clickable chips!
~12 lines! No backend needed 馃幆

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions