mirror of
https://github.com/luckyyzh/pi-agent-integrated.git
synced 2026-10-03 02:59:35 +00:00
147 lines
4.0 KiB
TypeScript
147 lines
4.0 KiB
TypeScript
"use client";
|
|
|
|
import { useI18n } from "@/hooks/useI18n";
|
|
|
|
export function ProjectTrustDialog({
|
|
cwd,
|
|
busy,
|
|
error,
|
|
onCancel,
|
|
onConfirm,
|
|
}: {
|
|
cwd: string;
|
|
busy: boolean;
|
|
error: string | null;
|
|
onCancel: () => void;
|
|
onConfirm: () => void;
|
|
}) {
|
|
const { t } = useI18n();
|
|
|
|
return (
|
|
<div
|
|
role="presentation"
|
|
style={{
|
|
position: "fixed",
|
|
inset: 0,
|
|
zIndex: 1100,
|
|
display: "flex",
|
|
alignItems: "center",
|
|
justifyContent: "center",
|
|
padding: 16,
|
|
background: "rgba(0,0,0,0.4)",
|
|
}}
|
|
onClick={(event) => {
|
|
if (!busy && event.target === event.currentTarget) onCancel();
|
|
}}
|
|
>
|
|
<div
|
|
role="dialog"
|
|
aria-modal="true"
|
|
aria-labelledby="project-trust-title"
|
|
style={{
|
|
width: 440,
|
|
maxWidth: "100%",
|
|
border: "1px solid var(--border)",
|
|
borderRadius: 8,
|
|
background: "var(--bg-panel)",
|
|
boxShadow: "0 12px 36px rgba(0,0,0,0.24)",
|
|
overflow: "hidden",
|
|
}}
|
|
>
|
|
<div style={{ display: "flex", gap: 12, padding: "18px 18px 14px" }}>
|
|
<svg
|
|
width="20"
|
|
height="20"
|
|
viewBox="0 0 24 24"
|
|
fill="none"
|
|
stroke="#f59e0b"
|
|
strokeWidth="2"
|
|
strokeLinecap="round"
|
|
strokeLinejoin="round"
|
|
aria-hidden="true"
|
|
style={{ flexShrink: 0, marginTop: 1 }}
|
|
>
|
|
<path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10Z" />
|
|
<path d="m9 12 2 2 4-4" />
|
|
</svg>
|
|
<div style={{ minWidth: 0 }}>
|
|
<div id="project-trust-title" style={{ fontSize: 15, fontWeight: 700, color: "var(--text)" }}>
|
|
{t("trust.dialogTitle")}
|
|
</div>
|
|
<div style={{ marginTop: 7, fontSize: 12, lineHeight: 1.6, color: "var(--text-muted)" }}>
|
|
{t("trust.dialogBody")}
|
|
</div>
|
|
<code
|
|
style={{
|
|
display: "block",
|
|
marginTop: 10,
|
|
padding: "8px 10px",
|
|
border: "1px solid var(--border)",
|
|
borderRadius: 5,
|
|
background: "var(--bg)",
|
|
color: "var(--text)",
|
|
fontFamily: "var(--font-mono)",
|
|
fontSize: 11,
|
|
overflowWrap: "anywhere",
|
|
}}
|
|
>
|
|
{cwd}
|
|
</code>
|
|
{error && (
|
|
<div role="alert" style={{ marginTop: 10, color: "#ef4444", fontSize: 12, lineHeight: 1.5 }}>
|
|
{error}
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
<div
|
|
style={{
|
|
display: "flex",
|
|
justifyContent: "flex-end",
|
|
gap: 8,
|
|
padding: "10px 18px",
|
|
borderTop: "1px solid var(--border)",
|
|
}}
|
|
>
|
|
<button
|
|
type="button"
|
|
onClick={onCancel}
|
|
disabled={busy}
|
|
style={{
|
|
height: 32,
|
|
padding: "0 12px",
|
|
border: "1px solid var(--border)",
|
|
borderRadius: 5,
|
|
background: "transparent",
|
|
color: "var(--text-muted)",
|
|
cursor: busy ? "not-allowed" : "pointer",
|
|
fontSize: 12,
|
|
}}
|
|
>
|
|
{t("trust.cancel")}
|
|
</button>
|
|
<button
|
|
type="button"
|
|
onClick={onConfirm}
|
|
disabled={busy}
|
|
style={{
|
|
height: 32,
|
|
padding: "0 12px",
|
|
border: "1px solid var(--accent)",
|
|
borderRadius: 5,
|
|
background: "var(--accent)",
|
|
color: "white",
|
|
cursor: busy ? "wait" : "pointer",
|
|
opacity: busy ? 0.7 : 1,
|
|
fontSize: 12,
|
|
fontWeight: 600,
|
|
}}
|
|
>
|
|
{busy ? t("trust.trusting") : t("trust.trustProject")}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|