Skip to content

Commit

Permalink
Revert make the last session card sticky
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanSoto31 committed Sep 10, 2024
1 parent cc9b4f2 commit 5d2e954
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 22 deletions.
9 changes: 3 additions & 6 deletions app/views/schedules/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@
<%= render partial: 'sessions/filters', locals: { resource: :schedule } %>
</div>

<div class="flex flex-col w-full h-full">
<div class="flex flex-col w-full h-full mb-[12rem]">
<% if @sessions.present? %>
<% previous_date = nil %>
<% grouped_sessions = @sessions.group_by(&:starts_at) %>

<% grouped_sessions.each do |starts_at, sessions| %>
<% @sessions.group_by(&:starts_at).each do |starts_at, sessions| %>
<%= content_tag(
:div,
class: [
Expand All @@ -42,14 +41,12 @@
locals: {
session: session,
user_is_an_attendee: true,
id_prefix: "schedule",
last_session: grouped_sessions.keys.last == starts_at && sessions.last == session
id_prefix: "schedule"
}
) %>
<% end %>
<% previous_date = starts_at.to_date %>
<% end %>
<div class="mb-[17rem]"></div>
<% elsif params[:starts_at].present? || session_filter_params.present? %>
<div class="flex flex-col items-center justify-center w-full h-full">
<p class="max-w-xs mb-4 font-bold text-center">No sessions match your current filters</p>
Expand Down
14 changes: 4 additions & 10 deletions app/views/sessions/_card.html.erb
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
<%# locals: (session:, user_is_an_attendee:, id_prefix: nil, last_session: false) %>

<%= content_tag(
:div,
id: dom_id(session, id_prefix),
class: [
"relative flex flex-col w-full p-5 mb-4 bg-white rounded-[20px]",
"sticky top-[329px]": last_session && session_filter_params.present?,
"sticky top-[296px]": last_session && session_filter_params.blank?
]
) do %>
<div class="relative flex flex-col w-full p-5 mb-4 bg-white rounded-[20px]" id="<%= dom_id(session, id_prefix) %>">
<a href="<%= session_path(session) %>" class="absolute top-0 bottom-0 left-0 right-0 z-0"></a>

<%= render partial: "sessions/status", locals: { session: session } %>

Expand Down Expand Up @@ -80,4 +73,5 @@
<span class="font-sans text-sm text-grey-600"><%= session.location&.name %></span>
</div>
</div>
<% end %>
</div>

9 changes: 3 additions & 6 deletions app/views/sessions/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@
<%= render partial: 'sessions/filters', locals: { resource: :sessions } %>
</div>

<div class="flex flex-col w-full h-full">
<div class="flex flex-col w-full h-full mb-[12rem]">
<% if @sessions.present? %>
<% previous_date = nil %>
<% grouped_sessions = @sessions.group_by(&:starts_at) %>

<% grouped_sessions.each do |starts_at, sessions| %>
<% @sessions.group_by(&:starts_at).each do |starts_at, sessions| %>
<%= content_tag(
:div,
class: [
Expand All @@ -41,14 +40,12 @@
partial: 'sessions/card',
locals: {
session: session,
user_is_an_attendee: @user_session_ids&.include?(session.id),
last_session: grouped_sessions.keys.last == starts_at && sessions.last == session
user_is_an_attendee: @user_session_ids&.include?(session.id)
}
) %>
<% end %>
<% previous_date = starts_at.to_date %>
<% end %>
<div class="mb-[17rem]"></div>
<% elsif params[:starts_at].present? || session_filter_params.present? %>
<div class="flex flex-col items-center justify-center w-full h-full">
<p class="max-w-xs mb-4 font-bold text-center">No sessions match your current filters</p>
Expand Down

0 comments on commit 5d2e954

Please sign in to comment.