Skip to content

Commit b631aa5

Browse files
committed
feat: improve command line preview with GitHub dark theme styling
1 parent d1a2c5d commit b631aa5

2 files changed

Lines changed: 119 additions & 49 deletions

File tree

src/frontEnd/src/components.d.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ declare module 'vue' {
3838
RouterLink: typeof import('vue-router')['RouterLink']
3939
RouterView: typeof import('vue-router')['RouterView']
4040
SearchFilterBar: typeof import('./components/SearchFilterBar.vue')['default']
41-
SelectButton: typeof import('primevue/selectbutton')['default']
42-
Slider: typeof import('primevue/slider')['default']
4341
StatCard: typeof import('./components/StatCard.vue')['default']
4442
Tag: typeof import('primevue/tag')['default']
4543
TaskFilter: typeof import('./components/TaskFilter.vue')['default']

src/frontEnd/src/components/CommandLinePreview.vue

Lines changed: 119 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
11
<template>
2-
<div class="command-preview">
3-
<div class="preview-header">
4-
<span class="preview-title">{{ title }}</span>
5-
<Button
6-
v-if="showCopy"
7-
icon="pi pi-copy"
8-
text
9-
rounded
10-
size="small"
11-
@click="copyCommand"
12-
v-tooltip.top="'复制'"
13-
/>
2+
<div class="terminal-window">
3+
<div class="terminal-header">
4+
<div class="traffic-lights">
5+
<span class="dot red"></span>
6+
<span class="dot yellow"></span>
7+
<span class="dot green"></span>
8+
</div>
9+
<span class="terminal-title">{{ title }}</span>
10+
<div class="terminal-actions">
11+
<button
12+
v-if="showCopy"
13+
class="copy-btn"
14+
@click="copyCommand"
15+
v-tooltip.top="'复制'"
16+
>
17+
<i class="pi pi-copy"></i>
18+
</button>
19+
</div>
20+
</div>
21+
<div class="terminal-body">
22+
<pre><code><span class="prompt">$ </span><span v-html="highlightedCommand"></span></code></pre>
1423
</div>
15-
<pre class="preview-content"><code v-html="highlightedCommand"></code></pre>
1624
</div>
1725
</template>
1826

1927
<script setup lang="ts">
2028
import { computed } from 'vue'
21-
import Button from 'primevue/button'
2229
import { useToast } from 'primevue/usetoast'
2330
2431
interface Props {
@@ -98,63 +105,128 @@ async function copyCommand() {
98105
</script>
99106

100107
<style scoped>
101-
.command-preview {
102-
border: 1px solid var(--p-surface-border);
103-
border-radius: var(--p-border-radius);
108+
/* ===== Terminal Window ===== */
109+
.terminal-window {
110+
border-radius: 8px;
104111
overflow: hidden;
112+
border: 1px solid #30363d;
113+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
105114
}
106115
107-
.preview-header {
116+
/* ===== Title Bar ===== */
117+
.terminal-header {
108118
display: flex;
109-
justify-content: space-between;
110119
align-items: center;
111-
padding: 0.5rem 0.75rem;
112-
background: var(--p-surface-section);
113-
border-bottom: 1px solid var(--p-surface-border);
120+
padding: 10px 14px;
121+
background: #161b22;
122+
border-bottom: 1px solid #30363d;
114123
}
115124
116-
.preview-title {
117-
font-size: 0.875rem;
118-
font-weight: 500;
119-
color: var(--p-text-secondary-color);
125+
.traffic-lights {
126+
display: flex;
127+
gap: 8px;
128+
flex-shrink: 0;
120129
}
121130
122-
.preview-content {
123-
margin: 0;
124-
padding: 0.75rem;
125-
background: var(--p-surface-card);
126-
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
131+
.traffic-lights .dot {
132+
width: 12px;
133+
height: 12px;
134+
border-radius: 50%;
135+
}
136+
137+
.traffic-lights .dot.red {
138+
background: #ff5f56;
139+
}
140+
141+
.traffic-lights .dot.yellow {
142+
background: #ffbd2e;
143+
}
144+
145+
.traffic-lights .dot.green {
146+
background: #27c93f;
147+
}
148+
149+
.terminal-title {
150+
flex: 1;
151+
text-align: center;
127152
font-size: 13px;
128-
line-height: 1.5;
153+
font-weight: 500;
154+
color: #8b949e;
155+
user-select: none;
156+
}
157+
158+
.terminal-actions {
159+
display: flex;
160+
align-items: center;
161+
flex-shrink: 0;
162+
}
163+
164+
.copy-btn {
165+
display: flex;
166+
align-items: center;
167+
justify-content: center;
168+
width: 28px;
169+
height: 28px;
170+
border: none;
171+
border-radius: 6px;
172+
background: transparent;
173+
color: #8b949e;
174+
cursor: pointer;
175+
transition: background 0.2s, color 0.2s;
176+
}
177+
178+
.copy-btn:hover {
179+
background: #30363d;
180+
color: #e6edf3;
181+
}
182+
183+
.copy-btn i {
184+
font-size: 14px;
185+
}
186+
187+
/* ===== Terminal Body ===== */
188+
.terminal-body {
189+
background: #0d1117;
190+
padding: 16px;
129191
overflow-x: auto;
192+
}
193+
194+
.terminal-body pre {
195+
margin: 0;
130196
white-space: pre-wrap;
131197
word-break: break-all;
132-
color: var(--p-text-color);
133198
}
134199
135-
.preview-content :deep(.param) {
136-
color: var(--p-primary-color);
137-
font-weight: 500;
200+
.terminal-body code {
201+
font-family: 'JetBrains Mono', 'SF Mono', Monaco, 'Cascadia Code', Consolas, 'Courier New', monospace;
202+
font-size: 13px;
203+
line-height: 1.6;
204+
color: #e6edf3;
138205
}
139206
140-
.preview-content :deep(.flag) {
141-
color: var(--p-primary-color);
142-
font-weight: 500;
207+
/* ===== Prompt ===== */
208+
.prompt {
209+
color: #7ee787;
210+
font-weight: 600;
211+
user-select: none;
143212
}
144213
145-
.preview-content :deep(.string) {
146-
color: var(--p-green-500);
214+
/* ===== Syntax Highlighting - GitHub Dark Default ===== */
215+
.terminal-body :deep(.param) {
216+
color: #79c0ff;
217+
font-weight: 500;
147218
}
148219
149-
.preview-content :deep(.number) {
150-
color: var(--p-orange-500);
220+
.terminal-body :deep(.flag) {
221+
color: #d2a8ff;
222+
font-weight: 500;
151223
}
152224
153-
:deep(.app-dark) .preview-content :deep(.string) {
154-
color: var(--p-green-400);
225+
.terminal-body :deep(.string) {
226+
color: #a5d6ff;
155227
}
156228
157-
:deep(.app-dark) .preview-content :deep(.number) {
158-
color: var(--p-orange-400);
229+
.terminal-body :deep(.number) {
230+
color: #ffa657;
159231
}
160232
</style>

0 commit comments

Comments
 (0)