dealroom/templates/layout.templ

79 lines
2.7 KiB
Plaintext

package templates
import "dealroom/internal/model"
templ Layout(title string, user *model.User) {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>{ title } - Deal Room</title>
<script src="https://unpkg.com/htmx.org@1.9.10"></script>
<script src="https://cdn.tailwindcss.com"></script>
<style>
/* Custom styles for Deal Room */
.deal-room-gradient {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
</style>
</head>
<body class="bg-gray-50 min-h-screen">
if user != nil {
@Navigation(user)
}
<main class="container mx-auto px-4 py-8">
{ children... }
</main>
@Footer()
</body>
</html>
}
templ Navigation(user *model.User) {
<nav class="deal-room-gradient shadow-lg">
<div class="container mx-auto px-4">
<div class="flex justify-between items-center py-4">
<div class="flex items-center space-x-4">
<h1 class="text-white text-xl font-bold">Deal Room</h1>
<div class="hidden md:flex space-x-6">
<a href="/" class="text-white hover:text-gray-200 transition-colors">Dashboard</a>
<a href="/activity" class="text-white hover:text-gray-200 transition-colors">Activity</a>
if user.Role == "admin" {
<a href="/admin" class="text-white hover:text-gray-200 transition-colors">Admin</a>
}
</div>
</div>
<div class="flex items-center space-x-4">
<span class="text-white">{ user.Name }</span>
<div class="relative group">
if user.AvatarURL != nil {
<img src={ *user.AvatarURL } alt="Avatar" class="w-8 h-8 rounded-full"/>
} else {
<div class="w-8 h-8 bg-white bg-opacity-20 rounded-full flex items-center justify-center">
<span class="text-white text-sm font-medium">{ string([]rune(user.Name)[0]) }</span>
</div>
}
<div class="absolute right-0 mt-2 w-48 bg-white rounded-md shadow-lg opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-200 z-10">
<div class="py-1">
<a href="/profile" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">Profile</a>
<a href="/auth/logout" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">Logout</a>
</div>
</div>
</div>
</div>
</div>
</div>
</nav>
}
templ Footer() {
<footer class="bg-gray-800 text-white mt-12">
<div class="container mx-auto px-4 py-6">
<div class="flex justify-between items-center">
<p class="text-sm">&copy; 2024 Deal Room. All rights reserved.</p>
<p class="text-xs text-gray-400">Secure • Encrypted • Auditable</p>
</div>
</div>
</footer>
}