diff --git a/app/assets/stylesheets/notifications.css b/app/assets/stylesheets/notifications.css index fdb211269..4b58106a9 100644 --- a/app/assets/stylesheets/notifications.css +++ b/app/assets/stylesheets/notifications.css @@ -1,85 +1,84 @@ .notification-tray { - position: fixed; - bottom: 1rem; - left: calc(50% - 20ch); - display: flex; - flex-direction: column; - gap: 1rem; height: 4rem; - width: 40ch; + inset: auto auto var(--block-space); + position: fixed; } .notification { + inset: auto auto 0; position: absolute; - padding: 4px; - bottom: 0; - border-radius: 6px; + transform: translate(var(--offsetX), var(--offsetY)); + transform-origin: center center; + transition: transform 0.2s ease-in-out; + z-index: var(--z-index); - & .notification--content { - border-radius: 6px; - background-color: #eee; - border: solid 1px black; - padding: 1rem; - display: flex; - align-items: center; - gap: 0.5rem; - width: 40ch; - color: black; - - &:visited { - color: black; - } + .notification__content { + color: var(--color-ink); + inline-size: var(--width); } - - transform: translateY(var(--offset)); - z-index: var(--z-index); - transition: transform 0.2s; - &:nth-child(1) { - --offset: 0; + --offsetX: 0; + --offsetY: 0; + --width: 40ch; --z-index: 0; } &:nth-child(2) { - --offset: -8px; + --offsetX: 0.5ch; + --offsetY: calc(var(--block-space-half) * -1); + --width: 39ch; --z-index: -1; } &:nth-child(3) { - --offset: -16px; + --offsetX: 1ch; + --offsetY: calc(var(--block-space) * -1); + --width: 38ch; --z-index: -2; } &:nth-child(4) { - --offset: -24px; + --offsetX: 1.5ch; + --offsetY: calc(var(--block-space) * -1.5); + --width: 37ch; --z-index: -3; } &:nth-child(5) { - --offset: -32px; + --offsetX: 2ch; + --offsetY: calc(var(--block-space) * -2); + --width: 36ch; --z-index: -4; } &:nth-child(1n + 6) { display: none; } -} -.notification-tray:hover .notification { - &:nth-child(2) { - --offset: -100%; - } + .notification-tray:hover & { + &:nth-child(2) { + --offsetX: 0; + --offsetY: calc((100% + var(--block-space-half)) * -1); + --width: 40ch; + } - &:nth-child(3) { - --offset: -200%; - } + &:nth-child(3) { + --offsetX: 0; + --offsetY: calc((100% + var(--block-space-half)) * -2); + --width: 40ch; + } - &:nth-child(4) { - --offset: -300%; - } + &:nth-child(4) { + --offsetX: 0; + --offsetY: calc((100% + var(--block-space-half)) * -3); + --width: 40ch; + } - &:nth-child(5) { - --offset: -400%; + &:nth-child(5) { + --offsetX: 0; + --offsetY: calc((100% + var(--block-space-half)) * -4); + --width: 40ch; + } } } diff --git a/app/helpers/notifications_helper.rb b/app/helpers/notifications_helper.rb index 02b2e3cde..61c40f19e 100644 --- a/app/helpers/notifications_helper.rb +++ b/app/helpers/notifications_helper.rb @@ -1,6 +1,6 @@ module NotificationsHelper def notification_tag(notification, &) - link_to notification.resource, id: dom_id(notification), class: "notification", + link_to notification.resource, id: dom_id(notification), class: "notification border-radius", data: { turbo_frame: "_top" }, & end end diff --git a/app/models/notifier/assigned.rb b/app/models/notifier/assigned.rb index ff9594dd8..52ac2644b 100644 --- a/app/models/notifier/assigned.rb +++ b/app/models/notifier/assigned.rb @@ -1,7 +1,7 @@ class Notifier::Assigned < Notifier private def body - "assigned you: #{bubble.title}" + "#{event.creator.name} assigned to you" end def recipients diff --git a/app/models/notifier/commented.rb b/app/models/notifier/commented.rb index 178861405..72cd01602 100644 --- a/app/models/notifier/commented.rb +++ b/app/models/notifier/commented.rb @@ -1,7 +1,7 @@ class Notifier::Commented < Notifier private def body - "commented on: #{bubble.title}" + "#{event.creator.name}" end def resource diff --git a/app/models/notifier/created.rb b/app/models/notifier/created.rb index 03667f246..a8da65c63 100644 --- a/app/models/notifier/created.rb +++ b/app/models/notifier/created.rb @@ -1,6 +1,6 @@ class Notifier::Created < Notifier private def body - "created: #{bubble.title}" + "Added by #{event.creator.name}" end end diff --git a/app/models/notifier/popped.rb b/app/models/notifier/popped.rb index 26fdd72d3..7fe7588cd 100644 --- a/app/models/notifier/popped.rb +++ b/app/models/notifier/popped.rb @@ -1,6 +1,6 @@ class Notifier::Popped < Notifier private def body - "popped: #{bubble.title}" + "Popped by #{event.creator.name}" end end diff --git a/app/views/notifications/_notification.html.erb b/app/views/notifications/_notification.html.erb index 7c7d99103..faf721470 100644 --- a/app/views/notifications/_notification.html.erb +++ b/app/views/notifications/_notification.html.erb @@ -1,9 +1,12 @@ <%= notification_tag notification do %> -
+
<%= avatar_image_tag(notification.creator) %>
- <%= notification.body %> +
+ <%= "RE: " if notification.resource.is_a?(Comment) %><%= notification.bubble.title %> + <%= notification.body %> ยท <%= time_ago_in_words(notification.created_at) %> ago +
<% end %> diff --git a/app/views/notifications/_tray.html.erb b/app/views/notifications/_tray.html.erb index af1c2d452..71ada65cb 100644 --- a/app/views/notifications/_tray.html.erb +++ b/app/views/notifications/_tray.html.erb @@ -1,5 +1,5 @@ <%= turbo_stream_from Current.user, :notifications %> -<%= tag.div id: "notification-tray", class: "notification-tray", data: { turbo_permanent: true } do %> +<%= tag.div id: "notification-tray", class: "notification-tray flex flex-column gap", data: { turbo_permanent: true } do %> <%= turbo_frame_tag("notifications", src: notifications_path) %> <% end %>