import React, { useState, useEffect, useRef } from 'react'; import { Search, BookOpen, FileText, Users, Settings, Save, Download, Upload, BookmarkPlus, CheckSquare, BarChart2, Clock, AlertCircle, Database, PieChart, BarChart, LineChart, Table, Brain, Edit3, Sliders, ChevronDown, ChevronRight, Maximize2, Minimize2, HelpCircle, FileText as FileIcon, Clipboard, ArrowRight, Check, X, RefreshCw } from 'lucide-react'; import { Chart as ChartJS, CategoryScale, LinearScale, PointElement, LineElement, BarElement, ArcElement, Title, Tooltip, Legend } from 'chart.js'; import { Line, Bar, Pie } from 'react-chartjs-2'; // Register ChartJS components ChartJS.register(CategoryScale, LinearScale, PointElement, LineElement, BarElement, ArcElement, Title, Tooltip, Legend); // Main application component export default function AcademicPaperAssistant() { // Core state const [activeTab, setActiveTab] = useState('editor'); const [paperTitle, setPaperTitle] = useState('Untitled Research Paper'); const [paperContent, setPaperContent] = useState(''); const [wordCount, setWordCount] = useState(0); const [references, setReferences] = useState([]); const [citationStyle, setCitationStyle] = useState('APA'); const [savedAt, setSavedAt] = useState(null); const [showReferenceModal, setShowReferenceModal] = useState(false); const [newReference, setNewReference] = useState({ title: '', authors: '', journal: '', year: '', doi: '', url: '' }); const [searchQuery, setSearchQuery] = useState(''); const [searchResults, setSearchResults] = useState([]); const [isSearching, setIsSearching] = useState(false); const [templates, setTemplates] = useState([ { id: 1, name: 'IEEE', description: 'For engineering and computer science' }, { id: 2, name: 'Nature', description: 'For natural sciences' }, { id: 3, name: 'JAMA', description: 'For medical research' }, { id: 4, name: 'APA', description: 'For social sciences' } ]); const [selectedTemplate, setSelectedTemplate] = useState(null); const [aiSuggestions, setAiSuggestions] = useState([]); const [showAiSuggestions, setShowAiSuggestions] = useState(false); const [paperSections, setPaperSections] = useState([ { id: 'abstract', name: 'Abstract', content: '', completed: false }, { id: 'introduction', name: 'Introduction', content: '', completed: false }, { id: 'literature', name: 'Literature Review', content: '', completed: false }, { id: 'methods', name: 'Methods', content: '', completed: false }, { id: 'results', name: 'Results', content: '', completed: false }, { id: 'discussion', name: 'Discussion', content: '', completed: false }, { id: 'conclusion', name: 'Conclusion', content: '', completed: false }, { id: 'references', name: 'References', content: '', completed: false } ]); const [activeSection, setActiveSection] = useState('abstract'); const [collaborators, setCollaborators] = useState([ { id: 1, name: 'You', email: 'you@example.com', role: 'Owner' } ]); // New state for AI paper generation const [showAiGenerationModal, setShowAiGenerationModal] = useState(false); const [aiGenerationParams, setAiGenerationParams] = useState({ topic: '', field: 'Computer Science', keywords: '', length: 'medium', model: 'claude-3.7-sonnet', includeVisualizations: true, includeStatistics: true, tone: 'academic' }); const [isGeneratingPaper, setIsGeneratingPaper] = useState(false); const [generationProgress, setGenerationProgress] = useState(0); const [generationStep, setGenerationStep] = useState(''); // New state for data visualization const [showVisualizationModal, setShowVisualizationModal] = useState(false); const [visualizationType, setVisualizationType] = useState('bar'); const [visualizationData, setVisualizationData] = useState({ labels: ['Dataset 1', 'Dataset 2', 'Dataset 3', 'Dataset 4', 'Dataset 5'], datasets: [ { label: 'Sample Data', data: [65, 59, 80, 81, 56], backgroundColor: [ 'rgba(44, 122, 123, 0.6)', 'rgba(54, 162, 235, 0.6)', 'rgba(255, 206, 86, 0.6)', 'rgba(75, 192, 192, 0.6)', 'rgba(153, 102, 255, 0.6)', ], borderColor: [ 'rgba(44, 122, 123, 1)', 'rgba(54, 162, 235, 1)', 'rgba(255, 206, 86, 1)', 'rgba(75, 192, 192, 1)', 'rgba(153, 102, 255, 1)', ], borderWidth: 1, }, ], }); const [visualizationOptions, setVisualizationOptions] = useState({ title: 'Sample Chart', xAxisLabel: 'Categories', yAxisLabel: 'Values', showLegend: true, }); const [visualizations, setVisualizations] = useState([]); const [activeVisualization, setActiveVisualization] = useState(null); // New state for statistical analysis const [showStatisticsModal, setShowStatisticsModal] = useState(false); const [statisticalTests, setStatisticalTests] = useState([ { id: 't-test', name: 'T-Test', description: 'Compare means of two groups' }, { id: 'anova', name: 'ANOVA', description: 'Compare means across multiple groups' }, { id: 'correlation', name: 'Correlation Analysis', description: 'Measure relationship between variables' }, { id: 'regression', name: 'Regression Analysis', description: 'Model relationship between dependent and independent variables' }, { id: 'chi-square', name: 'Chi-Square Test', description: 'Test relationship between categorical variables' } ]); const [selectedStatisticalTest, setSelectedStatisticalTest] = useState('t-test'); const [statisticalData, setStatisticalData] = useState({ group1: [65, 72, 83, 54, 91], group2: [43, 58, 76, 81, 47] }); const [statisticalResults, setStatisticalResults] = useState(null); const [statisticalAnalyses, setStatisticalAnalyses] = useState([]); // Calculate word count whenever paper content changes useEffect(() => { const words = paperContent.trim().split(/\s+/); setWordCount(paperContent ? words.length : 0); }, [paperContent]); // Auto-save functionality useEffect(() => { const saveTimer = setTimeout(() => { if (paperContent) { // In a real app, this would save to a database or localStorage console.log('Auto-saving paper...'); setSavedAt(new Date()); } }, 5000); return () => clearTimeout(saveTimer); }, [paperContent]); // Simulate AI suggestions based on content useEffect(() => { if (paperContent.length > 100) { // In a real app, this would call an AI service const mockSuggestions = [ "Consider adding more detail to your methodology section.", "Your introduction could benefit from a clearer research question.", "The literature review seems incomplete. Consider adding more recent sources." ]; setAiSuggestions(mockSuggestions); } }, [paperContent]); // Handle search functionality const handleSearch = (e) => { e.preventDefault(); if (!searchQuery.trim()) return; setIsSearching(true); // Simulate API call to academic search engine setTimeout(() => { const mockResults = [ { id: 1, title: "Advances in Machine Learning for Natural Language Processing", authors: "Smith, J., Johnson, A.", journal: "Journal of AI Research", year: 2022, doi: "10.1234/jair.2022.123" }, { id: 2, title: "A Comprehensive Review of Deep Learning Architectures", authors: "Chen, L., Wang, H.", journal: "IEEE Transactions on Neural Networks", year: 2021, doi: "10.1109/tnn.2021.456" }, { id: 3, title: "The Impact of Artificial Intelligence on Academic Research", authors: "Garcia, M., Lee, S.", journal: "Science and Education", year: 2023, doi: "10.5678/sci.edu.2023.789" } ]; setSearchResults(mockResults); setIsSearching(false); }, 1000); }; // Add a reference from search results const addReferenceFromSearch = (reference) => { setReferences([...references, reference]); // Show confirmation toast in a real app }; // Add a new reference manually const addNewReference = () => { if (newReference.title && newReference.authors) { setReferences([...references, { ...newReference, id: Date.now() }]); setNewReference({ title: '', authors: '', journal: '', year: '', doi: '', url: '' }); setShowReferenceModal(false); } }; // Update section content const updateSectionContent = (sectionId, content) => { setPaperSections(paperSections.map(section => section.id === sectionId ? { ...section, content } : section )); // Update overall paper content const updatedContent = paperSections .map(section => section.id === sectionId ? content : section.content) .join('\n\n'); setPaperContent(updatedContent); }; // Mark section as completed const toggleSectionCompletion = (sectionId) => { setPaperSections(paperSections.map(section => section.id === sectionId ? { ...section, completed: !section.completed } : section )); }; // Apply template const applyTemplate = (template) => { setSelectedTemplate(template); // In a real app, this would load template-specific formatting and guidelines }; // Export paper const exportPaper = (format) => { // In a real app, this would generate and download the paper in the specified format console.log(`Exporting paper in ${format} format...`); alert(`Your paper would now be downloaded in ${format} format.`); }; // Calculate completion percentage const calculateCompletion = () => { const completedSections = paperSections.filter(section => section.completed).length; return Math.round((completedSections / paperSections.length) * 100); }; // Generate paper with AI const generatePaperWithAI = () => { setIsGeneratingPaper(true); setGenerationProgress(0); setGenerationStep('Initializing AI model...'); // Simulate paper generation process const steps = [ 'Initializing AI model...', 'Researching topic...', 'Gathering relevant literature...', 'Drafting abstract...', 'Writing introduction...', 'Developing literature review...', 'Formulating methodology...', 'Analyzing results...', 'Creating visualizations...', 'Performing statistical analysis...', 'Writing discussion...', 'Finalizing conclusion...', 'Generating references...', 'Formatting paper...' ]; let currentStep = 0; const totalSteps = steps.length; const progressInterval = setInterval(() => { if (currentStep < totalSteps) { setGenerationStep(steps[currentStep]); setGenerationProgress(Math.round(((currentStep + 1) / totalSteps) * 100)); currentStep++; } else { clearInterval(progressInterval); // Simulate generated paper content const generatedAbstract = "This study investigates the impact of artificial intelligence on academic research productivity across multiple disciplines. Using a mixed-methods approach combining bibliometric analysis and qualitative interviews with researchers, we identified significant patterns in how AI tools are transforming scholarly workflows. Our findings indicate a 37% increase in research output among early adopters of AI-assisted writing and analysis tools, with particularly strong effects in data-intensive fields. However, challenges related to algorithmic bias and reproducibility remain significant concerns. This paper presents a framework for responsible AI integration in academic workflows and suggests policy recommendations for research institutions."; const generatedIntroduction = "The rapid advancement of artificial intelligence (AI) technologies has begun to transform numerous aspects of academic research, from literature review and data analysis to manuscript preparation and peer review (Smith et al., 2022). As large language models and specialized research tools become increasingly sophisticated, questions arise about their impact on research productivity, quality, and integrity (Chen & Wang, 2021). While proponents highlight potential efficiency gains and novel insights enabled by AI, critics raise concerns about algorithmic bias, reproducibility challenges, and the changing nature of scholarly expertise (Garcia & Lee, 2023).\n\nThis study aims to quantify and characterize the effects of AI adoption on research productivity across disciplines, identify best practices for AI integration in academic workflows, and develop a framework for addressing ethical and methodological challenges. By combining quantitative bibliometric analysis with qualitative insights from researchers, we provide a comprehensive assessment of AI's current and potential future impact on scholarly knowledge production."; // Update paper sections with generated content setPaperSections(paperSections.map(section => { if (section.id === 'abstract') { return { ...section, content: generatedAbstract, completed: true }; } else if (section.id === 'introduction') { return { ...section, content: generatedIntroduction, completed: true }; } else if (section.id === 'literature') { return { ...section, content: "The literature on AI in academic research can be categorized into three main streams: studies of AI as a research tool, investigations of AI's impact on research practices, and ethical considerations in AI-assisted research.\n\nAI as a research tool has seen rapid development across disciplines. In biomedicine, machine learning algorithms have demonstrated success in protein structure prediction (AlphaFold Team, 2021) and drug discovery (Johnson et al., 2022). In the humanities, natural language processing has enabled large-scale text analysis of historical documents and literary corpora (Williams & Thompson, 2020).", completed: true }; } else if (section.id === 'methods') { return { ...section, content: "This study employed a mixed-methods research design combining quantitative bibliometric analysis with qualitative interviews.\n\nFor the bibliometric component, we analyzed publication data from Web of Science and Scopus spanning 2018-2023, focusing on research productivity metrics across 12 disciplines. We identified AI adoption through explicit mentions in methodology sections and acknowledgments, supplemented by a survey of corresponding authors (n=427).\n\nQualitative data collection involved semi-structured interviews with 48 researchers across career stages and disciplines. Participants were selected using maximum variation sampling to ensure diverse perspectives. Interviews explored researchers' experiences with AI tools, perceived impacts on productivity and quality, and ethical considerations.", completed: true }; } else if (section.id === 'results') { return { ...section, content: "Our analysis revealed significant patterns in AI adoption and impact across academic disciplines.\n\nBibliometric analysis showed that researchers who adopted AI tools published an average of 37% more papers annually compared to matched non-adopters (p<0.001). This effect was strongest in computer science (52% increase), biomedicine (43%), and physics (39%), but remained significant across all fields studied. Citation impact showed more variable results, with significant positive effects in data-intensive fields but no consistent pattern in theoretical or qualitative disciplines.\n\nQualitative findings indicated that researchers primarily use AI for four purposes: literature discovery and synthesis (78% of participants), data analysis (65%), manuscript drafting and editing (61%), and visualization creation (42%). Early-career researchers reported higher rates of adoption and more diverse use cases compared to senior scholars.", completed: true }; } else if (section.id === 'discussion') { return { ...section, content: "The findings of this study highlight both the transformative potential of AI in academic research and important challenges that require attention.\n\nThe substantial productivity gains observed across disciplines suggest that AI tools are effectively addressing key bottlenecks in the research process. Particularly notable is the democratizing effect reported by researchers at less-resourced institutions, who described AI tools as partially compensating for limited access to research assistance and specialized expertise. However, the uneven adoption patterns across career stages and institutional types raise concerns about emerging forms of inequality in research capabilities.\n\nThe qualitative findings reveal a nuanced relationship between researchers and AI tools that goes beyond simple productivity metrics. Many participants described a collaborative relationship in which AI serves as a thought partner, helping to identify connections between disparate literature or suggesting alternative interpretations of data. This finding challenges simplistic narratives about AI replacing human researchers, instead pointing to new forms of human-AI complementarity in knowledge production.", completed: true }; } else if (section.id === 'conclusion') { return { ...section, content: "This study has demonstrated that AI adoption is associated with significant increases in research productivity across academic disciplines, with particularly strong effects in data-intensive fields. The mixed-methods approach revealed not only quantitative productivity gains but also qualitative changes in research practices and scholarly collaboration.\n\nOur findings suggest that responsible integration of AI in academic workflows requires attention to issues of transparency, reproducibility, equity, and the preservation of human creativity and critical thinking. The framework developed in this study offers a starting point for researchers, institutions, and policymakers seeking to maximize the benefits of AI while mitigating potential risks.\n\nFuture research should examine longitudinal effects of AI adoption on research trajectories, investigate potential impacts on research diversity and innovation, and develop more sophisticated methods for attributing contributions in AI-assisted research. As AI capabilities continue to advance, ongoing critical reflection on their role in knowledge production will be essential to maintaining the integrity and social value of academic research.", completed: true }; } else { return section; } })); // Add sample visualizations const newVisualizations = [ { id: Date.now(), type: 'bar', title: 'AI Adoption Rates by Discipline', description: 'Percentage of researchers reporting regular use of AI tools in their work', data: { labels: ['Computer Science', 'Biomedicine', 'Physics', 'Economics', 'Psychology', 'Sociology', 'History'], datasets: [{ label: 'Adoption Rate (%)', data: [78, 65, 52, 43, 38, 25, 18], backgroundColor: 'rgba(44, 122, 123, 0.6)', borderColor: 'rgba(44, 122, 123, 1)', borderWidth: 1 }] }, options: { title: 'AI Adoption Rates by Discipline', xAxisLabel: 'Discipline', yAxisLabel: 'Adoption Rate (%)', showLegend: true } }, { id: Date.now() + 1, type: 'line', title: 'Publication Productivity Before and After AI Adoption', description: 'Average annual publications per researcher', data: { labels: ['Year -2', 'Year -1', 'Adoption Year', 'Year +1', 'Year +2'], datasets: [{ label: 'AI Adopters', data: [3.2, 3.4, 3.8, 4.7, 5.2], borderColor: 'rgba(44, 122, 123, 1)', backgroundColor: 'rgba(44, 122, 123, 0.1)', tension: 0.3, fill: true }, { label: 'Non-Adopters', data: [3.3, 3.3, 3.4, 3.5, 3.6], borderColor: 'rgba(153, 102, 255, 1)', backgroundColor: 'rgba(153, 102, 255, 0.1)', tension: 0.3, fill: true }] }, options: { title: 'Publication Productivity Before and After AI Adoption', xAxisLabel: 'Year Relative to AI Adoption', yAxisLabel: 'Average Publications per Researcher', showLegend: true } }, { id: Date.now() + 2, type: 'pie', title: 'Primary Uses of AI in Research Workflow', description: 'Percentage of researchers reporting each use case as primary', data: { labels: ['Literature Review', 'Data Analysis', 'Manuscript Drafting', 'Visualization', 'Other'], datasets: [{ data: [35, 28, 22, 12, 3], backgroundColor: [ 'rgba(44, 122, 123, 0.6)', 'rgba(54, 162, 235, 0.6)', 'rgba(255, 206, 86, 0.6)', 'rgba(75, 192, 192, 0.6)', 'rgba(153, 102, 255, 0.6)', ], borderColor: [ 'rgba(44, 122, 123, 1)', 'rgba(54, 162, 235, 1)', 'rgba(255, 206, 86, 1)', 'rgba(75, 192, 192, 1)', 'rgba(153, 102, 255, 1)', ], borderWidth: 1 }] }, options: { title: 'Primary Uses of AI in Research Workflow', showLegend: true } } ]; setVisualizations([...visualizations, ...newVisualizations]); // Add sample statistical analyses const newStatisticalAnalyses = [ { id: Date.now(), type: 't-test', title: 'Comparison of Publication Rates Between AI Adopters and Non-Adopters', description: 'Independent samples t-test comparing annual publication counts', data: { group1: { name: 'AI Adopters', n: 215, mean: 4.7, sd: 1.2 }, group2: { name: 'Non-Adopters', n: 212, mean: 3.4, sd: 1.1 } }, results: { t: 11.42, df: 425, p: 0.00001, significant: true, effectSize: 1.13, effectSizeInterpretation: 'Large effect' }, interpretation: 'Researchers who adopted AI tools published significantly more papers annually (M = 4.7, SD = 1.2) compared to non-adopters (M = 3.4, SD = 1.1); t(425) = 11.42, p < .001, d = 1.13. This represents a large effect size, indicating a substantial impact of AI adoption on research productivity.' }, { id: Date.now() + 1, type: 'correlation', title: 'Correlation Between AI Usage Intensity and Citation Impact', description: 'Pearson correlation analysis examining relationship between AI tool usage frequency and citation counts', data: { n: 427, variables: ['AI Usage Intensity', 'Citation Count'] }, results: { r: 0.38, p: 0.003, significant: true, effectSize: 0.38, effectSizeInterpretation: 'Medium effect' }, interpretation: 'There was a significant positive correlation between AI usage intensity and citation impact (r = 0.38, p = .003), indicating a medium-strength relationship. Researchers who used AI tools more frequently tended to receive more citations, though the relationship was moderate in strength, suggesting other factors also play important roles in determining citation impact.' } ]; setStatisticalAnalyses([...statisticalAnalyses, ...newStatisticalAnalyses]); // Add references const newReferences = [ { id: 1, title: "The impact of artificial intelligence on scientific discovery", authors: "Smith, J., Johnson, A., & Williams, B.", journal: "Nature", year: 2022, doi: "10.1038/s41586-022-04543-3" }, { id: 2, title: "A comprehensive review of deep learning architectures for scientific applications", authors: "Chen, L., & Wang, H.", journal: "IEEE Transactions on Neural Networks", year: 2021, doi: "10.1109/tnn.2021.3067454" }, { id: 3, title: "Ethical considerations in AI-assisted academic research", authors: "Garcia, M., & Lee, S.", journal: "Science and Education", year: 2023, doi: "10.1007/s11191-023-00456-3" }, { id: 4, title: "AlphaFold: Protein structure prediction using deep learning", authors: "AlphaFold Team", journal: "Science", year: 2021, doi: "10.1126/science.abj8754" }, { id: 5, title: "Machine learning approaches in drug discovery and development", authors: "Johnson, K., Zhang, L., & Patel, R.", journal: "Nature Reviews Drug Discovery", year: 2022, doi: "10.1038/s41573-022-00465-9" }, { id: 6, title: "Computational methods for large-scale text analysis in humanities research", authors: "Williams, E., & Thompson, J.", journal: "Digital Scholarship in the Humanities", year: 2020, doi: "10.1093/llc/fqaa012" } ]; setReferences([...references, ...newReferences]); // Update paper title setPaperTitle("The Impact of Artificial Intelligence on Academic Research Productivity: A Mixed-Methods Analysis"); setIsGeneratingPaper(false); setShowAiGenerationModal(false); } }, 1000); }; // Create new visualization const createVisualization = () => { const newVisualization = { id: Date.now(), type: visualizationType, title: visualizationOptions.title, description: 'Description of the visualization', data: visualizationData, options: visualizationOptions }; setVisualizations([...visualizations, newVisualization]); setShowVisualizationModal(false); }; // Insert visualization into paper const insertVisualizationReference = (visualization) => { const reference = `[Figure: ${visualization.title}]`; // Insert at cursor position or at end of current section const currentSectionContent = paperSections.find(s => s.id === activeSection)?.content || ''; const updatedContent = currentSectionContent + '\n\n' + reference + '\n\n'; updateSectionContent(activeSection, updatedContent); }; // Perform statistical analysis const performStatisticalAnalysis = () => { let results = null; // Simulate statistical analysis if (selectedStatisticalTest === 't-test') { const group1Mean = statisticalData.group1.reduce((sum, val) => sum + val, 0) / statisticalData.group1.length; const group2Mean = statisticalData.group2.reduce((sum, val) => sum + val, 0) / statisticalData.group2.length; // Calculate t-statistic (simplified) const t = Math.abs(group1Mean - group2Mean) / Math.sqrt(2 / statisticalData.group1.length); const df = statisticalData.group1.length + statisticalData.group2.length - 2; const p = 0.03; // Simulated p-value results = { test: 't-test', group1: { n: statisticalData.group1.length, mean: group1Mean.toFixed(2), sd: (Math.sqrt(statisticalData.group1.reduce((sum, val) => sum + Math.pow(val - group1Mean, 2), 0) / statisticalData.group1.length)).toFixed(2) }, group2: { n: statisticalData.group2.length, mean: group2Mean.toFixed(2), sd: (Math.sqrt(statisticalData.group2.reduce((sum, val) => sum + Math.pow(val - group2Mean, 2), 0) / statisticalData.group2.length)).toFixed(2) }, t: t.toFixed(2), df, p, significant: p < 0.05, interpretation: `There was a significant difference between Group 1 (M=${group1Mean.toFixed(2)}) and Group 2 (M=${group2Mean.toFixed(2)}); t(${df})=${t.toFixed(2)}, p=${p.toFixed(3)}.` }; } else if (selectedStatisticalTest === 'correlation') { // Simplified correlation calculation const correlation = 0.68; // Simulated correlation coefficient const p = 0.008; // Simulated p-value results = { test: 'correlation', r: correlation.toFixed(2), n: statisticalData.group1.length, p, significant: p < 0.05, interpretation: `There was a significant positive correlation between the variables (r=${correlation.toFixed(2)}, n=${statisticalData.group1.length}, p=${p.toFixed(3)}).` }; } setStatisticalResults(results); }; // Save statistical analysis const saveStatisticalAnalysis = () => { if (statisticalResults) { const newAnalysis = { id: Date.now(), type: selectedStatisticalTest, title: `${selectedStatisticalTest === 't-test' ? 'T-Test' : 'Correlation'} Analysis`, description: 'Statistical analysis of research data', data: statisticalData, results: statisticalResults, interpretation: statisticalResults.interpretation }; setStatisticalAnalyses([...statisticalAnalyses, newAnalysis]); setShowStatisticsModal(false); setStatisticalResults(null); } }; // Insert statistical analysis into paper const insertStatisticalAnalysisReference = (analysis) => { const reference = `[Statistical Analysis: ${analysis.title}]`; // Insert at cursor position or at end of current section const currentSectionContent = paperSections.find(s => s.id === activeSection)?.content || ''; const updatedContent = currentSectionContent + '\n\n' + reference + '\n\n'; updateSectionContent(activeSection, updatedContent); }; // Render visualization based on type const renderVisualization = (visualization) => { const { type, data, options } = visualization; const chartOptions = { responsive: true, maintainAspectRatio: true, plugins: { title: { display: !!options.title, text: options.title }, legend: { display: options.showLegend } }, scales: { x: { title: { display: !!options.xAxisLabel, text: options.xAxisLabel } }, y: { title: { display: !!options.yAxisLabel, text: options.yAxisLabel } } } }; switch (type) { case 'bar': return ; case 'line': return ; case 'pie': return ; default: return
Unsupported visualization type
; } }; return (
{/* Header */}

Academic Paper Assistant

AI-powered research paper writing tool

{savedAt ? `Last saved: ${savedAt.toLocaleTimeString()}` : 'Not saved yet'}
{/* Main Content */}
{/* Sidebar */} {/* Secondary Sidebar */}
{activeTab === 'editor' && (

Document Structure

{paperSections.map(section => (
setActiveSection(section.id)} > {section.name}
))}

Progress

{calculateCompletion()}% complete

Word Count

{wordCount} words

Target: 6,000 words

AI Tools

)} {activeTab === 'research' && (

Research Tools

setSearchQuery(e.target.value)} />

Saved Research Notes

Key findings from Smith (2022)

Added 2 days ago

Methodology comparison

Added yesterday

AI Research Assistant

Ask AI to find relevant papers, summarize articles, or extract key information.

)} {activeTab === 'references' && (

References

{references.length === 0 ? (

No references added yet.

) : ( references.map((ref, index) => (

{ref.title}

{ref.authors}

{ref.journal}, {ref.year}

{ref.doi &&

DOI: {ref.doi}

}
)) )}
)} {activeTab === 'visualizations' && (

Visualizations

{visualizations.length === 0 ? (

No visualizations created yet.

) : ( visualizations.map((vis) => (
setActiveVisualization(vis)} >

{vis.title}

{vis.type}

{vis.description || 'No description'}

)) )}
)} {activeTab === 'statistics' && (

Statistical Analysis

{statisticalAnalyses.length === 0 ? (

No statistical analyses performed yet.

) : ( statisticalAnalyses.map((analysis) => (

{analysis.title}

{analysis.type}

{analysis.description}

{analysis.type === 't-test' && (

t({analysis.results.df}) = {analysis.results.t}, p = {analysis.results.p < 0.001 ? '< 0.001' : analysis.results.p.toFixed(3)}, {analysis.results.significant ? ' significant' : ' not significant'}

)} {analysis.type === 'correlation' && (

r = {analysis.results.r}, p = {analysis.results.p < 0.001 ? '< 0.001' : analysis.results.p.toFixed(3)}, {analysis.results.significant ? ' significant' : ' not significant'}

)}
)) )}
)} {activeTab === 'collaboration' && (

Collaboration

Current Collaborators

{collaborators.map(collaborator => (

{collaborator.name}

{collaborator.email}

{collaborator.role}
))}

Activity Log

You edited the Introduction section (10 minutes ago)

You added 2 new references (1 hour ago)

)} {activeTab === 'settings' && (

Settings

Journal Templates

{templates.map(template => (
applyTemplate(template)} >

{template.name}

{template.description}

))}

AI Settings

Auto-save

)}
{/* Main Content Area */}
{activeTab === 'editor' && (
setPaperTitle(e.target.value)} className="w-full text-2xl font-bold text-gray-800 border-none focus:outline-none focus:ring-0" placeholder="Enter paper title..." />

{paperSections.find(s => s.id === activeSection)?.name}

{showAiSuggestions && aiSuggestions.length > 0 && (

AI Writing Suggestions

    {aiSuggestions.map((suggestion, index) => (
  • {suggestion}
  • ))}
)}
)} {activeTab === 'research' && (

Research Results

{isSearching ? (
) : searchResults.length > 0 ? (
{searchResults.map(result => (

{result.title}

{result.authors}

{result.journal}, {result.year}

{result.doi &&

DOI: {result.doi}

}
))}
) : searchQuery ? (

No results found for "{searchQuery}"

Try different keywords or broaden your search

) : (

Search for academic papers to begin your research

Enter keywords, author names, or topics

)}
)} {activeTab === 'references' && (

Reference Management

Reference List

{references.length === 0 ? (

No references added yet

) : (
{references.map((ref, index) => (

{ref.title}

{ref.authors}

{ref.journal}, {ref.year}

{ref.doi &&

DOI: {ref.doi}

}
))}
)}

Citation Preview

In-text Citation

{references.length > 0 ? (
{citationStyle === 'APA' &&

According to recent research (Smith et al., 2022), the findings suggest...

} {citationStyle === 'MLA' &&

Recent studies indicate that "quoted text" (Smith et al. 42).

} {citationStyle === 'Chicago' &&

As noted by Smith et al., "quoted text."1

} {citationStyle === 'Harvard' &&

It has been argued (Smith et al., 2022, p.42) that...

} {citationStyle === 'IEEE' &&

Recent research [1] has demonstrated that...

}
) : (

Add references to see citation previews

)}

Reference List Format

{references.length > 0 ? (
{citationStyle === 'APA' && (

Smith, J., Johnson, A., & Williams, B. (2022). The impact of artificial intelligence on scientific discovery. Nature, 603(7901), 123-145. https://doi.org/10.1038/s41586-022-04543-3

)} {citationStyle === 'MLA' && (

Smith, John, et al. "The Impact of Artificial Intelligence on Scientific Discovery." Nature, vol. 603, no. 7901, 2022, pp. 123-145.

)} {citationStyle === 'Chicago' && (

Smith, John, Alice Johnson, and Brian Williams. "The Impact of Artificial Intelligence on Scientific Discovery." Nature 603, no. 7901 (2022): 123-145.

)} {citationStyle === 'Harvard' && (

Smith, J., Johnson, A. and Williams, B. (2022) 'The impact of artificial intelligence on scientific discovery', Nature, 603(7901), pp. 123-145.

)} {citationStyle === 'IEEE' && (

[1] J. Smith, A. Johnson, and B. Williams, "The impact of artificial intelligence on scientific discovery," Nature, vol. 603, no. 7901, pp. 123-145, 2022.

)}
) : (

Add references to see reference list format

)}
)} {activeTab === 'visualizations' && (

Data Visualizations

{activeVisualization ? (

{activeVisualization.title}

{renderVisualization(activeVisualization)}

{activeVisualization.description || 'No description provided.'}

) : visualizations.length > 0 ? (
{visualizations.map(vis => (
setActiveVisualization(vis)} >

{vis.title}

{renderVisualization(vis)}
{vis.type}
))}
) : (

No Visualizations Yet

Create visualizations to enhance your paper with charts, graphs, and other data representations.

)}
)} {activeTab === 'statistics' && (

Statistical Analysis

{statisticalAnalyses.length > 0 ? (
{statisticalAnalyses.map(analysis => (

{analysis.title}

{analysis.description}

{analysis.type}

Results

{analysis.type === 't-test' && (

{analysis.data.group1?.name || 'Group 1'}

n = {analysis.results.group1.n}

Mean = {analysis.results.group1.mean}

SD = {analysis.results.group1.sd}

{analysis.data.group2?.name || 'Group 2'}

n = {analysis.results.group2.n}

Mean = {analysis.results.group2.mean}

SD = {analysis.results.group2.sd}

Test Statistics

t = {analysis.results.t}

df = {analysis.results.df}

p = {analysis.results.p < 0.001 ? '< 0.001' : analysis.results.p.toFixed(3)}

Significant: {analysis.results.significant ? 'Yes' : 'No'}

{analysis.results.effectSize && (

Effect size: {analysis.results.effectSize.toFixed(2)} ({analysis.results.effectSizeInterpretation})

)}
)} {analysis.type === 'correlation' && (

Variables

{analysis.data.variables?.join(' and ') || 'Variable 1 and Variable 2'}

n = {analysis.results.n}

Test Statistics

r = {analysis.results.r}

p = {analysis.results.p < 0.001 ? '< 0.001' : analysis.results.p.toFixed(3)}

Significant: {analysis.results.significant ? 'Yes' : 'No'}

{analysis.results.effectSize && (

Effect size: {analysis.results.effectSize.toFixed(2)} ({analysis.results.effectSizeInterpretation})

)}
)}

Interpretation

{analysis.interpretation}

))}
) : (

No Statistical Analyses Yet

Perform statistical analyses to add rigor and evidence to your research findings.

)}
)} {activeTab === 'collaboration' && (

Collaboration Tools

Comments & Feedback

Introduction - Paragraph 2

You, 2 hours ago

Need to expand this section with more recent literature.

Methods - Sample Size

AI Assistant, 1 hour ago

Consider adding a power analysis to justify your sample size.

Peer Review Simulation

Get AI-generated feedback that simulates journal peer review to improve your paper before submission.

Journal Recommendation

Based on your paper's content, these journals might be a good fit for submission:

Journal of Academic Research

Impact Factor: 4.2

95% Match ~3 months review time

International Review of Science

Impact Factor: 5.7

82% Match ~5 months review time

Research Quarterly

Impact Factor: 3.8

78% Match ~2 months review time
)} {activeTab === 'settings' && (

Application Settings

Paper Information

setPaperTitle(e.target.value)} />

AI Settings

Select the AI model to use for paper generation and assistance

Choose the writing style for AI-generated content

setShowAiSuggestions(!showAiSuggestions)} />

Analytics

Word Count

{wordCount}

Target: 6,000 words

Completion

{calculateCompletion()}%

Sections completed: {paperSections.filter(s => s.completed).length}/{paperSections.length}

References

{references.length}

Recommended: 25-30 references

Writing progress over time

Continue writing to see your progress analytics

)}
{/* AI Paper Generation Modal */} {showAiGenerationModal && (

Generate Research Paper with AI

{isGeneratingPaper ? (

{generationProgress}%

Generating Your Paper

{generationStep}

This may take a few minutes. The AI is researching, writing, and formatting your paper.

) : ( <>
setAiGenerationParams({...aiGenerationParams, topic: e.target.value})} />
setAiGenerationParams({...aiGenerationParams, keywords: e.target.value})} />

Different models have different strengths for various research domains

setAiGenerationParams({...aiGenerationParams, includeVisualizations: e.target.checked})} />
setAiGenerationParams({...aiGenerationParams, includeStatistics: e.target.checked})} />

The AI will generate a complete research paper based on your specifications, including all sections, references, visualizations, and statistical analyses. You can edit the generated content afterward.

)}
)} {/* Visualization Modal */} {showVisualizationModal && (

Create Visualization

setVisualizationOptions({...visualizationOptions, title: e.target.value})} placeholder="Enter chart title" />
setVisualizationOptions({...visualizationOptions, xAxisLabel: e.target.value})} placeholder="X-Axis" />
setVisualizationOptions({...visualizationOptions, yAxisLabel: e.target.value})} placeholder="Y-Axis" />
{ const labels = e.target.value.split(',').map(label => label.trim()); setVisualizationData({...visualizationData, labels}); }} placeholder="Label 1, Label 2, Label 3..." />
{ const values = e.target.value.split(',').map(val => parseFloat(val.trim()) || 0); const updatedDatasets = [...visualizationData.datasets]; updatedDatasets[0] = {...updatedDatasets[0], data: values}; setVisualizationData({...visualizationData, datasets: updatedDatasets}); }} placeholder="10, 20, 30..." />
setVisualizationOptions({...visualizationOptions, showLegend: e.target.checked})} />

Preview

{visualizationType === 'bar' && } {visualizationType === 'line' && } {visualizationType === 'pie' && }
)} {/* Statistical Analysis Modal */} {showStatisticsModal && (

Statistical Analysis

{statisticalTests.map(test => (
setSelectedStatisticalTest(test.id)} >
{test.name}

{test.description}

))}
{selectedStatisticalTest === 't-test' && (
{showAiSuggestions && aiSuggestions.length > 0 && (

AI Writing Suggestions

    {aiSuggestions.map((suggestion, index) => (
  • {suggestion}
  • ))}
)}
)} {activeTab === 'research' && (

Research Results

{isSearching ? (
) : searchResults.length > 0 ? (
{searchResults.map(result => (

{result.title}

{result.authors}

{result.journal}, {result.year}

{result.doi &&

DOI: {result.doi}

}
))}
) : searchQuery ? (

No results found for "{searchQuery}"

Try different keywords or broaden your search

) : (

Search for academic papers to begin your research

Enter keywords, author names, or topics

)}
)} {activeTab === 'references' && (

Reference Management

Reference List

{references.length === 0 ? (

No references added yet

) : (
{references.map((ref, index) => (

{ref.title}

{ref.authors}

{ref.journal}, {ref.year}

{ref.doi &&

DOI: {ref.doi}

}
))}
)}

Citation Preview

In-text Citation

{references.length > 0 ? (
{citationStyle === 'APA' &&

According to recent research (Smith et al., 2022), the findings suggest...

} {citationStyle === 'MLA' &&

Recent studies indicate that "quoted text" (Smith et al. 42).

} {citationStyle === 'Chicago' &&

As noted by Smith et al., "quoted text."1

} {citationStyle === 'Harvard' &&

It has been argued (Smith et al., 2022, p.42) that...

} {citationStyle === 'IEEE' &&

Recent research [1] has demonstrated that...

}
) : (

Add references to see citation previews

)}

Reference List Format

{references.length > 0 ? (
{citationStyle === 'APA' && (

Smith, J., Johnson, A. (2022). Advances in Machine Learning for Natural Language Processing. Journal of AI Research, 15(2), 123-145. https://doi.org/10.1234/jair.2022.123

)} {citationStyle === 'MLA' && (

Smith, John, and Alice Johnson. "Advances in Machine Learning for Natural Language Processing." Journal of AI Research, vol. 15, no. 2, 2022, pp. 123-145.

)} {citationStyle === 'Chicago' && (

Smith, John, and Alice Johnson. "Advances in Machine Learning for Natural Language Processing." Journal of AI Research 15, no. 2 (2022): 123-145.

)} {citationStyle === 'Harvard' && (

Smith, J. and Johnson, A. (2022) 'Advances in Machine Learning for Natural Language Processing', Journal of AI Research, 15(2), pp. 123-145.

)} {citationStyle === 'IEEE' && (

[1] J. Smith and A. Johnson, "Advances in Machine Learning for Natural Language Processing," J. AI Res., vol. 15, no. 2, pp. 123-145, 2022.

)}
) : (

Add references to see reference list format

)}
)} {activeTab === 'collaboration' && (

Collaboration Tools

Comments & Feedback

Introduction - Paragraph 2

You, 2 hours ago

Need to expand this section with more recent literature.

Methods - Sample Size

AI Assistant, 1 hour ago

Consider adding a power analysis to justify your sample size.

Peer Review Simulation

Get AI-generated feedback that simulates journal peer review to improve your paper before submission.

Journal Recommendation

Based on your paper's content, these journals might be a good fit for submission:

Journal of Academic Research

Impact Factor: 4.2

95% Match ~3 months review time

International Review of Science

Impact Factor: 5.7

82% Match ~5 months review time

Research Quarterly

Impact Factor: 3.8

78% Match ~2 months review time
)} {activeTab === 'settings' && (

Application Settings

Paper Information

setPaperTitle(e.target.value)} />

Export & Sharing

Includes interactive figures, supplementary materials, and code

Analytics

Word Count

{wordCount}

Target: 6,000 words

Completion

{calculateCompletion()}%

Sections completed: {paperSections.filter(s => s.completed).length}/{paperSections.length}

References

{references.length}

Recommended: 25-30 references

Writing progress over time

Continue writing to see your progress analytics

)}
{/* Reference Modal */} {showReferenceModal && (

Add New Reference

setNewReference({...newReference, title: e.target.value})} placeholder="Paper title" />
setNewReference({...newReference, authors: e.target.value})} placeholder="e.g., Smith, J., Johnson, A." />
setNewReference({...newReference, journal: e.target.value})} placeholder="Journal name" />
setNewReference({...newReference, year: e.target.value})} placeholder="Publication year" />
setNewReference({...newReference, doi: e.target.value})} placeholder="Digital Object Identifier" />
setNewReference({...newReference, url: e.target.value})} placeholder="Link to paper" />
)}
); }