ui: move note and profile rendering to notedeck_ui

We want to render notes in other apps like dave, so lets move
our note rendering to notedeck_ui. We rework NoteAction so it doesn't
have anything specific to notedeck_columns

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2025-04-17 11:01:45 -07:00
parent e4bae57619
commit 8af80d7d10
53 changed files with 1436 additions and 1607 deletions

View File

@@ -1,41 +1,6 @@
use egui::{emath::GuiRounding, Button, Pos2, Stroke, Widget};
use egui::{Button, Widget};
use notedeck::NotedeckTextStyle;
use super::anim::{AnimationHelper, ICON_EXPANSION_MULTIPLE};
pub fn x_button(rect: egui::Rect) -> impl egui::Widget {
move |ui: &mut egui::Ui| -> egui::Response {
let max_width = rect.width();
let helper = AnimationHelper::new_from_rect(ui, "user_search_close", rect);
let fill_color = ui.visuals().text_color();
let radius = max_width / (2.0 * ICON_EXPANSION_MULTIPLE);
let painter = ui.painter();
let ppp = ui.ctx().pixels_per_point();
let nw_edge = helper
.scale_pos_from_center(Pos2::new(-radius, radius))
.round_to_pixel_center(ppp);
let se_edge = helper
.scale_pos_from_center(Pos2::new(radius, -radius))
.round_to_pixel_center(ppp);
let sw_edge = helper
.scale_pos_from_center(Pos2::new(-radius, -radius))
.round_to_pixel_center(ppp);
let ne_edge = helper
.scale_pos_from_center(Pos2::new(radius, radius))
.round_to_pixel_center(ppp);
let line_width = helper.scale_1d_pos(2.0);
painter.line_segment([nw_edge, se_edge], Stroke::new(line_width, fill_color));
painter.line_segment([ne_edge, sw_edge], Stroke::new(line_width, fill_color));
helper.take_animation_response()
}
}
/// Sized and styled to match the figma design
pub fn styled_button(text: &str, fill_color: egui::Color32) -> impl Widget + '_ {
move |ui: &mut egui::Ui| -> egui::Response {