module Web.View.Hubs.Show where
import Web.Types
import Generated.Types
import IHP.Prelude
import IHP.ViewPrelude
data ShowView = ShowView
{ hub :: !Hub
, widgets :: ![Widget]
, recentEvents :: ![InteractionEvent]
, recentAnnotations :: ![Annotation]
}
instance View ShowView where
html ShowView { .. } = [hsx|
{hub.name}
{hub.slug}
{hub.domain}
Recent Events
{length recentEvents}
Recent Annotations
{length recentAnnotations}
Widgets
| Name |
Type |
Status |
Version |
{forEach widgets renderWidgetRow}
Recent Interaction Events
| Event |
Actor |
Occurred |
{forEach recentEvents renderEventRow}
Recent Annotations
{forEach recentAnnotations renderAnnotationCard}
|]
renderWidgetRow :: Widget -> Html
renderWidgetRow w = [hsx|
|
{w.name}
|
{w.widgetType} |
{w.status}
|
v{show w.version} |
|]
renderEventRow :: InteractionEvent -> Html
renderEventRow e = [hsx|
| {e.eventType} |
{e.actorType} |
{show e.occurredAt} |
|]
renderAnnotationCard :: Annotation -> Html
renderAnnotationCard a = [hsx|
{a.category}
{a.actorType}
{a.body}
|]