diff --git a/dist/treebird.css b/dist/treebird.css index 950ff59..f76ad11 100644 --- a/dist/treebird.css +++ b/dist/treebird.css @@ -1104,6 +1104,50 @@ input[type=checkbox].hidden:not(:checked) + .reply-form min-width: 0; } +/* Compact notifications (statuses) */ +.notifications-compact, +.status-compact +{ + position: relative; + font-size: 14px; +} + +.status-compact .status.status-notification +{ + padding: 7px; +} + +.status-compact .pfp-td img +{ + width: 28px; + height: 28px; +} + +.status-compact .action-icon +{ + position: absolute; + background-color: #eaecf0; + border-radius: 50%; + width: 14px; + height: 14px; + border: 1px solid #cacaca; + padding: 3px; + top: 17px; + left: -17px; + z-index: 8; + font-size: 12px; +} + +.status-compact .action-icon svg +{ + width: 14px; + height: 14px; + stroke: #40455a; + /* Little fix */ + position: relative; + top: -1px; +} + /* .status .notification-text-group-with-icon .username */ /* { */ /* /\* UNDO *\/ */ diff --git a/perl/status.pm b/perl/status.pm index 2c0c8cd..091b4ab 100644 --- a/perl/status.pm +++ b/perl/status.pm @@ -29,6 +29,8 @@ sub generate_status $status = $status->{reblog}; } + my $is_statusey_notif = ($notif && ($notif->{type} eq 'mention' || $notif->{type} eq 'status')); + my %vars = ( prefix => '', ssn => $ssn, @@ -37,9 +39,26 @@ sub generate_status data => $data, notif => $notif, # May be undef compact => $is_compact, # May be undef - is_statusey_notif => ($notif && ($notif->{type} eq 'mention' || $notif->{type} eq 'status')), + is_statusey_notif => $is_statusey_notif, unique_toggle_id => $rel_context++, + interacted_with => $boost_acct || ($notif && !$is_statusey_notif), + # Functions + + action_to_string => sub { + return unless $notif; + return lang('NOTIF_LIKED') if $notif->{type} eq 'favourite'; + return lang('NOTIF_REPEATED') if $boost_acct || $notif->{type} eq 'reblog'; + return lang('NOTIF_REACTED_WITH') .' '. $notif->{emoji} if $boost_acct || $notif->{type} eq 'emoji reaction'; + }, + + action_to_icon => sub { + return unless $notif; + return get_icon('like') if $notif->{type} eq 'favourite'; + return get_icon('repeat') if $boost_acct || $notif->{type} eq 'reblog'; + return $notif->{emoji} if $notif->{type} eq 'emoji reaction'; + }, + icon => \&get_icon, lang => \&lang, rel_to_str => \&reltime_to_str, diff --git a/templates/main.tt b/templates/main.tt index 49db8c2..d4891cb 100644 --- a/templates/main.tt +++ b/templates/main.tt @@ -171,7 +171,7 @@
[% FOREACH notif IN notifs %] - [% notification(ssn, data, notif) %] + [% notification(ssn, data, notif, 1) %] [% END %]
diff --git a/templates/status.tt b/templates/status.tt index 6345f61..884bf3d 100644 --- a/templates/status.tt +++ b/templates/status.tt @@ -2,31 +2,21 @@
- [% IF boost || (notif && notif.account && !is_statusey_notif) %] + [% IF interacted_with && !compact %]
[% format_username(boost || notif.account) %] - [% IF notif && notif.type == 'favourite' %] - [% lang('NOTIF_LIKED') %] - [% ELSIF boost || (notif && notif.type == 'reblog') %] - [% lang('NOTIF_REPEATED') %] - [% ELSIF boost || (notif && notif.type == 'emoji reaction') %] - [%# Yes, it can be a custom emoji too %] - [% lang('NOTIF_REACTED_WITH') %] [% notif.emoji %] - [% END %] + [% action_to_string(); %] - [% IF notif && notif.type == 'favourite' %] - [% icon('like') %] - [% ELSIF boost || (notif && notif.type == 'reblog') %] [%# It's a repeat %] - [% icon('repeat') %] - [% END %] + [% action_to_icon(); %]
[% END %] @@ -37,8 +27,22 @@
- [% format_username(status.account) %] - [% status.account.acct %] + + [% format_username(status.account) %] + + + [% IF interacted_with && compact %] + + [% action_to_string(); %] + + + [% action_to_icon(); %] + + [% END %] + + [% UNLESS compact %] + [% status.account.acct %] + [% END %]