mirror of
https://github.com/aljazceru/notedeck.git
synced 2026-01-07 10:24:20 +01:00
Merge remote-tracking branches 'github/pr/877' and 'github/pr/885'
Fernando López Guevara (2):
fix(content): handle case where notes are not loaded
feat(app_images): add module to manage static app image assets
This commit is contained in:
@@ -420,11 +420,11 @@ fn render_nav_body(
|
||||
zaps: ctx.zaps,
|
||||
pool: ctx.pool,
|
||||
job_pool: ctx.job_pool,
|
||||
unknown_ids: ctx.unknown_ids,
|
||||
current_account_has_wallet: get_current_wallet(ctx.accounts, ctx.global_wallet).is_some(),
|
||||
};
|
||||
match top {
|
||||
Route::Timeline(kind) => render_timeline_route(
|
||||
ctx.unknown_ids,
|
||||
&mut app.timeline_cache,
|
||||
ctx.accounts,
|
||||
kind,
|
||||
@@ -436,7 +436,6 @@ fn render_nav_body(
|
||||
&mut app.jobs,
|
||||
),
|
||||
Route::Thread(selection) => render_thread_route(
|
||||
ctx.unknown_ids,
|
||||
&mut app.threads,
|
||||
ctx.accounts,
|
||||
selection,
|
||||
|
||||
@@ -6,12 +6,11 @@ use crate::{
|
||||
};
|
||||
|
||||
use enostr::Pubkey;
|
||||
use notedeck::{Accounts, MuteFun, NoteContext, UnknownIds};
|
||||
use notedeck::{Accounts, MuteFun, NoteContext};
|
||||
use notedeck_ui::{jobs::JobsCache, NoteOptions};
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn render_timeline_route(
|
||||
unknown_ids: &mut UnknownIds,
|
||||
timeline_cache: &mut TimelineCache,
|
||||
accounts: &mut Accounts,
|
||||
kind: &TimelineKind,
|
||||
@@ -50,7 +49,6 @@ pub fn render_timeline_route(
|
||||
pubkey,
|
||||
accounts,
|
||||
timeline_cache,
|
||||
unknown_ids,
|
||||
col,
|
||||
ui,
|
||||
&accounts.mutefun(),
|
||||
@@ -79,7 +77,6 @@ pub fn render_timeline_route(
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn render_thread_route(
|
||||
unknown_ids: &mut UnknownIds,
|
||||
threads: &mut Threads,
|
||||
accounts: &mut Accounts,
|
||||
selection: &ThreadSelection,
|
||||
@@ -95,7 +92,6 @@ pub fn render_thread_route(
|
||||
|
||||
ui::ThreadView::new(
|
||||
threads,
|
||||
unknown_ids,
|
||||
selection.selected_or_root(),
|
||||
note_options,
|
||||
&accounts.mutefun(),
|
||||
@@ -113,7 +109,6 @@ pub fn render_profile_route(
|
||||
pubkey: &Pubkey,
|
||||
accounts: &Accounts,
|
||||
timeline_cache: &mut TimelineCache,
|
||||
unknown_ids: &mut UnknownIds,
|
||||
col: usize,
|
||||
ui: &mut egui::Ui,
|
||||
is_muted: &MuteFun,
|
||||
@@ -127,7 +122,6 @@ pub fn render_profile_route(
|
||||
col,
|
||||
timeline_cache,
|
||||
note_options,
|
||||
unknown_ids,
|
||||
is_muted,
|
||||
note_context,
|
||||
jobs,
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
use crate::login_manager::AcquireKeyState;
|
||||
use crate::ui::{Preview, PreviewConfig};
|
||||
use egui::{
|
||||
Align, Button, Color32, Frame, Image, InnerResponse, Margin, RichText, TextBuffer, Vec2,
|
||||
Align, Button, Color32, Frame, InnerResponse, Layout, Margin, RichText, TextBuffer, TextEdit,
|
||||
Vec2,
|
||||
};
|
||||
use egui::{Layout, TextEdit};
|
||||
use egui_winit::clipboard::Clipboard;
|
||||
use enostr::Keypair;
|
||||
use notedeck::{fonts::get_font_size, AppAction, NotedeckTextStyle};
|
||||
use notedeck_ui::context_menu::{input_context, PasteBehavior};
|
||||
use notedeck_ui::{
|
||||
app_images,
|
||||
context_menu::{input_context, PasteBehavior},
|
||||
};
|
||||
|
||||
pub struct AccountLoginView<'a> {
|
||||
manager: &'a mut AcquireKeyState,
|
||||
@@ -138,15 +141,15 @@ fn login_textedit(manager: &mut AcquireKeyState) -> TextEdit {
|
||||
|
||||
fn eye_button(ui: &mut egui::Ui, is_visible: bool) -> egui::Response {
|
||||
let is_dark_mode = ui.visuals().dark_mode;
|
||||
let icon = Image::new(if is_visible && is_dark_mode {
|
||||
egui::include_image!("../../../../assets/icons/eye-dark.png")
|
||||
let icon = if is_visible && is_dark_mode {
|
||||
app_images::eye_dark_image()
|
||||
} else if is_visible {
|
||||
egui::include_image!("../../../../assets/icons/eye-light.png")
|
||||
app_images::eye_light_image()
|
||||
} else if is_dark_mode {
|
||||
egui::include_image!("../../../../assets/icons/eye-slash-dark.png")
|
||||
app_images::eye_slash_dark_image()
|
||||
} else {
|
||||
egui::include_image!("../../../../assets/icons/eye-slash-light.png")
|
||||
});
|
||||
app_images::eye_slash_light_image()
|
||||
};
|
||||
ui.add(Button::image(icon).frame(false))
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
use egui::{
|
||||
Align, Button, Frame, Image, InnerResponse, Layout, RichText, ScrollArea, Ui, UiBuilder, Vec2,
|
||||
Align, Button, Frame, InnerResponse, Layout, RichText, ScrollArea, Ui, UiBuilder, Vec2,
|
||||
};
|
||||
use nostrdb::{Ndb, Transaction};
|
||||
use notedeck::{Accounts, Images};
|
||||
use notedeck_ui::colors::PINK;
|
||||
|
||||
use notedeck_ui::app_images;
|
||||
use notedeck_ui::profile::preview::SimpleProfilePreview;
|
||||
|
||||
pub struct AccountsView<'a> {
|
||||
@@ -175,10 +176,8 @@ fn scroll_area() -> ScrollArea {
|
||||
}
|
||||
|
||||
fn add_account_button() -> Button<'static> {
|
||||
let img_data = egui::include_image!("../../../../assets/icons/add_account_icon_4x.png");
|
||||
let img = Image::new(img_data).fit_to_exact_size(Vec2::new(48.0, 48.0));
|
||||
Button::image_and_text(
|
||||
img,
|
||||
app_images::add_account_image().fit_to_exact_size(Vec2::new(48.0, 48.0)),
|
||||
RichText::new(" Add account")
|
||||
.size(16.0)
|
||||
// TODO: this color should not be hard coded. Find some way to add it to the visuals
|
||||
|
||||
@@ -2,8 +2,8 @@ use core::f32;
|
||||
use std::collections::HashMap;
|
||||
|
||||
use egui::{
|
||||
pos2, vec2, Align, Color32, FontId, Id, ImageSource, Margin, Pos2, Rect, RichText, Separator,
|
||||
Ui, Vec2, Widget,
|
||||
pos2, vec2, Align, Color32, FontId, Id, Image, Margin, Pos2, Rect, RichText, Separator, Ui,
|
||||
Vec2, Widget,
|
||||
};
|
||||
use enostr::Pubkey;
|
||||
use nostrdb::{Ndb, Transaction};
|
||||
@@ -17,7 +17,7 @@ use crate::{
|
||||
};
|
||||
|
||||
use notedeck::{AppContext, Images, NotedeckTextStyle, UserAccount};
|
||||
use notedeck_ui::anim::ICON_EXPANSION_MULTIPLE;
|
||||
use notedeck_ui::{anim::ICON_EXPANSION_MULTIPLE, app_images};
|
||||
use tokenator::{ParseError, TokenParser, TokenSerializable, TokenWriter};
|
||||
|
||||
use crate::ui::widgets::styled_button;
|
||||
@@ -226,7 +226,7 @@ impl<'a> AddColumnView<'a> {
|
||||
let algo_option = ColumnOptionData {
|
||||
title: "Contact List",
|
||||
description: "Source the last note for each user in your contact list",
|
||||
icon: egui::include_image!("../../../../assets/icons/home_icon_dark_4x.png"),
|
||||
icon: app_images::home_image(),
|
||||
option: AddColumnOption::Algo(AlgoOption::LastPerPubkey(Decision::Decided(
|
||||
ListKind::contact_list(deck_author),
|
||||
))),
|
||||
@@ -244,7 +244,7 @@ impl<'a> AddColumnView<'a> {
|
||||
let algo_option = ColumnOptionData {
|
||||
title: "Last Note per User",
|
||||
description: "Show the last note for each user from a list",
|
||||
icon: egui::include_image!("../../../../assets/icons/algo.png"),
|
||||
icon: app_images::algo_image(),
|
||||
option: AddColumnOption::Algo(AlgoOption::LastPerPubkey(Decision::Undecided)),
|
||||
};
|
||||
|
||||
@@ -434,7 +434,7 @@ impl<'a> AddColumnView<'a> {
|
||||
);
|
||||
|
||||
let icon_cur_y = animation_rect.top() + cur_height_padding + (total_content_height / 2.0);
|
||||
let icon_img = egui::Image::new(data.icon).fit_to_exact_size(cur_icon_size);
|
||||
let icon_img = data.icon.fit_to_exact_size(cur_icon_size);
|
||||
let icon_rect = Rect::from_center_size(pos2(cur_icon_x_pos, icon_cur_y), cur_icon_size);
|
||||
|
||||
icon_img.paint_at(ui, icon_rect);
|
||||
@@ -449,7 +449,7 @@ impl<'a> AddColumnView<'a> {
|
||||
vec.push(ColumnOptionData {
|
||||
title: "Universe",
|
||||
description: "See the whole nostr universe",
|
||||
icon: egui::include_image!("../../../../assets/icons/universe_icon_dark_4x.png"),
|
||||
icon: app_images::universe_image(),
|
||||
option: AddColumnOption::Universe,
|
||||
});
|
||||
|
||||
@@ -463,32 +463,32 @@ impl<'a> AddColumnView<'a> {
|
||||
vec.push(ColumnOptionData {
|
||||
title: "Contacts",
|
||||
description: "See notes from your contacts",
|
||||
icon: egui::include_image!("../../../../assets/icons/home_icon_dark_4x.png"),
|
||||
icon: app_images::home_image(),
|
||||
option: AddColumnOption::Contacts(source),
|
||||
});
|
||||
}
|
||||
vec.push(ColumnOptionData {
|
||||
title: "Notifications",
|
||||
description: "Stay up to date with notifications and mentions",
|
||||
icon: egui::include_image!("../../../../assets/icons/notifications_icon_dark_4x.png"),
|
||||
icon: app_images::notifications_image(),
|
||||
option: AddColumnOption::UndecidedNotification,
|
||||
});
|
||||
vec.push(ColumnOptionData {
|
||||
title: "Hashtags",
|
||||
description: "Stay up to date with a certain hashtag",
|
||||
icon: egui::include_image!("../../../../assets/icons/hashtag_icon_4x.png"),
|
||||
icon: app_images::hashtag_image(),
|
||||
option: AddColumnOption::UndecidedHashtag,
|
||||
});
|
||||
vec.push(ColumnOptionData {
|
||||
title: "Individual",
|
||||
description: "Stay up to date with someone's notes & replies",
|
||||
icon: egui::include_image!("../../../../assets/icons/profile_icon_4x.png"),
|
||||
icon: app_images::profile_image(),
|
||||
option: AddColumnOption::UndecidedIndividual,
|
||||
});
|
||||
vec.push(ColumnOptionData {
|
||||
title: "Algo",
|
||||
description: "Algorithmic feeds to aid in note discovery",
|
||||
icon: egui::include_image!("../../../../assets/icons/algo.png"),
|
||||
icon: app_images::algo_image(),
|
||||
option: AddColumnOption::Algo(AlgoOption::LastPerPubkey(Decision::Undecided)),
|
||||
});
|
||||
|
||||
@@ -508,9 +508,7 @@ impl<'a> AddColumnView<'a> {
|
||||
vec.push(ColumnOptionData {
|
||||
title: "Your Notifications",
|
||||
description: "Stay up to date with your notifications and mentions",
|
||||
icon: egui::include_image!(
|
||||
"../../../../assets/icons/notifications_icon_dark_4x.png"
|
||||
),
|
||||
icon: app_images::notifications_image(),
|
||||
option: AddColumnOption::Notification(source),
|
||||
});
|
||||
}
|
||||
@@ -518,7 +516,7 @@ impl<'a> AddColumnView<'a> {
|
||||
vec.push(ColumnOptionData {
|
||||
title: "Someone else's Notifications",
|
||||
description: "Stay up to date with someone else's notifications and mentions",
|
||||
icon: egui::include_image!("../../../../assets/icons/notifications_icon_dark_4x.png"),
|
||||
icon: app_images::notifications_image(),
|
||||
option: AddColumnOption::ExternalNotification,
|
||||
});
|
||||
|
||||
@@ -538,7 +536,7 @@ impl<'a> AddColumnView<'a> {
|
||||
vec.push(ColumnOptionData {
|
||||
title: "Your Notes",
|
||||
description: "Keep track of your notes & replies",
|
||||
icon: egui::include_image!("../../../../assets/icons/profile_icon_4x.png"),
|
||||
icon: app_images::profile_image(),
|
||||
option: AddColumnOption::Individual(source),
|
||||
});
|
||||
}
|
||||
@@ -546,7 +544,7 @@ impl<'a> AddColumnView<'a> {
|
||||
vec.push(ColumnOptionData {
|
||||
title: "Someone else's Notes",
|
||||
description: "Stay up to date with someone else's notes & replies",
|
||||
icon: egui::include_image!("../../../../assets/icons/profile_icon_4x.png"),
|
||||
icon: app_images::profile_image(),
|
||||
option: AddColumnOption::ExternalIndividual,
|
||||
});
|
||||
|
||||
@@ -586,7 +584,7 @@ pub(crate) fn sized_button(text: &str) -> impl Widget + '_ {
|
||||
struct ColumnOptionData {
|
||||
title: &'static str,
|
||||
description: &'static str,
|
||||
icon: ImageSource<'static>,
|
||||
icon: Image<'static>,
|
||||
option: AddColumnOption,
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ use egui::{Margin, Response, RichText, Sense, Stroke, UiBuilder};
|
||||
use enostr::Pubkey;
|
||||
use nostrdb::{Ndb, Transaction};
|
||||
use notedeck::{Images, NotedeckTextStyle};
|
||||
use notedeck_ui::app_images;
|
||||
use notedeck_ui::{
|
||||
anim::{AnimationHelper, ICON_EXPANSION_MULTIPLE},
|
||||
ProfilePic,
|
||||
@@ -152,12 +153,12 @@ impl<'a> NavTitle<'a> {
|
||||
let img_size = 16.0;
|
||||
let max_size = icon_width * ICON_EXPANSION_MULTIPLE;
|
||||
|
||||
let img_data = if ui.visuals().dark_mode {
|
||||
egui::include_image!("../../../../../assets/icons/column_delete_icon_4x.png")
|
||||
let img = (if ui.visuals().dark_mode {
|
||||
app_images::delete_dark_image()
|
||||
} else {
|
||||
egui::include_image!("../../../../../assets/icons/column_delete_icon_light_4x.png")
|
||||
};
|
||||
let img = egui::Image::new(img_data).max_width(img_size);
|
||||
app_images::delete_light_image()
|
||||
})
|
||||
.max_width(img_size);
|
||||
|
||||
let helper =
|
||||
AnimationHelper::new(ui, "delete-column-button", egui::vec2(max_size, max_size));
|
||||
@@ -427,14 +428,9 @@ impl<'a> NavTitle<'a> {
|
||||
fn title_pfp(&mut self, ui: &mut egui::Ui, top: &Route, pfp_size: f32) -> Option<Response> {
|
||||
match top {
|
||||
Route::Timeline(kind) => match kind {
|
||||
TimelineKind::Hashtag(_ht) => Some(
|
||||
ui.add(
|
||||
egui::Image::new(egui::include_image!(
|
||||
"../../../../../assets/icons/hashtag_icon_4x.png"
|
||||
))
|
||||
.fit_to_exact_size(egui::vec2(pfp_size, pfp_size)),
|
||||
),
|
||||
),
|
||||
TimelineKind::Hashtag(_ht) => Some(ui.add(
|
||||
app_images::hashtag_image().fit_to_exact_size(egui::vec2(pfp_size, pfp_size)),
|
||||
)),
|
||||
|
||||
TimelineKind::Profile(pubkey) => Some(self.show_profile(ui, pubkey, pfp_size)),
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ use nostrdb::{Ndb, ProfileRecord, Transaction};
|
||||
use notedeck::{
|
||||
fonts::get_font_size, get_profile_url, name::get_display_name, Images, NotedeckTextStyle,
|
||||
};
|
||||
use notedeck_ui::{colors, profile::display_name_widget, AnimationHelper, ProfilePic};
|
||||
use notedeck_ui::{app_images, colors, profile::display_name_widget, AnimationHelper, ProfilePic};
|
||||
|
||||
use crate::ui::widgets::styled_button_toggleable;
|
||||
|
||||
@@ -143,10 +143,9 @@ fn show_title(ui: &mut egui::Ui) {
|
||||
);
|
||||
painter.circle_filled(rect.center(), max_size / 2.0, circle_color);
|
||||
|
||||
let img_data = egui::include_image!("../../../../../assets/icons/filled_zap_icon.svg");
|
||||
let zap_max_width = 25.16;
|
||||
let zap_max_height = 29.34;
|
||||
let img = egui::Image::new(img_data)
|
||||
let img = app_images::filled_zap_image()
|
||||
.max_width(zap_max_width)
|
||||
.max_height(zap_max_height);
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ use egui::{
|
||||
};
|
||||
use enostr::{FilledKeypair, FullKeypair, KeypairUnowned, NoteId, Pubkey, RelayPool};
|
||||
use nostrdb::{Ndb, Transaction};
|
||||
use notedeck_ui::app_images;
|
||||
use notedeck_ui::blur::PixelDimensions;
|
||||
use notedeck_ui::images::{get_render_state, RenderState};
|
||||
use notedeck_ui::jobs::JobsCache;
|
||||
@@ -640,11 +641,15 @@ fn media_upload_button() -> impl egui::Widget {
|
||||
|
||||
painter.rect_filled(resp.rect, 8.0, fill_color);
|
||||
painter.rect_stroke(resp.rect, 8.0, stroke, egui::StrokeKind::Middle);
|
||||
egui::Image::new(egui::include_image!(
|
||||
"../../../../../assets/icons/media_upload_dark_4x.png"
|
||||
))
|
||||
.max_size(egui::vec2(16.0, 16.0))
|
||||
.paint_at(ui, resp.rect.shrink(8.0));
|
||||
let mut upload_img = app_images::media_upload_dark_image();
|
||||
|
||||
if !ui.visuals().dark_mode {
|
||||
upload_img = upload_img.tint(egui::Color32::BLACK);
|
||||
};
|
||||
|
||||
upload_img
|
||||
.max_size(egui::vec2(16.0, 16.0))
|
||||
.paint_at(ui, resp.rect.shrink(8.0));
|
||||
resp
|
||||
}
|
||||
}
|
||||
@@ -785,6 +790,7 @@ mod preview {
|
||||
zaps: app.zaps,
|
||||
pool: app.pool,
|
||||
job_pool: app.job_pool,
|
||||
unknown_ids: app.unknown_ids,
|
||||
current_account_has_wallet: false,
|
||||
};
|
||||
|
||||
|
||||
@@ -12,9 +12,10 @@ use crate::{
|
||||
};
|
||||
use notedeck::{
|
||||
name::get_display_name, profile::get_profile_url, Accounts, MuteFun, NoteAction, NoteContext,
|
||||
NotedeckTextStyle, UnknownIds,
|
||||
NotedeckTextStyle,
|
||||
};
|
||||
use notedeck_ui::{
|
||||
app_images,
|
||||
jobs::JobsCache,
|
||||
profile::{about_section_widget, banner, display_name_widget},
|
||||
NoteOptions, ProfilePic,
|
||||
@@ -26,7 +27,6 @@ pub struct ProfileView<'a, 'd> {
|
||||
col_id: usize,
|
||||
timeline_cache: &'a mut TimelineCache,
|
||||
note_options: NoteOptions,
|
||||
unknown_ids: &'a mut UnknownIds,
|
||||
is_muted: &'a MuteFun,
|
||||
note_context: &'a mut NoteContext<'d>,
|
||||
jobs: &'a mut JobsCache,
|
||||
@@ -45,7 +45,6 @@ impl<'a, 'd> ProfileView<'a, 'd> {
|
||||
col_id: usize,
|
||||
timeline_cache: &'a mut TimelineCache,
|
||||
note_options: NoteOptions,
|
||||
unknown_ids: &'a mut UnknownIds,
|
||||
is_muted: &'a MuteFun,
|
||||
note_context: &'a mut NoteContext<'d>,
|
||||
jobs: &'a mut JobsCache,
|
||||
@@ -56,7 +55,6 @@ impl<'a, 'd> ProfileView<'a, 'd> {
|
||||
col_id,
|
||||
timeline_cache,
|
||||
note_options,
|
||||
unknown_ids,
|
||||
is_muted,
|
||||
note_context,
|
||||
jobs,
|
||||
@@ -103,7 +101,7 @@ impl<'a, 'd> ProfileView<'a, 'd> {
|
||||
if let Err(e) = profile_timeline.poll_notes_into_view(
|
||||
self.note_context.ndb,
|
||||
&txn,
|
||||
self.unknown_ids,
|
||||
self.note_context.unknown_ids,
|
||||
self.note_context.note_cache,
|
||||
reversed,
|
||||
) {
|
||||
@@ -221,9 +219,13 @@ impl<'a, 'd> ProfileView<'a, 'd> {
|
||||
}
|
||||
|
||||
fn handle_link(ui: &mut egui::Ui, website_url: &str) {
|
||||
ui.image(egui::include_image!(
|
||||
"../../../../../assets/icons/links_4x.png"
|
||||
));
|
||||
let img = if ui.visuals().dark_mode {
|
||||
app_images::link_image()
|
||||
} else {
|
||||
app_images::link_image().tint(egui::Color32::BLACK)
|
||||
};
|
||||
|
||||
ui.add(img);
|
||||
if ui
|
||||
.label(RichText::new(website_url).color(notedeck_ui::colors::PINK))
|
||||
.on_hover_cursor(egui::CursorIcon::PointingHand)
|
||||
@@ -237,9 +239,12 @@ fn handle_link(ui: &mut egui::Ui, website_url: &str) {
|
||||
}
|
||||
|
||||
fn handle_lud16(ui: &mut egui::Ui, lud16: &str) {
|
||||
ui.image(egui::include_image!(
|
||||
"../../../../../assets/icons/zap_4x.png"
|
||||
));
|
||||
let img = if ui.visuals().dark_mode {
|
||||
app_images::zap_image()
|
||||
} else {
|
||||
app_images::zap_image().tint(egui::Color32::BLACK)
|
||||
};
|
||||
ui.add(img);
|
||||
|
||||
let _ = ui.label(RichText::new(lud16).color(notedeck_ui::colors::PINK));
|
||||
}
|
||||
@@ -273,10 +278,8 @@ fn copy_key_widget(pfp_rect: &egui::Rect) -> impl egui::Widget + '_ {
|
||||
Stroke::new(1.0, stroke_color),
|
||||
egui::StrokeKind::Outside,
|
||||
);
|
||||
egui::Image::new(egui::include_image!(
|
||||
"../../../../../assets/icons/key_4x.png"
|
||||
))
|
||||
.paint_at(
|
||||
|
||||
app_images::key_image().paint_at(
|
||||
ui,
|
||||
#[allow(deprecated)]
|
||||
painter.round_rect_to_pixels(egui::Rect::from_center_size(
|
||||
@@ -343,10 +346,9 @@ fn edit_profile_button() -> impl egui::Widget + 'static {
|
||||
|
||||
painter.galley(galley_rect.left_top(), galley, Color32::WHITE);
|
||||
|
||||
egui::Image::new(egui::include_image!(
|
||||
"../../../../../assets/icons/edit_icon_4x_dark.png"
|
||||
))
|
||||
.paint_at(ui, edit_icon_rect);
|
||||
app_images::edit_dark_image()
|
||||
.tint(ui.visuals().text_color())
|
||||
.paint_at(ui, edit_icon_rect);
|
||||
|
||||
resp
|
||||
}
|
||||
|
||||
@@ -2,11 +2,10 @@ use std::collections::HashMap;
|
||||
|
||||
use crate::relay_pool_manager::{RelayPoolManager, RelayStatus};
|
||||
use crate::ui::{Preview, PreviewConfig};
|
||||
use egui::{
|
||||
Align, Button, CornerRadius, Frame, Id, Image, Layout, Margin, Rgba, RichText, Ui, Vec2,
|
||||
};
|
||||
use egui::{Align, Button, CornerRadius, Frame, Id, Layout, Margin, Rgba, RichText, Ui, Vec2};
|
||||
use enostr::RelayPool;
|
||||
use notedeck::{Accounts, NotedeckTextStyle};
|
||||
use notedeck_ui::app_images;
|
||||
use notedeck_ui::{colors::PINK, padding, View};
|
||||
use tracing::debug;
|
||||
|
||||
@@ -180,10 +179,8 @@ impl<'a> RelayView<'a> {
|
||||
}
|
||||
|
||||
fn add_relay_button() -> Button<'static> {
|
||||
let img_data = egui::include_image!("../../../../assets/icons/add_relay_icon_4x.png");
|
||||
let img = Image::new(img_data).fit_to_exact_size(Vec2::new(48.0, 48.0));
|
||||
Button::image_and_text(
|
||||
img,
|
||||
app_images::add_relay_image().fit_to_exact_size(Vec2::new(48.0, 48.0)),
|
||||
RichText::new(" Add relay")
|
||||
.size(16.0)
|
||||
// TODO: this color should not be hard coded. Find some way to add it to the visuals
|
||||
@@ -207,18 +204,14 @@ fn get_right_side_width(status: RelayStatus) -> f32 {
|
||||
}
|
||||
}
|
||||
|
||||
fn delete_button(_dark_mode: bool) -> egui::Button<'static> {
|
||||
/*
|
||||
let img_data = if dark_mode {
|
||||
egui::include_image!("../../assets/icons/delete_icon_4x.png")
|
||||
fn delete_button(dark_mode: bool) -> egui::Button<'static> {
|
||||
let img = if dark_mode {
|
||||
app_images::delete_dark_image()
|
||||
} else {
|
||||
// TODO: use light delete icon
|
||||
egui::include_image!("../../assets/icons/delete_icon_4x.png")
|
||||
app_images::delete_light_image()
|
||||
};
|
||||
*/
|
||||
let img_data = egui::include_image!("../../../../assets/icons/delete_icon_4x.png");
|
||||
|
||||
egui::Button::image(egui::Image::new(img_data).max_width(10.0)).frame(false)
|
||||
egui::Button::image(img.max_width(10.0)).frame(false)
|
||||
}
|
||||
|
||||
fn relay_frame(ui: &mut Ui) -> Frame {
|
||||
@@ -254,19 +247,11 @@ fn show_connection_status(ui: &mut Ui, status: RelayStatus) {
|
||||
}
|
||||
|
||||
fn get_connection_icon(status: RelayStatus) -> egui::Image<'static> {
|
||||
let img_data = match status {
|
||||
RelayStatus::Connected => {
|
||||
egui::include_image!("../../../../assets/icons/connected_icon_4x.png")
|
||||
}
|
||||
RelayStatus::Connecting => {
|
||||
egui::include_image!("../../../../assets/icons/connecting_icon_4x.png")
|
||||
}
|
||||
RelayStatus::Disconnected => {
|
||||
egui::include_image!("../../../../assets/icons/disconnected_icon_4x.png")
|
||||
}
|
||||
};
|
||||
|
||||
egui::Image::new(img_data)
|
||||
match status {
|
||||
RelayStatus::Connected => app_images::connected_image(),
|
||||
RelayStatus::Connecting => app_images::connecting_image(),
|
||||
RelayStatus::Disconnected => app_images::disconnected_image(),
|
||||
}
|
||||
}
|
||||
|
||||
// PREVIEWS
|
||||
|
||||
@@ -12,7 +12,7 @@ use crate::{
|
||||
use notedeck::{Accounts, UserAccount};
|
||||
use notedeck_ui::{
|
||||
anim::{AnimationHelper, ICON_EXPANSION_MULTIPLE},
|
||||
colors, View,
|
||||
app_images, colors, View,
|
||||
};
|
||||
|
||||
use super::configure_deck::deck_icon;
|
||||
@@ -105,7 +105,7 @@ impl<'a> DesktopSidePanel<'a> {
|
||||
compose_resp.on_hover_cursor(egui::CursorIcon::NotAllowed)
|
||||
};
|
||||
let search_resp = ui.add(search_button());
|
||||
let column_resp = ui.add(add_column_button(dark_mode));
|
||||
let column_resp = ui.add(add_column_button());
|
||||
|
||||
ui.add(Separator::default().horizontal().spacing(8.0).shrink(4.0));
|
||||
|
||||
@@ -295,19 +295,17 @@ impl<'a> DesktopSidePanel<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn add_column_button(dark_mode: bool) -> impl Widget {
|
||||
fn add_column_button() -> impl Widget {
|
||||
move |ui: &mut egui::Ui| {
|
||||
let img_size = 24.0;
|
||||
let max_size = ICON_WIDTH * ICON_EXPANSION_MULTIPLE; // max size of the widget
|
||||
|
||||
let img_data = if dark_mode {
|
||||
egui::include_image!("../../../../assets/icons/add_column_dark_4x.png")
|
||||
let img = if ui.visuals().dark_mode {
|
||||
app_images::add_column_dark_image()
|
||||
} else {
|
||||
egui::include_image!("../../../../assets/icons/add_column_light_4x.png")
|
||||
app_images::add_column_light_image()
|
||||
};
|
||||
|
||||
let img = egui::Image::new(img_data).max_width(img_size);
|
||||
|
||||
let helper = AnimationHelper::new(ui, "add-column-button", vec2(max_size, max_size));
|
||||
|
||||
let cur_img_size = helper.scale_1d_pos(img_size);
|
||||
@@ -371,8 +369,7 @@ fn add_deck_button() -> impl Widget {
|
||||
let img_size = 40.0;
|
||||
|
||||
let max_size = ICON_WIDTH * ICON_EXPANSION_MULTIPLE; // max size of the widget
|
||||
let img_data = egui::include_image!("../../../../assets/icons/new_deck_icon_4x_dark.png");
|
||||
let img = egui::Image::new(img_data).max_width(img_size);
|
||||
let img = app_images::new_deck_image().max_width(img_size);
|
||||
|
||||
let helper = AnimationHelper::new(ui, "new-deck-icon", vec2(max_size, max_size));
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ use egui_virtual_list::VirtualList;
|
||||
use enostr::KeypairUnowned;
|
||||
use nostrdb::{Note, Transaction};
|
||||
use notedeck::note::root_note_id_from_selected_id;
|
||||
use notedeck::{MuteFun, NoteAction, NoteContext, UnknownIds};
|
||||
use notedeck::{MuteFun, NoteAction, NoteContext};
|
||||
use notedeck_ui::jobs::JobsCache;
|
||||
use notedeck_ui::note::NoteResponse;
|
||||
use notedeck_ui::{NoteOptions, NoteView};
|
||||
@@ -12,7 +12,6 @@ use crate::timeline::thread::{NoteSeenFlags, ParentState, Threads};
|
||||
|
||||
pub struct ThreadView<'a, 'd> {
|
||||
threads: &'a mut Threads,
|
||||
unknown_ids: &'a mut UnknownIds,
|
||||
selected_note_id: &'a [u8; 32],
|
||||
note_options: NoteOptions,
|
||||
col: usize,
|
||||
@@ -27,7 +26,6 @@ impl<'a, 'd> ThreadView<'a, 'd> {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
threads: &'a mut Threads,
|
||||
unknown_ids: &'a mut UnknownIds,
|
||||
selected_note_id: &'a [u8; 32],
|
||||
note_options: NoteOptions,
|
||||
is_muted: &'a MuteFun,
|
||||
@@ -38,7 +36,6 @@ impl<'a, 'd> ThreadView<'a, 'd> {
|
||||
let id_source = egui::Id::new("threadscroll_threadview");
|
||||
ThreadView {
|
||||
threads,
|
||||
unknown_ids,
|
||||
selected_note_id,
|
||||
note_options,
|
||||
id_source,
|
||||
@@ -96,7 +93,7 @@ impl<'a, 'd> ThreadView<'a, 'd> {
|
||||
self.note_context.note_cache,
|
||||
self.note_context.ndb,
|
||||
txn,
|
||||
self.unknown_ids,
|
||||
self.note_context.unknown_ids,
|
||||
self.col,
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user