Literature Review Protocol

import React, { useState } from ‘react’;
import {
BookOpen,
ChevronRight,
ChevronLeft,
Save,
CheckCircle,
MessageSquare,
FileText,
Download,
Copy,
Info
} from ‘lucide-react’;

// — Data Structure derived from the uploaded document —
const WIZARD_STEPS = [
{
id: ‘foundation’,
title: ‘Foundation & Purpose’,
aiMessage: “Hello! I’m here to help you structure your literature review protocol. Let’s start by understanding who you are and what you aim to achieve.”,
fields: [
{
id: ‘positionality’,
label: ‘Positionality’,
type: ‘radio’,
options: [‘Learner’, ‘Researcher’, ‘Practitioner’],
tooltip: ‘What is your current role in relation to this review?’
},
{
id: ‘purposes’,
label: ‘Purposes & Objectives’,
type: ‘checkbox’,
options: [‘Gap analysis’, ‘Framing a study’, ‘Topic Development’, ‘Concepts Clarification’, ‘Collecting evidence to support a project’],
tooltip: ‘Select all that apply to your current project.’
},
{
id: ‘topic’,
label: ‘Topic’,
type: ‘textarea’,
placeholder: ‘Enter your initial or developed topic here…’,
tooltip: ‘What is the main subject of your review?’
}
]
},
{
id: ‘framework’,
title: ‘Framework & Context’,
aiMessage: “Great. Now let’s define the core concepts, the setting, and the specific population you are investigating.”,
fields: [
{
id: ‘concepts’,
label: ‘Concepts & Search Terms’,
type: ‘textarea’,
placeholder: ‘E.g., Initial Concepts -> Final Concepts & Search Terms…’,
tooltip: ‘List your main concepts and any related synonyms or search terms.’
},
{
id: ‘context’,
label: ‘Location, Setting, Context’,
type: ‘text’,
placeholder: ‘E.g., Higher Education in North America, Urban clinics…’,
},
{
id: ‘population’,
label: ‘Population (from the research)’,
type: ‘text’,
placeholder: ‘E.g., Undergraduate students, Nurses, K-12 Teachers…’,
}
]
},
{
id: ‘design’,
title: ‘Research Design’,
aiMessage: “Every good review needs a strong question and a timeframe. Let’s structure yours.”,
fields: [
{
id: ‘researchQuestion’,
label: ‘Research Question’,
type: ‘textarea’,
placeholder: ‘What specific question is your review trying to answer?’,
tooltip: ‘Ensure it is structured and aligned with your research design.’
},
{
id: ‘referencePeriod’,
label: ‘Reference Period’,
type: ‘text’,
placeholder: ‘E.g., 2005-2024’,
tooltip: ‘What is the publication date range for the literature you will include?’
}
]
},
{
id: ‘evidence’,
title: ‘Evidence & Sources’,
aiMessage: “Where will we look, and what are we looking for? Let’s define your units of analysis and sources.”,
fields: [
{
id: ‘unitsPreliminary’,
label: ‘Units of Analysis (Preliminary Review)’,
type: ‘checkbox’,
options: [‘Reviews of research/research Handbook’, ‘Literature Reviews’, ‘Landmark or seminal works (monographs & articles)’],
},
{
id: ‘unitsSystematic’,
label: ‘Units of Analysis (Systematic Approach)’,
type: ‘checkbox’,
options: [‘Latest research, or design, or evaluation studies reports’, ‘Theoretical and conceptual papers’, ‘Grey literature/Conference presentations’, ‘Other types of sources’],
},
{
id: ‘sources’,
label: ‘Sources’,
type: ‘textarea’,
placeholder: ‘List Databases (Indexes, Collections), Journals, Open Access sources…’,
}
]
},
{
id: ‘methodology’,
title: ‘Scope & Methodology’,
aiMessage: “Almost there! How will you collect and analyze the data from your sources?”,
fields: [
{
id: ‘scope’,
label: ‘Scope & Inclusion Criteria’,
type: ‘textarea’,
placeholder: ‘Selective or comprehensive? Other inclusion/exclusion criteria?’,
},
{
id: ‘collectionPreliminary’,
label: ‘Data Collection: Preliminary Search’,
type: ‘checkbox’,
options: [‘Thesaurus searching in discipline-specific databases’, ‘AI semantic or NLP search’],
},
{
id: ‘collectionSystematic’,
label: ‘Data Collection: Systematic Search’,
type: ‘checkbox’,
options: [
‘Keyword searching (Advanced)’,
‘Citation Chaining’,
‘Cited reference search (conceptual mapping, linking)’,
‘Scanning meta-indexes for additional literature’,
‘AI semantic or NLP search or AI Research Assistants’
],
},
{
id: ‘analysisStrategies’,
label: ‘Strategies for Data Analysis’,
type: ‘checkbox’,
options: [‘Literature mapping’, ‘Thematic & arguments analysis’, ‘Characteristics Analysis Matrix’],
}
]
},
{
id: ‘output’,
title: ‘Structure & Output’,
aiMessage: “Finally, how will you structure the final written review?”,
fields: [
{
id: ‘structure’,
label: ‘Outline or Structure’,
type: ‘radio’,
options: [
‘A combination of themes and threads of arguments with sub-sections for concepts’,
‘Funnel (Broad to narrow)’,
‘Parallel’
],
}
]
}
];

export default function App() {
const [currentStep, setCurrentStep] = useState(0);
const [formData, setFormData] = useState({});
const [isComplete, setIsComplete] = useState(false);
const [copied, setCopied] = useState(false);

const handleInputChange = (fieldId, value, type, isChecked = false) => {
setFormData(prev => {
const newData = { …prev };

if (type === ‘checkbox’) {
const currentList = newData[fieldId] || [];
if (isChecked) {
newData[fieldId] = […currentList, value];
} else {
newData[fieldId] = currentList.filter(item => item !== value);
}
} else {
newData[fieldId] = value;
}

return newData;
});
};

const handleNext = () => {
if (currentStep prev + 1);
} else {
setIsComplete(true);
}
};

const handleBack = () => {
if (currentStep > 0) {
setCurrentStep(prev => prev – 1);
}
};

const generateMarkdown = () => {
let md = `# Literature Review Protocol\n\n`;

WIZARD_STEPS.forEach(step => {
md += `## ${step.title}\n\n`;
step.fields.forEach(field => {
md += `### ${field.label}\n`;
const value = formData[field.id];

if (!value || (Array.isArray(value) && value.length === 0)) {
md += `*Not specified*\n\n`;
} else if (Array.isArray(value)) {
value.forEach(v => {
md += `- ${v}\n`;
});
md += `\n`;
} else {
md += `${value}\n\n`;
}
});
});

return md;
};

const copyToClipboard = () => {
const text = generateMarkdown();
const textArea = document.createElement(“textarea”);
textArea.value = text;
document.body.appendChild(textArea);
textArea.select();
try {
document.execCommand(‘copy’);
setCopied(true);
setTimeout(() => setCopied(false), 2000);
} catch (err) {
console.error(‘Failed to copy’, err);
}
document.body.removeChild(textArea);
};

// — Render Functions —

const renderField = (field) => {
const value = formData[field.id] || (field.type === ‘checkbox’ ? [] : ”);

return (

{field.label}
{field.tooltip && (

{field.tooltip}

)}

{field.type === ‘textarea’ && (
handleInputChange(field.id, e.target.value, ‘textarea’)}
/>
)}

{field.type === ‘text’ && (
handleInputChange(field.id, e.target.value, ‘text’)}
/>
)}

{field.type === ‘radio’ && (

{field.options.map(opt => (

handleInputChange(field.id, opt, ‘radio’)}
/>
{opt}

))}

)}

{field.type === ‘checkbox’ && (

{field.options.map(opt => (

handleInputChange(field.id, opt, ‘checkbox’, e.target.checked)}
/>
{opt}

))}

)}

);
};

if (isComplete) {
return (

Protocol Complete!

You have successfully drafted your literature review protocol.

Your Protocol Document

{generateMarkdown()}

);
}

const stepData = WIZARD_STEPS[currentStep];

return (

{/* Header */}

LitReview Assistant

Your AI guide to developing a systematic research protocol.

{/* Main Wizard Container */}

{/* Progress Bar */}


Phase {currentStep + 1} of {WIZARD_STEPS.length}


{Math.round(((currentStep + 1) / WIZARD_STEPS.length) * 100)}% Completed

{/* AI Conversational Area */}

{stepData.title}

{stepData.aiMessage}

{/* Form Area */}

{stepData.fields.map(renderField)}

{/* Footer Navigation */}

);
}