Skip to content

Commit 709a80e

Browse files
committed
change admin theme, fix erros and resolved sensivity issue in calculation logic
1 parent 1f829bc commit 709a80e

9 files changed

Lines changed: 291 additions & 120 deletions

File tree

components/admin/AdminLayout.tsx

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ import {
1313
IoCloseOutline,
1414
IoChevronDownOutline,
1515
IoChevronForwardOutline,
16-
IoSpeedometerOutline,
17-
IoCheckmarkCircleOutline,
1816
} from 'react-icons/io5';
1917

2018
interface AdminLayoutProps {
@@ -133,9 +131,8 @@ export default function AdminLayout({ children }: AdminLayoutProps) {
133131
<div className="flex min-h-screen flex-col md:flex-row">
134132
{/* Sidebar */}
135133
<aside
136-
className={`${
137-
sidebarOpen ? 'translate-x-0' : '-translate-x-full'
138-
} md:translate-x-0 fixed md:static inset-y-0 left-0 z-40 w-64 bg-black border-r border-white/10 transition-transform duration-300 md:transition-none`}
134+
className={`${sidebarOpen ? 'translate-x-0' : '-translate-x-full'
135+
} md:translate-x-0 fixed inset-y-0 left-0 z-40 w-64 bg-black border-r border-white/10 transition-transform duration-300 md:transition-none`}
139136
>
140137
<div className="h-full flex flex-col">
141138
{/* Desktop Header */}
@@ -183,11 +180,10 @@ export default function AdminLayout({ children }: AdminLayoutProps) {
183180
{/* Group Header */}
184181
<button
185182
onClick={() => toggleGroup(group.label)}
186-
className={`w-full flex items-center justify-between px-3 py-2.5 rounded-lg transition-colors font-medium text-sm ${
187-
hasActiveItem
183+
className={`w-full flex items-center justify-between px-3 py-2.5 rounded-lg transition-colors font-medium text-sm ${hasActiveItem
188184
? 'text-white bg-white/5'
189185
: 'text-neutral-400 hover:bg-white/5 hover:text-white'
190-
}`}
186+
}`}
191187
>
192188
<div className="flex items-center gap-3">
193189
<GroupIcon className="w-4 h-4" />
@@ -217,11 +213,10 @@ export default function AdminLayout({ children }: AdminLayoutProps) {
217213
<Link
218214
href={item.href}
219215
onClick={() => setSidebarOpen(false)}
220-
className={`flex items-center gap-3 px-3 py-2 rounded-lg transition-colors text-sm ${
221-
isActiveItem
216+
className={`flex items-center gap-3 px-3 py-2 rounded-lg transition-colors text-sm ${isActiveItem
222217
? 'font-bold text-white bg-white/5 border border-white/10'
223218
: 'text-neutral-400 hover:bg-white/5 hover:text-white'
224-
}`}
219+
}`}
225220
>
226221
<ItemIcon className="w-4 h-4" />
227222
<span>{item.label}</span>
@@ -274,7 +269,7 @@ export default function AdminLayout({ children }: AdminLayoutProps) {
274269
</aside>
275270

276271
{/* Main Content */}
277-
<main className="flex-1 px-4 md:px-8 py-6 md:py-8 overflow-y-auto">
272+
<main className="flex-1 px-4 md:px-8 py-6 md:py-8 overflow-y-auto md:ml-64">
278273
{children}
279274
</main>
280275
</div>

cron.log

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
npm error Missing script: "warm-cache"
2+
npm error
3+
npm error To see a list of scripts, run:
4+
npm error npm run
5+
npm error A complete log of this run can be found in: C:\Users\THINKPAD\AppData\Local\npm-cache\_logs\2026-01-20T02_01_34_515Z-debug-0.log

lib/admin.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export async function getUserByIdentifier(identifier: string): Promise<User | nu
3838
// Note: This is not ideal for large user bases, but Supabase doesn't have a direct email search endpoint
3939
const { data: usersList, error: listError } = await supabaseAdmin.auth.admin.listUsers();
4040
if (!listError && usersList?.users) {
41-
const user = usersList.users.find(u =>
41+
const user = usersList.users.find(u =>
4242
u.email?.toLowerCase() === identifier.toLowerCase()
4343
);
4444
if (user) return user;
@@ -81,9 +81,10 @@ export async function getGlobalAccuracy(): Promise<{
8181
if (record.predictions && Array.isArray(record.predictions)) {
8282
record.predictions.forEach((p: any) => {
8383
total++;
84-
if (p.result === 'Won') won++;
85-
else if (p.result === 'Lost') lost++;
86-
else if (p.result === 'Postponed') postponed++;
84+
const res = p.result ? p.result.toLowerCase() : '';
85+
if (res === 'won' || res === 'win') won++;
86+
else if (res === 'lost' || res === 'loss') lost++;
87+
else if (res === 'postponed') postponed++;
8788
else pending++;
8889
});
8990
}
@@ -188,7 +189,8 @@ export async function getPendingMatches(): Promise<Array<{
188189
historyData.forEach((record: any) => {
189190
if (record.predictions && Array.isArray(record.predictions)) {
190191
record.predictions.forEach((p: any) => {
191-
if (p.result === 'Pending') {
192+
const res = p.result ? p.result.toLowerCase() : '';
193+
if (res === 'pending' || res === '' || !p.result) {
192194
pendingMatches.push({
193195
id: p.id,
194196
homeTeam: p.homeTeam,
@@ -207,4 +209,4 @@ export async function getPendingMatches(): Promise<Array<{
207209
} catch {
208210
return [];
209211
}
210-
}
212+
}

package-lock.json

Lines changed: 68 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@
4242
"ts-node": "^10.9.2",
4343
"typescript": "^5"
4444
}
45-
}
45+
}

0 commit comments

Comments
 (0)