Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add Additional Information To Bookmarks Page #17

Merged
merged 1 commit into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion i18n/en/cosmicding.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ no-bookmarks = No bookmarks
no-bookmarks-found-for-account = No bookmarks found for account {$acc}
notes = Notes
open-accounts-page = Open Accounts Page
open-instance = Open instance
open-instance = Open Instance
provided-url-is-not-valid = Provided URL is not valid
quit = Quit
refresh = Refresh
Expand All @@ -58,6 +58,7 @@ setting-managed-externally = This setting can only be managed from Linkding web
settings = Settings
shared = Shared
shared-disabled = Shared (Disabled)
snapshot = Snapshot
successful = successful
tags = Tags
tags-subtext = Enter any number of tags separated by space.
Expand Down
19 changes: 19 additions & 0 deletions src/pages/bookmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::app::Message;
use crate::fl;
use crate::models::account::Account;
use crate::models::bookmarks::Bookmark;
use chrono::{DateTime, Local};
use cosmic::iced::Length;
use cosmic::{
app::command::Task,
Expand Down Expand Up @@ -72,6 +73,8 @@ impl PageBookmarksView {
.iter()
.find(|&account| account.id == item.user_account_id)
.unwrap();
let date_added: DateTime<Local> =
item.date_added.clone().unwrap().parse().expect("");
let mut columns = Vec::new();
// Mandatory first row - title
columns.push(
Expand Down Expand Up @@ -168,6 +171,19 @@ impl PageBookmarksView {
.on_press(AppBookmarksMessage::ViewNotes(item.clone())),
);
}
if !item.web_archive_snapshot_url.is_empty() {
actions_row = actions_row.push(
widget::button::link(fl!("snapshot"))
.spacing(spacing.space_xxxs)
.trailing_icon(true)
.font_size(12)
.icon_size(11)
.tooltip(item.web_archive_snapshot_url.clone())
.on_press(AppBookmarksMessage::OpenExternalURL(
item.web_archive_snapshot_url.clone(),
)),
);
}
columns.push(
actions_row
.padding([
Expand All @@ -180,6 +196,9 @@ impl PageBookmarksView {
);
// Mandatory fifth row - details
let mut details_row = widget::row::with_capacity(1).spacing(spacing.space_xxs);
details_row = details_row
.push(widget::icon::from_name("accessories-clock-symbolic").size(12))
.push(widget::text(date_added.to_rfc2822()).size(12));
if item.is_archived {
details_row = details_row
.push(widget::icon::from_name("mail-archive-symbolic").size(12))
Expand Down
Loading