Align the Wails desktop shell with the macOS Tahoe visual design: - Add bundled open-source Inter Variable (Latin) and multi-weight CJK font mapping tuned for Windows DirectWrite readability - Refine VMPage with compact Studio Display stand, 2x3 icon spec card, inline telemetry meters, single-row Connection list, numbered install guide, and one-click tech summary copy - Move LogPanel to full-width status bar with ambient WHPX status and pointer-captured vertical resize handle - Upgrade HostView tiles, InstallersPage skeletons/empty state, system theme detection, and unified Segmented/Switch primitives - Refine translucent chrome surfaces, GPU scaleX meters/progress, toast swipe/enter motion, and reduced-motion/transparency/contrast support
60 lines
2.1 KiB
TypeScript
60 lines
2.1 KiB
TypeScript
import * as Alert from '@radix-ui/react-alert-dialog'
|
|
import React, { useState } from 'react'
|
|
import { t } from '../i18n'
|
|
import { Locale } from '../types'
|
|
|
|
interface Props {
|
|
locale: Locale
|
|
vmName: string
|
|
guestToolsConnected: boolean
|
|
onCancel: () => void
|
|
onConfirm: (text: string) => void
|
|
}
|
|
|
|
export const SendTextDialog: React.FC<Props> = ({ locale, vmName, guestToolsConnected, onCancel, onConfirm }) => {
|
|
const [text, setText] = useState('')
|
|
const canSend = text.length > 0
|
|
|
|
return (
|
|
<Alert.Root open onOpenChange={(open) => { if (!open) onCancel() }}>
|
|
<Alert.Portal>
|
|
<Alert.Overlay className="overlay" />
|
|
<Alert.Content className="dialog sm">
|
|
<div className="dialog-body">
|
|
<Alert.Title className="dialog-title">{t(locale, 'sendTextTitle', { name: vmName })}</Alert.Title>
|
|
<Alert.Description className="dialog-desc">
|
|
{t(locale, guestToolsConnected ? 'sendTextDesc' : 'sendTextDescNoGT')}
|
|
</Alert.Description>
|
|
<div className="field field-spaced">
|
|
<textarea
|
|
className="input textarea"
|
|
rows={4}
|
|
placeholder={t(locale, 'sendTextPlaceholder')}
|
|
value={text}
|
|
onChange={(e) => setText(e.target.value)}
|
|
onKeyDown={(e) => {
|
|
if (e.key === 'Enter' && (e.ctrlKey || e.metaKey) && canSend) {
|
|
e.preventDefault()
|
|
onConfirm(text)
|
|
}
|
|
}}
|
|
autoFocus
|
|
/>
|
|
</div>
|
|
</div>
|
|
<div className="dialog-foot">
|
|
<Alert.Cancel asChild>
|
|
<button type="button" className="btn">{t(locale, 'cancel')}</button>
|
|
</Alert.Cancel>
|
|
<Alert.Action asChild>
|
|
<button type="button" className="btn btn-primary" disabled={!canSend} onClick={() => onConfirm(text)}>
|
|
{t(locale, 'sendTextConfirm')}
|
|
</button>
|
|
</Alert.Action>
|
|
</div>
|
|
</Alert.Content>
|
|
</Alert.Portal>
|
|
</Alert.Root>
|
|
)
|
|
}
|