Skip to content

Commit ef5dbea

Browse files
committed
feat(installer): add DE/WM and environment icons, 2-col DE grid, uninstall icon spacing
1 parent 18b62f3 commit ef5dbea

2 files changed

Lines changed: 46 additions & 3 deletions

File tree

src/components/InteractiveInstaller.vue

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { ref, computed } from 'vue';
33
import { DocumentCopy } from '@element-plus/icons-vue';
44
import { ElMessage } from 'element-plus';
55
import CodeLines from './CodeLines.vue';
6+
import { useTheme } from '@/utils/theme';
67
import {
78
distros,
89
methods,
@@ -26,6 +27,35 @@ const selectedDe = ref<string>(deWms[0] || '');
2627
const selectedEnv = ref<string>(environments[0] || '');
2728
const selectedInit = ref<string>(initSystems[0] || 'systemd');
2829
30+
const { currentTheme } = useTheme();
31+
32+
const deIcons: Record<string, string> = {
33+
GNOME: 'simple-icons:gnome',
34+
'KDE Plasma': 'simple-icons:kde',
35+
Xfce: 'simple-icons:xfce',
36+
Cinnamon: 'simple-icons:cinnamon',
37+
MATE: 'simple-icons:ubuntumate',
38+
Pantheon: 'simple-icons:pantheon',
39+
COSMIC: 'simple-icons:system76',
40+
i3: 'simple-icons:i3',
41+
Sway: 'simple-icons:sway',
42+
Hyprland: 'simple-icons:hyprland',
43+
Niri: 'simple-icons:niri',
44+
};
45+
46+
const envBaseIcons: Record<string, string> = {
47+
Wayland: 'simple-icons:wayland',
48+
};
49+
50+
const deIcon = (de: string): string | undefined => deIcons[de];
51+
52+
const envIcon = (env: string): string | undefined =>
53+
env === 'X11'
54+
? currentTheme.value === 'latte'
55+
? 'vscode-icons:file-type-light-xorg'
56+
: 'vscode-icons:file-type-xorg'
57+
: envBaseIcons[env];
58+
2959
const needsUserCreation = computed(() => {
3060
return (
3161
selectedDistro.value !== 'NixOS' && selectedDistro.value !== 'Arch Linux' &&
@@ -238,6 +268,7 @@ const chromiumWaylandFlags = computed(() =>
238268
<div class="de-grid">
239269
<div v-for="de in deWms" :key="de" class="de-card" :class="{ active: selectedDe === de }" role="button"
240270
tabindex="0" :aria-pressed="selectedDe === de" @click="selectedDe = de" @keydown.enter="selectedDe = de">
271+
<v-icon v-if="deIcon(de)" :icon="deIcon(de)" width="1.25em" height="1.25em" />
241272
<span>{{ de }}</span>
242273
</div>
243274
</div>
@@ -249,6 +280,7 @@ const chromiumWaylandFlags = computed(() =>
249280
<div v-for="e in environments" :key="e" class="option-card" :class="{ active: selectedEnv === e }"
250281
role="button" tabindex="0" :aria-pressed="selectedEnv === e" @click="selectedEnv = e"
251282
@keydown.enter="selectedEnv = e">
283+
<v-icon v-if="envIcon(e)" :icon="envIcon(e)" width="1.1em" height="1.1em" />
252284
<span>{{ e }}</span>
253285
</div>
254286
</div>
@@ -601,7 +633,7 @@ const chromiumWaylandFlags = computed(() =>
601633
}
602634
603635
.de-grid {
604-
grid-template-columns: repeat(3, 1fr);
636+
grid-template-columns: repeat(2, 1fr);
605637
}
606638
607639
.option-grid {
@@ -651,7 +683,6 @@ const chromiumWaylandFlags = computed(() =>
651683
outline-offset: 2px;
652684
}
653685
654-
/* Trạng thái Active - Chỉ đổi viền và chữ để không bị lóa mảng màu lớn */
655686
.distro-card.active,
656687
.de-card.active,
657688
.option-card.active {
@@ -665,6 +696,12 @@ const chromiumWaylandFlags = computed(() =>
665696
flex-shrink: 0;
666697
}
667698
699+
.de-card svg,
700+
.option-card svg {
701+
flex-shrink: 0;
702+
margin-right: 6px;
703+
}
704+
668705
.distro-card span,
669706
.option-card span {
670707
font-size: 0.85rem;

src/components/UninstallItem.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ defineProps<{
99
<details class="uninstall-details">
1010
<summary>
1111
<div class="distro-label">
12-
<v-icon :icon="icon" width="1.2em" height="1.2em" class="mr-3" />
12+
<v-icon :icon="icon" width="1.2em" height="1.2em" />
1313
<span>{{ name }}</span>
1414
</div>
1515
</summary>
@@ -18,3 +18,9 @@ defineProps<{
1818
</div>
1919
</details>
2020
</template>
21+
22+
<style scoped>
23+
.distro-label {
24+
gap: 0.5rem;
25+
}
26+
</style>

0 commit comments

Comments
 (0)