feature: new changes!
All checks were successful
Recommender Build and Deploy (internal) / Build Recommender Image (push) Successful in 3m59s
Recommender Build and Deploy (internal) / Deploy Recommender (internal) (push) Successful in 10s

This commit is contained in:
2026-03-25 20:09:32 -03:00
parent 26f61077b8
commit f9f3d95406
25 changed files with 964 additions and 696 deletions

View File

@@ -19,6 +19,7 @@ export function createRecommendation(body: {
liked_shows: string;
disliked_shows: string;
themes: string;
brainstorm_count?: number;
}): Promise<{ id: string }> {
return request('/recommendations', {
method: 'POST',

View File

@@ -1,12 +1,15 @@
import { Router, Route } from 'preact-router';
import { Home } from './pages/Home.js';
import { Recom } from './pages/Recom.js';
import { RecommendationsProvider } from './context/RecommendationsContext.js';
export function App() {
return (
<Router>
<Route path="/" component={Home} />
<Route path="/recom/:id" component={Recom} />
</Router>
<RecommendationsProvider>
<Router>
<Route path="/" component={Home} />
<Route path="/recom/:id" component={Recom} />
</Router>
</RecommendationsProvider>
);
}

View File

@@ -0,0 +1,151 @@
/* ── Cards ─────────────────────────────────────────────── */
.cards-grid {
display: flex;
flex-direction: column;
gap: 12px;
margin-bottom: 32px;
}
.card {
background: var(--bg-surface);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 16px;
transition: border-color 0.15s;
}
.card:hover {
border-color: var(--bg-surface-3);
}
.card-header {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 8px;
flex-wrap: wrap;
}
.badge {
font-size: 11px;
font-weight: 600;
padding: 2px 8px;
border-radius: 100px;
text-transform: uppercase;
letter-spacing: 0.04em;
flex-shrink: 0;
}
.badge-green {
background: rgba(34, 197, 94, 0.15);
color: #4ade80;
}
.badge-blue {
background: rgba(59, 130, 246, 0.15);
color: #60a5fa;
}
.badge-yellow {
background: rgba(234, 179, 8, 0.15);
color: #facc15;
}
.badge-red {
background: rgba(239, 68, 68, 0.15);
color: #f87171;
}
.card-title {
font-size: 16px;
font-weight: 600;
color: var(--text);
}
.card-explanation {
font-size: 13px;
color: var(--text-muted);
line-height: 1.5;
margin-bottom: 12px;
}
.card-feedback {
border-top: 1px solid var(--border);
padding-top: 10px;
}
.star-rating {
display: flex;
align-items: center;
gap: 2px;
}
.star-btn {
background: none;
border: none;
cursor: pointer;
font-size: 18px;
color: var(--text-dim);
padding: 0 2px;
transition: color 0.1s, transform 0.1s;
}
.star-btn:hover,
.star-btn.star-active {
color: var(--yellow);
}
.star-btn:hover {
transform: scale(1.1);
}
.feedback-saved {
margin-left: 8px;
font-size: 12px;
color: var(--green);
font-weight: 500;
}
.comment-area {
margin-top: 8px;
display: flex;
flex-direction: column;
gap: 6px;
}
.comment-input {
font-size: 13px;
resize: vertical;
}
/* ── Rerank Button ──────────────────────────────────────── */
.rerank-section {
padding: 16px 0 32px;
display: flex;
justify-content: center;
}
.btn-rerank {
padding: 12px 28px;
background: var(--bg-surface-2);
color: var(--text);
border: 1px solid var(--border);
border-radius: var(--radius);
font-size: 14px;
font-weight: 600;
cursor: pointer;
transition: background 0.15s, border-color 0.15s;
}
.btn-rerank:hover:not(:disabled) {
background: var(--bg-surface-3);
border-color: var(--accent);
color: var(--accent);
}
.btn-rerank:disabled {
opacity: 0.4;
cursor: not-allowed;
}

View File

@@ -0,0 +1,105 @@
/* ── Modal ──────────────────────────────────────────────── */
.modal-backdrop {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.6);
display: flex;
align-items: center;
justify-content: center;
z-index: 100;
backdrop-filter: blur(2px);
}
.modal {
background: var(--bg-surface);
border: 1px solid var(--border);
border-radius: 12px;
width: 650px;
max-width: 96vw;
max-height: 90vh;
overflow-y: auto;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.modal-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 20px 20px 0;
}
.modal-header h2 {
font-size: 18px;
font-weight: 700;
}
.modal-close {
background: none;
border: none;
font-size: 22px;
color: var(--text-muted);
cursor: pointer;
line-height: 1;
padding: 0;
}
.modal-close:hover {
color: var(--text);
}
.modal-form {
padding: 20px;
display: flex;
flex-direction: column;
gap: 16px;
}
.form-group {
display: flex;
flex-direction: column;
gap: 6px;
flex: 1;
}
.form-group label {
font-size: 13px;
font-weight: 500;
color: var(--text-muted);
}
.form-input,
.form-textarea {
background: var(--bg-surface-2);
border: 1px solid var(--border);
border-radius: var(--radius-sm);
color: var(--text);
font-size: 14px;
padding: 10px 12px;
outline: none;
transition: border-color 0.15s;
font-family: inherit;
width: 100%;
}
.form-input[type="range"] {
padding: 0;
cursor: pointer;
}
.form-input:focus,
.form-textarea:focus {
border-color: var(--accent);
}
.form-textarea {
resize: vertical;
min-height: 80px;
}
.modal-actions {
display: flex;
justify-content: flex-end;
gap: 10px;
padding-top: 4px;
}

View File

@@ -1,4 +1,5 @@
import { useState } from 'preact/hooks';
import './Modal.css';
interface NewRecommendationModalProps {
onClose: () => void;
@@ -7,6 +8,7 @@ interface NewRecommendationModalProps {
liked_shows: string;
disliked_shows: string;
themes: string;
brainstorm_count?: number;
}) => Promise<void>;
}
@@ -15,6 +17,7 @@ export function NewRecommendationModal({ onClose, onSubmit }: NewRecommendationM
const [likedShows, setLikedShows] = useState('');
const [dislikedShows, setDislikedShows] = useState('');
const [themes, setThemes] = useState('');
const [brainstormCount, setBrainstormCount] = useState(100);
const [loading, setLoading] = useState(false);
const handleSubmit = async (e: Event) => {
@@ -27,6 +30,7 @@ export function NewRecommendationModal({ onClose, onSubmit }: NewRecommendationM
liked_shows: likedShows.trim(),
disliked_shows: dislikedShows.trim(),
themes: themes.trim(),
brainstorm_count: brainstormCount,
});
onClose();
} finally {
@@ -62,30 +66,28 @@ export function NewRecommendationModal({ onClose, onSubmit }: NewRecommendationM
/>
</div>
<div class="form-row">
<div class="form-group">
<label for="liked-shows">Shows you liked</label>
<input
id="liked-shows"
type="text"
class="form-input"
placeholder="e.g. Breaking Bad, The Wire"
value={likedShows}
onInput={(e) => setLikedShows((e.target as HTMLInputElement).value)}
/>
</div>
<div class="form-group">
<label for="liked-shows">Shows you liked</label>
<input
id="liked-shows"
type="text"
class="form-input"
placeholder="e.g. Breaking Bad, The Wire"
value={likedShows}
onInput={(e) => setLikedShows((e.target as HTMLInputElement).value)}
/>
</div>
<div class="form-group">
<label for="disliked-shows">Shows you disliked</label>
<input
id="disliked-shows"
type="text"
class="form-input"
placeholder="e.g. Game of Thrones"
value={dislikedShows}
onInput={(e) => setDislikedShows((e.target as HTMLInputElement).value)}
/>
</div>
<div class="form-group">
<label for="disliked-shows">Shows you disliked</label>
<input
id="disliked-shows"
type="text"
class="form-input"
placeholder="e.g. Game of Thrones"
value={dislikedShows}
onInput={(e) => setDislikedShows((e.target as HTMLInputElement).value)}
/>
</div>
<div class="form-group">
@@ -100,6 +102,20 @@ export function NewRecommendationModal({ onClose, onSubmit }: NewRecommendationM
/>
</div>
<div class="form-group">
<label for="brainstorm-count">Shows to brainstorm ({brainstormCount})</label>
<input
id="brainstorm-count"
type="range"
class="form-input"
min={50}
max={200}
step={10}
value={brainstormCount}
onInput={(e) => setBrainstormCount(Number((e.target as HTMLInputElement).value))}
/>
</div>
<div class="modal-actions">
<button type="button" class="btn-secondary" onClick={onClose} disabled={loading}>
Cancel

View File

@@ -0,0 +1,86 @@
/* ── Pipeline Progress ──────────────────────────────────── */
.pipeline-progress {
padding: 40px 0;
}
.pipeline-title {
font-size: 18px;
font-weight: 600;
color: var(--text);
margin-bottom: 24px;
}
.pipeline-steps {
list-style: none;
display: flex;
flex-direction: column;
gap: 12px;
}
.pipeline-step {
display: flex;
align-items: center;
gap: 12px;
padding: 12px 16px;
background: var(--bg-surface);
border: 1px solid var(--border);
border-radius: var(--radius);
font-size: 14px;
}
.pipeline-step--running {
border-color: var(--accent);
background: var(--accent-dim);
}
.pipeline-step--done {
border-color: rgba(34, 197, 94, 0.3);
background: rgba(34, 197, 94, 0.05);
}
.pipeline-step--error {
border-color: rgba(239, 68, 68, 0.3);
background: rgba(239, 68, 68, 0.05);
}
.stage-icon {
font-size: 16px;
width: 20px;
text-align: center;
}
.stage-done {
color: var(--green);
}
.stage-error {
color: var(--red);
}
.stage-running {
color: var(--accent);
}
.stage-pending {
color: var(--text-dim);
}
.spinner {
display: inline-block;
animation: spin 1s linear infinite;
}
@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
.pipeline-step-label {
font-weight: 500;
}

View File

@@ -1,3 +1,4 @@
import './PipelineProgress.css';
import type { StageMap, StageStatus } from '../types/index.js';
const STAGES: { key: keyof StageMap; label: string }[] = [

View File

@@ -1,4 +1,5 @@
import { useState } from 'preact/hooks';
import './Cards.css';
import type { CuratorOutput, CuratorCategory } from '../types/index.js';
interface RecommendationCardProps {

View File

@@ -0,0 +1,124 @@
/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
width: var(--sidebar-width);
background: var(--bg-surface);
border-right: 1px solid var(--border);
display: flex;
flex-direction: column;
overflow: hidden;
flex-shrink: 0;
}
.sidebar-header {
padding: 20px 16px 12px;
border-bottom: 1px solid var(--border);
text-align: center;
}
.sidebar-title {
font-size: 24px;
font-weight: 700;
color: var(--text);
letter-spacing: -0.3px;
text-decoration: none;
display: inline-block;
transition: color 0.15s ease;
padding-bottom: 10px;
}
.sidebar-title:hover {
color: var(--accent);
}
.btn-new {
margin: 12px;
padding: 10px 14px;
background: var(--accent);
color: #fff;
border: none;
border-radius: var(--radius);
font-size: 13px;
font-weight: 600;
cursor: pointer;
transition: background 0.15s;
text-align: left;
}
.btn-new:hover {
background: var(--accent-hover);
}
.sidebar-section-label {
padding: 8px 16px 4px;
font-size: 11px;
font-weight: 600;
letter-spacing: 0.06em;
text-transform: uppercase;
color: var(--text-dim);
}
.sidebar-list {
list-style: none;
overflow-y: auto;
flex: 1;
padding: 4px 8px 8px;
}
.sidebar-empty {
padding: 8px;
color: var(--text-dim);
font-size: 13px;
}
.sidebar-item {
display: flex;
align-items: center;
gap: 8px;
padding: 8px 10px;
border-radius: var(--radius-sm);
cursor: pointer;
color: var(--text-muted);
font-size: 13px;
transition: background 0.1s, color 0.1s;
user-select: none;
}
.sidebar-item:hover {
background: var(--bg-surface-2);
color: var(--text);
}
.sidebar-item.selected {
background: var(--accent-dim);
color: var(--text);
}
.sidebar-icon {
font-size: 12px;
width: 16px;
text-align: center;
flex-shrink: 0;
}
.status-done {
color: var(--green);
}
.status-error {
color: var(--red);
}
.status-running {
color: var(--accent);
}
.status-pending {
color: var(--text-dim);
}
.sidebar-item-title {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

View File

@@ -1,3 +1,4 @@
import './Sidebar.css';
import type { RecommendationSummary } from '../types/index.js';
interface SidebarProps {
@@ -29,7 +30,7 @@ export function Sidebar({ list, selectedId, onSelect, onNewClick }: SidebarProps
return (
<aside class="sidebar">
<div class="sidebar-header">
<span class="sidebar-title">Recommender</span>
<a href="/" class="sidebar-title">Recommender</a>
</div>
<button class="btn-new" onClick={onNewClick}>

View File

@@ -0,0 +1,18 @@
import { createContext } from 'preact';
import { useContext } from 'preact/hooks';
import { useRecommendations } from '../hooks/useRecommendations.js';
import type { ComponentChildren } from 'preact';
type Value = ReturnType<typeof useRecommendations>;
const Ctx = createContext<Value | null>(null);
export function RecommendationsProvider({ children }: { children: ComponentChildren }) {
return <Ctx.Provider value={useRecommendations()}>{children}</Ctx.Provider>;
}
export function useRecommendationsContext(): Value {
const ctx = useContext(Ctx);
if (!ctx) throw new Error('Must be inside RecommendationsProvider');
return ctx;
}

View File

@@ -34,6 +34,7 @@ export function useRecommendations() {
liked_shows: string;
disliked_shows: string;
themes: string;
brainstorm_count?: number;
}) => {
const { id } = await createRecommendation(body);
await refreshList();

View File

@@ -54,123 +54,7 @@ body,
padding: 32px;
}
/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
width: var(--sidebar-width);
background: var(--bg-surface);
border-right: 1px solid var(--border);
display: flex;
flex-direction: column;
overflow: hidden;
flex-shrink: 0;
}
.sidebar-header {
padding: 20px 16px 12px;
border-bottom: 1px solid var(--border);
}
.sidebar-title {
font-size: 16px;
font-weight: 700;
color: var(--text);
letter-spacing: -0.3px;
}
.btn-new {
margin: 12px;
padding: 10px 14px;
background: var(--accent);
color: #fff;
border: none;
border-radius: var(--radius);
font-size: 13px;
font-weight: 600;
cursor: pointer;
transition: background 0.15s;
text-align: left;
}
.btn-new:hover {
background: var(--accent-hover);
}
.sidebar-section-label {
padding: 8px 16px 4px;
font-size: 11px;
font-weight: 600;
letter-spacing: 0.06em;
text-transform: uppercase;
color: var(--text-dim);
}
.sidebar-list {
list-style: none;
overflow-y: auto;
flex: 1;
padding: 4px 8px 8px;
}
.sidebar-empty {
padding: 8px;
color: var(--text-dim);
font-size: 13px;
}
.sidebar-item {
display: flex;
align-items: center;
gap: 8px;
padding: 8px 10px;
border-radius: var(--radius-sm);
cursor: pointer;
color: var(--text-muted);
font-size: 13px;
transition: background 0.1s, color 0.1s;
user-select: none;
}
.sidebar-item:hover {
background: var(--bg-surface-2);
color: var(--text);
}
.sidebar-item.selected {
background: var(--accent-dim);
color: var(--text);
}
.sidebar-icon {
font-size: 12px;
width: 16px;
text-align: center;
flex-shrink: 0;
}
.status-done {
color: var(--green);
}
.status-error {
color: var(--red);
}
.status-running {
color: var(--accent);
}
.status-pending {
color: var(--text-dim);
}
.sidebar-item-title {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* ── Main content areas ─────────────────────────────────── */
/* ── Shared content areas ───────────────────────────────── */
.empty-state {
display: flex;
@@ -189,270 +73,6 @@ body,
color: var(--text);
}
.content-area {
max-width: 860px;
margin: 0 auto;
}
.rec-title {
font-size: 20px;
font-weight: 700;
color: var(--text);
margin-bottom: 24px;
}
.error-state {
color: var(--text-muted);
}
.error-state h2 {
color: var(--red);
margin-bottom: 8px;
}
.error-state p {
margin-bottom: 16px;
}
/* ── Pipeline Progress ──────────────────────────────────── */
.pipeline-progress {
padding: 40px 0;
}
.pipeline-title {
font-size: 18px;
font-weight: 600;
color: var(--text);
margin-bottom: 24px;
}
.pipeline-steps {
list-style: none;
display: flex;
flex-direction: column;
gap: 12px;
}
.pipeline-step {
display: flex;
align-items: center;
gap: 12px;
padding: 12px 16px;
background: var(--bg-surface);
border: 1px solid var(--border);
border-radius: var(--radius);
font-size: 14px;
}
.pipeline-step--running {
border-color: var(--accent);
background: var(--accent-dim);
}
.pipeline-step--done {
border-color: rgba(34, 197, 94, 0.3);
background: rgba(34, 197, 94, 0.05);
}
.pipeline-step--error {
border-color: rgba(239, 68, 68, 0.3);
background: rgba(239, 68, 68, 0.05);
}
.stage-icon {
font-size: 16px;
width: 20px;
text-align: center;
}
.stage-done {
color: var(--green);
}
.stage-error {
color: var(--red);
}
.stage-running {
color: var(--accent);
}
.stage-pending {
color: var(--text-dim);
}
.spinner {
display: inline-block;
animation: spin 1s linear infinite;
}
@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
.pipeline-step-label {
font-weight: 500;
}
/* ── Cards ─────────────────────────────────────────────── */
.cards-grid {
display: flex;
flex-direction: column;
gap: 12px;
margin-bottom: 32px;
}
.card {
background: var(--bg-surface);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 16px;
transition: border-color 0.15s;
}
.card:hover {
border-color: var(--bg-surface-3);
}
.card-header {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 8px;
flex-wrap: wrap;
}
.badge {
font-size: 11px;
font-weight: 600;
padding: 2px 8px;
border-radius: 100px;
text-transform: uppercase;
letter-spacing: 0.04em;
flex-shrink: 0;
}
.badge-green {
background: rgba(34, 197, 94, 0.15);
color: #4ade80;
}
.badge-blue {
background: rgba(59, 130, 246, 0.15);
color: #60a5fa;
}
.badge-yellow {
background: rgba(234, 179, 8, 0.15);
color: #facc15;
}
.badge-red {
background: rgba(239, 68, 68, 0.15);
color: #f87171;
}
.card-title {
font-size: 16px;
font-weight: 600;
color: var(--text);
}
.card-explanation {
font-size: 13px;
color: var(--text-muted);
line-height: 1.5;
margin-bottom: 12px;
}
.card-feedback {
border-top: 1px solid var(--border);
padding-top: 10px;
}
.star-rating {
display: flex;
align-items: center;
gap: 2px;
}
.star-btn {
background: none;
border: none;
cursor: pointer;
font-size: 18px;
color: var(--text-dim);
padding: 0 2px;
transition: color 0.1s, transform 0.1s;
}
.star-btn:hover,
.star-btn.star-active {
color: var(--yellow);
}
.star-btn:hover {
transform: scale(1.1);
}
.feedback-saved {
margin-left: 8px;
font-size: 12px;
color: var(--green);
font-weight: 500;
}
.comment-area {
margin-top: 8px;
display: flex;
flex-direction: column;
gap: 6px;
}
.comment-input {
font-size: 13px;
resize: vertical;
}
/* ── Rerank Button ──────────────────────────────────────── */
.rerank-section {
padding: 16px 0 32px;
display: flex;
justify-content: center;
}
.btn-rerank {
padding: 12px 28px;
background: var(--bg-surface-2);
color: var(--text);
border: 1px solid var(--border);
border-radius: var(--radius);
font-size: 14px;
font-weight: 600;
cursor: pointer;
transition: background 0.15s, border-color 0.15s;
}
.btn-rerank:hover:not(:disabled) {
background: var(--bg-surface-3);
border-color: var(--accent);
color: var(--accent);
}
.btn-rerank:disabled {
opacity: 0.4;
cursor: not-allowed;
}
/* ── Buttons ────────────────────────────────────────────── */
.btn-primary {
@@ -496,230 +116,3 @@ body,
.btn-secondary:hover:not(:disabled) {
background: var(--bg-surface-3);
}
/* ── Modal ──────────────────────────────────────────────── */
.modal-backdrop {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.6);
display: flex;
align-items: center;
justify-content: center;
z-index: 100;
backdrop-filter: blur(2px);
}
.modal {
background: var(--bg-surface);
border: 1px solid var(--border);
border-radius: 12px;
width: 540px;
max-width: 96vw;
max-height: 90vh;
overflow-y: auto;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.modal-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 20px 20px 0;
}
.modal-header h2 {
font-size: 18px;
font-weight: 700;
}
.modal-close {
background: none;
border: none;
font-size: 22px;
color: var(--text-muted);
cursor: pointer;
line-height: 1;
padding: 0;
}
.modal-close:hover {
color: var(--text);
}
.modal-form {
padding: 20px;
display: flex;
flex-direction: column;
gap: 16px;
}
.form-group {
display: flex;
flex-direction: column;
gap: 6px;
flex: 1;
}
.form-group label {
font-size: 13px;
font-weight: 500;
color: var(--text-muted);
}
.form-row {
display: flex;
gap: 12px;
}
.form-input,
.form-textarea {
background: var(--bg-surface-2);
border: 1px solid var(--border);
border-radius: var(--radius-sm);
color: var(--text);
font-size: 14px;
padding: 10px 12px;
outline: none;
transition: border-color 0.15s;
font-family: inherit;
width: 100%;
}
.form-input:focus,
.form-textarea:focus {
border-color: var(--accent);
}
.form-textarea {
resize: vertical;
min-height: 80px;
}
.modal-actions {
display: flex;
justify-content: flex-end;
gap: 10px;
padding-top: 4px;
}
/* ── Landing page ───────────────────────────────────────── */
.landing-layout {
display: flex;
height: 100vh;
position: relative;
overflow: hidden;
}
.landing-bg {
position: absolute;
inset: -6px;
/* overflow slightly to hide blur edges */
background: url('/wallpaper.png') center / cover no-repeat;
filter: blur(3px) brightness(0.35);
z-index: 0;
}
.landing-layout .sidebar {
position: relative;
z-index: 1;
background: rgba(26, 29, 39, 0.85);
backdrop-filter: blur(8px);
}
.landing-main {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 28px;
text-align: center;
position: relative;
z-index: 1;
padding: 40px;
}
.landing-title {
font-size: 5rem;
font-weight: 800;
color: #fff;
letter-spacing: -2px;
line-height: 1;
}
.landing-tagline {
font-size: 1.4rem;
color: rgba(255, 255, 255, 0.6);
font-weight: 400;
}
.btn-gradient {
padding: 18px 52px;
font-size: 1.15rem;
font-weight: 700;
color: #fff;
border: none;
border-radius: 14px;
cursor: pointer;
background: linear-gradient(135deg, #e040fb, #7c4dff, #2979ff, #00b0ff, #e040fb);
background-size: 300% 300%;
animation: gradient-flow 5s ease infinite;
box-shadow: 0 4px 32px rgba(99, 102, 241, 0.4);
transition: transform 0.15s, box-shadow 0.15s;
letter-spacing: 0.02em;
}
.btn-gradient:hover {
transform: translateY(-2px);
box-shadow: 0 8px 40px rgba(99, 102, 241, 0.55);
}
@keyframes gradient-flow {
0% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
100% {
background-position: 0% 50%;
}
}
/* ── Recom page ─────────────────────────────────────────── */
.recom-page {
display: flex;
flex-direction: column;
height: 100vh;
overflow: hidden;
}
.recom-nav {
flex-shrink: 0;
padding: 12px 24px;
border-bottom: 1px solid var(--border);
background: var(--bg-surface);
}
.recom-back {
color: var(--text-muted);
text-decoration: none;
font-size: 14px;
font-weight: 500;
transition: color 0.15s;
}
.recom-back:hover {
color: var(--text);
}
.recom-content {
flex: 1;
overflow-y: auto;
padding: 32px;
}

View File

@@ -0,0 +1,73 @@
/* ── Landing page ───────────────────────────────────────── */
.landing-layout {
display: flex;
height: 100vh;
position: relative;
overflow: hidden;
}
.landing-bg {
position: absolute;
inset: -6px;
/* overflow slightly to hide blur edges */
background: url('/wallpaper.png') center / cover no-repeat;
filter: blur(3px) brightness(0.35);
z-index: 0;
}
.landing-layout .sidebar {
position: relative;
z-index: 1;
background: rgba(26, 29, 39, 0.85);
backdrop-filter: blur(8px);
}
.landing-main {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 28px;
text-align: center;
position: relative;
z-index: 1;
padding: 40px;
}
.landing-title {
font-size: 5rem;
font-weight: 800;
color: #fff;
letter-spacing: -2px;
line-height: 1;
}
.landing-tagline {
font-size: 1.4rem;
color: rgba(255, 255, 255, 0.6);
font-weight: 400;
}
.btn-gradient {
padding: 16px 42px;
font-size: 1.20rem;
font-weight: 700;
color: rgba(255, 255, 255, 0.9);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 12px;
cursor: pointer;
background: linear-gradient(135deg, rgba(113, 88, 226, 0.8), rgba(61, 59, 243, 0.8));
backdrop-filter: blur(6px);
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), inset 0 1px 1px rgba(255, 255, 255, 0.1);
transition: all 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
letter-spacing: 0.02em;
}
.btn-gradient:hover {
transform: translateY(-2px);
color: #fff;
background: linear-gradient(135deg, rgba(113, 88, 226, 0.95), rgba(41, 121, 255, 0.95));
box-shadow: 0 8px 24px rgba(113, 88, 226, 0.3), inset 0 1px 2px rgba(255, 255, 255, 0.2);
}

View File

@@ -1,11 +1,12 @@
import { useState } from 'preact/hooks';
import './Home.css';
import { route } from 'preact-router';
import { Sidebar } from '../components/Sidebar.js';
import { NewRecommendationModal } from '../components/NewRecommendationModal.js';
import { useRecommendations } from '../hooks/useRecommendations.js';
import { useRecommendationsContext } from '../context/RecommendationsContext.js';
export function Home() {
const { list, createNew } = useRecommendations();
const { list, createNew } = useRecommendationsContext();
const [showModal, setShowModal] = useState(false);
const handleSelect = (id: string) => route(`/recom/${id}`);
@@ -15,6 +16,7 @@ export function Home() {
liked_shows: string;
disliked_shows: string;
themes: string;
brainstorm_count?: number;
}) => {
const id = await createNew(body);
route(`/recom/${id}`);

View File

@@ -0,0 +1,30 @@
/* ── Recom page ─────────────────────────────────────────── */
.recom-content {
min-height: 100%;
}
.content-area {
max-width: 860px;
margin: 0 auto;
}
.rec-title {
font-size: 20px;
font-weight: 700;
color: var(--text);
margin-bottom: 24px;
}
.error-state {
color: var(--text-muted);
}
.error-state h2 {
color: var(--red);
margin-bottom: 8px;
}
.error-state p {
margin-bottom: 16px;
}

View File

@@ -1,8 +1,11 @@
import { useState, useCallback, useEffect } from 'preact/hooks';
import './Recom.css';
import { route } from 'preact-router';
import { PipelineProgress } from '../components/PipelineProgress.js';
import { RecommendationCard } from '../components/RecommendationCard.js';
import { useRecommendations } from '../hooks/useRecommendations.js';
import { Sidebar } from '../components/Sidebar.js';
import { NewRecommendationModal } from '../components/NewRecommendationModal.js';
import { useRecommendationsContext } from '../context/RecommendationsContext.js';
import { useSSE } from '../hooks/useSSE.js';
import { getRecommendation } from '../api/client.js';
import type { Recommendation, SSEEvent, StageMap, PipelineStage } from '../types/index.js';
@@ -22,11 +25,12 @@ const DEFAULT_STAGES: StageMap = {
const STAGE_ORDER: (keyof StageMap)[] = ['interpreter', 'retrieval', 'ranking', 'curator'];
export function Recom({ id }: RecomProps) {
const { feedback, submitFeedback, rerank, updateStatus, refreshList } = useRecommendations();
const { list, feedback, submitFeedback, rerank, updateStatus, refreshList, createNew } = useRecommendationsContext();
const [rec, setRec] = useState<Recommendation | null>(null);
const [stages, setStages] = useState<StageMap>(DEFAULT_STAGES);
const [sseUrl, setSseUrl] = useState<string | null>(null);
const [showModal, setShowModal] = useState(false);
useEffect(() => {
setRec(null);
@@ -83,66 +87,83 @@ export function Recom({ id }: RecomProps) {
setRec((prev) => (prev ? { ...prev, status: 'pending' } : null));
};
const handleCreateNew = async (body: {
main_prompt: string;
liked_shows: string;
disliked_shows: string;
themes: string;
brainstorm_count?: number;
}) => {
const newId = await createNew(body);
route(`/recom/${newId}`);
};
const isRunning = rec?.status === 'running' || rec?.status === 'pending' || !!sseUrl;
const feedbackMap = new Map(feedback.map((f) => [f.tv_show_name, f]));
return (
<div class="recom-page">
<nav class="recom-nav">
<a
class="recom-back"
href="/"
onClick={(e) => { e.preventDefault(); route('/'); }}
>
Recommender
</a>
</nav>
<div class="layout">
<Sidebar
list={list}
selectedId={id}
onSelect={(sid) => route(`/recom/${sid}`)}
onNewClick={() => setShowModal(true)}
/>
<div class="recom-content">
{isRunning && (
<div class="content-area">
<PipelineProgress stages={stages} />
</div>
)}
{!isRunning && rec?.status === 'done' && rec.recommendations && (
<div class="content-area">
<h2 class="rec-title">{rec.title}</h2>
<div class="cards-grid">
{rec.recommendations.map((show) => (
<RecommendationCard
key={show.title}
show={show}
existingFeedback={feedbackMap.get(show.title)}
onFeedback={async (name, stars, comment) => {
await submitFeedback({ tv_show_name: name, stars, feedback: comment });
}}
/>
))}
<main class="main-content">
<div class="recom-content">
{isRunning && (
<div class="content-area">
<PipelineProgress stages={stages} />
</div>
<div class="rerank-section">
<button
class="btn-rerank"
onClick={handleRerank}
disabled={feedback.length === 0}
title={feedback.length === 0 ? 'Rate at least one show to enable re-ranking' : 'Re-rank based on your feedback'}
>
Re-rank with Feedback {feedback.length > 0 ? `(${feedback.length} rated)` : ''}
)}
{!isRunning && rec?.status === 'done' && rec.recommendations && (
<div class="content-area">
<h2 class="rec-title">{rec.title}</h2>
<div class="cards-grid">
{rec.recommendations.map((show) => (
<RecommendationCard
key={show.title}
show={show}
existingFeedback={feedbackMap.get(show.title)}
onFeedback={async (name, stars, comment) => {
await submitFeedback({ tv_show_name: name, stars, feedback: comment });
}}
/>
))}
</div>
<div class="rerank-section">
<button
class="btn-rerank"
onClick={handleRerank}
disabled={feedback.length === 0}
title={feedback.length === 0 ? 'Rate at least one show to enable re-ranking' : 'Re-rank based on your feedback'}
>
Re-rank with Feedback {feedback.length > 0 ? `(${feedback.length} rated)` : ''}
</button>
</div>
</div>
)}
{!isRunning && rec?.status === 'error' && (
<div class="content-area error-state">
<h2>Something went wrong</h2>
<p>The pipeline encountered an error. You can try again by clicking Re-rank.</p>
<button class="btn-primary" onClick={handleRerank}>
Try Again
</button>
</div>
</div>
)}
)}
</div>
</main>
{!isRunning && rec?.status === 'error' && (
<div class="content-area error-state">
<h2>Something went wrong</h2>
<p>The pipeline encountered an error. You can try again by clicking Re-rank.</p>
<button class="btn-primary" onClick={handleRerank}>
Try Again
</button>
</div>
)}
</div>
{showModal && (
<NewRecommendationModal
onClose={() => setShowModal(false)}
onSubmit={handleCreateNew}
/>
)}
</div>
);
}