Redesign the UI on brain's look: sidebar with search, Overview, modules, grouped Settings

- Left sidebar as in brain: search at the top (press /), Overview,
  Inventory, the modules (Content with Inbox, Sources, Scheduled and
  Published; later phases greyed out), Settings at the bottom; a top bar
  with breadcrumbs, and a menu that slides in on narrow screens.
- brain's colour tokens, type, radius and shadows, with a dark theme that
  follows the system setting.
- Settings as grouped tabs: Profile; Social accounts (was Credentials, now
  keys and sign-in together per network); Core & Hermes; AI, which now
  holds the API keys too. Old addresses redirect.
- /search matches every word across posts, fetched items, the inventory,
  products and settings pages.
- Overview: a card per module, then the setup checklist, folded once done.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-21 07:50:24 -07:00
co-authored by Claude Opus 5.5
parent 81a7d0596c
commit a89121f1ec
29 changed files with 1141 additions and 364 deletions
+37
View File
@@ -0,0 +1,37 @@
{{define "content"}}{{template "settings-start" .}}{{with .Data}}{{$set := .Set}}
<h2>Social accounts</h2>
<p class="lede">The keys Supermarket reads posts with, and the sign-ins it publishes with. Keys are kept in <code>secrets.json</code> in Supermarket's data folder, readable only by you; saved values are never shown, and an empty field keeps what's saved.</p>
{{/* The key fields of every card belong to this one form (form="accounts"),
so each card's Save saves them all, and the sign-in forms aren't nested. */}}
<form method="post" action="/settings/accounts" id="accounts"></form>
{{range .Networks}}{{$name := .Name}}
<section class="card network">
<h2>{{.Name}}
{{with .Connect}}{{if .Signed}}<span class="badge published">connected{{with .Account}} as {{.}}{{end}}</span>{{else}}<span class="badge">not connected</span>{{end}}{{end}}
</h2>
{{range .Fields}}
<div class="secret">
<label>{{.Label}}
<input type="password" name="{{.Name}}" form="accounts" autocomplete="off" placeholder="{{if index $set .Name}}saved — type to replace{{else}}not set{{end}}">
{{if .Help}}<span class="help">{{.Help}}</span>{{end}}
</label>
{{if index $set .Name}}<label class="check small"><input type="checkbox" name="remove:{{.Name}}" form="accounts"> remove</label>{{end}}
</div>
{{end}}
<button type="submit" form="accounts" class="secondary">Save keys</button>
{{with .Connect}}
<div class="signin">
<h3>Sign in to post</h3>
{{if .Signed}}<p>Connected{{with .Account}} as <strong>{{.}}</strong>{{end}}{{if not .At.IsZero}}, {{ago .At}}{{end}}.</p>{{end}}
<p class="help">{{.Setup}} <code>{{.Redirect}}</code>{{with .Note}}<br>{{.}}{{end}}</p>
<form method="post" action="/auth/{{.Provider}}/start">
<button type="submit" {{if not .Ready}}disabled title="Save the client ID{{if ne .Provider "x"}} and secret{{end}} first"{{end}}>{{if .Signed}}Reconnect{{else}}Connect{{end}} {{$name}}</button>
</form>
</div>
{{end}}
</section>
{{end}}
{{end}}{{template "settings-end"}}{{end}}
+36 -28
View File
@@ -1,32 +1,39 @@
{{define "content"}}{{with .Data}}{{$cfg := .Cfg}}
<nav class="tabs">
<a href="/settings/ai" aria-current="page">AI provider</a>
<a href="/settings/credentials">Credentials</a>
</nav>
<h1>AI provider</h1>
{{define "content"}}{{template "settings-start" .}}{{with .Data}}{{$cfg := .Cfg}}{{$set := .Set}}
<h2>AI</h2>
<p class="lede">The model Supermarket writes with: drafts, the profile draft, and later the other modules. It's called directly, never through Hermes, so text read from the web can't reach an agent with tools.</p>
<form method="post" action="/settings/ai" id="ai-form">
<form method="post" action="/settings/ai" id="ai-form" autocomplete="off">
<section class="card">
<fieldset class="choice">
<legend>Provider</legend>
<label class="check"><input type="radio" name="provider" value="anthropic" {{if ne $cfg.Provider "openai"}}checked{{end}} data-toggle="provider">
Anthropic (Claude)
{{if .HasAnthropicKey}}<span class="help">— with the key saved under <a href="/settings/credentials">Credentials</a></span>
{{else if .Shared}}<span class="help">— with Hermes' key, shared by <code>supermarket hermes</code> (Hermes uses {{.Shared.Model}}). A key saved under <a href="/settings/credentials">Credentials</a> would take its place.</span>
{{else}}<span class="help">— add the API key under <a href="/settings/credentials">Credentials</a>, or share Hermes' by running <code>supermarket hermes</code></span>{{end}}</label>
<label class="check"><input type="radio" name="provider" value="anthropic" {{if ne $cfg.Provider "openai"}}checked{{end}} data-toggle="provider"> Anthropic (Claude)</label>
<label class="check"><input type="radio" name="provider" value="openai" {{if eq $cfg.Provider "openai"}}checked{{end}} data-toggle="provider">
A server on your network (Ollama, LM Studio, llama.cpp, vLLM) or another OpenAI-compatible service</label>
</fieldset>
</section>
<div data-show-for="openai">
<label>Server address <input name="base_url" id="base_url" value="{{$cfg.BaseURL}}" placeholder="http://192.168.1.20:11434" list="servers">
<span class="help">Supermarket runs in Docker: for a server on this computer use <code>http://host.docker.internal:11434</code>, and use an IP address rather than a <code>.local</code> name.</span></label>
<datalist id="servers">{{range .Servers}}<option value="{{.BaseURL}}">{{.Name}}</option>{{end}}</datalist>
{{if .Servers}}<p class="help">Found by CoreDesktop's <code>configure ai-servers</code>: {{range $i, $s := .Servers}}{{if $i}}, {{end}}{{$s.Name}} ({{$s.BaseURL}}){{end}}.</p>{{end}}
<button type="button" class="secondary" hx-get="/settings/ai/models" hx-include="#base_url" hx-target="#model-list">List its models</button>
<div id="model-list"></div>
</div>
<section class="card" data-show-for="anthropic">
<h3>Key</h3>
{{if .HasAnthropicKey}}<p class="ok">Using the key saved here.</p>
{{else if .Shared}}<p class="ok">Using Hermes' key, shared by <code>supermarket hermes</code>. Hermes uses {{.Shared.Model}}.</p>
<p class="help">To use a separate key, for example to see Supermarket's costs apart from Hermes', save it below: it takes the place of Hermes'.</p>
{{else}}<p class="warn-text">No key yet. Save one below, or share Hermes' by running <code>supermarket hermes</code>.</p>{{end}}
{{range .Keys}}{{if eq .Group "anthropic"}}{{template "key-field" (dict "F" . "Set" (index $set .Name))}}{{end}}{{end}}
</section>
<section class="card" data-show-for="openai">
<h3>Server</h3>
<label>Address <input name="base_url" id="base_url" value="{{$cfg.BaseURL}}" placeholder="http://192.168.1.20:11434" list="servers">
<span class="help">Supermarket runs in Docker: for a server on this computer use <code>http://host.docker.internal:11434</code>, and use an IP address rather than a <code>.local</code> name.</span></label>
<datalist id="servers">{{range .Servers}}<option value="{{.BaseURL}}">{{.Name}}</option>{{end}}</datalist>
{{if .Servers}}<p class="help">Found by CoreDesktop's <code>configure ai-servers</code>: {{range $i, $s := .Servers}}{{if $i}}, {{end}}{{$s.Name}} ({{$s.BaseURL}}){{end}}.</p>{{end}}
<button type="button" class="secondary" hx-get="/settings/ai/models" hx-include="#base_url" hx-target="#model-list">List its models</button>
<div id="model-list"></div>
{{range .Keys}}{{if eq .Group "openai"}}{{template "key-field" (dict "F" . "Set" (index $set .Name))}}{{end}}{{end}}
</section>
<section class="card">
<h3>Model</h3>
<label>Model <input name="model" value="{{$cfg.Model}}" list="anthropic-models" required></label>
<datalist id="anthropic-models">{{range .AnthropicModels}}<option value="{{.}}">{{end}}</datalist>
@@ -36,14 +43,14 @@
</select>
<span class="help">How hard the model thinks. Medium suits drafting; higher costs more and takes longer.</span>
</label>
</section>
<section class="card">
<h2>Model per task</h2>
<p class="help">Leave empty to use the model above. Same provider.</p>
{{range .Tasks}}
<label>{{.Label}} <input name="task_{{.ID}}" value="{{index $cfg.TaskModels .ID}}" list="anthropic-models"></label>
{{end}}
<details>
<summary>A different model per task</summary>
<p class="help">Leave empty to use the model above. Same provider.</p>
{{range .Tasks}}
<label>{{.Label}} <input name="task_{{.ID}}" value="{{index $cfg.TaskModels .ID}}" list="anthropic-models"></label>
{{end}}
</details>
</section>
<div class="actions">
@@ -51,9 +58,10 @@
<button type="button" class="secondary" hx-post="/settings/ai/test" hx-include="#ai-form" hx-target="#test-result" hx-indicator="#testing">Test</button>
<span id="testing" class="htmx-indicator">Asking the model…</span>
</div>
<p class="help">Test uses the provider and model in the form, and the keys already saved: save a new key before testing it.</p>
<div id="test-result"></div>
</form>
{{end}}{{end}}
{{end}}{{template "settings-end"}}{{end}}
{{define "test-result"}}
{{if .Error}}<p class="error">{{.Error}}</p>
+5 -10
View File
@@ -1,21 +1,16 @@
{{define "content"}}{{with .Data}}
<nav class="tabs">
<a href="/content" aria-current="page">Sources</a>
<a href="/content/scheduled">Scheduled</a>
<a href="/content/published">Published</a>
</nav>
<div class="heading">
<h1>{{.Name}} <span class="badge {{.Entry.Relationship}}">{{.Entry.Relationship}}</span></h1>
<div class="buttons">
<form method="post" action="{{.Base}}/fetch" data-busy="Fetching…">
<button type="submit" {{if not .Sources}}disabled{{end}}>Fetch new</button>
</form>
{{if .Own}}<a class="button secondary" href="/profile">Edit profile</a>{{else}}<a class="button secondary" href="/inventory/{{.Entry.ID}}">Edit entry</a>{{end}}
{{if .Own}}<a class="button secondary" href="/settings/profile">Edit profile</a>{{else}}<a class="button secondary" href="/inventory/{{.Entry.ID}}">Edit entry</a>{{end}}
</div>
</div>
<p class="lede">
{{if .Own}}Posts that promote your own work: pick a product, or fetch your feeds and new pages on your websites.
{{if .Sources}}Reads {{join .Sources ", "}}.{{else}}Add your blog and release feeds, and your websites, to the <a href="/profile">profile</a> to fetch them.{{end}}
{{if .Sources}}Reads {{join .Sources ", "}}.{{else}}Add your blog and release feeds, and your websites, to the <a href="/settings/profile">profile</a> to fetch them.{{end}}
{{else}}{{if .Sources}}Reads {{join .Sources ", "}}.{{else}}This entry has no sources yet: add an X handle, hashtags, a YouTube channel or RSS feeds to it.{{end}}{{end}}
Last fetched {{ago .LastChecked}}; the next fetch looks for posts since {{.Since.Local.Format "2 Jan 15:04"}}.
</p>
@@ -25,7 +20,7 @@
<p><strong>{{if .NewItems}}{{.NewItems}} new item{{if ne .NewItems 1}}s{{end}}.{{else}}Nothing new.{{end}}</strong></p>
{{if .Errors}}<p class="warn-text">Some sources failed; they'll be read from the same point next time:</p>
<ul>{{range .Errors}}<li>{{.}}</li>{{end}}</ul>{{end}}
{{if .Skipped}}<p class="muted">Skipped, for lack of credentials (<a href="/settings/credentials">add them</a>): {{join .Skipped "; "}}.</p>{{end}}
{{if .Skipped}}<p class="muted">Skipped, for lack of credentials (<a href="/settings/accounts">add them</a>): {{join .Skipped "; "}}.</p>{{end}}
</section>
{{end}}
@@ -78,7 +73,7 @@
{{else}}
<section class="card">
<h2>Write drafts from the selected items</h2>
{{if not .ProfileSet}}<p class="warn-text">Fill in the <a href="/profile">company profile</a> first: drafts are written in its voice.</p>{{end}}
{{if not .ProfileSet}}<p class="warn-text">Fill in the <a href="/settings/profile">company profile</a> first: drafts are written in its voice.</p>{{end}}
<fieldset class="choice">
<legend>Channels</legend>
{{range .Channels}}
@@ -105,7 +100,7 @@
</form>
{{else}}
<section class="card empty">
<p>{{if .ShowDismissed}}Nothing dismissed.{{else if .Own}}No products or news yet: add products, feeds or websites to your <a href="/profile">profile</a>, then fetch.{{else}}No items yet. Fetch to see what {{.Name}} has been up to.{{end}}</p>
<p>{{if .ShowDismissed}}Nothing dismissed.{{else if .Own}}No products or news yet: add products, feeds or websites to your <a href="/settings/profile">profile</a>, then fetch.{{else}}No items yet. Fetch to see what {{.Name}} has been up to.{{end}}</p>
</section>
{{end}}
{{end}}{{end}}
@@ -1,9 +1,4 @@
{{define "content"}}{{with .Data}}
<nav class="tabs">
<a href="/content">Sources</a>
<a href="/content/scheduled">Scheduled</a>
<a href="/content/published" aria-current="page">Published</a>
</nav>
<h1>Published</h1>
<p class="lede">The last 200 posts Supermarket published.</p>
@@ -1,9 +1,4 @@
{{define "content"}}{{with .Data}}{{$conn := .Connected}}
<nav class="tabs">
<a href="/content">Sources</a>
<a href="/content/scheduled" aria-current="page">Scheduled</a>
<a href="/content/published">Published</a>
</nav>
<h1>Scheduled</h1>
<p class="lede">Approved posts, in the order they go out ({{.Zone}}). Supermarket publishes them on time as long as it's running; one more than 12 hours late goes back to the Inbox instead.</p>
+2 -7
View File
@@ -1,10 +1,5 @@
{{define "content"}}{{with .Data}}
<nav class="tabs">
<a href="/content" aria-current="page">Sources</a>
<a href="/content/scheduled">Scheduled</a>
<a href="/content/published">Published</a>
</nav>
<h1>Content</h1>
<h1>Sources</h1>
<p class="lede">Pick an inventory entry to fetch its latest news, choose what to write about, and get a draft for each channel to review in the <a href="/inbox">Inbox</a>.</p>
{{if .Rows}}
@@ -16,7 +11,7 @@
{{if .Own}}
<td><a href="/content/own">{{.Name}}</a> <span class="muted small">your own work</span></td>
<td><span class="badge product">product</span></td>
<td>{{if .Sources}}{{join .Sources ", "}}{{else}}<span class="muted">none: add products, websites or feeds to your <a href="/profile">profile</a></span>{{end}}</td>
<td>{{if .Sources}}{{join .Sources ", "}}{{else}}<span class="muted">none: add products, websites or feeds to your <a href="/settings/profile">profile</a></span>{{end}}</td>
{{else}}
<td><a href="/content/{{.Entry.ID}}">{{.Name}}</a></td>
<td><span class="badge {{.Entry.Relationship}}">{{.Entry.Relationship}}</span></td>
+5 -4
View File
@@ -1,12 +1,13 @@
{{define "content"}}{{with .Data}}
<h1>Core &amp; Hermes</h1>
{{define "content"}}{{template "settings-start" .}}{{with .Data}}
<h2>Core &amp; Hermes</h2>
<p class="lede">Your Federated Core's services, and Hermes, the agent that reaches them for Supermarket.</p>
<section class="card">
<h2>Federated Core</h2>
{{if .Core}}
<p><strong>{{.Core.Domain}}</strong> · {{.Core.Email}}{{if .Core.Name}} · {{.Core.Name}}{{end}}</p>
<p class="help">From CoreDesktop's <code>configure core</code>. To use another Core, change it there and run <code>update</code>.</p>
<div hx-get="/core/checks" hx-trigger="load" hx-swap="outerHTML"><p class="help">Checking the Core's services…</p></div>
<div hx-get="/settings/core/checks" hx-trigger="load" hx-swap="outerHTML"><p class="help">Checking the Core's services…</p></div>
{{else}}
<p>No Core found. Run <code>configure core</code> in CoreDesktop, then <code>update</code>. Without a Core, everything works except EspoCRM, Plausible and publishing through Gitea.</p>
{{end}}
@@ -41,7 +42,7 @@
<p>Hermes runs in CoreDesktop's sandbox, so also let it reach the hub: add <code>mcphub.{{if .Core}}{{.Core.Domain}}{{else}}&lt;your Core's domain&gt;{{end}}</code> to <code>network.allowedDomains</code> in <code>~/.config/coredesktop/sandbox/hermes.json</code>. Then restart Hermes' gateway: <code>systemctl --user restart hermes-gateway</code>.</p>
<details><summary>Show the MCP token</summary><pre>{{.MCPToken}}</pre><p class="help">Also in <code>mcp-token</code> in the data folder.</p></details>
</details>
{{end}}{{end}}
{{end}}{{template "settings-end"}}{{end}}
{{define "checks"}}
{{if .}}
-51
View File
@@ -1,51 +0,0 @@
{{define "content"}}{{with .Data}}{{$set := .Set}}
<nav class="tabs">
<a href="/settings/ai">AI provider</a>
<a href="/settings/credentials" aria-current="page">Credentials</a>
</nav>
<h1>Credentials</h1>
<p class="lede">Kept in <code>secrets.json</code> in Supermarket's data folder, readable only by you. Saved values are never shown: leave a field empty to keep what's saved.</p>
<form method="post" action="/settings/credentials">
{{$group := ""}}
{{range .Fields}}
{{if ne .Group $group}}{{if $group}}</section>{{end}}{{$group = .Group}}<section class="card"><h2>{{.Group}}</h2>{{end}}
<div class="secret">
<label>{{.Label}}
<input type="password" name="{{.Name}}" autocomplete="off" placeholder="{{if index $set .Name}}saved — type to replace{{else}}not set{{end}}">
{{if .Help}}<span class="help">{{.Help}}</span>{{end}}
</label>
{{if index $set .Name}}<label class="check small"><input type="checkbox" name="remove:{{.Name}}"> remove</label>{{end}}
</div>
{{end}}
{{if $group}}</section>{{end}}
<div class="actions"><button type="submit">Save</button></div>
</form>
<section class="card">
<h2>Sign in to post</h2>
<div class="connect">
<div>
<h3>X</h3>
{{with index .Connections "x"}}{{if .Account}}<p>Connected as @{{.Account}}, {{ago .At}}.</p>{{end}}{{end}}
{{if and (index $set .XToken) (not (index .Connections "x").Account)}}<p>A token is saved.</p>{{end}}
<p class="help">In the X developer portal, add this callback URL to your app: <code>{{.XRedirect}}</code></p>
<form method="post" action="/auth/x/start"><button type="submit" {{if not (index $set "x.client_id")}}disabled{{end}}>{{if index $set .XToken}}Reconnect{{else}}Connect{{end}} X</button></form>
</div>
<div>
<h3>LinkedIn</h3>
{{with index .Connections "linkedin"}}{{if .Account}}<p>Connected, {{ago .At}}.</p>{{end}}{{end}}
{{if and (index $set .LIToken) (not (index .Connections "linkedin").Account)}}<p>A token is saved.</p>{{end}}
<p class="help">In your LinkedIn app's Auth settings, add this redirect URL: <code>{{.LIRedirect}}</code></p>
<form method="post" action="/auth/linkedin/start"><button type="submit" {{if not (and (index $set "linkedin.client_id") (index $set "linkedin.client_secret"))}}disabled{{end}}>{{if index $set .LIToken}}Reconnect{{else}}Connect{{end}} LinkedIn</button></form>
</div>
<div>
<h3>Reddit</h3>
{{with index .Connections "reddit"}}{{if .Account}}<p>Connected as u/{{.Account}}, {{ago .At}}.</p>{{end}}{{end}}
<p class="help">At reddit.com/prefs/apps, create a <strong>web app</strong> with this redirect URI: <code>{{.RedditRedirect}}</code>.
Reddit's API terms need approval for commercial use: Supermarket is meant for a few hand-approved posts, not volume.</p>
<form method="post" action="/auth/reddit/start"><button type="submit" {{if not (and (index $set "reddit.client_id") (index $set "reddit.client_secret"))}}disabled{{end}}>{{if index $set .RedditToken}}Reconnect{{else}}Connect{{end}} Reddit</button></form>
</div>
</div>
</section>
{{end}}{{end}}
+33 -12
View File
@@ -1,6 +1,27 @@
{{define "content"}}{{with .Data}}
<h1>Overview</h1>
{{define "content"}}{{$inbox := .Inbox}}{{with .Data}}
<div class="page-head">
<h1>Overview</h1>
<p class="lede">Supermarket's modules, and what's left to set up.</p>
</div>
<div class="grid">
{{range .Modules}}
{{if .Link}}
<a class="card module" href="{{.Link}}">
<h3>{{template "icon" .ID}}{{.Name}} <span class="badge">{{.Phase}}</span></h3>
<p>{{.Body}}</p>
{{if eq .ID "content"}}<span class="stat">{{if $inbox}}{{$inbox}} waiting in the Inbox{{else}}Inbox empty{{end}}{{with $.Data.Scheduled}} · {{.}} scheduled{{end}}</span>{{end}}
</a>
{{else}}
<section class="card module later">
<h3>{{template "icon" .ID}}{{.Name}} <span class="badge">{{.Phase}}</span></h3>
<p>{{.Body}}</p>
</section>
{{end}}
{{end}}
</div>
{{if .Pending}}
<section class="card">
<h2>Setup</h2>
<ul class="steps">
@@ -12,6 +33,16 @@
{{end}}
</ul>
</section>
{{else}}
<details class="card">
<summary>Setup: all done</summary>
<ul class="steps">
{{range .Steps}}
<li class="done"><a href="{{.Link}}"><strong>{{.Label}}</strong></a><span>{{.Detail}}</span></li>
{{end}}
</ul>
</details>
{{end}}
{{if .ImportErr}}
<section class="card warn">
@@ -26,14 +57,4 @@
{{if .QueuedPosts}}<p>Its queued posts are now drafts: <a href="/inbox">{{.QueuedPosts}} waiting in the Inbox</a>.</p>{{end}}
</details>
{{end}}
<h2>Modules</h2>
<div class="grid">
{{range .Modules}}
<section class="card module">
<h3>{{if .Link}}<a href="{{.Link}}">{{.Name}}</a>{{else}}{{.Name}}{{end}} <span class="badge">{{.Phase}}</span></h3>
<p>{{.Body}}</p>
</section>
{{end}}
</div>
{{end}}{{end}}
+2 -2
View File
@@ -44,7 +44,7 @@
<p class="count{{if .TooLong}} over{{end}}" id="count-{{.ID}}">{{.Length}} / {{.Limit}}{{if and (eq .Channel "x") .SourceURL}} including the link{{end}}</p>
<div class="actions">
<button type="submit" name="action" value="publish" formaction="/drafts/{{.ID}}/publish"
{{if not (index $conn .Channel)}}disabled title="Sign in to {{.ChannelName}} under Settings → Credentials"{{end}}>Publish now</button>
{{if not (index $conn .Channel)}}disabled title="Sign in to {{.ChannelName}} under Settings → Social accounts"{{end}}>Publish now</button>
<button type="submit" class="secondary">Save</button>
</div>
<div class="schedule">
@@ -53,7 +53,7 @@
</label>
<button type="submit" class="secondary" formaction="/drafts/{{.ID}}/schedule">Schedule</button>
</div>
{{if not (index $conn .Channel)}}<p class="help">{{.ChannelName}} isn't connected: <a href="/settings/credentials">sign in</a> before it's due.</p>{{end}}
{{if not (index $conn .Channel)}}<p class="help">{{.ChannelName}} isn't connected: <a href="/settings/accounts">sign in</a> before it's due.</p>{{end}}
</form>
<form method="post" action="/drafts/{{.ID}}/discard" data-confirm="Discard this {{.Where}} draft?">
<button type="submit" class="danger small">Discard</button>
+109 -17
View File
@@ -10,23 +10,115 @@
<script src="/static/app.js" defer></script>
</head>
<body>
<header class="topbar">
<a class="brand" href="/">Super<span>market</span></a>
<nav>
<a href="/" {{if eq .Nav "home"}}aria-current="page"{{end}}>Overview</a>
<a href="/profile" {{if eq .Nav "profile"}}aria-current="page"{{end}}>Profile</a>
<a href="/inbox" {{if eq .Nav "inbox"}}aria-current="page"{{end}}>Inbox{{if .Inbox}} <span class="count-badge">{{.Inbox}}</span>{{end}}</a>
<a href="/content" {{if eq .Nav "content"}}aria-current="page"{{end}}>Content</a>
<a href="/inventory" {{if eq .Nav "inventory"}}aria-current="page"{{end}}>Inventory</a>
<a href="/settings/ai" {{if eq .Nav "settings"}}aria-current="page"{{end}}>Settings</a>
<a href="/core" {{if eq .Nav "core"}}aria-current="page"{{end}}>Core &amp; Hermes</a>
<div class="shell">
<aside class="sidebar" id="sidebar">
<a class="brand" href="/"><span class="logo">{{template "icon" "cart"}}</span>Supermarket</a>
<form class="search" action="/search" method="get" role="search">
{{template "icon" "search"}}
<input type="search" name="q" value="{{.Query}}" placeholder="Search" aria-label="Search" id="search-box">
<kbd title="Press / to search">/</kbd>
</form>
<nav class="nav" aria-label="Main">
<a href="/" {{if eq .Nav "home"}}aria-current="page"{{end}}>{{template "icon" "overview"}}<span>Overview</span></a>
<a href="/inventory" {{if eq .Nav "inventory"}}aria-current="page"{{end}}>{{template "icon" "inventory"}}<span>Inventory</span></a>
<div class="nav-label">Modules</div>
{{$nav := .Nav}}{{$inbox := .Inbox}}
{{range .Modules}}
{{if .Link}}
<a href="{{.Link}}" {{if eq $nav .ID}}aria-current="page"{{end}} class="{{if hasPrefix $nav .ID}}open{{end}}">{{template "icon" .ID}}<span>{{.Name}}</span></a>
{{if eq .ID "content"}}
<div class="subnav">
<a href="/inbox" {{if eq $nav "content/inbox"}}aria-current="page"{{end}}>Inbox{{if $inbox}} <span class="count-badge" title="{{$inbox}} waiting for review">{{$inbox}}</span>{{end}}</a>
<a href="/content" {{if eq $nav "content/sources"}}aria-current="page"{{end}}>Sources</a>
<a href="/content/scheduled" {{if eq $nav "content/scheduled"}}aria-current="page"{{end}}>Scheduled</a>
<a href="/content/published" {{if eq $nav "content/published"}}aria-current="page"{{end}}>Published</a>
</div>
{{end}}
{{else}}
<span class="soon" title="{{.Body}}">{{template "icon" .ID}}<span>{{.Name}}</span><small>{{.Phase}}</small></span>
{{end}}
{{end}}
</nav>
</header>
<main>
{{if .Flash}}<p class="flash" role="status">{{.Flash}}</p>{{end}}
{{if .Error}}<p class="error" role="alert">{{.Error}}</p>{{end}}
{{template "content" .}}
</main>
<footer>Supermarket {{.Version}}</footer>
<div class="sidebar-foot">
<a href="/settings/profile" {{if hasPrefix .Nav "settings"}}aria-current="page"{{end}}>{{template "icon" "settings"}}<span>Settings</span></a>
<p class="version">Supermarket {{.Version}}</p>
</div>
</aside>
<div class="scrim" data-nav-close></div>
<div class="main-col">
<header class="topbar">
<button type="button" class="icon-button menu-button" data-nav-toggle aria-controls="sidebar" aria-label="Open navigation">{{template "icon" "menu"}}</button>
<nav class="crumbs" aria-label="Breadcrumb">
{{with .Section}}<span>{{.}}</span><span class="sep" aria-hidden="true">/</span>{{end}}
<span class="here">{{.Title}}</span>
</nav>
</header>
<main>
{{if .Flash}}<p class="flash" role="status">{{.Flash}}</p>{{end}}
{{if .Error}}<p class="error" role="alert">{{.Error}}</p>{{end}}
{{template "content" .}}
</main>
</div>
</div>
</body>
</html>
{{/* Settings pages share this frame: a heading, and the tabs on the left
(grouped, as in brain). Call with the page: {{template "settings-start" $}}
… {{template "settings-end"}}. */}}
{{define "settings-start"}}
<div class="page-head">
<h1>Settings</h1>
<p class="lede">Your company, the accounts Supermarket posts with, the AI it writes with, and your Federated Core.</p>
</div>
<div class="settings">
<nav class="settings-nav" aria-label="Settings sections">
<div class="nav-label">Company</div>
<a href="/settings/profile" {{if eq .Nav "settings/profile"}}aria-current="page"{{end}}>{{template "icon" "profile"}}Profile</a>
<div class="nav-label">Connections</div>
<a href="/settings/accounts" {{if eq .Nav "settings/accounts"}}aria-current="page"{{end}}>{{template "icon" "accounts"}}Social accounts</a>
<a href="/settings/core" {{if eq .Nav "settings/core"}}aria-current="page"{{end}}>{{template "icon" "core"}}Core &amp; Hermes</a>
<div class="nav-label">AI</div>
<a href="/settings/ai" {{if eq .Nav "settings/ai"}}aria-current="page"{{end}}>{{template "icon" "ai"}}AI</a>
</nav>
<div class="settings-body">
{{end}}
{{define "settings-end"}}
</div>
</div>
{{end}}
{{/* A secret's field: {{template "key-field" (dict "F" secretField "Set" bool)}}.
Saved values are never shown; an empty field keeps what's saved. */}}
{{define "key-field"}}
<div class="secret">
<label>{{.F.Label}}
<input type="password" name="{{.F.Name}}" autocomplete="off" placeholder="{{if .Set}}saved — type to replace{{else}}not set{{end}}">
{{if .F.Help}}<span class="help">{{.F.Help}} Kept in <code>secrets.json</code>, readable only by you, and never shown again.</span>{{end}}
</label>
{{if .Set}}<label class="check small"><input type="checkbox" name="remove:{{.F.Name}}"> remove</label>{{end}}
</div>
{{end}}
{{/* Icons from Lucide (lucide.dev, ISC licence). */}}
{{define "icon"}}<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
{{- if eq . "search"}}<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>
{{- else if eq . "overview"}}<rect width="7" height="9" x="3" y="3" rx="1"/><rect width="7" height="5" x="14" y="3" rx="1"/><rect width="7" height="9" x="14" y="12" rx="1"/><rect width="7" height="5" x="3" y="16" rx="1"/>
{{- else if eq . "inventory"}}<path d="m16 6 4 14"/><path d="M12 6v14"/><path d="M8 8v12"/><path d="M4 4v16"/>
{{- else if eq . "content"}}<path d="M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2"/><path d="M18 14h-8"/><path d="M15 18h-5"/><path d="M10 6h8v4h-8V6Z"/>
{{- else if eq . "prospects"}}<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/>
{{- else if eq . "seo"}}<polyline points="22 7 13.5 15.5 8.5 10.5 2 17"/><polyline points="16 7 22 7 22 13"/>
{{- else if eq . "metrics"}}<path d="M3 3v18h18"/><path d="M18 17V9"/><path d="M13 17V5"/><path d="M8 17v-3"/>
{{- else if eq . "sites"}}<circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/>
{{- else if eq . "settings"}}<path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/>
{{- else if eq . "profile"}}<path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/>
{{- else if eq . "accounts"}}<circle cx="18" cy="5" r="3"/><circle cx="6" cy="12" r="3"/><circle cx="18" cy="19" r="3"/><path d="m8.59 13.51 6.83 3.98"/><path d="m15.41 6.51-6.82 3.98"/>
{{- else if eq . "ai"}}<path d="M12 8V4H8"/><rect width="16" height="12" x="4" y="8" rx="2"/><path d="M2 14h2"/><path d="M20 14h2"/><path d="M15 13v2"/><path d="M9 13v2"/>
{{- else if eq . "core"}}<path d="M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z"/><path d="m2 22 3-3"/><path d="M7.5 13.5 10 11"/><path d="M10.5 16.5 13 14"/><path d="m18 3-4 4h6l-4 4"/>
{{- else if eq . "cart"}}<circle cx="8" cy="21" r="1"/><circle cx="19" cy="21" r="1"/><path d="M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12"/>
{{- else if eq . "menu"}}<path d="M4 12h16"/><path d="M4 6h16"/><path d="M4 18h16"/>
{{- end}}</svg>{{end}}
+5 -5
View File
@@ -1,8 +1,8 @@
{{define "content"}}{{with .Data}}
<h1>Company profile</h1>
{{define "content"}}{{template "settings-start" .}}{{with .Data}}
<h2>Company profile</h2>
<p class="lede">Everything Supermarket writes, targets and audits starts here.</p>
<form class="card inline-form" method="post" action="/profile/draft">
<form class="card inline-form" method="post" action="/settings/profile/draft">
<label for="draft_url"><strong>Draft from your website</strong></label>
<p class="help">Reads your home page and a few pages it links to (about, products, pricing), and fills in what's empty below. Nothing is saved until you press Save.</p>
{{if .NoAI}}<p class="warn-text">This uses the AI: first <a href="/settings/ai">choose an AI provider</a> (for Anthropic, add your API key), then come back. Or fill in the form below by hand.</p>{{end}}
@@ -15,7 +15,7 @@
{{if .Drafted}}<p class="flash">Here's a draft. Check every field, correct what's wrong, then Save.</p>{{end}}
<form method="post" action="/profile">
<form method="post" action="/settings/profile">
{{with .P}}
<section class="card">
<h2>The company</h2>
@@ -105,4 +105,4 @@
<div class="actions"><button type="submit">Save</button></div>
</form>
{{end}}{{end}}
{{end}}{{template "settings-end"}}{{end}}
+29
View File
@@ -0,0 +1,29 @@
{{define "content"}}{{with .Data}}
<div class="page-head">
<h1>Search</h1>
<p class="lede">Posts, fetched items, the inventory, your products and settings.</p>
</div>
<form class="search-page" action="/search" method="get" role="search">
<input type="search" name="q" value="{{.Q}}" placeholder="e.g. a company, a product, or words from a post" aria-label="Search for" autofocus>
<button type="submit">Search</button>
</form>
{{if .Q}}
{{if .Groups}}
{{$limit := .Limit}}
{{range .Groups}}
<h2>{{.Name}} <span class="muted small">{{len .Hits}}{{if ge (len .Hits) $limit}}+{{end}}</span></h2>
<ul class="results">
{{range .Hits}}
<li><a href="{{.Link}}">
<span class="title"><span>{{truncate 140 .Title}}</span>{{with .Badge}}<span class="badge {{.}}">{{.}}</span>{{end}}</span>
{{with .Detail}}<span class="detail">{{truncate 200 .}}</span>{{end}}
</a></li>
{{end}}
</ul>
{{end}}
{{else}}
<section class="card empty"><p>Nothing matches “{{.Q}}”. Every word has to appear; try fewer words.</p></section>
{{end}}
{{end}}
{{end}}{{end}}