WinLanEm commited on
Commit
8aeeb5e
·
verified ·
1 Parent(s): 1966dac

Create a Settings page using Vue 3 with Composition API and Tailwind CSS that includes the following sections:

Browse files

1. **Language Switching**
- Two options: Russian and English
- Toggle switch between languages
- All page text should change based on the selected language

2. **Services Management**
- Display connected services: GitHub, GitLab, Bitbucket, Jira, Asana
- For each service:
- Name and icon
- Status (Connected/Not connected)
- "Connect" button for disconnected services
- "Disconnect" button for connected services
- Service data should come from backend (use mock data)

3. **User Profile Editing**
- Editable fields:
- Name (text input)
- Email (email input)
- Password (password input)
- Confirm Password (password confirmation)
- Validation:
- Passwords must match in both fields
- Email must be valid
- "Save Changes" button

4. **Logout**
- "Logout" button with confirmation

Technical Requirements:
- Use Vue 3 Composition API with TypeScript
- Tailwind CSS for styling
- All texts must support two languages (Russian/English)
- Component-based approach, split into logical components
- Responsive design
- Use SVG or emoji for service icons
- Profile edit form must have validation
- Use cards with connection status for services

Mock Data for Services:
```javascript
const services = [
{ id: 1, name: 'GitHub', connected: true, icon: '🐙' },
{ id: 2, name: 'GitLab', connected: false, icon: '🦊' },
{ id: 3, name: 'Bitbucket', connected: true, icon: '🚀' },
{ id: 4, name: 'Jira', connected: false, icon: '🎯' },
{ id: 5, name: 'Asana', connected: false, icon: '📋' }
]const user = {
name: 'John Doe',
email: 'john@example.com',
password: ''
}

Files changed (4) hide show
  1. approval.html +2 -2
  2. dashboard.html +2 -2
  3. manual.html +2 -2
  4. settings.html +291 -0
approval.html CHANGED
@@ -39,12 +39,12 @@
39
  </a>
40
  </li>
41
  <li>
42
- <a href="#" class="flex items-center space-x-3 px-3 py-2 hover:bg-gray-700 rounded-lg transition">
43
  <i data-feather="settings" class="w-5 h-5"></i>
44
  <span>Settings</span>
45
  </a>
46
  </li>
47
- </ul>
48
  </div>
49
  </nav>
50
 
 
39
  </a>
40
  </li>
41
  <li>
42
+ <a href="settings.html" class="flex items-center space-x-3 px-3 py-2 hover:bg-gray-700 rounded-lg transition">
43
  <i data-feather="settings" class="w-5 h-5"></i>
44
  <span>Settings</span>
45
  </a>
46
  </li>
47
+ </ul>
48
  </div>
49
  </nav>
50
 
dashboard.html CHANGED
@@ -40,12 +40,12 @@
40
  </a>
41
  </li>
42
  <li>
43
- <a href="#" class="flex items-center space-x-3 px-3 py-2 hover:bg-gray-700 rounded-lg transition">
44
  <i data-feather="settings" class="w-5 h-5"></i>
45
  <span>Settings</span>
46
  </a>
47
  </li>
48
- </ul>
49
  </div>
50
  </nav>
51
 
 
40
  </a>
41
  </li>
42
  <li>
43
+ <a href="settings.html" class="flex items-center space-x-3 px-3 py-2 hover:bg-gray-700 rounded-lg transition">
44
  <i data-feather="settings" class="w-5 h-5"></i>
45
  <span>Settings</span>
46
  </a>
47
  </li>
48
+ </ul>
49
  </div>
50
  </nav>
51
 
manual.html CHANGED
@@ -39,12 +39,12 @@
39
  </a>
40
  </li>
41
  <li>
42
- <a href="#" class="flex items-center space-x-3 px-3 py-2 hover:bg-gray-700 rounded-lg transition">
43
  <i data-feather="settings" class="w-5 h-5"></i>
44
  <span>Settings</span>
45
  </a>
46
  </li>
47
- </ul>
48
  </div>
49
  </nav>
50
 
 
39
  </a>
40
  </li>
41
  <li>
42
+ <a href="settings.html" class="flex items-center space-x-3 px-3 py-2 hover:bg-gray-700 rounded-lg transition">
43
  <i data-feather="settings" class="w-5 h-5"></i>
44
  <span>Settings</span>
45
  </a>
46
  </li>
47
+ </ul>
48
  </div>
49
  </nav>
50
 
settings.html ADDED
@@ -0,0 +1,291 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en" class="dark">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Settings | DevPulse Radar</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
9
+ <script src="https://unpkg.com/feather-icons"></script>
10
+ </head>
11
+ <body class="bg-gray-900 text-gray-100 min-h-screen">
12
+ <div id="app" class="flex h-screen">
13
+ <!-- Sidebar -->
14
+ <nav class="w-64 bg-gray-800 border-r border-gray-700 hidden md:block">
15
+ <div class="p-4 border-b border-gray-700">
16
+ <div class="flex items-center space-x-2">
17
+ <i data-feather="activity" class="text-primary w-6 h-6"></i>
18
+ <span class="text-xl font-bold">DevPulse Radar</span>
19
+ </div>
20
+ </div>
21
+ <div class="p-4">
22
+ <ul class="space-y-2">
23
+ <li>
24
+ <a href="dashboard.html" class="flex items-center space-x-3 px-3 py-2 hover:bg-gray-700 rounded-lg transition">
25
+ <i data-feather="home" class="w-5 h-5"></i>
26
+ <span>{{ translations[currentLanguage].dashboard }}</span>
27
+ </a>
28
+ </li>
29
+ <li>
30
+ <a href="approval.html" class="flex items-center space-x-3 px-3 py-2 hover:bg-gray-700 rounded-lg transition">
31
+ <i data-feather="check-circle" class="w-5 h-5"></i>
32
+ <span>{{ translations[currentLanguage].taskApproval }}</span>
33
+ </a>
34
+ </li>
35
+ <li>
36
+ <a href="manual.html" class="flex items-center space-x-3 px-3 py-2 hover:bg-gray-700 rounded-lg transition">
37
+ <i data-feather="plus-circle" class="w-5 h-5"></i>
38
+ <span>{{ translations[currentLanguage].manualAdd }}</span>
39
+ </a>
40
+ </li>
41
+ <li>
42
+ <a href="settings.html" class="flex items-center space-x-3 px-3 py-2 bg-gray-700 rounded-lg text-primary">
43
+ <i data-feather="settings" class="w-5 h-5"></i>
44
+ <span>{{ translations[currentLanguage].settings }}</span>
45
+ </a>
46
+ </li>
47
+ </ul>
48
+ </div>
49
+ </nav>
50
+
51
+ <!-- Main Content -->
52
+ <div class="flex-1 overflow-auto">
53
+ <!-- Top Navigation -->
54
+ <header class="sticky top-0 z-10 bg-gray-800 border-b border-gray-700 p-4">
55
+ <div class="flex justify-between items-center">
56
+ <div class="flex items-center space-x-4">
57
+ <button class="md:hidden">
58
+ <i data-feather="menu" class="w-5 h-5"></i>
59
+ </button>
60
+ <h1 class="text-xl font-bold">{{ translations[currentLanguage].settings }}</h1>
61
+ </div>
62
+ <div class="flex items-center space-x-4">
63
+ <button class="flex items-center space-x-2">
64
+ <span>{{ translations[currentLanguage].language }}</span>
65
+ <label class="relative inline-flex items-center cursor-pointer">
66
+ <input type="checkbox" v-model="currentLanguage" true-value="ru" false-value="en" class="sr-only peer">
67
+ <div class="w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-primary"></div>
68
+ <span class="ml-3 text-sm">{{ currentLanguage === 'en' ? 'EN' : 'RU' }}</span>
69
+ </label>
70
+ </button>
71
+ <div class="flex items-center space-x-2">
72
+ <div class="w-8 h-8 rounded-full bg-primary flex items-center justify-center">
73
+ <span class="text-sm font-medium">{{ userInitials }}</span>
74
+ </div>
75
+ </div>
76
+ </div>
77
+ </div>
78
+ </header>
79
+
80
+ <!-- Settings Content -->
81
+ <main class="p-6">
82
+ <!-- Profile Section -->
83
+ <div class="bg-gray-800 rounded-xl p-6 mb-6 border border-gray-700">
84
+ <h2 class="text-xl font-bold mb-4">{{ translations[currentLanguage].profile }}</h2>
85
+
86
+ <form @submit.prevent="saveProfile" class="space-y-4">
87
+ <div>
88
+ <label class="block text-sm font-medium mb-1">{{ translations[currentLanguage].name }}</label>
89
+ <input v-model="user.name" type="text" class="w-full bg-gray-700 border border-gray-600 rounded-lg px-4 py-2 focus:ring-2 focus:ring-primary focus:border-transparent">
90
+ </div>
91
+ <div>
92
+ <label class="block text-sm font-medium mb-1">{{ translations[currentLanguage].email }}</label>
93
+ <input v-model="user.email" type="email" class="w-full bg-gray-700 border border-gray-600 rounded-lg px-4 py-2 focus:ring-2 focus:ring-primary focus:border-transparent">
94
+ <p v-if="errors.email" class="text-red-400 text-xs mt-1">{{ errors.email }}</p>
95
+ </div>
96
+ <div>
97
+ <label class="block text-sm font-medium mb-1">{{ translations[currentLanguage].password }}</label>
98
+ <input v-model="user.password" type="password" class="w-full bg-gray-700 border border-gray-600 rounded-lg px-4 py-2 focus:ring-2 focus:ring-primary focus:border-transparent">
99
+ </div>
100
+ <div>
101
+ <label class="block text-sm font-medium mb-1">{{ translations[currentLanguage].confirmPassword }}</label>
102
+ <input v-model="user.confirmPassword" type="password" class="w-full bg-gray-700 border border-gray-600 rounded-lg px-4 py-2 focus:ring-2 focus:ring-primary focus:border-transparent">
103
+ <p v-if="errors.password" class="text-red-400 text-xs mt-1">{{ errors.password }}</p>
104
+ </div>
105
+ <div class="flex justify-end">
106
+ <button type="submit" class="bg-primary hover:bg-primary/90 px-6 py-2 rounded-lg font-medium transition">
107
+ {{ translations[currentLanguage].saveChanges }}
108
+ </button>
109
+ </div>
110
+ </form>
111
+ </div>
112
+
113
+ <!-- Services Section -->
114
+ <div class="bg-gray-800 rounded-xl p-6 mb-6 border border-gray-700">
115
+ <h2 class="text-xl font-bold mb-4">{{ translations[currentLanguage].services }}</h2>
116
+
117
+ <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
118
+ <div v-for="service in services" :key="service.id" class="bg-gray-700 rounded-lg p-4 border border-gray-600">
119
+ <div class="flex items-center justify-between">
120
+ <div class="flex items-center space-x-3">
121
+ <span class="text-2xl">{{ service.icon }}</span>
122
+ <div>
123
+ <h3 class="font-medium">{{ service.name }}</h3>
124
+ <p class="text-xs" :class="service.connected ? 'text-green-400' : 'text-gray-400'">
125
+ {{ service.connected ? translations[currentLanguage].connected : translations[currentLanguage].notConnected }}
126
+ </p>
127
+ </div>
128
+ </div>
129
+ <button
130
+ @click="toggleService(service.id)"
131
+ class="px-3 py-1 rounded text-sm"
132
+ :class="service.connected ? 'bg-red-600 hover:bg-red-700' : 'bg-primary hover:bg-primary/90'"
133
+ >
134
+ {{ service.connected ? translations[currentLanguage].disconnect : translations[currentLanguage].connect }}
135
+ </button>
136
+ </div>
137
+ </div>
138
+ </div>
139
+ </div>
140
+
141
+ <!-- Logout Section -->
142
+ <div class="bg-gray-800 rounded-xl p-6 border border-gray-700">
143
+ <h2 class="text-xl font-bold mb-4">{{ translations[currentLanguage].account }}</h2>
144
+ <button
145
+ @click="confirmLogout"
146
+ class="bg-red-600 hover:bg-red-700 px-6 py-2 rounded-lg font-medium transition"
147
+ >
148
+ {{ translations[currentLanguage].logout }}
149
+ </button>
150
+ </div>
151
+ </main>
152
+ </div>
153
+ </div>
154
+
155
+ <script>
156
+ const { createApp, ref, computed } = Vue;
157
+
158
+ createApp({
159
+ setup() {
160
+ // Language support
161
+ const currentLanguage = ref('en');
162
+ const translations = {
163
+ en: {
164
+ dashboard: 'Dashboard',
165
+ taskApproval: 'Task Approval',
166
+ manualAdd: 'Manual Add',
167
+ settings: 'Settings',
168
+ language: 'Language',
169
+ profile: 'Profile',
170
+ name: 'Name',
171
+ email: 'Email',
172
+ password: 'Password',
173
+ confirmPassword: 'Confirm Password',
174
+ saveChanges: 'Save Changes',
175
+ services: 'Connected Services',
176
+ connected: 'Connected',
177
+ notConnected: 'Not connected',
178
+ connect: 'Connect',
179
+ disconnect: 'Disconnect',
180
+ account: 'Account',
181
+ logout: 'Logout',
182
+ logoutConfirm: 'Are you sure you want to logout?'
183
+ },
184
+ ru: {
185
+ dashboard: 'Панель',
186
+ taskApproval: 'Подтверждение задач',
187
+ manualAdd: 'Ручное добавление',
188
+ settings: 'Настройки',
189
+ language: 'Язык',
190
+ profile: 'Профиль',
191
+ name: 'Имя',
192
+ email: 'Электронная почта',
193
+ password: 'Пароль',
194
+ confirmPassword: 'Подтвердите пароль',
195
+ saveChanges: 'Сохранить изменения',
196
+ services: 'Подключенные сервисы',
197
+ connected: 'Подключено',
198
+ notConnected: 'Не подключено',
199
+ connect: 'Подключить',
200
+ disconnect: 'Отключить',
201
+ account: 'Аккаунт',
202
+ logout: 'Выйти',
203
+ logoutConfirm: 'Вы уверены, что хотите выйти?'
204
+ }
205
+ };
206
+
207
+ // User data
208
+ const user = ref({
209
+ name: 'John Doe',
210
+ email: 'john@example.com',
211
+ password: '',
212
+ confirmPassword: ''
213
+ });
214
+
215
+ // Services data
216
+ const services = ref([
217
+ { id: 1, name: 'GitHub', connected: true, icon: '🐙' },
218
+ { id: 2, name: 'GitLab', connected: false, icon: '🦊' },
219
+ { id: 3, name: 'Bitbucket', connected: true, icon: '🚀' },
220
+ { id: 4, name: 'Jira', connected: false, icon: '🎯' },
221
+ { id: 5, name: 'Asana', connected: false, icon: '📋' }
222
+ ]);
223
+
224
+ // Form errors
225
+ const errors = ref({
226
+ email: '',
227
+ password: ''
228
+ });
229
+
230
+ // Computed properties
231
+ const userInitials = computed(() => {
232
+ return user.value.name.split(' ').map(n => n[0]).join('');
233
+ });
234
+
235
+ // Methods
236
+ const toggleService = (id) => {
237
+ const service = services.value.find(s => s.id === id);
238
+ if (service) {
239
+ service.connected = !service.connected;
240
+ }
241
+ };
242
+
243
+ const validateEmail = (email) => {
244
+ const re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
245
+ return re.test(email);
246
+ };
247
+
248
+ const saveProfile = () => {
249
+ errors.value = { email: '', password: '' };
250
+
251
+ // Validate email
252
+ if (!validateEmail(user.value.email)) {
253
+ errors.value.email = translations.value[currentLanguage.value].invalidEmail || 'Invalid email';
254
+ return;
255
+ }
256
+
257
+ // Validate password match if password is provided
258
+ if (user.value.password && user.value.password !== user.value.confirmPassword) {
259
+ errors.value.password = translations.value[currentLanguage.value].passwordsDontMatch || 'Passwords do not match';
260
+ return;
261
+ }
262
+
263
+ // Save logic would go here
264
+ alert(translations.value[currentLanguage.value].profileSaved || 'Profile saved');
265
+ };
266
+
267
+ const confirmLogout = () => {
268
+ if (confirm(translations.value[currentLanguage.value].logoutConfirm)) {
269
+ // Logout logic would go here
270
+ window.location.href = 'login.html';
271
+ }
272
+ };
273
+
274
+ return {
275
+ currentLanguage,
276
+ translations,
277
+ user,
278
+ services,
279
+ errors,
280
+ userInitials,
281
+ toggleService,
282
+ saveProfile,
283
+ confirmLogout
284
+ };
285
+ }
286
+ }).mount('#app');
287
+
288
+ feather.replace();
289
+ </script>
290
+ </body>
291
+ </html>