Skip to content

Commit e1bf94b

Browse files
authored
chore(refactor): rename HistorySection to MountsSection and centralize types (#37)
1 parent 95993e8 commit e1bf94b

15 files changed

Lines changed: 99 additions & 80 deletions

src/App.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import EditorTabs from "./components/layout/EditorTabs.vue";
1515
import { useResponsive } from "./composables/useResponsive";
1616
import IndentationPicker from "./components/layout/IndentationPicker.vue";
1717
import PresetsGallery from "./components/presets/PresetsGallery.vue";
18+
import type { PresetApplyPayload, Section } from "./types";
1819
1920
const {
2021
state,
@@ -45,11 +46,9 @@ const {
4546
const { isMobile } = useResponsive();
4647
const activeView = ref<"config" | "preview">("config");
4748
48-
const activeSection = ref<
49-
"general" | "features" | "ports" | "history" | "advanced" | "presets"
50-
>("presets");
49+
const activeSection = ref<Section>("presets");
5150
52-
function handleApplyPreset(payload: any) {
51+
function handleApplyPreset(payload: PresetApplyPayload) {
5352
state.value.orchestration = payload.orchestration;
5453
state.value.config = {
5554
...state.value.config,

src/components/ConfigForm.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<script setup lang="ts">
22
import { computed } from "vue";
3-
import type { DevContainerConfig, OrchestrationType } from "../types";
3+
import type { DevContainerConfig, OrchestrationType, Section } from "../types";
44
import GeneralSection from "./GeneralSection.vue";
55
import FeaturesSection from "./FeaturesSection.vue";
66
import PortsSection from "./PortsSection.vue";
7-
import HistorySection from "./HistorySection.vue";
7+
import MountsSection from "./MountsSection.vue";
88
import AdvancedSection from "./AdvancedSection.vue";
99
1010
const props = defineProps<{
1111
modelValue: {
1212
orchestration: OrchestrationType;
1313
config: DevContainerConfig;
1414
};
15-
activeSection: string;
15+
activeSection: Section;
1616
}>();
1717
1818
const emit = defineEmits(["update:modelValue"]);
@@ -62,10 +62,10 @@ function handleUpdateOrchestration(val: OrchestrationType) {
6262
</div>
6363

6464
<div
65-
v-if="activeSection === 'history'"
65+
v-if="activeSection === 'mounts'"
6666
class="space-y-8 animate-in fade-in slide-in-from-left-2 duration-300"
6767
>
68-
<HistorySection
68+
<MountsSection
6969
:config="config"
7070
:orchestration="orchestration"
7171
@update:config="handleUpdateConfig"

src/components/FeatureSelector.vue

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,10 @@ const manualFeatures = computed(() => {
182182
class="flex justify-between p-3 cursor-pointer select-none gap-3"
183183
>
184184
<div class="flex flex-col flex-1 min-w-0 gap-1.5">
185-
<div class="flex flex-wrap items-center gap-2">
185+
<div class="flex items-center gap-2 min-w-0">
186186
<span
187-
class="text-[11px] font-black uppercase tracking-wider truncate shrink-0"
187+
class="text-[11px] font-black uppercase tracking-wider truncate flex-1 min-w-0"
188+
:title="feature.name"
188189
:class="
189190
selectedFeatures[feature.id]
190191
? 'text-ide-accent'
@@ -194,7 +195,7 @@ const manualFeatures = computed(() => {
194195
{{ feature.name }}
195196
</span>
196197
<span
197-
class="px-1.5 rounded-full text-[6px] font-black uppercase tracking-widest border whitespace-nowrap"
198+
class="px-1.5 rounded-full text-[6px] font-black uppercase tracking-widest border whitespace-nowrap shrink-0"
198199
style="padding-top: 0.125rem; padding-bottom: 0.125rem"
199200
:class="
200201
feature.id.startsWith('ghcr.io/devcontainers/features')
@@ -230,9 +231,11 @@ const manualFeatures = computed(() => {
230231
</svg>
231232
</a>
232233
</div>
233-
<span class="text-[8px] font-mono text-ide-text-muted truncate">{{
234-
feature.id
235-
}}</span>
234+
<span
235+
class="text-[8px] font-mono text-ide-text-muted truncate block"
236+
:title="feature.id"
237+
>{{ feature.id }}</span
238+
>
236239
</div>
237240
<div
238241
class="w-4 h-4 border border-ide-border rounded flex items-center justify-center transition-colors"
@@ -405,7 +408,8 @@ const manualFeatures = computed(() => {
405408
>Manual Reference</span
406409
>
407410
<span
408-
class="text-[8px] font-mono text-ide-text-muted truncate pr-4"
411+
class="text-[8px] font-mono text-ide-text-muted truncate block pr-4"
412+
:title="String(id)"
409413
>{{ id }}</span
410414
>
411415
</div>

src/components/layout/ActivityBar.vue

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
<script setup lang="ts">
2-
type Section =
3-
| "general"
4-
| "features"
5-
| "ports"
6-
| "history"
7-
| "advanced"
8-
| "presets";
2+
import type { Section } from "../../types";
93
104
defineProps<{
115
activeSection: Section;
@@ -128,15 +122,15 @@ defineEmits<{
128122
</svg>
129123
</div>
130124
<div
131-
@click="$emit('update:activeSection', 'history')"
125+
@click="$emit('update:activeSection', 'mounts')"
132126
class="activity-item group"
133-
:class="{ active: activeSection === 'history' }"
127+
:class="{ active: activeSection === 'mounts' }"
134128
title="Mounts"
135129
>
136130
<svg
137131
class="w-6 h-6"
138132
:class="
139-
activeSection === 'history'
133+
activeSection === 'mounts'
140134
? 'text-ide-text-bright'
141135
: 'text-ide-text-muted group-hover:text-ide-text'
142136
"

src/components/layout/MobileSectionNav.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script setup lang="ts">
2-
import { CONFIG_SECTIONS, type Section } from "../../constants/ui";
2+
import { CONFIG_SECTIONS } from "../../constants/ui";
3+
import type { Section } from "../../types";
34
45
defineProps<{
56
activeSection: Section;

src/components/presets/PresetCard.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ const iconError = ref(false);
5858
<div class="flex items-center gap-2">
5959
<span
6060
class="text-[11px] font-black uppercase tracking-wider truncate"
61+
:title="preset.name"
6162
:class="loading ? 'text-ide-accent' : 'text-ide-text-bright'"
6263
>
6364
{{ preset.name }}
@@ -67,9 +68,11 @@ const iconError = ref(false);
6768
class="w-2.5 h-2.5 border border-ide-accent border-t-transparent rounded-full animate-spin"
6869
></span>
6970
</div>
70-
<span class="text-[8px] font-mono text-ide-text-muted truncate">{{
71-
preset.image
72-
}}</span>
71+
<span
72+
class="text-[8px] font-mono text-ide-text-muted truncate"
73+
:title="preset.image"
74+
>{{ preset.image }}</span
75+
>
7376
</div>
7477
</div>
7578

src/components/presets/PresetsGallery.vue

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type {
55
OfficialTemplate,
66
PresetConfigState,
77
TemplateOption,
8+
PresetApplyPayload,
89
} from "../../types";
910
import {
1011
usePresets,
@@ -15,15 +16,7 @@ import PresetConfigForm from "./PresetConfigForm.vue";
1516
import SectionHeader from "../SectionHeader.vue";
1617
1718
const emit = defineEmits<{
18-
(
19-
e: "apply",
20-
data: {
21-
orchestration: OrchestrationType;
22-
config: any;
23-
dockerfile: string | null;
24-
dockerCompose: string | null;
25-
},
26-
): void;
19+
(e: "apply", data: PresetApplyPayload): void;
2720
}>();
2821
2922
const { templates, loading, error, refresh, fetchTemplateConfig } =

src/composables/useEditorActions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { ref, type Ref } from "vue";
22
import JSZip from "jszip";
3+
import type { EditorFile } from "../types";
34

45
export function useEditorActions(
5-
allFiles: Ref<Record<string, { content: string; language: string }>>,
6+
allFiles: Ref<Record<string, EditorFile>>,
67
activeFile: Ref<string>,
78
reset: () => void,
89
getShareUrl: () => string,

src/composables/useFeatures.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,6 @@
11
import { ref, onMounted } from "vue";
22
import { DATA_URLS } from "../constants/urls";
3-
4-
export interface FeatureOption {
5-
type: "string" | "boolean";
6-
description?: string;
7-
default?: any;
8-
proposals?: any[];
9-
enum?: any[];
10-
}
11-
12-
export interface FeatureMetadata {
13-
id: string;
14-
name: string;
15-
description?: string;
16-
options?: Record<string, FeatureOption>;
17-
category?: string;
18-
documentationURL?: string;
19-
}
3+
import type { FeatureMetadata } from "../types";
204

215
export function useFeatures() {
226
const features = ref<FeatureMetadata[]>([]);

0 commit comments

Comments
 (0)