Skip to content

Commit 6ff9ecb

Browse files
committed
2 parents 7e3086a + fbff951 commit 6ff9ecb

File tree

7 files changed

+184
-111
lines changed

7 files changed

+184
-111
lines changed

client/src/assets/134013-student-with-laptop.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

client/src/components/Aibot.jsx

Lines changed: 43 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,59 @@
11
import React from 'react';
22
import Navbar from './Navbar';
3+
import Lottie from 'lottie-react';
4+
import animationData from '../assets/134013-student-with-laptop.json';
5+
import animationData1 from '../assets/39701-robot-bot-3d.json';
6+
7+
38
const Tutor = () => {
49
const avatarNarration = 'Hello! How can I assist you today?';
5-
const ourReply = 'I would like to learn abt full adder.';
6-
const tutorImages = [
7-
'image1.jpg',
8-
'image2.jpg',
9-
'image3.jpg'
10-
];
10+
11+
const handleReply = () => {
12+
// Handle the reply button functionality here
13+
};
1114

1215
return (
1316
<div className="w-screen">
1417
<Navbar />
15-
<div className="flex flex-col items-center justify-center h-screen w-screen text-center bg-gradient-to-tr from-violet-700 via-green-600 to-green-400 mt-3">
16-
<div className="w-full max-w-xl bg-gray-100 rounded-lg shadow-lg p-4 mb-6">
17-
<div className="flex items-center">
18-
<div className="w-16 h-16 rounded-full bg-blue-500 flex-shrink-0"></div>
19-
<div className="ml-4">
20-
<p className="text-lg font-bold">AI Tutor</p>
21-
<p className="text-gray-500 text-sm">{avatarNarration}</p>
18+
<div className="flex flex-col items-center justify-center h-screen w-screen text-center bg-gradient-to-tr from-violet-700 via-green-600 to-green-400 mt-3">
19+
<div className="h-3/4 flex flex-col justify-center">
20+
<div className="bg-gray-100 rounded-lg shadow-lg p-20 w-full">
21+
<div className="flex items-center">
22+
<div className="w-16 h-16 rounded-full bg-blue-500 flex-shrink-0">
23+
<Lottie animationData={animationData1} />
24+
</div>
25+
<div className="ml-4">
26+
<p className="text-lg font-bold">AI Tutor</p>
27+
<p className="text-gray-500 text-sm">{avatarNarration}</p>
28+
</div>
29+
</div>
2230
</div>
2331
</div>
24-
</div>
25-
26-
<div className="w-full max-w-xl bg-gray-100 rounded-lg shadow-lg p-6">
27-
<h3 className="text-lg font-medium mb-4">Related Media:</h3>
28-
<div className="grid grid-cols-3 gap-4">
29-
{tutorImages.map((image, index) => (
30-
<img key={index} src={image} alt={`Image ${index + 1}`} className="rounded-lg" />
31-
))}
32-
</div>
33-
</div>
34-
35-
<div className="w-full max-w-xl bg-gray-100 rounded-lg shadow-lg p-6 mb-6 mt-4">
36-
<div className="flex items-center">
37-
<div className="w-16 h-16 rounded-full bg-green-500 flex-shrink-0"></div>
38-
<div className="ml-4">
39-
<p className="text-lg font-bold">Me</p>
40-
<p className="text-gray-500 text-sm">{ourReply}</p>
32+
<div className="h-1/4 flex items-center justify-center">
33+
<div className="max-w-xl bg-slate-100 rounded-lg shadow-lg p-8 w-full fixed bottom-4">
34+
<div className="flex items-center">
35+
<div className="w-16 h-16 rounded-full bg-green-500 flex-shrink-0">
36+
<Lottie animationData={animationData} />
37+
</div>
38+
<div className="ml-4">
39+
<p className="text-lg font-bold">Me</p>
40+
<div className="flex items-center justify-between">
41+
<input
42+
type="text"
43+
className="w-full mr-4 bg-white rounded-lg py-2 px-3"
44+
/>
45+
<button
46+
className="bg-blue-500 text-white rounded-lg py-2 px-4"
47+
onClick={handleReply}
48+
>
49+
Reply
50+
</button>
51+
</div>
52+
</div>
53+
</div>
4154
</div>
4255
</div>
4356
</div>
44-
45-
46-
</div>
4757
</div>
4858
);
4959
};

client/src/components/Anythingmore.jsx

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,50 @@ function Anythingmore() {
1313
console.log('Submitted details:', details);
1414
// You can add additional logic here, such as making an API call to save the details
1515

16+
// Create a text file from the input content
17+
const textFile = new Blob([details], { type: 'text/plain' });
18+
19+
// Create a file URL for downloading
20+
const fileURL = URL.createObjectURL(textFile);
21+
22+
// Create a temporary link element
23+
const downloadLink = document.createElement('a');
24+
downloadLink.href = fileURL;
25+
downloadLink.download = 'anything.txt';
26+
27+
// Append the link to the document body and trigger the download
28+
document.body.appendChild(downloadLink);
29+
downloadLink.click();
30+
31+
// Remove the link from the document body
32+
document.body.removeChild(downloadLink);
33+
34+
// Call the API to push the text file
35+
callAPI(textFile)
36+
.then(() => {
37+
console.log('API call successful');
38+
})
39+
.catch((error) => {
40+
console.error('Error calling API:', error);
41+
});
42+
1643
// Clear the input field after submission
1744
setDetails('');
1845
};
1946

47+
const callAPI = (file) => {
48+
const formData = new FormData();
49+
formData.append('file', file);
50+
51+
return fetch(
52+
'https://3f2ssd7loqowjtj7hnzhni7trq0blutk.lambda-url.us-east-1.on.aws/notestotext_anythingelse',
53+
{
54+
method: 'POST',
55+
body: formData,
56+
}
57+
);
58+
};
59+
2060
return (
2161
<div className="flex flex-col items-center justify-center h-screen text-center w-screen bg-gradient-to-tr from-violet-700 via-green-600 to-green-400">
2262
<h1 className="text-3xl font-bold mb-4 text-white">Anything more to add!</h1>
@@ -26,13 +66,11 @@ function Anythingmore() {
2666
onChange={handleInputChange}
2767
placeholder="Enter details..."
2868
></textarea>
29-
<Link to="/dashboard">
30-
<button
31-
className="bg-violet-900 text-white py-2 px-6 rounded-lg"
32-
onClick={handleSubmit}
33-
>
34-
Finish
69+
<button className="bg-violet-900 text-white py-2 px-6 rounded-lg mb-4" onClick={handleSubmit}>
70+
Submit
3571
</button>
72+
<Link to="/dashboard">
73+
<button className="bg-violet-900 text-white py-2 px-6 rounded-lg">Finish</button>
3674
</Link>
3775
</div>
3876
);

client/src/components/Hero.jsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ import { Link } from 'react-router-dom';
55
function Hero() {
66
return (
77
<div>
8-
<section className="bg-white dark:bg-violet-900 mt-4 w-screen">
8+
<section className="bg-violet-900 mt-4 w-screen">
99
<div className="grid max-w-screen-xl px-4 py-8 mx-auto lg:gap-8 xl:gap-0 lg:py-16 lg:grid-cols-12">
1010
<div className="mr-auto place-self-center lg:col-span-7">
11-
<h1 className="max-w-2xl mb-4 text-4xl font-extrabold tracking-tight leading-none md:text-5xl xl:text-6xl dark:text-white">Unlock Your Academic Potential with LearnMateAI</h1>
12-
<p className="max-w-2xl mb-6 font-light text-gray-500 lg:mb-8 md:text-lg lg:text-xl dark:text-gray-400">Personalized Learning for Smarter Results</p>
11+
<h1 className="max-w-2xl mb-4 text-4xl font-extrabold tracking-tight leading-none md:text-5xl xl:text-6xl text-white">Unlock Your Academic Potential with LearnMateAI</h1>
12+
<p className="max-w-2xl mb-6 font-light lg:mb-8 md:text-lg lg:text-xl text-white">Personalized Learning for Smarter Results</p>
1313
<Link to='/uploadnote'>
14-
<a href="#" className="inline-flex items-center justify-center px-5 py-3 mr-3 text-base font-medium text-center text-white rounded-lg bg-primary-700 hover:bg-primary-800 focus:ring-4 focus:ring-primary-300 dark:focus:ring-primary-900">
15-
Upload Notes
14+
<a href="#" className="inline-flex items-center justify-center px-5 py-3 mr-3 text-base font-medium text-center text-white rounded-lg bg-primary-700 hover:bg-primary-800 focus:ring-4 focus:ring-primary-300 ">
15+
Get started
1616
<svg className="w-5 h-5 ml-2 -mr-1" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fillRule="evenodd" d="M10.293 3.293a1 1 0 011.414 0l6 6a1 1 0 010 1.414l-6 6a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-4.293-4.293a1 1 0 010-1.414z" clipRule="evenodd"></path></svg>
1717
</a>
1818
</Link>
19-
<a href="#" className="inline-flex items-center justify-center px-5 py-3 text-base font-medium text-center text-gray-900 border border-gray-300 rounded-lg hover:bg-violet-900 focus:ring-4 focus:ring-gray-100 dark:text-white dark:border-gray-700 dark:hover:bg-gray-700 dark:focus:ring-gray-800">
19+
{/* <a href="#" className="inline-flex items-center justify-center px-5 py-3 text-base font-medium text-center text-white border border-gray-300 rounded-lg hover:bg-violet-900 focus:ring-4 focus:ring-gray-100 dark:border-gray-700">
2020
Watch Video
21-
</a>
21+
</a> */}
2222
</div>
2323
<div className="hidden lg:mt-0 lg:col-span-5 lg:flex">
2424
<Lottie animationData={animation} height={400} width={300}/>

client/src/components/Uploadnote.jsx

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,35 @@ function Uploadnote({ moduleNumber }) {
1919
setUploadSuccess(false);
2020
};
2121

22-
const handleFileChange = (index, event) => {
22+
const handleFileChange = async (index, event) => {
2323
const file = event.target.files[0];
2424
const updatedFiles = [...selectedFiles];
2525
updatedFiles[index] = file;
2626
setSelectedFiles(updatedFiles);
2727
setUploadSuccess(false);
28+
29+
try {
30+
const formData = new FormData();
31+
formData.append('files', file);
32+
33+
const response = await fetch('https://3f2ssd7loqowjtj7hnzhni7trq0blutk.lambda-url.us-east-1.on.aws/notestotext_modwise', {
34+
method: 'POST',
35+
body: formData,
36+
});
37+
38+
if (response.ok) {
39+
setUploadSuccess(true);
40+
setShowSuccessMessage(true);
41+
setTimeout(() => {
42+
setShowSuccessMessage(false);
43+
setFadeOut(true);
44+
}, 10000);
45+
} else {
46+
throw new Error('Error uploading file');
47+
}
48+
} catch (error) {
49+
console.error('Error uploading file:', error);
50+
}
2851
};
2952

3053
const handleUpload = () => {
@@ -65,20 +88,20 @@ function Uploadnote({ moduleNumber }) {
6588

6689
const saveFileLocally = (filePath, file) => {
6790
return new Promise((resolve, reject) => {
68-
const virtualLink = document.createElement('a');
69-
virtualLink.href = URL.createObjectURL(file);
70-
virtualLink.download = filePath;
71-
virtualLink.addEventListener('load', () => {
72-
URL.revokeObjectURL(virtualLink.href);
73-
resolve();
74-
});
75-
virtualLink.addEventListener('error', (error) => {
76-
reject(error);
77-
});
78-
document.body.appendChild(virtualLink);
79-
virtualLink.click();
80-
document.body.removeChild(virtualLink);
91+
const virtualLink = document.createElement('a');
92+
virtualLink.href = URL.createObjectURL(file);
93+
virtualLink.download = filePath;
94+
virtualLink.addEventListener('load', () => {
95+
URL.revokeObjectURL(virtualLink.href);
96+
resolve();
8197
});
98+
virtualLink.addEventListener('error', (error) => {
99+
reject(error);
100+
});
101+
document.body.appendChild(virtualLink);
102+
virtualLink.click();
103+
document.body.removeChild(virtualLink);
104+
});
82105
};
83106

84107
const handleUploadAnother = () => {
@@ -151,11 +174,7 @@ function Uploadnote({ moduleNumber }) {
151174
) : (
152175
<>
153176
{showSuccessMessage && (
154-
<motion.div
155-
className="text-xl"
156-
initial={{ opacity: 0 }}
157-
animate={{ opacity: 1 }}
158-
>
177+
<motion.div className="text-xl" initial={{ opacity: 0 }} animate={{ opacity: 1 }}>
159178
Successfully Uploaded!
160179
</motion.div>
161180
)}

0 commit comments

Comments
 (0)