Start fixing MDI

This commit is contained in:
2025-04-22 13:54:57 +02:00
parent 792272a478
commit f3b508c9f7
8 changed files with 461 additions and 228 deletions

View File

@@ -1,4 +1,4 @@
import { ProfileManager } from '$lib/profiles/ProfileManager';
// No need to import ProfileManager here
import { get } from 'svelte/store';
import { activeProfile } from '$lib/stores/mudStore';
import type { MudProfile } from '$lib/profiles/ProfileManager';
@@ -12,7 +12,6 @@ import TriggerEditor from '$lib/components/TriggerEditor.svelte';
*/
export class ModalHelper {
private static modal: Modal | null = null;
private static profileManager = new ProfileManager();
/**
* Show the full-featured profile editor modal
@@ -57,8 +56,31 @@ export class ModalHelper {
throw new Error('Failed to create modal instance');
}
// Get profile to edit or create new one
const profile = existingProfile || this.profileManager.createDefaultProfile();
// Get profile to edit or use the default empty profile
const profile = existingProfile || {
id: `profile-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`,
name: 'New Profile',
host: 'mud.example.com',
port: 23,
useSSL: false,
ansiColor: true,
autoLogin: {
enabled: false,
username: '',
password: '',
commands: []
},
aliases: {},
macros: {},
gmcpPackages: [],
accessibilityOptions: {
textToSpeech: false,
highContrast: false,
speechRate: 1,
speechPitch: 1,
speechVolume: 1
}
};
const isNewProfile = !existingProfile;
console.log('Setting up modal with profile:', profile);