refactor: migrate UI to Tailwind CSS for a modernized design system.

This commit is contained in:
CJACK
2026-02-01 05:33:50 +08:00
parent 1d1361616b
commit 1f6043ff70
12 changed files with 1087 additions and 1174 deletions

View File

@@ -1,569 +1,172 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
/* Custom CSS Variables for Design Tokens */
:root {
--bg-primary: #0f0f0f;
--bg-secondary: #1a1a1a;
--bg-tertiary: #242424;
--text-primary: #e5e5e5;
--text-secondary: #a0a0a0;
--accent: #3b82f6;
--accent-hover: #2563eb;
--success: #22c55e;
--error: #ef4444;
--warning: #f59e0b;
--border: #333;
--radius: 8px;
--shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
--color-border: hsl(217.2 32.6% 17.5%);
--color-input: hsl(217.2 32.6% 17.5%);
--color-ring: hsl(212.7 26.8% 83.9%);
--color-background: hsl(222.2 84% 4.9%);
--color-foreground: hsl(210 40% 98%);
--color-primary: hsl(210 40% 98%);
--color-primary-foreground: hsl(222.2 47.4% 11.2%);
--color-secondary: hsl(217.2 32.6% 17.5%);
--color-secondary-foreground: hsl(210 40% 98%);
--color-destructive: hsl(0 62.8% 30.6%);
--color-destructive-foreground: hsl(210 40% 98%);
--color-muted: hsl(217.2 32.6% 17.5%);
--color-muted-foreground: hsl(215 20.2% 65.1%);
--color-accent: hsl(217.2 32.6% 17.5%);
--color-accent-foreground: hsl(210 40% 98%);
--color-popover: hsl(222.2 84% 4.9%);
--color-popover-foreground: hsl(210 40% 98%);
--color-card: hsl(222.2 84% 4.9%);
--color-card-foreground: hsl(210 40% 98%);
--radius: 0.5rem;
}
/* Base styles */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
border-color: var(--color-border);
}
body {
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
background: var(--bg-primary);
color: var(--text-primary);
line-height: 1.6;
min-height: 100vh;
background-color: var(--color-background);
color: var(--color-foreground);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-feature-settings: "rlig" 1, "calt" 1;
}
.app {
max-width: 1200px;
margin: 0 auto;
padding: 2rem;
/* Custom scrollbar */
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
.header {
text-align: center;
margin-bottom: 2rem;
padding-bottom: 1.5rem;
border-bottom: 1px solid var(--border);
::-webkit-scrollbar-track {
background: transparent;
}
.header h1 {
font-size: 2rem;
background: linear-gradient(135deg, #3b82f6, #8b5cf6);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
::-webkit-scrollbar-thumb {
background: var(--color-muted);
border-radius: 4px;
}
.header p {
color: var(--text-secondary);
margin-top: 0.5rem;
::-webkit-scrollbar-thumb:hover {
background: var(--color-muted-foreground);
}
.tabs {
display: flex;
gap: 0.5rem;
margin-bottom: 1.5rem;
flex-wrap: wrap;
}
.tab {
padding: 0.75rem 1.5rem;
border: none;
background: var(--bg-secondary);
color: var(--text-secondary);
border-radius: var(--radius);
cursor: pointer;
transition: all 0.2s;
font-size: 0.9rem;
}
.tab:hover {
background: var(--bg-tertiary);
color: var(--text-primary);
}
.tab.active {
background: var(--accent);
color: white;
}
.card {
background: var(--bg-secondary);
border-radius: var(--radius);
padding: 1.5rem;
margin-bottom: 1rem;
border: 1px solid var(--border);
}
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 1rem;
}
.card-title {
font-size: 1.1rem;
font-weight: 600;
}
.form-group {
margin-bottom: 1rem;
}
.form-label {
display: block;
margin-bottom: 0.5rem;
color: var(--text-secondary);
font-size: 0.9rem;
}
.form-input {
width: 100%;
padding: 0.75rem 1rem;
background: var(--bg-tertiary);
border: 1px solid var(--border);
border-radius: var(--radius);
color: var(--text-primary);
font-size: 0.95rem;
transition: border-color 0.2s;
}
.form-input:focus {
outline: none;
border-color: var(--accent);
}
.form-input::placeholder {
color: var(--text-secondary);
opacity: 0.6;
}
textarea.form-input {
min-height: 120px;
resize: vertical;
font-family: 'Monaco', 'Menlo', monospace;
font-size: 0.85rem;
/* Custom scrollbar utility */
.custom-scrollbar {
scrollbar-width: thin;
scrollbar-color: var(--color-muted) transparent;
}
/* Button components */
.btn {
padding: 0.75rem 1.5rem;
border: none;
border-radius: var(--radius);
cursor: pointer;
font-size: 0.9rem;
font-weight: 500;
transition: all 0.2s;
display: inline-flex;
align-items: center;
gap: 0.5rem;
justify-content: center;
border-radius: 0.5rem;
padding: 0.5rem 1rem;
font-size: 0.875rem;
font-weight: 500;
transition: all 0.15s;
}
.btn-primary {
background: var(--accent);
color: white;
}
.btn-primary:hover {
background: var(--accent-hover);
}
.btn-secondary {
background: var(--bg-tertiary);
color: var(--text-primary);
}
.btn-secondary:hover {
background: #333;
}
.btn-danger {
background: var(--error);
color: white;
}
.btn-danger:hover {
background: #dc2626;
}
.btn-success {
background: var(--success);
color: white;
}
.btn-success:hover {
background: #16a34a;
.btn:focus {
outline: none;
box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}
.btn:disabled {
opacity: 0.5;
cursor: not-allowed;
pointer-events: none;
}
.btn-group {
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
.btn-primary {
background-color: var(--color-primary);
color: var(--color-primary-foreground);
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
.list {
display: flex;
flex-direction: column;
gap: 0.5rem;
.btn-primary:hover {
background-color: rgba(248, 250, 252, 0.9);
}
.list-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.75rem 1rem;
background: var(--bg-tertiary);
border-radius: var(--radius);
.btn-primary:active {
transform: scale(0.95);
}
.list-item-text {
font-family: 'Monaco', 'Menlo', monospace;
font-size: 0.9rem;
.btn-secondary {
background-color: var(--color-secondary);
color: var(--color-secondary-foreground);
border: 1px solid var(--color-border);
}
.list-item-info {
display: flex;
gap: 0.75rem;
align-items: center;
.btn-secondary:hover {
background-color: var(--color-accent);
color: var(--color-accent-foreground);
}
.badge {
padding: 0.25rem 0.5rem;
border-radius: 4px;
font-size: 0.75rem;
font-weight: 500;
.btn-danger {
background-color: var(--color-destructive);
color: var(--color-destructive-foreground);
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
.badge-success {
background: rgba(34, 197, 94, 0.2);
color: var(--success);
}
.badge-warning {
background: rgba(245, 158, 11, 0.2);
color: var(--warning);
}
.badge-error {
background: rgba(239, 68, 68, 0.2);
color: var(--error);
}
.alert {
padding: 1rem;
border-radius: var(--radius);
margin-bottom: 1rem;
}
.alert-success {
background: rgba(34, 197, 94, 0.1);
border: 1px solid var(--success);
color: var(--success);
}
.alert-error {
background: rgba(239, 68, 68, 0.1);
border: 1px solid var(--error);
color: var(--error);
}
.alert-info {
background: rgba(59, 130, 246, 0.1);
border: 1px solid var(--accent);
color: var(--accent);
}
.empty-state {
text-align: center;
padding: 2rem;
color: var(--text-secondary);
}
.code-block {
background: var(--bg-tertiary);
border-radius: var(--radius);
padding: 1rem;
overflow-x: auto;
font-family: 'Monaco', 'Menlo', monospace;
font-size: 0.85rem;
white-space: pre-wrap;
word-break: break-all;
}
.loading {
display: inline-block;
width: 1rem;
height: 1rem;
border: 2px solid rgba(255, 255, 255, 0.3);
border-radius: 50%;
border-top-color: white;
animation: spin 0.8s linear infinite;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
.modal-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.7);
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
}
.modal {
background: var(--bg-secondary);
border-radius: var(--radius);
padding: 1.5rem;
max-width: 500px;
width: 90%;
max-height: 80vh;
overflow-y: auto;
box-shadow: var(--shadow);
}
.modal-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 1rem;
padding-bottom: 1rem;
border-bottom: 1px solid var(--border);
}
.modal-title {
font-size: 1.1rem;
font-weight: 600;
}
.modal-close {
background: none;
border: none;
color: var(--text-secondary);
font-size: 1.5rem;
cursor: pointer;
line-height: 1;
}
.modal-close:hover {
color: var(--text-primary);
}
.section {
margin-bottom: 2rem;
}
.section-title {
font-size: 1rem;
margin-bottom: 1rem;
color: var(--text-secondary);
text-transform: uppercase;
letter-spacing: 0.05em;
}
.grid {
display: grid;
gap: 1rem;
}
.grid-2 {
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.stats {
display: flex;
gap: 1.5rem;
margin-bottom: 1rem;
}
.stat {
text-align: center;
}
.stat-value {
font-size: 2rem;
font-weight: 700;
color: var(--accent);
}
.stat-label {
font-size: 0.85rem;
color: var(--text-secondary);
}
/* Queue Status */
.queue-status {
padding: 0.75rem;
background: var(--bg-tertiary);
border-radius: var(--radius);
}
.stat-row {
display: flex;
align-items: center;
gap: 0.5rem;
flex-wrap: wrap;
}
.stat-value {
font-size: 1.25rem;
font-weight: 700;
margin-right: 0.5rem;
}
.stat-success {
color: var(--success);
}
.stat-warning {
color: var(--warning);
}
.stat-detail {
margin-top: 0.5rem;
font-size: 0.85rem;
color: var(--text-secondary);
font-family: 'Monaco', 'Menlo', monospace;
}
/* Button Group Inline */
.btn-group-inline {
display: flex;
gap: 0.5rem;
align-items: center;
.btn-danger:hover {
background-color: rgba(127, 29, 29, 0.9);
}
.btn-sm {
padding: 0.4rem 0.8rem;
font-size: 0.8rem;
}
/* Token Preview */
.token-preview {
padding: 0.375rem 0.75rem;
font-size: 0.75rem;
color: var(--text-secondary);
font-family: 'Monaco', 'Menlo', monospace;
background: var(--bg-tertiary);
padding: 0.2rem 0.5rem;
border-radius: var(--radius);
margin-left: 0.5rem;
}
/* Batch Progress */
.batch-progress {
margin: 1rem 0;
padding: 1rem;
background: var(--bg-tertiary);
border-radius: var(--radius);
}
.progress-header {
/* Input field */
.input-field {
display: flex;
justify-content: space-between;
margin-bottom: 0.5rem;
font-size: 0.9rem;
}
.progress-bar {
height: 8px;
background: var(--bg-secondary);
border-radius: 4px;
overflow: hidden;
}
.progress-fill {
height: 100%;
background: linear-gradient(90deg, var(--primary), var(--primary-hover));
transition: width 0.3s ease;
}
.progress-results {
margin-top: 0.75rem;
max-height: 150px;
overflow-y: auto;
font-size: 0.85rem;
}
.progress-result {
padding: 0.25rem 0;
font-family: 'Monaco', 'Menlo', monospace;
}
.progress-result.success {
color: var(--success);
}
.progress-result.failed {
color: var(--error);
}
/* Login Page */
.login-container {
display: flex;
justify-content: center;
align-items: center;
min-height: 70vh;
}
.login-card {
background: var(--bg-secondary);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 2.5rem;
height: 2.5rem;
width: 100%;
max-width: 400px;
box-shadow: var(--shadow);
border-radius: 0.5rem;
border: 1px solid var(--color-input);
background-color: rgba(30, 41, 59, 0.3);
padding: 0.5rem 0.75rem;
font-size: 0.875rem;
transition: all 0.15s;
}
.login-header {
text-align: center;
margin-bottom: 2rem;
.input-field::placeholder {
color: var(--color-muted-foreground);
}
.login-header h1 {
font-size: 1.75rem;
margin-bottom: 0.5rem;
.input-field:focus {
outline: none;
box-shadow: 0 0 0 2px var(--color-ring);
}
.login-header p {
color: var(--text-secondary);
font-size: 0.9rem;
.input-field:disabled {
cursor: not-allowed;
opacity: 0.5;
}
.login-footer {
margin-top: 1.5rem;
text-align: center;
color: var(--text-secondary);
font-size: 0.8rem;
}
@media (max-width: 640px) {
.app {
padding: 1rem;
}
.tabs {
flex-direction: column;
}
.tab {
text-align: center;
}
.btn-group {
flex-direction: column;
}
.btn {
width: 100%;
justify-content: center;
}
/* Card */
.card {
background-color: var(--color-card);
color: var(--color-card-foreground);
border: 1px solid var(--color-border);
border-radius: 0.75rem;
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
overflow: hidden;
}