develop #3

Merged
kbe merged 227 commits from develop into main 2025-09-16 14:35:23 +00:00
8 changed files with 186 additions and 207 deletions
Showing only changes of commit 1989cbf6af - Show all commits

View File

@@ -1,39 +1,70 @@
/* Flash Messages - Theme Integration */
.flash-message {
@apply max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 mb-4;
.notification {
font-family: var(--font-sans, 'Plus Jakarta Sans', sans-serif);
box-shadow: var(--shadow-lg);
border: 1px solid;
transition: all var(--duration-normal, 0.3s) ease-out;
}
/* Base styles for all flash messages */
.flash-message .flex {
@apply rounded-md p-4 border shadow-md;
.notification-icon {
min-width: 20px;
height: 20px;
}
/* Success message styles */
.flash-message-success {
@apply bg-green-50 border-green-100 text-green-800;
.notification-icon i {
color: currentColor !important;
}
/* Error message styles */
.flash-message-error {
@apply bg-red-50 border-red-100 text-red-800;
.notification-success {
background: var(--color-success-light, #dcfce7);
color: var(--color-success-dark, #15803d);
border-color: var(--color-success, #22c55e);
}
/* Warning message styles */
.flash-message-warning {
@apply bg-yellow-50 border-yellow-100 text-yellow-800;
.notification-warning {
background: var(--color-warning-light, #fef3c7);
color: var(--color-warning-dark, #92400e);
border-color: var(--color-warning, #f59e0b);
}
/* Info message styles */
.flash-message-info {
@apply bg-blue-50 border-blue-100 text-blue-800;
.notification-error {
background: var(--color-danger-light, #fecaca);
color: var(--color-danger-dark, #dc2626);
border-color: var(--color-danger, #ef4444);
}
/* Notice message styles */
.flash-message-notice {
@apply bg-purple-50 border-purple-100 text-purple-800;
.notification-info {
background: var(--color-primary-50, #f0f9ff);
color: var(--color-primary-800, #1e40af);
border-color: var(--color-primary-200, #bfdbfe);
}
/* Alert message styles */
.flash-message-alert {
@apply bg-red-50 border-red-100 text-red-800;
/* Fallback colors if CSS variables are not available */
.notification-success {
background: #dcfce7;
color: #15803d;
border-color: #22c55e;
}
.notification-warning {
background: #fef3c7;
color: #92400e;
border-color: #f59e0b;
}
.notification-error {
background: #fecaca;
color: #dc2626;
border-color: #ef4444;
}
.notification-info {
background: #f0f9ff;
color: #1e40af;
border-color: #bfdbfe;
}
/* Animation for fade out */
.flash-messages-container .notification.opacity-0 {
opacity: 0;
transform: translateY(-10px);
}

View File

@@ -10,7 +10,7 @@ const buttonVariants = cva(
variants: {
variant: {
default:
"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
"bg-purple text-purple-foreground shadow-xs hover:bg-purple/90",
destructive:
"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
outline:
@@ -19,7 +19,7 @@ const buttonVariants = cva(
"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
ghost:
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
link: "text-primary underline-offset-4 hover:underline",
link: "text-purple underline-offset-4 hover:underline",
},
size: {
default: "h-9 px-4 py-2 has-[>svg]:px-3",

View File

@@ -1,137 +1,95 @@
<header class="shadow-sm border-b border-neutral-700">
<div class="bg-neutral-900">
<nav x-data="{ open: false }" class="bg-neutral-800 border-b border-neutral-700">
<!-- Primary Navigation Menu -->
<div class="container mx-auto px-4 sm:px-6 lg:px-8">
<header class="bg-neutral-800 border-b border-neutral-700">
<nav x-data="{ open: false }" class="container mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between h-16">
<div class="flex">
<!-- Logo -->
<div class="shrink-0 flex items-center">
<%= link_to Rails.application.config.app_name, current_user ? "/dashboard" : "/", class: "text-xl font-bold text-white" %>
</div>
<!-- Navigation Links -->
<div class="hidden space-x-8 sm:-my-px sm:ms-10 sm:flex items-center">
<%= link_to t('header.parties'), events_path,
class: "text-neutral-100 hover:text-primary-200 px-3 py-2 rounded-md text-sm font-medium transition-colors duration-200"
%>
<%= link_to t('header.concerts'), "#" ,
class: "text-neutral-100 hover:text-primary-200 px-3 py-2 rounded-md text-sm font-medium transition-colors duration-200"
%>
</div>
</div>
<!-- Authentication Links -->
<% if user_signed_in? %>
<!-- Settings Dropdown -->
<div class="hidden sm:flex sm:items-center sm:ms-6">
<div class="relative" x-data="{ open: false }" @click.outside="open = false" @close.stop="open = false">
<div @click="open = ! open">
<button
class="bg-primary-700 text-white border border-primary-800 font-medium py-2 px-4 rounded-lg hover:bg-primary-800 transition-colors duration-200 focus-ring">
<div>
<%= current_user.email.length> 20 ? current_user.email[0,20] + "..." : current_user.email %>
</div>
<div class="ms-1">
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
<path fill-rule="evenodd"
d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
clip-rule="evenodd" />
</svg>
</div>
</button>
</div>
<div x-show="open" x-transition:enter="transition ease-out duration-200"
x-transition:enter-start="opacity-0 scale-95" x-transition:enter-end="opacity-100 scale-100"
x-transition:leave="transition ease-in duration-75" x-transition:leave-start="opacity-100 scale-100"
x-transition:leave-end="opacity-0 scale-95"
class="absolute z-50 mt-2 w-48 rounded-md shadow-lg origin-top-right right-0" style="display: none;"
@click="open = false">
<div class="rounded-md ring-1 ring-primary-700 py-1 bg-primary-600">
<%= link_to t('header.profile') , edit_user_registration_path,
class: "block w-full px-4 py-2 text-start text-sm leading-5 text-neutral-100 hover:bg-primary-700" %>
<%= link_to t('header.reservations') , "#" ,
class: "block w-full px-4 py-2 text-start text-sm leading-5 text-neutral-100 hover:bg-primary-700" %>
<%= link_to t('header.logout') , destroy_user_session_path, data: { controller: "logout" ,
action: "click->logout#signOut" , logout_url_value: destroy_user_session_path, login_url_value:
new_user_session_path, turbo: false },
class: "block w-full px-4 py-2 text-start text-sm leading-5 text-neutral-100 hover:bg-primary-700" %>
</div>
</div>
h <!-- Login/Register Links -->
<div class="hidden sm:flex sm:items-center sm:ms-6 space-x-4 items-center">
<%= link_to t('header.login') , new_user_session_path,
class: "text-neutral-100 hover:text-primary-200 px-3 py-2 rounded-md text-sm font-medium transition-colors duration-200"
%>
<%= link_to t('header.register') , new_user_registration_path,
class: "bg-primary-50 text-primary-600 font-medium py-2 px-4 rounded-lg shadow-sm hover:bg-primary-100 transition-all duration-200"
%>
</div>
<% end %>
<!-- Hamburger -->
<div class="-me-2 flex items-center sm:hidden">
<button @click="open = ! open"
class="p-2 rounded-md text-neutral-300 hover:text-white hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-white">
<svg class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
<path :class="{ 'hidden': open, 'inline-flex': !open }" class="inline-flex" stroke-linecap="round"
stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
<path :class="{ 'hidden': !open, 'inline-flex': open }" class="hidden" stroke-linecap="round"
stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
</div>
</div>
<!-- Responsive Navigation Menu -->
<div :class="{ 'block': open, 'hidden': !open }" class="hidden sm:hidden">
<div class="pt-2 pb-3 space-y-1 bg-primary-600">
<%= link_to t('header.parties') , "#" ,
class: "block px-3 py-2 rounded-md text-base font-medium text-neutral-100 hover:text-primary-200 hover:bg-primary-700"
%>
<%= link_to t('header.concerts') , "#" ,
class: "block px-3 py-2 rounded-md text-base font-medium text-neutral-100 hover:text-primary-200 hover:bg-primary-700"
%>
</div>
<!-- Responsive Settings Options -->
<div class="pt-4 pb-1 border-t border-primary-700 bg-primary-600">
<% if user_signed_in? %>
<div class="px-4">
<% if current_user.first_name %>
<div class="font-medium text-base text-white">
<%= current_user.first_name %>
</div>
<% else %>
<div class="font-medium text-base text-white">
<%= current_user.email.length> 20 ? current_user.email[0,20] + "..." : current_user.email %>
</div>
<%# <div class="font-medium text-sm text-purple-200">
<%= current_user.email.length> 20 ? current_user.email[0,20] + "..." : current_user.email %>
</div>
<% end %>
</div>
<div class="mt-3 space-y-1">
<%= link_to t('header.profile') , edit_user_registration_path,
class: "block px-3 py-2 rounded-md text-base font-medium text-neutral-100 hover:text-primary-200 hover:bg-primary-700"
%>
<%= link_to t('header.reservations') , "#" ,
class: "block px-3 py-2 rounded-md text-base font-medium text-neutral-100 hover:text-primary-200 hover:bg-primary-700"
%>
<!-- Logo & Navigation -->
<div class="flex items-center space-x-8">
<%= link_to Rails.application.config.app_name, current_user ? "/dashboard" : "/",
class: "text-xl font-bold text-white" %>
<%= link_to t('header.logout') , destroy_user_session_path, data: { controller: "logout" , action: "click->logout#signOut",
<div class="hidden sm:flex space-x-6">
<%= link_to t("header.parties"), events_path,
class: "bg-black text-gray-100 hover:text-purple-200 px-3 py-2 rounded-md text-sm font-medium transition-colors duration-200" %>
<%= link_to t("header.concerts"), "#",
class: "bg-black text-gray-100 hover:text-purple-200 px-3 py-2 rounded-md text-sm font-medium transition-colors duration-200" %>
</div>
</div>
<!-- Authentication -->
<div class="flex items-center space-x-4">
<% if user_signed_in? %>
<div class="relative" x-data="{ open: false }" @click.outside="open = false">
<button @click="open = !open"
class="bg-purple-700 text-white border border-purple-800 font-medium py-2 px-4 rounded-lg hover:bg-purple-800 transition-colors duration-200 flex items-center space-x-2">
<span><%= current_user.email.length > 20 ? current_user.email[0,20] + "..." : current_user.email %></span>
<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />
</svg>
</button>
<div x-show="open" x-transition
class="absolute right-0 mt-2 w-48 rounded-md shadow-lg z-50">
<%= link_to t("header.profile"), edit_user_registration_path,
class: "block px-4 py-2 text-sm bg-black text-gray-100 hover:bg-purple-700 first:rounded-t-md" %>
<%= link_to t("header.reservations"), "#",
class: "block px-4 py-2 text-sm bg-black text-gray-100 hover:bg-purple-700" %>
<%= link_to t("header.logout"), destroy_user_session_path,
data: { controller: "logout", action: "click->logout#signOut",
logout_url_value: destroy_user_session_path, login_url_value: new_user_session_path, turbo: false },
class: "block px-3 py-2 rounded-md text-base font-medium text-neutral-100 hover:text-primary-200 hover:bg-primary-700"
%>
class: "block px-4 py-2 text-sm bg-black text-gray-100 hover:bg-purple-700 last:rounded-b-md" %>
</div>
</div>
<% else %>
<div class="mt-3 space-y-1">
<%= link_to t('header.register') , new_user_registration_path,
class: "block px-3 py-2 rounded-md text-base font-medium text-neutral-100 hover:text-primary-200 hover:bg-primary-700"
%>
<%= link_to t('header.login') , new_user_session_path,
class: "block px-3 py-2 rounded-md text-base font-medium text-neutral-100 hover:text-primary-200 hover:bg-primary-700"
%>
<div class="hidden sm:flex items-center space-x-4">
<%= link_to t("header.login"), new_user_session_path,
class: "bg-black text-gray-100 hover:text-purple-200 px-3 py-2 rounded-md text-sm font-medium transition-colors duration-200" %>
<%= link_to t("header.register"), new_user_registration_path,
class: "bg-purple-600 text-white font-medium py-2 px-4 rounded-lg hover:bg-purple-700 transition-colors duration-200" %>
</div>
<% end %>
<!-- Mobile Menu Button -->
<button @click="open = !open" class="sm:hidden p-2 rounded-md text-neutral-300 hover:text-white hover:bg-purple-700">
<svg class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
<path :class="{ "hidden": open }" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
<path :class="{ "hidden": !open }" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
</div>
<!-- Mobile Menu -->
<div :class="{ "block": open, "hidden": !open }" class="hidden sm:hidden">
<div class="px-2 pt-2 pb-3 space-y-1">
<%= link_to t("header.parties"), events_path,
class: "block px-3 py-2 rounded-md text-base font-medium bg-black text-gray-100 hover:text-purple-200 hover:bg-purple-700" %>
<%= link_to t("header.concerts"), "#",
class: "block px-3 py-2 rounded-md text-base font-medium bg-black text-gray-100 hover:text-purple-200 hover:bg-purple-700" %>
</div>
<div class="pt-4 pb-3 border-t border-gray-700">
<% if user_signed_in? %>
<div class="px-4 mb-3">
<div class="text-base font-medium text-white">
<%= current_user.first_name || current_user.email %>
</div>
</div>
<div class="px-2 space-y-1">
<%= link_to t("header.profile"), edit_user_registration_path,
class: "block px-3 py-2 rounded-md text-base font-medium bg-black text-gray-100 hover:text-purple-200 hover:bg-purple-700" %>
<%= link_to t("header.reservations"), "#",
class: "block px-3 py-2 rounded-md text-base font-medium bg-black text-gray-100 hover:text-purple-200 hover:bg-purple-700" %>
<%= link_to t("header.logout"), destroy_user_session_path,
data: { controller: "logout", action: "click->logout#signOut", logout_url_value: destroy_user_session_path, login_url_value: new_user_session_path, turbo: false },
class: "block px-3 py-2 rounded-md text-base font-medium bg-black text-gray-100 hover:text-purple-200 hover:bg-purple-700" %>
</div>
<% else %>
<div class="px-2 space-y-1">
<%= link_to t("header.login"), new_user_session_path,
class: "block px-3 py-2 rounded-md text-base font-medium bg-black text-gray-100 hover:text-purple-200 hover:bg-purple-700" %>
<%= link_to t("header.register"), new_user_registration_path,
class: "block px-3 py-2 rounded-md text-base font-medium bg-purple-600 text-white hover:bg-purple-700" %>
</div>
<% end %>
</div>
</div>
</nav>
</div>
</header>

View File

@@ -40,9 +40,6 @@
<label for="user_remember_me" class="ml-2 block text-sm text-neutral-700"> <%= t('devise.sessions.new.remember_me') %> </label>
</div>
<div class="text-sm">
<%= link_to t('devise.sessions.new.forgot_password'), new_password_path(resource_name), class: "font-medium text-purple-600 hover:text-purple-500" %>
</div>
</div>
<% end %>

View File

@@ -32,13 +32,10 @@
<div class="app-wrapper">
<%= render "components/header" %>
<main>
<% if flash.any? %>
<div class="flash py-6">
<!-- Flash messages positioned between header and content -->
<%= render "shared/flash_messages" %>
</div>
<% end %>
<main class="">
<div class="yield">
<%= yield %>
</div>

View File

@@ -1,25 +1,21 @@
<% if flash.any? %>
<div class="flash-messages-container" style="position: relative; width: 100%; display: flex; justify-content: center; padding: var(--space-4); margin-top: var(--space-4);">
<div style="width: 100%; max-width: 600px;">
<% flash.each do |type, message| %>
<% if message.present? %>
<div class="rounded-md bg-green-50 border-green-100 p-4 border <%= flash_class(type) %> animate-fade-in" data-controller="flash-message">
<div class="flex">
<div class="shrink-0">
<div class="notification <%= flash_class(type) %>"
data-controller="flash-message"
style="display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4); border-radius: var(--radius-lg); margin-bottom: var(--space-3); font-weight: 500; width: 100%; box-sizing: border-box;">
<div class="notification-icon" style="display: flex; align-items: center; flex-shrink: 0;">
<%= flash_icon(type) %>
</div>
<div class="ml-3 w-full">
<div class="space-y-2">
<div class="text-sm text-green-700">
<p class="text-sm font-medium"><%= message %></p>
</div>
</div>
</div>
<div class="ml-4 flex-shrink-0 flex">
<button data-action="click->flash-message#close" class="inline-flex text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-purple-500">
<svg class="h-5 w-5" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd" />
</svg>
<span style="flex: 1;"><%= message %></span>
<button data-action="click->flash-message#close"
style="background: none; border: none; cursor: pointer; padding: var(--space-1); color: inherit; opacity: 0.7; transition: opacity 0.2s;">
<i data-lucide="x" style="width: 16px; height: 16px;"></i>
</button>
</div>
<% end %>
</div>
</div>
<% end %>
<% end %>

View File

@@ -15,10 +15,10 @@ Rails.application.routes.draw do
# Pages
get "dashboard", to: "pages#dashboard", as: "dashboard"
# events
# Events
get "events", to: "events#index", as: "events"
get "events/:slug.:id", to: "events#show", as: "party"
post "events/:slug.:id/checkout", to: "events#checkout", as: "party_checkout"
get "events/:slug.:id", to: "events#show", as: "event"
post "events/:slug.:id/checkout", to: "events#checkout", as: "event_checkout"
# Routes for devise authentication Gem
# Bind devise to user

View File

@@ -31,11 +31,11 @@ end
# Reload all users after creation
users = User.all.to_a
# Create sample parties
parties_data = [
# Create sample events
events_data = [
{
name: "Summer Beach Party",
slug: "summer-beach-party",
name: "Summer Beach Event",
slug: "summer-beach-event",
description: "Join us for an amazing night at the beach with music, dancing, and cocktails.",
venue_name: "Sunset Beach Resort",
venue_address: "123 Ocean Drive, Miami, FL",
@@ -77,40 +77,40 @@ parties_data = [
}
]
parties = []
parties_data.each do |party_data|
user = party_data.delete(:user)
party = Party.find_or_create_by!(name: party_data[:name]) do |p|
p.assign_attributes(party_data)
events = []
events_data.each do |event_data|
user = event_data.delete(:user)
event = Event.find_or_create_by!(name: event_data[:name]) do |p|
p.assign_attributes(event_data)
p.user = user
p.state = :published
end
parties << party
events << event
end
# Create ticket types for each party
parties.each_with_index do |party, index|
# Create ticket types for each event
events.each_with_index do |event, index|
# General Admission ticket type
TicketType.find_or_create_by!(party: party, name: "General Admission") do |tt|
tt.description = "General admission ticket for #{party.name}"
TicketType.find_or_create_by!(event: event, name: "General Admission") do |tt|
tt.description = "General admission ticket for #{event.name}"
tt.price_cents = 2500 # $25.00
tt.quantity = 100
tt.sale_start_at = 1.month.ago
tt.sale_end_at = party.start_time - 1.hour
tt.sale_end_at = event.start_time - 1.hour
tt.requires_id = false
tt.minimum_age = 18
end
# VIP ticket type
TicketType.find_or_create_by!(party: party, name: "VIP") do |tt|
tt.description = "VIP access ticket for #{party.name} with premium benefits"
TicketType.find_or_create_by!(event: event, name: "VIP") do |tt|
tt.description = "VIP access ticket for #{event.name} with premium benefits"
tt.price_cents = 7500 # $75.00
tt.quantity = 20
tt.sale_start_at = 1.month.ago
tt.sale_end_at = party.start_time - 1.hour
tt.sale_end_at = event.start_time - 1.hour
tt.requires_id = true
tt.minimum_age = 21
end
end
puts "Created #{User.count} users, #{Party.count} parties, and #{TicketType.count} ticket types"
puts "Created #{User.count} users, #{Event.count} events, and #{TicketType.count} ticket types"