fix Unexpected any.

This commit is contained in:
romantarkin 2025-02-02 19:47:56 +05:00
parent 4473ed56de
commit 8b6175eb71
32 changed files with 135 additions and 73 deletions

View File

@ -20,7 +20,7 @@ services:
image: node:20 image: node:20
restart: always restart: always
working_dir: /app working_dir: /app
command: bash -c "npm install && npm run build && npm run start" command: bash -c "npm ci --force && npm run build && npm run start"
environment: environment:
MYSQL_USER: ${MYSQL_USER} MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD} MYSQL_PASSWORD: ${MYSQL_PASSWORD}
@ -28,5 +28,7 @@ services:
MYSQL_DATABASE_NAME: ${MYSQL_DATABASE_NAME} MYSQL_DATABASE_NAME: ${MYSQL_DATABASE_NAME}
volumes: volumes:
- ./:/app - ./:/app
ports:
- '3000:80'
networks: networks:
reverse_proxy: reverse_proxy:

View File

@ -1,9 +1,11 @@
import {BodyTypeItem} from "@/api/context/BodyType";
export async function list () { export async function list () {
const response = await fetch('/api/v1/body-types'); const response = await fetch('/api/v1/body-types');
return (await response.json()).results.rows; return (await response.json()).results.rows;
} }
export async function add (params: any) { export async function add (params: BodyTypeItem) {
const response = await fetch('/api/v1/body-types', { const response = await fetch('/api/v1/body-types', {
method: 'POST', method: 'POST',
headers: { headers: {
@ -14,7 +16,7 @@ export async function add (params: any) {
return await response.json(); return await response.json();
} }
export async function update (params: any) { export async function update (params: BodyTypeItem) {
const response = await fetch('/api/v1/body-types', { const response = await fetch('/api/v1/body-types', {
method: 'PUT', method: 'PUT',
headers: { headers: {
@ -30,7 +32,7 @@ export async function update (params: any) {
return await response.json(); return await response.json();
} }
export async function remove (params: any) { export async function remove (params: BodyTypeItem) {
const response = await fetch('/api/v1/body-types', { const response = await fetch('/api/v1/body-types', {
method: 'DELETE', method: 'DELETE',
headers: { headers: {

View File

@ -1,9 +1,11 @@
import {CarBrandItem} from "@/api/context/CarBrand";
export async function list () { export async function list () {
const response = await fetch('/api/v1/car-brands'); const response = await fetch('/api/v1/car-brands');
return (await response.json()).results.rows; return (await response.json()).results.rows;
} }
export async function add (params: any) { export async function add (params: CarBrandItem) {
const response = await fetch('/api/v1/car-brands', { const response = await fetch('/api/v1/car-brands', {
method: 'POST', method: 'POST',
headers: { headers: {
@ -14,7 +16,7 @@ export async function add (params: any) {
return await response.json(); return await response.json();
} }
export async function update (params: any) { export async function update (params: CarBrandItem) {
const response = await fetch('/api/v1/car-brands', { const response = await fetch('/api/v1/car-brands', {
method: 'PUT', method: 'PUT',
headers: { headers: {
@ -30,7 +32,7 @@ export async function update (params: any) {
return await response.json(); return await response.json();
} }
export async function remove (params: any) { export async function remove (params: CarBrandItem) {
const response = await fetch('/api/v1/car-brands', { const response = await fetch('/api/v1/car-brands', {
method: 'DELETE', method: 'DELETE',
headers: { headers: {

View File

@ -1,9 +1,11 @@
import {CarColorItem} from "@/api/context/CarColor";
export async function list () { export async function list () {
const response = await fetch('/api/v1/car-colors'); const response = await fetch('/api/v1/car-colors');
return (await response.json()).results.rows; return (await response.json()).results.rows;
} }
export async function add (params: any) { export async function add (params: CarColorItem) {
const response = await fetch('/api/v1/car-colors', { const response = await fetch('/api/v1/car-colors', {
method: 'POST', method: 'POST',
headers: { headers: {
@ -14,7 +16,7 @@ export async function add (params: any) {
return await response.json(); return await response.json();
} }
export async function update (params: any) { export async function update (params: CarColorItem) {
const response = await fetch('/api/v1/car-colors', { const response = await fetch('/api/v1/car-colors', {
method: 'PUT', method: 'PUT',
headers: { headers: {
@ -30,7 +32,7 @@ export async function update (params: any) {
return await response.json(); return await response.json();
} }
export async function remove (params: any) { export async function remove (params: CarColorItem) {
const response = await fetch('/api/v1/car-colors', { const response = await fetch('/api/v1/car-colors', {
method: 'DELETE', method: 'DELETE',
headers: { headers: {

View File

@ -1,9 +1,11 @@
import {CarModelItem} from "@/api/context/CarModel";
export async function list () { export async function list () {
const response = await fetch('/api/v1/car-models'); const response = await fetch('/api/v1/car-models');
return (await response.json()).results.rows; return (await response.json()).results.rows;
} }
export async function add (params: any) { export async function add (params: CarModelItem) {
const response = await fetch('/api/v1/car-models', { const response = await fetch('/api/v1/car-models', {
method: 'POST', method: 'POST',
headers: { headers: {
@ -14,7 +16,7 @@ export async function add (params: any) {
return await response.json(); return await response.json();
} }
export async function update (params: any) { export async function update (params: CarModelItem) {
const response = await fetch('/api/v1/car-models', { const response = await fetch('/api/v1/car-models', {
method: 'PUT', method: 'PUT',
headers: { headers: {
@ -30,7 +32,7 @@ export async function update (params: any) {
return await response.json(); return await response.json();
} }
export async function remove (params: any) { export async function remove (params: CarModelItem) {
const response = await fetch('/api/v1/car-models', { const response = await fetch('/api/v1/car-models', {
method: 'DELETE', method: 'DELETE',
headers: { headers: {

View File

@ -1,9 +1,11 @@
import {CarItem} from "@/api/context/Car";
export async function list () { export async function list () {
const response = await fetch('/api/v1/cars'); const response = await fetch('/api/v1/cars');
return (await response.json()).results.rows; return (await response.json()).results.rows;
} }
export async function add (params: any) { export async function add (params: CarItem) {
const response = await fetch('/api/v1/cars', { const response = await fetch('/api/v1/cars', {
method: 'POST', method: 'POST',
headers: { headers: {
@ -14,7 +16,7 @@ export async function add (params: any) {
return await response.json(); return await response.json();
} }
export async function update (params: any) { export async function update (params: CarItem) {
const response = await fetch('/api/v1/cars', { const response = await fetch('/api/v1/cars', {
method: 'PUT', method: 'PUT',
headers: { headers: {
@ -30,7 +32,7 @@ export async function update (params: any) {
return await response.json(); return await response.json();
} }
export async function remove (params: any) { export async function remove (params: CarItem) {
const response = await fetch('/api/v1/cars', { const response = await fetch('/api/v1/cars', {
method: 'DELETE', method: 'DELETE',
headers: { headers: {

View File

@ -3,13 +3,11 @@
import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react'; import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react';
import { list } from "@/api/bodyTypes"; import { list } from "@/api/bodyTypes";
interface BodyTypeItem { export interface BodyTypeItem {
id: string; id: string;
name: string; name: string;
country: string;
} }
interface BodyTypeContextType { interface BodyTypeContextType {
bodyTypes: BodyTypeItem[] | null; bodyTypes: BodyTypeItem[] | null;
setBodyTypes: (content: BodyTypeItem[] | null) => void; setBodyTypes: (content: BodyTypeItem[] | null) => void;
@ -19,7 +17,7 @@ interface BodyTypeContextType {
const BodyTypeContext = createContext<BodyTypeContextType | undefined>(undefined); const BodyTypeContext = createContext<BodyTypeContextType | undefined>(undefined);
export const BodyTypeProvider = ({ children }: { children: ReactNode }) => { export const BodyTypeProvider = ({ children }: { children: ReactNode }) => {
const [bodyTypes, setBodyTypes] = useState<any | null>(null); const [bodyTypes, setBodyTypes] = useState<BodyTypeItem[] | null>(null);
const fetchData = async () => { const fetchData = async () => {
setBodyTypes(await list()); setBodyTypes(await list());

View File

@ -3,7 +3,7 @@
import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react'; import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react';
import { list } from "@/api/cars"; import { list } from "@/api/cars";
interface CarItem { export interface CarItem {
id: string, id: string,
car_models_id: string, car_models_id: string,
engines_id: string, engines_id: string,
@ -22,7 +22,7 @@ interface CarContextType {
const CarContext = createContext<CarContextType | undefined>(undefined); const CarContext = createContext<CarContextType | undefined>(undefined);
export const CarProvider = ({ children }: { children: ReactNode }) => { export const CarProvider = ({ children }: { children: ReactNode }) => {
const [car, setCar] = useState<any | null>(null); const [car, setCar] = useState<CarItem[] | null>(null);
const fetchData = async () => { const fetchData = async () => {
setCar(await list()); setCar(await list());

View File

@ -3,7 +3,7 @@
import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react'; import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react';
import { list } from "@/api/carBrands"; import { list } from "@/api/carBrands";
interface CarBrandItem { export interface CarBrandItem {
id: string; id: string;
name: string; name: string;
country: string; country: string;
@ -18,7 +18,7 @@ interface CarBrandContextType {
const CarBrandContext = createContext<CarBrandContextType | undefined>(undefined); const CarBrandContext = createContext<CarBrandContextType | undefined>(undefined);
export const CarBrandProvider = ({ children }: { children: ReactNode }) => { export const CarBrandProvider = ({ children }: { children: ReactNode }) => {
const [carBrands, setCarBrands] = useState<any | null>(null); const [carBrands, setCarBrands] = useState<CarBrandItem[] | null>(null);
const fetchData = async () => { const fetchData = async () => {
setCarBrands(await list()); setCarBrands(await list());

View File

@ -3,8 +3,7 @@
import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react'; import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react';
import { list } from "@/api/carColors"; import { list } from "@/api/carColors";
// Define types for carColor item export interface CarColorItem {
interface CarColorItem {
id: string; id: string;
name: string; name: string;
hexCode: string; hexCode: string;

View File

@ -3,7 +3,7 @@
import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react'; import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react';
import { list } from "@/api/carModels"; import { list } from "@/api/carModels";
interface CarModelItem { export interface CarModelItem {
id: string; id: string;
name: string; name: string;
yearStart: string, yearStart: string,
@ -20,7 +20,7 @@ interface CarModelContextType {
const CarModelContext = createContext<CarModelContextType | undefined>(undefined); const CarModelContext = createContext<CarModelContextType | undefined>(undefined);
export const CarModelProvider = ({ children }: { children: ReactNode }) => { export const CarModelProvider = ({ children }: { children: ReactNode }) => {
const [carModel, setCarModel] = useState<any | null>(null); const [carModel, setCarModel] = useState<CarModelItem[] | null>(null);
const fetchData = async () => { const fetchData = async () => {
setCarModel(await list()); setCarModel(await list());

View File

@ -3,7 +3,7 @@
import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react'; import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react';
import { list } from "@/api/customers"; import { list } from "@/api/customers";
interface CustomerItem { export interface CustomerItem {
id: string; id: string;
name: string; name: string;
phone: string; phone: string;
@ -19,7 +19,7 @@ interface CustomerContextType {
const CustomerContext = createContext<CustomerContextType | undefined>(undefined); const CustomerContext = createContext<CustomerContextType | undefined>(undefined);
export const CustomerProvider = ({ children }: { children: ReactNode }) => { export const CustomerProvider = ({ children }: { children: ReactNode }) => {
const [customers, setCustomers] = useState<any | null>([]); const [customers, setCustomers] = useState<CustomerItem[] | []>([]);
const fetchData = async () => { const fetchData = async () => {
setCustomers(await list()); setCustomers(await list());

View File

@ -3,7 +3,7 @@
import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react'; import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react';
import { list } from "@/api/engines"; import { list } from "@/api/engines";
interface EngineItem { export interface EngineItem {
id: string, id: string,
type: string, type: string,
powerHR: string, powerHR: string,
@ -19,7 +19,7 @@ interface EngineContextType {
const EngineContext = createContext<EngineContextType | undefined>(undefined); const EngineContext = createContext<EngineContextType | undefined>(undefined);
export const EngineProvider = ({ children }: { children: ReactNode }) => { export const EngineProvider = ({ children }: { children: ReactNode }) => {
const [engine, setEngine] = useState<any | null>(null); const [engine, setEngine] = useState<EngineItem[] | null>(null);
const fetchData = async () => { const fetchData = async () => {
setEngine(await list()); setEngine(await list());

View File

@ -3,7 +3,7 @@
import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react'; import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react';
import { list } from "@/api/sales"; import { list } from "@/api/sales";
interface SaleItem { export interface SaleItem {
id: string, id: string,
date: string, date: string,
price: string, price: string,
@ -20,7 +20,7 @@ interface SaleContextType {
const SaleContext = createContext<SaleContextType | undefined>(undefined); const SaleContext = createContext<SaleContextType | undefined>(undefined);
export const SaleProvider = ({ children }: { children: ReactNode }) => { export const SaleProvider = ({ children }: { children: ReactNode }) => {
const [sale, setSale] = useState<any | null>(null); const [sale, setSale] = useState<SaleItem[] | null>(null);
const fetchData = async () => { const fetchData = async () => {
setSale(await list()); setSale(await list());

View File

@ -3,7 +3,7 @@
import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react'; import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react';
import { list } from "@/api/transmissions"; import { list } from "@/api/transmissions";
interface TransmissionItem { export interface TransmissionItem {
id: string, id: string,
type: string, type: string,
} }
@ -17,7 +17,7 @@ interface TransmissionContextType {
const TransmissionContext = createContext<TransmissionContextType | undefined>(undefined); const TransmissionContext = createContext<TransmissionContextType | undefined>(undefined);
export const TransmissionProvider = ({ children }: { children: ReactNode }) => { export const TransmissionProvider = ({ children }: { children: ReactNode }) => {
const [transmission, setTransmission] = useState<any | null>(null); const [transmission, setTransmission] = useState<TransmissionItem[] | null>(null);
const fetchData = async () => { const fetchData = async () => {
setTransmission(await list()); setTransmission(await list());

View File

@ -3,7 +3,7 @@
import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react'; import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react';
import { list } from "@/api/trims"; import { list } from "@/api/trims";
interface TrimItem { export interface TrimItem {
id: string; id: string;
name: string, name: string,
price: string, price: string,
@ -19,7 +19,7 @@ interface TrimContextType {
const TrimContext = createContext<TrimContextType | undefined>(undefined); const TrimContext = createContext<TrimContextType | undefined>(undefined);
export const TrimProvider = ({ children }: { children: ReactNode }) => { export const TrimProvider = ({ children }: { children: ReactNode }) => {
const [trim, setTrim] = useState<any | null>(null); const [trim, setTrim] = useState<TrimItem[] | null>(null);
const fetchData = async () => { const fetchData = async () => {
setTrim(await list()); setTrim(await list());

View File

@ -1,9 +1,11 @@
import {CustomerItem} from "@/api/context/Customer";
export async function list () { export async function list () {
const response = await fetch('/api/v1/customers'); const response = await fetch('/api/v1/customers');
return (await response.json()).results.rows; return (await response.json()).results.rows;
} }
export async function add (params: any) { export async function add (params: CustomerItem) {
const response = await fetch('/api/v1/customers', { const response = await fetch('/api/v1/customers', {
method: 'POST', method: 'POST',
headers: { headers: {
@ -14,7 +16,7 @@ export async function add (params: any) {
return await response.json(); return await response.json();
} }
export async function update (params: any) { export async function update (params: CustomerItem) {
const response = await fetch('/api/v1/customers', { const response = await fetch('/api/v1/customers', {
method: 'PUT', method: 'PUT',
headers: { headers: {
@ -30,7 +32,7 @@ export async function update (params: any) {
return await response.json(); return await response.json();
} }
export async function remove (params: any) { export async function remove (params: CustomerItem) {
const response = await fetch('/api/v1/customers', { const response = await fetch('/api/v1/customers', {
method: 'DELETE', method: 'DELETE',
headers: { headers: {

View File

@ -1,9 +1,11 @@
import {EngineItem} from "@/api/context/Engine";
export async function list () { export async function list () {
const response = await fetch('/api/v1/engines'); const response = await fetch('/api/v1/engines');
return (await response.json()).results.rows; return (await response.json()).results.rows;
} }
export async function add (params: any) { export async function add (params: EngineItem) {
const response = await fetch('/api/v1/engines', { const response = await fetch('/api/v1/engines', {
method: 'POST', method: 'POST',
headers: { headers: {
@ -14,7 +16,7 @@ export async function add (params: any) {
return await response.json(); return await response.json();
} }
export async function update (params: any) { export async function update (params: EngineItem) {
const response = await fetch('/api/v1/engines', { const response = await fetch('/api/v1/engines', {
method: 'PUT', method: 'PUT',
headers: { headers: {
@ -30,7 +32,7 @@ export async function update (params: any) {
return await response.json(); return await response.json();
} }
export async function remove (params: any) { export async function remove (params: EngineItem) {
const response = await fetch('/api/v1/engines', { const response = await fetch('/api/v1/engines', {
method: 'DELETE', method: 'DELETE',
headers: { headers: {

View File

@ -1,9 +1,11 @@
import {SaleItem} from "@/api/context/Sale";
export async function list () { export async function list () {
const response = await fetch('/api/v1/sales'); const response = await fetch('/api/v1/sales');
return (await response.json()).results.rows; return (await response.json()).results.rows;
} }
export async function add (params: any) { export async function add (params: SaleItem) {
const response = await fetch('/api/v1/sales', { const response = await fetch('/api/v1/sales', {
method: 'POST', method: 'POST',
headers: { headers: {
@ -14,7 +16,7 @@ export async function add (params: any) {
return await response.json(); return await response.json();
} }
export async function update (params: any) { export async function update (params: SaleItem) {
const response = await fetch('/api/v1/sales', { const response = await fetch('/api/v1/sales', {
method: 'PUT', method: 'PUT',
headers: { headers: {
@ -30,7 +32,7 @@ export async function update (params: any) {
return await response.json(); return await response.json();
} }
export async function remove (params: any) { export async function remove (params: SaleItem) {
const response = await fetch('/api/v1/sales', { const response = await fetch('/api/v1/sales', {
method: 'DELETE', method: 'DELETE',
headers: { headers: {

View File

@ -1,9 +1,11 @@
import {TransmissionItem} from "@/api/context/Transmission";
export async function list () { export async function list () {
const response = await fetch('/api/v1/transmissions'); const response = await fetch('/api/v1/transmissions');
return (await response.json()).results.rows; return (await response.json()).results.rows;
} }
export async function add (params: any) { export async function add (params: TransmissionItem) {
const response = await fetch('/api/v1/transmissions', { const response = await fetch('/api/v1/transmissions', {
method: 'POST', method: 'POST',
headers: { headers: {
@ -14,7 +16,7 @@ export async function add (params: any) {
return await response.json(); return await response.json();
} }
export async function update (params: any) { export async function update (params: TransmissionItem) {
const response = await fetch('/api/v1/transmissions', { const response = await fetch('/api/v1/transmissions', {
method: 'PUT', method: 'PUT',
headers: { headers: {
@ -30,7 +32,7 @@ export async function update (params: any) {
return await response.json(); return await response.json();
} }
export async function remove (params: any) { export async function remove (params: TransmissionItem) {
const response = await fetch('/api/v1/transmissions', { const response = await fetch('/api/v1/transmissions', {
method: 'DELETE', method: 'DELETE',
headers: { headers: {

View File

@ -1,9 +1,11 @@
import {TrimItem} from "@/api/context/Trim";
export async function list () { export async function list () {
const response = await fetch('/api/v1/trims'); const response = await fetch('/api/v1/trims');
return (await response.json()).results.rows; return (await response.json()).results.rows;
} }
export async function add (params: any) { export async function add (params: TrimItem) {
const response = await fetch('/api/v1/trims', { const response = await fetch('/api/v1/trims', {
method: 'POST', method: 'POST',
headers: { headers: {
@ -14,7 +16,7 @@ export async function add (params: any) {
return await response.json(); return await response.json();
} }
export async function update (params: any) { export async function update (params: TrimItem) {
const response = await fetch('/api/v1/trims', { const response = await fetch('/api/v1/trims', {
method: 'PUT', method: 'PUT',
headers: { headers: {
@ -30,7 +32,7 @@ export async function update (params: any) {
return await response.json(); return await response.json();
} }
export async function remove (params: any) { export async function remove (params: TrimItem) {
const response = await fetch('/api/v1/trims', { const response = await fetch('/api/v1/trims', {
method: 'DELETE', method: 'DELETE',
headers: { headers: {

View File

@ -1,6 +1,9 @@
import './Content.css'; import './Content.css';
import {ReactNode} from "react";
export default function Content({children}:any) { export default function Content({children}:{
children: ReactNode;
}) {
return ( return (
<div className="content"> <div className="content">
{children} {children}

View File

@ -1,7 +1,12 @@
import React from 'react'; import React, { ChangeEvent } from 'react';
import './Input.css' import './Input.css'
export function Input({children, name, value, onChange}: any) { export function Input({children, name, value, onChange}: {
children?: string;
name: string;
value: string;
onChange: (event: ChangeEvent<HTMLInputElement>) => void;
}) {
return ( return (
<> <>
<label htmlFor={name}>{children}</label> <label htmlFor={name}>{children}</label>

View File

@ -1,7 +1,11 @@
import React from 'react'; import React, {ChangeEvent} from 'react';
import './InputColor.css' import './InputColor.css'
export function InputColor({children, value, onChange, name}: any) { export function InputColor({value, onChange, name}: {
name: string;
value?: string;
onChange: (event: ChangeEvent<HTMLInputElement>) => void;
}) {
return ( return (
<> <>
<input type="color" value={value} name={name} onChange={onChange} className="input__color"/> <input type="color" value={value} name={name} onChange={onChange} className="input__color"/>

View File

@ -1,8 +1,13 @@
import React from 'react'; import React, {ChangeEvent} from 'react';
import './InputDate.css' import './InputDate.css'
import {format} from "date-fns"; import {format} from "date-fns";
export function InputDate({children, value, onChange, name}: any) { export function InputDate({children, value, onChange, name}: {
children?: string;
name: string;
value: string;
onChange: (event: ChangeEvent<HTMLInputElement>) => void;
}) {
return ( return (
<> <>
<label htmlFor={name}>{children}</label> <label htmlFor={name}>{children}</label>

View File

@ -1,7 +1,10 @@
import './Modal.css'; import './Modal.css';
import {useModalContext} from "@/components/Modal/ModalContext"; import {useModalContext} from "@/components/Modal/ModalContext";
import {ReactNode} from "react";
export default function Modal({children}:any) { export default function Modal({children}:{
children: ReactNode;
}) {
const { setContentModal } = useModalContext(); const { setContentModal } = useModalContext();
return ( return (

View File

@ -1,8 +1,11 @@
"use client"; "use client";
import './NavBar.css'; import './NavBar.css';
import {ReactNode} from "react";
export default function NavBar({children}:any) { export default function NavBar({children}:{
children: ReactNode;
}) {
return ( return (
<ul> <ul>
{children} {children}

View File

@ -1,12 +1,26 @@
import React from 'react'; import React from 'react';
import ReactSelect from "react-select"; import ReactSelect, { SingleValue } from "react-select";
export function Select({options, placeholder, value, onChange, name}: any) { interface OptionType {
value: string | number;
label: string;
}
interface SelectProps {
options: OptionType[];
placeholder: string;
value: string | number | null;
onChange: (selectedOption: SingleValue<OptionType>) => void;
name: string;
}
export function Select({options, placeholder, value, onChange, name}: SelectProps) {
return ( return (
<> <>
<label htmlFor={name}>{placeholder}</label> <label htmlFor={name}>{placeholder}</label>
<ReactSelect options={options} placeholder={placeholder} <ReactSelect options={options} placeholder={placeholder}
value={options.find((option: any) => option.value === value)} value={options.find((option) => option.value === value)}
onChange={onChange} name={name}/> onChange={onChange} name={name}/>
</> </>
); );

View File

@ -1,6 +1,8 @@
import React from 'react'; import React, {ReactNode} from 'react';
export function Row({children}: any) { export function Row({children}: {
children: ReactNode;
}) {
return ( return (
<td>{children}</td> <td>{children}</td>
); );

View File

@ -1,6 +1,8 @@
import React from 'react'; import React, {ReactNode} from 'react';
export function Rows({children}: any) { export function Rows({children}: {
children: ReactNode;
}) {
return ( return (
<tr> <tr>
{children} {children}

View File

@ -1,14 +1,17 @@
import React from 'react'; import React, {ReactNode} from 'react';
import "./Table.css" import "./Table.css"
export function Table({ header, children }: any) { export function Table({ header, children }: {
header: string[];
children: ReactNode;
}) {
return ( return (
<div> <div>
<table> <table>
<thead> <thead>
<tr> <tr>
{ {
header.map((item: any, index: number) => ( header.map((item: string, index: number) => (
<th key={index}>{item}</th> <th key={index}>{item}</th>
)) ))
} }

View File

@ -5,7 +5,6 @@ import {useModalContext} from "@/components/Modal/ModalContext";
import SaleModal from "@/modals/Sale"; import SaleModal from "@/modals/Sale";
import {Rows} from "@/components/Table/Rows"; import {Rows} from "@/components/Table/Rows";
import {Row} from "@/components/Table/Row"; import {Row} from "@/components/Table/Row";
import CarModelsModal from "@/modals/CarModel";
import {remove} from "@/api/sales"; import {remove} from "@/api/sales";
import {useSaleContext} from "@/api/context/Sale"; import {useSaleContext} from "@/api/context/Sale";
import {useCarContext} from "@/api/context/Car"; import {useCarContext} from "@/api/context/Car";