From b283bb02882f8676fbabc34b15838faee7d63a87 Mon Sep 17 00:00:00 2001 From: Jonni Liljamo Date: Fri, 6 Oct 2023 13:53:05 +0300 Subject: [PATCH] feat: demo patches * disclaimer at top * build script * umami for usage data --- Dockerfile | 5 ++--- scripts/demobuildpublish.elv | 7 +++++++ static/demo.js | 21 +++++++++++++++++++++ static/styles.css | 22 ++++++++++++++++++---- template/templates/common/base.tmpl | 22 ++++++++++++++++++---- template/templates/index.tmpl | 8 ++++---- template/templates/linkedit.tmpl | 14 +++++++------- template/templates/login.tmpl | 2 +- template/templates/settings.tmpl | 4 ++-- template/templates/tags.tmpl | 8 ++++---- 10 files changed, 84 insertions(+), 29 deletions(-) create mode 100755 scripts/demobuildpublish.elv create mode 100644 static/demo.js diff --git a/Dockerfile b/Dockerfile index edcdcb8..18946a6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,12 +10,11 @@ RUN go mod download && go mod verify COPY . . -RUN --mount=type=cache,target=/root/.cache/go-build \ -CGO_ENABLED=0 GOOS=linux go build -ldflags=-X=main.version=${VERSION} -v -o /tixe ./tixe.go +RUN CGO_ENABLED=0 GOOS=linux go build -ldflags=-X=main.version=${VERSION} -v -o /tixe ./tixe.go # tester FROM builder AS tester -RUN --mount=type=cache,target=/root/.cache/go-build go test -v ./... +RUN go test -v ./... # release FROM alpine:3.18 AS release diff --git a/scripts/demobuildpublish.elv b/scripts/demobuildpublish.elv new file mode 100755 index 0000000..b7b80ba --- /dev/null +++ b/scripts/demobuildpublish.elv @@ -0,0 +1,7 @@ +#!/usr/bin/env elvish + +var version = 'demo-'(git describe --tags) +var image = 'registry.liljamo.dev/skye/tixe:'$version + +docker build -t $image . --build-arg 'VERSION='$version +docker push $image diff --git a/static/demo.js b/static/demo.js new file mode 100644 index 0000000..4d1e8a6 --- /dev/null +++ b/static/demo.js @@ -0,0 +1,21 @@ +const formsToTrack = [ + { "submit_id": "settings_submit_displayname", "form_id": "settings_form_displayname", "event": "settings-update-displayname" }, + { "submit_id": "linkedit_submit_delete", "form_id": "linkedit_form_delete", "event": "linkedit-delete" }, + { "submit_id": "linkedit_submit_visual", "form_id": "linkedit_form_visual", "event": "linkedit-update-visual" }, + { "submit_id": "linkedit_submit_link", "form_id": "linkedit_form_link", "event": "linkedit-update-link" }, + { "submit_id": "tags_submit_delete", "form_id": "tags_form_delete", "event": "tags-delete" }, + { "submit_id": "tags_submit_new", "form_id": "tags_form_new", "event": "tags-new" }, + { "submit_id": "index_submit_link_new", "form_id": "index_form_link_new", "event": "index-link-new" }, +]; + +for (var i = 0; i < formsToTrack.length; i++) { + const obj = formsToTrack[i]; + const submit = document.getElementById(obj.submit_id); + + if (submit == null) { + continue; + } + + submit.setAttribute("type", "button"); + submit.setAttribute("onclick", `umami.track('${obj.event}').then(function() {document.getElementById('${obj.form_id}').submit()})`) +} diff --git a/static/styles.css b/static/styles.css index 5f331cd..c0f451d 100644 --- a/static/styles.css +++ b/static/styles.css @@ -767,6 +767,11 @@ video { border-bottom-width: 2px; } +.bg-rose-200 { + --tw-bg-opacity: 1; + background-color: rgb(254 205 211 / var(--tw-bg-opacity)); +} + .bg-slate-50 { --tw-bg-opacity: 1; background-color: rgb(248 250 252 / var(--tw-bg-opacity)); @@ -877,6 +882,10 @@ video { padding-right: 1rem; } +.text-center { + text-align: center; +} + .text-lg { font-size: 1.125rem; line-height: 1.75rem; @@ -901,15 +910,20 @@ video { font-weight: 700; } -.text-transparent { - color: transparent; -} - .text-amber-500 { --tw-text-opacity: 1; color: rgb(245 158 11 / var(--tw-text-opacity)); } +.text-orange-500 { + --tw-text-opacity: 1; + color: rgb(249 115 22 / var(--tw-text-opacity)); +} + +.text-transparent { + color: transparent; +} + .opacity-0 { opacity: 0; } diff --git a/template/templates/common/base.tmpl b/template/templates/common/base.tmpl index 816c8bc..649760b 100644 --- a/template/templates/common/base.tmpl +++ b/template/templates/common/base.tmpl @@ -2,6 +2,8 @@ + + @@ -13,9 +15,20 @@
+
+

This is a demo instance.

+

+ Data on this instance is wiped every hour, on the hour. + During that time (usually a minute or two), the site will be unreachable. +

+

+ umami is used to collect usage data on the demo, the data is + viewable here +

+
-
@@ -34,7 +47,7 @@ {{ else if ne .user nil }} - Logout + Logout {{ end }}
@@ -51,6 +64,7 @@
+ {{ end }} diff --git a/template/templates/index.tmpl b/template/templates/index.tmpl index b13a674..f7b54d1 100644 --- a/template/templates/index.tmpl +++ b/template/templates/index.tmpl @@ -9,7 +9,7 @@
New link
- -
+

Visual

-
-
+

Link

-
diff --git a/template/templates/login.tmpl b/template/templates/login.tmpl index 20fd55a..b5dbeb2 100644 --- a/template/templates/login.tmpl +++ b/template/templates/login.tmpl @@ -1,6 +1,6 @@ {{ define "content" }}

Login

- diff --git a/template/templates/settings.tmpl b/template/templates/settings.tmpl index 985b197..b4957be 100644 --- a/template/templates/settings.tmpl +++ b/template/templates/settings.tmpl @@ -7,11 +7,11 @@ Settings

- +

Display Name

-
diff --git a/template/templates/tags.tmpl b/template/templates/tags.tmpl index 8991936..21c4b64 100644 --- a/template/templates/tags.tmpl +++ b/template/templates/tags.tmpl @@ -6,11 +6,11 @@ > Tags

- +

New Tag

-