This commit updates the web interface to better align with Nextcloud's design system and improve the Vector Viz layout. Changes: - Replace emoji icons with Material Design SVG icons for better consistency with Nextcloud apps - Simplify navigation styling with minimal padding and subtle active states (250px width) - Update CSS variables to match Nextcloud design system - Restructure Vector Viz from two-column to single-column vertical layout for better plot visibility - Move search controls to compact horizontal grid at top - Make navigation toggle always visible (not just on mobile) - Fix plot container sizing with overflow:visible to prevent colorbar clipping - Remove heavy shadows and custom card styling for cleaner aesthetic - Add error and success page templates with consistent styling Technical details: - Preserve Alpine.js for reactive functionality - Use CSS Grid for responsive horizontal controls layout - Add smooth transitions for navigation collapse/expand - Maintain HTMX for dynamic content loading 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
348 lines
14 KiB
HTML
348 lines
14 KiB
HTML
<style>
|
|
.viz-layout {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 16px;
|
|
height: 100%;
|
|
min-height: 0;
|
|
overflow-y: auto;
|
|
}
|
|
.viz-card {
|
|
background: var(--color-main-background);
|
|
border-radius: 0;
|
|
padding: 16px;
|
|
box-shadow: none;
|
|
}
|
|
.viz-controls-card {
|
|
flex: 0 0 auto;
|
|
border-bottom: 1px solid var(--color-border);
|
|
padding-bottom: 16px;
|
|
}
|
|
.viz-controls-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
gap: 12px;
|
|
align-items: end;
|
|
}
|
|
@media (min-width: 768px) {
|
|
.viz-controls-grid {
|
|
grid-template-columns: 2fr 1.5fr 1.5fr auto auto;
|
|
}
|
|
}
|
|
.viz-control-group {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 4px;
|
|
}
|
|
.viz-control-group label {
|
|
font-weight: 500;
|
|
color: var(--color-main-text);
|
|
font-size: 13px;
|
|
}
|
|
.viz-control-group input[type="text"],
|
|
.viz-control-group input[type="number"],
|
|
.viz-control-group select {
|
|
width: 100%;
|
|
padding: 7px 10px;
|
|
border: 1px solid var(--color-border-dark);
|
|
border-radius: var(--border-radius);
|
|
font-size: 14px;
|
|
background: var(--color-main-background);
|
|
color: var(--color-main-text);
|
|
}
|
|
.viz-control-group input:focus,
|
|
.viz-control-group select:focus {
|
|
outline: none;
|
|
border-color: var(--color-primary-element);
|
|
}
|
|
.viz-control-group input[type="range"] {
|
|
width: 100%;
|
|
}
|
|
.viz-control-group select[multiple] {
|
|
min-height: 100px;
|
|
}
|
|
.viz-weight-display {
|
|
display: inline-block;
|
|
min-width: 40px;
|
|
text-align: right;
|
|
color: #666;
|
|
}
|
|
.viz-btn {
|
|
background: var(--color-primary-element);
|
|
color: white;
|
|
border: none;
|
|
padding: 7px 16px;
|
|
border-radius: var(--border-radius);
|
|
cursor: pointer;
|
|
font-size: 14px;
|
|
font-weight: 500;
|
|
white-space: nowrap;
|
|
}
|
|
.viz-btn:hover {
|
|
background: #0052a3;
|
|
}
|
|
.viz-btn-secondary {
|
|
background: #6c757d;
|
|
color: white;
|
|
border: none;
|
|
padding: 7px 16px;
|
|
border-radius: var(--border-radius);
|
|
cursor: pointer;
|
|
font-size: 14px;
|
|
white-space: nowrap;
|
|
}
|
|
.viz-btn-secondary:hover {
|
|
background: #5a6268;
|
|
}
|
|
.viz-card-plot {
|
|
flex: 0 0 auto;
|
|
display: flex;
|
|
flex-direction: column;
|
|
min-height: 500px;
|
|
height: 600px;
|
|
}
|
|
#viz-plot-container {
|
|
width: 100%;
|
|
height: 100%;
|
|
position: relative;
|
|
overflow: visible;
|
|
}
|
|
#viz-plot {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
.viz-loading {
|
|
text-align: center;
|
|
padding: 40px;
|
|
color: #666;
|
|
}
|
|
.viz-loading-overlay {
|
|
position: absolute;
|
|
inset: 0;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
background: white;
|
|
color: #666;
|
|
}
|
|
.viz-no-results {
|
|
text-align: center;
|
|
padding: 40px;
|
|
color: #666;
|
|
font-style: italic;
|
|
}
|
|
.viz-advanced-section {
|
|
margin-top: 12px;
|
|
padding: 12px;
|
|
background: var(--color-background-hover);
|
|
border-radius: var(--border-radius);
|
|
border: 1px solid var(--color-border);
|
|
}
|
|
.viz-info-box {
|
|
background: var(--color-primary-element-light);
|
|
border-left: 3px solid var(--color-primary-element);
|
|
padding: 10px 12px;
|
|
margin-bottom: 16px;
|
|
font-size: 13px;
|
|
color: var(--color-main-text);
|
|
}
|
|
.chunk-toggle-btn {
|
|
background: #6c757d;
|
|
color: white;
|
|
border: none;
|
|
padding: 4px 10px;
|
|
border-radius: 3px;
|
|
cursor: pointer;
|
|
font-size: 12px;
|
|
margin-top: 6px;
|
|
}
|
|
.chunk-toggle-btn:hover {
|
|
background: #5a6268;
|
|
}
|
|
.chunk-context {
|
|
background: var(--color-background-hover);
|
|
border: 1px solid var(--color-border);
|
|
border-radius: var(--border-radius);
|
|
padding: 12px;
|
|
margin-top: 8px;
|
|
font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', 'Menlo', monospace;
|
|
font-size: 13px;
|
|
line-height: 1.6;
|
|
white-space: pre-wrap;
|
|
word-wrap: break-word;
|
|
}
|
|
.chunk-text {
|
|
color: var(--color-text-maxcontrast);
|
|
}
|
|
.chunk-matched {
|
|
background: #fff3cd;
|
|
border: 1px solid #ffc107;
|
|
padding: 2px 4px;
|
|
border-radius: var(--border-radius);
|
|
font-weight: 500;
|
|
color: var(--color-main-text);
|
|
}
|
|
.chunk-ellipsis {
|
|
color: var(--color-text-maxcontrast);
|
|
font-style: italic;
|
|
}
|
|
</style>
|
|
|
|
<div x-data="vizApp()">
|
|
<div class="viz-layout">
|
|
<!-- Top: Search Controls -->
|
|
<div class="viz-card viz-controls-card">
|
|
<form @submit.prevent="executeSearch">
|
|
<div class="viz-controls-grid">
|
|
<div class="viz-control-group">
|
|
<label>Search Query</label>
|
|
<input type="text" x-model="query" placeholder="Enter search query..." required />
|
|
</div>
|
|
|
|
<div class="viz-control-group">
|
|
<label>Algorithm</label>
|
|
<select x-model="algorithm">
|
|
<option value="semantic">Semantic (Dense)</option>
|
|
<option value="bm25_hybrid" selected>BM25 Hybrid</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="viz-control-group">
|
|
<label>Fusion</label>
|
|
<select x-model="fusion" :disabled="algorithm !== 'bm25_hybrid'" :style="algorithm !== 'bm25_hybrid' ? 'opacity: 0.5; cursor: not-allowed;' : ''">
|
|
<option value="rrf" selected>RRF</option>
|
|
<option value="dbsf">DBSF</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="viz-control-group">
|
|
<label> </label>
|
|
<button type="submit" class="viz-btn">Search</button>
|
|
</div>
|
|
|
|
<div class="viz-control-group">
|
|
<label> </label>
|
|
<button type="button" class="viz-btn-secondary" @click="showAdvanced = !showAdvanced">
|
|
<span x-text="showAdvanced ? 'Hide' : 'Advanced'"></span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Advanced Options (Collapsible) -->
|
|
<div x-show="showAdvanced" style="margin-top: 16px;">
|
|
<div class="viz-controls-grid" style="grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));">
|
|
<div class="viz-control-group">
|
|
<label>Document Types</label>
|
|
<div style="display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px;">
|
|
<label style="display: flex; align-items: center; cursor: pointer; font-weight: normal;">
|
|
<input type="checkbox" x-model="docTypes" value="" style="margin-right: 4px;">
|
|
<span>All</span>
|
|
</label>
|
|
<label style="display: flex; align-items: center; cursor: pointer; font-weight: normal;">
|
|
<input type="checkbox" x-model="docTypes" value="note" style="margin-right: 4px;">
|
|
<span>Notes</span>
|
|
</label>
|
|
<label style="display: flex; align-items: center; cursor: pointer; font-weight: normal;">
|
|
<input type="checkbox" x-model="docTypes" value="file" style="margin-right: 4px;">
|
|
<span>Files</span>
|
|
</label>
|
|
<label style="display: flex; align-items: center; cursor: pointer; font-weight: normal;">
|
|
<input type="checkbox" x-model="docTypes" value="calendar" style="margin-right: 4px;">
|
|
<span>Calendar</span>
|
|
</label>
|
|
<label style="display: flex; align-items: center; cursor: pointer; font-weight: normal;">
|
|
<input type="checkbox" x-model="docTypes" value="contact" style="margin-right: 4px;">
|
|
<span>Contacts</span>
|
|
</label>
|
|
<label style="display: flex; align-items: center; cursor: pointer; font-weight: normal;">
|
|
<input type="checkbox" x-model="docTypes" value="deck" style="margin-right: 4px;">
|
|
<span>Deck</span>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="viz-control-group">
|
|
<label>Score Threshold</label>
|
|
<input type="number" x-model.number="scoreThreshold" min="0" max="1" step="any" />
|
|
</div>
|
|
|
|
<div class="viz-control-group">
|
|
<label>Result Limit</label>
|
|
<input type="number" x-model.number="limit" min="1" max="100" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
<!-- Plot -->
|
|
<div class="viz-card viz-card-plot">
|
|
<div id="viz-plot-container">
|
|
<div x-show="loading" class="viz-loading-overlay" x-transition.opacity.duration.200ms>
|
|
Executing search and computing PCA projection...
|
|
</div>
|
|
<div id="viz-plot" x-show="!loading" x-transition.opacity.duration.200ms></div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Results -->
|
|
<div class="viz-card" style="flex: 0 0 auto;">
|
|
<h3 style="margin-top: 0;">Search Results (<span x-text="loading ? '...' : results.length"></span>)</h3>
|
|
|
|
<div x-show="loading" class="viz-loading" x-transition.opacity.duration.200ms>
|
|
Loading results...
|
|
</div>
|
|
|
|
<div x-show="!loading && results.length === 0" class="viz-no-results" x-transition.opacity.duration.200ms>
|
|
No results found. Try a different query or adjust your search parameters.
|
|
</div>
|
|
|
|
<template x-if="!loading && results.length > 0">
|
|
<div x-transition.opacity.duration.200ms>
|
|
<template x-for="result in results" :key="result.id">
|
|
<div style="padding: 12px; border-bottom: 1px solid #eee;">
|
|
<a :href="getNextcloudUrl(result)" target="_blank" style="font-weight: 500; color: #0066cc; text-decoration: none;">
|
|
<span x-text="result.title"></span>
|
|
</a>
|
|
<div style="font-size: 14px; color: #666; margin-top: 4px;" x-text="result.excerpt"></div>
|
|
<div style="font-size: 12px; color: #999; margin-top: 4px;">
|
|
Raw Score: <span x-text="result.original_score.toFixed(3)"></span>
|
|
(<span x-text="(result.score * 100).toFixed(0)"></span>% relative) |
|
|
Type: <span x-text="result.doc_type"></span>
|
|
</div>
|
|
|
|
<!-- Show Chunk button (only if chunk position is available) -->
|
|
<template x-if="hasChunkPosition(result)">
|
|
<button
|
|
class="chunk-toggle-btn"
|
|
@click="toggleChunk(result)"
|
|
x-text="isChunkExpanded(`${result.doc_type}_${result.id}`) ? 'Hide Chunk' : 'Show Chunk'"
|
|
></button>
|
|
</template>
|
|
|
|
<!-- Chunk context (expanded inline) -->
|
|
<template x-if="isChunkExpanded(`${result.doc_type}_${result.id}`)">
|
|
<div class="chunk-context" x-transition.opacity.duration.200ms>
|
|
<template x-if="chunkLoading[`${result.doc_type}_${result.id}`]">
|
|
<div style="color: #666; font-style: italic;">Loading chunk...</div>
|
|
</template>
|
|
<template x-if="!chunkLoading[`${result.doc_type}_${result.id}`]">
|
|
<div>
|
|
<template x-if="expandedChunks[`${result.doc_type}_${result.id}`]?.has_more_before">
|
|
<span class="chunk-ellipsis">...</span>
|
|
</template>
|
|
<span class="chunk-text" x-text="expandedChunks[`${result.doc_type}_${result.id}`]?.before_context"></span><span class="chunk-matched" x-text="expandedChunks[`${result.doc_type}_${result.id}`]?.chunk_text"></span><span class="chunk-text" x-text="expandedChunks[`${result.doc_type}_${result.id}`]?.after_context"></span><template x-if="expandedChunks[`${result.doc_type}_${result.id}`]?.has_more_after">
|
|
<span class="chunk-ellipsis">...</span>
|
|
</template>
|
|
</div>
|
|
</template>
|
|
</div>
|
|
</template>
|
|
</div>
|
|
</template>
|
|
</div>
|
|
</template>
|
|
</div><!-- Search Results -->
|
|
</div><!-- .viz-layout -->
|
|
</div><!-- x-data="vizApp()" -->
|