lots of design improvements

This commit is contained in:
Doar Mihai
2026-02-14 16:11:09 +02:00
parent 56b593d9ca
commit 67de095a03
25 changed files with 1942 additions and 1477 deletions
+39 -60
View File
@@ -1,68 +1,47 @@
@import 'tailwindcss';
@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';
@source '../../storage/framework/views/*.php';
@source '../**/*.blade.php';
@source '../**/*.js';
@import "tailwindcss";
/* Custom Styles */
@theme {
--font-sans: 'Inter', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
'Segoe UI Symbol', 'Noto Color Emoji';
--color-primary-50: #f0f9ff;
--color-primary-100: #e0f2fe;
--color-primary-200: #bae6fd;
--color-primary-300: #7dd3fc;
--color-primary-400: #38bdf8;
--color-primary-500: #0ea5e9;
--color-primary-600: #0284c7;
--color-primary-700: #0369a1;
--color-primary-800: #075985;
--color-primary-900: #0c4a6e;
--color-primary-950: #082f49;
/* 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;
--color-accent-50: #fdf4ff;
--color-accent-100: #fae8ff;
--color-accent-200: #f5d0fe;
--color-accent-300: #f0abfc;
--color-accent-400: #e879f9;
--color-accent-500: #d946ef;
--color-accent-600: #c026d3;
--color-accent-700: #a21caf;
--color-accent-800: #86198f;
--color-accent-900: #701a75;
--color-accent-950: #4a044e;
}
/* Custom utility classes */
@layer utilities {
.text-balance {
text-wrap: balance;
}
/* Utility Classes */
.line-clamp-1 {
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
overflow: hidden;
}
/* 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;
}
.line-clamp-2 {
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.btn-primary {
@apply inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md text-white bg-primary-600 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500;
}
+69 -64
View File
@@ -1,72 +1,77 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">{{ __('Login') }}</div>
<div class="min-h-screen flex items-center justify-center py-12 px-4 sm:px-6 lg:px-8">
<div class="max-w-md w-full space-y-8">
<div>
<h2 class="mt-6 text-center text-3xl font-extrabold text-gray-900">
{{ __('Login') }}
</h2>
</div>
<div class="bg-white py-8 px-4 shadow sm:rounded-lg sm:px-10">
<form method="POST" action="{{ route('login') }}" class="space-y-6">
@csrf
<div class="card-body">
<form method="POST" action="{{ route('login') }}">
@csrf
<div class="row mb-3">
<label for="email" class="col-md-4 col-form-label text-md-end">{{ __('Email Address') }}</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email" autofocus>
@error('email')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="row mb-3">
<label for="password" class="col-md-4 col-form-label text-md-end">{{ __('Password') }}</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="current-password">
@error('password')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="row mb-3">
<div class="col-md-6 offset-md-4">
<div class="form-check">
<input class="form-check-input" type="checkbox" name="remember" id="remember" {{ old('remember') ? 'checked' : '' }}>
<label class="form-check-label" for="remember">
{{ __('Remember Me') }}
</label>
</div>
</div>
</div>
<div class="row mb-0">
<div class="col-md-8 offset-md-4">
<button type="submit" class="btn btn-primary">
{{ __('Login') }}
</button>
@if (Route::has('password.request'))
<a class="btn btn-link" href="{{ route('password.request') }}">
{{ __('Forgot Your Password?') }}
</a>
@endif
</div>
</div>
</form>
<div>
<label for="email" class="block text-sm font-medium text-gray-700">
{{ __('Email Address') }}
</label>
<div class="mt-1">
<input id="email" type="email" name="email" value="{{ old('email') }}" required autocomplete="email" autofocus
class="appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm @error('email') border-red-300 text-red-900 placeholder-red-300 focus:ring-red-500 focus:border-red-500 @enderror">
@error('email')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
</div>
</div>
<div>
<label for="password" class="block text-sm font-medium text-gray-700">
{{ __('Password') }}
</label>
<div class="mt-1">
<input id="password" type="password" name="password" required autocomplete="current-password"
class="appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm @error('password') border-red-300 text-red-900 placeholder-red-300 focus:ring-red-500 focus:border-red-500 @enderror">
@error('password')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
</div>
<div class="flex items-center justify-between">
<div class="flex items-center">
<input id="remember" name="remember" type="checkbox" {{ old('remember') ? 'checked' : '' }}
class="h-4 w-4 text-primary-600 focus:ring-primary-500 border-gray-300 rounded">
<label for="remember" class="ml-2 block text-sm text-gray-900">
{{ __('Remember Me') }}
</label>
</div>
@if (Route::has('password.request'))
<div class="text-sm">
<a href="{{ route('password.request') }}" class="font-medium text-primary-600 hover:text-primary-500">
{{ __('Forgot Your Password?') }}
</a>
</div>
@endif
</div>
<div>
<button type="submit"
class="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-primary-600 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">
{{ __('Login') }}
</button>
</div>
@if (Route::has('register'))
<div class="text-sm text-center">
<span class="text-gray-600">{{ __("Don't have an account?") }}</span>
<a href="{{ route('register') }}" class="font-medium text-primary-600 hover:text-primary-500">
{{ __('Register') }}
</a>
</div>
@endif
</form>
</div>
</div>
</div>
@@ -1,48 +1,48 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">{{ __('Confirm Password') }}</div>
<div class="min-h-screen flex items-center justify-center py-12 px-4 sm:px-6 lg:px-8">
<div class="max-w-md w-full space-y-8">
<div>
<h2 class="mt-6 text-center text-3xl font-extrabold text-gray-900">
{{ __('Confirm Password') }}
</h2>
<p class="mt-2 text-center text-sm text-gray-600">
{{ __('Please confirm your password before continuing.') }}
</p>
</div>
<div class="bg-white py-8 px-4 shadow sm:rounded-lg sm:px-10">
<form method="POST" action="{{ route('password.confirm') }}" class="space-y-6">
@csrf
<div class="card-body">
{{ __('Please confirm your password before continuing.') }}
<form method="POST" action="{{ route('password.confirm') }}">
@csrf
<div class="row mb-3">
<label for="password" class="col-md-4 col-form-label text-md-end">{{ __('Password') }}</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="current-password">
@error('password')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="row mb-0">
<div class="col-md-8 offset-md-4">
<button type="submit" class="btn btn-primary">
{{ __('Confirm Password') }}
</button>
@if (Route::has('password.request'))
<a class="btn btn-link" href="{{ route('password.request') }}">
{{ __('Forgot Your Password?') }}
</a>
@endif
</div>
</div>
</form>
<div>
<label for="password" class="block text-sm font-medium text-gray-700">
{{ __('Password') }}
</label>
<div class="mt-1">
<input id="password" type="password" name="password" required autocomplete="current-password"
class="appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm @error('password') border-red-300 text-red-900 placeholder-red-300 focus:ring-red-500 focus:border-red-500 @enderror">
@error('password')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
</div>
</div>
<div>
<button type="submit"
class="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-primary-600 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">
{{ __('Confirm Password') }}
</button>
</div>
@if (Route::has('password.request'))
<div class="text-sm text-center">
<a href="{{ route('password.request') }}" class="font-medium text-primary-600 hover:text-primary-500">
{{ __('Forgot Your Password?') }}
</a>
</div>
@endif
</form>
</div>
</div>
</div>
+56 -37
View File
@@ -1,46 +1,65 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">{{ __('Reset Password') }}</div>
<div class="card-body">
@if (session('status'))
<div class="alert alert-success" role="alert">
{{ session('status') }}
<div class="min-h-screen flex items-center justify-center py-12 px-4 sm:px-6 lg:px-8">
<div class="max-w-md w-full space-y-8">
<div>
<h2 class="mt-6 text-center text-3xl font-extrabold text-gray-900">
{{ __('Reset Password') }}
</h2>
<p class="mt-2 text-center text-sm text-gray-600">
{{ __('Enter your email address and we will send you a password reset link.') }}
</p>
</div>
<div class="bg-white py-8 px-4 shadow sm:rounded-lg sm:px-10">
@if (session('status'))
<div class="mb-4 rounded-md bg-green-50 p-4">
<div class="flex">
<div class="flex-shrink-0">
<svg class="h-5 w-5 text-green-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" />
</svg>
</div>
@endif
<form method="POST" action="{{ route('password.email') }}">
@csrf
<div class="row mb-3">
<label for="email" class="col-md-4 col-form-label text-md-end">{{ __('Email Address') }}</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email" autofocus>
@error('email')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="ml-3">
<p class="text-sm font-medium text-green-800">
{{ session('status') }}
</p>
</div>
<div class="row mb-0">
<div class="col-md-6 offset-md-4">
<button type="submit" class="btn btn-primary">
{{ __('Send Password Reset Link') }}
</button>
</div>
</div>
</form>
</div>
</div>
</div>
@endif
<form method="POST" action="{{ route('password.email') }}" class="space-y-6">
@csrf
<div>
<label for="email" class="block text-sm font-medium text-gray-700">
{{ __('Email Address') }}
</label>
<div class="mt-1">
<input id="email" type="email" name="email" value="{{ old('email') }}" required autocomplete="email" autofocus
class="appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm @error('email') border-red-300 text-red-900 placeholder-red-300 focus:ring-red-500 focus:border-red-500 @enderror">
@error('email')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
</div>
<div>
<button type="submit"
class="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-primary-600 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">
{{ __('Send Password Reset Link') }}
</button>
</div>
@if (Route::has('login'))
<div class="text-sm text-center">
<a href="{{ route('login') }}" class="font-medium text-primary-600 hover:text-primary-500">
{{ __('Back to Login') }}
</a>
</div>
@endif
</form>
</div>
</div>
</div>
+53 -55
View File
@@ -1,64 +1,62 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">{{ __('Reset Password') }}</div>
<div class="min-h-screen flex items-center justify-center py-12 px-4 sm:px-6 lg:px-8">
<div class="max-w-md w-full space-y-8">
<div>
<h2 class="mt-6 text-center text-3xl font-extrabold text-gray-900">
{{ __('Reset Password') }}
</h2>
</div>
<div class="bg-white py-8 px-4 shadow sm:rounded-lg sm:px-10">
<form method="POST" action="{{ route('password.update') }}" class="space-y-6">
@csrf
<div class="card-body">
<form method="POST" action="{{ route('password.update') }}">
@csrf
<input type="hidden" name="token" value="{{ $token }}">
<input type="hidden" name="token" value="{{ $token }}">
<div class="row mb-3">
<label for="email" class="col-md-4 col-form-label text-md-end">{{ __('Email Address') }}</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ $email ?? old('email') }}" required autocomplete="email" autofocus>
@error('email')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="row mb-3">
<label for="password" class="col-md-4 col-form-label text-md-end">{{ __('Password') }}</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="new-password">
@error('password')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="row mb-3">
<label for="password-confirm" class="col-md-4 col-form-label text-md-end">{{ __('Confirm Password') }}</label>
<div class="col-md-6">
<input id="password-confirm" type="password" class="form-control" name="password_confirmation" required autocomplete="new-password">
</div>
</div>
<div class="row mb-0">
<div class="col-md-6 offset-md-4">
<button type="submit" class="btn btn-primary">
{{ __('Reset Password') }}
</button>
</div>
</div>
</form>
<div>
<label for="email" class="block text-sm font-medium text-gray-700">
{{ __('Email Address') }}
</label>
<div class="mt-1">
<input id="email" type="email" name="email" value="{{ $email ?? old('email') }}" required autocomplete="email" autofocus
class="appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm @error('email') border-red-300 text-red-900 placeholder-red-300 focus:ring-red-500 focus:border-red-500 @enderror">
@error('email')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
</div>
</div>
<div>
<label for="password" class="block text-sm font-medium text-gray-700">
{{ __('Password') }}
</label>
<div class="mt-1">
<input id="password" type="password" name="password" required autocomplete="new-password"
class="appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm @error('password') border-red-300 text-red-900 placeholder-red-300 focus:ring-red-500 focus:border-red-500 @enderror">
@error('password')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
</div>
<div>
<label for="password-confirm" class="block text-sm font-medium text-gray-700">
{{ __('Confirm Password') }}
</label>
<div class="mt-1">
<input id="password-confirm" type="password" name="password_confirmation" required autocomplete="new-password"
class="appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm">
</div>
</div>
<div>
<button type="submit"
class="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-primary-600 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">
{{ __('Reset Password') }}
</button>
</div>
</form>
</div>
</div>
</div>
+74 -68
View File
@@ -1,76 +1,82 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">{{ __('Register') }}</div>
<div class="min-h-screen flex items-center justify-center py-12 px-4 sm:px-6 lg:px-8">
<div class="max-w-md w-full space-y-8">
<div>
<h2 class="mt-6 text-center text-3xl font-extrabold text-gray-900">
{{ __('Register') }}
</h2>
</div>
<div class="bg-white py-8 px-4 shadow sm:rounded-lg sm:px-10">
<form method="POST" action="{{ route('register') }}" class="space-y-6">
@csrf
<div class="card-body">
<form method="POST" action="{{ route('register') }}">
@csrf
<div class="row mb-3">
<label for="name" class="col-md-4 col-form-label text-md-end">{{ __('Name') }}</label>
<div class="col-md-6">
<input id="name" type="text" class="form-control @error('name') is-invalid @enderror" name="name" value="{{ old('name') }}" required autocomplete="name" autofocus>
@error('name')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="row mb-3">
<label for="email" class="col-md-4 col-form-label text-md-end">{{ __('Email Address') }}</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email">
@error('email')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="row mb-3">
<label for="password" class="col-md-4 col-form-label text-md-end">{{ __('Password') }}</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="new-password">
@error('password')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="row mb-3">
<label for="password-confirm" class="col-md-4 col-form-label text-md-end">{{ __('Confirm Password') }}</label>
<div class="col-md-6">
<input id="password-confirm" type="password" class="form-control" name="password_confirmation" required autocomplete="new-password">
</div>
</div>
<div class="row mb-0">
<div class="col-md-6 offset-md-4">
<button type="submit" class="btn btn-primary">
{{ __('Register') }}
</button>
</div>
</div>
</form>
<div>
<label for="name" class="block text-sm font-medium text-gray-700">
{{ __('Name') }}
</label>
<div class="mt-1">
<input id="name" type="text" name="name" value="{{ old('name') }}" required autocomplete="name" autofocus
class="appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm @error('name') border-red-300 text-red-900 placeholder-red-300 focus:ring-red-500 focus:border-red-500 @enderror">
@error('name')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
</div>
</div>
<div>
<label for="email" class="block text-sm font-medium text-gray-700">
{{ __('Email Address') }}
</label>
<div class="mt-1">
<input id="email" type="email" name="email" value="{{ old('email') }}" required autocomplete="email"
class="appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm @error('email') border-red-300 text-red-900 placeholder-red-300 focus:ring-red-500 focus:border-red-500 @enderror">
@error('email')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
</div>
<div>
<label for="password" class="block text-sm font-medium text-gray-700">
{{ __('Password') }}
</label>
<div class="mt-1">
<input id="password" type="password" name="password" required autocomplete="new-password"
class="appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm @error('password') border-red-300 text-red-900 placeholder-red-300 focus:ring-red-500 focus:border-red-500 @enderror">
@error('password')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
</div>
<div>
<label for="password-confirm" class="block text-sm font-medium text-gray-700">
{{ __('Confirm Password') }}
</label>
<div class="mt-1">
<input id="password-confirm" type="password" name="password_confirmation" required autocomplete="new-password"
class="appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm">
</div>
</div>
<div>
<button type="submit"
class="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-primary-600 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">
{{ __('Register') }}
</button>
</div>
@if (Route::has('login'))
<div class="text-sm text-center">
<span class="text-gray-600">{{ __("Already have an account?") }}</span>
<a href="{{ route('login') }}" class="font-medium text-primary-600 hover:text-primary-500">
{{ __('Login') }}
</a>
</div>
@endif
</form>
</div>
</div>
</div>
+34 -18
View File
@@ -1,27 +1,43 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">{{ __('Verify Your Email Address') }}</div>
<div class="card-body">
@if (session('resent'))
<div class="alert alert-success" role="alert">
{{ __('A fresh verification link has been sent to your email address.') }}
<div class="min-h-screen flex items-center justify-center py-12 px-4 sm:px-6 lg:px-8">
<div class="max-w-md w-full space-y-8">
<div>
<h2 class="mt-6 text-center text-3xl font-extrabold text-gray-900">
{{ __('Verify Your Email Address') }}
</h2>
</div>
<div class="bg-white py-8 px-4 shadow sm:rounded-lg sm:px-10">
@if (session('resent'))
<div class="mb-4 rounded-md bg-green-50 p-4">
<div class="flex">
<div class="flex-shrink-0">
<svg class="h-5 w-5 text-green-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" />
</svg>
</div>
@endif
{{ __('Before proceeding, please check your email for a verification link.') }}
{{ __('If you did not receive the email') }},
<form class="d-inline" method="POST" action="{{ route('verification.resend') }}">
@csrf
<button type="submit" class="btn btn-link p-0 m-0 align-baseline">{{ __('click here to request another') }}</button>.
</form>
<div class="ml-3">
<p class="text-sm font-medium text-green-800">
{{ __('A fresh verification link has been sent to your email address.') }}
</p>
</div>
</div>
</div>
@endif
<div class="text-sm text-gray-600 mb-6">
<p>{{ __('Before proceeding, please check your email for a verification link.') }}</p>
<p class="mt-2">{{ __('If you did not receive the email') }}</p>
</div>
<form method="POST" action="{{ route('verification.resend') }}">
@csrf
<button type="submit"
class="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-primary-600 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">
{{ __('Click here to request another') }}
</button>
</form>
</div>
</div>
</div>
@@ -2,10 +2,10 @@
<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">
<div class="flex flex-1">
<!-- Logo -->
<div class="flex-shrink-0 flex items-center">
<a href="{{ route('products.index') }}" class="flex items-center space-x-2">
<a href="{{ route('homepage') }}" 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>
@@ -16,8 +16,8 @@
<!-- 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
class="inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium {{ request()->routeIs('products.*') ? 'border-primary-500 text-gray-900' : 'border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700' }}">
Products
</a>
@auth
@if(auth()->user()->hasAnyRole(['admin', 'moderator']))
@@ -28,6 +28,24 @@
@endif
@endauth
</div>
<!-- Search Bar (Desktop) -->
<div class="hidden md:flex md:flex-1 md:ml-8 md:mr-8 md:max-w-md">
<form action="{{ route('products.index') }}" method="GET" class="w-full">
<div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<svg class="h-5 w-5 text-gray-400" 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>
</div>
<input type="text"
name="search"
value="{{ request('search') }}"
class="block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-md leading-5 bg-white placeholder-gray-500 focus:outline-none focus:placeholder-gray-400 focus:ring-1 focus:ring-primary-500 focus:border-primary-500 sm:text-sm"
placeholder="Search products...">
</div>
</form>
</div>
</div>
<!-- Right Side -->
@@ -0,0 +1,71 @@
<div class="bg-white rounded-lg border border-gray-200 hover:shadow-lg transition-shadow overflow-hidden group">
<a href="{{ route('products.show', $product) }}" class="block">
<!-- Thumbnail -->
<div class="relative aspect-video bg-gray-100 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-300">
@else
<div class="w-full h-full flex items-center justify-center bg-gradient-to-br from-primary-100 to-primary-200">
<svg class="h-16 w-16 text-primary-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4"></path>
</svg>
</div>
@endif
<!-- Category Badge -->
<div class="absolute top-2 left-2">
<span class="inline-flex items-center px-2.5 py-0.5 rounded-md text-xs font-medium bg-white/90 backdrop-blur-sm text-gray-800">
{{ $product->category->name }}
</span>
</div>
</div>
<!-- Content -->
<div class="p-4">
<h3 class="text-lg font-semibold text-gray-900 line-clamp-1 group-hover:text-primary-600">
{{ $product->title }}
</h3>
<p class="mt-2 text-sm text-gray-600 line-clamp-2">
{{ $product->description }}
</p>
<!-- Meta Info -->
<div class="mt-4 flex items-center justify-between">
<div class="flex items-center space-x-3">
<!-- Upvote Button -->
<form action="{{ route('products.upvote', $product) }}" method="POST" class="inline-block" @auth @else onclick="event.preventDefault(); alert('Please login to upvote');" @endauth>
@csrf
<button type="submit"
@guest disabled @endguest
class="group/upvote flex items-center space-x-1 px-3 py-1.5 rounded-md border {{ $product->isUpvotedBy(auth()->user()) ? 'border-primary-500 bg-primary-50 text-primary-700' : 'border-gray-300 bg-white text-gray-700 hover:border-primary-500 hover:bg-primary-50' }} transition-colors">
<svg class="h-4 w-4" fill="{{ $product->isUpvotedBy(auth()->user()) ? 'currentColor' : '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="text-sm font-medium">{{ $product->upvotes_count }}</span>
</button>
</form>
<!-- Comments Count -->
<div class="flex items-center space-x-1 text-gray-500">
<svg class="h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"></path>
</svg>
<span class="text-sm">{{ $product->comments_count }}</span>
</div>
</div>
<!-- User Info -->
<div class="flex items-center">
<a href="{{ route('profile.show', $product->user) }}" class="flex items-center space-x-2 hover:opacity-75" onclick="event.stopPropagation();">
<div class="h-6 w-6 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 text-gray-600">{{ $product->user->name }}</span>
</a>
</div>
</div>
</div>
</a>
</div>
@@ -35,9 +35,9 @@ aria-live="assertive">
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">
class="w-full max-w-sm 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 items-start gap-3">
<div class="flex-shrink-0">
<!-- Success Icon -->
<template x-if="notice.type === 'success'">
@@ -64,11 +64,11 @@ aria-live="assertive">
</svg>
</template>
</div>
<div class="ml-3 w-0 flex-1 pt-0.5">
<div class="flex-1 min-w-0">
<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>
<p class="mt-1 text-sm text-gray-500 break-words" x-text="notice.message"></p>
</div>
<div class="ml-4 flex-shrink-0 flex">
<div class="flex-shrink-0">
<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>
+1
View File
@@ -86,6 +86,7 @@
</p>
</div>
</div>
</footer>
</div>
+148 -123
View File
@@ -1,130 +1,155 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-10">
<div class="card">
<div class="card-header">
<h3 class="mb-0">Submit a Product</h3>
<div class="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
<div class="mb-8">
<h1 class="text-3xl font-bold text-gray-900">Submit a Product</h1>
<p class="mt-2 text-sm text-gray-600">Share your EU-based tech product with the community</p>
</div>
<div class="bg-white shadow-sm rounded-lg">
<div class="px-4 py-5 sm:p-6">
<form method="POST" action="{{ route('products.store') }}" enctype="multipart/form-data" class="space-y-6">
@csrf
<!-- Title -->
<div>
<label for="title" class="block text-sm font-medium text-gray-700">
Product Title <span class="text-red-600">*</span>
</label>
<div class="mt-1">
<input type="text"
id="title"
name="title"
value="{{ old('title') }}"
required
maxlength="255"
placeholder="e.g., My Awesome Product"
class="appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm @error('title') border-red-300 text-red-900 placeholder-red-300 focus:ring-red-500 focus:border-red-500 @enderror">
@error('title')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
<p class="mt-2 text-sm text-gray-500">A catchy, descriptive title for your product.</p>
</div>
</div>
<div class="card-body">
<form method="POST" action="{{ route('products.store') }}" enctype="multipart/form-data">
@csrf
<!-- Title -->
<div class="mb-3">
<label for="title" class="form-label">Product Title <span class="text-danger">*</span></label>
<input type="text"
class="form-control @error('title') is-invalid @enderror"
id="title"
name="title"
value="{{ old('title') }}"
required
maxlength="255"
placeholder="e.g., My Awesome Product">
@error('title')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
<small class="form-text text-muted">A catchy, descriptive title for your product.</small>
</div>
<!-- Description -->
<div class="mb-3">
<label for="description" class="form-label">Description <span class="text-danger">*</span></label>
<textarea class="form-control @error('description') is-invalid @enderror"
id="description"
name="description"
rows="5"
required
placeholder="Tell us about your product...">{{ old('description') }}</textarea>
@error('description')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
<small class="form-text text-muted">Provide a detailed description of your product (what it does, key features, etc.).</small>
</div>
<!-- Website URL -->
<div class="mb-3">
<label for="website_url" class="form-label">Website URL <span class="text-danger">*</span></label>
<input type="url"
class="form-control @error('website_url') is-invalid @enderror"
id="website_url"
name="website_url"
value="{{ old('website_url') }}"
required
placeholder="https://example.com">
@error('website_url')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
<small class="form-text text-muted">The full URL to your product's website or landing page.</small>
</div>
<!-- Category -->
<div class="mb-3">
<label for="category_id" class="form-label">Category <span class="text-danger">*</span></label>
<select class="form-select @error('category_id') is-invalid @enderror"
id="category_id"
name="category_id"
required>
<option value="">Select a category...</option>
@foreach($categories as $category)
<option value="{{ $category->id }}" {{ old('category_id') == $category->id ? 'selected' : '' }}>
{{ $category->name }}
</option>
@endforeach
</select>
@error('category_id')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
<small class="form-text text-muted">Choose the category that best fits your product.</small>
</div>
<!-- Thumbnail -->
<div class="mb-3">
<label for="thumbnail" class="form-label">Product Thumbnail</label>
<input type="file"
class="form-control @error('thumbnail') is-invalid @enderror"
id="thumbnail"
name="thumbnail"
accept="image/*">
@error('thumbnail')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
<small class="form-text text-muted">Upload a product screenshot or logo (JPEG, PNG, or GIF, max 2MB).</small>
</div>
<!-- Image Preview -->
<div class="mb-3" id="imagePreview" style="display: none;">
<label class="form-label">Preview:</label>
<div>
<img id="preview" src="#" alt="Thumbnail preview" style="max-width: 300px; max-height: 300px;" class="img-thumbnail">
</div>
</div>
<!-- Submit Button -->
<div class="d-flex justify-content-between">
<a href="{{ route('products.index') }}" class="btn btn-secondary">Cancel</a>
<button type="submit" class="btn btn-primary">Submit Product</button>
</div>
<div class="alert alert-info mt-3" role="alert">
<strong>Note:</strong> Your product will be reviewed by our moderators before it appears on the site.
</div>
</form>
<!-- Description -->
<div>
<label for="description" class="block text-sm font-medium text-gray-700">
Description <span class="text-red-600">*</span>
</label>
<div class="mt-1">
<textarea id="description"
name="description"
rows="5"
required
placeholder="Tell us about your product..."
class="appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm @error('description') border-red-300 text-red-900 placeholder-red-300 focus:ring-red-500 focus:border-red-500 @enderror">{{ old('description') }}</textarea>
@error('description')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
<p class="mt-2 text-sm text-gray-500">Provide a detailed description of your product (what it does, key features, etc.).</p>
</div>
</div>
</div>
<!-- Website URL -->
<div>
<label for="website_url" class="block text-sm font-medium text-gray-700">
Website URL <span class="text-red-600">*</span>
</label>
<div class="mt-1">
<input type="url"
id="website_url"
name="website_url"
value="{{ old('website_url') }}"
required
placeholder="https://example.com"
class="appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm @error('website_url') border-red-300 text-red-900 placeholder-red-300 focus:ring-red-500 focus:border-red-500 @enderror">
@error('website_url')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
<p class="mt-2 text-sm text-gray-500">The full URL to your product's website or landing page.</p>
</div>
</div>
<!-- Category -->
<div>
<label for="category_id" class="block text-sm font-medium text-gray-700">
Category <span class="text-red-600">*</span>
</label>
<div class="mt-1">
<select id="category_id"
name="category_id"
required
class="appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm @error('category_id') border-red-300 text-red-900 focus:ring-red-500 focus:border-red-500 @enderror">
<option value="">Select a category...</option>
@foreach($categories as $category)
<option value="{{ $category->id }}" {{ old('category_id') == $category->id ? 'selected' : '' }}>
{{ $category->name }}
</option>
@endforeach
</select>
@error('category_id')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
<p class="mt-2 text-sm text-gray-500">Choose the category that best fits your product.</p>
</div>
</div>
<!-- Thumbnail -->
<div>
<label for="thumbnail" class="block text-sm font-medium text-gray-700">
Product Thumbnail
</label>
<div class="mt-1">
<input type="file"
id="thumbnail"
name="thumbnail"
accept="image/*"
class="block w-full text-sm text-gray-500 file:mr-4 file:py-2 file:px-4 file:rounded-md file:border-0 file:text-sm file:font-semibold file:bg-primary-50 file:text-primary-700 hover:file:bg-primary-100 @error('thumbnail') border-red-300 @enderror">
@error('thumbnail')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
<p class="mt-2 text-sm text-gray-500">Upload a product screenshot or logo (JPEG, PNG, or GIF, max 2MB).</p>
</div>
</div>
<!-- Image Preview -->
<div id="imagePreview" class="hidden">
<label class="block text-sm font-medium text-gray-700 mb-2">Preview:</label>
<div class="mt-1">
<img id="preview" src="#" alt="Thumbnail preview" class="max-w-xs rounded-lg border border-gray-300 shadow-sm">
</div>
</div>
<!-- Info Alert -->
<div class="rounded-md bg-blue-50 p-4">
<div class="flex">
<div class="flex-shrink-0">
<svg class="h-5 w-5 text-blue-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd" />
</svg>
</div>
<div class="ml-3 flex-1">
<p class="text-sm text-blue-700">
<strong>Note:</strong> Your product will be reviewed by our moderators before it appears on the site.
</p>
</div>
</div>
</div>
<!-- Submit Buttons -->
<div class="flex items-center justify-between pt-5 border-t border-gray-200">
<a href="{{ route('products.index') }}"
class="inline-flex items-center px-4 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">
Cancel
</a>
<button type="submit"
class="inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-primary-600 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">
Submit Product
</button>
</div>
</form>
</div>
</div>
</div>
@@ -137,11 +162,11 @@
const reader = new FileReader();
reader.onload = function(e) {
document.getElementById('preview').src = e.target.result;
document.getElementById('imagePreview').style.display = 'block';
document.getElementById('imagePreview').classList.remove('hidden');
}
reader.readAsDataURL(file);
} else {
document.getElementById('imagePreview').style.display = 'none';
document.getElementById('imagePreview').classList.add('hidden');
}
});
</script>
+164 -126
View File
@@ -1,133 +1,171 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-10">
<div class="card">
<div class="card-header">
<h3 class="mb-0">Edit Product</h3>
<div class="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
<div class="mb-8">
<h1 class="text-3xl font-bold text-gray-900">Edit Product</h1>
<p class="mt-2 text-sm text-gray-600">Update your product information and details</p>
</div>
<div class="bg-white shadow-sm rounded-lg">
<div class="px-4 py-5 sm:p-6">
<form method="POST" action="{{ route('products.update', $product) }}" enctype="multipart/form-data" class="space-y-6">
@csrf
@method('PUT')
<!-- Title -->
<div>
<label for="title" class="block text-sm font-medium text-gray-700">
Product Title <span class="text-red-600">*</span>
</label>
<div class="mt-1">
<input type="text"
id="title"
name="title"
value="{{ old('title', $product->title) }}"
required
maxlength="255"
placeholder="e.g., My Awesome Product"
class="appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm @error('title') border-red-300 text-red-900 placeholder-red-300 focus:ring-red-500 focus:border-red-500 @enderror">
@error('title')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
<p class="mt-2 text-sm text-gray-500">A catchy, descriptive title for your product.</p>
</div>
</div>
<div class="card-body">
<form method="POST" action="{{ route('products.update', $product) }}" enctype="multipart/form-data">
@csrf
@method('PUT')
<!-- Title -->
<div class="mb-3">
<label for="title" class="form-label">Product Title <span class="text-danger">*</span></label>
<input type="text"
class="form-control @error('title') is-invalid @enderror"
id="title"
name="title"
value="{{ old('title', $product->title) }}"
required
maxlength="255">
@error('title')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<!-- Description -->
<div class="mb-3">
<label for="description" class="form-label">Description <span class="text-danger">*</span></label>
<textarea class="form-control @error('description') is-invalid @enderror"
id="description"
name="description"
rows="5"
required>{{ old('description', $product->description) }}</textarea>
@error('description')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<!-- Website URL -->
<div class="mb-3">
<label for="website_url" class="form-label">Website URL <span class="text-danger">*</span></label>
<input type="url"
class="form-control @error('website_url') is-invalid @enderror"
id="website_url"
name="website_url"
value="{{ old('website_url', $product->website_url) }}"
required>
@error('website_url')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<!-- Category -->
<div class="mb-3">
<label for="category_id" class="form-label">Category <span class="text-danger">*</span></label>
<select class="form-select @error('category_id') is-invalid @enderror"
id="category_id"
name="category_id"
required>
<option value="">Select a category...</option>
@foreach($categories as $category)
<option value="{{ $category->id }}"
{{ old('category_id', $product->category_id) == $category->id ? 'selected' : '' }}>
{{ $category->name }}
</option>
@endforeach
</select>
@error('category_id')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<!-- Current Thumbnail -->
@if($product->thumbnail_url)
<div class="mb-3">
<label class="form-label">Current Thumbnail:</label>
<div>
<img src="{{ $product->thumbnail_url }}" alt="{{ $product->title }}" style="max-width: 300px; max-height: 300px;" class="img-thumbnail">
</div>
</div>
@endif
<!-- New Thumbnail -->
<div class="mb-3">
<label for="thumbnail" class="form-label">
{{ $product->thumbnail_url ? 'Replace Thumbnail' : 'Product Thumbnail' }}
</label>
<input type="file"
class="form-control @error('thumbnail') is-invalid @enderror"
id="thumbnail"
name="thumbnail"
accept="image/*">
@error('thumbnail')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
<small class="form-text text-muted">JPEG, PNG, or GIF, max 2MB.</small>
</div>
<!-- Image Preview -->
<div class="mb-3" id="imagePreview" style="display: none;">
<label class="form-label">New Preview:</label>
<div>
<img id="preview" src="#" alt="Thumbnail preview" style="max-width: 300px; max-height: 300px;" class="img-thumbnail">
</div>
</div>
<!-- Submit Button -->
<div class="d-flex justify-content-between">
<a href="{{ route('products.show', $product) }}" class="btn btn-secondary">Cancel</a>
<button type="submit" class="btn btn-primary">Update Product</button>
</div>
</form>
<!-- Description -->
<div>
<label for="description" class="block text-sm font-medium text-gray-700">
Description <span class="text-red-600">*</span>
</label>
<div class="mt-1">
<textarea id="description"
name="description"
rows="5"
required
placeholder="Tell us about your product..."
class="appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm @error('description') border-red-300 text-red-900 placeholder-red-300 focus:ring-red-500 focus:border-red-500 @enderror">{{ old('description', $product->description) }}</textarea>
@error('description')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
<p class="mt-2 text-sm text-gray-500">Provide a detailed description of your product (what it does, key features, etc.).</p>
</div>
</div>
</div>
<!-- Website URL -->
<div>
<label for="website_url" class="block text-sm font-medium text-gray-700">
Website URL <span class="text-red-600">*</span>
</label>
<div class="mt-1">
<input type="url"
id="website_url"
name="website_url"
value="{{ old('website_url', $product->website_url) }}"
required
placeholder="https://example.com"
class="appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm @error('website_url') border-red-300 text-red-900 placeholder-red-300 focus:ring-red-500 focus:border-red-500 @enderror">
@error('website_url')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
<p class="mt-2 text-sm text-gray-500">The full URL to your product's website or landing page.</p>
</div>
</div>
<!-- Category -->
<div>
<label for="category_id" class="block text-sm font-medium text-gray-700">
Category <span class="text-red-600">*</span>
</label>
<div class="mt-1">
<select id="category_id"
name="category_id"
required
class="appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm @error('category_id') border-red-300 text-red-900 focus:ring-red-500 focus:border-red-500 @enderror">
<option value="">Select a category...</option>
@foreach($categories as $category)
<option value="{{ $category->id }}" {{ old('category_id', $product->category_id) == $category->id ? 'selected' : '' }}>
{{ $category->name }}
</option>
@endforeach
</select>
@error('category_id')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
<p class="mt-2 text-sm text-gray-500">Choose the category that best fits your product.</p>
</div>
</div>
<!-- Current Thumbnail -->
@if($product->thumbnail_url)
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Current Thumbnail:</label>
<div class="mt-1">
<img src="{{ $product->thumbnail_url }}"
alt="{{ $product->title }}"
class="max-w-xs rounded-lg border border-gray-300 shadow-sm">
</div>
</div>
@endif
<!-- New Thumbnail -->
<div>
<label for="thumbnail" class="block text-sm font-medium text-gray-700">
{{ $product->thumbnail_url ? 'Replace Thumbnail' : 'Product Thumbnail' }}
</label>
<div class="mt-1">
<input type="file"
id="thumbnail"
name="thumbnail"
accept="image/*"
class="block w-full text-sm text-gray-500 file:mr-4 file:py-2 file:px-4 file:rounded-md file:border-0 file:text-sm file:font-semibold file:bg-primary-50 file:text-primary-700 hover:file:bg-primary-100 @error('thumbnail') border-red-300 @enderror">
@error('thumbnail')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
<p class="mt-2 text-sm text-gray-500">Upload a product screenshot or logo (JPEG, PNG, or GIF, max 2MB).</p>
</div>
</div>
<!-- Image Preview -->
<div id="imagePreview" class="hidden">
<label class="block text-sm font-medium text-gray-700 mb-2">New Preview:</label>
<div class="mt-1">
<img id="preview" src="#" alt="Thumbnail preview" class="max-w-xs rounded-lg border border-gray-300 shadow-sm">
</div>
</div>
<!-- Info Alert -->
<div class="rounded-md bg-blue-50 p-4">
<div class="flex">
<div class="flex-shrink-0">
<svg class="h-5 w-5 text-blue-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd" />
</svg>
</div>
<div class="ml-3 flex-1">
<p class="text-sm text-blue-700">
<strong>Note:</strong> Changes to your product may need to be reviewed by moderators before appearing on the site.
</p>
</div>
</div>
</div>
<!-- Submit Buttons -->
<div class="flex items-center justify-between pt-5 border-t border-gray-200">
<a href="{{ route('products.show', $product) }}"
class="inline-flex items-center px-4 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">
Cancel
</a>
<button type="submit"
class="inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-primary-600 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">
<svg class="mr-2 h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
</svg>
Update Product
</button>
</div>
</form>
</div>
</div>
</div>
@@ -140,11 +178,11 @@
const reader = new FileReader();
reader.onload = function(e) {
document.getElementById('preview').src = e.target.result;
document.getElementById('imagePreview').style.display = 'block';
document.getElementById('imagePreview').classList.remove('hidden');
}
reader.readAsDataURL(file);
} else {
document.getElementById('imagePreview').style.display = 'none';
document.getElementById('imagePreview').classList.add('hidden');
}
});
</script>
+45 -24
View File
@@ -42,15 +42,20 @@
<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">
<div class="bg-white rounded-xl shadow-sm border border-gray-200 p-6">
<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">
<div class="lg:hidden mb-4">
<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">
class="w-full inline-flex items-center justify-between px-4 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">
<span class="flex items-center">
<svg class="mr-2 h-5 w-5 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6V4m0 2a2 2 0 100 4m0-4a2 2 0 110 4m-6 8a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4m6 6v10m6-2a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4"></path>
</svg>
Filters & Sort
</span>
<svg class="h-5 w-5 transition-transform" :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>
@@ -58,20 +63,24 @@
<!-- Filters Grid -->
<div :class="{ 'hidden': !showFilters }"
class="lg:block grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-5 gap-4">
class="lg:flex lg:items-end lg:gap-4 grid grid-cols-1 sm:grid-cols-2 gap-4 lg:gap-4">
<!-- Search (hidden on desktop as it's in hero) -->
<div class="lg:hidden">
<div class="lg:hidden sm:col-span-2">
<label for="mobile-search" class="block text-sm font-medium text-gray-700 mb-2">Search</label>
<input type="text"
id="mobile-search"
name="search"
value="{{ request('search') }}"
placeholder="Search..."
class="input">
placeholder="Search products..."
class="appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm">
</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">
<div class="lg:flex-1">
<label for="category" class="block text-sm font-medium text-gray-700 mb-2">Category</label>
<select name="category"
id="category"
class="appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm">
<option value="">All Categories</option>
@foreach($categories as $category)
<option value="{{ $category->id }}" {{ request('category') == $category->id ? 'selected' : '' }}>
@@ -82,9 +91,11 @@
</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">
<div class="lg:flex-1">
<label for="date_range" class="block text-sm font-medium text-gray-700 mb-2">Time Period</label>
<select name="date_range"
id="date_range"
class="appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm">
<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>
@@ -94,9 +105,11 @@
</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">
<div class="lg:flex-1">
<label for="sort" class="block text-sm font-medium text-gray-700 mb-2">Sort By</label>
<select name="sort"
id="sort"
class="appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm">
<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>
@@ -104,11 +117,19 @@
</div>
<!-- Action Buttons -->
<div class="flex items-end space-x-2">
<button type="submit" class="btn-primary flex-1 lg:flex-none">
<div class="flex gap-2 sm:col-span-2 lg:col-span-auto lg:flex-shrink-0">
<button type="submit"
class="flex-1 lg:flex-none inline-flex items-center justify-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-primary-600 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">
<svg class="mr-2 h-4 w-4" 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>
Apply
</button>
<a href="{{ route('products.index') }}" class="btn-outline flex-1 lg:flex-none">
<a href="{{ route('products.index') }}"
class="flex-1 lg:flex-none inline-flex items-center justify-center px-4 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">
<svg class="mr-2 h-4 w-4" 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>
Clear
</a>
</div>
@@ -179,11 +200,11 @@
@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">
<a href="{{ route('products.create') }}" class="inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-primary-600 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">
<svg class="mr-2 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>
Submit a Product
</a>
@endauth
</div>
+199 -157
View File
@@ -1,168 +1,210 @@
@extends('layouts.app')
@section('content')
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<h1 class="mb-4">Product Management</h1>
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
<!-- Header -->
<div class="mb-8">
<h1 class="text-3xl font-bold text-gray-900">Product Management</h1>
<p class="mt-2 text-sm text-gray-600">Review and manage submitted products</p>
</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
<!-- Status Filter -->
<div class="bg-white rounded-lg shadow-sm border border-gray-200 mb-6">
<div class="px-6 py-4">
<h2 class="text-lg font-medium text-gray-900 mb-4">Filter by Status</h2>
<div class="flex flex-wrap gap-3">
<a href="{{ route('products.manage') }}"
class="inline-flex items-center px-4 py-2 rounded-md text-sm font-medium {{ !request('status') || request('status') == 'pending' ? 'bg-yellow-100 text-yellow-800 ring-2 ring-yellow-600' : 'bg-white text-gray-700 ring-1 ring-gray-300 hover:bg-gray-50' }}">
<svg class="mr-2 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 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
Pending
<span class="ml-2 inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium {{ !request('status') || request('status') == 'pending' ? 'bg-yellow-200 text-yellow-800' : 'bg-gray-200 text-gray-700' }}">
{{ $statusCounts['pending'] }}
</span>
</a>
<!-- Status Filter -->
<div class="card mb-4">
<div class="card-body">
<div class="row">
<div class="col-md-12">
<h5 class="mb-3">Filter by Status</h5>
<a href="{{ route('products.manage') }}"
class="btn btn-sm {{ !request('status') || request('status') == 'pending' ? 'btn-warning' : 'btn-outline-warning' }}">
Pending ({{ $statusCounts['pending'] }})
</a>
<a href="{{ route('products.manage', ['status' => 'approved']) }}"
class="btn btn-sm {{ request('status') == 'approved' ? 'btn-success' : 'btn-outline-success' }}">
Approved ({{ $statusCounts['approved'] }})
</a>
<a href="{{ route('products.manage', ['status' => 'rejected']) }}"
class="btn btn-sm {{ request('status') == 'rejected' ? 'btn-danger' : 'btn-outline-danger' }}">
Rejected ({{ $statusCounts['rejected'] }})
</a>
</div>
</div>
</div>
</div>
<a href="{{ route('products.manage', ['status' => 'approved']) }}"
class="inline-flex items-center px-4 py-2 rounded-md text-sm font-medium {{ request('status') == 'approved' ? 'bg-green-100 text-green-800 ring-2 ring-green-600' : 'bg-white text-gray-700 ring-1 ring-gray-300 hover:bg-gray-50' }}">
<svg class="mr-2 h-5 w-5" 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>
Approved
<span class="ml-2 inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium {{ request('status') == 'approved' ? 'bg-green-200 text-green-800' : 'bg-gray-200 text-gray-700' }}">
{{ $statusCounts['approved'] }}
</span>
</a>
<!-- Products Table -->
<div class="card">
<div class="card-body">
@if($products->count() > 0)
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>Thumbnail</th>
<th>Title</th>
<th>Category</th>
<th>Submitted By</th>
<th>Status</th>
<th>Date</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach($products as $product)
<tr>
<td>
@if($product->thumbnail_url)
<img src="{{ $product->thumbnail_url }}"
alt="{{ $product->title }}"
style="width: 60px; height: 60px; object-fit: cover;"
class="rounded">
@else
<div class="bg-light d-flex align-items-center justify-content-center rounded"
style="width: 60px; height: 60px;">
<span class="text-muted small">No img</span>
</div>
@endif
</td>
<td>
<a href="{{ route('products.show', $product) }}" class="fw-bold text-decoration-none">
{{ $product->title }}
</a>
<br>
<small class="text-muted">{{ Str::limit($product->description, 60) }}</small>
</td>
<td>
<span class="badge bg-secondary">{{ $product->category->name }}</span>
</td>
<td>
<a href="{{ route('profile.show', $product->user) }}">
{{ $product->user->name }}
</a>
</td>
<td>
@if($product->isPending())
<span class="badge bg-warning text-dark">Pending</span>
@elseif($product->isApproved())
<span class="badge bg-success">Approved</span>
@elseif($product->isRejected())
<span class="badge bg-danger">Rejected</span>
@endif
</td>
<td>
<small>{{ $product->created_at->format('M j, Y') }}</small>
<br>
<small class="text-muted">{{ $product->created_at->diffForHumans() }}</small>
</td>
<td>
<div class="btn-group btn-group-sm" role="group">
@if($product->isPending() || $product->isRejected())
<form action="{{ route('products.approve', $product) }}" method="POST" class="d-inline">
@csrf
<button type="submit" class="btn btn-success btn-sm" title="Approve">
✓
</button>
</form>
@endif
@if($product->isPending() || $product->isApproved())
<form action="{{ route('products.reject', $product) }}" method="POST" class="d-inline">
@csrf
<button type="submit"
class="btn btn-danger btn-sm"
title="Reject"
onclick="return confirm('Are you sure you want to reject this product?');">
✗
</button>
</form>
@endif
<a href="{{ route('products.show', $product) }}" class="btn btn-info btn-sm" title="View">
👁
</a>
@can('edit-product', $product)
<a href="{{ route('products.edit', $product) }}" class="btn btn-primary btn-sm" title="Edit">
✎
</a>
@endcan
@can('delete-product', $product)
<form action="{{ route('products.destroy', $product) }}" method="POST" class="d-inline">
@csrf
@method('DELETE')
<button type="submit"
class="btn btn-danger btn-sm"
title="Delete"
onclick="return confirm('Are you sure you want to delete this product permanently?');">
🗑
</button>
</form>
@endcan
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<!-- Pagination -->
<div class="d-flex justify-content-center mt-4">
{{ $products->appends(['status' => request('status')])->links() }}
</div>
@else
<div class="alert alert-info">
No products found with status: {{ request('status', 'pending') }}
</div>
@endif
</div>
<a href="{{ route('products.manage', ['status' => 'rejected']) }}"
class="inline-flex items-center px-4 py-2 rounded-md text-sm font-medium {{ request('status') == 'rejected' ? 'bg-red-100 text-red-800 ring-2 ring-red-600' : 'bg-white text-gray-700 ring-1 ring-gray-300 hover:bg-gray-50' }}">
<svg class="mr-2 h-5 w-5" 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>
Rejected
<span class="ml-2 inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium {{ request('status') == 'rejected' ? 'bg-red-200 text-red-800' : 'bg-gray-200 text-gray-700' }}">
{{ $statusCounts['rejected'] }}
</span>
</a>
</div>
</div>
</div>
<!-- Products List -->
@if($products->count() > 0)
<div class="space-y-4">
@foreach($products as $product)
<div class="bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden hover:shadow-md transition-shadow">
<div class="p-6">
<div class="flex items-start gap-4">
<!-- Thumbnail -->
<div class="flex-shrink-0">
@if($product->thumbnail_url)
<img src="{{ $product->thumbnail_url }}"
alt="{{ $product->title }}"
class="w-20 h-20 rounded-lg object-cover border border-gray-200">
@else
<div class="w-20 h-20 rounded-lg bg-gradient-to-br from-gray-100 to-gray-200 flex items-center justify-center border border-gray-200">
<svg class="h-8 w-8 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>
<!-- Content -->
<div class="flex-1 min-w-0">
<div class="flex items-start justify-between">
<div class="flex-1">
<h3 class="text-lg font-semibold text-gray-900">
<a href="{{ route('products.show', $product) }}" class="hover:text-primary-600">
{{ $product->title }}
</a>
</h3>
<p class="mt-1 text-sm text-gray-600 line-clamp-2">{{ $product->description }}</p>
<div class="mt-3 flex flex-wrap items-center gap-4 text-sm">
<span class="inline-flex items-center px-2.5 py-0.5 rounded-md bg-primary-100 text-primary-800 font-medium">
{{ $product->category->name }}
</span>
<span class="inline-flex items-center text-gray-500">
<svg class="mr-1.5 h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"></path>
</svg>
<a href="{{ route('profile.show', $product->user) }}" class="hover:text-primary-600">
{{ $product->user->name }}
</a>
</span>
<span class="inline-flex items-center text-gray-500">
<svg class="mr-1.5 h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<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>
</svg>
{{ $product->created_at->format('M j, Y') }}
</span>
<span class="text-gray-400">•</span>
<span class="text-gray-500">{{ $product->created_at->diffForHumans() }}</span>
</div>
</div>
<!-- Status Badge -->
<div class="ml-4 flex-shrink-0">
@if($product->isPending())
<span class="inline-flex items-center px-3 py-1 rounded-md text-sm font-medium bg-yellow-100 text-yellow-800">
Pending
</span>
@elseif($product->isApproved())
<span class="inline-flex items-center px-3 py-1 rounded-md text-sm font-medium bg-green-100 text-green-800">
Approved
</span>
@elseif($product->isRejected())
<span class="inline-flex items-center px-3 py-1 rounded-md text-sm font-medium bg-red-100 text-red-800">
Rejected
</span>
@endif
</div>
</div>
<!-- Actions -->
<div class="mt-4 flex items-center gap-2">
@if($product->isPending() || $product->isRejected())
<form action="{{ route('products.approve', $product) }}" method="POST">
@csrf
<button type="submit" class="inline-flex items-center px-3 py-1.5 border border-transparent text-sm font-medium rounded-md text-white bg-green-600 hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500">
<svg class="mr-1.5 h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
</svg>
Approve
</button>
</form>
@endif
@if($product->isPending() || $product->isApproved())
<form action="{{ route('products.reject', $product) }}" method="POST" onsubmit="return confirm('Are you sure you want to reject this product?');">
@csrf
<button type="submit" class="inline-flex items-center px-3 py-1.5 border border-transparent text-sm font-medium rounded-md text-white bg-red-600 hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500">
<svg class="mr-1.5 h-4 w-4" 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>
Reject
</button>
</form>
@endif
<a href="{{ route('products.show', $product) }}" class="inline-flex items-center px-3 py-1.5 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">
<svg class="mr-1.5 h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path>
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"></path>
</svg>
View
</a>
@can('edit-product', $product)
<a href="{{ route('products.edit', $product) }}" class="inline-flex items-center px-3 py-1.5 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">
<svg class="mr-1.5 h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"></path>
</svg>
Edit
</a>
@endcan
@can('delete-product', $product)
<form action="{{ route('products.destroy', $product) }}" method="POST" onsubmit="return confirm('Are you sure you want to delete this product permanently?');">
@csrf
@method('DELETE')
<button type="submit" class="inline-flex items-center px-3 py-1.5 border border-red-300 text-sm font-medium rounded-md text-red-700 bg-white hover:bg-red-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500">
<svg class="mr-1.5 h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"></path>
</svg>
Delete
</button>
</form>
@endcan
</div>
</div>
</div>
</div>
</div>
@endforeach
</div>
<!-- Pagination -->
@if($products->hasPages())
<div class="mt-6">
{{ $products->appends(['status' => request('status')])->links() }}
</div>
@endif
@else
<div class="text-center py-12 bg-gray-50 rounded-lg border border-gray-200">
<svg class="mx-auto h-12 w-12 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"></path>
</svg>
<h3 class="mt-2 text-sm font-medium text-gray-900">No products found</h3>
<p class="mt-1 text-sm text-gray-500">
No products with status: <strong>{{ request('status', 'pending') }}</strong>
</p>
</div>
@endif
</div>
@endsection
+293 -202
View File
@@ -1,215 +1,300 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-10">
@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 class="max-w-5xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
<!-- Success Message -->
@if(session('success'))
<div class="mb-6 rounded-md bg-green-50 p-4">
<div class="flex">
<div class="flex-shrink-0">
<svg class="h-5 w-5 text-green-400" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
</svg>
</div>
<div class="ml-3">
<p class="text-sm font-medium text-green-800">{{ session('success') }}</p>
</div>
</div>
</div>
@endif
<div class="bg-white rounded-lg shadow-sm border border-gray-200">
<!-- Product Header -->
<div class="px-6 py-8 border-b border-gray-200">
<div class="flex flex-col md:flex-row md:items-start md:justify-between gap-4">
<div class="flex-1">
<div class="flex items-center gap-3 mb-3">
<h1 class="text-3xl font-bold text-gray-900">{{ $product->title }}</h1>
<!-- Status Badges -->
@if($product->isPending())
<span class="inline-flex items-center px-2.5 py-0.5 rounded-md text-xs font-medium bg-yellow-100 text-yellow-800">
Pending Review
</span>
@elseif($product->isApproved())
<span class="inline-flex items-center px-2.5 py-0.5 rounded-md text-xs font-medium bg-green-100 text-green-800">
Approved
</span>
@elseif($product->isRejected())
<span class="inline-flex items-center px-2.5 py-0.5 rounded-md text-xs font-medium bg-red-100 text-red-800">
Rejected
</span>
@endif
</div>
<div class="flex items-center gap-3 text-sm text-gray-600">
<span class="inline-flex items-center px-2.5 py-0.5 rounded-md bg-primary-100 text-primary-800 font-medium">
{{ $product->category->name }}
</span>
<span>•</span>
<a href="{{ route('profile.show', $product->user) }}" class="hover:text-primary-600">
by {{ $product->user->name }}
</a>
<span>•</span>
<span>{{ $product->created_at->format('M j, Y') }}</span>
</div>
</div>
<!-- Action Buttons -->
<div class="flex items-center gap-2">
@auth
<!-- Upvote Button -->
<button
class="upvote-btn flex items-center gap-2 px-4 py-2 rounded-md border transition-colors {{ $product->isUpvotedBy(auth()->user()) ? 'border-primary-500 bg-primary-50 text-primary-700' : 'border-gray-300 bg-white text-gray-700 hover:border-primary-500 hover:bg-primary-50' }}"
data-product-id="{{ $product->id }}"
data-upvoted="{{ $product->isUpvotedBy(auth()->user()) ? 'true' : 'false' }}">
<svg class="h-5 w-5" fill="{{ $product->isUpvotedBy(auth()->user()) ? 'currentColor' : '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="upvote-count font-semibold">{{ $product->upvotes()->count() }}</span>
</button>
<!-- Bookmark Button -->
<button
class="bookmark-btn p-2 rounded-md border transition-colors {{ $product->isBookmarkedBy(auth()->user()) ? 'border-primary-500 bg-primary-50 text-primary-700' : 'border-gray-300 bg-white text-gray-700 hover:border-gray-400' }}"
data-product-id="{{ $product->id }}"
data-bookmarked="{{ $product->isBookmarkedBy(auth()->user()) ? 'true' : 'false' }}">
<svg class="h-5 w-5" fill="{{ $product->isBookmarkedBy(auth()->user()) ? '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>
@else
<div class="flex items-center gap-2 px-4 py-2 rounded-md border border-gray-300 bg-gray-50 text-gray-700">
<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="M5 15l7-7 7 7"></path>
</svg>
<span class="font-semibold">{{ $product->upvotes()->count() }}</span>
</div>
@endauth
@can('edit-product', $product)
<a href="{{ route('products.edit', $product) }}" class="inline-flex items-center px-3 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50">
Edit
</a>
@endcan
@can('delete-product', $product)
<form action="{{ route('products.destroy', $product) }}" method="POST" onsubmit="return confirm('Are you sure you want to delete this product?');">
@csrf
@method('DELETE')
<button type="submit" class="inline-flex items-center px-3 py-2 border border-red-300 shadow-sm text-sm font-medium rounded-md text-red-700 bg-white hover:bg-red-50">
Delete
</button>
</form>
@endcan
</div>
</div>
</div>
<!-- Product Content -->
<div class="px-6 py-8">
<!-- Product Thumbnail -->
@if($product->thumbnail_url)
<div class="mb-8 rounded-lg overflow-hidden border border-gray-200">
<img src="{{ $product->thumbnail_url }}"
alt="{{ $product->title }}"
class="w-full h-auto max-h-96 object-contain bg-gray-50">
</div>
@endif
<div class="card">
<div class="card-body">
<!-- Product Header -->
<div class="d-flex justify-content-between align-items-start mb-4">
<div class="flex-grow-1">
<h1 class="mb-2">{{ $product->title }}</h1>
<p class="text-muted mb-0">
<span class="badge bg-secondary">{{ $product->category->name }}</span>
@if($product->isPending())
<span class="badge bg-warning text-dark">Pending Review</span>
@elseif($product->isApproved())
<span class="badge bg-success">Approved</span>
@elseif($product->isRejected())
<span class="badge bg-danger">Rejected</span>
@endif
</p>
</div>
<div class="d-flex align-items-center gap-2">
@auth
<!-- Upvote Button -->
<button
class="btn btn-outline-primary upvote-btn {{ $product->isUpvotedBy(auth()->user()) ? 'active' : '' }}"
data-product-id="{{ $product->id }}"
data-upvoted="{{ $product->isUpvotedBy(auth()->user()) ? 'true' : 'false' }}">
<i class="bi bi-arrow-up-circle"></i>
<span class="upvote-count">{{ $product->upvotes()->count() }}</span>
</button>
<!-- Product Description -->
<div class="mb-8">
<h2 class="text-xl font-semibold text-gray-900 mb-4">About</h2>
<p class="text-gray-700 text-lg leading-relaxed whitespace-pre-line">{{ $product->description }}</p>
</div>
<!-- Bookmark Button -->
<button
class="btn btn-outline-secondary bookmark-btn {{ $product->isBookmarkedBy(auth()->user()) ? 'active' : '' }}"
data-product-id="{{ $product->id }}"
data-bookmarked="{{ $product->isBookmarkedBy(auth()->user()) ? 'true' : 'false' }}">
<i class="bi {{ $product->isBookmarkedBy(auth()->user()) ? 'bi-bookmark-fill' : 'bi-bookmark' }}"></i>
</button>
<!-- Visit Website Button -->
<div class="mb-8">
<a href="{{ $product->website_url }}"
target="_blank"
rel="noopener noreferrer"
class="inline-flex items-center px-6 py-3 border border-transparent text-base font-medium rounded-md text-white bg-primary-600 hover:bg-primary-700 shadow-sm">
Visit Website
<svg class="ml-2 h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<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>
</svg>
</a>
</div>
<!-- Product Metadata -->
@if($product->isApproved() && $product->approved_at)
<div class="pt-6 border-t border-gray-200">
<dl class="grid grid-cols-1 gap-x-4 gap-y-4 sm:grid-cols-2">
<div>
<dt class="text-sm font-medium text-gray-500">Submitted by</dt>
<dd class="mt-1 text-sm text-gray-900">
<a href="{{ route('profile.show', $product->user) }}" class="hover:text-primary-600">
{{ $product->user->name }}
</a>
</dd>
</div>
<div>
<dt class="text-sm font-medium text-gray-500">Submitted on</dt>
<dd class="mt-1 text-sm text-gray-900">{{ $product->created_at->format('F j, Y') }}</dd>
</div>
<div>
<dt class="text-sm font-medium text-gray-500">Approved on</dt>
<dd class="mt-1 text-sm text-gray-900">{{ $product->approved_at->format('F j, Y') }}</dd>
</div>
<div>
<dt class="text-sm font-medium text-gray-500">Category</dt>
<dd class="mt-1 text-sm text-gray-900">{{ $product->category->name }}</dd>
</div>
</dl>
</div>
@endif
</div>
</div>
<!-- Comments Section -->
<div class="bg-white rounded-lg shadow-sm border border-gray-200 mt-6">
<div class="px-6 py-4 border-b border-gray-200">
<h2 class="text-xl font-semibold text-gray-900">
Comments ({{ $product->comments()->count() }})
</h2>
</div>
<div class="px-6 py-6">
@auth
<!-- Comment Form -->
<form action="{{ route('products.comments.store', $product) }}" method="POST" class="mb-8">
@csrf
<div>
<label for="body" class="sr-only">Add a comment</label>
<textarea
id="body"
name="body"
rows="3"
required
maxlength="1000"
placeholder="Share your thoughts about this product..."
class="block w-full rounded-md border-gray-300 shadow-sm focus:border-primary-500 focus:ring-primary-500 sm:text-sm @error('body') border-red-300 text-red-900 placeholder-red-300 focus:border-red-500 focus:ring-red-500 @enderror">{{ old('body') }}</textarea>
@error('body')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div class="mt-3 flex justify-end">
<button type="submit" class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md text-white bg-primary-600 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">
Post Comment
</button>
</div>
</form>
@else
<div class="text-center py-6 bg-gray-50 rounded-lg mb-8">
<p class="text-gray-600">
<a href="{{ route('login') }}" class="font-medium text-primary-600 hover:text-primary-500">Log in</a>
to post a comment
</p>
</div>
@endauth
<!-- Comments List -->
<div class="space-y-6">
@forelse($product->comments as $comment)
<div class="flex gap-4">
<!-- Avatar -->
<div class="flex-shrink-0">
@if($comment->user->avatar_url)
<img src="{{ $comment->user->avatar_url }}"
alt="{{ $comment->user->name }}"
class="h-10 w-10 rounded-full object-cover">
@else
<div class="text-muted">
<i class="bi bi-arrow-up-circle"></i>
<span>{{ $product->upvotes()->count() }}</span> upvotes
<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($comment->user->name, 0, 1)) }}
</div>
@endauth
@can('edit-product', $product)
<a href="{{ route('products.edit', $product) }}" class="btn btn-sm btn-outline-primary">Edit</a>
@endcan
@can('delete-product', $product)
<form action="{{ route('products.destroy', $product) }}" method="POST" class="d-inline" onsubmit="return confirm('Are you sure you want to delete this product?');">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-sm btn-outline-danger">Delete</button>
</form>
@endcan
@endif
</div>
</div>
<!-- Product Thumbnail -->
@if($product->thumbnail_url)
<div class="mb-4">
<img src="{{ $product->thumbnail_url }}" alt="{{ $product->title }}" class="img-fluid rounded" style="max-height: 400px;">
</div>
@endif
<!-- Product Description -->
<div class="mb-4">
<h4>About</h4>
<p class="lead">{{ $product->description }}</p>
</div>
<!-- Product Links -->
<div class="mb-4">
<a href="{{ $product->website_url }}" target="_blank" rel="noopener" class="btn btn-primary btn-lg">
Visit Website →
</a>
</div>
<!-- Product Metadata -->
<hr>
<div class="row text-muted small">
<div class="col-md-6">
<strong>Submitted by:</strong>
<a href="{{ route('profile.show', $product->user) }}">{{ $product->user->name }}</a>
</div>
<div class="col-md-6 text-md-end">
<strong>Submitted:</strong> {{ $product->created_at->format('F j, Y') }}
</div>
</div>
@if($product->isApproved() && $product->approved_at)
<div class="row text-muted small mt-2">
<div class="col-md-12">
<strong>Approved:</strong> {{ $product->approved_at->format('F j, Y') }}
</div>
</div>
@endif
</div>
</div>
<!-- Comments Section -->
<div class="card mt-3">
<div class="card-header">
<h5 class="mb-0">Comments ({{ $product->comments()->count() }})</h5>
</div>
<div class="card-body">
@auth
<!-- Comment Form -->
<form action="{{ route('products.comments.store', $product) }}" method="POST" class="mb-4">
@csrf
<div class="mb-3">
<textarea
class="form-control @error('body') is-invalid @enderror"
name="body"
rows="3"
placeholder="Share your thoughts about this product..."
required
maxlength="1000">{{ old('body') }}</textarea>
@error('body')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<button type="submit" class="btn btn-primary">Post Comment</button>
</form>
@else
<p class="text-muted">
<a href="{{ route('login') }}">Login</a> to post a comment.
</p>
@endauth
<!-- Comments List -->
@forelse($product->comments as $comment)
<div class="border-top pt-3 mt-3">
<div class="d-flex">
<div class="me-3">
@if($comment->user->avatar_url)
<img src="{{ $comment->user->avatar_url }}" alt="{{ $comment->user->name }}" class="rounded-circle" style="width: 40px; height: 40px; object-fit: cover;">
@else
<div class="bg-secondary text-white rounded-circle d-flex align-items-center justify-content-center" style="width: 40px; height: 40px;">
{{ strtoupper(substr($comment->user->name, 0, 1)) }}
</div>
@endif
</div>
<div class="flex-grow-1">
<div class="d-flex justify-content-between align-items-start">
<div>
<strong>{{ $comment->user->name }}</strong>
<span class="text-muted small">· {{ $comment->created_at->diffForHumans() }}</span>
</div>
@can('delete-comment', $comment)
<form action="{{ route('comments.destroy', $comment) }}" method="POST" class="d-inline">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-sm btn-link text-danger p-0" onclick="return confirm('Are you sure you want to delete this comment?');">
Delete
</button>
</form>
@endcan
</div>
<p class="mb-0 mt-2">{{ $comment->body }}</p>
<!-- Comment Content -->
<div class="flex-1 min-w-0">
<div class="flex items-center justify-between">
<div class="flex items-center gap-2">
<a href="{{ route('profile.show', $comment->user) }}" class="font-medium text-gray-900 hover:text-primary-600">
{{ $comment->user->name }}
</a>
<span class="text-gray-500 text-sm">·</span>
<span class="text-gray-500 text-sm">{{ $comment->created_at->diffForHumans() }}</span>
</div>
@can('delete-comment', $comment)
<form action="{{ route('comments.destroy', $comment) }}" method="POST" onsubmit="return confirm('Are you sure you want to delete this comment?');">
@csrf
@method('DELETE')
<button type="submit" class="text-sm text-red-600 hover:text-red-700">
Delete
</button>
</form>
@endcan
</div>
</div>
@empty
<p class="text-muted text-center py-4">No comments yet. Be the first to comment!</p>
@endforelse
</div>
</div>
<!-- Moderator Actions -->
@can('approve-product')
@if($product->isPending() || $product->isRejected())
<div class="card mt-3">
<div class="card-header bg-warning">
<h5 class="mb-0">Moderator Actions</h5>
</div>
<div class="card-body">
<form action="{{ route('products.approve', $product) }}" method="POST" class="d-inline">
@csrf
<button type="submit" class="btn btn-success">Approve Product</button>
</form>
<form action="{{ route('products.reject', $product) }}" method="POST" class="d-inline">
@csrf
<button type="submit" class="btn btn-danger" onclick="return confirm('Are you sure you want to reject this product?');">Reject Product</button>
</form>
<p class="mt-2 text-gray-700 whitespace-pre-line">{{ $comment->body }}</p>
</div>
</div>
@endif
@endcan
<div class="mt-3">
<a href="{{ route('products.index') }}" class="btn btn-secondary">← Back to Products</a>
@empty
<div class="text-center py-12 bg-gray-50 rounded-lg">
<svg class="mx-auto h-12 w-12 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"></path>
</svg>
<p class="mt-2 text-gray-600">No comments yet. Be the first to share your thoughts!</p>
</div>
@endforelse
</div>
</div>
</div>
</div>
@push('styles')
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
@endpush
<!-- Moderator Actions -->
@can('approve-product')
@if($product->isPending() || $product->isRejected())
<div class="bg-yellow-50 border border-yellow-200 rounded-lg mt-6">
<div class="px-6 py-4 border-b border-yellow-200 bg-yellow-100">
<h3 class="text-lg font-semibold text-yellow-900">Moderator Actions</h3>
</div>
<div class="px-6 py-4 flex gap-3">
<form action="{{ route('products.approve', $product) }}" method="POST">
@csrf
<button type="submit" class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md text-white bg-green-600 hover:bg-green-700">
Approve Product
</button>
</form>
<form action="{{ route('products.reject', $product) }}" method="POST" onsubmit="return confirm('Are you sure you want to reject this product?');">
@csrf
<button type="submit" class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md text-white bg-red-600 hover:bg-red-700">
Reject Product
</button>
</form>
</div>
</div>
@endif
@endcan
<!-- Back Button -->
<div class="mt-6">
<a href="{{ route('products.index') }}" class="inline-flex items-center text-sm font-medium text-gray-600 hover:text-gray-900">
<svg class="mr-2 h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"></path>
</svg>
Back to Products
</a>
</div>
</div>
@push('scripts')
<script>
@@ -234,10 +319,16 @@
if (data.success) {
// Update button state
this.setAttribute('data-upvoted', data.upvoted ? 'true' : 'false');
const svg = this.querySelector('svg');
if (data.upvoted) {
this.classList.add('active');
this.classList.remove('border-gray-300', 'bg-white', 'text-gray-700', 'hover:border-primary-500', 'hover:bg-primary-50');
this.classList.add('border-primary-500', 'bg-primary-50', 'text-primary-700');
svg.setAttribute('fill', 'currentColor');
} else {
this.classList.remove('active');
this.classList.remove('border-primary-500', 'bg-primary-50', 'text-primary-700');
this.classList.add('border-gray-300', 'bg-white', 'text-gray-700', 'hover:border-primary-500', 'hover:bg-primary-50');
svg.setAttribute('fill', 'none');
}
// Update count
@@ -270,16 +361,16 @@
if (data.success) {
// Update button state
this.setAttribute('data-bookmarked', data.bookmarked ? 'true' : 'false');
const icon = this.querySelector('i');
const svg = this.querySelector('svg');
if (data.bookmarked) {
this.classList.add('active');
icon.classList.remove('bi-bookmark');
icon.classList.add('bi-bookmark-fill');
this.classList.remove('border-gray-300', 'bg-white', 'text-gray-700', 'hover:border-gray-400');
this.classList.add('border-primary-500', 'bg-primary-50', 'text-primary-700');
svg.setAttribute('fill', 'currentColor');
} else {
this.classList.remove('active');
icon.classList.remove('bi-bookmark-fill');
icon.classList.add('bi-bookmark');
this.classList.remove('border-primary-500', 'bg-primary-50', 'text-primary-700');
this.classList.add('border-gray-300', 'bg-white', 'text-gray-700', 'hover:border-gray-400');
svg.setAttribute('fill', 'none');
}
}
} catch (error) {
+201 -132
View File
@@ -1,152 +1,221 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">Edit Profile</div>
<div class="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
<!-- Header -->
<div class="mb-8">
<h1 class="text-3xl font-bold text-gray-900">Edit Profile</h1>
<p class="mt-2 text-sm text-gray-600">Update your profile information and social links</p>
</div>
<div class="card-body">
@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
<div class="bg-white rounded-lg shadow-sm border border-gray-200">
<div class="px-6 py-8">
<form method="POST" action="{{ route('profile.update') }}" enctype="multipart/form-data" class="space-y-8">
@csrf
@method('PUT')
<form method="POST" action="{{ route('profile.update') }}" enctype="multipart/form-data">
@csrf
@method('PUT')
<!-- Avatar Section -->
<div class="mb-4">
<label class="form-label">Profile Picture</label>
<div class="d-flex align-items-center">
<div class="me-3">
@if ($user->avatar)
<img src="{{ $user->avatar_url }}" alt="{{ $user->name }}" class="rounded-circle" style="width: 100px; height: 100px; object-fit: cover;">
@else
<div class="bg-secondary text-white rounded-circle d-flex align-items-center justify-content-center" style="width: 100px; height: 100px; font-size: 36px;">
{{ strtoupper(substr($user->name, 0, 1)) }}
</div>
@endif
<!-- Avatar Section -->
<div>
<h3 class="text-lg font-medium text-gray-900 mb-4">Profile Picture</h3>
<div class="flex items-center gap-6">
<div class="flex-shrink-0">
@if($user->avatar_url)
<img src="{{ $user->avatar_url }}"
alt="{{ $user->name }}"
class="h-24 w-24 rounded-full object-cover ring-4 ring-gray-100">
@else
<div class="h-24 w-24 rounded-full bg-gradient-to-br from-primary-500 to-accent-500 flex items-center justify-center text-white text-3xl font-bold ring-4 ring-gray-100">
{{ strtoupper(substr($user->name, 0, 1)) }}
</div>
<div class="flex-grow-1">
<input type="file" class="form-control @error('avatar') is-invalid @enderror" id="avatar" name="avatar" accept="image/*">
@error('avatar')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
<small class="form-text text-muted">JPG, PNG, or GIF. Max size 2MB.</small>
@if ($user->avatar)
<div class="mt-2">
<form method="POST" action="{{ route('profile.avatar.delete') }}" class="d-inline">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-sm btn-danger" onclick="return confirm('Are you sure you want to delete your avatar?')">
Delete Avatar
</button>
</form>
</div>
@endif
</div>
</div>
@endif
</div>
<!-- Name -->
<div class="mb-3">
<label for="name" class="form-label">Name</label>
<input type="text" class="form-control @error('name') is-invalid @enderror" id="name" name="name" value="{{ old('name', $user->name) }}" required>
@error('name')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
<div class="flex-1">
<input type="file"
id="avatar"
name="avatar"
accept="image/*"
class="block w-full text-sm text-gray-500 file:mr-4 file:py-2 file:px-4 file:rounded-md file:border-0 file:text-sm file:font-semibold file:bg-primary-50 file:text-primary-700 hover:file:bg-primary-100 @error('avatar') border-red-300 @enderror">
@error('avatar')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
<p class="mt-2 text-sm text-gray-500">JPG, PNG, or GIF. Max size 2MB.</p>
@if($user->avatar)
<form method="POST" action="{{ route('profile.avatar.delete') }}" class="mt-3" onsubmit="return confirm('Are you sure you want to delete your avatar?')">
@csrf
@method('DELETE')
<button type="submit" class="text-sm font-medium text-red-600 hover:text-red-700">
Delete Avatar
</button>
</form>
@endif
</div>
</div>
</div>
<!-- Basic Information -->
<div class="border-t border-gray-200 pt-8">
<h3 class="text-lg font-medium text-gray-900 mb-4">Basic Information</h3>
<div class="grid grid-cols-1 gap-6 sm:grid-cols-2">
<!-- Name -->
<div>
<label for="name" class="block text-sm font-medium text-gray-700">
Name <span class="text-red-600">*</span>
</label>
<div class="mt-1">
<input type="text"
id="name"
name="name"
value="{{ old('name', $user->name) }}"
required
class="appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm @error('name') border-red-300 text-red-900 placeholder-red-300 focus:ring-red-500 focus:border-red-500 @enderror">
@error('name')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
</div>
<!-- Email -->
<div class="mb-3">
<label for="email" class="form-label">Email</label>
<input type="email" class="form-control @error('email') is-invalid @enderror" id="email" name="email" value="{{ old('email', $user->email) }}" required>
@error('email')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
<div>
<label for="email" class="block text-sm font-medium text-gray-700">
Email <span class="text-red-600">*</span>
</label>
<div class="mt-1">
<input type="email"
id="email"
name="email"
value="{{ old('email', $user->email) }}"
required
class="appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm @error('email') border-red-300 text-red-900 placeholder-red-300 focus:ring-red-500 focus:border-red-500 @enderror">
@error('email')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
</div>
</div>
<!-- Bio -->
<div class="mb-3">
<label for="bio" class="form-label">Bio</label>
<textarea class="form-control @error('bio') is-invalid @enderror" id="bio" name="bio" rows="4" maxlength="1000">{{ old('bio', $user->bio) }}</textarea>
<!-- Bio -->
<div class="mt-6">
<label for="bio" class="block text-sm font-medium text-gray-700">
Bio
</label>
<div class="mt-1">
<textarea id="bio"
name="bio"
rows="4"
maxlength="1000"
placeholder="Tell us a bit about yourself..."
class="appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm @error('bio') border-red-300 text-red-900 placeholder-red-300 focus:ring-red-500 focus:border-red-500 @enderror">{{ old('bio', $user->bio) }}</textarea>
@error('bio')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
<small class="form-text text-muted">Max 1000 characters</small>
<p class="mt-2 text-sm text-gray-500">Max 1000 characters</p>
</div>
<!-- Website -->
<div class="mb-3">
<label for="website" class="form-label">Website</label>
<input type="url" class="form-control @error('website') is-invalid @enderror" id="website" name="website" value="{{ old('website', $user->website) }}" placeholder="https://example.com">
@error('website')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<!-- Social Links -->
<div class="mb-3">
<label for="twitter" class="form-label">Twitter Username</label>
<div class="input-group">
<span class="input-group-text">@</span>
<input type="text" class="form-control @error('twitter') is-invalid @enderror" id="twitter" name="twitter" value="{{ old('twitter', $user->twitter) }}" placeholder="username">
@error('twitter')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="mb-3">
<label for="github" class="form-label">GitHub Username</label>
<div class="input-group">
<span class="input-group-text">github.com/</span>
<input type="text" class="form-control @error('github') is-invalid @enderror" id="github" name="github" value="{{ old('github', $user->github) }}" placeholder="username">
@error('github')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="mb-3">
<label for="linkedin" class="form-label">LinkedIn Username</label>
<div class="input-group">
<span class="input-group-text">linkedin.com/in/</span>
<input type="text" class="form-control @error('linkedin') is-invalid @enderror" id="linkedin" name="linkedin" value="{{ old('linkedin', $user->linkedin) }}" placeholder="username">
@error('linkedin')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="d-flex justify-content-between">
<a href="{{ route('profile.show', $user) }}" class="btn btn-secondary">Cancel</a>
<button type="submit" class="btn btn-primary">Update Profile</button>
</div>
</form>
</div>
</div>
</div>
<!-- Website & Social Links -->
<div class="border-t border-gray-200 pt-8">
<h3 class="text-lg font-medium text-gray-900 mb-4">Website & Social Links</h3>
<div class="space-y-6">
<!-- Website -->
<div>
<label for="website" class="block text-sm font-medium text-gray-700">
Website
</label>
<div class="mt-1">
<input type="url"
id="website"
name="website"
value="{{ old('website', $user->website) }}"
placeholder="https://example.com"
class="appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm @error('website') border-red-300 text-red-900 placeholder-red-300 focus:ring-red-500 focus:border-red-500 @enderror">
@error('website')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
</div>
<!-- Twitter -->
<div>
<label for="twitter" class="block text-sm font-medium text-gray-700">
Twitter Username
</label>
<div class="mt-1 flex rounded-md shadow-sm">
<span class="inline-flex items-center px-3 rounded-l-md border border-r-0 border-gray-300 bg-gray-50 text-gray-500 sm:text-sm">
@
</span>
<input type="text"
id="twitter"
name="twitter"
value="{{ old('twitter', $user->twitter) }}"
placeholder="username"
class="flex-1 min-w-0 block w-full px-3 py-2 rounded-none rounded-r-md border-gray-300 focus:ring-primary-500 focus:border-primary-500 sm:text-sm @error('twitter') border-red-300 text-red-900 placeholder-red-300 focus:ring-red-500 focus:border-red-500 @enderror">
</div>
@error('twitter')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<!-- GitHub -->
<div>
<label for="github" class="block text-sm font-medium text-gray-700">
GitHub Username
</label>
<div class="mt-1 flex rounded-md shadow-sm">
<span class="inline-flex items-center px-3 rounded-l-md border border-r-0 border-gray-300 bg-gray-50 text-gray-500 text-sm">
github.com/
</span>
<input type="text"
id="github"
name="github"
value="{{ old('github', $user->github) }}"
placeholder="username"
class="flex-1 min-w-0 block w-full px-3 py-2 rounded-none rounded-r-md border-gray-300 focus:ring-primary-500 focus:border-primary-500 sm:text-sm @error('github') border-red-300 text-red-900 placeholder-red-300 focus:ring-red-500 focus:border-red-500 @enderror">
</div>
@error('github')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<!-- LinkedIn -->
<div>
<label for="linkedin" class="block text-sm font-medium text-gray-700">
LinkedIn Username
</label>
<div class="mt-1 flex rounded-md shadow-sm">
<span class="inline-flex items-center px-3 rounded-l-md border border-r-0 border-gray-300 bg-gray-50 text-gray-500 text-sm">
linkedin.com/in/
</span>
<input type="text"
id="linkedin"
name="linkedin"
value="{{ old('linkedin', $user->linkedin) }}"
placeholder="username"
class="flex-1 min-w-0 block w-full px-3 py-2 rounded-none rounded-r-md border-gray-300 focus:ring-primary-500 focus:border-primary-500 sm:text-sm @error('linkedin') border-red-300 text-red-900 placeholder-red-300 focus:ring-red-500 focus:border-red-500 @enderror">
</div>
@error('linkedin')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
</div>
</div>
<!-- Form Actions -->
<div class="border-t border-gray-200 pt-6 flex items-center justify-between">
<a href="{{ route('profile.show', $user) }}"
class="inline-flex items-center px-4 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">
Cancel
</a>
<button type="submit"
class="inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-primary-600 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">
<svg class="mr-2 h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
</svg>
Update Profile
</button>
</div>
</form>
</div>
</div>
</div>
+184 -82
View File
@@ -1,93 +1,195 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<span>{{ $user->name }}'s Profile</span>
@auth
@if (Auth::id() === $user->id)
<a href="{{ route('profile.edit') }}" class="btn btn-sm btn-primary">Edit Profile</a>
@endif
@endauth
</div>
<div class="card-body">
<div class="row">
<div class="col-md-3 text-center">
@if ($user->avatar)
<img src="{{ $user->avatar_url }}" alt="{{ $user->name }}" class="img-fluid rounded-circle mb-3" style="max-width: 150px;">
@else
<div class="bg-secondary text-white rounded-circle d-flex align-items-center justify-content-center mb-3" style="width: 150px; height: 150px; font-size: 48px; margin: 0 auto;">
{{ strtoupper(substr($user->name, 0, 1)) }}
</div>
@endif
</div>
<div class="col-md-9">
<h3>{{ $user->name }}</h3>
<p class="text-muted">{{ $user->email }}</p>
@if ($user->bio)
<div class="mt-3">
<h5>Bio</h5>
<p>{{ $user->bio }}</p>
</div>
@endif
@if ($user->website || $user->twitter || $user->github || $user->linkedin)
<div class="mt-4">
<h5>Links</h5>
<ul class="list-unstyled">
@if ($user->website)
<li class="mb-2">
<strong>Website:</strong>
<a href="{{ $user->website }}" target="_blank" rel="noopener">{{ $user->website }}</a>
</li>
@endif
@if ($user->twitter)
<li class="mb-2">
<strong>Twitter:</strong>
<a href="https://twitter.com/{{ $user->twitter }}" target="_blank" rel="noopener">@{{ $user->twitter }}</a>
</li>
@endif
@if ($user->github)
<li class="mb-2">
<strong>GitHub:</strong>
<a href="https://github.com/{{ $user->github }}" target="_blank" rel="noopener">{{ $user->github }}</a>
</li>
@endif
@if ($user->linkedin)
<li class="mb-2">
<strong>LinkedIn:</strong>
<a href="https://linkedin.com/in/{{ $user->linkedin }}" target="_blank" rel="noopener">{{ $user->linkedin }}</a>
</li>
@endif
</ul>
</div>
@endif
@if ($user->roles->isNotEmpty())
<div class="mt-4">
<h5>Roles</h5>
<div>
@foreach ($user->roles as $role)
<span class="badge bg-primary me-1">{{ $role->name }}</span>
@endforeach
</div>
</div>
@endif
<div class="mt-3 text-muted">
<small>Member since {{ $user->created_at->format('F Y') }}</small>
<div class="bg-white">
<!-- Profile Header -->
<div class="bg-gradient-to-br from-primary-50 to-white border-b border-gray-200">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
<div class="md:flex md:items-center md:justify-between md:space-x-8">
<!-- Avatar & Name -->
<div class="flex items-center space-x-6">
<div class="flex-shrink-0">
@if($user->avatar_url)
<img src="{{ $user->avatar_url }}"
alt="{{ $user->name }}"
class="h-24 w-24 rounded-full object-cover ring-4 ring-white shadow-lg">
@else
<div class="h-24 w-24 rounded-full bg-gradient-to-br from-primary-500 to-accent-500 flex items-center justify-center text-white text-3xl font-bold ring-4 ring-white shadow-lg">
{{ strtoupper(substr($user->name, 0, 1)) }}
</div>
</div>
@endif
</div>
<div>
<h1 class="text-3xl font-bold text-gray-900">{{ $user->name }}</h1>
<p class="mt-1 text-base text-gray-500">{{ $user->email }}</p>
@if($user->roles->isNotEmpty())
<div class="mt-2 flex items-center gap-2">
@foreach($user->roles as $role)
<span class="inline-flex items-center px-2.5 py-0.5 rounded-md text-xs font-medium bg-primary-100 text-primary-800">
{{ ucfirst($role->name) }}
</span>
@endforeach
</div>
@endif
</div>
</div>
<!-- Edit Profile Button -->
@auth
@if(Auth::id() === $user->id)
<div class="mt-6 md:mt-0">
<a href="{{ route('profile.edit') }}"
class="inline-flex items-center px-4 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">
<svg class="mr-2 h-5 w-5 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"></path>
</svg>
Edit Profile
</a>
</div>
@endif
@endauth
</div>
<!-- Bio -->
@if($user->bio)
<div class="mt-6 max-w-3xl">
<p class="text-gray-700 text-base leading-relaxed">{{ $user->bio }}</p>
</div>
@endif
<!-- Stats -->
<div class="mt-8 grid grid-cols-3 gap-4 sm:gap-6">
<div class="bg-white rounded-lg border border-gray-200 p-4 text-center">
<div class="text-2xl font-bold text-gray-900">{{ $stats['products_count'] }}</div>
<div class="mt-1 text-sm text-gray-600">{{ Str::plural('Product', $stats['products_count']) }}</div>
</div>
<div class="bg-white rounded-lg border border-gray-200 p-4 text-center">
<div class="text-2xl font-bold text-gray-900">{{ $stats['total_upvotes'] }}</div>
<div class="mt-1 text-sm text-gray-600">{{ Str::plural('Upvote', $stats['total_upvotes']) }}</div>
</div>
<div class="bg-white rounded-lg border border-gray-200 p-4 text-center">
<div class="text-2xl font-bold text-gray-900">{{ $stats['comments_count'] }}</div>
<div class="mt-1 text-sm text-gray-600">{{ Str::plural('Comment', $stats['comments_count']) }}</div>
</div>
</div>
<!-- Social Links -->
@if($user->website || $user->twitter || $user->github || $user->linkedin)
<div class="mt-6 flex flex-wrap gap-3">
@if($user->website)
<a href="{{ $user->website }}"
target="_blank"
rel="noopener noreferrer"
class="inline-flex items-center px-3 py-2 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">
<svg class="mr-2 h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"></path>
</svg>
Website
</a>
@endif
@if($user->twitter)
<a href="https://twitter.com/{{ $user->twitter }}"
target="_blank"
rel="noopener noreferrer"
class="inline-flex items-center px-3 py-2 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">
<svg class="mr-2 h-4 w-4" fill="currentColor" viewBox="0 0 24 24">
<path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"></path>
</svg>
Twitter
</a>
@endif
@if($user->github)
<a href="https://github.com/{{ $user->github }}"
target="_blank"
rel="noopener noreferrer"
class="inline-flex items-center px-3 py-2 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">
<svg class="mr-2 h-4 w-4" fill="currentColor" viewBox="0 0 24 24">
<path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path>
</svg>
GitHub
</a>
@endif
@if($user->linkedin)
<a href="https://linkedin.com/in/{{ $user->linkedin }}"
target="_blank"
rel="noopener noreferrer"
class="inline-flex items-center px-3 py-2 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">
<svg class="mr-2 h-4 w-4" fill="currentColor" viewBox="0 0 24 24">
<path d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"></path>
</svg>
LinkedIn
</a>
@endif
</div>
@endif
<!-- Member Since -->
<div class="mt-6">
<p class="text-sm text-gray-500">
<svg class="inline-block h-4 w-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<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>
</svg>
Member since {{ $user->created_at->format('F Y') }}
</p>
</div>
</div>
</div>
<!-- Products Section -->
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
<div class="mb-8">
<h2 class="text-2xl font-bold text-gray-900">
Products by {{ $user->name }}
</h2>
<p class="mt-2 text-sm text-gray-600">
@if($products->total() > 0)
Showing {{ $products->count() }} of {{ $products->total() }} {{ Str::plural('product', $products->total()) }}
@else
No products yet
@endif
</p>
</div>
@if($products->count() > 0)
<div class="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3">
@foreach($products as $product)
@include('components.product-card', ['product' => $product])
@endforeach
</div>
<!-- Pagination -->
@if($products->hasPages())
<div class="mt-8">
{{ $products->links() }}
</div>
@endif
@else
<div class="text-center py-12 bg-gray-50 rounded-lg border border-gray-200">
<svg class="mx-auto h-12 w-12 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4"></path>
</svg>
<h3 class="mt-2 text-sm font-medium text-gray-900">No products</h3>
<p class="mt-1 text-sm text-gray-500">
{{ Auth::id() === $user->id ? "You haven't submitted any products yet." : "{$user->name} hasn't submitted any products yet." }}
</p>
@auth
@if(Auth::id() === $user->id)
<div class="mt-6">
<a href="{{ route('products.create') }}"
class="inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-primary-600 hover:bg-primary-700">
<svg class="mr-2 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>
Submit Your First Product
</a>
</div>
@endif
@endauth
</div>
@endif
</div>
</div>
@endsection
File diff suppressed because one or more lines are too long