Fix: Admin Dashboard accessibility and config prop passing

This commit is contained in:
Quintine committed 2026-05-20 13:51:48 +10:00
1 parent fd1d7c0025
commit 993f3bd30b
2 files changed
+5 -5

No files matched your search

+1 -1
View File
@@ -158,7 +158,7 @@ function App() {
<main className="max-w-6xl mx-auto px-4 py-8">
{notification && <div className="fixed bottom-4 right-4 bg-red-600 text-white px-6 py-3 rounded-lg shadow-2xl animate-bounce z-50 font-bold tracking-wide border border-red-400">{notification}</div>}
{view === 'customer' ? <CustomerView stock={stock} addToCart={addToCart} config={config} /> : <AdminDashboard stock={stock} orders={orders} refreshData={refreshData} notify={showNotification} promptConfirm={promptConfirm} />}
{view === 'customer' ? <CustomerView stock={stock} addToCart={addToCart} config={config} /> : <AdminDashboard stock={stock} orders={orders} config={config} refreshData={refreshData} notify={showNotification} promptConfirm={promptConfirm} />}
</main>
{showCartModal && <CartModal cart={cart} config={config} onClose={() => setShowCartModal(false)} onRemove={removeFromCart} onUpdateQty={updateCartQty} onSubmit={submitOrder} />}
+4 -4
View File
@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
import { Icons } from './Icons';
import { API } from '../services/api';
export default function AdminDashboard({ stock, orders, refreshData, notify, promptConfirm }: any) {
export default function AdminDashboard({ stock, orders, config, refreshData, notify, promptConfirm }: any) {
const [tab, setTab] = useState<'orders' | 'stock' | 'settings'>('orders');
const [newAdminCode, setNewAdminCode] = useState('');
@@ -189,7 +189,7 @@ export default function AdminDashboard({ stock, orders, refreshData, notify, pro
<label className="block text-xs font-bold text-stone-500 uppercase mb-2">Final Deposit Date</label>
<input
type="datetime-local"
value={stock.config?.finalDepositDate || ''}
value={config?.finalDepositDate || ''}
onChange={(e) => API.updateConfig({ finalDepositDate: e.target.value }).then(refreshData)}
className="w-full bg-stone-900 border border-stone-700 rounded p-3 text-white focus:border-red-600 outline-none"
/>
@@ -198,7 +198,7 @@ export default function AdminDashboard({ stock, orders, refreshData, notify, pro
<label className="block text-xs font-bold text-stone-500 uppercase mb-2">Scheduled Cook Day</label>
<input
type="date"
value={stock.config?.cookDay || ''}
value={config?.cookDay || ''}
onChange={(e) => API.updateConfig({ cookDay: e.target.value }).then(refreshData)}
className="w-full bg-stone-900 border border-stone-700 rounded p-3 text-white focus:border-red-600 outline-none"
/>
@@ -209,7 +209,7 @@ export default function AdminDashboard({ stock, orders, refreshData, notify, pro
<input
type="text"
placeholder="e.g. 0400 000 000 or email@domain.com"
value={stock.config?.payIdInfo || ''}
value={config?.payIdInfo || ''}
onChange={(e) => API.updateConfig({ payIdInfo: e.target.value }).then(refreshData)}
className="w-full bg-stone-900 border border-stone-700 rounded p-3 text-white focus:border-red-600 outline-none"
/>