| class="hamburger-btn" |
| 9 | @click="toggleSidebar" |
| 10 | aria-label="Toggle menu" |
| 11 | > |
| 12 | <span class="hamburger-icon">☰</span> |
| 13 | </button> |
| 14 | <div class="logo-wrapper"> |
| 15 | <LogoIcon class="logo-icon" /> |
| 16 | </div> |
| 17 | <span class="divider">/</span> |
| 18 | <span class="brand-name">frp</span> |
| 19 | <span class="badge server-badge">Server</span> |
| 20 | </div> |
| 21 |
| 22 | <div class="header-controls"> |
| 23 | <a |
| 24 | class="github-link" |
| 25 | href="https://github.com/fatedier/frp" |
| 26 | target="_blank" |
| 27 | aria-label="GitHub" |
| 28 | > |
| 29 | <GitHubIcon class="github-icon" /> |
| 30 | </a> |
| 31 | <el-switch |
| 32 | v-model="isDark" |
| 33 | inline-prompt |
| 34 | :active-icon="Moon" |
| 35 | :inactive-icon="Sunny" |
| 36 | class="theme-switch" |
| 37 | /> |
| 38 | </div> |
| 39 | </div> |
| 40 | </header> |
| 41 |
| 42 | <div class="layout"> |
| 43 | <!-- Mobile overlay --> |
| 44 | <div |
| 45 | v-if="isMobile && sidebarOpen" |
| 46 | class="sidebar-overlay" |
| 47 | @click="closeSidebar" |
| 48 | /> |
| 49 |
| 50 | <aside |
| 51 | class="sidebar" |
| 52 | :class="{ 'mobile-open': isMobile && sidebarOpen }" |
| 53 | > |
| 54 | <nav class="sidebar-nav"> |
| 55 | <router-link |
| 56 | to="/" |
| 57 | class="sidebar-link" |
| 58 | :class="{ active: route.path === '/' }" |
| 59 | @click="closeSidebar" |
| 60 | > |
| 61 | Overview |
| 62 | </router-link> |
| 63 | <router-link |
| 64 | to="/clients" |
| 65 | class="sidebar-link" |
| 66 | :class="{ active: route.path.startsWith('/clients') }" |
| 67 | @click="closeSidebar" |
| 68 | > |
| 69 | Clients |
| 70 | </router-link> |
| 71 | <router-link |
| 72 | to="/proxies" |
| 73 | class="sidebar-link" |
| 74 | :class="{ |
| 75 | active: |
| 76 | route.path.startsWith('/proxies') || |
| 77 | route.path.startsWith('/proxy'), |
| 78 | }" |
| 79 | @click="closeSidebar" |
| 80 | > |
| 81 | Proxies |
| 82 | </router-link> |
| 83 | </nav> |
| 84 | </aside> |
| 85 |
| 86 | <main id="content"> |
| 87 | <router-view></router-view> |
| 88 | </main> |
| 89 | </div> |
| 90 | </div> |
| 91 | </template> |
| 92 |
| 93 | <script setup lang="ts"> |
| 94 | import { ref, watch } from 'vue' |
| 95 | import { useRoute } from 'vue-router' |
| 96 | import { useDark } from '@vueuse/core' |
| 97 | import { Moon, Sunny } from '@element-plus/icons-vue' |
| 98 | import GitHubIcon from './assets/icons/github.svg?component' |
| 99 | import LogoIcon from './assets/icons/logo.svg?component' |
| 100 | import { useResponsive } from './composables/useResponsive' |
| 101 |
| 102 | const route = useRoute() |
| 103 | const isDark = useDark() |
| 104 | const { isMobile } = useResponsive() |
| 105 |
| 106 | const sidebarOpen = ref(false) |
| 107 |
| 108 | const toggleSidebar = () => { |
| 109 | sidebarOpen.value = !sidebarOpen.value |
| 110 | } |
| 111 |
| 112 | const closeSidebar = () => { |
| 113 | sidebarOpen.value = false |
| 114 | } |
| 115 |
| 116 | // Auto-close sidebar on route change |
| 117 | watch( |
| 118 | () => route.path, |
| 119 | () => { |
| 120 | if (isMobile.value) { |
| 121 | closeSidebar() |
| 122 | } |
| 123 | }, |
| 124 | ) |
| 125 | </script> |
| 126 |
| 127 | <style> |
| 128 | :root { |
| 129 | --header-height: 50px; |
| 130 | --sidebar-width: 200px; |
| 131 | --header-bg: #ffffff; |
| 132 | --header-border: #e4e7ed; |
| 133 | --sidebar-bg: #ffffff; |
| 134 | --text-primary: #303133; |
| 135 | --text-secondary: #606266; |
| 136 | --text-muted: #909399; |
| 137 | --hover-bg: #efefef; |
| 138 | --content-bg: #f9f9f9; |
| 139 | } |
| 140 |
| 141 | html.dark { |
| 142 | --header-bg: #1e1e2e; |
| 143 | --header-border: #3a3d5c; |
| 144 | --sidebar-bg: #1e1e2e; |
| 145 | --text-primary: #e5e7eb; |
| 146 | --text-secondary: #b0b0b0; |
| 147 | --text-muted: #888888; |
| 148 | --hover-bg: #2a2a3e; |
| 149 | --content-bg: #181825; |
| 150 | } |
| 151 |
| 152 | body { |
| 153 | margin: 0; |
| 154 | font-family: |
| 155 | ui-sans-serif, -apple-system, system-ui, Segoe UI, Helvetica, Arial, |
| 156 | sans-serif; |
| 157 | } |
| 158 |
| 159 | *, |
| 160 | :after, |
| 161 | :before { |
| 162 | box-sizing: border-box; |
| 163 | -webkit-tap-highlight-color: transparent; |
| 164 | } |
| 165 |
| 166 | html, |
| 167 | body { |
| 168 | height: 100%; |
| 169 | overflow: hidden; |
| 170 | } |
| 171 |
| 172 | #app { |
| 173 | height: 100vh; |
| 174 | height: 100dvh; |
| 175 | display: flex; |
| 176 | flex-direction: column; |
| 177 | background-color: var(--content-bg); |
| 178 | } |
| 179 |
| 180 | /* Header */ |
| 181 | .header { |
| 182 | flex-shrink: 0; |
| 183 | background: var(--header-bg); |
| 184 | border-bottom: 1px solid var(--header-border); |
| 185 | height: var(--header-height); |
| 186 | } |
| 187 |
| 188 | .header-content { |
| 189 | display: flex; |
| 190 | align-items: center; |
| 191 | justify-content: space-between; |
| 192 | height: 100%; |
| 193 | padding: 0 20px; |
| 194 | } |
| 195 |
| 196 | .brand-section { |
| 197 | display: flex; |
| 198 | align-items: center; |
| 199 | gap: 12px; |
| 200 | } |
| 201 |
| 202 | .logo-wrapper { |
| 203 | display: flex; |
| 204 | align-items: center; |
| 205 | } |
| 206 |
| 207 | .logo-icon { |
| 208 | width: 28px; |
| 209 | height: 28px; |
| 210 | } |
| 211 |
| 212 | .divider { |
| 213 | color: var(--header-border); |
| 214 | font-size: 22px; |
| 215 | font-weight: 200; |
| 216 | } |
| 217 |
| 218 | .brand-name { |
| 219 | font-weight: 600; |
| 220 | font-size: 18px; |
| 221 | color: var(--text-primary); |
| 222 | letter-spacing: -0.5px; |
| 223 | } |
| 224 |
| 225 | .badge { |
| 226 | font-size: 11px; |
| 227 | font-weight: 500; |
| 228 | color: var(--text-muted); |
| 229 | background: var(--hover-bg); |
| 230 | padding: 2px 8px; |
| 231 | border-radius: 4px; |
| 232 | } |
| 233 |
| 234 | .badge.server-badge { |
| 235 | background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%); |
| 236 | color: white; |
| 237 | border: none; |
| 238 | font-weight: 500; |
| 239 | } |
| 240 |
| 241 | html.dark .badge.server-badge { |
| 242 | background: linear-gradient(135deg, #60a5fa 0%, #22d3ee 100%); |
| 243 | } |
| 244 |
| 245 | .header-controls { |
| 246 | display: flex; |
| 247 | align-items: center; |
| 248 | gap: 16px; |
| 249 | } |
| 250 |
| 251 | .github-link { |
| 252 | display: flex; |
| 253 | align-items: center; |
| 254 | justify-content: center; |
| 255 | width: 28px; |
| 256 | height: 28px; |
| 257 | border-radius: 6px; |
| 258 | color: var(--text-secondary); |
| 259 | transition: all 0.15s ease; |
| 260 | text-decoration: none; |
| 261 | } |
| 262 |
| 263 | .github-link:hover { |
| 264 | background: var(--hover-bg); |
| 265 | color: var(--text-primary); |
| 266 | } |
| 267 |
| 268 | .github-icon { |
| 269 | width: 18px; |
| 270 | height: 18px; |
| 271 | } |
| 272 |
| 273 | .theme-switch { |
| 274 | --el-switch-on-color: #2c2c3a; |
| 275 | --el-switch-off-color: #f2f2f2; |
| 276 | --el-switch-border-color: var(--header-border); |
| 277 | } |
| 278 |
| 279 | html.dark .theme-switch { |
| 280 | --el-switch-off-color: #333; |
| 281 | } |
| 282 |
| 283 | .theme-switch .el-switch__core .el-switch__inner .el-icon { |
| 284 | color: #909399 !important; |
| 285 | } |
| 286 |
| 287 | /* Layout */ |
| 288 | .layout { |
| 289 | flex: 1; |
| 290 | display: flex; |
| 291 | overflow: hidden; |
| 292 | } |
| 293 |
| 294 | /* Sidebar */ |
| 295 | .sidebar { |
| 296 | width: var(--sidebar-width); |
| 297 | flex-shrink: 0; |
| 298 | background: var(--sidebar-bg); |
| 299 | border-right: 1px solid var(--header-border); |
| 300 | padding: 16px 12px; |
| 301 | overflow-y: auto; |
| 302 | display: flex; |
| 303 | flex-direction: column; |
| 304 | } |
| 305 |
| 306 | .sidebar-nav { |
| 307 | display: flex; |
| 308 | flex-direction: column; |
| 309 | gap: 2px; |
| 310 | } |
| 311 |
| 312 | .sidebar-link { |
| 313 | display: block; |
| 314 | text-decoration: none; |
| 315 | font-size: 15px; |
| 316 | color: var(--text-secondary); |
| 317 | padding: 10px 12px; |
| 318 | border-radius: 6px; |
| 319 | transition: all 0.15s ease; |
| 320 | } |
| 321 |
| 322 | .sidebar-link:hover { |
| 323 | color: var(--text-primary); |
| 324 | background: var(--hover-bg); |
| 325 | } |
| 326 |
| 327 | .sidebar-link.active { |
| 328 | color: var(--text-primary); |
| 329 | background: var(--hover-bg); |
| 330 | font-weight: 500; |
| 331 | } |
| 332 |
| 333 | /* Hamburger button (mobile only) */ |
| 334 | .hamburger-btn { |
| 335 | display: flex; |
| 336 | align-items: center; |
| 337 | justify-content: center; |
| 338 | width: 36px; |
| 339 | height: 36px; |
| 340 | border: none; |
| 341 | border-radius: 6px; |
| 342 | background: transparent; |
| 343 | cursor: pointer; |
| 344 | padding: 0; |
| 345 | transition: background 0.15s ease; |
| 346 | } |
| 347 |
| 348 | .hamburger-btn:hover { |
| 349 | background: var(--hover-bg); |
| 350 | } |
| 351 |
| 352 | .hamburger-icon { |
| 353 | font-size: 20px; |
| 354 | line-height: 1; |
| 355 | color: var(--text-primary); |
| 356 | } |
| 357 |
| 358 | /* Mobile overlay */ |
| 359 | .sidebar-overlay { |
| 360 | position: fixed; |
| 361 | inset: 0; |
| 362 | background: rgba(0, 0, 0, 0.5); |
| 363 | z-index: 99; |
| 364 | } |
| 365 |
| 366 | /* Content */ |
| 367 | #content { |
| 368 | flex: 1; |
| 369 | min-width: 0; |
| 370 | overflow-y: auto; |
| 371 | padding: 40px; |
| 372 | } |
| 373 |
| 374 | #content > * { |
| 375 | max-width: 1024px; |
| 376 | margin: 0 auto; |
| 377 | } |
| 378 |
| 379 | /* Common page styles */ |
| 380 | .page-title { |
| 381 | font-size: 20px; |
| 382 | font-weight: 600; |
| 383 | color: var(--color-text-primary, var(--text-primary)); |
| 384 | margin: 0; |
| 385 | } |
| 386 |
| 387 | .page-subtitle { |
| 388 | font-size: 14px; |
| 389 | color: var(--color-text-muted, var(--text-muted)); |
| 390 | margin: 8px 0 0; |
| 391 | } |
| 392 |
| 393 | /* Element Plus global overrides */ |
| 394 | .el-button { |
| 395 | font-weight: 500; |
| 396 | } |
| 397 |
| 398 | .el-tag { |
| 399 | font-weight: 500; |
| 400 | } |
| 401 |
| 402 | .el-switch { |
| 403 | --el-switch-on-color: #606266; |
| 404 | --el-switch-off-color: #dcdfe6; |
| 405 | } |
| 406 |
| 407 | html.dark .el-switch { |
| 408 | --el-switch-on-color: #b0b0b0; |
| 409 | --el-switch-off-color: #3a3d5c; |
| 410 | } |
| 411 |
| 412 | .el-form-item { |
| 413 | margin-bottom: 16px; |
| 414 | } |
| 415 |
| 416 | .el-loading-mask { |
| 417 | border-radius: 8px; |
| 418 | } |
| 419 |
| 420 | /* Select overrides */ |
| 421 | .el-select__wrapper { |
| 422 | border-radius: 8px !important; |
| 423 | box-shadow: 0 0 0 1px var(--color-border-light, #e4e7ed) inset !important; |
| 424 | transition: all 0.15s ease; |
| 425 | } |
| 426 |
| 427 | .el-select__wrapper:hover { |
| 428 | box-shadow: 0 0 0 1px var(--color-border, #dcdfe6) inset !important; |
| 429 | } |
| 430 |
| 431 | .el-select__wrapper.is-focused { |
| 432 | box-shadow: 0 0 0 1px var(--color-border, #dcdfe6) inset !important; |
| 433 | } |
| 434 |
| 435 | .el-select-dropdown { |
| 436 | border-radius: 12px !important; |
| 437 | border: 1px solid var(--color-border-light, #e4e7ed) !important; |
| 438 | box-shadow: |
| 439 | 0 10px 25px -5px rgba(0, 0, 0, 0.1), |
| 440 | 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important; |
| 441 | padding: 4px !important; |
| 442 | } |
| 443 |
| 444 | .el-select-dropdown__item { |
| 445 | border-radius: 6px; |
| 446 | margin: 2px 0; |
| 447 | transition: background 0.15s ease; |
| 448 | } |
| 449 |
| 450 | .el-select-dropdown__item.is-selected { |
| 451 | color: var(--color-text-primary, var(--text-primary)); |
| 452 | font-weight: 500; |
| 453 | } |
| 454 |
| 455 | /* Input overrides */ |
| 456 | .el-input__wrapper { |
| 457 | border-radius: 8px !important; |
| 458 | box-shadow: 0 0 0 1px var(--color-border-light, #e4e7ed) inset !important; |
| 459 | transition: all 0.15s ease; |
| 460 | } |
| 461 |
| 462 | .el-input__wrapper:hover { |
| 463 | box-shadow: 0 0 0 1px var(--color-border, #dcdfe6) inset !important; |
| 464 | } |
| 465 |
| 466 | .el-input__wrapper.is-focus { |
| 467 | box-shadow: 0 0 0 1px var(--color-border, #dcdfe6) inset !important; |
| 468 | } |
| 469 |
| 470 | /* Card overrides */ |
| 471 | .el-card { |
| 472 | border-radius: 12px; |
| 473 | border: 1px solid var(--color-border-light, #e4e7ed); |
| 474 | transition: all 0.2s ease; |
| 475 | } |
| 476 |
| 477 | /* Scrollbar */ |
| 478 | ::-webkit-scrollbar { |
| 479 | width: 6px; |
| 480 | height: 6px; |
| 481 | } |
| 482 |
| 483 | ::-webkit-scrollbar-track { |
| 484 | background: transparent; |
| 485 | } |
| 486 |
| 487 | ::-webkit-scrollbar-thumb { |
| 488 | background: #d1d1d1; |
| 489 | border-radius: 3px; |
| 490 | } |
| 491 |
| 492 | /* Mobile */ |
| 493 | @media (max-width: 767px) { |
| 494 | .header-content { |
| 495 | padding: 0 16px; |
| 496 | } |
| 497 |
| 498 | .sidebar { |
| 499 | position: fixed; |
| 500 | top: var(--header-height); |
| 501 | left: 0; |
| 502 | bottom: 0; |
| 503 | z-index: 100; |
| 504 | background: var(--sidebar-bg); |
| 505 | transform: translateX(-100%); |
| 506 | transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1); |
| 507 | border-right: 1px solid var(--header-border); |
| 508 | } |
| 509 |
| 510 | .sidebar.mobile-open { |
| 511 | transform: translateX(0); |
| 512 | } |
| 513 |
| 514 | #content { |
| 515 | width: 100%; |
| 516 | padding: 20px; |
| 517 | } |
| 518 | } |
| 519 | </style> |