Files
rhema-claw/web/claw/app/components/SettingsNav.vue
T
vhaudiquet cb1948742f
android / debug (push) Successful in 2m26s
android / release (push) Successful in 2m19s
ci / checks (push) Successful in 3m48s
ci / test (push) Successful in 1m24s
ci / chart (push) Successful in 7s
ci / docker (push) Successful in 2m11s
ci / web (push) Successful in 15s
ci / publish-edge-images (deploy/docker/claw.Dockerfile, rhema-claw) (push) Successful in 2m17s
ci / publish-edge-images (deploy/docker/ui.Dockerfile, rhema-claw-ui) (push) Successful in 16s
ci / publish-edge-chart (push) Successful in 4s
feat(claw): show the user's profile in the bottom-left account
The web shell's account showed the agent's identity and the word
"connected", which left no way to see or set the human's own name and
picture.

The claw now stores a user profile beside the bootstrap files and
serves it over /v1/user and /v1/user/avatar. The agent sets it during
onboarding with user_profile_set; the bottom-left account in both
sidebars renders it and opens an editor for the name and picture. The
prompt context exposes user_name and user_profile, and bootstrap
documents resolve {{ user_name }}, so USER.md and the other markdown
files can address the user by name.

The connection state stays with the unreachable banner, so the sidebars
no longer report it.

Unit and HTTP tests cover the profile store, the tool, the variable
expansion, and the routes. fmt, clippy, cargo test, nuxt typecheck, and
nuxt build pass; both sidebars and the editor checked at 1280x800.
2026-12-01 18:30:50 +01:00

227 lines
4.8 KiB
Vue

<script setup lang="ts">
// The settings nav: searchable sections of pages, in the same sidebar
// slot as the session list. The search is a client-side filter over
// these entries; it hides nothing the claw cannot serve.
import { MessageSquare, Search } from 'lucide-vue-next'
import type { UserProfile } from '~/composables/useClaw'
export interface SettingsEntry {
id: string
label: string
}
export interface SettingsSection {
label: string
entries: SettingsEntry[]
}
const props = defineProps<{
sections: SettingsSection[]
active: string
user: UserProfile | null
userAvatarUrl: string | null
}>()
defineEmits<{ home: []; select: [id: string]; navigateChat: []; editProfile: [] }>()
const query = ref('')
const filtered = computed<SettingsSection[]>(() => {
const needle = query.value.trim().toLowerCase()
if (!needle) return props.sections
return props.sections
.map((section) => ({
label: section.label,
entries: section.entries.filter((entry) =>
entry.label.toLowerCase().includes(needle),
),
}))
.filter((section) => section.entries.length > 0)
})
</script>
<template>
<aside class="sidebar">
<div class="sidebar-top">
<SidebarBrand @home="$emit('home')" />
</div>
<div class="search">
<Search :size="14" class="search-icon" aria-hidden="true" />
<input v-model="query" type="search" placeholder="Search settings" aria-label="Search settings">
</div>
<p v-if="filtered.length === 0" class="empty">No settings match.</p>
<nav class="sections" aria-label="Settings">
<div v-for="section in filtered" :key="section.label" class="section">
<span class="sidebar-label">{{ section.label }}</span>
<button
v-for="entry in section.entries"
:key="entry.id"
class="entry"
:class="{ active: entry.id === active }"
@click="$emit('select', entry.id)"
>
{{ entry.label }}
</button>
</div>
</nav>
<div class="sidebar-bottom">
<button class="sidebar-link" @click="$emit('navigateChat')">
<MessageSquare :size="16" aria-hidden="true" />
<span>Chat</span>
</button>
<UserProfileButton
:profile="user"
:avatar-url="userAvatarUrl"
@edit="$emit('editProfile')"
/>
</div>
</aside>
</template>
<style scoped>
.sidebar {
display: flex;
flex-direction: column;
width: var(--sidebar-w);
flex: 0 0 var(--sidebar-w);
position: sticky;
top: 0;
height: 100vh;
border-right: 1px solid var(--border);
background: var(--surface);
}
.sidebar-top {
padding: var(--sp-4) var(--sp-3) var(--sp-2);
}
.search {
position: relative;
padding: 0 var(--sp-3) var(--sp-2);
}
.search-icon {
position: absolute;
left: calc(var(--sp-3) + var(--sp-2));
top: 50%;
transform: translateY(-60%);
color: var(--faint);
pointer-events: none;
}
.search input {
width: 100%;
min-height: 32px;
padding: var(--sp-1) var(--sp-2) var(--sp-1) var(--sp-8);
background: var(--surface);
font-size: var(--fs-meta);
}
.sections {
flex: 1;
min-height: 0;
overflow-y: auto;
padding: 0 var(--sp-2) var(--sp-4);
scrollbar-width: thin;
}
.section {
display: flex;
flex-direction: column;
gap: 1px;
margin-bottom: var(--sp-4);
}
.sidebar-label {
display: block;
padding: 0 var(--sp-2) var(--sp-1);
color: var(--faint);
font-size: var(--fs-small);
font-weight: 500;
}
.entry {
display: block;
width: 100%;
min-height: 0;
padding: var(--sp-2);
border: 0;
border-radius: var(--r-control);
background: transparent;
color: var(--text);
font-size: var(--fs-meta);
font-weight: 400;
line-height: var(--lh-body);
text-align: left;
}
.entry:hover:not(:disabled) {
background: var(--surface-2);
}
.entry.active {
background: var(--accent-soft);
color: var(--accent);
font-weight: 600;
}
.empty {
margin: 0;
padding: var(--sp-3) var(--sp-2);
color: var(--muted);
font-size: var(--fs-meta);
}
.sidebar-bottom {
padding: var(--sp-2);
border-top: 1px solid var(--border);
display: flex;
flex-direction: column;
gap: var(--sp-1);
}
.sidebar-link {
display: flex;
align-items: center;
justify-content: flex-start;
gap: var(--sp-2);
width: 100%;
min-height: 0;
padding: var(--sp-2);
border: 0;
border-radius: var(--r-control);
background: transparent;
color: var(--muted);
font-size: var(--fs-meta);
font-weight: 400;
text-align: left;
}
.sidebar-link:hover:not(:disabled) {
background: var(--surface-2);
color: var(--text);
}
@media (max-width: 860px) {
.sidebar {
position: static;
width: 100%;
flex: none;
height: auto;
max-height: none;
min-height: 0;
overflow: visible;
border-right: 0;
border-bottom: 1px solid var(--border);
}
.sections {
min-height: 0;
}
}
</style>