File size: 8,182 Bytes
343bf49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>SmartLearn - Personalized Study Plan</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap" rel="stylesheet">
    <style>

        body, html {

            margin: 0;

            padding: 0;

            font-family: 'Poppins', sans-serif;

            background: url('https://wallpapercave.com/wp/ew0V5jf.jpg') no-repeat center center fixed;

            background-size: cover;

            position: relative;

            min-height: 100vh;

            display: flex;

            justify-content: center;

            align-items: center;

        }

        body::before {

            content: '';

            position: absolute;

            top: 0;

            left: 0;

            right: 0;

            bottom: 0;

            background-color: rgba(0, 0, 0, 0.2);

            z-index: 1;

        }

        .container {

            position: relative;

            z-index: 2;

            background-color: rgba(241, 241, 241, 0.2);

            border-radius: 20px;

            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);

            padding: 40px;

            width: 90%;

            max-width: 800px;

        }

        .back-button {

            position: absolute;

            top: 20px;

            left: 20px;

            background-color: #007bff;

            color: white;

            border: none;

            border-radius: 50%;

            width: 40px;

            height: 40px;

            cursor: pointer;

            display: flex;

            justify-content: center;

            align-items: center;

            font-size: 18px;

            transition: background-color 0.3s;

            z-index: 3;

        }

        .back-button:hover {

            background-color: #0056b3;

        }

        h1 {

            text-align: center;

            color: #333;

            margin-bottom: 30px;

            font-weight: 600;

        }

        .study-plan-form {

            display: grid;

            gap: 20px;

            margin-bottom: 30px;

        }

        .form-group {

            display: flex;

            flex-direction: column;

        }

        label {

            margin-bottom: 5px;

            font-weight: 500;

            color: white; /* Changed the color to white */

        }

        input, select {

            padding: 10px;

            border: 1px solid #ddd;

            border-radius: 5px;

            font-size: 16px;

        }

        button {

            background-color: #28a745;

            color: white;

            border: none;

            padding: 12px 20px;

            border-radius: 5px;

            cursor: pointer;

            font-size: 16px;

            transition: background-color 0.3s;

        }

        button:hover {

            background-color: #218838;

        }

        .chat-container {

            background-color: #f8f9fa;

            border-radius: 10px;

            padding: 20px;

            max-height: 300px;

            overflow-y: auto;

        }

        .chat-messages {

            display: flex;

            flex-direction: column;

        }

        .message {

            margin-bottom: 15px;

            padding: 10px;

            border-radius: 10px;

            max-width: 80%;

        }

        .user-message {

            align-self: flex-end;

            background-color: #007bff;

            color: white;

        }

        .ai-message {

            align-self: flex-start;

            background-color: #e9ecef;

            color: #333;

        }

    </style>
</head>
<body>
    <div class="container">
        <button class="back-button" onclick="goBack()"><i class="fas fa-arrow-left"></i></button>
        <h1><i class="fas fa-graduation-cap"></i> Personalized Study Plan</h1>
        <div class="study-plan-form">
            <div class="form-group">
                <label for="subjects"><i class="fas fa-book"></i> Subjects (comma-separated):</label>
                <input type="text" id="subjects" placeholder="Math, Science, History">
            </div>
            <div class="form-group">
                <label for="available-time"><i class="fas fa-clock"></i> Available study time per day (hours):</label>
                <input type="number" id="available-time" min="1" max="24" value="2">
            </div>
            <div class="form-group">
                <label for="goal"><i class="fas fa-bullseye"></i> Study goal:</label>
                <input type="text" id="goal" placeholder="Prepare for final exams">
            </div>
            <div class="form-group">
                <label for="area-lag"><i class="fas fa-exclamation-triangle"></i> Areas of Lag (comma-separated):</label>
                <input type="text" id="area-lag" placeholder="Algebra, Thermodynamics">
            </div>
            <div class="form-group">
                <label for="learning-style"><i class="fas fa-brain"></i> Preferred learning style:</label>
                <select id="learning-style">
                    <option value="visual">Visual</option>
                    <option value="auditory">Auditory</option>
                    <option value="reading">Reading/Writing</option>
                    <option value="kinesthetic">Kinesthetic</option>
                </select>
            </div>
            <button onclick="generateStudyPlan()"><i class="fas fa-magic"></i> Generate Study Plan</button>
        </div>
        <div class="chat-container">
            <div id="chat-messages" class="chat-messages"></div>
        </div>
    </div>

    <script>

        const chatMessages = document.getElementById('chat-messages');



        function addMessage(content, isUser) {

            const messageDiv = document.createElement('div');

            messageDiv.className = `message ${isUser ? 'user-message' : 'ai-message'}`;

            messageDiv.innerHTML = content; // Use innerHTML to render HTML tags

            chatMessages.appendChild(messageDiv);

            chatMessages.scrollTop = chatMessages.scrollHeight;

        }



        function generateStudyPlan() {

            const subjects = document.getElementById('subjects').value;

            const availableTime = document.getElementById('available-time').value;

            const goal = document.getElementById('goal').value;

            const areaLag = document.getElementById('area-lag').value;

            const learningStyle = document.getElementById('learning-style').value;



            const userInput = `Subjects: ${subjects}, Available time: ${availableTime} hours, Goal: ${goal}, Areas of Lag: ${areaLag}, Learning style: ${learningStyle}`;

            addMessage(`Generating study plan for: ${userInput}`, true);



            // API call to Flask backend

            fetch('/generate_study_plan', {

                method: 'POST',

                headers: {

                    'Content-Type': 'application/json'

                },

                body: JSON.stringify({

                    subjects: subjects,

                    hours: availableTime,

                    areaLag: areaLag,

                    goal: goal,

                    learningStyle: learningStyle

                })

            })

            .then(response => response.json())

            .then(data => {

                addMessage(data.study_plan, false);

            })

            .catch(error => {

                addMessage('Error generating study plan. Please try again.', false);

                console.error('Error:', error);

            });

        }



        // Initial message

        addMessage("Welcome! Fill out the form above to generate your personalized study plan.", false);



        function goBack() {

            window.history.back();

        }

    </script>
</body>
</html>