/* * ============================================================================= * VibeQuant (vquant) — AI-Powered Financial Intelligence Platform * ----------------------------------------------------------------------------- * File: client/src/pages/shared-report.tsx * * Author: Simon-Pierre Boucher * Contact: contact@spboucher.ai * Website: https://www.spboucher.ai * Demo: https://www.vquant.ai * License: MIT (see LICENSE) * * Copyright © 2026 Simon-Pierre Boucher. All rights reserved. * ============================================================================= */ import { useQuery } from "@tanstack/react-query"; import { useRoute, useLocation } from "wouter"; import { Sparkles, Loader2, ArrowLeft } from "lucide-react"; import { StreamingAnswer } from "@/components/streaming-answer"; import { ToolResults } from "@/components/chat/tool-results"; import { ResultCard } from "@/components/chat/result-card"; import { ThemeToggle } from "@/components/theme-toggle"; import { ThemeColorPicker } from "@/components/theme-color-picker"; import { Button } from "@/components/ui/button"; import { DownloadButtons } from "@/components/chat/download-buttons"; import { CustomPythonFigure } from "@/components/chat/custom-python-figure"; import type { SearchResult } from "@shared/types"; import { useRef, useMemo } from "react"; interface SharedReportData { question: string; answer: string; toolResults: any[]; sources: SearchResult[]; customPythonFigures?: Array<{ id: string; figures: string[]; output?: string; description?: string }>; createdAt: string; } export default function SharedReport() { const [, params] = useRoute("/share/:shareId"); const [, setLocation] = useLocation(); const shareId = params?.shareId; const contentRef = useRef(null); const { data, isLoading, error } = useQuery({ queryKey: ["/api/share", shareId], enabled: !!shareId, }); // Build figure registry for inline references const figureRegistry = useMemo(() => { const registry = new Map(); if (data?.customPythonFigures) { data.customPythonFigures.forEach(batch => { batch.figures.forEach((fig, idx) => { const figId = `${batch.id}-${idx}`; registry.set(figId, fig); }); }); } return registry; }, [data?.customPythonFigures]); // Extract flat list of figure data URIs for markdown image resolution // Figures are stored as base64 in the DB — convert to data URIs so they // survive redeployments (file-based /figures/ URLs are ephemeral on disk). const figureUrls = useMemo(() => { if (!data?.customPythonFigures) return []; return data.customPythonFigures.flatMap(batch => batch.figures.map(fig => fig.startsWith('/') || fig.startsWith('http') || fig.startsWith('data:') ? fig : `data:image/png;base64,${fig}` ) ); }, [data?.customPythonFigures]); if (isLoading) { return (

Chargement du rapport...

); } if (error || !data) { return (

Rapport introuvable

Ce lien de partage n'existe pas ou a expiré

); } return (
{/* Subtle Background */}
{/* Header */}
setLocation('/')}>
VQuant
{/* Main Content */}
{/* Branding */}

Rapport généré par

VQuant AI

{new Date(data.createdAt).toLocaleDateString('fr-FR', { year: 'numeric', month: 'long', day: 'numeric', hour: '2-digit', minute: '2-digit' })}

{/* Question */}

Question

{data.question}

{/* Download Buttons */}
{/* Content */}
{data.customPythonFigures && data.customPythonFigures.length > 0 && (
)} {data.sources.length > 0 && (

Web Results

{data.sources.map((result: SearchResult, index: number) => ( ))}
)}
); }