-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTrustHostModal.tsx
More file actions
59 lines (57 loc) · 2.01 KB
/
Copy pathTrustHostModal.tsx
File metadata and controls
59 lines (57 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import type { KeyboardEvent as ReactKeyboardEvent } from "react";
import type { TrustPromptRequest } from "../features/session-model";
export type TrustHostModalProps = {
prompt: TrustPromptRequest;
saveTrustHostAsDefault: boolean;
onSaveTrustDefaultChange: (value: boolean) => void;
onClose: (sessionId: string) => void;
onAccept: () => void;
onKeyDown: (event: ReactKeyboardEvent<HTMLElement>) => void;
};
export function TrustHostModal({
prompt,
saveTrustHostAsDefault,
onSaveTrustDefaultChange,
onClose,
onAccept,
onKeyDown,
}: TrustHostModalProps) {
return (
<div className="app-settings-overlay" onClick={() => onClose(prompt.sessionId)}>
<section
className="app-settings-modal panel trust-host-modal"
onClick={(event) => event.stopPropagation()}
onKeyDown={onKeyDown}
>
<header className="panel-header">
<h2>Trust host key</h2>
<button className="btn" onClick={() => onClose(prompt.sessionId)}>
Close
</button>
</header>
<div className="app-settings-content">
<p className="muted-copy">
Session <strong>{prompt.sessionId}</strong> requests trust confirmation for host <strong>{prompt.hostLabel}</strong>.
</p>
<label className="field checkbox-field trust-default-checkbox">
<input
className="checkbox-input"
type="checkbox"
checked={saveTrustHostAsDefault}
onChange={(event) => onSaveTrustDefaultChange(event.target.checked)}
/>
<span className="field-label">Save as default for this host</span>
</label>
<div className="action-row">
<button className="btn" onClick={() => onClose(prompt.sessionId)}>
Dismiss
</button>
<button className="btn btn-primary" onClick={() => void onAccept()} autoFocus>
Trust host
</button>
</div>
</div>
</section>
</div>
);
}