Add reading list progress actions

This commit is contained in:
2026-05-08 06:23:21 -04:00
parent fc00840697
commit e13557814d
7 changed files with 152 additions and 16 deletions
+32 -1
View File
@@ -2,9 +2,36 @@ use std::time::SystemTime;
use crate::{DomainError, ProfileId, ReadingListId, SpaceId, UrlText};
#[derive(Clone, Debug, Eq, PartialEq)]
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum ReadingProgress {
Unread,
Finished,
}
impl ReadingProgress {
#[must_use]
pub fn label(self) -> &'static str {
match self {
Self::Unread => "Unread",
Self::Finished => "Read",
}
}
#[must_use]
pub fn action_label(self) -> &'static str {
match self {
Self::Unread => "Mark Read",
Self::Finished => "Mark Unread",
}
}
#[must_use]
pub fn toggled(self) -> Self {
match self {
Self::Unread => Self::Finished,
Self::Finished => Self::Unread,
}
}
}
#[derive(Clone, Debug, Eq, PartialEq)]
@@ -74,6 +101,10 @@ impl ReadingListEntry {
&self.progress
}
pub fn set_progress(&mut self, progress: ReadingProgress) {
self.progress = progress;
}
#[must_use]
pub fn added_at(&self) -> SystemTime {
self.added_at