fsd extra-pages-deleted-compressed
fsd extra-pages-deleted-compressed
OUTPUT :
PROGRAM:
LoginUser.js:
registerUser.js:
OUTPUT:
PROGRAM:
sendEmail.js:
const mailOptions = {
from: '[email protected]',
to: '[email protected]',
subject: 'Default Subject',
text: 'This is the default email content sent using Node.js!'
};
mkdir git_demo
Explanation:
Creates a new folder named git_demo in the current directory. This is where you’ll store
your project files.
Step 2.
cd git_demo
Explanation:
Moves you into the newly created git_demo directory so you can start working inside it.
Step 3.
Explanation:
Creates a file named README.md and writes # git_demo into it.
The >> appends content to the file, creating it if it doesn't exist.
README.md is commonly used to describe the project.
Step 4.
git init
Explanation:
Initializes a new Git repository in the current directory.
This creates a hidden .git folder where Git stores its data and version history.
Step 5.
Explanation:
Stages README.md for commit, meaning Git will track this file in the next commit.
Step 6.
Explanation:
Commits the staged file(s) to the repository with the message "first commit".
This creates the first snapshot of your project.
Step 7.
Explanation:
Renames the default branch from master to main (GitHub and other platforms now use
main by default).
-M forces the rename even if main already exists.
Step 8.
Step 9.
Push to GitHub
Explanation:
Pushes your local main branch to the origin (GitHub).
-u sets origin/main as the default upstream branch, so you can use git push/git pull
directly next time.
Step 10.
Result
🔗 https://github.com/your-username/git_demo.git
OUTPUT :
Index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document Analyzer</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
VITE.CONFIG.JS
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
CAPACITOR.CONFIG.JSON
{
"appId": "com.example.documentanalyzer",
"appName": "DocumentAnalyzer",
"webDir": "dist",
"bundledWebRuntime": falseimport React, { useState, useCallback } from 'react';
import { pdfjs } from 'react-pdf';
import { Document, Page } from 'react-pdf';
import { FileUp, FileText, Layers, BookOpen, Download, Copy, Maximize2, ChevronLeft,
ChevronRight } from 'lucide-react';
import DocumentSummary from './components/DocumentSummary';
import KeyInsights from './components/KeyInsights';
import ExtractedContent from './components/ExtractedContent';
import UploadZone from './components/UploadZone';
function App() {
const [file, setFile] = useState(null);
const [numPages, setNumPages] = useState(null);
const [pageNumber, setPageNumber] = useState(1);
const [scale, setScale] = useState(1.2);
const [activeTab, setActiveTab] = useState('summary');
const [extractedText, setExtractedText] = useState('');
const [isAnalyzing, setIsAnalyzing] = useState(false);
const [insights, setInsights] = useState([]);
const [summary, setSummary] = useState('');
}
App.jsx
function App() {
const [file, setFile] = useState(null);
const [numPages, setNumPages] = useState(null);
const [pageNumber, setPageNumber] = useState(1);
const [scale, setScale] = useState(1.2);
const [activeTab, setActiveTab] = useState('summary');
const [extractedText, setExtractedText] = useState('');
const [isAnalyzing, setIsAnalyzing] = useState(false);
const [insights, setInsights] = useState([]);
const [summary, setSummary] = useState('');
const onDocumentLoadSuccess = ({ numPages }) => {
setNumPages(numPages);
setPageNumber(1);
simulateAnalysis();
};
setIsAnalyzing(false);
}, 2000);
};
return (
<div className="min-h-screen bg-gradient-to-br from-gray-50 to-gray-100">
<header className="bg-white shadow-sm">
<div className="max-w-7xl mx-auto px-4 py-4 sm:px-6 lg:px-8 flex justify-between
items-center">
<div className="flex items-center space-x-2">
<FileText className="h-8 w-8 text-indigo-600" />
error={
<div className="flex flex-col justify-center items-center h-full text-red-500 p-4">
<svg xmlns="http://www.w3.org/2000/svg" className="h-12 w-12" fill="none"
viewBox="0 0 24 24" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12
9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-
3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
</svg>
<p className="mt-2 text-center">Failed to load PDF. Please ensure it's a valid
PDF document.</p>
</div>
}
>
<Page
pageNumber={pageNumber}
scale={scale}
renderTextLayer={false}
renderAnnotationLayer={false}
className="mx-auto"
/>
</Document>
</div>
{numPages && (
<div className="flex justify-between items-center mt-4">
<button
onClick={previousPage}
disabled={pageNumber <= 1}
className={`flex items-center px-3 py-1 rounded-md ${pageNumber <= 1 ? 'text-
gray-400 cursor-not-allowed' : 'text-gray-700 hover:bg-gray-100'}`}
>
<ChevronLeft className="h-5 w-5 mr-1" />
Previous
</button>
<button
onClick={nextPage}
disabled={pageNumber >= (numPages || 1)}
className={`flex items-center px-3 py-1 rounded-md ${pageNumber >=
(numPages || 1) ? 'text-gray-400 cursor-not-allowed' : 'text-gray-700 hover:bg-gray-100'}`}
>
Next
<ChevronRight className="h-5 w-5 ml-1" />
</button>
</div>
)}
</div>
<button
onClick={() => setActiveTab('summary')}
className={`py-4 px-6 text-center border-b-2 font-medium text-sm flex-1 ${
activeTab === 'summary'
? 'border-indigo-500 text-indigo-600'
: 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'
}`}
>
Summary
</button>
<button
onClick={() => setActiveTab('insights')}
className={`py-4 px-6 text-center border-b-2 font-medium text-sm flex-1 ${
activeTab === 'insights'
? 'border-indigo-500 text-indigo-600'
: 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'
}`}
>
Key Insights
</button>
<button
onClick={() => setActiveTab('extracted')}
className={`py-4 px-6 text-center border-b-2 font-medium text-sm flex-1 ${
activeTab === 'extracted'
? 'border-indigo-500 text-indigo-600'
: 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'
}`}
>
Extracted Text
</button>
</nav>
</div>
<div className="p-6">
{isAnalyzing ? (
<div className="flex flex-col items-center justify-center py-12">
<div className="animate-spin rounded-full h-16 w-16 border-t-2 border-b-2
border-indigo-500 mb-4"></div>
<h3 className="text-lg font-medium text-gray-900 mb-1">Analyzing
Document</h3>
<p className="text-sm text-gray-500">Extracting and processing content...</p>
</div>
):(
<>
{activeTab === 'summary' && <DocumentSummary summary={summary} />}
{activeTab === 'insights' && <KeyInsights insights={insights} />}
{activeTab === 'extracted' && <ExtractedContent text={extractedText} />}
</>
)}
</div>
</div>
</div>
)}
</main>
</div>
);
}
main.jsx
createRoot(document.getElementById('root')).render(
<StrictMode>
<App />
</StrictMode>
);
DocumentSummary.jsx
<div className="font-medium">92%</div>
</div>
<div className="bg-white p-3 rounded shadow-sm">
<div className="text-xs text-gray-500 mb-1">Pages</div>
<div className="font-medium">12</div>
</div>
<div className="bg-white p-3 rounded shadow-sm">
<div className="text-xs text-gray-500 mb-1">Word Count</div>
<div className="font-medium">3,245</div>
</div>
</div>
</div>
</div>
);
};
KeyInsights.jsx
import React from 'react';
import { Lightbulb } from 'lucide-react';
<ul className="space-y-3">
{insights.map((insight, index) => (
<li key={index} className="bg-white p-4 rounded-lg border border-gray-200
shadow-sm hover:shadow-md transition-shadow">
<div className="flex">
<span className="flex-shrink-0 flex items-center justify-center h-8 w-8
rounded-full bg-indigo-100 text-indigo-600 text-sm font-medium mr-3">
{index + 1}
</span>
<p className="text-gray-700">{insight}</p>
</div>
</li>
))}
</ul>
UploadZone.jsx
import React, { useCallback, useState } from 'react';
import { FileUp, FileText } from 'lucide-react';
return (
<div className="max-w-3xl mx-auto">
<div className="text-center mb-8">
<FileText className="h-12 w-12 text-indigo-600 mx-auto mb-4" />
<h2 className="text-3xl font-extrabold text-gray-900 mb-2">Document
Analyzer</h2>
<p className="text-lg text-gray-600">
Upload a PDF document to analyze its content, extract insights, and generate
summaries.
</p>
</div>
<div
className={`mt-6 flex justify-center px-6 pt-5 pb-6 border-2 border-dashed
rounded-lg ${
isDragging ? 'border-indigo-500 bg-indigo-50' : 'border-gray-300 hover:border-
indigo-400'
} transition-colors duration-200 ease-in-out`}
onDragEnter={handleDragEnter}
onDragOver={handleDragOver}
onDragLeave={handleDragLeave}
onDrop={handleDrop}
>
<div className="space-y-1 text-center">
<FileUp className="mx-auto h-12 w-12 text-gray-400" />
<div className="flex text-sm text-gray-600">
<label
htmlFor="file-upload"
className="relative cursor-pointer bg-white rounded-md font-medium text-
indigo-600 hover:text-indigo-500 focus-within:outline-none focus-within:ring-2 focus-
within:ring-offset-2 focus-within:ring-indigo-500"
>
<span>Upload a PDF file</span>
<input
id="file-upload"
name="file-upload"
type="file"
className="sr-only"
accept="application/pdf"
onChange={handleFileChange}
/>
</label>
<p className="pl-1">or drag and drop</p>
</div>
<p className="text-xs text-gray-500">PDF up to 10MB</p>
</div>
</div>
Identify key insights, trends, and important information from your documents.
</p>
</div>
ExtractedContent.jsx
if (!text) {
return (
<div className="flex flex-col items-center justify-center py-12 text-gray-500">
<FileText className="h-12 w-12 mb-4 text-gray-400" />
<h3 className="text-lg font-medium text-gray-900 mb-1">No Extracted Text</h3>
<p className="text-sm text-center">Upload a document to extract its text
content.</p>
</div>
);
}
const copyToClipboard = () => {
navigator.clipboard.writeText(text);
alert('Text copied to clipboard!');
};
return (
<div>
<div className="flex justify-between items-center mb-4">
<h3 className="text-lg font-medium text-gray-900 flex items-center">
<FileText className="h-5 w-5 mr-2 text-indigo-500" />
Extracted Text
</h3>
<button
onClick={copyToClipboard}
className="inline-flex items-center px-3 py-1 border border-gray-300 shadow-sm
text-sm leading-4 font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50
focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
>
<Copy className="h-4 w-4 mr-2" />
Copy All
</button>
</div>
OUTPUT :