PaperStack / types.ts
Akhil-Theerthala's picture
Upload 32 files
46a757e verified
export interface BentoCardData {
id: string;
title: string;
summary: string;
type: 'stat' | 'concept' | 'quote' | 'insight' | 'process';
colSpan: number; // 1 to 4
rowSpan: number; // 1 to 2
detailPrompt: string; // The prompt to send to the AI to get more details
mermaid?: string; // Mermaid JS diagram definition
expandedContent?: string;
isLoadingDetails?: boolean;
rating?: number;
feedback?: string;
}
export interface ChatMessage {
id: string;
role: 'user' | 'model' | 'system';
text: string;
timestamp: number;
}
// Model types
export type GeminiModel = 'gemini-2.5-flash' | 'gemini-3-pro-preview';
// ADHD-Friendly Reading Preferences
export interface ReadingPreferences {
bionicReading: boolean;
eli5Mode: boolean; // Simple language mode
highlightKeyTerms: boolean;
ttsEnabled: boolean;
ttsSpeed: number; // 0.5 to 2.0
}
export interface AppSettings {
apiKey: string;
model: GeminiModel;
theme: 'light' | 'dark';
layoutMode: 'auto' | 'grid' | 'list';
useThinking: boolean;
readingPreferences: ReadingPreferences;
}
// Confidence level for AI-generated content
export type ConfidenceLevel = 'direct-quote' | 'paraphrase' | 'synthesis' | 'interpretation';
// Source anchor for zero-latency verification
export interface SourceAnchor {
id: string;
claimText: string;
sourceText: string;
pageNumber?: number;
confidence: ConfidenceLevel;
highlightColor: string;
}
export interface ProcessingStatus {
state: 'idle' | 'reading' | 'analyzing' | 'generating' | 'complete' | 'error';
message?: string;
}
// Progressive Disclosure Layers (ADHD-Friendly)
export interface ContentLayers {
// Layer 1: Tweet-length core thesis (< 280 chars)
thesis: string;
// Layer 2: Key takeaways (3-5 bullet points)
takeaways: string[];
// Layer 3: Full detailed content (markdown)
detailed: string;
// ELI5 version for simple language mode
eli5Content?: string;
}
// Blog View Types
export interface BlogSection {
id: string;
title: string;
content: string; // Markdown (Layer 3 - detailed)
// Progressive disclosure layers
layers?: ContentLayers;
visualizationType?: 'mermaid' | 'chart' | 'equation' | 'none';
visualizationData?: string;
chartData?: ChartData;
marginNotes?: MarginNote[];
technicalTerms?: TechnicalTerm[];
collapsibleSections?: CollapsibleContent[];
isLoading?: boolean;
error?: string;
// Validation status
validationStatus?: ValidationStatus;
// Source anchors for verification
sourceAnchors?: SourceAnchor[];
}
export interface ValidationStatus {
isValidated: boolean;
contentRelevance: ValidationResult;
visualizationValidity: ValidationResult;
overallScore: number; // 0-100
wasRepaired?: boolean;
repairAttempts?: number;
}
export interface ValidationResult {
passed: boolean;
score: number; // 0-100
issues: string[];
suggestions?: string[];
}
export interface ValidationStatus {
isValidated: boolean;
contentRelevance: ValidationResult;
visualizationValidity: ValidationResult;
overallScore: number; // 0-100
wasRepaired?: boolean;
repairAttempts?: number;
}
export interface ValidationResult {
passed: boolean;
score: number; // 0-100
issues: string[];
suggestions?: string[];
}
// Structure plan from paper analysis
export interface SectionPlan {
id: string;
title: string;
sectionType: 'intro' | 'background' | 'methodology' | 'results' | 'analysis' | 'applications' | 'conclusion' | 'custom';
focusPoints: string[]; // Key points to cover
suggestedVisualization: 'mermaid' | 'chart' | 'equation' | 'none';
visualizationHint?: string; // What to visualize
estimatedLength: 'short' | 'medium' | 'long';
}
export interface PaperStructure {
paperTitle: string;
paperAbstract: string;
mainContribution: string;
sections: SectionPlan[];
keyTerms: string[]; // Important terms across the paper
}
export interface MarginNote {
id: string;
text: string;
icon?: 'info' | 'warning' | 'tip' | 'note';
}
export interface TechnicalTerm {
term: string;
definition: string;
highlightColor?: string; // Consistent color for this term throughout
}
export interface CollapsibleContent {
id: string;
title: string;
content: string;
}
// Interactive Chart Types (Playable Visualizations)
export interface ChartData {
type: 'bar' | 'line' | 'pie' | 'scatter' | 'area';
title: string;
data: Array<{ label: string; value: number; [key: string]: any }>;
xAxis?: string;
yAxis?: string;
colors?: string[];
// Interactive features
interactive?: {
enableSliders?: boolean;
sliderConfig?: SliderConfig[];
enableToggles?: boolean;
toggleableDatasets?: string[];
};
}
// Slider configuration for interactive charts
export interface SliderConfig {
id: string;
label: string;
min: number;
max: number;
step: number;
defaultValue: number;
affectsVariable: string; // Which variable this slider modifies
}
export type ViewMode = 'grid' | 'blog';
// Text-to-Speech state
export interface TTSState {
isPlaying: boolean;
currentSectionId: string | null;
currentWordIndex: number;
speed: number;
}
// Wayfinding / Progress tracking
export interface ReadingProgress {
sectionId: string;
percentComplete: number;
timeSpent: number; // in seconds
}