Make memory UI dynamic and content-aware
This commit is contained in:
+146
-229
@@ -6,39 +6,48 @@
|
||||
background: #101214;
|
||||
color: #f3f4f6;
|
||||
--bg: #101214;
|
||||
--bg-2: #15181c;
|
||||
--panel: #171a1d;
|
||||
--panel-2: #1c2024;
|
||||
--border: #2a2f35;
|
||||
--border-strong: #3a4149;
|
||||
--text: #f3f4f6;
|
||||
--muted: #9ca3af;
|
||||
--muted-2: #7b828c;
|
||||
--accent: #d8dde3;
|
||||
--muted: #a5adb7;
|
||||
--muted-2: #7f8791;
|
||||
--accent: #8fbcbb;
|
||||
--accent-soft: rgba(143,188,187,0.18);
|
||||
--accent-strong: #a3d5d3;
|
||||
--accent-glow: rgba(143,188,187,0.28);
|
||||
--pointer-x: 18%;
|
||||
--pointer-y: 12%;
|
||||
}
|
||||
|
||||
html, body, #root {
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
button, input, textarea {
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
button {
|
||||
border: 0;
|
||||
}
|
||||
html, body, #root { min-height: 100%; }
|
||||
body { background: var(--bg); color: var(--text); }
|
||||
button, input, textarea { font: inherit; }
|
||||
button { border: 0; }
|
||||
|
||||
.app-shell {
|
||||
position: relative;
|
||||
min-height: 100vh;
|
||||
background: var(--bg);
|
||||
background:
|
||||
radial-gradient(circle at var(--pointer-x) var(--pointer-y), var(--accent-soft), transparent 26%),
|
||||
linear-gradient(180deg, #101214 0%, #111419 100%);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.dynamic-wash {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
background:
|
||||
radial-gradient(circle at calc(var(--pointer-x) + 10%) calc(var(--pointer-y) + 8%), var(--accent-glow), transparent 16%),
|
||||
linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.01) 100%);
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.app {
|
||||
position: relative;
|
||||
max-width: 1180px;
|
||||
margin: 0 auto;
|
||||
padding: 2rem 1.25rem 4rem;
|
||||
@@ -68,15 +77,15 @@ button {
|
||||
|
||||
.hero h1 {
|
||||
margin-top: 0.35rem;
|
||||
font-size: clamp(2.2rem, 5vw, 4.4rem);
|
||||
font-weight: 600;
|
||||
letter-spacing: -0.06em;
|
||||
font-size: clamp(2.4rem, 5vw, 4.8rem);
|
||||
font-weight: 620;
|
||||
letter-spacing: -0.07em;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
margin-top: 0.7rem;
|
||||
max-width: 38rem;
|
||||
line-height: 1.5;
|
||||
margin-top: 0.75rem;
|
||||
max-width: 42rem;
|
||||
line-height: 1.55;
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
@@ -93,21 +102,9 @@ button {
|
||||
.memory-content,
|
||||
.memory-editor,
|
||||
.viewer-header {
|
||||
background: var(--panel);
|
||||
background: linear-gradient(180deg, rgba(23,26,29,0.96), rgba(20,23,27,0.96));
|
||||
border: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.panel,
|
||||
.file-card,
|
||||
.result-item,
|
||||
.memory-content,
|
||||
.memory-editor,
|
||||
.viewer-header,
|
||||
.search-input,
|
||||
.ghost-btn,
|
||||
.primary-btn,
|
||||
.tag-pill {
|
||||
border-radius: 10px;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.panel,
|
||||
@@ -116,44 +113,54 @@ button {
|
||||
.viewer-header,
|
||||
.memory-content,
|
||||
.memory-editor {
|
||||
box-shadow: none;
|
||||
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
.interactive-card,
|
||||
.ghost-btn,
|
||||
.primary-btn,
|
||||
.tag-pill,
|
||||
.rail-row {
|
||||
transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
|
||||
}
|
||||
|
||||
.interactive-card:hover,
|
||||
.ghost-btn:hover,
|
||||
.primary-btn:hover,
|
||||
.rail-row:hover {
|
||||
transform: translateY(-2px);
|
||||
border-color: color-mix(in srgb, var(--accent) 44%, var(--border));
|
||||
box-shadow: 0 16px 34px rgba(0,0,0,0.2);
|
||||
}
|
||||
|
||||
.hero-grid {
|
||||
grid-template-columns: 1.35fr 0.9fr 1fr;
|
||||
grid-template-columns: 1.25fr 0.92fr 0.95fr;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.panel {
|
||||
padding: 1rem;
|
||||
}
|
||||
.panel { padding: 1rem; }
|
||||
.accent-panel { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
|
||||
|
||||
.lead-copy {
|
||||
margin-top: 0.75rem;
|
||||
font-size: 1.05rem;
|
||||
line-height: 1.6;
|
||||
font-size: 1.08rem;
|
||||
line-height: 1.65;
|
||||
}
|
||||
|
||||
.lead-meta,
|
||||
.file-age,
|
||||
.result-meta {
|
||||
color: var(--muted-2);
|
||||
font-size: 0.82rem;
|
||||
}
|
||||
|
||||
.lead-meta {
|
||||
margin-top: 0.65rem;
|
||||
}
|
||||
|
||||
.stats-panel {
|
||||
display: grid;
|
||||
gap: 0.65rem;
|
||||
}
|
||||
.result-meta,
|
||||
.theme-copy { color: var(--muted-2); font-size: 0.82rem; }
|
||||
.lead-meta { margin-top: 0.65rem; }
|
||||
.theme-title { margin-top: 0.35rem; font-size: 1.2rem; font-weight: 600; letter-spacing: -0.03em; }
|
||||
.theme-copy { margin-top: 0.55rem; line-height: 1.55; }
|
||||
|
||||
.stats-panel { display: grid; gap: 0.65rem; }
|
||||
.stat-row,
|
||||
.rail-row,
|
||||
.result-head,
|
||||
.file-card-top {
|
||||
.file-card-top,
|
||||
.section-heading,
|
||||
.compact-heading {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
@@ -162,127 +169,85 @@ button {
|
||||
|
||||
.stat-row {
|
||||
padding-bottom: 0.65rem;
|
||||
border-bottom: 1px solid var(--border);
|
||||
border-bottom: 1px solid rgba(255,255,255,0.05);
|
||||
}
|
||||
|
||||
.stat-row:last-child {
|
||||
padding-bottom: 0;
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
.stat-row:last-child { padding-bottom: 0; border-bottom: 0; }
|
||||
.stat-row span,
|
||||
.recap-line,
|
||||
.rail-row span,
|
||||
.file-stats,
|
||||
.file-snippet,
|
||||
.result-snippet,
|
||||
.slash-hint {
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.slash-hint,
|
||||
.recap-line,
|
||||
.rail-metrics span { color: var(--muted); }
|
||||
.stat-row strong,
|
||||
.rail-metrics strong {
|
||||
font-size: 1.15rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.recap-panel {
|
||||
display: grid;
|
||||
gap: 0.65rem;
|
||||
}
|
||||
|
||||
.main-grid {
|
||||
grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.section-heading,
|
||||
.compact-heading {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
.rail-metrics strong { font-size: 1.15rem; font-weight: 620; }
|
||||
|
||||
.cluster-panel,
|
||||
.search-block,
|
||||
.main-grid { margin-top: 1rem; }
|
||||
.main-grid { grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr); }
|
||||
.section-heading h2,
|
||||
.compact-heading h2 {
|
||||
margin-top: 0.2rem;
|
||||
font-size: 1.1rem;
|
||||
font-weight: 600;
|
||||
font-weight: 620;
|
||||
letter-spacing: -0.02em;
|
||||
}
|
||||
|
||||
.rail-list {
|
||||
margin-top: 1rem;
|
||||
display: grid;
|
||||
gap: 0.6rem;
|
||||
}
|
||||
|
||||
.rail-list { margin-top: 1rem; display: grid; gap: 0.7rem; }
|
||||
.rail-row {
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
background: var(--panel-2);
|
||||
background: rgba(28,32,36,0.92);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 10px;
|
||||
border-radius: 11px;
|
||||
padding: 0.85rem 0.9rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.rail-copy { min-width: 0; }
|
||||
.rail-date,
|
||||
.file-label,
|
||||
.result-name {
|
||||
font-weight: 600;
|
||||
letter-spacing: -0.01em;
|
||||
}
|
||||
|
||||
.rail-metrics {
|
||||
display: grid;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.composer-form {
|
||||
margin-top: 1rem;
|
||||
display: flex;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.search-block {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.search-section {
|
||||
position: relative;
|
||||
margin: 1rem 0;
|
||||
.result-name { font-weight: 620; letter-spacing: -0.01em; }
|
||||
.rail-metrics { display: grid; text-align: right; min-width: 8rem; }
|
||||
.rail-bar {
|
||||
width: 100%;
|
||||
height: 4px;
|
||||
margin-top: 0.45rem;
|
||||
background: rgba(255,255,255,0.06);
|
||||
border-radius: 999px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.rail-bar span {
|
||||
display: block;
|
||||
height: 100%;
|
||||
border-radius: 999px;
|
||||
background: linear-gradient(90deg, var(--accent), var(--accent-strong));
|
||||
}
|
||||
|
||||
.composer-form { margin-top: 1rem; display: flex; gap: 0.75rem; }
|
||||
.search-section { position: relative; margin: 1rem 0; }
|
||||
.search-input,
|
||||
.memory-editor {
|
||||
width: 100%;
|
||||
background: #121518;
|
||||
background: rgba(18,21,24,0.98);
|
||||
color: var(--text);
|
||||
border: 1px solid var(--border-strong);
|
||||
border-radius: 12px;
|
||||
outline: none;
|
||||
padding: 0.9rem 1rem;
|
||||
transition: border-color 140ms ease, background 140ms ease;
|
||||
padding: 0.92rem 1rem;
|
||||
}
|
||||
|
||||
.memory-editor {
|
||||
min-height: 68vh;
|
||||
resize: vertical;
|
||||
line-height: 1.6;
|
||||
line-height: 1.65;
|
||||
}
|
||||
|
||||
.search-input:focus,
|
||||
.memory-editor:focus {
|
||||
border-color: #626973;
|
||||
background: #101316;
|
||||
border-color: color-mix(in srgb, var(--accent) 70%, var(--border-strong));
|
||||
box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-soft) 90%, transparent);
|
||||
}
|
||||
|
||||
.search-input::placeholder,
|
||||
.memory-editor::placeholder {
|
||||
color: var(--muted-2);
|
||||
}
|
||||
|
||||
.memory-editor::placeholder { color: var(--muted-2); }
|
||||
.search-spinner {
|
||||
position: absolute;
|
||||
right: 1rem;
|
||||
@@ -295,50 +260,19 @@ button {
|
||||
.search-results {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.file-card,
|
||||
.result-item,
|
||||
.ghost-btn,
|
||||
.primary-btn {
|
||||
cursor: pointer;
|
||||
gap: 0.8rem;
|
||||
}
|
||||
|
||||
.file-card,
|
||||
.result-item {
|
||||
padding: 1rem;
|
||||
text-align: left;
|
||||
transition: border-color 140ms ease, transform 140ms ease;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.file-card:hover,
|
||||
.result-item:hover,
|
||||
.ghost-btn:hover,
|
||||
.primary-btn:hover,
|
||||
.back-btn:hover,
|
||||
.rail-row:hover {
|
||||
transform: translateY(-1px);
|
||||
border-color: #505862;
|
||||
}
|
||||
|
||||
.file-date {
|
||||
color: var(--muted-2);
|
||||
font-size: 0.82rem;
|
||||
}
|
||||
|
||||
.file-date { color: var(--accent-strong); font-size: 0.82rem; }
|
||||
.file-snippet,
|
||||
.result-snippet {
|
||||
margin-top: 0.55rem;
|
||||
line-height: 1.55;
|
||||
}
|
||||
|
||||
.file-stats {
|
||||
margin-top: 0.75rem;
|
||||
display: flex;
|
||||
gap: 0.6rem;
|
||||
font-size: 0.82rem;
|
||||
}
|
||||
.result-snippet { margin-top: 0.55rem; line-height: 1.6; }
|
||||
.file-stats { margin-top: 0.75rem; display: flex; gap: 0.6rem; font-size: 0.82rem; }
|
||||
|
||||
.tag-strip {
|
||||
margin-top: 0.8rem;
|
||||
@@ -350,43 +284,46 @@ button {
|
||||
.tag-pill {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
min-height: 1.8rem;
|
||||
padding: 0.22rem 0.55rem;
|
||||
background: #111417;
|
||||
border: 1px solid var(--border-strong);
|
||||
color: #d7dce2;
|
||||
min-height: 1.85rem;
|
||||
padding: 0.24rem 0.58rem;
|
||||
background: rgba(255,255,255,0.02);
|
||||
border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
|
||||
border-radius: 999px;
|
||||
color: var(--accent-strong);
|
||||
font-size: 0.75rem;
|
||||
text-transform: lowercase;
|
||||
cursor: pointer;
|
||||
}
|
||||
.tag-pill.active,
|
||||
.tag-pill:hover {
|
||||
background: var(--accent-soft);
|
||||
border-color: color-mix(in srgb, var(--accent) 70%, var(--border));
|
||||
}
|
||||
|
||||
.ghost-btn,
|
||||
.primary-btn,
|
||||
.back-btn {
|
||||
padding: 0.8rem 1rem;
|
||||
.back-btn,
|
||||
.small-btn {
|
||||
padding: 0.82rem 1rem;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.ghost-btn,
|
||||
.back-btn {
|
||||
background: transparent;
|
||||
background: rgba(255,255,255,0.02);
|
||||
color: var(--text);
|
||||
border: 1px solid var(--border-strong);
|
||||
}
|
||||
|
||||
.primary-btn {
|
||||
background: #e8ebef;
|
||||
color: #111315;
|
||||
border: 1px solid #e8ebef;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.primary-btn:disabled {
|
||||
opacity: 0.55;
|
||||
cursor: default;
|
||||
transform: none;
|
||||
background: linear-gradient(135deg, var(--accent), var(--accent-strong));
|
||||
color: #0d1116;
|
||||
border: 1px solid transparent;
|
||||
font-weight: 620;
|
||||
}
|
||||
.primary-btn:disabled { opacity: 0.55; cursor: default; transform: none; }
|
||||
.small-btn { padding: 0.56rem 0.82rem; }
|
||||
|
||||
kbd {
|
||||
background: #15191d;
|
||||
background: rgba(255,255,255,0.03);
|
||||
border: 1px solid var(--border-strong);
|
||||
padding: 0.1rem 0.4rem;
|
||||
border-radius: 6px;
|
||||
@@ -398,7 +335,6 @@ kbd {
|
||||
margin: 0 auto;
|
||||
padding: 2rem 1.25rem 3rem;
|
||||
}
|
||||
|
||||
.viewer-header {
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr auto;
|
||||
@@ -407,53 +343,34 @@ kbd {
|
||||
padding: 1rem;
|
||||
margin-bottom: 0.8rem;
|
||||
}
|
||||
|
||||
.viewer-title {
|
||||
margin-top: 0.2rem;
|
||||
font-size: 1.35rem;
|
||||
font-weight: 600;
|
||||
font-weight: 620;
|
||||
letter-spacing: -0.03em;
|
||||
}
|
||||
|
||||
.memory-content {
|
||||
margin-top: 0.8rem;
|
||||
padding: 1.2rem;
|
||||
white-space: pre-wrap;
|
||||
line-height: 1.65;
|
||||
line-height: 1.68;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.muted-panel {
|
||||
color: var(--muted);
|
||||
}
|
||||
.muted-panel { color: var(--muted); }
|
||||
|
||||
@media (max-width: 980px) {
|
||||
.hero,
|
||||
.hero-grid,
|
||||
.main-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.hero-actions {
|
||||
align-items: flex-start;
|
||||
}
|
||||
.main-grid { grid-template-columns: 1fr; }
|
||||
.hero-actions { align-items: flex-start; }
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.app,
|
||||
.viewer-shell {
|
||||
padding-left: 0.9rem;
|
||||
padding-right: 0.9rem;
|
||||
}
|
||||
|
||||
.viewer-shell { padding-left: 0.9rem; padding-right: 0.9rem; }
|
||||
.composer-form,
|
||||
.viewer-header {
|
||||
grid-template-columns: 1fr;
|
||||
display: grid;
|
||||
}
|
||||
|
||||
.viewer-header { display: grid; grid-template-columns: 1fr; }
|
||||
.files-grid,
|
||||
.search-results {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.search-results { grid-template-columns: 1fr; }
|
||||
.rail-row { grid-template-columns: 1fr; }
|
||||
}
|
||||
|
||||
+105
-40
@@ -34,27 +34,34 @@ function pickSpark(content) {
|
||||
return clipText(candidate.replace(/^[-*]\s*/, ''))
|
||||
}
|
||||
|
||||
function TagStrip({ tags = [] }) {
|
||||
function TagStrip({ tags = [], onPick, activeTag }) {
|
||||
if (!tags.length) return null
|
||||
return (
|
||||
<div className="tag-strip">
|
||||
{tags.map((tag) => (
|
||||
<span key={tag} className="tag-pill">{tag}</span>
|
||||
<button
|
||||
key={tag}
|
||||
type="button"
|
||||
className={`tag-pill ${activeTag === tag ? 'active' : ''}`}
|
||||
onClick={onPick ? () => onPick(tag) : undefined}
|
||||
>
|
||||
{tag}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function FileCard({ file, onClick }) {
|
||||
function FileCard({ file, onClick, onPickTag, activeTag }) {
|
||||
return (
|
||||
<button className="file-card" onClick={onClick}>
|
||||
<button className="file-card interactive-card" onClick={onClick}>
|
||||
<div className="file-card-top">
|
||||
<div className="file-date">{formatDate(file.mtimeMs)}</div>
|
||||
<div className="file-age">{formatRelative(file.mtimeMs)}</div>
|
||||
</div>
|
||||
<div className="file-label">{file.dateLabel}</div>
|
||||
<div className="file-snippet">{file.tags?.[0] ? `Tagged for ${file.tags[0]}.` : 'Quiet day in the archive.'}</div>
|
||||
<TagStrip tags={file.tags} />
|
||||
<div className="file-snippet">{file.tags?.[0] ? `Leaning ${file.tags[0]}.` : 'Quiet day in the archive.'}</div>
|
||||
<TagStrip tags={file.tags} onPick={onPickTag} activeTag={activeTag} />
|
||||
<div className="file-stats">
|
||||
<span>{file.wordCount.toLocaleString()} words</span>
|
||||
<span>{file.entryCount} entries</span>
|
||||
@@ -63,7 +70,7 @@ function FileCard({ file, onClick }) {
|
||||
)
|
||||
}
|
||||
|
||||
function Viewer({ selected, onBack }) {
|
||||
function Viewer({ selected, onBack, activeTag, onPickTag }) {
|
||||
const [content, setContent] = useState('')
|
||||
const [draft, setDraft] = useState('')
|
||||
const [loading, setLoading] = useState(true)
|
||||
@@ -74,9 +81,7 @@ function Viewer({ selected, onBack }) {
|
||||
useEffect(() => {
|
||||
setLoading(true)
|
||||
setSaveState('idle')
|
||||
const url = isMainMemory
|
||||
? `${API}/api/main-memory`
|
||||
: `${API}/api/memories/${selected.filename}`
|
||||
const url = isMainMemory ? `${API}/api/main-memory` : `${API}/api/memories/${selected.filename}`
|
||||
|
||||
fetch(url)
|
||||
.then((r) => r.json())
|
||||
@@ -112,7 +117,7 @@ function Viewer({ selected, onBack }) {
|
||||
|
||||
return (
|
||||
<div className="viewer-shell">
|
||||
<div className="viewer-header">
|
||||
<div className="viewer-header panel interactive-card">
|
||||
<button className="ghost-btn back-btn" onClick={onBack}>Back</button>
|
||||
<div className="viewer-heading">
|
||||
<div className="viewer-kicker">{isMainMemory ? 'core memory' : 'daily note'}</div>
|
||||
@@ -124,7 +129,7 @@ function Viewer({ selected, onBack }) {
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
<TagStrip tags={tags} />
|
||||
<TagStrip tags={tags} onPick={onPickTag} activeTag={activeTag} />
|
||||
{loading ? (
|
||||
<div className="panel muted-panel">Loading…</div>
|
||||
) : isMainMemory ? (
|
||||
@@ -136,28 +141,30 @@ function Viewer({ selected, onBack }) {
|
||||
)
|
||||
}
|
||||
|
||||
function ActivityRail({ files, onSelect }) {
|
||||
function ActivityRail({ files, onSelect, onPickTag, activeTag }) {
|
||||
if (!files?.length) return null
|
||||
const recent = files.slice(0, 8)
|
||||
const maxWords = Math.max(...recent.map((file) => file.wordCount), 1)
|
||||
|
||||
return (
|
||||
<section className="panel rail-panel">
|
||||
<section className="panel rail-panel interactive-card">
|
||||
<div className="section-heading">
|
||||
<div>
|
||||
<div className="section-kicker">recent rhythm</div>
|
||||
<h2>Eight latest memory days.</h2>
|
||||
<h2>Latest memory days.</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div className="rail-list">
|
||||
{recent.map((file) => (
|
||||
<button key={file.filename} className="rail-row" onClick={() => onSelect(file)}>
|
||||
<div>
|
||||
<div className="rail-copy">
|
||||
<div className="rail-date">{file.dateLabel}</div>
|
||||
<TagStrip tags={file.tags} />
|
||||
<TagStrip tags={file.tags} onPick={onPickTag} activeTag={activeTag} />
|
||||
</div>
|
||||
<div className="rail-metrics">
|
||||
<strong>{file.wordCount.toLocaleString()}</strong>
|
||||
<span>{file.entryCount} entries</span>
|
||||
<div className="rail-bar"><span style={{ width: `${(file.wordCount / maxWords) * 100}%` }} /></div>
|
||||
</div>
|
||||
</button>
|
||||
))}
|
||||
@@ -166,6 +173,17 @@ function ActivityRail({ files, onSelect }) {
|
||||
)
|
||||
}
|
||||
|
||||
function ThemeSwatches({ theme, tags, onPickTag, activeTag }) {
|
||||
return (
|
||||
<section className="panel recap-panel interactive-card">
|
||||
<div className="section-kicker">theme drift</div>
|
||||
<div className="theme-title">{theme?.name || 'Nord'} mode</div>
|
||||
<p className="theme-copy">The color temperature now leans with what lives in core memory, not just a fixed skin.</p>
|
||||
<TagStrip tags={tags} onPick={onPickTag} activeTag={activeTag} />
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
export default function App() {
|
||||
const [meta, setMeta] = useState(null)
|
||||
const [selected, setSelected] = useState(null)
|
||||
@@ -177,6 +195,8 @@ export default function App() {
|
||||
const [reviewCount, setReviewCount] = useState(null)
|
||||
const [quickLog, setQuickLog] = useState('')
|
||||
const [logState, setLogState] = useState('idle')
|
||||
const [activeTag, setActiveTag] = useState('')
|
||||
const [pointer, setPointer] = useState({ x: 18, y: 12 })
|
||||
const searchRef = useRef(null)
|
||||
|
||||
const refreshMeta = () => {
|
||||
@@ -199,6 +219,14 @@ export default function App() {
|
||||
refreshMeta()
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
const onMove = (e) => {
|
||||
setPointer({ x: (e.clientX / window.innerWidth) * 100, y: (e.clientY / window.innerHeight) * 100 })
|
||||
}
|
||||
window.addEventListener('pointermove', onMove)
|
||||
return () => window.removeEventListener('pointermove', onMove)
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
if (!meta?.dailyFiles?.length) return
|
||||
const latest = meta.dailyFiles[0]
|
||||
@@ -215,6 +243,13 @@ export default function App() {
|
||||
})
|
||||
}, [meta])
|
||||
|
||||
useEffect(() => {
|
||||
if (activeTag) {
|
||||
setQuery(activeTag)
|
||||
searchRef.current?.focus()
|
||||
}
|
||||
}, [activeTag])
|
||||
|
||||
useEffect(() => {
|
||||
if (!query.trim() || query.length < 2) {
|
||||
setSearchResults([])
|
||||
@@ -231,7 +266,7 @@ export default function App() {
|
||||
setSearchResults([])
|
||||
}
|
||||
setSearching(false)
|
||||
}, 220)
|
||||
}, 180)
|
||||
|
||||
return () => clearTimeout(t)
|
||||
}, [query])
|
||||
@@ -243,6 +278,28 @@ export default function App() {
|
||||
return { latest, longest }
|
||||
}, [meta])
|
||||
|
||||
const smartClusters = useMemo(() => {
|
||||
const tags = new Map()
|
||||
for (const file of meta?.dailyFiles || []) {
|
||||
for (const tag of file.tags || []) {
|
||||
tags.set(tag, (tags.get(tag) || 0) + 1)
|
||||
}
|
||||
}
|
||||
return Array.from(tags.entries())
|
||||
.sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]))
|
||||
.slice(0, 8)
|
||||
.map(([tag]) => tag)
|
||||
}, [meta])
|
||||
|
||||
const themeStyle = useMemo(() => ({
|
||||
'--accent': meta?.theme?.accent || '#8fbcbb',
|
||||
'--accent-soft': meta?.theme?.accentSoft || 'rgba(143,188,187,0.18)',
|
||||
'--accent-strong': meta?.theme?.accentStrong || '#a3d5d3',
|
||||
'--accent-glow': meta?.theme?.glow || 'rgba(143,188,187,0.28)',
|
||||
'--pointer-x': `${pointer.x}%`,
|
||||
'--pointer-y': `${pointer.y}%`,
|
||||
}), [meta, pointer])
|
||||
|
||||
const openFile = (file) => setSelected({ type: 'daily', filename: file.filename, title: file.dateLabel, tags: file.tags || [] })
|
||||
|
||||
const submitLog = async (e) => {
|
||||
@@ -267,17 +324,18 @@ export default function App() {
|
||||
}
|
||||
|
||||
if (selected) {
|
||||
return <Viewer selected={selected} onBack={() => setSelected(null)} />
|
||||
return <Viewer selected={selected} onBack={() => setSelected(null)} activeTag={activeTag} onPickTag={setActiveTag} />
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="app-shell">
|
||||
<div className="app-shell" style={themeStyle}>
|
||||
<div className="dynamic-wash" aria-hidden="true" />
|
||||
<div className="app">
|
||||
<header className="hero">
|
||||
<div className="hero-copy">
|
||||
<div className="eyebrow">freeclaw memory cloud</div>
|
||||
<h1>Sharper memory.</h1>
|
||||
<p className="subtitle">Quiet archive. Fast search. Auto tags. Less glow, more signal.</p>
|
||||
<h1>Memory with a pulse.</h1>
|
||||
<p className="subtitle">Theme shifts with core memory. Tags are smarter. The archive should feel alive, not embalmed.</p>
|
||||
</div>
|
||||
<div className="hero-actions">
|
||||
<button
|
||||
@@ -292,34 +350,38 @@ export default function App() {
|
||||
|
||||
{meta && heroStats && (
|
||||
<section className="hero-grid">
|
||||
<div className="panel lead-panel">
|
||||
<div className="panel lead-panel interactive-card accent-panel">
|
||||
<div className="section-kicker">latest spark</div>
|
||||
<div className="lead-copy">{spark || 'Loading…'}</div>
|
||||
<div className="lead-meta">{sparkSource || 'recent archive'}</div>
|
||||
<TagStrip tags={heroStats.latest.tags} />
|
||||
<TagStrip tags={heroStats.latest.tags} onPick={setActiveTag} activeTag={activeTag} />
|
||||
</div>
|
||||
|
||||
<div className="panel stats-panel">
|
||||
<div className="panel stats-panel interactive-card">
|
||||
<div className="stat-row"><span>daily files</span><strong>{meta.summary.dailyFileCount}</strong></div>
|
||||
<div className="stat-row"><span>words logged</span><strong>{meta.summary.totalDailyWords.toLocaleString()}</strong></div>
|
||||
<div className="stat-row"><span>core memories</span><strong>{meta.mainMemory?.entryCount ?? 0}</strong></div>
|
||||
<div className="stat-row"><span>review queue</span><strong>{reviewCount ?? '—'}</strong></div>
|
||||
</div>
|
||||
|
||||
<div className="panel recap-panel">
|
||||
<div className="section-kicker">pulse</div>
|
||||
<div className="recap-line">Latest <strong>{heroStats.latest.dateLabel}</strong></div>
|
||||
<div className="recap-line">Largest <strong>{heroStats.longest.wordCount.toLocaleString()} words</strong></div>
|
||||
<div className="recap-line">Touched <strong>{formatRelative(heroStats.latest.mtimeMs)}</strong></div>
|
||||
<TagStrip tags={meta.mainMemory?.tags} />
|
||||
</div>
|
||||
<ThemeSwatches theme={meta.theme} tags={meta.mainMemory?.tags} onPickTag={setActiveTag} activeTag={activeTag} />
|
||||
</section>
|
||||
)}
|
||||
|
||||
<div className="main-grid">
|
||||
<ActivityRail files={meta?.dailyFiles} onSelect={openFile} />
|
||||
<section className="panel cluster-panel interactive-card">
|
||||
<div className="section-heading">
|
||||
<div>
|
||||
<div className="section-kicker">smart clusters</div>
|
||||
<h2>Recurring ideas across the archive.</h2>
|
||||
</div>
|
||||
</div>
|
||||
<TagStrip tags={smartClusters} onPick={setActiveTag} activeTag={activeTag} />
|
||||
</section>
|
||||
|
||||
<section className="panel composer-panel">
|
||||
<div className="main-grid">
|
||||
<ActivityRail files={meta?.dailyFiles} onSelect={openFile} onPickTag={setActiveTag} activeTag={activeTag} />
|
||||
|
||||
<section className="panel composer-panel interactive-card">
|
||||
<div className="section-heading compact-heading">
|
||||
<div>
|
||||
<div className="section-kicker">quick log</div>
|
||||
@@ -328,6 +390,7 @@ export default function App() {
|
||||
</div>
|
||||
<form className="composer-form" onSubmit={submitLog}>
|
||||
<input
|
||||
ref={searchRef}
|
||||
className="search-input composer-input"
|
||||
type="text"
|
||||
placeholder="A note, decision, odd clue, or tiny win…"
|
||||
@@ -348,12 +411,14 @@ export default function App() {
|
||||
<div className="section-heading compact-heading">
|
||||
<div>
|
||||
<div className="section-kicker">search</div>
|
||||
<h2>Find threads fast.</h2>
|
||||
<h2>{activeTag ? `Filtering on ${activeTag}` : 'Find threads fast.'}</h2>
|
||||
</div>
|
||||
{activeTag && (
|
||||
<button className="ghost-btn small-btn" onClick={() => { setActiveTag(''); setQuery('') }}>Clear tag</button>
|
||||
)}
|
||||
</div>
|
||||
<div className="search-section">
|
||||
<input
|
||||
ref={searchRef}
|
||||
className="search-input"
|
||||
type="text"
|
||||
placeholder="Search memory files…"
|
||||
@@ -368,7 +433,7 @@ export default function App() {
|
||||
{searchResults.map((result) => (
|
||||
<button
|
||||
key={result.filename}
|
||||
className="result-item"
|
||||
className="result-item interactive-card"
|
||||
onClick={() => setSelected({ type: 'daily', filename: result.filename, title: result.dateLabel, tags: result.tags || [] })}
|
||||
>
|
||||
<div className="result-head">
|
||||
@@ -376,7 +441,7 @@ export default function App() {
|
||||
<div className="result-meta">{result.matchCount} matches</div>
|
||||
</div>
|
||||
<div className="result-snippet">{result.snippet}</div>
|
||||
<TagStrip tags={result.tags} />
|
||||
<TagStrip tags={result.tags} onPick={setActiveTag} activeTag={activeTag} />
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
@@ -385,7 +450,7 @@ export default function App() {
|
||||
{searchResults.length === 0 && !searching && query.length < 2 && meta && (
|
||||
<div className="files-grid">
|
||||
{meta.dailyFiles.map((file) => (
|
||||
<FileCard key={file.filename} file={file} onClick={() => openFile(file)} />
|
||||
<FileCard key={file.filename} file={file} onClick={() => openFile(file)} onPickTag={setActiveTag} activeTag={activeTag} />
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user