Commit e8043f26 authored by Mahmoud Aglan's avatar Mahmoud Aglan

fix: admin branding — English labels, effective color saving, full coverage

- All Arabic labels replaced with English descriptive labels
- API save_theme now also writes local theme.json (prevents stale overrides)
- Added Ludo Board Colors section (9 controls)
- Added Backgammon Board Colors section (14 controls)
- Page lang/dir switched from ar/rtl to en/ltr
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 9b2a459c
This diff is collapsed.
...@@ -53,7 +53,6 @@ if ($method === 'POST') { ...@@ -53,7 +53,6 @@ if ($method === 'POST') {
$values = $input['values'] ?? []; $values = $input['values'] ?? [];
foreach ($values as $key => $value) { foreach ($values as $key => $value) {
if (empty($key) || $value === null) continue; if (empty($key) || $value === null) continue;
// Upsert: try update first, if no rows affected, insert
$existing = $sdb->get('platform_theme', ['id' => 'eq.' . $key, 'select' => 'id', 'limit' => 1]); $existing = $sdb->get('platform_theme', ['id' => 'eq.' . $key, 'select' => 'id', 'limit' => 1]);
if (!empty($existing) && !isset($existing['error'])) { if (!empty($existing) && !isset($existing['error'])) {
$sdb->update('platform_theme', ['value' => $value], ['id' => 'eq.' . $key]); $sdb->update('platform_theme', ['value' => $value], ['id' => 'eq.' . $key]);
...@@ -69,6 +68,13 @@ if ($method === 'POST') { ...@@ -69,6 +68,13 @@ if ($method === 'POST') {
]); ]);
} }
} }
// Also update local theme.json so admin page stays in sync
$themeFile = __DIR__ . '/../public/assets/brand/theme.json';
$brandDir = dirname($themeFile);
if (!is_dir($brandDir)) mkdir($brandDir, 0777, true);
$local = file_exists($themeFile) ? (json_decode(file_get_contents($themeFile), true) ?: []) : [];
$local = array_merge($local, $values);
file_put_contents($themeFile, json_encode($local, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
jsonResponse(['success' => true]); jsonResponse(['success' => true]);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment