Skip to content

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.

Apply minor cosmetic changes to admin UI.

Kailash Nadhd9df23c92942
diff --git a/cmd/avatar.go b/cmd/avatar.go
index 5e6b77ce..da093cf3 100644
--- a/cmd/avatar.go
+++ b/cmd/avatar.go
@@ -25,6 +25,24 @@ var avatarColors = map[string][]struct {
{"#edeaff", "#a89aee", "#323052"},
{"#f2ecff", "#ba9feb", "#3c3152"},
},
+ "campaign-template": {
+ {"#fff0e9", "#e8ab91", "#573b2f"},
+ {"#fceee7", "#dfa58b", "#51392e"},
+ {"#fff2e9", "#e9b295", "#573e30"},
+ {"#fcece5", "#e2a18a", "#54372d"},
+ },
+ "campaign-visual-template": {
+ {"#f2eaff", "#bf9ce5", "#463154"},
+ {"#f5ecff", "#c6a2e8", "#4a3457"},
+ {"#efe8fa", "#b698dd", "#403050"},
+ {"#f4e9fc", "#c39be0", "#493153"},
+ },
+ "tx-template": {
+ {"#e3f6fa", "#82c9d8", "#254750"},
+ {"#e5f5fa", "#8ac5d7", "#294550"},
+ {"#e1f5f8", "#79c5d1", "#22474d"},
+ {"#e7f7fa", "#91cdd8", "#2b4950"},
+ },
"subscriber": {
{"#e4f0ff", "#83b8fa", "#203657"},
{"#e2f3ff", "#85c5f5", "#264356"},
@@ -32,16 +50,22 @@ var avatarColors = map[string][]struct {
{"#e1f2ff", "#7ebff9", "#204459"},
},
"user": {
+ {"#edf7e5", "#a4ce86", "#354b29"},
+ {"#eaf5e4", "#98c77f", "#304927"},
+ {"#f0f7e6", "#afcf8b", "#3c4d2b"},
+ {"#e9f5e7", "#94c58a", "#304a2d"},
+ },
+ "user-role": {
{"#faedf2", "#dfa4bb", "#50313e"},
{"#f9edf3", "#d9a5bf", "#4b3143"},
{"#fbedf0", "#e2a7b5", "#52343e"},
{"#f8ecf2", "#d49eb5", "#4c3140"},
},
- "role": {
- {"#edf0f4", "#a6b4c5", "#303c4c"},
- {"#eef1f5", "#afbac9", "#343f4d"},
- {"#ebf0f3", "#a1b5c1", "#2f414a"},
- {"#eef0f5", "#adb3c8", "#373d4e"},
+ "list-role": {
+ {"#fff3df", "#e8be78", "#574222"},
+ {"#fff1dc", "#e5b56f", "#553e20"},
+ {"#faf3df", "#d9bd78", "#504323"},
+ {"#fff0e0", "#e7b582", "#573f28"},
},
}
@@ -56,8 +80,8 @@ type avatar struct {
func makeAvatar(kind, seed, name string) avatar {
colors, ok := avatarColors[kind]
if !ok {
- // Greyish default.
- colors = avatarColors["role"]
+ // Default to the user role palette.
+ colors = avatarColors["user-role"]
}
sum := sha256.Sum256([]byte(kind + ":" + strings.ToLower(strings.TrimSpace(seed))))
diff --git a/i18n/en.json b/i18n/en.json
index f65090d7..2847d7a2 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -243,6 +243,7 @@
"globals.buttons.toggleSelect": "Toggle selection",
"globals.buttons.refresh": "Refresh",
"globals.buttons.view": "View",
+ "globals.buttons.filter": "Filter",
"globals.buttons.search": "Search",
"globals.days.0": "Sun",
"globals.days.1": "Sun",
diff --git a/static/admin/assets/css/style.css b/static/admin/assets/css/style.css
index bcec0565..f690181a 100644
--- a/static/admin/assets/css/style.css
+++ b/static/admin/assets/css/style.css
@@ -682,6 +682,7 @@ td > .empty-state {
.page-content {
margin-block-end: var(--space-6);
+ min-height: 10vh;
&.card.has-table {
padding-block-start: 0;
@@ -761,7 +762,7 @@ td > .empty-state {
}
.actions button.more {
- padding: 0 var(--space-1);
+ padding: var(--space-1);
border-radius: 0;
}
}
@@ -933,6 +934,10 @@ visual-editor {
display: flex;
flex-direction: column;
gap: var(--space-2);
+
+ ot-upload.card {
+ border: 0;
+ }
}
@supports (anchor-name: --a) {
@@ -1162,13 +1167,13 @@ section.campaign {
/* Templates */
section.templates {
- td .badge {
- min-width: 100px;
- }
-
.editor-body {
margin-block: var(--space-3);
}
+
+ a.default {
+ font-weight: bold;
+ }
}
/* Analytics */
@@ -1245,8 +1250,14 @@ section.import {
.actions {
opacity: 0;
position: absolute;
- right: var(--space-2);
- top: var(--space-2);
+ right: var(--space-1);
+ top: var(--space-1);
+
+ .more {
+ min-width: auto;
+ width: auto;
+ padding: var(--space-1);
+ }
}
figure:hover .actions,
@@ -1702,6 +1713,11 @@ section.users {
border: 1px solid var(--border);
border-radius: var(--radius-medium);
box-shadow: var(--shadow-small);
+ transition: box-shadow var(--transition-fast);
+
+ &:is(:hover, :focus-within, :active) {
+ box-shadow: var(--shadow-large);
+ }
}
tbody td:first-child:not([colspan]):not(:has(> input[type="checkbox"])),
diff --git a/static/admin/partials/media-gallery-item.html b/static/admin/partials/media-gallery-item.html
index 1d52d4a5..b0b922ee 100644
--- a/static/admin/partials/media-gallery-item.html
+++ b/static/admin/partials/media-gallery-item.html
@@ -15,7 +15,7 @@
<span class="text-light text-8" x-text="niceDate(m.created_at)"></span>
</figcaption>
<ot-dropdown class="actions">
- <button type="button" class="ghost small icon" aria-label="{{ $root.L.T "globals.buttons.more" }}" popovertarget="attach" :popovertarget="`attach-${idx}`">{{ Icon "more-vertical" }}</button>
+ <button type="button" class="ghost more icon" aria-label="{{ $root.L.T "globals.buttons.more" }}" popovertarget="attach" :popovertarget="`attach-${idx}`">{{ Icon "more-vertical" }}</button>
<menu popover :id="`attach-${idx}`">
<button type="button" role="menuitem" class="ghost" data-variant="danger" :disabled="!canEdit" @click.prevent="onDeleteAttachment(m)">{{ Icon "trash-2" }} {{ $root.L.T "globals.buttons.delete" }}</button>
</menu>
@@ -39,7 +39,7 @@
</figcaption>
{{- if $canManage }}
<ot-dropdown class="actions">
- <button popovertarget="media-actions-{{ $m.ID }}" type="button" class="ghost small icon" aria-label="{{ $root.L.T "globals.buttons.more" }}">{{ Icon "more-vertical" }}</button>
+ <button popovertarget="media-actions-{{ $m.ID }}" type="button" class="ghost more icon" aria-label="{{ $root.L.T "globals.buttons.more" }}">{{ Icon "more-vertical" }}</button>
<menu popover id="media-actions-{{ $m.ID }}">
<button type="button" role="menuitem" class="ghost" data-variant="danger" data-cy="btn-delete" @click.prevent="onDelete({{ $m.ID }}, {{ ToJSON $m.Filename }})">{{ Icon "trash-2" }} {{ $root.L.T "globals.buttons.delete" }}</button>
</menu>
diff --git a/static/admin/views/roles.html b/static/admin/views/roles.html
index a5b74813..eaa63b4d 100644
--- a/static/admin/views/roles.html
+++ b/static/admin/views/roles.html
@@ -39,7 +39,7 @@
<tr data-testid="role-row" data-id="{{ .ID }}">
<td>
<div class="name-stack">
- {{ template "avatar" dict "Kind" "role" "Seed" (printf "%d" .ID) "Name" .Name }}
+ {{ template "avatar" dict "Kind" (printf "%s-role" $d.Type) "Seed" (printf "%d" .ID) "Name" .Name }}
<a href="{{ $base }}/{{ .ID }}" class="unstyled">
{{- if eq .ID 1 }}{{ Badge (list (Icon "star") .Name) "enum" }}{{ else }}{{ .Name }}{{ end -}}
</a>
diff --git a/static/admin/views/template.html b/static/admin/views/template.html
index 5db011e0..d561fa24 100644
--- a/static/admin/views/template.html
+++ b/static/admin/views/template.html
@@ -17,6 +17,11 @@
<div class="col-6">
<div class="hstack gap-1">
<a href="{{ $base }}" class="back" aria-label="{{ .L.T "globals.buttons.back" }}">{{ Icon "chevron-left" }}</a>
+ {{- if not $isNew }}
+ {{- $kind := "campaign-template" -}}
+ {{- if eq $t.Type "tx" }}{{ $kind = "tx-template" }}{{ else if eq $t.Type "campaign_visual" }}{{ $kind = "campaign-visual-template" }}{{ end -}}
+ {{ template "avatar" dict "Kind" $kind "Seed" (printf "%d" $t.ID) "Name" $t.Name }}
+ {{- end }}
<h1 class="page-title">
{{- if $isNew }}{{ .L.T "templates.newTemplate" }}{{ else }}{{ $t.Name }}{{ end -}}
</h1>
diff --git a/static/admin/views/templates.html b/static/admin/views/templates.html
index 46173a91..8b8d55ee 100644
--- a/static/admin/views/templates.html
+++ b/static/admin/views/templates.html
@@ -44,20 +44,27 @@
{{- range $d.Templates }}
<tr data-testid="template-row" data-id="{{ .ID }}">
<td>
- <a href="{{ $base }}/{{ .ID }}" class="unstyled" data-testid="btn-edit">{{ .Name }}</a>
- {{ if .IsDefault }}{{ Badge ($.L.T "templates.default") }}{{ end }}
- {{- if eq .Type "tx" }}<p class="text-light">{{ .Subject }}</p>{{ end }}
+ {{- $kind := "campaign-template" -}}
+ {{- if eq .Type "tx" }}{{ $kind = "tx-template" }}{{ else if eq .Type "campaign_visual" }}{{ $kind = "campaign-visual-template" }}{{ end -}}
+ <div class="name-stack">
+ {{ template "avatar" dict "Kind" $kind "Seed" (printf "%d" .ID) "Name" .Name }}
+ <div>
+ <a href="{{ $base }}/{{ .ID }}" class="unstyled {{ if .IsDefault }}default{{ end }}" data-testid="btn-edit">{{ .Name }}</a>
+ {{ if .IsDefault }}{{ Badge ($.L.T "templates.default") }}{{ end }}
+ {{- if eq .Type "tx" }}<p class="text-light">{{ .Subject }}</p>{{ end }}
+ </div>
+ </div>
</td>
<td>
<div class="hstack">
{{- if eq .Type "tx" }}
- <a href="{{ $base }}?type={{ .Type }}" title="{{ $.L.T "globals.buttons.view" }} {{ $.L.Tc "globals.terms.tx" 1 }}">{{ Badge (list (Icon "terminal") ($.L.Tc "globals.terms.tx" 1)) "enum" }}</a>
+ <a href="{{ $base }}?type={{ .Type }}" title="{{ $.L.T "globals.buttons.filter" }} {{ $.L.Tc "globals.terms.tx" 1 }}">{{ Badge (list (Icon "terminal") ($.L.Tc "globals.terms.tx" 1)) "enum" }}</a>
{{- else }}
- <a href="{{ $base }}?type={{ .Type }}" title="{{ $.L.T "globals.buttons.view" }} {{ $.L.Tc "globals.terms.campaign" 1 }}">{{ Badge (list (Icon "send") ($.L.Tc "globals.terms.campaign" 1)) "enum" }}</a>
+ <a href="{{ $base }}?type={{ .Type }}" title="{{ $.L.T "globals.buttons.filter" }} {{ $.L.Tc "globals.terms.campaign" 1 }}">{{ Badge (list (Icon "send") ($.L.Tc "globals.terms.campaign" 1)) "enum" }}</a>
{{- if eq .Type "campaign_visual" }}
- <a href="{{ $base }}?type={{ .Type }}" title="{{ $.L.T "globals.buttons.view" }} {{ $.L.T "campaigns.contentType.visual" }}">{{ Badge (list (Icon "eye") ($.L.T "campaigns.contentType.visual")) "enum" }}</a>
+ <a href="{{ $base }}?type={{ .Type }}" title="{{ $.L.T "globals.buttons.filter" }} {{ $.L.T "campaigns.contentType.visual" }}">{{ Badge (list (Icon "eye") ($.L.T "campaigns.contentType.visual")) "enum" }}</a>
{{- else }}
- <a href="{{ $base }}?type={{ .Type }}" title="{{ $.L.T "globals.buttons.view" }} HTML">{{ Badge (list (Icon "code") "HTML") "enum" }}</a>
+ <a href="{{ $base }}?type={{ .Type }}" title="{{ $.L.T "globals.buttons.filter" }} HTML">{{ Badge (list (Icon "code") "HTML") "enum" }}</a>
{{- end }}
{{- end }}
</div>
diff --git a/static/admin/views/users.html b/static/admin/views/users.html
index 6723c26d..f2b0fc1d 100644
--- a/static/admin/views/users.html
+++ b/static/admin/views/users.html
@@ -82,8 +82,8 @@
{{- else }}
<span class="{{ if eq .Status "disabled" }}text-danger{{ end }}">{{ .Username }}</span>
{{- end }}
- {{- if eq .Type "api" }}<a href="{{ $base }}?type=api" title="{{ $.L.T "globals.buttons.view" }} {{ $.L.T "users.type.api" }}">{{ Badge (list (Icon "code") ($.L.T "users.type.api")) "tag" }}</a>{{ end }}
- {{- if eq .Status "disabled" }}<a href="{{ $base }}?status=disabled" title="{{ $.L.T "globals.buttons.view" }} {{ $.L.T "users.status.disabled" }}">{{ Badge (list (Dot) ($.L.T "users.status.disabled")) "enum status-disabled" }}</a>{{ end }}
+ {{- if eq .Type "api" }}<a href="{{ $base }}?type=api" title="{{ $.L.T "globals.buttons.filter" }} {{ $.L.T "users.type.api" }}">{{ Badge (list (Icon "code") ($.L.T "users.type.api")) "tag" }}</a>{{ end }}
+ {{- if eq .Status "disabled" }}<a href="{{ $base }}?status=disabled" title="{{ $.L.T "globals.buttons.filter" }} {{ $.L.T "users.status.disabled" }}">{{ Badge (list (Dot) ($.L.T "users.status.disabled")) "enum status-disabled" }}</a>{{ end }}
{{- if .Name }}<div class="text-light text-8">{{ .Name }}</div>{{ end }}
</div>
</div>
@@ -91,15 +91,15 @@
<td data-label="{{ $.L.T "subscribers.email" }}" class="text-light">{{ if .Email.Valid }}{{ .Email.String }}{{ else }}<span class="text-light">&mdash;</span>{{ end }}</td>
<td data-label="{{ $.L.Tc "users.userRole" 1 }}">
<div class="name-stack role-name">
- {{ template "avatar" dict "Kind" "role" "Seed" (printf "%d" .UserRole.ID) "Name" .UserRole.Name }}
- <a href="{{ $base }}?user_role_id={{ .UserRole.ID }}" class="unstyled" title="{{ $.L.T "globals.buttons.view" }} {{ .UserRole.Name }}">{{ .UserRole.Name }}</a>
+ {{ template "avatar" dict "Kind" "user-role" "Seed" (printf "%d" .UserRole.ID) "Name" .UserRole.Name }}
+ <a href="{{ $base }}?user_role_id={{ .UserRole.ID }}" class="unstyled" title="{{ $.L.T "globals.buttons.filter" }} {{ .UserRole.Name }}">{{ .UserRole.Name }}</a>
</div>
</td>
<td data-label="{{ $.L.Tc "users.listRole" 2 }}">
{{- with .ListRole }}
<div class="name-stack role-name">
- {{ template "avatar" dict "Kind" "role" "Seed" (printf "%d" .ID) "Name" .Name }}
- <a href="{{ $base }}?list_role_id={{ .ID }}" class="unstyled" title="{{ $.L.T "globals.buttons.view" }} {{ .Name }}">{{ .Name }}</a>
+ {{ template "avatar" dict "Kind" "list-role" "Seed" (printf "%d" .ID) "Name" .Name }}
+ <a href="{{ $base }}?list_role_id={{ .ID }}" class="unstyled" title="{{ $.L.T "globals.buttons.filter" }} {{ .Name }}">{{ .Name }}</a>
</div>
{{- else }}
<span class="text-light">&mdash;</span>