dealroom/templates/dashboard.templ

110 lines
4.5 KiB
Plaintext

package templates
import (
"fmt"
"dealroom/internal/model"
)
templ Dashboard(user *model.User, dealRooms []*model.Entry) {
@Layout("Dashboard", user) {
<div class="space-y-8">
<!-- Welcome Section -->
<div class="bg-white shadow rounded-lg p-6">
<div class="flex items-center justify-between">
<div>
<h1 class="text-2xl font-bold text-gray-900">Welcome back, { user.Name }</h1>
<p class="text-gray-600 mt-1">You have access to { fmt.Sprintf("%d", len(dealRooms)) } deal rooms</p>
</div>
if user.Role == "admin" {
<button onclick="window.location.href='/deal-rooms/new'"
class="bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-md text-sm font-medium transition-colors">
New Deal Room
</button>
}
</div>
</div>
<!-- Deal Rooms Grid -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
for _, room := range dealRooms {
@DealRoomCard(room)
}
if len(dealRooms) == 0 {
<div class="col-span-full">
<div class="text-center py-12">
<svg class="mx-auto h-12 w-12 text-gray-400" stroke="currentColor" fill="none" viewBox="0 0 48 48">
<path d="M34 40h10v-4a6 6 0 00-10.712-3.714M34 40H14m20 0v-4a9.971 9.971 0 00-.712-3.714M14 40H4v-4a6 6 0 0110.713-3.714M14 40v-4c0-1.313.253-2.566.713-3.714m0 0A9.971 9.971 0 0124 24c4.21 0 7.813 2.602 9.288 6.286" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
<h3 class="mt-2 text-sm font-medium text-gray-900">No deal rooms</h3>
<p class="mt-1 text-sm text-gray-500">Get started by creating a new deal room or wait for an invitation.</p>
</div>
</div>
}
</div>
<!-- Recent Activity -->
<div class="bg-white shadow rounded-lg">
<div class="px-6 py-4 border-b border-gray-200">
<h2 class="text-lg font-medium text-gray-900">Recent Activity</h2>
</div>
<div class="divide-y divide-gray-200" hx-get="/api/activity/recent" hx-trigger="load">
<!-- Activity items will be loaded via HTMX -->
<div class="p-6 text-center text-gray-500">
<div class="animate-pulse">Loading recent activity...</div>
</div>
</div>
</div>
</div>
}
}
templ DealRoomCard(room *model.Entry) {
<div class="bg-white shadow rounded-lg hover:shadow-md transition-shadow">
<div class="p-6">
<div class="flex items-center justify-between mb-4">
<h3 class="text-lg font-medium text-gray-900 truncate">{ room.Title }</h3>
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800">
Active
</span>
</div>
<!-- Deal Room Details -->
<div class="space-y-2 text-sm text-gray-600 mb-4">
<div class="flex items-center">
<svg class="h-4 w-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-4m-5 0H9m0 0H7m2 0v-5a2 2 0 012-2h2a2 2 0 012 2v5"/>
</svg>
Target Company
</div>
<div class="flex items-center">
<svg class="h-4 w-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1"/>
</svg>
Deal Value
</div>
<div class="flex items-center">
<svg class="h-4 w-4 mr-2" 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"/>
</svg>
{ room.CreatedAt.Format("Jan 2, 2006") }
</div>
</div>
<div class="flex items-center justify-between">
<button onclick={ templ.SafeScript("window.location.href='/deal-rooms/" + room.ID + "'") }
class="text-indigo-600 hover:text-indigo-500 text-sm font-medium">
View Details →
</button>
<div class="flex -space-x-2">
<!-- Participant avatars would go here -->
<div class="w-6 h-6 bg-gray-300 rounded-full border-2 border-white"></div>
<div class="w-6 h-6 bg-gray-300 rounded-full border-2 border-white"></div>
<div class="w-6 h-6 bg-gray-300 rounded-full border-2 border-white flex items-center justify-center">
<span class="text-xs text-gray-600">+3</span>
</div>
</div>
</div>
</div>
</div>
}