Skip to content

Commit b42c672

Browse files
author
aemiguel
committed
Fix agent context layout to match document blocks, bump v0.1.57
1 parent c3d7636 commit b42c672

File tree

2 files changed

+27
-48
lines changed

2 files changed

+27
-48
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lore-core"
3-
version = "0.1.56"
3+
version = "0.1.57"
44
edition = "2024"
55
autobins = false
66

src/ui.rs

Lines changed: 26 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -145,21 +145,24 @@ pub fn render_shell(shell: PageShell, content: String) -> String {
145145
function toggleAgentContext() {{
146146
var preview = document.getElementById('agent-context-preview');
147147
var full = document.getElementById('agent-context-full');
148-
var form = document.getElementById('agent-context-form');
148+
var editPanel = document.getElementById('agent-context-edit');
149149
var band = document.querySelector('.agent-context-band');
150-
if (!form) return;
151-
if (form.style.display === 'none') {{
150+
var block = document.querySelector('.agent-context-block');
151+
if (!editPanel) return;
152+
if (editPanel.style.display === 'none') {{
152153
if (preview) preview.style.display = 'none';
153154
if (full) full.style.display = 'none';
154-
form.style.display = '';
155+
editPanel.style.display = '';
155156
if (band) band.classList.add('editline-band-active');
156-
var ta = form.querySelector('textarea');
157+
if (block) block.classList.add('editing');
158+
var ta = editPanel.querySelector('textarea');
157159
if (ta) {{ ta.focus(); ta.setSelectionRange(ta.value.length, ta.value.length); }}
158160
}} else {{
159161
if (preview) preview.style.display = '';
160162
if (full) full.style.display = 'none';
161-
form.style.display = 'none';
163+
editPanel.style.display = 'none';
162164
if (band) band.classList.remove('editline-band-active');
165+
if (block) block.classList.remove('editing');
163166
}}
164167
}}
165168
function toggleEditlineInserter(btn) {{
@@ -3091,10 +3094,10 @@ pub fn render_project_page(
30913094
let agent_context_html = {
30923095
let edit_form = if can_write {
30933096
format!(
3094-
r#"<form id="agent-context-form" method="post" action="/ui/{project_slug}/context" style="display:none;">
3097+
r#"<form id="agent-context-form" method="post" action="/ui/{project_slug}/context">
3098+
<textarea name="agent_context" class="block-edit-textarea agent-context-textarea">{content_escaped}</textarea>
30953099
<input type="hidden" name="csrf_token" value="{csrf}">
3096-
<textarea name="agent_context" class="agent-context-textarea">{content_escaped}</textarea>
3097-
<div style="display:flex; gap:var(--s-3); margin-top:var(--s-2);">
3100+
<div style="display:flex; gap:var(--s-3);">
30983101
<button type="submit" class="button-link">Save</button>
30993102
<button type="button" class="button-link" onclick="toggleAgentContext()">Cancel</button>
31003103
</div>
@@ -3114,14 +3117,16 @@ pub fn render_project_page(
31143117
format!(
31153118
r#"<div class="agent-context-section">
31163119
<div class="section-tag">Agent Context</div>
3117-
<div class="agent-context-panel">
3118-
<div class="agent-context-content">
3119-
<pre class="agent-context-preview" id="agent-context-preview">{preview}</pre>
3120-
<div class="agent-context-full" id="agent-context-full" style="display:none;">
3121-
<pre class="agent-context-full-text">{full_text}</pre>
3120+
<div class="editline-row">
3121+
<article class="block agent-context-block">
3122+
<div class="block-body">
3123+
<pre class="agent-context-preview" id="agent-context-preview">{preview}</pre>
3124+
<div class="agent-context-full" id="agent-context-full" style="display:none;">
3125+
<pre class="agent-context-full-text">{full_text}</pre>
3126+
</div>
31223127
</div>
3123-
{edit_form}
3124-
</div>{band_html}
3128+
<div class="block-edit-panel" id="agent-context-edit" style="display:none;">{edit_form}</div>
3129+
</article>{band_html}
31253130
</div>
31263131
</div>"#,
31273132
preview = if context_preview.is_empty() {
@@ -6306,47 +6311,21 @@ fn shared_styles(theme: UiTheme, mode: ColorMode) -> String {
63066311
margin-bottom: 0;
63076312
}
63086313
6309-
.agent-context-panel {
6310-
display: flex;
6311-
align-items: stretch;
6312-
background: var(--surface-hover);
6313-
border-radius: var(--radius);
6314-
padding: var(--s-3) 0 var(--s-3) var(--s-4);
6315-
overflow: hidden;
6316-
}
6317-
6318-
.agent-context-content {
6319-
flex: 1;
6320-
min-width: 0;
6321-
padding-right: var(--s-4);
6322-
}
6323-
63246314
.agent-context-preview,
63256315
.agent-context-full-text {
63266316
margin: 0;
6327-
font-size: 0.85em;
63286317
white-space: pre-wrap;
63296318
word-break: break-word;
63306319
color: var(--fg);
6331-
opacity: 0.8;
6320+
background: transparent;
6321+
padding: 0;
6322+
border-radius: 0;
6323+
font-size: inherit;
6324+
font-family: inherit;
63326325
}
63336326
63346327
.agent-context-textarea {
6335-
width: 100%;
63366328
min-height: 120px;
6337-
max-height: 400px;
6338-
font-family: var(--font-mono);
6339-
font-size: 0.85em;
6340-
padding: var(--s-3);
6341-
border: 1px solid var(--line);
6342-
border-radius: var(--radius);
6343-
background: var(--bg);
6344-
color: var(--fg);
6345-
resize: vertical;
6346-
}
6347-
6348-
.agent-context-band {
6349-
align-self: stretch;
63506329
}
63516330
63526331
.block {

0 commit comments

Comments
 (0)