muboboev commited on
Commit
9e2b812
·
verified ·
1 Parent(s): 8df57b3

Подэтап 2.2 — Выбор ролевого интерфейса

Browse files

Реализовать UI экран “Select Role”.

Подключить список ролей:

Immigrant

Child / Student

Government / Bank / Teacher

При выборе роли → сохранять тип в UserProfile.

Создать RoleRouter — динамическое перенаправление по интерфейсу.

Files changed (4) hide show
  1. auth.html +15 -12
  2. data-architecture.html +8 -7
  3. index.html +1 -0
  4. select-role.html +154 -0
auth.html CHANGED
@@ -61,14 +61,15 @@
61
  </div>
62
  <a href="#" class="text-sm text-indigo-400 hover:underline">Forgot password?</a>
63
  </div>
64
-
65
  <button type="submit" class="w-full py-3 bg-indigo-600 hover:bg-indigo-700 rounded-lg font-medium transition-colors">
66
  Sign In
67
  </button>
68
  </form>
69
 
 
 
70
  <div class="relative my-6">
71
- <div class="absolute inset-0 flex items-center">
72
  <div class="w-full border-t border-slate-700"></div>
73
  </div>
74
  <div class="relative flex justify-center text-sm">
@@ -87,11 +88,13 @@
87
  <i data-feather="smartphone" class="text-blue-400"></i>
88
  </button>
89
  </div>
90
-
91
- <p class="mt-6 text-center text-sm text-slate-400">
92
- Don't have an account? <a href="#" class="text-indigo-400 hover:underline">Register</a>
93
- </p>
94
- </div>
 
 
95
  </div>
96
 
97
  <script>
@@ -114,12 +117,12 @@
114
  e.preventDefault();
115
  const email = document.getElementById('email').value;
116
  const password = document.getElementById('password').value;
117
-
118
  auth.signInWithEmailAndPassword(email, password)
119
  .then((userCredential) => {
120
  // Handle successful login
121
- window.location.href = 'index.html';
122
- })
 
123
  .catch((error) => {
124
  console.error(error);
125
  alert('Authentication failed: ' + error.message);
@@ -131,8 +134,8 @@
131
  const provider = new firebase.auth.GoogleAuthProvider();
132
  auth.signInWithPopup(provider)
133
  .then((result) => {
134
- window.location.href = 'index.html';
135
- }).catch((error) => {
136
  console.error(error);
137
  alert('Google sign-in failed: ' + error.message);
138
  });
 
61
  </div>
62
  <a href="#" class="text-sm text-indigo-400 hover:underline">Forgot password?</a>
63
  </div>
 
64
  <button type="submit" class="w-full py-3 bg-indigo-600 hover:bg-indigo-700 rounded-lg font-medium transition-colors">
65
  Sign In
66
  </button>
67
  </form>
68
 
69
+ <input type="hidden" id="redirectTo" name="redirectTo" value="select-role.html">
70
+
71
  <div class="relative my-6">
72
+ <div class="absolute inset-0 flex items-center">
73
  <div class="w-full border-t border-slate-700"></div>
74
  </div>
75
  <div class="relative flex justify-center text-sm">
 
88
  <i data-feather="smartphone" class="text-blue-400"></i>
89
  </button>
90
  </div>
91
+ <p class="mt-6 text-center text-sm text-slate-400">
92
+ Don't have an account? <a href="#" class="text-indigo-400 hover:underline">Register</a>
93
+ </p>
94
+ <p class="mt-2 text-center text-xs text-slate-500">
95
+ By signing in, you agree to our Terms of Service and Privacy Policy
96
+ </p>
97
+ </div>
98
  </div>
99
 
100
  <script>
 
117
  e.preventDefault();
118
  const email = document.getElementById('email').value;
119
  const password = document.getElementById('password').value;
 
120
  auth.signInWithEmailAndPassword(email, password)
121
  .then((userCredential) => {
122
  // Handle successful login
123
+ const redirectTo = document.getElementById('redirectTo').value;
124
+ window.location.href = redirectTo;
125
+ })
126
  .catch((error) => {
127
  console.error(error);
128
  alert('Authentication failed: ' + error.message);
 
134
  const provider = new firebase.auth.GoogleAuthProvider();
135
  auth.signInWithPopup(provider)
136
  .then((result) => {
137
+ window.location.href = 'select-role.html';
138
+ }).catch((error) => {
139
  console.error(error);
140
  alert('Google sign-in failed: ' + error.message);
141
  });
data-architecture.html CHANGED
@@ -41,13 +41,14 @@
41
  <i data-feather="cpu" class="text-indigo-500"></i>
42
  <span class="text-xl font-bold gradient-text">QuantumCode</span>
43
  </div>
44
- <div class="hidden md:flex space-x-8">
45
- <a href="index.html" class="hover:text-indigo-400 transition-colors">Home</a>
46
- <a href="index.html#features" class="hover:text-indigo-400 transition-colors">Features</a>
47
- <a href="index.html#roadmap" class="hover:text-indigo-400 transition-colors">Roadmap</a>
48
- <a href="data-architecture.html" class="text-indigo-400">Data Architecture</a>
49
- <a href="auth.html" class="hover:text-indigo-400 transition-colors">Login</a>
50
- </div>
 
51
  </nav>
52
 
53
  <main class="container mx-auto px-4 py-16">
 
41
  <i data-feather="cpu" class="text-indigo-500"></i>
42
  <span class="text-xl font-bold gradient-text">QuantumCode</span>
43
  </div>
44
+ <div class="hidden md:flex space-x-8">
45
+ <a href="index.html" class="hover:text-indigo-400 transition-colors">Home</a>
46
+ <a href="index.html#features" class="hover:text-indigo-400 transition-colors">Features</a>
47
+ <a href="index.html#roadmap" class="hover:text-indigo-400 transition-colors">Roadmap</a>
48
+ <a href="data-architecture.html" class="text-indigo-400">Data Architecture</a>
49
+ <a href="auth.html" class="hover:text-indigo-400 transition-colors">Login</a>
50
+ <a href="select-role.html" class="hover:text-indigo-400 transition-colors">Roles</a>
51
+ </div>
52
  </nav>
53
 
54
  <main class="container mx-auto px-4 py-16">
index.html CHANGED
@@ -45,6 +45,7 @@
45
  <a href="#" class="hover:text-indigo-400 transition-colors">Roadmap</a>
46
  <a href="data-architecture.html" class="hover:text-indigo-400 transition-colors">Data Architecture</a>
47
  <a href="auth.html" class="hover:text-indigo-400 transition-colors">Login</a>
 
48
  <a href="#" class="hover:text-indigo-400 transition-colors">Docs</a>
49
  </div>
50
  <button class="md:hidden">
 
45
  <a href="#" class="hover:text-indigo-400 transition-colors">Roadmap</a>
46
  <a href="data-architecture.html" class="hover:text-indigo-400 transition-colors">Data Architecture</a>
47
  <a href="auth.html" class="hover:text-indigo-400 transition-colors">Login</a>
48
+ <a href="select-role.html" class="hover:text-indigo-400 transition-colors">Roles</a>
49
  <a href="#" class="hover:text-indigo-400 transition-colors">Docs</a>
50
  </div>
51
  <button class="md:hidden">
select-role.html ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Select Role | QuantumCode</title>
7
+ <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
+ <script src="https://unpkg.com/feather-icons"></script>
10
+ <script src="https://www.gstatic.com/firebasejs/8.10.0/firebase-app.js"></script>
11
+ <script src="https://www.gstatic.com/firebasejs/8.10.0/firebase-auth.js"></script>
12
+ <script src="https://www.gstatic.com/firebasejs/8.10.0/firebase-database.js"></script>
13
+ <style>
14
+ @import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap');
15
+
16
+ body {
17
+ font-family: 'Space Grotesk', sans-serif;
18
+ background-color: #0f172a;
19
+ color: #e2e8f0;
20
+ }
21
+
22
+ .gradient-text {
23
+ background: linear-gradient(90deg, #7c3aed 0%, #2563eb 100%);
24
+ -webkit-background-clip: text;
25
+ background-clip: text;
26
+ color: transparent;
27
+ }
28
+
29
+ .glass-card {
30
+ background: rgba(15, 23, 42, 0.7);
31
+ backdrop-filter: blur(10px);
32
+ border: 1px solid rgba(255, 255, 255, 0.1);
33
+ border-radius: 1rem;
34
+ }
35
+
36
+ .role-card {
37
+ transition: all 0.3s ease;
38
+ border: 2px solid transparent;
39
+ }
40
+
41
+ .role-card:hover {
42
+ transform: translateY(-5px);
43
+ border-color: #7c3aed;
44
+ }
45
+
46
+ .role-card.selected {
47
+ border-color: #7c3aed;
48
+ background: rgba(124, 58, 237, 0.1);
49
+ }
50
+ </style>
51
+ </head>
52
+ <body class="min-h-screen flex items-center justify-center">
53
+ <div class="container mx-auto px-4 py-12">
54
+ <div class="max-w-2xl mx-auto glass-card p-8">
55
+ <div class="text-center mb-8">
56
+ <div class="flex justify-center mb-4">
57
+ <i data-feather="user" class="text-indigo-500 w-12 h-12"></i>
58
+ </div>
59
+ <h1 class="text-3xl font-bold gradient-text mb-2">Select Your Role</h1>
60
+ <p class="text-slate-300">Choose how you'll use QuantumCode</p>
61
+ </div>
62
+
63
+ <div class="grid md:grid-cols-3 gap-6 mb-8">
64
+ <div class="role-card glass-card p-6 text-center cursor-pointer" data-role="immigrant">
65
+ <i data-feather="globe" class="w-10 h-10 mx-auto text-indigo-400 mb-4"></i>
66
+ <h3 class="text-xl font-bold mb-2">Immigrant</h3>
67
+ <p class="text-slate-300 text-sm">Access language learning and integration resources</p>
68
+ </div>
69
+
70
+ <div class="role-card glass-card p-6 text-center cursor-pointer" data-role="student">
71
+ <i data-feather="book" class="w-10 h-10 mx-auto text-indigo-400 mb-4"></i>
72
+ <h3 class="text-xl font-bold mb-2">Student</h3>
73
+ <p class="text-slate-300 text-sm">Learn programming and technology skills</p>
74
+ </div>
75
+
76
+ <div class="role-card glass-card p-6 text-center cursor-pointer" data-role="teacher">
77
+ <i data-feather="users" class="w-10 h-10 mx-auto text-indigo-400 mb-4"></i>
78
+ <h3 class="text-xl font-bold mb-2">Teacher/Admin</h3>
79
+ <p class="text-slate-300 text-sm">Manage courses and student progress</p>
80
+ </div>
81
+ </div>
82
+
83
+ <button id="confirmRole" class="w-full py-3 bg-indigo-600 hover:bg-indigo-700 rounded-lg font-medium transition-colors opacity-50 cursor-not-allowed" disabled>
84
+ Confirm Role
85
+ </button>
86
+ </div>
87
+ </div>
88
+
89
+ <script>
90
+ // Firebase configuration
91
+ const firebaseConfig = {
92
+ apiKey: "YOUR_API_KEY",
93
+ authDomain: "YOUR_AUTH_DOMAIN",
94
+ projectId: "YOUR_PROJECT_ID",
95
+ storageBucket: "YOUR_STORAGE_BUCKET",
96
+ messagingSenderId: "YOUR_MESSAGING_SENDER_ID",
97
+ appId: "YOUR_APP_ID"
98
+ };
99
+
100
+ // Initialize Firebase
101
+ firebase.initializeApp(firebaseConfig);
102
+ const auth = firebase.auth();
103
+ const database = firebase.database();
104
+
105
+ let selectedRole = null;
106
+
107
+ // Role selection
108
+ document.querySelectorAll('.role-card').forEach(card => {
109
+ card.addEventListener('click', () => {
110
+ document.querySelectorAll('.role-card').forEach(c => c.classList.remove('selected'));
111
+ card.classList.add('selected');
112
+ selectedRole = card.getAttribute('data-role');
113
+ document.getElementById('confirmRole').disabled = false;
114
+ document.getElementById('confirmRole').classList.remove('opacity-50', 'cursor-not-allowed');
115
+ });
116
+ });
117
+
118
+ // Save role and redirect
119
+ document.getElementById('confirmRole').addEventListener('click', () => {
120
+ if (!selectedRole) return;
121
+
122
+ const user = auth.currentUser;
123
+ if (user) {
124
+ database.ref('users/' + user.uid).update({
125
+ role: selectedRole
126
+ }).then(() => {
127
+ // Redirect based on role
128
+ switch(selectedRole) {
129
+ case 'immigrant':
130
+ window.location.href = 'immigrant-dashboard.html';
131
+ break;
132
+ case 'student':
133
+ window.location.href = 'student-dashboard.html';
134
+ break;
135
+ case 'teacher':
136
+ window.location.href = 'teacher-dashboard.html';
137
+ break;
138
+ default:
139
+ window.location.href = 'index.html';
140
+ }
141
+ }).catch(error => {
142
+ console.error('Error saving role:', error);
143
+ alert('Error saving your role. Please try again.');
144
+ });
145
+ } else {
146
+ alert('You must be logged in to select a role.');
147
+ window.location.href = 'auth.html';
148
+ }
149
+ });
150
+
151
+ feather.replace();
152
+ </script>
153
+ </body>
154
+ </html>