Leaderboard/GH banner fixes for mobile (#924)

This commit is contained in:
Mahad Kalam 2026-02-11 18:57:52 +00:00 committed by GitHub
parent 6c15a4a8b4
commit 9c12424be8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 30 additions and 27 deletions

View file

@ -3,27 +3,27 @@
</script>
<div class="bg-dark border border-primary rounded-lg p-4 mb-6">
<div class="flex items-center gap-3">
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
class="text-white shrink-0"
><path
fill="currentColor"
d="M12 2A10 10 0 0 0 2 12c0 4.42 2.87 8.17 6.84 9.5c.5.08.66-.23.66-.5v-1.69c-2.77.6-3.36-1.34-3.36-1.34c-.46-1.16-1.11-1.47-1.11-1.47c-.91-.62.07-.6.07-.6c1 .07 1.53 1.03 1.53 1.03c.87 1.52 2.34 1.07 2.91.83c.09-.65.35-1.09.63-1.34c-2.22-.25-4.55-1.11-4.55-4.92c0-1.11.38-2 1.03-2.71c-.1-.25-.45-1.29.1-2.64c0 0 .84-.27 2.75 1.02c.79-.22 1.65-.33 2.5-.33s1.71.11 2.5.33c1.91-1.29 2.75-1.02 2.75-1.02c.55 1.35.2 2.39.1 2.64c.65.71 1.03 1.6 1.03 2.71c0 3.82-2.34 4.66-4.57 4.91c.36.31.69.92.69 1.85V21c0 .27.16.59.67.5C19.14 20.16 22 16.42 22 12A10 10 0 0 0 12 2"
/></svg
>
<div class="flex-1">
<div class="flex flex-col sm:flex-row sm:items-center gap-3">
<div class="flex items-center gap-3 flex-1 min-w-0">
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
class="text-white shrink-0"
><path
fill="currentColor"
d="M12 2A10 10 0 0 0 2 12c0 4.42 2.87 8.17 6.84 9.5c.5.08.66-.23.66-.5v-1.69c-2.77.6-3.36-1.34-3.36-1.34c-.46-1.16-1.11-1.47-1.11-1.47c-.91-.62.07-.6.07-.6c1 .07 1.53 1.03 1.53 1.03c.87 1.52 2.34 1.07 2.91.83c.09-.65.35-1.09.63-1.34c-2.22-.25-4.55-1.11-4.55-4.92c0-1.11.38-2 1.03-2.71c-.1-.25-.45-1.29.1-2.64c0 0 .84-.27 2.75 1.02c.79-.22 1.65-.33 2.5-.33s1.71.11 2.5.33c1.91-1.29 2.75-1.02 2.75-1.02c.55 1.35.2 2.39.1 2.64c.65.71 1.03 1.6 1.03 2.71c0 3.82-2.34 4.66-4.57 4.91c.36.31.69.92.69 1.85V21c0 .27.16.59.67.5C19.14 20.16 22 16.42 22 12A10 10 0 0 0 12 2"
/></svg
>
<span class="text-white"
>Link your GitHub account to unlock project linking, show what
you're working on, and qualify for leaderboards!</span
>Link your GitHub account to unlock project linking, show what you're
working on, and qualify for leaderboards!</span
>
</div>
<a
href={github_auth_path}
class="bg-primary hover:bg-primary text-white font-medium px-4 py-2 rounded-lg transition-colors duration-200 shrink-0"
class="bg-primary hover:bg-primary text-white font-medium px-4 py-2 rounded-lg transition-colors duration-200 shrink-0 text-center w-full md:w-fit"
data-turbo="false">Connect GitHub</a
>
</div>

View file

@ -1,25 +1,25 @@
<% entries.each_with_index do |e, i| %>
<div class="flex items-center p-2 hover:bg-dark transition-colors duration-200 <%= 'bg-dark border-l-4 border-l-primary' if e.user_id == current_user&.id %> <%= 'opacity-40 hover:opacity-60' if e.user.red? && current_user&.admin_level.in?(%w[admin superadmin]) %>">
<div class="w-12 shrink-0 text-center font-medium text-muted">
<div class="flex items-center p-2 sm:p-3 hover:bg-dark transition-colors duration-200 gap-2 sm:gap-0 <%= 'bg-dark border-l-4 border-l-primary' if e.user_id == current_user&.id %> <%= 'opacity-40 hover:opacity-60' if e.user.red? && current_user&.admin_level.in?(%w[admin superadmin]) %>">
<div class="w-8 sm:w-12 shrink-0 text-center font-medium text-muted">
<% idx = offset + i %>
<%=
case idx
when 0
'<span class="text-2xl">🥇</span>'.html_safe
'<span class="text-xl sm:text-2xl">🥇</span>'.html_safe
when 1
'<span class="text-2xl">🥈</span>'.html_safe
'<span class="text-xl sm:text-2xl">🥈</span>'.html_safe
when 2
'<span class="text-2xl">🥉</span>'.html_safe
'<span class="text-xl sm:text-2xl">🥉</span>'.html_safe
else
"<span class=\"text-lg\">#{idx + 1}</span>".html_safe
"<span class=\"text-base sm:text-lg\">#{idx + 1}</span>".html_safe
end
%>
</div>
<div class="flex-1 mx-4 min-w-0">
<div class="flex-1 mx-1 sm:mx-4 min-w-0">
<div class="flex items-center gap-2 flex-wrap">
<%= render 'shared/user_mention', user: e.user, show: %i[profile_link verified_badge] %>
<% if (proj = active_projects&.dig(e.user_id)).present? %>
<span class="text-xs italic text-muted">
<span class="text-xs italic text-muted truncate max-w-[150px] sm:max-w-none">
working on <%= link_to h(proj.project_name), proj.repo_url, target: '_blank', class: 'text-accent hover:text-cyan-400 transition-colors' %>
<% dev_tool(nil, 'span') do %>
<%= link_to '🌌', visualize_git_url(proj.repo_url), target: '_blank', class: 'ml-1' %>
@ -31,7 +31,7 @@
<% end %>
</div>
</div>
<div class="shrink-0 font-mono text-sm text-white font-medium">
<div class="shrink-0 font-mono text-xs sm:text-sm text-white font-medium whitespace-nowrap">
<%= short_time_detailed e.total_seconds %>
</div>
</div>

View file

@ -1,4 +1,4 @@
<div class="max-w-6xl mx-auto p-6">
<div class="max-w-6xl mx-auto px-3 py-4 sm:p-6">
<div class="mb-8">
<h1 class="text-3xl font-bold text-white mb-4">Leaderboard</h1>
@ -8,7 +8,10 @@
</div>
<% if current_user && current_user.github_uid.blank? %>
<div class="bg-darker border border-primary rounded-lg p-4 mb-6"><%= link_to 'Connect your GitHub', '/auth/github', class: 'bg-primary hover:bg-primary/75 text-white font-medium mr-2 px-4 py-2 rounded-lg transition-colors duration-200' %> to qualify for the leaderboard.</div>
<div class="bg-darker border border-primary rounded-lg p-4 mb-6 flex flex-col sm:flex-row sm:items-center gap-3">
<span class="text-white">Connect your GitHub to qualify for the leaderboard.</span>
<%= link_to 'Connect GitHub', '/auth/github', class: 'bg-primary hover:bg-primary/75 text-white font-medium px-4 py-2 rounded-lg transition-colors duration-200 text-center shrink-0 w-fit' %>
</div>
<% end %>
<div class="text-muted text-sm">