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