profile: add about and username to profile previews
Also adjust colors to match design Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -4,8 +4,8 @@ pub mod options;
|
||||
pub use contents::NoteContents;
|
||||
pub use options::NoteOptions;
|
||||
|
||||
use crate::{ui, Damus};
|
||||
use egui::{Color32, Label, RichText, Sense, TextureHandle, Vec2};
|
||||
use crate::{colors, ui, Damus};
|
||||
use egui::{Label, RichText, Sense, TextureHandle, Vec2};
|
||||
|
||||
pub struct Note<'a> {
|
||||
app: &'a mut Damus,
|
||||
@@ -237,17 +237,20 @@ fn render_reltime(
|
||||
puffin::profile_function!();
|
||||
|
||||
ui.horizontal(|ui| {
|
||||
let color = Color32::from_rgb(0x8A, 0x8A, 0x8A);
|
||||
if before {
|
||||
ui.add(Label::new(RichText::new("⋅").size(10.0).color(color)));
|
||||
ui.add(Label::new(
|
||||
RichText::new("⋅").size(10.0).color(colors::GRAY_SECONDARY),
|
||||
));
|
||||
}
|
||||
ui.add(Label::new(
|
||||
RichText::new(note_cache.reltime_str())
|
||||
.size(10.0)
|
||||
.color(color),
|
||||
.color(colors::GRAY_SECONDARY),
|
||||
));
|
||||
if !before {
|
||||
ui.add(Label::new(RichText::new("⋅").size(10.0).color(color)));
|
||||
ui.add(Label::new(
|
||||
RichText::new("⋅").size(10.0).color(colors::GRAY_SECONDARY),
|
||||
));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
use crate::app_style::NotedeckTextStyle;
|
||||
use crate::images;
|
||||
use crate::DisplayName;
|
||||
use crate::{colors, images, DisplayName};
|
||||
use egui::load::TexturePoll;
|
||||
use egui::{RichText, Sense};
|
||||
use egui_extras::Size;
|
||||
@@ -66,22 +65,33 @@ impl<'a> ProfilePreview<'a> {
|
||||
DisplayName::One("??")
|
||||
};
|
||||
|
||||
match name {
|
||||
DisplayName::One(n) => {
|
||||
ui.label(RichText::new(n).text_style(NotedeckTextStyle::Heading3.text_style()));
|
||||
crate::ui::padding(12.0, ui, |ui| {
|
||||
match name {
|
||||
DisplayName::One(n) => {
|
||||
ui.label(RichText::new(n).text_style(NotedeckTextStyle::Heading3.text_style()));
|
||||
}
|
||||
|
||||
DisplayName::Both {
|
||||
display_name,
|
||||
username,
|
||||
} => {
|
||||
ui.label(
|
||||
RichText::new(display_name)
|
||||
.text_style(NotedeckTextStyle::Heading3.text_style()),
|
||||
);
|
||||
|
||||
ui.label(
|
||||
RichText::new(format!("@{}", username))
|
||||
.size(12.0)
|
||||
.color(colors::MID_GRAY),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
DisplayName::Both {
|
||||
display_name,
|
||||
username,
|
||||
} => {
|
||||
ui.label(
|
||||
RichText::new(display_name)
|
||||
.text_style(NotedeckTextStyle::Heading3.text_style()),
|
||||
);
|
||||
ui.label(RichText::new(format!("@{}", username)));
|
||||
if let Some(about) = profile.record().profile().and_then(|p| p.about()) {
|
||||
ui.label(about);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user