mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
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:
1 parent
505f31844e
commit
86a4b52053
1 file changed
+3
-1
@@ -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>
|
||||
|
||||
Reference in new issue
Block a user