Add multi-user auth, settings area, and unified label feed

Turns Daybook into a multi-user tool and reworks the feed UI:

- Multi-user: Django session login (username/password + remember-me),
  per-user personal API tokens (DRF authtoken), whole app gated behind
  login. Each artifact has an owner; feeds are private per user.
- Rename persona -> source (free-text label for whatever posted an
  artifact: agent-profile, script, or person). source + tags form one
  unified label system; single label filter matches tags, source has
  its own filter/column/sidebar.
- Settings area (gear/user menu, top-right): Account (view/regenerate
  token) and Demo Data (in-app button seeding one artifact per kind).
  User account management via Django admin (superusers only).
- Feed rework: rolling 7-day window with sticky inline date separators
  and infinite scroll; left sidebar is now a Sources list with per-source
  unread counts; artifact type shown as text after title; source in its
  own column.
- Unread tracking: read_at on Artifact, marked read when previewed,
  bold titles for unread, sidebar unread badges, old banner removed.
- Tag colours: global shared registry, hash-based default with optional
  per-tag override via tag_colors on POST/PATCH.
- Ingest: token resolves owner; same source name under two users' tokens
  stays isolated. daybook_post.py renamed persona->source, requires a
  real token, --check accepts a bearer token. Docs updated to match.

Migrations 0004-0008 rename persona, add owner (nullable -> backfill to
first superuser -> required), and add read_at. Fresh installs no-op the
backfill.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
ritte 2026-07-24 09:06:46 +02:00
parent 203f9b578e
commit 37cd96fa7a
33 changed files with 1614 additions and 367 deletions

View file

@ -8,6 +8,7 @@
--text: #2f343d;
--muted: #7b8491;
--selected-day-bg: #3d4552;
--day-tile-bg: #eef0f4;
--selected-artifact-bg: #eaf3ff;
--selected-artifact-rail: #dcecff;
--control-border: #d9dee6;
@ -37,10 +38,73 @@ body {
display: grid;
flex: 0 0 auto;
gap: 0;
grid-template-columns: max-content 1fr;
grid-template-columns: max-content 1fr max-content;
padding: 0;
}
.topbar-actions {
align-items: center;
display: flex;
gap: 0.4rem;
padding: 0.32rem 0.8rem;
position: relative;
}
.icon-button {
background: transparent;
border: 1px solid transparent;
border-radius: 6px;
color: var(--muted);
cursor: pointer;
font-size: 0.85rem;
padding: 0.4rem 0.6rem;
}
.icon-button:hover {
background: var(--surface);
border-color: var(--control-border);
}
.user-menu-dropdown {
background: var(--surface);
border: 1px solid var(--control-border);
border-radius: 8px;
box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
display: flex;
flex-direction: column;
min-width: 10rem;
position: absolute;
right: 0.8rem;
top: calc(100% + 4px);
z-index: 20;
}
.user-menu-dropdown[hidden] {
display: none;
}
.user-menu-dropdown a,
.user-menu-dropdown button {
background: transparent;
border: 0;
color: var(--text);
cursor: pointer;
font-size: 0.85rem;
padding: 0.5rem 0.8rem;
text-align: left;
text-decoration: none;
width: 100%;
}
.user-menu-dropdown a:hover,
.user-menu-dropdown button:hover {
background: var(--surface-alt);
}
.user-menu-dropdown form {
margin: 0;
}
.brandline {
align-items: center;
display: flex;
@ -48,6 +112,15 @@ body {
padding: 0.38rem 0.8rem;
}
.brand-link {
color: inherit;
text-decoration: none;
}
.brand-link:hover {
opacity: 0.75;
}
.eyebrow {
color: var(--muted);
font-size: 0.68rem;
@ -142,14 +215,14 @@ h1 {
overflow: hidden;
}
.day-sidebar,
.source-sidebar,
.artifact-sidebar,
.preview-pane {
min-width: 0;
padding: 0;
}
.day-sidebar,
.source-sidebar,
.artifact-sidebar {
min-height: 0;
overflow-x: hidden;
@ -157,7 +230,7 @@ h1 {
scrollbar-width: none;
}
.day-sidebar {
.source-sidebar {
display: flex;
flex-direction: column;
overflow-y: hidden;
@ -170,7 +243,7 @@ h1 {
padding: 0;
}
.day-list,
.source-list,
.artifact-list {
min-height: 0;
overflow-x: hidden;
@ -179,34 +252,34 @@ h1 {
scrollbar-width: none;
}
.day-sidebar:hover .day-list,
.source-sidebar:hover .source-list,
.artifact-sidebar:hover .artifact-list {
scrollbar-color: rgba(61, 69, 82, 0.35) transparent;
scrollbar-width: thin;
}
.day-list::-webkit-scrollbar,
.source-list::-webkit-scrollbar,
.artifact-list::-webkit-scrollbar {
width: 0;
}
.day-sidebar:hover .day-list::-webkit-scrollbar,
.source-sidebar:hover .source-list::-webkit-scrollbar,
.artifact-sidebar:hover .artifact-list::-webkit-scrollbar {
width: 6px;
}
.day-list::-webkit-scrollbar-thumb,
.source-list::-webkit-scrollbar-thumb,
.artifact-list::-webkit-scrollbar-thumb {
background: rgba(61, 69, 82, 0.35);
border-radius: 999px;
}
.day-list::-webkit-scrollbar-track,
.source-list::-webkit-scrollbar-track,
.artifact-list::-webkit-scrollbar-track {
background: transparent;
}
.day-sidebar {
.source-sidebar {
background: var(--surface-alt);
}
@ -250,7 +323,7 @@ h1 {
user-select: none;
}
.day-sidebar h2,
.source-sidebar h2,
.pane-heading h2 {
color: var(--text);
font-size: 0.68rem;
@ -259,64 +332,97 @@ h1 {
text-transform: uppercase;
}
.day-list,
.artifact-list {
.source-list {
display: grid;
}
.day-list {
.source-list {
align-content: start;
flex: 1 1 auto;
gap: 0.35rem;
padding: 0.55rem;
}
.day-link,
.source-link,
.artifact-row {
color: inherit;
text-decoration: none;
}
.day-link {
.source-link {
align-items: center;
background: var(--day-tile-bg);
border-radius: 6px;
display: grid;
gap: 0.1rem;
padding: 0.48rem;
display: flex;
gap: 0.4rem;
justify-content: space-between;
padding: 0.45rem 0.55rem;
}
.day-link:hover,
.day-link.selected {
.source-link:hover {
background: var(--surface);
box-shadow: none;
}
.day-link:focus-visible {
.source-link:focus-visible {
outline: 2px solid #8ab4f8;
outline-offset: 2px;
}
.day-link.selected {
.source-link.selected {
background: var(--selected-day-bg);
color: #ffffff;
}
.day-link.selected span,
.day-link.selected strong {
.source-link.selected .source-name,
.source-link.selected .source-count {
color: #ffffff;
}
.day-link.selected .today-badge {
background: #d8f1df;
color: #28583a;
.source-name {
font-size: 0.8rem;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.source-count {
color: var(--muted);
flex: 0 0 auto;
font-size: 0.7rem;
}
.day-link span,
.pane-heading span,
.artifact-time {
color: var(--muted);
font-size: 0.7rem;
}
.day-separator {
align-items: center;
background: var(--surface-alt);
border-bottom: 1px solid var(--grid-line);
color: var(--muted);
display: flex;
font-size: 0.7rem;
font-weight: 700;
justify-content: space-between;
letter-spacing: 0.04em;
padding: 0.32rem 0.55rem;
position: sticky;
text-transform: uppercase;
top: 0;
z-index: 5;
}
.day-separator-count {
font-weight: 400;
}
.feed-more {
height: 1px;
}
.today-badge {
background: #d8f1df;
border-radius: 999px;
@ -329,10 +435,6 @@ h1 {
padding: 0.08rem 0.38rem;
}
.day-link strong {
color: var(--text);
font-size: 0.82rem;
}
.pane-bar {
align-items: baseline;
@ -353,7 +455,7 @@ h1 {
border-bottom: 1px solid var(--grid-line);
}
.day-sidebar .pane-bar,
.source-sidebar .pane-bar,
.artifact-sidebar .pane-bar {
align-items: center;
justify-content: center;
@ -365,30 +467,6 @@ h1 {
gap: 0.04rem;
}
.new-artifacts-banner {
background: #eaf3ff;
border: 0;
border-radius: 999px;
color: #315a8a;
cursor: pointer;
display: block;
font: inherit;
font-size: 0.76rem;
font-weight: 700;
margin: 0 0.55rem 0.5rem;
padding: 0.48rem 0.7rem;
text-align: center;
width: calc(100% - 1.1rem);
}
.new-artifacts-banner[hidden] {
display: none;
}
.new-artifacts-banner:hover {
background: #dcecff;
}
.artifact-list {
align-content: start;
flex: 1 1 auto;
@ -402,7 +480,7 @@ h1 {
border-radius: 0;
display: grid;
gap: 0;
grid-template-columns: 3.15rem minmax(0, 1fr) 2.6rem;
grid-template-columns: 3.15rem minmax(0, 1fr) 7rem;
min-height: 2.7rem;
overflow: hidden;
padding: 0;
@ -427,55 +505,30 @@ h1 {
background: var(--selected-artifact-rail);
}
.artifact-row.selected .artifact-row-main span,
.artifact-row.selected .artifact-title,
.artifact-row.selected .artifact-time {
color: var(--text);
}
.artifact-row.selected .kind-icon {
background: #dbeaff;
color: #315a8a;
}
.kind-icon {
align-items: center;
background: #f1f3f6;
color: #5f6875;
display: inline-flex;
font-size: 0.56rem;
font-weight: 800;
justify-content: center;
letter-spacing: 0.04em;
line-height: 1;
padding: 0 0.42rem;
white-space: nowrap;
}
.kind-image {
color: #265336;
}
.kind-pdf {
color: #78352f;
}
.kind-markdown {
color: #443265;
}
.kind-deck {
color: #6e4a12;
}
.artifact-row-main {
align-items: center;
border-right: 1px solid var(--grid-line);
display: flex;
flex-wrap: wrap;
gap: 0.32rem;
min-width: 0;
padding: 0.42rem 0.55rem;
}
.artifact-row-main span {
.artifact-row.unread .artifact-title {
font-weight: 700;
}
.artifact-row.unread .artifact-source {
color: var(--text);
}
.artifact-row-main > .artifact-title {
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
color: var(--text);
@ -484,6 +537,39 @@ h1 {
overflow: hidden;
}
.artifact-kind-text {
color: var(--muted);
font-size: 0.68rem;
white-space: nowrap;
}
.artifact-source {
align-items: center;
color: var(--muted);
display: flex;
font-size: 0.72rem;
overflow: hidden;
padding: 0.42rem 0.55rem;
text-overflow: ellipsis;
white-space: nowrap;
}
.tag-chips {
display: flex;
flex-wrap: wrap;
gap: 0.24rem;
}
.tag-chip {
border-radius: 999px;
color: #ffffff;
font-size: 0.66rem;
font-weight: 600;
line-height: 1;
padding: 0.18rem 0.44rem;
white-space: nowrap;
}
.artifact-time {
align-items: center;
background: #f3f5f7;
@ -646,10 +732,120 @@ kbd {
display: none;
}
.day-sidebar,
.source-sidebar,
.artifact-sidebar {
border-bottom: 1px solid #d9c9ad;
border-right: 0;
max-height: 32vh;
}
}
.login-page {
align-items: center;
display: flex;
height: 100%;
justify-content: center;
overflow: auto;
}
.login-card {
background: var(--surface);
border: 1px solid var(--control-border);
border-radius: 12px;
display: flex;
flex-direction: column;
gap: 0.8rem;
padding: 2rem;
width: 20rem;
}
.login-card label {
display: flex;
flex-direction: column;
gap: 0.3rem;
}
.login-card label span {
color: var(--muted);
font-size: 0.78rem;
}
.login-card input[type="text"],
.login-card input[type="password"] {
border: 1px solid var(--control-border);
border-radius: 6px;
padding: 0.5rem 0.6rem;
}
.login-remember {
align-items: center;
flex-direction: row !important;
gap: 0.5rem !important;
}
.login-error {
color: #c14f4f;
font-size: 0.82rem;
}
.settings-layout {
display: grid;
flex: 1 1 auto;
grid-template-columns: 14rem 1fr;
min-height: 0;
overflow: auto;
}
.settings-nav {
background: var(--surface-alt);
border-right: 1px solid var(--grid-line);
display: flex;
flex-direction: column;
padding: 1rem 0.6rem;
}
.settings-nav a {
border-radius: 6px;
color: var(--text);
padding: 0.5rem 0.7rem;
text-decoration: none;
}
.settings-nav a:hover {
background: var(--surface);
}
.settings-nav a.selected {
background: var(--day-tile-bg);
font-weight: 600;
}
.settings-nav-back {
border-bottom: 1px solid var(--grid-line);
color: var(--muted) !important;
font-size: 0.82rem;
margin-bottom: 0.5rem;
padding-bottom: 0.7rem !important;
}
.settings-panel {
max-width: 42rem;
padding: 1.6rem 2rem;
}
.settings-messages {
background: #eaf7ed;
border-radius: 8px;
color: #28583a;
list-style: none;
margin: 0 0 1.2rem;
padding: 0.6rem 0.9rem;
}
.token-value {
background: var(--surface-alt);
border-radius: 6px;
display: inline-block;
padding: 0.4rem 0.6rem;
word-break: break-all;
}