Skip to content

Commit a313cf4

Browse files
authored
Placehero: Allow reblogs (#1108)
![Screenshot of Raph's timeline](https://github.com/user-attachments/assets/808aae6e-abda-40ec-b4b4-6f8c6925c95f) Fairly small PR here, moving towards displaying a single timeline in context.
1 parent 1f4c2b0 commit a313cf4

File tree

2 files changed

+28
-6
lines changed

2 files changed

+28
-6
lines changed

placehero/src/components.rs

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use xilem::WidgetView;
66
use xilem::palette::css;
77
use xilem::style::Padding;
88
use xilem::style::Style;
9+
use xilem::view::FlexSequence;
910
use xilem::view::flex_row;
1011
use xilem::view::portal;
1112
use xilem::view::{
@@ -33,7 +34,31 @@ pub(crate) fn timeline_status(
3334
avatars: &mut Avatars,
3435
status: &Status,
3536
) -> impl WidgetView<Placehero> + use<> {
36-
sized_box(flex((
37+
let (info_line, primary_status) = if let Some(reblog) = status.reblog.as_ref() {
38+
(
39+
Some(prose(format!("🔄 {} boosted", status.account.display_name))),
40+
&**reblog,
41+
)
42+
} else {
43+
(None, status)
44+
};
45+
sized_box(flex((info_line, base_status(avatars, primary_status))))
46+
.border(css::WHITE, 2.0)
47+
.padding(10.0)
48+
.corner_radius(5.)
49+
}
50+
51+
/// Renders the key parts of a Status, in a shared way.
52+
///
53+
/// This is the shared funcitionality between a timeline and the list of views.
54+
// TODO: Determine our UX for boosting/reblogging.
55+
// In particular, do we want to have the same design as "normal" Mastodon, where the
56+
// avatar for the booster is shown in the "child" avatar.
57+
fn base_status(avatars: &mut Avatars, status: &Status) -> impl FlexSequence<Placehero> + use<> {
58+
// TODO: In theory, it's possible to reblog a reblog; it's not clear what happens in this case.
59+
debug_assert!(status.reblog.is_none(), "`base_status` can't show reblogs.");
60+
// We return a child list.
61+
(
3762
// Account info/message time
3863
flex_row((
3964
avatars.avatar(&status.account.avatar_static),
@@ -63,10 +88,7 @@ pub(crate) fn timeline_status(
6388
))
6489
// TODO: The "extra space" amount actually ends up being zero, so this doesn't do anything.
6590
.main_axis_alignment(MainAxisAlignment::SpaceEvenly),
66-
)))
67-
.border(css::WHITE, 2.0)
68-
.padding(10.0)
69-
.corner_radius(5.)
91+
)
7092
}
7193

7294
/// A [`timeline`]; statuses are rendered individually.

placehero/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ fn load_statuses(
192192
.get_account_statuses(
193193
id,
194194
Some(&GetAccountStatusesInputOptions {
195-
exclude_reblogs: Some(true),
195+
exclude_reblogs: Some(false),
196196
exclude_replies: Some(true),
197197
..Default::default()
198198
}),

0 commit comments

Comments
 (0)