Files
RetroHub/resources/js/Features/Dashboard/Pages/Index.vue
T

123 lines
5.8 KiB
Vue

<script setup lang="ts">
import AppLayout from '@/Shared/Layouts/AppLayout.vue';
import { Head, Link } from '@inertiajs/vue3';
import type { ConsoleData, GameData, DashboardStatsData } from '@/types';
interface Props {
stats: DashboardStatsData;
recentGames: GameData[];
consoles: ConsoleData[];
user: {
name: string;
email: string;
};
}
defineProps<Props>();
</script>
<template>
<AppLayout title="Dashboard" :user="user">
<template #header>
<h2 class="font-semibold text-xl text-gray-800 leading-tight">Dashboard</h2>
</template>
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<!-- Stats -->
<div class="grid grid-cols-1 md:grid-cols-4 gap-6 mb-8">
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg p-6">
<div class="text-2xl font-bold text-purple-600">{{ stats.totalGames }}</div>
<div class="text-gray-500">Games</div>
</div>
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg p-6">
<div class="text-2xl font-bold text-purple-600">{{ stats.totalConsoles }}</div>
<div class="text-gray-500">Consoles</div>
</div>
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg p-6">
<div class="text-2xl font-bold text-purple-600">{{ stats.totalRoms }}</div>
<div class="text-gray-500">ROM Files</div>
</div>
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg p-6">
<div class="text-2xl font-bold text-purple-600">{{ stats.userSaves }}</div>
<div class="text-gray-500">Save Files</div>
</div>
</div>
<!-- Quick Actions -->
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg p-6 mb-8">
<h3 class="text-lg font-semibold mb-4">Quick Actions</h3>
<div class="flex gap-4">
<Link
:href="route('upload.index')"
class="bg-purple-600 hover:bg-purple-700 text-white font-bold py-2 px-4 rounded"
>
Upload ROMs
</Link>
<Link
:href="route('consoles.index')"
class="bg-gray-600 hover:bg-gray-700 text-white font-bold py-2 px-4 rounded"
>
Browse Library
</Link>
<Link
:href="route('scraper.index')"
class="bg-amber-600 hover:bg-amber-700 text-white font-bold py-2 px-4 rounded"
>
Cover Scraper
</Link>
</div>
</div>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
<!-- Recent Games -->
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg p-6">
<h3 class="text-lg font-semibold mb-4">Recent Games</h3>
<div v-if="recentGames.length === 0" class="text-gray-500">
No games uploaded yet.
</div>
<div v-else class="space-y-3">
<Link
v-for="game in recentGames"
:key="game.id"
:href="route('games.show', game.slug)"
class="flex items-center gap-3 p-2 rounded hover:bg-gray-50"
>
<div class="w-10 h-14 bg-gray-200 rounded flex items-center justify-center overflow-hidden">
<img
v-if="game.coverPath"
:src="'/storage/' + game.coverPath"
:alt="game.title"
class="w-full h-full object-cover"
/>
<span v-else class="text-xs text-gray-400">No cover</span>
</div>
<div>
<div class="font-medium">{{ game.title }}</div>
<div class="text-sm text-gray-500">{{ game.console?.name }}</div>
</div>
</Link>
</div>
</div>
<!-- Consoles -->
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg p-6">
<h3 class="text-lg font-semibold mb-4">Consoles</h3>
<div class="grid grid-cols-2 gap-3">
<Link
v-for="console in consoles"
:key="console.id"
:href="route('consoles.show', console.slug)"
class="p-3 border rounded-lg hover:bg-gray-50"
>
<div class="font-medium">{{ console.name }}</div>
<div class="text-sm text-gray-500">{{ console.gamesCount }} games</div>
</Link>
</div>
</div>
</div>
</div>
</div>
</AppLayout>
</template>