/** * Restore Modal — confirmation before overwriting current file * Ball Studios */ import React, { useState } from 'react'; import http from '@/api/http'; interface Props { serverUuid: string; revision: { id: number; revision_number: number; change_summary: string }; onClose: () => void; onRestored: () => void; } export default function RestoreModal({ serverUuid, revision, onClose, onRestored }: Props) { const [loading, setLoading] = useState(false); const [error, setError] = useState(null); const handleRestore = async () => { setLoading(true); setError(null); try { await http.post(`/api/client/servers/${serverUuid}/addons/files/revisions/${revision.id}/restore`); onRestored(); } catch (e: any) { setError(e?.response?.data?.errors?.[0]?.detail ?? 'Restore failed.'); } finally { setLoading(false); } }; return (
🔄

Restore Revision #{revision.revision_number}?

This will overwrite the current file with revision #{revision.revision_number}.
{revision.change_summary}

{error &&

{error}

}
); }