Skip to content

Commit 06e186e

Browse files
committed
2 parents 208e103 + a7280a2 commit 06e186e

File tree

8 files changed

+271
-38
lines changed

8 files changed

+271
-38
lines changed

client/src/App.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ import Uploadn from "./components/Uploadn";
1818
import Aibot from "./components/Aibot";
1919
import Uploadp from "./components/Uploadp";
2020
import Uploads from "./components/Uploads";
21+
import Sortedpyq from "./components/Sortedpyq";
22+
import Generalpyq from "./components/Generalpyq";
23+
import Repetitivepyq from "./components/Repetitivepyq";
2124

2225
function App() {
2326
return (
@@ -48,6 +51,9 @@ function App() {
4851

4952

5053
<Route path="/aibot" element={<Aibot/>} />
54+
<Route path="/sortedpyq" element={<Sortedpyq/>} />
55+
<Route path="/generalpyq" element={<Generalpyq/>} />
56+
<Route path="/repetitivepyq" element={<Repetitivepyq/>} />
5157

5258
</Routes>
5359
</BrowserRouter>

client/src/components/Aibot.jsx

Lines changed: 95 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,74 @@
1-
import React from 'react';
1+
import React, { useState, useRef } from 'react';
22
import Navbar from './Navbar';
33
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

77
const Tutor = () => {
8+
const [inputText, setInputText] = useState('');
9+
const inputImageRef = useRef(null);
10+
const inputVoiceRef = useRef(null);
11+
const recognitionRef = useRef(null);
12+
const [isListening, setIsListening] = useState(false);
13+
const [outputText, setOutputText] = useState('');
14+
const [outputSound, setOutputSound] = useState(null);
15+
const [outputImage, setOutputImage] = useState(null);
16+
817
const avatarNarration = 'Hello! I am Luna, your tutor. How can I assist you today?';
918

1019
const handleReply = () => {
1120
// Handle the reply button functionality here
21+
console.log('Input Text:', inputText);
22+
console.log('Input Image:', inputImageRef.current.files[0]);
23+
console.log('Input Voice:', inputVoiceRef.current.files[0]);
24+
// You can perform further actions based on the input and update the output state variables accordingly.
25+
};
26+
27+
const handleTextChange = (event) => {
28+
setInputText(event.target.value);
29+
};
30+
31+
const handleImageChange = (event) => {
32+
const file = event.target.files[0];
33+
inputImageRef.current.value = ''; // Reset the input file value for re-selecting the same file
34+
setOutputImage(URL.createObjectURL(file));
35+
};
36+
37+
const handleVoiceChange = () => {
38+
if (isListening) {
39+
recognitionRef.current.stop();
40+
setIsListening(false);
41+
} else {
42+
const recognition = new window.SpeechRecognition();
43+
recognition.continuous = true;
44+
recognition.interimResults = false;
45+
46+
recognition.onstart = () => {
47+
setIsListening(true);
48+
};
49+
50+
recognition.onresult = (event) => {
51+
const transcript = Array.from(event.results)
52+
.map((result) => result[0])
53+
.map((result) => result.transcript)
54+
.join('');
55+
56+
setInputText(transcript);
57+
};
58+
59+
recognition.onerror = (event) => {
60+
console.error('Recognition error:', event.error);
61+
setIsListening(false);
62+
};
63+
64+
recognition.onend = () => {
65+
setIsListening(false);
66+
};
67+
68+
recognition.start();
69+
setIsListening(true);
70+
recognitionRef.current = recognition;
71+
}
1272
};
1373

1474
return (
@@ -41,18 +101,52 @@ const Tutor = () => {
41101
type="text"
42102
className="w-full mr-4 bg-white rounded-lg py-2 px-3 focus:outline-none"
43103
placeholder="Enter your message"
104+
value={inputText}
105+
onChange={handleTextChange}
106+
/>
107+
<input
108+
type="file"
109+
accept="image/*"
110+
className="hidden"
111+
onChange={handleImageChange}
112+
ref={inputImageRef}
44113
/>
45114
<button
46115
className="bg-blue-500 text-white rounded-lg py-2 px-4 hover:bg-blue-600 transition-colors"
47116
onClick={handleReply}
48117
>
49118
Reply
50119
</button>
120+
<button
121+
className={`bg-blue-500 text-white rounded-lg py-2 px-4 hover:bg-blue-600 transition-colors ml-2 ${
122+
isListening ? 'bg-red-500' : ''
123+
}`}
124+
onClick={handleVoiceChange}
125+
>
126+
{isListening ? 'Stop Listening' : 'Add Voice'}
127+
</button>
128+
<button
129+
className="bg-blue-500 text-white rounded-lg py-2 px-4 hover:bg-blue-600 transition-colors ml-2"
130+
onClick={() => inputImageRef.current.click()}
131+
>
132+
Add Image
133+
</button>
51134
</div>
52135
</div>
53136
</div>
54137
</div>
55138
</div>
139+
<div className="fixed bottom-4 right-4">
140+
<div className="w-64 bg-white rounded-lg shadow-lg p-4">
141+
{outputText && <p className="mb-2">{outputText}</p>}
142+
{outputSound && (
143+
<audio controls>
144+
<source src={outputSound} type="audio/mpeg" />
145+
</audio>
146+
)}
147+
{outputImage && <img src={outputImage} alt="Output" className="w-full" />}
148+
</div>
149+
</div>
56150
</div>
57151
</div>
58152
);

client/src/components/Dashboard.jsx

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { useState, useEffect } from "react";
22
import { motion } from "framer-motion";
33
import Navbar from "./Navbar";
4+
import { Link } from "react-router-dom";
45

56
const data = {
67
coursesCompleted: 5,
@@ -61,52 +62,60 @@ const Dashboard = () => {
6162
<div className="w-screen">
6263
<Navbar />
6364
<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-4 gap-4 py-12 h-12">
65+
<div className="grid grid-cols-4 gap-6 py-12 h-4">
66+
<Link to="/sortedpyq">
6567
<motion.div
6668
className="bg-slate-100 rounded-lg shadow-lg py-6 w-72"
6769
variants={containerVariants}
6870
initial="hidden"
6971
animate="visible"
7072
transition={{ delay: 0.2 }}
7173
>
72-
<h3 className="mb-4">Total hours</h3>
73-
<pre></pre>
74+
<h2 className="mb-4">Sorted PYQ</h2>
75+
7476
</motion.div>
77+
</Link>
78+
<Link to="/generalpyq">
7579
<motion.div
7680
className="bg-slate-100 rounded-lg shadow-lg py-6"
7781
variants={containerVariants}
7882
initial="hidden"
7983
animate="visible"
8084
transition={{ delay: 0.2 }}
8185
>
82-
<h3 className="mb-4">Maximum retention</h3>
83-
<pre></pre>
86+
<h2 className="mb-4">General Question Paper</h2>
87+
8488
</motion.div>
89+
</Link>
90+
<Link to="/repetitivepyq">
8591
<motion.div
8692
className="bg-slate-100 rounded-lg shadow-lg py-6"
8793
variants={containerVariants}
8894
initial="hidden"
8995
animate="visible"
9096
transition={{ delay: 0.2 }}
9197
>
92-
<h3 className="mb-4">Completed hours</h3>
93-
<pre></pre>
98+
<h2 className="mb-4">Repetitive questions</h2>
99+
94100
</motion.div>
101+
</Link>
102+
<Link to="/studyplanner">
95103
<motion.div
96104
className="bg-slate-100 rounded-lg shadow-lg py-6"
97105
variants={containerVariants}
98106
initial="hidden"
99107
animate="visible"
100108
transition={{ delay: 0.2 }}
101109
>
102-
<h3 className="mb-4">Average retention</h3>
103-
<pre></pre>
110+
<h2 className="mb-4">Study plan</h2>
111+
104112
</motion.div>
113+
</Link>
105114

106115

107116

108117

109-
</div>
118+
</div>
110119

111120
<div className="grid grid-cols-2 gap-16 py-16">
112121
<div className="grid grid-cols-2 gap-4">
@@ -118,10 +127,10 @@ const Dashboard = () => {
118127
>
119128
<h3 className="text-xl mb-4">Important Topics</h3>
120129
<pre>{impTopicContent}</pre>
121-
<p>Half adder</p>
122-
<p>Full adder</p>
123-
<p>Half Subtractor</p>
124-
<p>Full Subtractor</p>
130+
<p>NFA and DFA</p>
131+
<p>NFA to DFA conversion</p>
132+
<p>Minimisation</p>
133+
<p>Ardens Theorem</p>
125134
</motion.div>
126135

127136
<motion.div
@@ -133,6 +142,10 @@ const Dashboard = () => {
133142
>
134143
<h3 className="text-xl mb-4">Topic List</h3>
135144
<pre>{topicListContent}</pre>
145+
<p>Finite state systems</p>
146+
<p>Definitions</p>
147+
<p>Minimisation</p>
148+
<p>Moore and Mealy machinesm</p>
136149
</motion.div>
137150
</div>
138151

@@ -145,7 +158,7 @@ const Dashboard = () => {
145158
>
146159
<h3 className="text-lg font-semibold mb-4">Cluster Questions</h3>
147160
<iframe
148-
src="https://mrcet.com/downloads/digital_notes/CSE/II%20Year/DBMS.pdf"
161+
src="http://www.gpcet.ac.in/wp-content/uploads/2017/04/flat-10.pdf"
149162
className="w-full h-full"
150163
title="PDF Viewer"
151164
/>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import React, { useEffect, useState } from 'react';
2+
import Navbar from './Navbar';
3+
4+
const Generalpyq = () => {
5+
const [pdfUrl, setPdfUrl] = useState('');
6+
7+
useEffect(() => {
8+
fetchPdf();
9+
}, []);
10+
11+
const fetchPdf = async () => {
12+
try {
13+
const response = await fetch('API_URL'); // Replace 'API_URL' with your actual API endpoint
14+
if (response.ok) {
15+
const pdfData = await response.blob();
16+
const pdfUrl = URL.createObjectURL(pdfData);
17+
setPdfUrl(pdfUrl);
18+
} else {
19+
throw new Error('Error fetching PDF');
20+
}
21+
} catch (error) {
22+
console.error('Error fetching PDF:', error);
23+
}
24+
};
25+
26+
return (
27+
<div>
28+
<Navbar />
29+
30+
<div className="flex justify-center">
31+
<div className="w-1/2 h-1/2 bg-gray-200 rounded-lg mt-4">
32+
<h1 className="text-center text-3xl">General PYQ</h1>
33+
{pdfUrl && (
34+
<iframe src={pdfUrl} title="General PYQ" className="w-full h-full"></iframe>
35+
)}
36+
</div>
37+
</div>
38+
</div>
39+
);
40+
};
41+
42+
export default Generalpyq;

client/src/components/Navbar.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ const Navbar = () => {
4848
>
4949
Quiz
5050
</Link> */}
51-
<Link
51+
{/* <Link
5252
to="/studyplanner"
5353
className="hover:text-gray-900 px-3 py-2 rounded-md text-sm"
5454
>
5555
Study Planner
56-
</Link>
56+
</Link> */}
5757
<Link
5858
to="/dashboard"
5959
className="hover:text-gray-900 px-3 py-2 rounded-md text-sm"
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import React, { useEffect, useState } from 'react';
2+
import Navbar from './Navbar';
3+
4+
const Repetitivepyq = () => {
5+
const [pdfUrl, setPdfUrl] = useState('');
6+
7+
useEffect(() => {
8+
fetchPdf();
9+
}, []);
10+
11+
const fetchPdf = async () => {
12+
try {
13+
const response = await fetch('API_URL'); // Replace 'API_URL' with your actual API endpoint
14+
if (response.ok) {
15+
const pdfData = await response.blob();
16+
const pdfUrl = URL.createObjectURL(pdfData);
17+
setPdfUrl(pdfUrl);
18+
} else {
19+
throw new Error('Error fetching PDF');
20+
}
21+
} catch (error) {
22+
console.error('Error fetching PDF:', error);
23+
}
24+
};
25+
26+
return (
27+
<div>
28+
<Navbar />
29+
30+
<div className="flex justify-center">
31+
<div className="w-1/2 h-1/2 bg-gray-200 rounded-lg mt-4">
32+
<h1 className="text-center text-3xl">Repetitive PYQ</h1>
33+
{pdfUrl && (
34+
<iframe src={pdfUrl} title="Sorted PYQ" className="w-full h-full"></iframe>
35+
)}
36+
</div>
37+
</div>
38+
</div>
39+
);
40+
};
41+
42+
export default Repetitivepyq;

0 commit comments

Comments
 (0)