From 1806c875b5129ea761a184f0ec6330041e9a586e Mon Sep 17 00:00:00 2001 From: kbe Date: Wed, 27 Aug 2025 01:12:00 +0200 Subject: [PATCH] refactor: dashboard views by extracting metric card and party item partials, and fix metric card rendering issue --- app/views/components/_metric_card.html.erb | 12 +++ app/views/components/_party_item.html.erb | 15 ++++ app/views/pages/dashboard.html.erb | 89 ++-------------------- app/views/parties/show.html.erb | 57 +++++++++++--- 4 files changed, 78 insertions(+), 95 deletions(-) create mode 100644 app/views/components/_metric_card.html.erb create mode 100644 app/views/components/_party_item.html.erb diff --git a/app/views/components/_metric_card.html.erb b/app/views/components/_metric_card.html.erb new file mode 100644 index 0000000..75d3237 --- /dev/null +++ b/app/views/components/_metric_card.html.erb @@ -0,0 +1,12 @@ +
+
+
+
+ <%= value %> +
+

+ <%= title %> +

+
+
+
diff --git a/app/views/components/_party_item.html.erb b/app/views/components/_party_item.html.erb new file mode 100644 index 0000000..ddfbaa1 --- /dev/null +++ b/app/views/components/_party_item.html.erb @@ -0,0 +1,15 @@ +<%= link_to party_path(party.slug, party), class: "group block p-4 rounded-lg border border-slate-200 dark:border-slate-700 hover:border-purple-300 dark:hover:border-purple-600 hover:shadow-md transition-all duration-200" do %> +
+
+ <%= image_tag party.image, alt: party.name, class: "w-full h-full object-cover" if party.image.present? %> +
+
+

+ <%= party.name %> +

+

+ <%= l(party.start_time, format: :short) %> +

+
+
+<% end %> diff --git a/app/views/pages/dashboard.html.erb b/app/views/pages/dashboard.html.erb index 8ccf59c..b62c33c 100644 --- a/app/views/pages/dashboard.html.erb +++ b/app/views/pages/dashboard.html.erb @@ -4,46 +4,11 @@

Tableau de bord

-
-
-
-
- <%= @available_parties %> -
-

- Événements disponibles -

-
-
-
+ <%= render partial: 'components/metric_card', locals: { title: "Événements disponibles", value: @available_parties, classes: "from-purple-100 to-indigo-100" } %> -
-
-
-
- <%= @events_this_week %> -
-

- Événements aujourd'hui -

-
-
-
+ <%= render partial: 'components/metric_card', locals: { title: "Événements aujourd'hui", value: @events_this_week, classes: "from-purple-100 to-indigo-100" } %> - - -
-
-
-
- <%= @events_this_week %> -
-

- Événements cette semaine -

-
-
-
+ <%= render partial: 'components/metric_card', locals: { title: "Événements cette semaine", value: @events_this_week, classes: "from-purple-100 to-indigo-100" } %>
@@ -58,21 +23,7 @@ @@ -92,21 +43,7 @@ @@ -126,21 +63,7 @@ diff --git a/app/views/parties/show.html.erb b/app/views/parties/show.html.erb index 9a3dbff..387d58d 100644 --- a/app/views/parties/show.html.erb +++ b/app/views/parties/show.html.erb @@ -2,13 +2,13 @@

<%= @party.name %>

- + <% if @party.image.present? %> <%= image_tag @party.image, class: "img-fluid rounded mb-3" %> <% end %> - +

<%= @party.description %>

- +
Event Details
@@ -21,17 +21,50 @@
- +
-
-
-
Ticket Information
-

- - Get Tickets -

+
+ +
+
+
Early Bird
+

€49.99 - 30 min early access

+
+ Quantity: + +
+
+
+ +
+
+
Standard
+

€29.99 - Regular access

+
+ Quantity: + +
+
+
+ +
+
+
VIP
+

€99.99 - Premium access

+
+ Quantity: + +
+
+
+ +
+ +
-
\ No newline at end of file +