/** * Port Forwarding Wizard Content * Renders step-by-step wizard content for creating port forwarding rules */ import { Check } from 'lucide-react'; import React from 'react'; import { useI18n } from '../../application/i18n/I18nProvider'; import { Host,PortForwardingRule,PortForwardingType } from '../../domain/models'; import { cn } from '../../lib/utils'; import { DistroAvatar } from '../DistroAvatar'; import { TrafficDiagram } from '../TrafficDiagram'; import { Button } from '../ui/button'; import { Input } from '../ui/input'; import { Label } from '../ui/label'; import { getTypeDescription } from './utils'; export type WizardStep = 'type' | 'local-config' | 'remote-host-selection' | 'remote-config' | 'destination' | 'host-selection' | 'label'; export interface WizardContentProps { step: WizardStep; type: PortForwardingType; draft: Partial; hosts: Host[]; onTypeChange: (type: PortForwardingType) => void; onDraftChange: (updates: Partial) => void; onOpenHostSelector: () => void; } export const WizardContent: React.FC = ({ step, type, draft, hosts, onTypeChange, onDraftChange, onOpenHostSelector, }) => { const { t } = useI18n(); const selectedHost = hosts.find(h => h.id === draft.hostId); switch (step) { case 'type': return ( <>
{t('pf.wizard.type.title')}
{(['local', 'remote', 'dynamic'] as PortForwardingType[]).map((pfType) => ( ))}

{getTypeDescription(t, type)}

); case 'local-config': return ( <>
{t('pf.wizard.localConfig.title')}

{t('pf.wizard.localConfig.desc')}

onDraftChange({ localPort: parseInt(e.target.value) || undefined })} />
onDraftChange({ bindAddress: e.target.value })} />
); case 'remote-host-selection': return ( <>
{t('pf.wizard.remoteHost.title')}

{t('pf.wizard.remoteHost.desc')}

); case 'remote-config': return ( <>
{t('pf.wizard.remoteConfig.title')}

{t('pf.wizard.remoteConfig.desc')}

onDraftChange({ localPort: parseInt(e.target.value) || undefined })} />
onDraftChange({ bindAddress: e.target.value })} />
); case 'destination': return ( <>
{t('pf.wizard.destination.title')}

{type === 'local' ? t('pf.wizard.destination.desc.local') : t('pf.wizard.destination.desc.remote') }

onDraftChange({ remoteHost: e.target.value })} />
onDraftChange({ remotePort: parseInt(e.target.value) || undefined })} />
); case 'host-selection': return ( <>
{t('pf.wizard.sshServer.title')}

{type === 'dynamic' ? t('pf.wizard.sshServer.desc.dynamic') : t('pf.wizard.sshServer.desc.default') }

{/* Rule label */}
onDraftChange({ label: e.target.value })} />
); case 'label': return ( <>
{t('pf.wizard.label.title')}
onDraftChange({ label: e.target.value })} />
); default: return null; } }; export default WizardContent;