Upgraded to next v15 and eslint to v9
This commit is contained in:
@ -1,12 +1,12 @@
|
||||
'use server';
|
||||
|
||||
export type ContactFormState = {
|
||||
export interface ContactFormState {
|
||||
name: string;
|
||||
phone: string;
|
||||
email: string;
|
||||
message: string;
|
||||
status: string;
|
||||
};
|
||||
}
|
||||
|
||||
export async function saveContactForm(state: ContactFormState, formData: FormData): Promise<ContactFormState> {
|
||||
const url =
|
||||
|
||||
@ -100,6 +100,6 @@ export default async function ProductPage(props: ProductPageProps) {
|
||||
|
||||
return (
|
||||
// Render the client component and pass necessary props
|
||||
(<ProductDetails product={product} relatedProducts={products} />)
|
||||
<ProductDetails product={product} relatedProducts={products} />
|
||||
);
|
||||
}
|
||||
|
||||
@ -1,15 +1,13 @@
|
||||
import React from 'react';
|
||||
|
||||
import styles from './PillButton.module.css';
|
||||
|
||||
type PillButtonProps = {
|
||||
interface PillButtonProps {
|
||||
text: string; // text prop is now required
|
||||
className?: string;
|
||||
// Additional props if needed
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
[key: string]: any;
|
||||
onClick?: () => void; // onClick is optional
|
||||
};
|
||||
}
|
||||
|
||||
export function PillButton({ text, className = '', onClick, ...props }: PillButtonProps) {
|
||||
return (
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
// src/components/AnimatedImage.tsx
|
||||
'use client';
|
||||
import Image, { StaticImageData } from 'next/image';
|
||||
import React from 'react';
|
||||
|
||||
import useInView from '@/hooks/useInView';
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
'use client';
|
||||
import Image from 'next/image';
|
||||
import Link from 'next/link';
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { FiSearch, FiUser } from 'react-icons/fi';
|
||||
import { HiShoppingBag } from 'react-icons/hi2';
|
||||
|
||||
|
||||
@ -1,12 +1,11 @@
|
||||
import { useEffect } from 'react';
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
|
||||
type Callback = (entry: IntersectionObserverEntry) => void;
|
||||
|
||||
class IntersectionObserverManager {
|
||||
private observer: IntersectionObserver;
|
||||
private callbacks: Map<Element, Callback>;
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
constructor(options: IntersectionObserverInit) {
|
||||
this.callbacks = new Map();
|
||||
|
||||
@ -44,7 +43,6 @@ class IntersectionObserverManager {
|
||||
|
||||
let manager: IntersectionObserverManager | null = null;
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
const getObserverManager = (options: IntersectionObserverInit) => {
|
||||
if (!manager) {
|
||||
manager = new IntersectionObserverManager(options);
|
||||
@ -52,10 +50,7 @@ const getObserverManager = (options: IntersectionObserverInit) => {
|
||||
return manager;
|
||||
};
|
||||
|
||||
export const useSharedIntersectionObserver = (
|
||||
// eslint-disable-next-line no-undef
|
||||
options: IntersectionObserverInit,
|
||||
) => {
|
||||
export const useSharedIntersectionObserver = (options: IntersectionObserverInit) => {
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
// Cleanup logic if needed
|
||||
@ -67,8 +62,11 @@ export const useSharedIntersectionObserver = (
|
||||
if (typeof window === 'undefined') {
|
||||
// Return a dummy manager for SSR
|
||||
return {
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
observe: () => {},
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
unobserve: () => {},
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
disconnect: () => {},
|
||||
} as unknown as IntersectionObserverManager;
|
||||
}
|
||||
|
||||
@ -3,7 +3,6 @@ import { RefObject, useEffect, useRef, useState } from 'react';
|
||||
|
||||
import { useSharedIntersectionObserver } from './shared-intersection-observer';
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
interface UseInViewOptions extends IntersectionObserverInit {
|
||||
triggerOnce?: boolean;
|
||||
}
|
||||
|
||||
@ -5,20 +5,20 @@ import React, { createContext, useContext, useEffect, useState } from 'react';
|
||||
|
||||
import { useRegion } from './region';
|
||||
|
||||
type CartContextType = {
|
||||
interface CartContextType {
|
||||
cart?: HttpTypes.StoreCart;
|
||||
setCart: React.Dispatch<React.SetStateAction<HttpTypes.StoreCart | undefined>>;
|
||||
addToCart: (variant_id: string, quantity: number) => void;
|
||||
updateQuantity: (item_id: string, quantity: number) => void;
|
||||
removeItem: (item_id: string) => void;
|
||||
refreshCart: () => void;
|
||||
};
|
||||
}
|
||||
|
||||
const CartContext = createContext<CartContextType | null>(null);
|
||||
|
||||
type CartProviderProps = {
|
||||
interface CartProviderProps {
|
||||
children: React.ReactNode;
|
||||
};
|
||||
}
|
||||
|
||||
export const CartProvider = ({ children }: CartProviderProps) => {
|
||||
const [cart, setCart] = useState<HttpTypes.StoreCart>();
|
||||
@ -68,7 +68,7 @@ export const CartProvider = ({ children }: CartProviderProps) => {
|
||||
setCart(undefined);
|
||||
};
|
||||
|
||||
function addToCart(variant_id: string, quantity: number = 1) {
|
||||
function addToCart(variant_id: string, quantity = 1) {
|
||||
if (!cart) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3,18 +3,18 @@
|
||||
import { HttpTypes } from '@medusajs/types';
|
||||
import React, { createContext, useContext, useEffect, useState } from 'react';
|
||||
|
||||
type CustomerContextType = {
|
||||
interface CustomerContextType {
|
||||
customer: HttpTypes.StoreCustomer | undefined;
|
||||
register: (firstName: string, lastName: string, email: string, password: string) => Promise<void>;
|
||||
login: (email: string, password: string) => Promise<void>;
|
||||
logout: () => void;
|
||||
};
|
||||
}
|
||||
|
||||
const CustomerContext = createContext<CustomerContextType | null>(null);
|
||||
|
||||
type CustomerProviderProps = {
|
||||
interface CustomerProviderProps {
|
||||
children: React.ReactNode;
|
||||
};
|
||||
}
|
||||
|
||||
export const CustomerProvider = ({ children }: CustomerProviderProps) => {
|
||||
const [customer, setCustomer] = useState<HttpTypes.StoreCustomer | undefined>();
|
||||
|
||||
@ -3,16 +3,16 @@
|
||||
import { HttpTypes } from '@medusajs/types';
|
||||
import React, { createContext, useContext, useEffect, useState } from 'react';
|
||||
|
||||
type RegionContextType = {
|
||||
interface RegionContextType {
|
||||
region?: HttpTypes.StoreRegion;
|
||||
setRegion: React.Dispatch<React.SetStateAction<HttpTypes.StoreRegion | undefined>>;
|
||||
};
|
||||
}
|
||||
|
||||
const RegionContext = createContext<RegionContextType | null>(null);
|
||||
|
||||
type RegionProviderProps = {
|
||||
interface RegionProviderProps {
|
||||
children: React.ReactNode;
|
||||
};
|
||||
}
|
||||
|
||||
export const RegionProvider = ({ children }: RegionProviderProps) => {
|
||||
const [region, setRegion] = useState<HttpTypes.StoreRegion>();
|
||||
|
||||
Reference in New Issue
Block a user