work on the frontend

This commit is contained in:
Doar Mihai
2026-02-08 14:13:22 +02:00
parent 89be4d4329
commit 56b593d9ca
17 changed files with 2238 additions and 424 deletions
+58 -1
View File
@@ -6,6 +6,63 @@
@source '../**/*.js';
@theme {
--font-sans: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
--font-sans: 'Inter', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
'Segoe UI Symbol', 'Noto Color Emoji';
/* Custom color palette for ProductHunt-like theme */
--color-primary-50: #fef2f2;
--color-primary-100: #fee2e2;
--color-primary-200: #fecaca;
--color-primary-300: #fca5a5;
--color-primary-400: #f87171;
--color-primary-500: #ef4444;
--color-primary-600: #dc2626;
--color-primary-700: #b91c1c;
--color-primary-800: #991b1b;
--color-primary-900: #7f1d1d;
--color-accent-50: #fff7ed;
--color-accent-100: #ffedd5;
--color-accent-200: #fed7aa;
--color-accent-300: #fdba74;
--color-accent-400: #fb923c;
--color-accent-500: #f97316;
--color-accent-600: #ea580c;
--color-accent-700: #c2410c;
--color-accent-800: #9a3412;
--color-accent-900: #7c2d12;
}
/* Custom utility classes */
@layer utilities {
.text-balance {
text-wrap: balance;
}
}
/* Custom component styles */
@layer components {
.btn-primary {
@apply px-4 py-2 bg-primary-600 text-white rounded-lg font-medium hover:bg-primary-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2;
}
.btn-secondary {
@apply px-4 py-2 bg-gray-100 text-gray-900 rounded-lg font-medium hover:bg-gray-200 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-gray-500 focus:ring-offset-2;
}
.btn-outline {
@apply px-4 py-2 border-2 border-gray-300 text-gray-700 rounded-lg font-medium hover:border-gray-400 hover:bg-gray-50 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-gray-500 focus:ring-offset-2;
}
.card {
@apply bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden transition-shadow duration-200 hover:shadow-md;
}
.input {
@apply block w-full rounded-lg border-gray-300 shadow-sm focus:border-primary-500 focus:ring-primary-500 transition-colors duration-200;
}
.badge {
@apply inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium;
}
}
+7
View File
@@ -1 +1,8 @@
import './bootstrap';
import Alpine from 'alpinejs';
// Make Alpine available globally
window.Alpine = Alpine;
// Start Alpine
Alpine.start();
@@ -0,0 +1,175 @@
<nav class="bg-white border-b border-gray-200 sticky top-0 z-50" x-data="{ mobileMenuOpen: false, userMenuOpen: false }">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between h-16">
<!-- Logo and Primary Navigation -->
<div class="flex">
<!-- Logo -->
<div class="flex-shrink-0 flex items-center">
<a href="{{ route('products.index') }}" class="flex items-center space-x-2">
<svg class="h-8 w-8 text-primary-600" fill="currentColor" viewBox="0 0 24 24">
<path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"></path>
</svg>
<span class="text-xl font-bold text-gray-900">{{ config('app.name', 'BestTech') }}</span>
</a>
</div>
<!-- Desktop Navigation -->
<div class="hidden sm:ml-8 sm:flex sm:space-x-8">
<a href="{{ route('products.index') }}"
class="inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium {{ request()->routeIs('products.index') ? 'border-primary-500 text-gray-900' : 'border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700' }}">
Discover
</a>
@auth
@if(auth()->user()->hasAnyRole(['admin', 'moderator']))
<a href="{{ route('products.manage') }}"
class="inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium {{ request()->routeIs('products.manage') ? 'border-primary-500 text-gray-900' : 'border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700' }}">
Manage
</a>
@endif
@endauth
</div>
</div>
<!-- Right Side -->
<div class="hidden sm:ml-6 sm:flex sm:items-center sm:space-x-4">
@guest
<a href="{{ route('login') }}" class="text-gray-700 hover:text-gray-900 px-3 py-2 rounded-md text-sm font-medium">
Sign in
</a>
<a href="{{ route('register') }}" class="btn-primary">
Get started
</a>
@else
<!-- Submit Product Button -->
<a href="{{ route('products.create') }}" class="btn-primary flex items-center space-x-2">
<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"></path>
</svg>
<span>Submit</span>
</a>
<!-- User Menu Dropdown -->
<div class="relative" @click.away="userMenuOpen = false">
<button @click="userMenuOpen = !userMenuOpen"
class="flex items-center space-x-3 text-sm rounded-full focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">
<div class="h-8 w-8 rounded-full bg-gradient-to-br from-primary-500 to-accent-500 flex items-center justify-center text-white font-semibold">
{{ strtoupper(substr(Auth::user()->name, 0, 1)) }}
</div>
<svg class="h-5 w-5 text-gray-400" 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"></path>
</svg>
</button>
<!-- Dropdown Menu -->
<div x-show="userMenuOpen"
x-transition:enter="transition ease-out duration-100"
x-transition:enter-start="transform opacity-0 scale-95"
x-transition:enter-end="transform opacity-100 scale-100"
x-transition:leave="transition ease-in duration-75"
x-transition:leave-start="transform opacity-100 scale-100"
x-transition:leave-end="transform opacity-0 scale-95"
class="origin-top-right absolute right-0 mt-2 w-48 rounded-lg shadow-lg py-1 bg-white ring-1 ring-black ring-opacity-5"
style="display: none;">
<div class="px-4 py-2 border-b border-gray-100">
<p class="text-sm font-medium text-gray-900">{{ Auth::user()->name }}</p>
<p class="text-xs text-gray-500">{{ Auth::user()->email }}</p>
</div>
<a href="{{ route('profile.show', Auth::user()) }}" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">
Your Profile
</a>
<a href="{{ route('profile.edit') }}" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">
Settings
</a>
<form method="POST" action="{{ route('logout') }}">
@csrf
<button type="submit" class="block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">
Sign out
</button>
</form>
</div>
</div>
@endguest
</div>
<!-- Mobile menu button -->
<div class="flex items-center sm:hidden">
<button @click="mobileMenuOpen = !mobileMenuOpen"
class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-primary-500">
<svg class="h-6 w-6" :class="{'hidden': mobileMenuOpen, 'block': !mobileMenuOpen }" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"></path>
</svg>
<svg class="h-6 w-6" :class="{'block': mobileMenuOpen, 'hidden': !mobileMenuOpen }" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
</svg>
</button>
</div>
</div>
</div>
<!-- Mobile menu -->
<div x-show="mobileMenuOpen"
x-transition:enter="transition ease-out duration-100"
x-transition:enter-start="transform opacity-0 scale-95"
x-transition:enter-end="transform opacity-100 scale-100"
x-transition:leave="transition ease-in duration-75"
x-transition:leave-start="transform opacity-100 scale-100"
x-transition:leave-end="transform opacity-0 scale-95"
class="sm:hidden"
style="display: none;">
<div class="pt-2 pb-3 space-y-1">
<a href="{{ route('products.index') }}"
class="block pl-3 pr-4 py-2 border-l-4 text-base font-medium {{ request()->routeIs('products.index') ? 'border-primary-500 text-primary-700 bg-primary-50' : 'border-transparent text-gray-500 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-700' }}">
Discover
</a>
@auth
@if(auth()->user()->hasAnyRole(['admin', 'moderator']))
<a href="{{ route('products.manage') }}"
class="block pl-3 pr-4 py-2 border-l-4 text-base font-medium {{ request()->routeIs('products.manage') ? 'border-primary-500 text-primary-700 bg-primary-50' : 'border-transparent text-gray-500 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-700' }}">
Manage
</a>
@endif
@endauth
</div>
@auth
<div class="pt-4 pb-3 border-t border-gray-200">
<div class="flex items-center px-4">
<div class="flex-shrink-0">
<div class="h-10 w-10 rounded-full bg-gradient-to-br from-primary-500 to-accent-500 flex items-center justify-center text-white font-semibold">
{{ strtoupper(substr(Auth::user()->name, 0, 1)) }}
</div>
</div>
<div class="ml-3">
<div class="text-base font-medium text-gray-800">{{ Auth::user()->name }}</div>
<div class="text-sm font-medium text-gray-500">{{ Auth::user()->email }}</div>
</div>
</div>
<div class="mt-3 space-y-1">
<a href="{{ route('products.create') }}" class="block px-4 py-2 text-base font-medium text-gray-500 hover:text-gray-800 hover:bg-gray-100">
Submit Product
</a>
<a href="{{ route('profile.show', Auth::user()) }}" class="block px-4 py-2 text-base font-medium text-gray-500 hover:text-gray-800 hover:bg-gray-100">
Your Profile
</a>
<a href="{{ route('profile.edit') }}" class="block px-4 py-2 text-base font-medium text-gray-500 hover:text-gray-800 hover:bg-gray-100">
Settings
</a>
<form method="POST" action="{{ route('logout') }}">
@csrf
<button type="submit" class="block w-full text-left px-4 py-2 text-base font-medium text-gray-500 hover:text-gray-800 hover:bg-gray-100">
Sign out
</button>
</form>
</div>
</div>
@else
<div class="pt-4 pb-3 border-t border-gray-200 space-y-1">
<a href="{{ route('login') }}" class="block px-4 py-2 text-base font-medium text-gray-500 hover:text-gray-800 hover:bg-gray-100">
Sign in
</a>
<a href="{{ route('register') }}" class="block px-4 py-2 text-base font-medium text-primary-600 hover:text-primary-800 hover:bg-gray-100">
Get started
</a>
</div>
@endguest
</div>
</nav>
@@ -0,0 +1,46 @@
@props(['product'])
@php
$isBookmarked = auth()->check() && $product->isBookmarkedBy(auth()->user());
@endphp
<div x-data="{
bookmarked: {{ $isBookmarked ? 'true' : 'false' }},
loading: false,
toggleBookmark() {
if (this.loading) return;
this.loading = true;
fetch('{{ route('products.bookmark', $product) }}', {
method: 'POST',
headers: {
'X-CSRF-TOKEN': '{{ csrf_token() }}',
'Content-Type': 'application/json',
'Accept': 'application/json',
},
})
.then(response => response.json())
.then(data => {
this.bookmarked = data.bookmarked;
})
.catch(error => {
console.error('Error:', error);
})
.finally(() => {
this.loading = false;
});
}
}">
<button @click="toggleBookmark()"
:disabled="loading"
:title="bookmarked ? 'Remove bookmark' : 'Bookmark this product'"
class="text-gray-400 hover:text-primary-600 transition-colors disabled:opacity-50">
<svg class="h-5 w-5"
:class="{ 'animate-pulse': loading }"
:fill="bookmarked ? 'currentColor' : 'none'"
stroke="currentColor"
viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"></path>
</svg>
</button>
</div>
@@ -0,0 +1,82 @@
@props(['product'])
<div class="card group">
<a href="{{ route('products.show', $product) }}" class="block">
<!-- Thumbnail -->
<div class="aspect-video bg-gradient-to-br from-gray-100 to-gray-200 overflow-hidden">
@if($product->thumbnail_url)
<img src="{{ $product->thumbnail_url }}"
alt="{{ $product->title }}"
class="w-full h-full object-cover group-hover:scale-105 transition-transform duration-200"
loading="lazy">
@else
<div class="w-full h-full flex items-center justify-center">
<svg class="h-16 w-16 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"></path>
</svg>
</div>
@endif
</div>
</a>
<!-- Content -->
<div class="p-4">
<div class="flex items-start justify-between mb-2">
<div class="flex-1 min-w-0">
<a href="{{ route('products.show', $product) }}" class="group-hover:text-primary-600 transition-colors">
<h3 class="text-lg font-semibold text-gray-900 truncate">{{ $product->title }}</h3>
</a>
</div>
<!-- Upvote Button Component -->
@include('components.product.upvote-button', ['product' => $product])
</div>
<!-- Description -->
<p class="text-sm text-gray-600 line-clamp-2 mb-3">
{{ Str::limit($product->description, 100) }}
</p>
<!-- Meta Information -->
<div class="flex items-center justify-between text-xs text-gray-500">
<div class="flex items-center space-x-3">
<!-- Category Badge -->
<span class="badge bg-gray-100 text-gray-700">
{{ $product->category->name }}
</span>
<!-- Created At -->
<span class="flex items-center">
<svg class="h-3.5 w-3.5 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<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>
</svg>
{{ $product->created_at->diffForHumans() }}
</span>
</div>
<!-- User -->
<a href="{{ route('profile.show', $product->user) }}" class="flex items-center space-x-1 hover:text-gray-900">
<div class="h-5 w-5 rounded-full bg-gradient-to-br from-primary-500 to-accent-500 flex items-center justify-center text-white text-xs font-semibold">
{{ strtoupper(substr($product->user->name, 0, 1)) }}
</div>
<span class="text-xs">{{ $product->user->name }}</span>
</a>
</div>
<!-- Action Buttons -->
<div class="mt-3 pt-3 border-t border-gray-100 flex items-center justify-between">
<a href="{{ route('products.show', $product) }}"
class="text-sm font-medium text-primary-600 hover:text-primary-700 flex items-center">
View details
<svg class="h-4 w-4 ml-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path>
</svg>
</a>
<!-- Bookmark Button -->
@auth
@include('components.product.bookmark-button', ['product' => $product])
@endauth
</div>
</div>
</div>
@@ -0,0 +1,64 @@
@props(['product', 'size' => 'sm'])
@php
$isUpvoted = auth()->check() && $product->isUpvotedBy(auth()->user());
$upvotesCount = isset($product->upvotes_count) ? $product->upvotes_count : $product->upvotes()->count();
$sizeClasses = match($size) {
'lg' => 'h-12 w-12 text-base',
'md' => 'h-10 w-10 text-sm',
default => 'h-8 w-8 text-xs',
};
@endphp
<div x-data="{
upvoted: {{ $isUpvoted ? 'true' : 'false' }},
count: {{ $upvotesCount }},
loading: false,
toggleUpvote() {
@guest
window.location.href = '{{ route('login') }}';
return;
@endguest
if (this.loading) return;
this.loading = true;
fetch('{{ route('products.upvote', $product) }}', {
method: 'POST',
headers: {
'X-CSRF-TOKEN': '{{ csrf_token() }}',
'Content-Type': 'application/json',
'Accept': 'application/json',
},
})
.then(response => response.json())
.then(data => {
this.upvoted = data.upvoted;
this.count = data.upvotes_count;
})
.catch(error => {
console.error('Error:', error);
})
.finally(() => {
this.loading = false;
});
}
}" class="flex-shrink-0">
<button @click="toggleUpvote()"
:disabled="loading"
:class="{
'bg-primary-100 border-primary-500 text-primary-700': upvoted,
'bg-white border-gray-300 text-gray-700 hover:border-gray-400': !upvoted
}"
class="{{ $sizeClasses }} flex flex-col items-center justify-center border-2 rounded-lg transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed">
<svg :class="{ 'animate-bounce': loading }"
class="w-4 h-4"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 15l7-7 7 7"></path>
</svg>
<span class="font-semibold" x-text="count"></span>
</button>
</div>
@@ -0,0 +1,67 @@
@props([
'name',
'show' => false,
'maxWidth' => 'md'
])
@php
$maxWidthClass = [
'sm' => 'sm:max-w-sm',
'md' => 'sm:max-w-md',
'lg' => 'sm:max-w-lg',
'xl' => 'sm:max-w-xl',
'2xl' => 'sm:max-w-2xl',
][$maxWidth];
@endphp
<div x-data="{
show: @js($show),
focusables() {
let selector = 'a, button, input:not([type=\'hidden\']), textarea, select, details, [tabindex]:not([tabindex=\'-1\'])'
return [...this.$el.querySelectorAll(selector)]
.filter(el => ! el.hasAttribute('disabled'))
},
firstFocusable() { return this.focusables()[0] },
lastFocusable() { return this.focusables().slice(-1)[0] },
nextFocusable() { return this.focusables()[this.nextFocusableIndex()] || this.firstFocusable() },
prevFocusable() { return this.focusables()[this.prevFocusableIndex()] || this.lastFocusable() },
nextFocusableIndex() { return (this.focusables().indexOf(document.activeElement) + 1) % (this.focusables().length + 1) },
prevFocusableIndex() { return Math.max(0, this.focusables().indexOf(document.activeElement)) -1 },
}"
x-init="$watch('show', value => {
if (value) {
document.body.classList.add('overflow-hidden');
{{ $attributes->has('focusable') ? 'setTimeout(() => firstFocusable().focus(), 100)' : '' }}
} else {
document.body.classList.remove('overflow-hidden');
}
})"
x-on:open-modal.window="$event.detail == '{{ $name }}' ? show = true : null"
x-on:close-modal.window="$event.detail == '{{ $name }}' ? show = false : null"
x-on:close.stop="show = false"
x-on:keydown.escape.window="show = false"
x-on:keydown.tab.prevent="$event.shiftKey || nextFocusable().focus()"
x-on:keydown.shift.tab.prevent="prevFocusable().focus()"
x-show="show"
class="fixed inset-0 overflow-y-auto px-4 py-6 sm:px-0 z-50"
style="display: {{ $show ? 'block' : 'none' }};">
<div x-show="show" class="fixed inset-0 transform transition-all" x-on:click="show = false"
x-transition:enter="ease-out duration-300"
x-transition:enter-start="opacity-0"
x-transition:enter-end="opacity-100"
x-transition:leave="ease-in duration-200"
x-transition:leave-start="opacity-100"
x-transition:leave-end="opacity-0">
<div class="absolute inset-0 bg-gray-500 opacity-75"></div>
</div>
<div x-show="show" class="mb-6 bg-white rounded-lg overflow-hidden shadow-xl transform transition-all sm:w-full sm:mx-auto {{ $maxWidthClass }}"
x-transition:enter="ease-out duration-300"
x-transition:enter-start="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
x-transition:enter-end="opacity-100 translate-y-0 sm:scale-100"
x-transition:leave="ease-in duration-200"
x-transition:leave-start="opacity-100 translate-y-0 sm:scale-100"
x-transition:leave-end="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95">
{{ $slot }}
</div>
</div>
@@ -0,0 +1,135 @@
<!-- Toast Notifications -->
<div x-data="{
notices: [],
visible: [],
add(notice) {
const id = Date.now();
notice.id = id;
this.notices.push(notice);
this.visible.push(id);
setTimeout(() => {
this.remove(id);
}, notice.duration || 5000);
},
remove(id) {
const index = this.visible.indexOf(id);
if (index > -1) {
this.visible.splice(index, 1);
}
setTimeout(() => {
const noticeIndex = this.notices.findIndex(n => n.id === id);
if (noticeIndex > -1) {
this.notices.splice(noticeIndex, 1);
}
}, 300);
}
}"
@notify.window="add($event.detail)"
class="fixed top-4 right-4 z-50 space-y-2"
aria-live="assertive">
<template x-for="notice in notices" :key="notice.id">
<div x-show="visible.includes(notice.id)"
x-transition:enter="transition ease-out duration-300"
x-transition:enter-start="transform translate-x-full opacity-0"
x-transition:enter-end="transform translate-x-0 opacity-100"
x-transition:leave="transition ease-in duration-200"
x-transition:leave-start="transform translate-x-0 opacity-100"
x-transition:leave-end="transform translate-x-full opacity-0"
class="max-w-sm w-full bg-white shadow-lg rounded-lg pointer-events-auto ring-1 ring-black ring-opacity-5 overflow-hidden">
<div class="p-4">
<div class="flex items-start">
<div class="flex-shrink-0">
<!-- Success Icon -->
<template x-if="notice.type === 'success'">
<svg class="h-6 w-6 text-green-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
</template>
<!-- Error Icon -->
<template x-if="notice.type === 'error'">
<svg class="h-6 w-6 text-red-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
</template>
<!-- Info Icon -->
<template x-if="notice.type === 'info'">
<svg class="h-6 w-6 text-blue-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
</template>
<!-- Warning Icon -->
<template x-if="notice.type === 'warning'">
<svg class="h-6 w-6 text-yellow-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path>
</svg>
</template>
</div>
<div class="ml-3 w-0 flex-1 pt-0.5">
<p class="text-sm font-medium text-gray-900" x-text="notice.title"></p>
<p class="mt-1 text-sm text-gray-500" x-text="notice.message"></p>
</div>
<div class="ml-4 flex-shrink-0 flex">
<button @click="remove(notice.id)"
class="bg-white rounded-md inline-flex text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">
<span class="sr-only">Close</span>
<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"></path>
</svg>
</button>
</div>
</div>
</div>
</div>
</template>
</div>
<!-- Session Messages (Laravel Flash Messages) -->
@if(session('success') || session('error') || session('info') || session('warning'))
<script>
document.addEventListener('DOMContentLoaded', function() {
@if(session('success'))
window.dispatchEvent(new CustomEvent('notify', {
detail: {
type: 'success',
title: 'Success!',
message: '{{ session('success') }}',
duration: 5000
}
}));
@endif
@if(session('error'))
window.dispatchEvent(new CustomEvent('notify', {
detail: {
type: 'error',
title: 'Error!',
message: '{{ session('error') }}',
duration: 5000
}
}));
@endif
@if(session('info'))
window.dispatchEvent(new CustomEvent('notify', {
detail: {
type: 'info',
title: 'Info',
message: '{{ session('info') }}',
duration: 5000
}
}));
@endif
@if(session('warning'))
window.dispatchEvent(new CustomEvent('notify', {
detail: {
type: 'warning',
title: 'Warning!',
message: '{{ session('warning') }}',
duration: 5000
}
}));
@endif
});
</script>
@endif
+80 -62
View File
@@ -1,5 +1,5 @@
<!doctype html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}" class="h-full bg-gray-50">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
@@ -7,74 +7,92 @@
<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ config('app.name', 'Laravel') }}</title>
<title>{{ $title ?? config('app.name', 'BestTech') }}</title>
<!-- Fonts -->
<link rel="dns-prefetch" href="//fonts.bunny.net">
<link href="https://fonts.bunny.net/css?family=Nunito" rel="stylesheet">
<link rel="preconnect" href="https://fonts.bunny.net">
<link href="https://fonts.bunny.net/css?family=inter:300,400,500,600,700,800" rel="stylesheet">
<!-- Scripts -->
@vite(['resources/sass/app.scss', 'resources/js/app.js'])
<!-- Favicon -->
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
<!-- Scripts & Styles -->
@vite(['resources/css/app.css', 'resources/js/app.js'])
<!-- Additional Head Content -->
@stack('styles')
</head>
<body>
<div id="app">
<nav class="navbar navbar-expand-md navbar-light bg-white shadow-sm">
<div class="container">
<a class="navbar-brand" href="{{ url('/') }}">
{{ config('app.name', 'Laravel') }}
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="{{ __('Toggle navigation') }}">
<span class="navbar-toggler-icon"></span>
</button>
<body class="h-full antialiased">
<div id="app" class="min-h-full flex flex-col">
<!-- Navigation -->
@include('components.layout.navbar')
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<!-- Left Side Of Navbar -->
<ul class="navbar-nav me-auto">
</ul>
<!-- Right Side Of Navbar -->
<ul class="navbar-nav ms-auto">
<!-- Authentication Links -->
@guest
@if (Route::has('login'))
<li class="nav-item">
<a class="nav-link" href="{{ route('login') }}">{{ __('Login') }}</a>
</li>
@endif
@if (Route::has('register'))
<li class="nav-item">
<a class="nav-link" href="{{ route('register') }}">{{ __('Register') }}</a>
</li>
@endif
@else
<li class="nav-item dropdown">
<a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" v-pre>
{{ Auth::user()->name }}
</a>
<div class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="{{ route('logout') }}"
onclick="event.preventDefault();
document.getElementById('logout-form').submit();">
{{ __('Logout') }}
</a>
<form id="logout-form" action="{{ route('logout') }}" method="POST" class="d-none">
@csrf
</form>
</div>
</li>
@endguest
</ul>
</div>
</div>
</nav>
<main class="py-4">
<!-- Page Content -->
<main class="flex-grow">
@yield('content')
</main>
<!-- Footer -->
<footer class="bg-white border-t border-gray-200 mt-auto">
<div class="max-w-7xl mx-auto py-12 px-4 sm:px-6 lg:px-8">
<div class="grid grid-cols-1 md:grid-cols-4 gap-8">
<!-- Company Info -->
<div class="col-span-1">
<div class="flex items-center space-x-2 mb-4">
<svg class="h-8 w-8 text-primary-600" fill="currentColor" viewBox="0 0 24 24">
<path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"></path>
</svg>
<span class="text-lg font-bold text-gray-900">{{ config('app.name', 'BestTech') }}</span>
</div>
<p class="text-sm text-gray-600">
Discover the best tech products from the EU.
</p>
</div>
<!-- Product Links -->
<div>
<h3 class="text-sm font-semibold text-gray-900 uppercase tracking-wider mb-4">Product</h3>
<ul class="space-y-3">
<li><a href="{{ route('products.index') }}" class="text-sm text-gray-600 hover:text-gray-900">Discover</a></li>
@auth
<li><a href="{{ route('products.create') }}" class="text-sm text-gray-600 hover:text-gray-900">Submit Product</a></li>
@endauth
</ul>
</div>
<!-- Company Links -->
<div>
<h3 class="text-sm font-semibold text-gray-900 uppercase tracking-wider mb-4">Company</h3>
<ul class="space-y-3">
<li><a href="#" class="text-sm text-gray-600 hover:text-gray-900">About</a></li>
<li><a href="#" class="text-sm text-gray-600 hover:text-gray-900">Blog</a></li>
<li><a href="#" class="text-sm text-gray-600 hover:text-gray-900">Contact</a></li>
</ul>
</div>
<!-- Legal Links -->
<div>
<h3 class="text-sm font-semibold text-gray-900 uppercase tracking-wider mb-4">Legal</h3>
<ul class="space-y-3">
<li><a href="#" class="text-sm text-gray-600 hover:text-gray-900">Privacy</a></li>
<li><a href="#" class="text-sm text-gray-600 hover:text-gray-900">Terms</a></li>
</ul>
</div>
</div>
<div class="mt-8 pt-8 border-t border-gray-200">
<p class="text-sm text-gray-500 text-center">
&copy; {{ date('Y') }} {{ config('app.name', 'BestTech') }}. All rights reserved.
</p>
</div>
</div>
</footer>
</div>
<!-- Toast Notifications -->
@include('components.ui.notification')
<!-- Additional Scripts -->
@stack('scripts')
</body>
</html>
@@ -0,0 +1,180 @@
@extends('layouts.app')
@php
$title = 'Discover Products - ' . config('app.name');
@endphp
@section('content')
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="d-flex justify-content-between align-items-center mb-4">
<h1>Discover Products</h1>
@auth
<a href="{{ route('products.create') }}" class="btn btn-primary">Submit a Product</a>
@endauth
</div>
<!-- Search & Filter Form -->
<div class="card mb-4">
<div class="card-body">
<form method="GET" action="{{ route('products.index') }}" id="filterForm">
<div class="row g-3">
<!-- Search Input -->
<div class="col-md-4">
<label for="search" class="form-label fw-semibold">Search Products</label>
<input
type="text"
name="search"
id="search"
value="{{ request('search') }}"
class="form-control"
placeholder="Search by title or description..."
>
</div>
<!-- Category Filter -->
<div class="col-md-3">
<label for="category" class="form-label fw-semibold">Category</label>
<select name="category" id="category" class="form-select">
<option value="">All Categories</option>
@foreach($categories as $category)
<option value="{{ $category->id }}" {{ request('category') == $category->id ? 'selected' : '' }}>
{{ $category->name }}
</option>
@endforeach
</select>
</div>
<!-- Date Range Filter -->
<div class="col-md-2">
<label for="date_range" class="form-label fw-semibold">Time Period</label>
<select name="date_range" id="date_range" class="form-select">
<option value="">All Time</option>
<option value="today" {{ request('date_range') === 'today' ? 'selected' : '' }}>Today</option>
<option value="week" {{ request('date_range') === 'week' ? 'selected' : '' }}>This Week</option>
<option value="month" {{ request('date_range') === 'month' ? 'selected' : '' }}>This Month</option>
<option value="year" {{ request('date_range') === 'year' ? 'selected' : '' }}>This Year</option>
</select>
</div>
<!-- Sort By -->
<div class="col-md-2">
<label for="sort" class="form-label fw-semibold">Sort By</label>
<select name="sort" id="sort" class="form-select">
<option value="newest" {{ request('sort') === 'newest' || !request('sort') ? 'selected' : '' }}>Newest</option>
<option value="popular" {{ request('sort') === 'popular' ? 'selected' : '' }}>Most Popular</option>
<option value="oldest" {{ request('sort') === 'oldest' ? 'selected' : '' }}>Oldest</option>
</select>
</div>
<!-- Action Buttons -->
<div class="col-md-1 d-flex align-items-end">
<div class="btn-group w-100" role="group">
<button type="submit" class="btn btn-primary" title="Apply Filters">
<i class="bi bi-search"></i>
</button>
<a href="{{ route('products.index') }}" class="btn btn-outline-secondary" title="Clear Filters">
<i class="bi bi-x-circle"></i>
</a>
</div>
</div>
</div>
@if(request()->hasAny(['search', 'category', 'date_range', 'sort']))
<div class="mt-3">
<small class="text-muted">
<strong>Active Filters:</strong>
@if(request('search'))
<span class="badge bg-secondary me-1">Search: "{{ request('search') }}"</span>
@endif
@if(request('category'))
<span class="badge bg-secondary me-1">Category: {{ $categories->find(request('category'))->name ?? 'Unknown' }}</span>
@endif
@if(request('date_range'))
<span class="badge bg-secondary me-1">Period: {{ ucfirst(request('date_range')) }}</span>
@endif
@if(request('sort') && request('sort') !== 'newest')
<span class="badge bg-secondary me-1">Sort: {{ ucfirst(request('sort')) }}</span>
@endif
</small>
</div>
@endif
</form>
</div>
</div>
@if(session('success'))
<div class="alert alert-success alert-dismissible fade show" role="alert">
{{ session('success') }}
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
@endif
<!-- Results Summary -->
@if($products->total() > 0)
<div class="mb-3">
<p class="text-muted">
Showing {{ $products->firstItem() }} to {{ $products->lastItem() }} of {{ $products->total() }} product(s)
</p>
</div>
@endif
<!-- Products Grid -->
<div class="row">
@forelse($products as $product)
<div class="col-md-4 mb-4">
<div class="card h-100">
@if($product->thumbnail_url)
<img src="{{ $product->thumbnail_url }}" class="card-img-top" alt="{{ $product->title }}" style="height: 200px; object-fit: cover;">
@else
<div class="bg-light d-flex align-items-center justify-content-center" style="height: 200px;">
<span class="text-muted">No image</span>
</div>
@endif
<div class="card-body d-flex flex-column">
<div class="d-flex justify-content-between align-items-start mb-2">
<h5 class="card-title mb-0">{{ $product->title }}</h5>
@if(isset($product->upvotes_count))
<span class="badge bg-primary rounded-pill">
<i class="bi bi-arrow-up"></i> {{ $product->upvotes_count }}
</span>
@endif
</div>
<p class="card-text text-muted small mb-2">
<span class="badge bg-secondary">{{ $product->category->name }}</span>
</p>
<p class="card-text flex-grow-1">{{ Str::limit($product->description, 100) }}</p>
<div class="mt-auto">
<a href="{{ route('products.show', $product) }}" class="btn btn-sm btn-primary">View Details</a>
<a href="{{ $product->website_url }}" target="_blank" rel="noopener" class="btn btn-sm btn-outline-primary">Visit Website</a>
</div>
<div class="mt-2 text-muted small">
By {{ $product->user->name }} · {{ $product->created_at->diffForHumans() }}
</div>
</div>
</div>
</div>
@empty
<div class="col-md-12">
<div class="alert alert-info">
@if(request()->hasAny(['search', 'category', 'date_range']))
No products found matching your filters. Try adjusting your search criteria.
@else
No products found. Be the first to submit one!
@endif
</div>
</div>
@endforelse
</div>
<!-- Pagination -->
@if($products->hasPages())
<div class="d-flex justify-content-center">
{{ $products->links() }}
</div>
@endif
</div>
</div>
</div>
@endsection
+191 -166
View File
@@ -1,176 +1,201 @@
@extends('layouts.app')
@php
$title = 'Discover Products - ' . config('app.name');
@endphp
@section('content')
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="d-flex justify-content-between align-items-center mb-4">
<h1>Discover Products</h1>
@auth
<a href="{{ route('products.create') }}" class="btn btn-primary">Submit a Product</a>
@endauth
</div>
<!-- Hero Section -->
<div class="bg-gradient-to-br from-primary-50 via-white to-accent-50 border-b border-gray-200">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12 sm:py-16">
<div class="text-center max-w-3xl mx-auto">
<h1 class="text-4xl sm:text-5xl font-bold text-gray-900 mb-4">
Discover the best tech from Europe
</h1>
<p class="text-lg text-gray-600 mb-8">
Find amazing products built by European makers and companies
</p>
<!-- Search & Filter Form -->
<div class="card mb-4">
<div class="card-body">
<form method="GET" action="{{ route('products.index') }}" id="filterForm">
<div class="row g-3">
<!-- Search Input -->
<div class="col-md-4">
<label for="search" class="form-label fw-semibold">Search Products</label>
<input
type="text"
name="search"
id="search"
value="{{ request('search') }}"
class="form-control"
placeholder="Search by title or description..."
>
</div>
<!-- Category Filter -->
<div class="col-md-3">
<label for="category" class="form-label fw-semibold">Category</label>
<select name="category" id="category" class="form-select">
<option value="">All Categories</option>
@foreach($categories as $category)
<option value="{{ $category->id }}" {{ request('category') == $category->id ? 'selected' : '' }}>
{{ $category->name }}
</option>
@endforeach
</select>
</div>
<!-- Date Range Filter -->
<div class="col-md-2">
<label for="date_range" class="form-label fw-semibold">Time Period</label>
<select name="date_range" id="date_range" class="form-select">
<option value="">All Time</option>
<option value="today" {{ request('date_range') === 'today' ? 'selected' : '' }}>Today</option>
<option value="week" {{ request('date_range') === 'week' ? 'selected' : '' }}>This Week</option>
<option value="month" {{ request('date_range') === 'month' ? 'selected' : '' }}>This Month</option>
<option value="year" {{ request('date_range') === 'year' ? 'selected' : '' }}>This Year</option>
</select>
</div>
<!-- Sort By -->
<div class="col-md-2">
<label for="sort" class="form-label fw-semibold">Sort By</label>
<select name="sort" id="sort" class="form-select">
<option value="newest" {{ request('sort') === 'newest' || !request('sort') ? 'selected' : '' }}>Newest</option>
<option value="popular" {{ request('sort') === 'popular' ? 'selected' : '' }}>Most Popular</option>
<option value="oldest" {{ request('sort') === 'oldest' ? 'selected' : '' }}>Oldest</option>
</select>
</div>
<!-- Action Buttons -->
<div class="col-md-1 d-flex align-items-end">
<div class="btn-group w-100" role="group">
<button type="submit" class="btn btn-primary" title="Apply Filters">
<i class="bi bi-search"></i>
</button>
<a href="{{ route('products.index') }}" class="btn btn-outline-secondary" title="Clear Filters">
<i class="bi bi-x-circle"></i>
</a>
</div>
</div>
</div>
@if(request()->hasAny(['search', 'category', 'date_range', 'sort']))
<div class="mt-3">
<small class="text-muted">
<strong>Active Filters:</strong>
@if(request('search'))
<span class="badge bg-secondary me-1">Search: "{{ request('search') }}"</span>
@endif
@if(request('category'))
<span class="badge bg-secondary me-1">Category: {{ $categories->find(request('category'))->name ?? 'Unknown' }}</span>
@endif
@if(request('date_range'))
<span class="badge bg-secondary me-1">Period: {{ ucfirst(request('date_range')) }}</span>
@endif
@if(request('sort') && request('sort') !== 'newest')
<span class="badge bg-secondary me-1">Sort: {{ ucfirst(request('sort')) }}</span>
@endif
</small>
</div>
@endif
</form>
</div>
</div>
@if(session('success'))
<div class="alert alert-success alert-dismissible fade show" role="alert">
{{ session('success') }}
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
@endif
<!-- Results Summary -->
@if($products->total() > 0)
<div class="mb-3">
<p class="text-muted">
Showing {{ $products->firstItem() }} to {{ $products->lastItem() }} of {{ $products->total() }} product(s)
</p>
</div>
@endif
<!-- Products Grid -->
<div class="row">
@forelse($products as $product)
<div class="col-md-4 mb-4">
<div class="card h-100">
@if($product->thumbnail_url)
<img src="{{ $product->thumbnail_url }}" class="card-img-top" alt="{{ $product->title }}" style="height: 200px; object-fit: cover;">
@else
<div class="bg-light d-flex align-items-center justify-content-center" style="height: 200px;">
<span class="text-muted">No image</span>
</div>
@endif
<div class="card-body d-flex flex-column">
<div class="d-flex justify-content-between align-items-start mb-2">
<h5 class="card-title mb-0">{{ $product->title }}</h5>
@if(isset($product->upvotes_count))
<span class="badge bg-primary rounded-pill">
<i class="bi bi-arrow-up"></i> {{ $product->upvotes_count }}
</span>
@endif
</div>
<p class="card-text text-muted small mb-2">
<span class="badge bg-secondary">{{ $product->category->name }}</span>
</p>
<p class="card-text flex-grow-1">{{ Str::limit($product->description, 100) }}</p>
<div class="mt-auto">
<a href="{{ route('products.show', $product) }}" class="btn btn-sm btn-primary">View Details</a>
<a href="{{ $product->website_url }}" target="_blank" rel="noopener" class="btn btn-sm btn-outline-primary">Visit Website</a>
</div>
<div class="mt-2 text-muted small">
By {{ $product->user->name }} · {{ $product->created_at->diffForHumans() }}
</div>
</div>
</div>
<!-- Hero Search -->
<div class="max-w-2xl mx-auto">
<form method="GET" action="{{ route('products.index') }}">
<div class="relative">
<input type="text"
name="search"
value="{{ request('search') }}"
placeholder="Search for products..."
class="w-full px-6 py-4 text-lg border-2 border-gray-300 rounded-full focus:border-primary-500 focus:ring-2 focus:ring-primary-200 transition-all duration-200">
<button type="submit"
class="absolute right-2 top-1/2 -translate-y-1/2 bg-primary-600 text-white px-6 py-2 rounded-full hover:bg-primary-700 transition-colors">
<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path>
</svg>
</button>
</div>
@empty
<div class="col-md-12">
<div class="alert alert-info">
@if(request()->hasAny(['search', 'category', 'date_range']))
No products found matching your filters. Try adjusting your search criteria.
@else
No products found. Be the first to submit one!
@endif
</div>
</div>
@endforelse
</form>
</div>
<!-- Pagination -->
@if($products->hasPages())
<div class="d-flex justify-content-center">
{{ $products->links() }}
</div>
@endif
</div>
</div>
</div>
<!-- Main Content -->
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
<!-- Filters & Sorting -->
<div class="mb-8">
<div class="bg-white rounded-xl shadow-sm border border-gray-200 p-4">
<form method="GET" action="{{ route('products.index') }}" class="space-y-4 lg:space-y-0" x-data="{ showFilters: false }">
<!-- Filter Toggle (Mobile) -->
<div class="lg:hidden">
<button @click="showFilters = !showFilters"
type="button"
class="w-full btn-secondary flex items-center justify-between">
<span>Filters & Sort</span>
<svg class="h-5 w-5" :class="{ 'rotate-180': showFilters }" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
</svg>
</button>
</div>
<!-- Filters Grid -->
<div :class="{ 'hidden': !showFilters }"
class="lg:block grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-5 gap-4">
<!-- Search (hidden on desktop as it's in hero) -->
<div class="lg:hidden">
<input type="text"
name="search"
value="{{ request('search') }}"
placeholder="Search..."
class="input">
</div>
<!-- Category Filter -->
<div>
<label for="category" class="block text-sm font-medium text-gray-700 mb-1">Category</label>
<select name="category" id="category" class="input">
<option value="">All Categories</option>
@foreach($categories as $category)
<option value="{{ $category->id }}" {{ request('category') == $category->id ? 'selected' : '' }}>
{{ $category->name }}
</option>
@endforeach
</select>
</div>
<!-- Date Range Filter -->
<div>
<label for="date_range" class="block text-sm font-medium text-gray-700 mb-1">Time Period</label>
<select name="date_range" id="date_range" class="input">
<option value="">All Time</option>
<option value="today" {{ request('date_range') === 'today' ? 'selected' : '' }}>Today</option>
<option value="week" {{ request('date_range') === 'week' ? 'selected' : '' }}>This Week</option>
<option value="month" {{ request('date_range') === 'month' ? 'selected' : '' }}>This Month</option>
<option value="year" {{ request('date_range') === 'year' ? 'selected' : '' }}>This Year</option>
</select>
</div>
<!-- Sort By -->
<div>
<label for="sort" class="block text-sm font-medium text-gray-700 mb-1">Sort By</label>
<select name="sort" id="sort" class="input">
<option value="newest" {{ request('sort') === 'newest' || !request('sort') ? 'selected' : '' }}>Newest</option>
<option value="popular" {{ request('sort') === 'popular' ? 'selected' : '' }}>Most Popular</option>
<option value="oldest" {{ request('sort') === 'oldest' ? 'selected' : '' }}>Oldest</option>
</select>
</div>
<!-- Action Buttons -->
<div class="flex items-end space-x-2">
<button type="submit" class="btn-primary flex-1 lg:flex-none">
Apply
</button>
<a href="{{ route('products.index') }}" class="btn-outline flex-1 lg:flex-none">
Clear
</a>
</div>
</div>
<!-- Active Filters Tags -->
@if(request()->hasAny(['search', 'category', 'date_range', 'sort']))
<div class="flex flex-wrap gap-2 pt-4 border-t border-gray-200">
<span class="text-sm font-medium text-gray-700">Active filters:</span>
@if(request('search'))
<span class="inline-flex items-center px-3 py-1 rounded-full text-sm bg-primary-100 text-primary-800">
Search: "{{ request('search') }}"
<a href="{{ route('products.index', request()->except('search')) }}" class="ml-2 hover:text-primary-900">×</a>
</span>
@endif
@if(request('category'))
<span class="inline-flex items-center px-3 py-1 rounded-full text-sm bg-primary-100 text-primary-800">
{{ $categories->find(request('category'))->name ?? 'Unknown' }}
<a href="{{ route('products.index', request()->except('category')) }}" class="ml-2 hover:text-primary-900">×</a>
</span>
@endif
@if(request('date_range'))
<span class="inline-flex items-center px-3 py-1 rounded-full text-sm bg-primary-100 text-primary-800">
{{ ucfirst(request('date_range')) }}
<a href="{{ route('products.index', request()->except('date_range')) }}" class="ml-2 hover:text-primary-900">×</a>
</span>
@endif
@if(request('sort') && request('sort') !== 'newest')
<span class="inline-flex items-center px-3 py-1 rounded-full text-sm bg-primary-100 text-primary-800">
{{ ucfirst(request('sort')) }}
<a href="{{ route('products.index', request()->except('sort')) }}" class="ml-2 hover:text-primary-900">×</a>
</span>
@endif
</div>
@endif
</form>
</div>
</div>
<!-- Results Summary -->
@if($products->total() > 0)
<div class="mb-6">
<p class="text-sm text-gray-600">
Showing <span class="font-semibold text-gray-900">{{ $products->firstItem() }}</span> to
<span class="font-semibold text-gray-900">{{ $products->lastItem() }}</span> of
<span class="font-semibold text-gray-900">{{ $products->total() }}</span> products
</p>
</div>
@endif
<!-- Products Grid -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 mb-8">
@forelse($products as $product)
@include('components.product.card', ['product' => $product])
@empty
<!-- Empty State -->
<div class="col-span-full">
<div class="text-center py-16">
<svg class="mx-auto h-16 w-16 text-gray-400 mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.172 16.172a4 4 0 015.656 0M9 10h.01M15 10h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
<h3 class="text-lg font-medium text-gray-900 mb-2">No products found</h3>
<p class="text-gray-600 mb-6">
@if(request()->hasAny(['search', 'category', 'date_range']))
Try adjusting your search or filters to find what you're looking for.
@else
Be the first to submit a product!
@endif
</p>
@auth
<a href="{{ route('products.create') }}" class="btn-primary inline-flex items-center space-x-2">
<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"></path>
</svg>
<span>Submit a Product</span>
</a>
@endauth
</div>
</div>
@endforelse
</div>
<!-- Pagination -->
@if($products->hasPages())
<div class="flex justify-center">
{{ $products->links() }}
</div>
@endif
</div>
@endsection
File diff suppressed because one or more lines are too long