Skip to content

Commit f289fdc

Browse files
display events on hacker dashboard
1 parent bd8451c commit f289fdc

File tree

3 files changed

+131
-0
lines changed

3 files changed

+131
-0
lines changed

packages/hackathon/app/definitions/hackathon/event_definition.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
class Hackathon::EventDefinition < Hackathon::ResourceDefinition
2+
field :duration, hint: "Duration in minutes", description: "Duration in minutes"
3+
24
display :meeting_link, as: :url
35
display :video_url, as: :url
46

packages/hacker_dashboard_portal/app/views/hacker_dashboard_portal/dashboard/_team_dashboard.html.erb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@
123123
</div>
124124
</div>
125125

126+
<!-- Upcoming Events -->
127+
<%= render "upcoming_events" %>
128+
129+
126130
<!-- Your Teammates -->
127131
<div class="bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-100 dark:border-gray-700 mb-8">
128132
<div class="flex items-center justify-between mb-6">
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
<% upcoming_events = Hackathon::Event.upcoming.limit(3) %>
2+
<% next_event = upcoming_events.first %>
3+
4+
<% if upcoming_events.any? %>
5+
<!-- Next Upcoming Event (Featured) -->
6+
<% if next_event.present? %>
7+
<div class="bg-gradient-to-br from-blue-50 to-indigo-50 dark:from-blue-900/30 dark:to-indigo-800/30 rounded-2xl shadow-md p-6 mb-6 border-2 border-blue-200 dark:border-blue-800">
8+
<div class="flex items-start gap-4">
9+
<div class="flex-shrink-0">
10+
<div class="w-12 h-12 bg-blue-500 dark:bg-blue-600 rounded-full flex items-center justify-center">
11+
<svg class="w-6 h-6 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
12+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"></path>
13+
</svg>
14+
</div>
15+
</div>
16+
<div class="flex-1">
17+
<div class="flex items-center gap-2 mb-1">
18+
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200">
19+
Next Event
20+
</span>
21+
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-200">
22+
<%= next_event.event_type.titleize %>
23+
</span>
24+
</div>
25+
<h3 class="text-xl font-bold text-blue-900 dark:text-blue-100 mb-2"><%= next_event.title %></h3>
26+
<div class="flex items-center gap-4 text-sm text-blue-800 dark:text-blue-200 mb-3">
27+
<div class="flex items-center gap-1">
28+
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
29+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path>
30+
</svg>
31+
<%= next_event.scheduled_at.strftime("%b %d at %I:%M %p") %>
32+
</div>
33+
<% if next_event.duration.present? %>
34+
<div class="flex items-center gap-1">
35+
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
36+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"></path>
37+
</svg>
38+
<%= next_event.duration %> min
39+
</div>
40+
<% end %>
41+
</div>
42+
<p class="text-blue-800 dark:text-blue-200 mb-4 line-clamp-2"><%= next_event.description %></p>
43+
<div class="flex gap-3">
44+
<% if next_event.meeting_link.present? %>
45+
<a href="<%= next_event.meeting_link %>" target="_blank" rel="noopener" class="inline-flex items-center gap-2 px-4 py-2 bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600 text-white font-semibold rounded-lg shadow-md hover:shadow-lg transition-all">
46+
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
47+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"></path>
48+
</svg>
49+
Join Meeting
50+
</a>
51+
<% end %>
52+
<a href="<%= resource_url_for(Hackathon::Event) %>" class="inline-flex items-center gap-2 px-4 py-2 bg-white dark:bg-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600 text-blue-700 dark:text-blue-300 font-semibold rounded-lg shadow-md hover:shadow-lg transition-all border border-blue-200 dark:border-blue-700">
53+
View All Events
54+
</a>
55+
</div>
56+
</div>
57+
</div>
58+
</div>
59+
<% end %>
60+
61+
<!-- Other Upcoming Events (if more than 1) -->
62+
<% if upcoming_events.count > 1 %>
63+
<div class="bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 mb-6 border border-gray-100 dark:border-gray-700">
64+
<h3 class="text-lg font-bold text-gray-900 dark:text-white mb-4 flex items-center gap-2">
65+
<svg class="w-5 h-5 text-gray-600 dark:text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
66+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"></path>
67+
</svg>
68+
More Upcoming Events
69+
</h3>
70+
<div class="space-y-3">
71+
<% upcoming_events[1..].each do |event| %>
72+
<div class="flex items-center justify-between p-4 bg-gray-50 dark:bg-gray-700/50 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors">
73+
<div class="flex-1">
74+
<div class="flex items-center gap-2 mb-1">
75+
<h4 class="font-semibold text-gray-900 dark:text-white"><%= event.title %></h4>
76+
<span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-gray-200 text-gray-700 dark:bg-gray-600 dark:text-gray-200">
77+
<%= event.event_type.titleize %>
78+
</span>
79+
</div>
80+
<div class="flex items-center gap-3 text-sm text-gray-600 dark:text-gray-400">
81+
<div class="flex items-center gap-1">
82+
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
83+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"></path>
84+
</svg>
85+
<%= event.scheduled_at.strftime("%b %d, %I:%M %p") %>
86+
</div>
87+
<% if event.duration.present? %>
88+
<span><%= event.duration %> min</span>
89+
<% end %>
90+
</div>
91+
</div>
92+
<% if event.meeting_link.present? %>
93+
<a href="<%= event.meeting_link %>" target="_blank" rel="noopener" class="inline-flex items-center gap-2 px-3 py-2 bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600 text-white text-sm font-semibold rounded-lg transition-all">
94+
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
95+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"></path>
96+
</svg>
97+
Join
98+
</a>
99+
<% end %>
100+
</div>
101+
<% end %>
102+
</div>
103+
</div>
104+
<% end %>
105+
<% else %>
106+
<!-- No Upcoming Events - Simple Link -->
107+
<div class="bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 mb-6 border border-gray-100 dark:border-gray-700">
108+
<div class="text-center py-6">
109+
<div class="flex justify-center mb-3">
110+
<div class="w-12 h-12 bg-gray-100 dark:bg-gray-700 rounded-full flex items-center justify-center">
111+
<svg class="w-6 h-6 text-gray-400 dark:text-gray-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
112+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"></path>
113+
</svg>
114+
</div>
115+
</div>
116+
<h3 class="text-base font-semibold text-gray-900 dark:text-white mb-2">No Upcoming Events</h3>
117+
<a href="<%= resource_url_for(Hackathon::Event) %>" class="inline-flex items-center gap-2 text-sm text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300 font-medium">
118+
View All Events
119+
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
120+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path>
121+
</svg>
122+
</a>
123+
</div>
124+
</div>
125+
<% end %>

0 commit comments

Comments
 (0)