Add reading list removal

This commit is contained in:
2026-05-08 06:29:16 -04:00
parent e13557814d
commit 5db300f107
4 changed files with 69 additions and 2 deletions
@@ -143,6 +143,7 @@ impl ElyShell {
.child(progress_label(entry.progress())),
)
.child(render_progress_action(index, entry_id, progress, cx))
.child(render_remove_action(index, entry.id().clone(), cx))
.into_any_element()
}
}
@@ -210,6 +211,23 @@ fn render_progress_action(
.into_any_element()
}
fn render_remove_action(
index: usize,
entry_id: ReadingListId,
cx: &mut Context<ElyShell>,
) -> AnyElement {
Button::new(("remove-reading-list", index))
.danger()
.xsmall()
.icon(IconName::Delete)
.label("Remove")
.tooltip("Remove From Reading List")
.on_click(cx.listener(move |shell, _, _, cx| {
shell.remove_reading_list_entry(&entry_id, cx);
}))
.into_any_element()
}
fn reading_list_count_label(count: usize) -> String {
match count {
1 => "1 item".to_string(),
+12
View File
@@ -16,4 +16,16 @@ impl ElyShell {
cx.notify();
}
}
pub(super) fn remove_reading_list_entry(
&mut self,
entry_id: &ReadingListId,
cx: &mut Context<Self>,
) {
if let ShellState::Ready(core) = &mut self.state
&& core.remove_reading_list_entry(entry_id).is_ok()
{
cx.notify();
}
}
}