Skip to content

Commit e211754

Browse files
committed
feature: UI improvements, migrate to Tailwind & optimize user data flow
1 parent dc09334 commit e211754

28 files changed

+94
-565
lines changed

app/Http/Controllers/Auth/EmailVerificationPromptController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class EmailVerificationPromptController extends Controller
1616
public function __invoke(Request $request): RedirectResponse|Response
1717
{
1818
return $request->user()->hasVerifiedEmail()
19-
? redirect()->intended(route('dashboard', absolute: false))
19+
? redirect()->intended(route('dashboard.show', absolute: false))
2020
: Inertia::render('Auth/VerifyEmail', ['status' => session('status')]);
2121
}
2222
}

app/Http/Controllers/Auth/RegisteredUserController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ public function store(Request $request): RedirectResponse
4646

4747
Auth::login($user);
4848

49-
return redirect(route('dashboard', absolute: false));
49+
return redirect(route('dashboard.show', absolute: false));
5050
}
5151
}

app/Http/Controllers/Auth/VerifyEmailController.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ class VerifyEmailController extends Controller
1515
public function __invoke(EmailVerificationRequest $request): RedirectResponse
1616
{
1717
if ($request->user()->hasVerifiedEmail()) {
18-
return redirect()->intended(route('dashboard', absolute: false).'?verified=1');
18+
return redirect()->intended(route('dashboard.show', absolute: false).'?verified=1');
1919
}
2020

2121
if ($request->user()->markEmailAsVerified()) {
2222
event(new Verified($request->user()));
2323
}
2424

25-
return redirect()->intended(route('dashboard', absolute: false).'?verified=1');
25+
return redirect()->intended(route('dashboard.show', absolute: false).'?verified=1');
2626
}
2727
}

app/Http/Controllers/UserController.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@
33
namespace App\Http\Controllers;
44

55
use Illuminate\Support\Facades\Auth;
6+
use Inertia\Inertia;
67

78
class UserController extends Controller
89
{
9-
public function getUserLoggedIn()
10+
public function show()
1011
{
1112
$userLogged = Auth::user();
12-
return response()->json($userLogged);
13+
return Inertia::render('Dashboard/Show', [
14+
'user' => $userLogged
15+
]);
1316
}
1417
}

resources/js/Components/Tile.vue

+15-47
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,31 @@
11
<script setup>
2-
import { router } from '@inertiajs/vue3';
2+
const emit = defineEmits(['click']);
33
defineProps({
44
title: String,
55
description: String,
6-
link: String,
7-
width: String,
8-
height: String,
9-
bgColor: String,
106
});
117
</script>
128

139
<template>
10+
<div class="group shadow-xl rounded-xl h-40 cursor-pointer transition-all duration-300 ease-in-out hover:-translate-y-1" @click="emit('click')">
1411
<div
15-
@click="router.get(link)"
16-
class="tile-container"
17-
:style="{
18-
backgroundColor: bgColor || '#ffffff',
19-
width: width || '100%',
20-
height: height || '100%'
21-
}"
12+
class="relative flex flex-col justify-center items-start rounded-xl overflow-hidden text-white p-6 bg-gradient-to-br from-red-500 to-red-600 shadow-2xl h-full w-full"
2213
>
23-
<div class="tile-content">
24-
<h3 class="tile-title">{{ title }}</h3>
25-
<p class="tile-description">{{ description }}</p>
14+
<div class="relative z-10 w-full">
15+
<h3 class="text-lg sm:text-xl font-bold mb-1">{{ title }}</h3>
16+
<p class="text-sm text-white/80">{{ description }}</p>
17+
</div>
18+
19+
<div class="absolute inset-0 bg-black/0 group-hover:bg-black/10 transition-all duration-300 ease-in-out"></div>
20+
21+
<div class="absolute bottom-4 right-4 opacity-50 group-hover:opacity-100 transition-all duration-300 transform group-hover:translate-x-1">
22+
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
23+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
24+
</svg>
2625
</div>
2726
</div>
27+
</div>
2828
</template>
2929

30-
3130
<style scoped>
32-
.tile-container {
33-
color: white;
34-
display: flex;
35-
flex-direction: column;
36-
justify-content: center;
37-
align-items: center;
38-
box-shadow: rgba(0, 0, 0, 0.3) 10px 10px 15px;
39-
cursor: pointer;
40-
overflow: hidden;
41-
transition: transform 0.3s ease;
42-
border-radius: 20px;
43-
}
44-
45-
.tile-container:hover {
46-
transform: scale(1.05);
47-
48-
}
49-
50-
.tile-content {
51-
text-align: center;
52-
}
53-
54-
.tile-title {
55-
font-size: 1.5rem;
56-
font-weight: bold;
57-
}
58-
59-
.tile-description {
60-
font-size: 1rem;
61-
color: #dfdfdf;
62-
}
6331
</style>

resources/js/Layouts/AuthenticatedLayout.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const showingNavigationDropdown = ref(false);
2222
<div class="flex">
2323
<!-- Logo -->
2424
<div class="flex shrink-0 items-center">
25-
<Link :href="route('dashboard')">
25+
<Link :href="route('dashboard.show')">
2626
<ApplicationLogo
2727
class="block h-9 w-auto fill-current text-gray-800"
2828
/>
@@ -34,7 +34,7 @@ const showingNavigationDropdown = ref(false);
3434
class="hidden space-x-8 sm:-my-px sm:ms-10 sm:flex"
3535
>
3636
<NavLink
37-
:href="route('dashboard')"
37+
:href="route('dashboard.show')"
3838
:active="route().current('dashboard')"
3939
>
4040
Dashboard
@@ -141,7 +141,7 @@ const showingNavigationDropdown = ref(false);
141141
>
142142
<div class="space-y-1 pb-3 pt-2">
143143
<ResponsiveNavLink
144-
:href="route('dashboard')"
144+
:href="route('dashboard.show')"
145145
:active="route().current('dashboard')"
146146
>
147147
Dashboard

resources/js/Pages/Dashboard.vue

-90
This file was deleted.

resources/js/Pages/Dashboard/Show.vue

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<script setup>
2+
import { Head, router } from '@inertiajs/vue3';
3+
import Tile from '@/Components/Tile.vue';
4+
5+
const props = defineProps({
6+
user: Object,
7+
required: true
8+
});
9+
10+
const navigateToClients = () => router.get('/clients');
11+
const navigateToVehicles = () => router.get('/vehicles');
12+
const navigateToRepairs = () => router.get('/repairs');
13+
const navigateToBuys = () => router.get('/buys');
14+
</script>
15+
16+
<template>
17+
<Head title="Dashboard" />
18+
19+
<div class="min-h-screen flex flex-col px-4 py-12 sm:px-6 lg:px-8">
20+
<div class="max-w-7xl mx-auto w-full">
21+
<h1 class="text-black text-center text-2xl sm:text-3xl font-bold mb-12">
22+
Bienvenido a <span class="text-red-600">Neumatrans</span>, {{ props.user.name }}
23+
</h1>
24+
25+
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
26+
<Tile
27+
title="Clientes"
28+
description="Gestión de clientes"
29+
@click="navigateToClients"
30+
/>
31+
<Tile
32+
title="Vehículos"
33+
description="Gestión de vehículos"
34+
@click="navigateToVehicles"
35+
/>
36+
<Tile
37+
title="Reparaciones"
38+
description="Gestión de reparaciones"
39+
@click="navigateToRepairs"
40+
/>
41+
<Tile
42+
title="Compras"
43+
description="Gestión de compras"
44+
@click="navigateToBuys"
45+
/>
46+
<Tile
47+
title="Compras"
48+
description="Gestión de reparaciones"
49+
@click="navigateToBuys"
50+
/>
51+
<Tile
52+
title="Compras"
53+
description="Gestión de compras"
54+
@click="navigateToBuys"
55+
/>
56+
</div>
57+
</div>
58+
</div>
59+
</template>

resources/js/Pages/Welcome.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function handleImageError() {
5757
<nav v-if="canLogin" class="-mx-3 flex flex-1 justify-end">
5858
<Link
5959
v-if="$page.props.auth.user"
60-
:href="route('dashboard')"
60+
:href="route('dashboard.show')"
6161
class="rounded-md px-3 py-2 text-black ring-1 ring-transparent transition hover:text-black/70 focus:outline-none focus-visible:ring-[#FF2D20] dark:text-white dark:hover:text-white/80 dark:focus-visible:ring-white"
6262
>
6363
Dashboard

resources/js/ziggy.js

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

routes/web.php

+2-8
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,13 @@
1818
]);
1919
});
2020

21-
Route::get('/dashboard', function () {
22-
return Inertia::render('Dashboard');
23-
})->middleware(['auth', 'verified'])->name('dashboard');
24-
25-
Route::middleware('auth')->group(function () {
21+
Route::middleware(['auth', 'verified'])->group(function () {
22+
Route::get('/dashboard', [UserController::class, 'show'])->name('dashboard.show');
2623
Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit');
2724
Route::patch('/profile', [ProfileController::class, 'update'])->name('profile.update');
2825
Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy');
2926
});
3027

31-
//API routes
32-
Route::get('/api/user-logged-in', [UserController::class, 'getUserLoggedIn'])->name('user-logged-in');
33-
3428
//pages routes
3529
Route::get('/clients', [ClientController::class, 'index'])->name('clients');
3630
Route::get('/vehicles', [VehicleController::class, 'index'])->name('vehicles');

storage/app/.gitignore

100644100755
File mode changed.

storage/app/private/.gitignore

100644100755
File mode changed.

storage/app/public/.gitignore

100644100755
File mode changed.

storage/framework/.gitignore

100644100755
File mode changed.

storage/framework/cache/.gitignore

100644100755
File mode changed.

storage/framework/cache/data/.gitignore

100644100755
File mode changed.

storage/framework/sessions/.gitignore

100644100755
File mode changed.

storage/framework/testing/.gitignore

100644100755
File mode changed.

storage/framework/views/.gitignore

100644100755
File mode changed.

storage/logs/.gitignore

100644100755
File mode changed.

0 commit comments

Comments
 (0)