feat(tasks): finished work can be looked at, and is out of the way by default
A task list is what is left to do, so closing something has to take it off the plan. But "what did I get done" is a real question and the answer was nowhere: once a task was closed it left the interface entirely. They come back in one list at the bottom rather than back among the open ones in their sections. A closed task has stopped being work and started being a record, and putting the record in the middle of the plan makes the plan longer without making it say more. Off by default, and deliberately: a list that opens full of things already done is a list you have to read past before you can use it. In localStorage rather than on the account, like the sidebar's width and unlike a folded group. It is a way of *looking*, not a statement about the work — somebody reviewing their week wants it on for ten minutes, and a setting that followed them to every device is one they would have to turn off twice. `loadTasks` asks for closed tasks when the setting is on, rather than each caller deciding. A view added later cannot then forget and quietly ignore it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
4d8b70918b
commit
626ea9aaec
@@ -583,5 +583,9 @@ export const da = {
|
||||
'push.deniedByBrowser':
|
||||
'Browseren har blokeret notifikationer for dette site. Det skal slås til i browserens indstillinger.',
|
||||
'push.notEnabled': 'Notifikationer blev ikke slået til.',
|
||||
'push.noVapidKey': 'Serveren har ingen VAPID-nøgle.'
|
||||
'push.noVapidKey': 'Serveren har ingen VAPID-nøgle.',
|
||||
|
||||
'view.done': 'Færdige',
|
||||
'view.showDone': 'Vis færdige',
|
||||
'view.hideDone': 'Skjul færdige'
|
||||
};
|
||||
|
||||
@@ -578,5 +578,9 @@ export const en = {
|
||||
'push.deniedByBrowser':
|
||||
'The browser has blocked notifications for this site. It has to be turned on in the browser’s own settings.',
|
||||
'push.notEnabled': 'Notifications were not turned on.',
|
||||
'push.noVapidKey': 'The server has no VAPID key.'
|
||||
'push.noVapidKey': 'The server has no VAPID key.',
|
||||
|
||||
'view.done': 'Done',
|
||||
'view.showDone': 'Show done',
|
||||
'view.hideDone': 'Hide done'
|
||||
};
|
||||
|
||||
@@ -192,8 +192,19 @@ class AppState {
|
||||
|
||||
// --- tasks ------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Loads a slice of tasks into the store.
|
||||
*
|
||||
* Closed ones come along when the view is showing them — asked for here rather
|
||||
* than at every call site, so a view added later cannot forget and quietly
|
||||
* ignore the setting. A caller that genuinely wants only what is open passes
|
||||
* `completed: 'exclude'`.
|
||||
*/
|
||||
async loadTasks(params) {
|
||||
const { tasks } = await api.listTasks(params);
|
||||
const { tasks } = await api.listTasks({
|
||||
completed: completedView.shown ? 'include' : undefined,
|
||||
...params
|
||||
});
|
||||
this.tasks = tasks;
|
||||
return tasks;
|
||||
}
|
||||
@@ -661,6 +672,37 @@ function read() {
|
||||
|
||||
export const upcomingView = new UpcomingView();
|
||||
|
||||
/**
|
||||
* Whether the lists show what has already been finished.
|
||||
*
|
||||
* In localStorage rather than on the account, like the sidebar's width and unlike
|
||||
* a folded group. It is a way of *looking* rather than a statement about the work:
|
||||
* somebody reviewing what they got done this week wants it on for ten minutes, and
|
||||
* a setting that followed them to every device would be a setting they had to turn
|
||||
* off twice.
|
||||
*
|
||||
* Off by default, and deliberately. A task list is what is left to do; a list that
|
||||
* opens full of things already done is a list that has to be read past before it
|
||||
* can be used.
|
||||
*/
|
||||
class CompletedView {
|
||||
shown = $state(
|
||||
typeof localStorage !== 'undefined' && localStorage.getItem('verdande:completed') === 'show'
|
||||
);
|
||||
|
||||
toggle() {
|
||||
this.shown = !this.shown;
|
||||
try {
|
||||
localStorage.setItem('verdande:completed', this.shown ? 'show' : 'hide');
|
||||
} catch {
|
||||
// Private browsing; the choice simply will not persist.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const completedView = new CompletedView();
|
||||
|
||||
|
||||
/**
|
||||
* The themes on offer.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user