Fixing build errors typescript

This commit is contained in:
Mitchell Magro 2025-07-18 07:27:16 +02:00
parent 5313c10401
commit ad660904bb
15 changed files with 55 additions and 35 deletions

View File

@ -3,7 +3,18 @@ import { CardContent, Typography, Divider, List, ListItem, ListItemText, Paper,
import MoreVertIcon from '@mui/icons-material/MoreVert';
export const SectionCard = ({ title, icon, items }) => (
interface SectionCardItem {
title: string;
date?: string;
}
interface SectionCardProps {
title: string;
icon?: React.ReactNode;
items: SectionCardItem[];
}
export const SectionCard: React.FC<SectionCardProps> = ({ title, icon, items }) => (
<Paper elevation={3} sx={{ padding: 2, margin: 2, display: 'flex', flexDirection: 'column' }}>
<CardContent>
<Box sx={{ display: 'flex', justifyContent: 'space-between', mb: 2 }}>

View File

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import {
Box,
Button,

View File

@ -5,10 +5,10 @@ import {
Select,
MenuItem,
SelectChangeEvent,
ListItemIcon,
ListItemText,
} from '@mui/material';
import { SIDEBAR_LINKS } from '@/constants/SidebarLink.constants';
import { ISidebarLink } from '@/interfaces/SidebarLink.interfaces';
interface Props {
onChange?: (event: SelectChangeEvent<string>) => void;
@ -31,7 +31,7 @@ export default function SidebarDropdown({ onChange }: Props) {
onChange={handleChange}
label="Navigate To"
>
{SIDEBAR_LINKS.map((link:any) => (
{SIDEBAR_LINKS.map((link:ISidebarLink) => (
<MenuItem key={link.path} value={link.path}>
<ListItemText primary={link.title} />
</MenuItem>

View File

@ -1,22 +1,17 @@
import React, { useState } from 'react';
import { AppBar, Toolbar, IconButton, Menu, MenuItem, Button } from '@mui/material';
import { AppBar, Toolbar, IconButton, Menu, MenuItem } from '@mui/material';
import MenuIcon from '@mui/icons-material/Menu';
import Dropdown from './DropDown';
const Header = () => {
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
// Handle menu open
const handleMenuClick = (event: React.MouseEvent<HTMLElement>) => {
setAnchorEl(event.currentTarget);
};
// Handle menu close
const handleMenuClose = () => {
setAnchorEl(null);
};
const handleChange = (e:any) => {
const handleChange = () => {
};
return (

View File

@ -1,9 +1,12 @@
"use client"
import React from 'react';
import { Box, Chip, Typography, Button } from '@mui/material';
import { useRouter, useSearchParams } from 'next/navigation';
interface SearchFiltersProps {
filters: Record<string, string>;
onDeleteFilter?: (key: string) => void;
onClearAll?: () => void;
}
const SearchFilters = ({ filters }: SearchFiltersProps) => {

View File

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import * as React from "react";
import Box from "@mui/material/Box";
import Drawer from "@mui/material/Drawer";

View File

@ -1,4 +1,4 @@
// app/transactions/page.tsx
/* eslint-disable @typescript-eslint/no-explicit-any */
"use client";
import { useState } from "react";

View File

@ -5,10 +5,25 @@ export default async function BackOfficeUsersPage() {
process.env.NEXT_PUBLIC_BASE_URL || process.env.VERCEL_URL
? `https://${process.env.VERCEL_URL}`
: "http://localhost:3000";
const res = await fetch(`${baseUrl}ss/api/dashboard/admin/users`, {
cache: "no-store", // 👈 disables caching for SSR freshness
let users = [];
try {
const res = await fetch(`${baseUrl}/api/dashboard/admin/users`, {
// cache: "no-store", // optional: disable SSR caching if needed
});
const users = await res.json();
if (!res.ok) {
// If the API responds with 500/404/etc., log and bail gracefully
console.error(
`Failed to fetch users: ${res.status} ${res.statusText}`
);
} else {
users = await res.json();
}
} catch (error) {
console.error("Error fetching users:", error);
}
return (
<div>

View File

@ -1,8 +1,7 @@
// This ensures this component is rendered only on the client side
"use client";
import { Approve } from "@/app/features/pages/Approve/Approve";
import { Approve } from "@/app/components/pages/Approve/Approve";
export default function ApprovePage() {
return (

View File

@ -1,7 +1,7 @@
// This ensures this component is rendered only on the client side
"use client";
import TransactionTable from "@/app/features/Pages/Transactions/Transactions";
import TransactionTable from "@/app/components/pages/transactions/Transactions";
export default function TransactionPage() {
return (

View File

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import {
Box,
Button,

View File

@ -6,17 +6,6 @@ import AccountMenu from "./accountMenu/AccountMenu";
import "./Header.scss";
const Header = () => {
// const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
// // Handle menu open
// const handleMenuClick = (event: React.MouseEvent<HTMLElement>) => {
// setAnchorEl(event.currentTarget);
// };
// // Handle menu close
// const handleMenuClose = () => {
// setAnchorEl(null);
// };
const handleChange = () => {};

View File

@ -4,7 +4,7 @@ import { useEffect } from "react";
export function MSWProvider({ children }: { children: React.ReactNode }) {
useEffect(() => {
if (process.env.NEXT_PUBLIC_API_MOCKING === "enabled") {
import("../../mock/browser").then(({ worker }) => {
import("../../mock/browser").then(({ }) => {
// worker.start();
});
}

View File

@ -1,6 +1,11 @@
'use client'
"use client"
import dynamic from "next/dynamic";
import React, { useState } from 'react';
import SearchFilters from '../components/searchFilter/SearchFilters';
const SearchFilters = dynamic(
() => import("../components/searchFilter/SearchFilters"),
{ ssr: false }
);
export default function Home() {
const [filters, setFilters] = useState({
@ -9,12 +14,12 @@ export default function Home() {
startDate: '2025-06-28 23:25',
});
const handleDeleteFilter = (key) => {
const handleDeleteFilter = (key: string) => {
setFilters((prev) => ({ ...prev, [key]: null }));
};
const handleClearAll = () => {
setFilters({ user: null, state: null, startDate: null });
setFilters({ user: '', state: '', startDate: '' });
};
return (

View File

@ -1,4 +1,4 @@
// app/products/page.tsx
/* eslint-disable @typescript-eslint/no-explicit-any */
'use client';
import { useState } from 'react';