From 16ee8a7cd5ea98195903ecfd37c558d0cfa9ea94 Mon Sep 17 00:00:00 2001 From: efim Date: Thu, 23 Nov 2023 15:01:51 +0000 Subject: [PATCH] feat: controls styling from gesture info --- rooms/room.go | 28 +++++++++---------- routes/room_page.go | 7 +++-- routes/room_page_templates_preview.go | 4 +-- routes/static/out.css | 27 ++++++++++++++---- routes/templates/room.gohtml | 13 +++++---- routes/templates/tableTemplatesPreview.gohtml | 2 +- 6 files changed, 51 insertions(+), 30 deletions(-) diff --git a/rooms/room.go b/rooms/room.go index 7d306ed..b89fbdb 100644 --- a/rooms/room.go +++ b/rooms/room.go @@ -230,7 +230,7 @@ const ( Meta ) -var GesturesHighToLow = [...]HandGesture{Meta, ClarifyingQ, Expand, ProbingQ, ChangeTopic} +var GesturesHighToLow = [...]HandGesture{4, 3, 2, 1, 0} func GestureFromInt(num int) (HandGesture, bool) { if num >= int(ChangeTopic) && num <= int(Meta) { @@ -245,9 +245,9 @@ func (g HandGesture) String() string { } type GestureInfo struct { - Name string - Color, BgColor template.CSS - IconUrl template.URL + Name string + Color, ColorDark template.CSS + IconUrl template.URL } func (g HandGesture) GetGestureInfo() GestureInfo { @@ -255,28 +255,28 @@ func (g HandGesture) GetGestureInfo() GestureInfo { switch g { case ChangeTopic: result = GestureInfo{ - Color: "--change-topic-color", - BgColor: "--change-topic-dark", + Color: "--change-topic-color", + ColorDark: "--change-topic-dark", } case ProbingQ: result = GestureInfo{ - Color: "--probing-q-color", - BgColor: "--probing-q-dark", + Color: "--probing-q-color", + ColorDark: "--probing-q-dark", } case Expand: result = GestureInfo{ - Color: "--expand-color", - BgColor: "--expand-dark", + Color: "--expand-color", + ColorDark: "--expand-dark", } case ClarifyingQ: result = GestureInfo{ - Color: "--clarifying-q-color", - BgColor: "--clarifying-q-dark", + Color: "--clarifying-q-color", + ColorDark: "--clarifying-q-dark", } case Meta: result = GestureInfo{ - Color: "--meta-color", - BgColor: "--meta-dark", + Color: "--meta-color", + ColorDark: "--meta-dark", } } result.Name = g.String() diff --git a/routes/room_page.go b/routes/room_page.go index 1e2e6dd..35441e5 100644 --- a/routes/room_page.go +++ b/routes/room_page.go @@ -201,14 +201,15 @@ func roomPageRoute( template.New("").ParseFS(templateFs, tableTemplates, templFile, baseFile)) type GestureData struct { - Name string Url string + Gesture rooms.HandGesture } + var gesturesData []GestureData - for gesture := rooms.ChangeTopic; gesture <= rooms.Meta; gesture++ { + for _, gesture := range rooms.GesturesHighToLow { gesturesData = append(gesturesData, GestureData{ - Name: gesture.String(), Url: fmt.Sprintf("%s%d", raiseHandPath, gesture), + Gesture: gesture, }) } diff --git a/routes/room_page_templates_preview.go b/routes/room_page_templates_preview.go index 0f5a5a5..fb4ef6b 100644 --- a/routes/room_page_templates_preview.go +++ b/routes/room_page_templates_preview.go @@ -250,7 +250,7 @@ func roomTemplatesPreview( contentData := struct { DefaultColor template.CSS - Gestures []rooms.HandGesture + GesturePreviews []rooms.HandGesture ABrick brickState TestPerson personData ARoom *roomTableData @@ -260,7 +260,7 @@ func roomTemplatesPreview( TemplateType: "raisedBrick", Gesture: rooms.Expand, }, - Gestures: rooms.GesturesHighToLow[:], + GesturePreviews: rooms.GesturesHighToLow[:], TestPerson: testPersonData, ARoom: &roomTableData{ Room: &aRoom, diff --git a/routes/static/out.css b/routes/static/out.css index 2e218e6..2bb5d8e 100644 --- a/routes/static/out.css +++ b/routes/static/out.css @@ -558,6 +558,10 @@ video { display: flex; } +.table { + display: table; +} + .grid { display: grid; } @@ -684,6 +688,10 @@ video { border-width: 4px; } +.border-\[hsl\(var\(--border-color\)\)\] { + border-color: hsl(var(--border-color)); +} + .border-\[hsl\(var\(--brick-color\)\)\] { border-color: hsl(var(--brick-color)); } @@ -697,11 +705,6 @@ video { border-color: rgb(0 0 0 / var(--tw-border-opacity)); } -.border-blue-700 { - --tw-border-opacity: 1; - border-color: rgb(29 78 216 / var(--tw-border-opacity)); -} - .border-yellow-700 { --tw-border-opacity: 1; border-color: rgb(161 98 7 / var(--tw-border-opacity)); @@ -750,6 +753,11 @@ video { padding: 1rem; } +.px-10 { + padding-left: 2.5rem; + padding-right: 2.5rem; +} + .px-2 { padding-left: 0.5rem; padding-right: 0.5rem; @@ -760,6 +768,11 @@ video { padding-bottom: 0.25rem; } +.py-4 { + padding-top: 1rem; + padding-bottom: 1rem; +} + .text-xl { font-size: 1.25rem; line-height: 1.75rem; @@ -773,6 +786,10 @@ video { color: hsl(var(--brick-color) / 0.5); } +.text-\[hsl\(var\(--text-color\)\)\] { + color: hsl(var(--text-color)); +} + .text-blue-700 { --tw-text-opacity: 1; color: rgb(29 78 216 / var(--tw-text-opacity)); diff --git a/routes/templates/room.gohtml b/routes/templates/room.gohtml index 9dcaf03..efee13d 100644 --- a/routes/templates/room.gohtml +++ b/routes/templates/room.gohtml @@ -29,6 +29,7 @@
+ {{/* This is dynamic table, updated from SSE */}}
{{ end }}
+ {{/* This is personal hand controls */}}
{{ range .Gestures }} {{ end }}
diff --git a/routes/templates/tableTemplatesPreview.gohtml b/routes/templates/tableTemplatesPreview.gohtml index abaf4c5..9463b7a 100644 --- a/routes/templates/tableTemplatesPreview.gohtml +++ b/routes/templates/tableTemplatesPreview.gohtml @@ -9,7 +9,7 @@

speaker

mark

mark and active

- {{ range .Gestures }} + {{ range .GesturePreviews }} {{ with .GetGestureInfo }}
for {{ .Name }}
{{ template "inactiveBrick" . }}