dealroom/templates/audit.templ

60 lines
2.5 KiB
Plaintext

package templates
import "dealroom/internal/model"
templ AuditLogPage(profile *model.Profile, activities []*model.DealActivity) {
@Layout(profile, "audit") {
<div class="space-y-5">
<div>
<h1 class="text-2xl font-bold">Audit Log</h1>
<p class="text-sm text-gray-500 mt-1">Complete activity timeline across all deal rooms.</p>
</div>
<div class="bg-gray-900 rounded-lg border border-gray-800 p-6">
<div class="space-y-6">
for _, act := range activities {
<div class="flex items-start gap-4 relative">
<!-- Timeline line -->
<div class="flex flex-col items-center">
@activityDot(act.ActivityType)
<div class="w-px h-full bg-gray-800 absolute top-6 left-3"></div>
</div>
<div class="flex-1 pb-6">
<div class="flex items-center gap-2">
<span class="text-sm font-medium">{ act.UserName }</span>
<span class={ "text-xs px-1.5 py-0.5 rounded font-medium",
templ.KV("bg-teal-500/10 text-teal-400", act.ActivityType == "upload"),
templ.KV("bg-blue-500/10 text-blue-400", act.ActivityType == "view"),
templ.KV("bg-amber-500/10 text-amber-400", act.ActivityType == "edit"),
templ.KV("bg-purple-500/10 text-purple-400", act.ActivityType == "download"),
templ.KV("bg-gray-700 text-gray-400", act.ActivityType != "upload" && act.ActivityType != "view" && act.ActivityType != "edit" && act.ActivityType != "download") }>
{ act.ActivityType }
</span>
</div>
<p class="text-sm text-gray-400 mt-0.5">{ act.ResourceType }: { act.ResourceName }</p>
<p class="text-xs text-gray-600 mt-1">{ act.CreatedAt.Format("Jan 2, 2006 3:04 PM") }</p>
</div>
</div>
}
</div>
</div>
</div>
}
}
templ activityDot(actType string) {
<div class={ "w-6 h-6 rounded-full flex items-center justify-center shrink-0 z-10",
templ.KV("bg-teal-500/20", actType == "upload"),
templ.KV("bg-blue-500/20", actType == "view"),
templ.KV("bg-amber-500/20", actType == "edit"),
templ.KV("bg-purple-500/20", actType == "download"),
templ.KV("bg-gray-700", actType != "upload" && actType != "view" && actType != "edit" && actType != "download") }>
<div class={ "w-2 h-2 rounded-full",
templ.KV("bg-teal-400", actType == "upload"),
templ.KV("bg-blue-400", actType == "view"),
templ.KV("bg-amber-400", actType == "edit"),
templ.KV("bg-purple-400", actType == "download"),
templ.KV("bg-gray-400", actType != "upload" && actType != "view" && actType != "edit" && actType != "download") }></div>
</div>
}