Skip to content

Commit 1461fe5

Browse files
update dashboard
1 parent c7e87c2 commit 1461fe5

3 files changed

Lines changed: 97 additions & 63 deletions

File tree

app/helpers/application_helper.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
module ApplicationHelper
22
RESOURCES = {
33
"Team" => {
4-
icon: Phlex::TablerIcons::UsersGroup,
4+
icon: Phlex::TablerIcons::Users,
55
description: "View team details, including members and their roles."
66
},
77
"Hacker" => {
8-
icon: Phlex::TablerIcons::Code,
8+
icon: Phlex::TablerIcons::User,
99
description: "View all registered hackers and their details. Check in hackers to events."
1010
},
1111
"Invitation" => {
12-
icon: Phlex::TablerIcons::Mail,
12+
icon: Phlex::TablerIcons::MailForward,
1313
description: "View and track invitations sent to potential team members."
1414
},
1515
"Check in" => {
16-
icon: Phlex::TablerIcons::Tent,
16+
icon: Phlex::TablerIcons::CircleCheck,
1717
description: "View event check-in records and attendance history."
1818
}
1919
}.freeze
Lines changed: 84 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,97 @@
1-
<div class="container mx-auto p-4">
2-
<div class="flex items-center justify-between mb-6">
3-
<h5
4-
class="
5-
mb-2 text-3xl font-extrabold leading-none tracking-tight text-gray-900
6-
md:text-4xl dark:text-white
7-
"
8-
>
1+
<div class="container mx-auto p-4 max-w-7xl">
2+
<header class="mb-8">
3+
<h1 class="text-3xl md:text-4xl font-bold text-gray-900 dark:text-white mb-2">
94
Hackathon Dashboard
10-
</h5>
5+
</h1>
6+
<p class="text-gray-600 dark:text-gray-400">
7+
Overview of all hackathon activities and resources
8+
</p>
9+
</header>
10+
11+
<!-- Summary Statistics -->
12+
<div class="grid grid-cols-2 sm:grid-cols-4 gap-4 mb-8">
13+
<div class="bg-gradient-to-r from-blue-500 to-blue-600 rounded-lg p-4 text-white">
14+
<div class="text-2xl font-bold"><%= Hackathon::Team.count %></div>
15+
<div class="text-blue-100 text-sm">Total Teams</div>
16+
</div>
17+
<div class="bg-gradient-to-r from-green-500 to-green-600 rounded-lg p-4 text-white">
18+
<div class="text-2xl font-bold"><%= Hackathon::Team.qualified.count %></div>
19+
<div class="text-green-100 text-sm">Qualified Teams</div>
20+
</div>
21+
<div class="bg-gradient-to-r from-purple-500 to-purple-600 rounded-lg p-4 text-white">
22+
<div class="text-2xl font-bold"><%= authorized_resource_scope(registered_resources.find { |r| r.model_name.human == 'Hacker' }).count rescue 0 %></div>
23+
<div class="text-purple-100 text-sm">Total Hackers</div>
24+
</div>
25+
<div class="bg-gradient-to-r from-orange-500 to-orange-600 rounded-lg p-4 text-white">
26+
<div class="text-2xl font-bold"><%= authorized_resource_scope(registered_resources.find { |r| r.model_name.human == 'Invitation' }).count rescue 0 %></div>
27+
<div class="text-orange-100 text-sm">Invitations</div>
28+
</div>
1129
</div>
12-
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
13-
<% icon_style = "dark:stroke-white w-12 h-12" %>
30+
31+
<!-- Resource Cards -->
32+
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6">
33+
<% icon_style = "w-8 h-8 text-current" %>
1434
<% registered_resources.each do |resource| %>
1535
<% next unless allowed_to?(:index?, resource) && ['Team', 'Invitation', 'Hacker', "Check in"].include?(resource.model_name.human) %>
16-
<div
17-
class="bg-white dark:bg-gray-800 shadow-md rounded-lg overflow-hidden"
18-
>
19-
<div class="p-4">
20-
<div class="flex items-center space-x-2 mb-2 hover:animate-pulse">
21-
<%= render icon_for(resource.model_name.human) %>
22-
<div class="flex flex-col">
23-
<a
24-
href="<%= resource_url_for(resource, parent: nil) %>"
25-
class="
26-
text-2xl font-medium text-gray-900 dark:text-white truncate hover:underline
27-
"
28-
>
29-
<%= resource.model_name.human.pluralize.titleize %>
30-
</a>
31-
<p class="text-sm font-medium text-gray dark:text-white">
32-
<%= description_for(resource.model_name.human) %>
33-
</p>
36+
<a href="<%= resource_url_for(resource, parent: nil) %>" class="group block h-full">
37+
<div class="bg-white dark:bg-gray-800 shadow-lg rounded-xl overflow-hidden border border-gray-200 dark:border-gray-700 hover:shadow-xl transition-all duration-300 hover:-translate-y-1 cursor-pointer h-full flex flex-col">
38+
<div class="p-6 flex-1 flex flex-col">
39+
<div class="flex items-start space-x-4 mb-4">
40+
<div class="flex-shrink-0 p-3 bg-gray-100 dark:bg-gray-700 rounded-lg group-hover:bg-blue-100 dark:group-hover:bg-blue-900 transition-colors duration-300">
41+
<div class="text-gray-600 dark:text-gray-300 group-hover:text-blue-600 dark:group-hover:text-blue-400 transition-colors duration-300">
42+
<%= render icon_for(resource.model_name.human, style: icon_style) %>
43+
</div>
44+
</div>
45+
<div class="flex-1 min-w-0">
46+
<h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-1 group-hover:text-blue-600 dark:group-hover:text-blue-400 transition-colors duration-200">
47+
<%= resource.model_name.human.pluralize.titleize %>
48+
</h3>
49+
<p class="text-sm text-gray-600 dark:text-gray-400 leading-relaxed">
50+
<%= description_for(resource.model_name.human) %>
51+
</p>
52+
</div>
53+
</div>
54+
<div class="flex items-center justify-between mt-auto">
55+
<div class="text-2xl font-bold text-gray-900 dark:text-white">
56+
<%= authorized_resource_scope(resource).count %>
57+
</div>
58+
<div class="text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wide font-medium">
59+
<%= resource.model_name.human.pluralize %>
60+
</div>
3461
</div>
35-
</div>
36-
<div class="mt-2 text-xl font-semibold text-gray-900 dark:text-white">
37-
<%= authorized_resource_scope(resource).count %>
3862
</div>
3963
</div>
40-
</div>
64+
</a>
4165
<% end %>
42-
<div class="bg-white dark:bg-gray-800 shadow-md rounded-lg overflow-hidden">
43-
<div class="p-4">
44-
<div class="flex items-center space-x-2 mb-2 hover:animate-pulse">
45-
<%= render Phlex::TablerIcons::Bulb.new(class: icon_style) %>
46-
<div class="flex flex-col">
47-
<a
48-
href="<%= hackathon_teams_path(q: { scope: 'qualified' }) %>"
49-
class="
50-
text-2xl font-medium text-gray-900 dark:text-white truncate hover:underline
51-
"
52-
>
53-
Qualified Teams
54-
</a>
55-
<p class="text-sm font-medium text-gray dark:text-white">
56-
Qualified teams are teams with a minimum of 3 registered members.
57-
</p>
66+
<!-- Qualified Teams Special Card -->
67+
<a href="<%= hackathon_teams_path(q: { scope: 'qualified' }) %>" class="group block h-full">
68+
<div class="bg-gradient-to-br from-yellow-50 to-yellow-100 dark:from-yellow-900/20 dark:to-yellow-800/20 shadow-lg rounded-xl overflow-hidden border border-yellow-200 dark:border-yellow-700 hover:shadow-xl transition-all duration-300 hover:-translate-y-1 cursor-pointer h-full flex flex-col">
69+
<div class="p-6 flex-1 flex flex-col">
70+
<div class="flex items-start space-x-4 mb-4">
71+
<div class="flex-shrink-0 p-3 bg-yellow-200 dark:bg-yellow-800 rounded-lg group-hover:bg-yellow-300 dark:group-hover:bg-yellow-700 transition-colors duration-300">
72+
<div class="text-yellow-700 dark:text-yellow-300">
73+
<%= render Phlex::TablerIcons::Bulb.new(class: icon_style) %>
74+
</div>
75+
</div>
76+
<div class="flex-1 min-w-0">
77+
<h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-1 group-hover:text-yellow-600 dark:group-hover:text-yellow-400 transition-colors duration-200">
78+
Qualified Teams
79+
</h3>
80+
<p class="text-sm text-gray-600 dark:text-gray-400 leading-relaxed">
81+
Qualified teams are teams with a minimum of <%= Hackathon::Team::MINIMUM_TEAM_MEMBERSHIPS %> registered members.
82+
</p>
83+
</div>
84+
</div>
85+
<div class="flex items-center justify-between mt-auto">
86+
<div class="text-2xl font-bold text-gray-900 dark:text-white">
87+
<%= Hackathon::Team.qualified.size %>
88+
</div>
89+
<div class="text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wide font-medium">
90+
Teams
91+
</div>
5892
</div>
59-
</div>
60-
<div class="mt-2 text-xl font-semibold text-gray-900 dark:text-white">
61-
<%= Hackathon::Team.qualified.size %>
6293
</div>
6394
</div>
64-
</div>
95+
</a>
6596
</div>
6697
</div>

packages/admin_dashboard_portal/app/views/plutonium/_resource_sidebar.html.erb

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@
66
url: root_path,
77
icon: Phlex::TablerIcons::Home
88

9-
m.item "Hackathon Data", icon: Phlex::TablerIcons::GridDots do |n|
10-
registered_resources.each do |resource|
11-
next unless ['Team', 'Invitation', 'Hacker', 'Check in'].include?(resource.model_name.human)
12-
n.item resource.model_name.human.pluralize,
13-
url: resource_url_for(resource, parent: nil)
14-
end
9+
[
10+
[Hackathon::Team, Phlex::TablerIcons::Users],
11+
[Hacker, Phlex::TablerIcons::User],
12+
[Hackathon::Invitation, Phlex::TablerIcons::MailForward],
13+
[Hackathon::CheckIn, Phlex::TablerIcons::CircleCheck]
14+
].each do |resource, icon|
15+
m.item resource.model_name.human.pluralize,
16+
url: resource_url_for(resource, parent: nil),
17+
icon: icon
1518
end
1619
end
1720
)

0 commit comments

Comments
 (0)