fix(admin): danger-zone result colour driven by mutation state

P18. Replace the brittle "wipeMsg.startsWith(localized prefix)" success
heuristic with React Query's `wipeAllData.isError` flag. The previous
heuristic (a) re-formatted the success copy with empty placeholders to
extract a prefix, (b) string-prefix-matched against the rendered
message, and (c) silently broke whenever the i18n copy changed colon
position or got translated. Now the colour follows the mutation state
directly: error → destructive, success → dracula-green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Marc-André BombeckandClaude Opus 4.7 committed 2026-05-09 02:09:57 +02:00
1 parent 505f31844e
commit 86a4b52053
1 file changed
+3 -1
+3 -1
View File
@@ -113,7 +113,9 @@ export function DangerZoneSection({ id }: { id: string }) {
</div>
{wipeMsg && (
<p
className={`mt-2 text-sm ${wipeMsg.startsWith(t("admin.deletedResult", { measurements: "", medications: "", intakeEvents: "", apiTokens: "", withingsConnections: "", authChallenges: "" }).split(":")[0]) ? "text-dracula-green" : "text-destructive"}`}
className={`mt-2 text-sm ${
wipeAllData.isError ? "text-destructive" : "text-dracula-green"
}`}
>
{wipeMsg}
</p>