From 8380720d5edd54fb877004c373358247386fc08e Mon Sep 17 00:00:00 2001 From: NanamiAdmin Date: Mon, 9 Mar 2026 22:25:58 +0800 Subject: [PATCH] refactor(styles): move common styles to shared CSS file Extract duplicated styles across multiple components into a common CSS file and import it where needed. This improves maintainability by reducing code duplication and centralizing style definitions. --- src/styles/common.css | 490 +++++++++++++++++++++++++++++++++++ src/views/InstanceDetail.vue | 139 +--------- src/views/Instances.vue | 105 +------- src/views/Logs.vue | 33 +-- src/views/Monitor.vue | 31 +-- src/views/Sessions.vue | 71 +---- src/views/SystemInfo.vue | 53 +--- src/views/Users.vue | 212 +-------------- 8 files changed, 504 insertions(+), 630 deletions(-) create mode 100644 src/styles/common.css diff --git a/src/styles/common.css b/src/styles/common.css new file mode 100644 index 0000000..a904515 --- /dev/null +++ b/src/styles/common.css @@ -0,0 +1,490 @@ +.page-header { + margin-bottom: 24px; +} + +.page-header h2 { + font-size: 24px; + color: var(--text-color); + margin: 0; + transition: color 0.3s; +} + +.card { + background: var(--card-bg); + border-radius: 8px; + padding: 20px; + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); + transition: background-color 0.3s; +} + +.card-header { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 16px; +} + +.card-header h3 { + font-size: 16px; + color: var(--text-color); + margin: 0; + transition: color 0.3s; +} + +.card-body { + display: flex; + flex-direction: column; + gap: 12px; +} + +.card-footer { + display: flex; + gap: 8px; +} + +.empty-state { + text-align: center; + padding: 60px 20px; + color: #999; + font-size: 16px; +} + +.action-btn { + padding: 8px 16px; + border: none; + border-radius: 6px; + font-size: 14px; + font-weight: 500; + cursor: pointer; + transition: all 0.3s; +} + +.delete-btn { + background: #ff4d4f; + color: white; +} + +.delete-btn:hover { + background: #f04142; +} + +.edit-btn { + background: #f0f0f0; + color: var(--text-color); +} + +.edit-btn:hover { + background: #e0e0e0; +} + +.start-btn { + background: #52c41a; + color: white; +} + +.start-btn:hover { + background: #45a049; +} + +.stop-btn { + background: #ff4d4f; + color: white; +} + +.stop-btn:hover { + background: #f04142; +} + +.add-btn { + padding: 10px 20px; + background: var(--primary-color); + color: white; + border: none; + border-radius: 6px; + font-size: 14px; + font-weight: 500; + cursor: pointer; + transition: all 0.3s; +} + +.add-btn:hover { + background: #5568d3; +} + +.form { + display: flex; + flex-direction: column; + gap: 16px; +} + +.form-group { + display: flex; + flex-direction: column; + gap: 8px; +} + +.form-group label { + font-size: 14px; + color: #666; + font-weight: 500; +} + +.form-group input, +.form-group select { + padding: 10px; + border: 1px solid var(--border-color); + border-radius: 6px; + font-size: 14px; + background: var(--bg-color); + color: var(--text-color); + transition: background-color 0.3s, color 0.3s, border-color 0.3s; +} + +.form-group input:focus, +.form-group select:focus { + outline: none; + border-color: var(--primary-color); +} + +.form-group input:disabled { + background: #f5f5f5; + cursor: not-allowed; +} + +.form-actions { + display: flex; + gap: 12px; + margin-top: 8px; +} + +.cancel-btn, +.submit-btn { + flex: 1; + padding: 10px; + border: none; + border-radius: 6px; + font-size: 14px; + font-weight: 500; + cursor: pointer; + transition: all 0.3s; +} + +.cancel-btn { + background: #f0f0f0; + color: var(--text-color); +} + +.cancel-btn:hover { + background: #e0e0e0; +} + +.submit-btn { + background: var(--primary-color); + color: white; +} + +.submit-btn:hover:not(:disabled) { + background: #5568d3; +} + +.submit-btn:disabled { + opacity: 0.6; + cursor: not-allowed; +} + +.info-row { + display: flex; + justify-content: space-between; + font-size: 14px; +} + +.info-row .label { + color: #666; +} + +.info-row .value { + color: var(--text-color); + font-weight: 500; + transition: color 0.3s; +} + +.info-item { + display: flex; + justify-content: space-between; + font-size: 14px; +} + +.info-label { + color: #666; + font-weight: 500; +} + +.info-value { + color: var(--text-color); + font-weight: 500; + text-align: right; + word-break: break-all; + transition: color 0.3s; +} + +.status-badge { + padding: 4px 12px; + border-radius: 12px; + font-size: 12px; + font-weight: 500; +} + +.status-badge.running { + background: #f6ffed; + color: #52c41a; +} + +.status-badge.stopped { + background: #fff1f0; + color: #ff4d4f; +} + +.status-badge.active { + background: #f6ffed; + color: #52c41a; +} + +.status-badge.inactive { + background: #fff1f0; + color: #ff4d4f; +} + +.type-badge { + display: inline-block; + padding: 2px 8px; + border-radius: 4px; + font-size: 12px; + font-weight: 500; +} + +.type-badge.superuser { + background: #fff7e6; + color: #fa8c16; +} + +.type-badge.admin { + background: #e6f7ff; + color: #1890ff; +} + +.type-badge.visitor { + background: #f9f9f9; + color: #666; +} + +.modal-overlay { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: rgba(0, 0, 0, 0.5); + display: flex; + align-items: center; + justify-content: center; + z-index: 1000; +} + +.modal { + background: var(--card-bg); + border-radius: 12px; + padding: 24px; + width: 400px; + box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2); + transition: background-color 0.3s; +} + +.modal h3 { + font-size: 20px; + color: var(--text-color); + margin: 0 0 20px 0; + transition: color 0.3s; +} + +.log-list { + display: flex; + flex-direction: column; + gap: 8px; +} + +.log-item { + display: flex; + gap: 12px; + padding: 12px; + background: #f9f9f9; + border-radius: 6px; + font-size: 14px; + font-family: 'Consolas', 'Monaco', monospace; +} + +.log-time { + color: #999; + min-width: 160px; +} + +.log-level { + min-width: 70px; + font-weight: 600; + text-align: center; + padding: 2px 8px; + border-radius: 4px; +} + +.log-level.DEBUG { + color: #52c41a; + background: #f6ffed; +} + +.log-level.INFO { + color: #1890ff; + background: #e6f7ff; +} + +.log-level.WARN { + color: #faad14; + background: #fffbe6; +} + +.log-level.ERROR { + color: #ff4d4f; + background: #fff1f0; +} + +.log-level.FATAL { + color: #cf1322; + background: #fff1f0; +} + +.log-message { + color: var(--text-color); + flex: 1; + word-break: break-all; + transition: color 0.3s; +} + +.avatar { + width: 48px; + height: 48px; + border-radius: 50%; + background: linear-gradient(135deg, var(--primary-color) 0%, #764ba2 100%); + display: flex; + align-items: center; + justify-content: center; + color: white; + font-weight: 600; + font-size: 18px; +} + +.back-btn { + padding: 8px 16px; + background: #f0f0f0; + border: none; + border-radius: 6px; + cursor: pointer; + font-size: 14px; + transition: all 0.3s; +} + +.back-btn:hover { + background: #e0e0e0; +} + +.config-item { + display: flex; + justify-content: space-between; + padding: 12px; + background: #f9f9f9; + border-radius: 6px; +} + +.config-key { + color: #666; + font-weight: 500; +} + +.config-value { + color: var(--text-color); + transition: color 0.3s; +} + +.proxy-item { + padding: 16px; + background: #f9f9f9; + border-radius: 6px; +} + +.proxy-header { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 12px; +} + +.proxy-name { + font-size: 16px; + font-weight: 600; + color: var(--text-color); + transition: color 0.3s; +} + +.proxy-details { + display: flex; + flex-direction: column; + gap: 8px; +} + +.proxy-detail { + display: flex; + justify-content: space-between; + font-size: 14px; +} + +.detail-key { + color: #666; +} + +.detail-value { + color: var(--text-color); + transition: color 0.3s; +} + +.section { + background: var(--card-bg); + border-radius: 8px; + padding: 20px; + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); + transition: background-color 0.3s; +} + +.section h3 { + font-size: 18px; + color: var(--text-color); + margin: 0 0 16px 0; + transition: color 0.3s; +} + +.logs-container { + max-height: 400px; + overflow-y: auto; +} + +.filter-controls select { + padding: 8px 16px; + border: 1px solid var(--border-color); + border-radius: 6px; + font-size: 14px; + background: var(--card-bg); + color: var(--text-color); + cursor: pointer; + transition: background-color 0.3s, color 0.3s, border-color 0.3s; +} + +.filter-controls select:focus { + outline: none; + border-color: var(--primary-color); +} diff --git a/src/views/InstanceDetail.vue b/src/views/InstanceDetail.vue index 61d020d..e3dd295 100644 --- a/src/views/InstanceDetail.vue +++ b/src/views/InstanceDetail.vue @@ -144,6 +144,8 @@ export default { diff --git a/src/views/Instances.vue b/src/views/Instances.vue index 5445606..8cc8755 100644 --- a/src/views/Instances.vue +++ b/src/views/Instances.vue @@ -136,21 +136,12 @@ export default { diff --git a/src/views/Logs.vue b/src/views/Logs.vue index b417b7c..eb118ff 100644 --- a/src/views/Logs.vue +++ b/src/views/Logs.vue @@ -66,6 +66,8 @@ export default { diff --git a/src/views/Monitor.vue b/src/views/Monitor.vue index c58a98c..0e411ed 100644 --- a/src/views/Monitor.vue +++ b/src/views/Monitor.vue @@ -259,21 +259,12 @@ export default { diff --git a/src/views/SystemInfo.vue b/src/views/SystemInfo.vue index cd0759e..184ce5e 100644 --- a/src/views/SystemInfo.vue +++ b/src/views/SystemInfo.vue @@ -176,35 +176,18 @@ export default { diff --git a/src/views/Users.vue b/src/views/Users.vue index 516e898..5a48ee1 100644 --- a/src/views/Users.vue +++ b/src/views/Users.vue @@ -201,6 +201,8 @@ export default {