Spaces:
Running
Running
File size: 15,277 Bytes
8aeeb5e | 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 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | <!DOCTYPE html>
<html lang="en" class="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Settings | DevPulse Radar</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<script src="https://unpkg.com/feather-icons"></script>
</head>
<body class="bg-gray-900 text-gray-100 min-h-screen">
<div id="app" class="flex h-screen">
<!-- Sidebar -->
<nav class="w-64 bg-gray-800 border-r border-gray-700 hidden md:block">
<div class="p-4 border-b border-gray-700">
<div class="flex items-center space-x-2">
<i data-feather="activity" class="text-primary w-6 h-6"></i>
<span class="text-xl font-bold">DevPulse Radar</span>
</div>
</div>
<div class="p-4">
<ul class="space-y-2">
<li>
<a href="dashboard.html" class="flex items-center space-x-3 px-3 py-2 hover:bg-gray-700 rounded-lg transition">
<i data-feather="home" class="w-5 h-5"></i>
<span>{{ translations[currentLanguage].dashboard }}</span>
</a>
</li>
<li>
<a href="approval.html" class="flex items-center space-x-3 px-3 py-2 hover:bg-gray-700 rounded-lg transition">
<i data-feather="check-circle" class="w-5 h-5"></i>
<span>{{ translations[currentLanguage].taskApproval }}</span>
</a>
</li>
<li>
<a href="manual.html" class="flex items-center space-x-3 px-3 py-2 hover:bg-gray-700 rounded-lg transition">
<i data-feather="plus-circle" class="w-5 h-5"></i>
<span>{{ translations[currentLanguage].manualAdd }}</span>
</a>
</li>
<li>
<a href="settings.html" class="flex items-center space-x-3 px-3 py-2 bg-gray-700 rounded-lg text-primary">
<i data-feather="settings" class="w-5 h-5"></i>
<span>{{ translations[currentLanguage].settings }}</span>
</a>
</li>
</ul>
</div>
</nav>
<!-- Main Content -->
<div class="flex-1 overflow-auto">
<!-- Top Navigation -->
<header class="sticky top-0 z-10 bg-gray-800 border-b border-gray-700 p-4">
<div class="flex justify-between items-center">
<div class="flex items-center space-x-4">
<button class="md:hidden">
<i data-feather="menu" class="w-5 h-5"></i>
</button>
<h1 class="text-xl font-bold">{{ translations[currentLanguage].settings }}</h1>
</div>
<div class="flex items-center space-x-4">
<button class="flex items-center space-x-2">
<span>{{ translations[currentLanguage].language }}</span>
<label class="relative inline-flex items-center cursor-pointer">
<input type="checkbox" v-model="currentLanguage" true-value="ru" false-value="en" class="sr-only peer">
<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>
<span class="ml-3 text-sm">{{ currentLanguage === 'en' ? 'EN' : 'RU' }}</span>
</label>
</button>
<div class="flex items-center space-x-2">
<div class="w-8 h-8 rounded-full bg-primary flex items-center justify-center">
<span class="text-sm font-medium">{{ userInitials }}</span>
</div>
</div>
</div>
</div>
</header>
<!-- Settings Content -->
<main class="p-6">
<!-- Profile Section -->
<div class="bg-gray-800 rounded-xl p-6 mb-6 border border-gray-700">
<h2 class="text-xl font-bold mb-4">{{ translations[currentLanguage].profile }}</h2>
<form @submit.prevent="saveProfile" class="space-y-4">
<div>
<label class="block text-sm font-medium mb-1">{{ translations[currentLanguage].name }}</label>
<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">
</div>
<div>
<label class="block text-sm font-medium mb-1">{{ translations[currentLanguage].email }}</label>
<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">
<p v-if="errors.email" class="text-red-400 text-xs mt-1">{{ errors.email }}</p>
</div>
<div>
<label class="block text-sm font-medium mb-1">{{ translations[currentLanguage].password }}</label>
<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">
</div>
<div>
<label class="block text-sm font-medium mb-1">{{ translations[currentLanguage].confirmPassword }}</label>
<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">
<p v-if="errors.password" class="text-red-400 text-xs mt-1">{{ errors.password }}</p>
</div>
<div class="flex justify-end">
<button type="submit" class="bg-primary hover:bg-primary/90 px-6 py-2 rounded-lg font-medium transition">
{{ translations[currentLanguage].saveChanges }}
</button>
</div>
</form>
</div>
<!-- Services Section -->
<div class="bg-gray-800 rounded-xl p-6 mb-6 border border-gray-700">
<h2 class="text-xl font-bold mb-4">{{ translations[currentLanguage].services }}</h2>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
<div v-for="service in services" :key="service.id" class="bg-gray-700 rounded-lg p-4 border border-gray-600">
<div class="flex items-center justify-between">
<div class="flex items-center space-x-3">
<span class="text-2xl">{{ service.icon }}</span>
<div>
<h3 class="font-medium">{{ service.name }}</h3>
<p class="text-xs" :class="service.connected ? 'text-green-400' : 'text-gray-400'">
{{ service.connected ? translations[currentLanguage].connected : translations[currentLanguage].notConnected }}
</p>
</div>
</div>
<button
@click="toggleService(service.id)"
class="px-3 py-1 rounded text-sm"
:class="service.connected ? 'bg-red-600 hover:bg-red-700' : 'bg-primary hover:bg-primary/90'"
>
{{ service.connected ? translations[currentLanguage].disconnect : translations[currentLanguage].connect }}
</button>
</div>
</div>
</div>
</div>
<!-- Logout Section -->
<div class="bg-gray-800 rounded-xl p-6 border border-gray-700">
<h2 class="text-xl font-bold mb-4">{{ translations[currentLanguage].account }}</h2>
<button
@click="confirmLogout"
class="bg-red-600 hover:bg-red-700 px-6 py-2 rounded-lg font-medium transition"
>
{{ translations[currentLanguage].logout }}
</button>
</div>
</main>
</div>
</div>
<script>
const { createApp, ref, computed } = Vue;
createApp({
setup() {
// Language support
const currentLanguage = ref('en');
const translations = {
en: {
dashboard: 'Dashboard',
taskApproval: 'Task Approval',
manualAdd: 'Manual Add',
settings: 'Settings',
language: 'Language',
profile: 'Profile',
name: 'Name',
email: 'Email',
password: 'Password',
confirmPassword: 'Confirm Password',
saveChanges: 'Save Changes',
services: 'Connected Services',
connected: 'Connected',
notConnected: 'Not connected',
connect: 'Connect',
disconnect: 'Disconnect',
account: 'Account',
logout: 'Logout',
logoutConfirm: 'Are you sure you want to logout?'
},
ru: {
dashboard: 'Панель',
taskApproval: 'Подтверждение задач',
manualAdd: 'Ручное добавление',
settings: 'Настройки',
language: 'Язык',
profile: 'Профиль',
name: 'Имя',
email: 'Электронная почта',
password: 'Пароль',
confirmPassword: 'Подтвердите пароль',
saveChanges: 'Сохранить изменения',
services: 'Подключенные сервисы',
connected: 'Подключено',
notConnected: 'Не подключено',
connect: 'Подключить',
disconnect: 'Отключить',
account: 'Аккаунт',
logout: 'Выйти',
logoutConfirm: 'Вы уверены, что хотите выйти?'
}
};
// User data
const user = ref({
name: 'John Doe',
email: 'john@example.com',
password: '',
confirmPassword: ''
});
// Services data
const services = ref([
{ 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: '📋' }
]);
// Form errors
const errors = ref({
email: '',
password: ''
});
// Computed properties
const userInitials = computed(() => {
return user.value.name.split(' ').map(n => n[0]).join('');
});
// Methods
const toggleService = (id) => {
const service = services.value.find(s => s.id === id);
if (service) {
service.connected = !service.connected;
}
};
const validateEmail = (email) => {
const re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
return re.test(email);
};
const saveProfile = () => {
errors.value = { email: '', password: '' };
// Validate email
if (!validateEmail(user.value.email)) {
errors.value.email = translations.value[currentLanguage.value].invalidEmail || 'Invalid email';
return;
}
// Validate password match if password is provided
if (user.value.password && user.value.password !== user.value.confirmPassword) {
errors.value.password = translations.value[currentLanguage.value].passwordsDontMatch || 'Passwords do not match';
return;
}
// Save logic would go here
alert(translations.value[currentLanguage.value].profileSaved || 'Profile saved');
};
const confirmLogout = () => {
if (confirm(translations.value[currentLanguage.value].logoutConfirm)) {
// Logout logic would go here
window.location.href = 'login.html';
}
};
return {
currentLanguage,
translations,
user,
services,
errors,
userInitials,
toggleService,
saveProfile,
confirmLogout
};
}
}).mount('#app');
feather.replace();
</script>
</body>
</html> |