Skip to content

Commit 37befa7

Browse files
Dashboard cluster questions[final]
1 parent 7aa3125 commit 37befa7

File tree

10 files changed

+191
-221
lines changed

10 files changed

+191
-221
lines changed

client/src/App.jsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ import About from "./components/About";
1010
import Team from "./components/Team";
1111
import Studyplanner from "./components/Studyplanner";
1212
import Features from "./components/Features";
13-
import Uploadsyllabus from "./components/Uploadsyllabus";
13+
1414
import Uploadnote from "./components/Uploadnote";
15-
import Uploadpyq from "./components/Uploadpyq";
15+
1616
import Anythingmore from "./components/Anythingmore";
1717
import Uploadn from "./components/Uploadn";
1818
import Aibot from "./components/Aibot";
1919
import Uploadp from "./components/Uploadp";
20+
import Uploads from "./components/Uploads";
2021

2122
function App() {
2223
return (
@@ -37,12 +38,14 @@ function App() {
3738
<Route path="/login" element={<Login/>} />
3839

3940

40-
<Route path="/uploadsyllabus" element={<Uploadsyllabus/>} />
41+
4142
<Route path="/uploadnote" element={<Uploadnote/>} />
42-
<Route path="/uploadpyq" element={<Uploadpyq/>} />
43+
4344
<Route path="/anythingmore" element={<Anythingmore/>} />
4445
<Route path="/uploadn" element={<Uploadn/>} />
4546
<Route path="/uploadp" element={<Uploadp/>} />
47+
<Route path="/uploads" element={<Uploads/>} />
48+
4649

4750
<Route path="/aibot" element={<Aibot/>} />
4851

client/src/components/Aibot.jsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ import Lottie from 'lottie-react';
44
import animationData from '../assets/134013-student-with-laptop.json';
55
import animationData1 from '../assets/39701-robot-bot-3d.json';
66

7-
87
const Tutor = () => {
9-
const avatarNarration = 'Hello! How can I assist you today?';
8+
const avatarNarration = 'Hello! I am Luna, your tutor. How can I assist you today?';
109

1110
const handleReply = () => {
1211
// Handle the reply button functionality here
@@ -17,33 +16,34 @@ const Tutor = () => {
1716
<Navbar />
1817
<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">
1918
<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} />
19+
<div className="bg-slate-100 rounded-lg shadow-lg px-60 py-16 h-full mt-4 mb-28 w-auto">
20+
<div className="flex items-center py-8 px-16">
21+
<div className="w-24 h-24 rounded-full bg-orange-600 flex-shrink-0">
22+
<Lottie animationData={animationData1} loop autoplay />
2423
</div>
2524
<div className="ml-4">
26-
<p className="text-lg font-bold">AI Tutor</p>
25+
<p className="text-2xl font-bold text-gray-800">Luna</p>
2726
<p className="text-gray-500 text-sm">{avatarNarration}</p>
2827
</div>
2928
</div>
3029
</div>
3130
</div>
3231
<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">
32+
<div className="max-w-xl bg-slate-100 rounded-lg shadow-lg p-4 fixed bottom-4">
3433
<div className="flex items-center">
35-
<div className="w-16 h-16 rounded-full bg-green-500 flex-shrink-0">
36-
<Lottie animationData={animationData} />
34+
<div className="w-24 h-24 rounded-full bg-green-500 flex-shrink-0">
35+
<Lottie animationData={animationData} loop autoplay />
3736
</div>
3837
<div className="ml-4">
39-
<p className="text-lg font-bold">Me</p>
40-
<div className="flex items-center justify-between">
38+
<p className="text-2xl font-bold text-gray-800">Me</p>
39+
<div className="flex items-center justify-between mt-2">
4140
<input
4241
type="text"
43-
className="w-full mr-4 bg-white rounded-lg py-2 px-3"
42+
className="w-full mr-4 bg-white rounded-lg py-2 px-3 focus:outline-none"
43+
placeholder="Enter your message"
4444
/>
4545
<button
46-
className="bg-blue-500 text-white rounded-lg py-2 px-4"
46+
className="bg-blue-500 text-white rounded-lg py-2 px-4 hover:bg-blue-600 transition-colors"
4747
onClick={handleReply}
4848
>
4949
Reply

client/src/components/Anythingmore.jsx

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,6 @@ function Anythingmore() {
1717
// Create a text file from the input content
1818
const textFile = new Blob([details], { type: 'text/plain' });
1919

20-
// Create a file URL for downloading
21-
const fileURL = URL.createObjectURL(textFile);
22-
23-
// Create a temporary link element
24-
const downloadLink = document.createElement('a');
25-
downloadLink.href = fileURL;
26-
downloadLink.download = 'anything.txt';
27-
28-
// Append the link to the document body and trigger the download
29-
document.body.appendChild(downloadLink);
30-
downloadLink.click();
31-
32-
// Remove the link from the document body
33-
document.body.removeChild(downloadLink);
34-
3520
// Call the API to push the text file
3621
callAPI(textFile)
3722
.then(() => {
@@ -55,7 +40,7 @@ function Anythingmore() {
5540

5641
const callAPI = (file) => {
5742
const formData = new FormData();
58-
formData.append('file', file);
43+
formData.append('file', file, 'anythingelse.txt');
5944

6045
return fetch(
6146
'https://3f2ssd7loqowjtj7hnzhni7trq0blutk.lambda-url.us-east-1.on.aws/notestotext_anythingelse',
@@ -66,8 +51,8 @@ function Anythingmore() {
6651
);
6752
};
6853

69-
const retryAPI = (file) => {
70-
callAPI(file)
54+
const retryAPI = (textfile) => {
55+
callAPI(textfile)
7156
.then(() => {
7257
console.log('API call retried successfully');
7358
setApiError(false);
@@ -90,7 +75,7 @@ function Anythingmore() {
9075
<button className="bg-violet-900 text-white py-2 px-6 rounded-lg mb-4" onClick={handleSubmit}>
9176
Submit
9277
</button>
93-
{apiError && <p className="text-red-500">Error calling API. Retrying...</p>}
78+
{apiError && <p className="text-red-500"></p>}
9479
<Link to="/dashboard">
9580
<button className="bg-violet-900 text-white py-2 px-6 rounded-lg">Finish</button>
9681
</Link>

client/src/components/Dashboard.jsx

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React, { useState, useEffect } from "react";
22
import { motion } from "framer-motion";
3-
43
import Navbar from "./Navbar";
54

65
const data = {
@@ -61,39 +60,51 @@ const Dashboard = () => {
6160
return (
6261
<div className="w-screen">
6362
<Navbar />
64-
<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">
65-
<div className="flex flex-wrap justify-center gap-8 p-6">
63+
<div className="flex flex-col items-center h-screen w-screen text-center bg-gradient-to-tr from-violet-700 via-green-600 to-green-400 mt-3">
64+
<div className="grid grid-cols-2 gap-16 py-16 h-96">
65+
<div className="grid grid-cols-2 gap-4">
6666
<motion.div
67-
className="w-full sm:w-1/2 bg-slate-50 rounded-lg shadow-lg p-6"
67+
className="bg-slate-100 rounded-lg shadow-lg py-6 h-96 w-60"
6868
variants={containerVariants}
6969
initial="hidden"
7070
animate="visible"
7171
>
72-
<h3 className="text-lg font-medium mb-4">Important Topics</h3>
72+
<h3 className="text-xl mb-4">Important Topics</h3>
7373
<pre>{impTopicContent}</pre>
74+
<p>Half adder</p>
75+
<p>Full adder</p>
76+
<p>Half Subtractor</p>
77+
<p>Full Subtractor</p>
7478
</motion.div>
7579

7680
<motion.div
77-
className="w-full sm:w-1/2 bg-slate-50 rounded-lg shadow-lg p-6"
81+
className="bg-slate-100 rounded-lg shadow-lg py-6 w-60"
7882
variants={containerVariants}
7983
initial="hidden"
8084
animate="visible"
8185
transition={{ delay: 0.2 }}
8286
>
83-
<h3 className="text-lg font-medium mb-4">Topic List</h3>
87+
<h3 className="text-xl mb-4">Topic List</h3>
8488
<pre>{topicListContent}</pre>
8589
</motion.div>
90+
</div>
8691

8792
<motion.div
88-
className="w-full sm:w-1/2 bg-slate-50 rounded-lg shadow-lg p-6"
93+
className="bg-slate-50 rounded-lg shadow-lg py-6 w-120"
8994
variants={containerVariants}
9095
initial="hidden"
9196
animate="visible"
9297
transition={{ delay: 0.4 }}
9398
>
94-
<h3 className="text-lg font-medium mb-4">Cluster Questions</h3>
95-
<pre>{clusterQuestionsContent}</pre>
99+
<h3 className="text-lg font-semibold mb-4">Cluster Questions</h3>
100+
<iframe
101+
src="https://mrcet.com/downloads/digital_notes/CSE/II%20Year/DBMS.pdf"
102+
className="w-full h-full"
103+
title="PDF Viewer"
104+
/>
96105
</motion.div>
106+
107+
97108
</div>
98109
</div>
99110
</div>

client/src/components/Hero.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Link } from 'react-router-dom';
55
function Hero() {
66
return (
77
<div>
8-
<section className="bg-violet-900 mt-4 w-screen">
8+
<section className="bg-gradient-to-tr from-violet-700 via-green-600 to-green-400 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">
1111
<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>

client/src/components/Uploadn.jsx

Lines changed: 60 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import Lottie from 'lottie-react';
44
import animationData from '../assets/95241-uploading.json';
55
import { Link } from 'react-router-dom';
66

7-
function Uploadnote({ moduleNumber }) {
7+
function Uploadn({ moduleNumber }) {
88
const [numNotes, setNumNotes] = useState(0);
99
const [selectedFiles, setSelectedFiles] = useState([]);
1010
const [uploading, setUploading] = useState(false);
1111
const [uploadSuccess, setUploadSuccess] = useState(false);
1212
const [showSuccessMessage, setShowSuccessMessage] = useState(false);
13-
const [fadeOut, setFadeOut] = useState(false); // New state to control fading out
13+
const [fadeOut, setFadeOut] = useState(false);
1414

1515
const handleNumNotesChange = (event) => {
1616
const count = parseInt(event.target.value, 10);
@@ -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();
97+
});
98+
virtualLink.addEventListener('error', (error) => {
99+
reject(error);
81100
});
101+
document.body.appendChild(virtualLink);
102+
virtualLink.click();
103+
document.body.removeChild(virtualLink);
104+
});
82105
};
83106

84107
const handleUploadAnother = () => {
@@ -88,6 +111,20 @@ function Uploadnote({ moduleNumber }) {
88111
setFadeOut(false);
89112
};
90113

114+
const handleFinish = () => {
115+
fetch('https://3f2ssd7loqowjtj7hnzhni7trq0blutk.lambda-url.us-east-1.on.aws/notestotext')
116+
.then((response) => {
117+
if (response.ok) {
118+
// Handle successful response
119+
} else {
120+
throw new Error('Error requesting data');
121+
}
122+
})
123+
.catch((error) => {
124+
console.error('Error requesting data:', error);
125+
});
126+
};
127+
91128
const renderUploadInputs = () => {
92129
const inputs = [];
93130

@@ -144,18 +181,14 @@ function Uploadnote({ moduleNumber }) {
144181
>
145182
{uploading ? 'Uploaded' : 'Upload'}
146183
</motion.button>
147-
<Link to="/uploadpyq" className="bg-green-500 text-white py-2 ml-4 px-6 mt-4 rounded-lg">
184+
<Link to="/uploadp" className="bg-green-500 text-white py-2 ml-4 px-6 mt-4 rounded-lg">
148185
Next
149186
</Link>
150187
</>
151188
) : (
152189
<>
153190
{showSuccessMessage && (
154-
<motion.div
155-
className="text-xl"
156-
initial={{ opacity: 0 }}
157-
animate={{ opacity: 1 }}
158-
>
191+
<motion.div className="text-xl" initial={{ opacity: 0 }} animate={{ opacity: 1 }}>
159192
Successfully Uploaded!
160193
</motion.div>
161194
)}
@@ -165,9 +198,12 @@ function Uploadnote({ moduleNumber }) {
165198
>
166199
Upload Another
167200
</motion.button>
168-
<Link to="/uploadpyq" className="text-blue-500 mt-8">
201+
<Link to="/uploadp" className="text-blue-500 mt-8">
169202
Next
170203
</Link>
204+
<button className="text-blue-500 mt-8" onClick={handleFinish}>
205+
Finish
206+
</button>
171207
</>
172208
)}
173209
</motion.div>
@@ -176,4 +212,4 @@ function Uploadnote({ moduleNumber }) {
176212
);
177213
}
178214

179-
export default Uploadnote;
215+
export default Uploadn;

client/src/components/Uploadnote.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ function Uploadnote({ moduleNumber }) {
167167
>
168168
{uploading ? 'Uploaded' : 'Upload'}
169169
</motion.button>
170-
<Link to="/uploadpyq" className="bg-green-500 text-white py-2 ml-4 px-6 mt-4 rounded-lg">
170+
<Link to="/uploadp" className="bg-green-500 text-white py-2 ml-4 px-6 mt-4 rounded-lg">
171171
Next
172172
</Link>
173173
</>
@@ -184,7 +184,7 @@ function Uploadnote({ moduleNumber }) {
184184
>
185185
Upload Another
186186
</motion.button>
187-
<Link to="/uploadpyq" className="text-blue-500 mt-8">
187+
<Link to="/uploadp" className="text-blue-500 mt-8">
188188
Next
189189
</Link>
190190
</>

0 commit comments

Comments
 (0)