From 4b672b7aa866fbe671bffd9ff4153c64e8c62374 Mon Sep 17 00:00:00 2001 From: suvajit Date: Sat, 26 Oct 2024 17:15:21 +0530 Subject: [PATCH] fix: fast refresh issue --- app/layout.tsx | 2 +- app/page.tsx | 2 +- app/rosters/components/RostersPage.tsx | 4 +-- app/rosters/page.tsx | 2 +- app/rosters/template.tsx | 2 +- app/web/components/AttackLog.tsx | 2 +- app/web/components/AttackLogPage.tsx | 4 +-- .../components/CapitalContributionPage.tsx | 4 +-- app/web/components/CapitalDonation.tsx | 2 +- app/web/components/History.tsx | 30 +------------------ app/web/components/Loader.tsx | 3 +- app/web/components/PlayerPage.tsx | 4 +-- components/BottomNav.tsx | 2 +- components/Landing.tsx | 4 +-- components/MotionPresets.tsx | 2 +- components/SkeletonLoader.tsx | 2 +- components/TopNav.tsx | 2 +- components/Transition.tsx | 4 +-- hooks/useAPI.ts | 4 +-- util/theme.ts | 4 +-- 20 files changed, 24 insertions(+), 61 deletions(-) diff --git a/app/layout.tsx b/app/layout.tsx index 6d4b542..b1a24e4 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,5 +1,5 @@ import { authCookieKey, authenticatedPathRegex } from '@/lib/constants'; -import theme from '@/util/theme'; +import { theme } from '@/util/theme'; import { AppRouterCacheProvider } from '@mui/material-nextjs/v14-appRouter'; import { ThemeProvider } from '@mui/material/styles'; import { GoogleAnalytics, GoogleTagManager } from '@next/third-parties/google'; diff --git a/app/page.tsx b/app/page.tsx index b404c6c..5751ebb 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1,4 +1,4 @@ -import LandingPage from '@/components/Landing'; +import { LandingPage } from '@/components/Landing'; export default function Home() { return ( diff --git a/app/rosters/components/RostersPage.tsx b/app/rosters/components/RostersPage.tsx index a4ab79b..a2465e3 100644 --- a/app/rosters/components/RostersPage.tsx +++ b/app/rosters/components/RostersPage.tsx @@ -49,7 +49,7 @@ const rolesMap: Record = { member: 'Mem' }; -const RostersPage = (props: { +export const RostersPage = (props: { guildId: string; userId: string; token: string; @@ -964,5 +964,3 @@ function getRosterName(roster: RostersEntity) { } return roster.name; } - -export default RostersPage; diff --git a/app/rosters/page.tsx b/app/rosters/page.tsx index 6baaa2c..bea3053 100644 --- a/app/rosters/page.tsx +++ b/app/rosters/page.tsx @@ -1,7 +1,7 @@ import jwt from 'jsonwebtoken'; import { headers } from 'next/headers'; import { redirect } from 'next/navigation'; -import RostersPage from './components/RostersPage'; +import { RostersPage } from './components/RostersPage'; const getServerSideProps = async () => { const headersList = headers(); diff --git a/app/rosters/template.tsx b/app/rosters/template.tsx index f084507..f30d4f8 100644 --- a/app/rosters/template.tsx +++ b/app/rosters/template.tsx @@ -1,5 +1,5 @@ 'use client'; -import MotionPresets from '@/components/MotionPresets'; +import { MotionPresets } from '@/components/MotionPresets'; export default function PageTemplate({ children diff --git a/app/web/components/AttackLog.tsx b/app/web/components/AttackLog.tsx index 64611f3..7b0e9cd 100644 --- a/app/web/components/AttackLog.tsx +++ b/app/web/components/AttackLog.tsx @@ -53,7 +53,7 @@ interface ClanWar { }; } -export default function AttackLog({ data }: { data: ClanWar }) { +export function AttackLog({ data }: { data: ClanWar }) { return ( ); } - -export const fakeWar = Array.from({ length: 50 }).map((_, index) => { - const oldStars = Math.floor(Math.random() * 3); - const newStars = Math.floor(Math.random() * 3); - const percentage = Math.floor(Math.random() * 100); - - return { - oldStars, - newStars, - percentage, - townHall: Math.floor(Math.random() * 5) + 10, - opponent: { - townHall: Math.floor(Math.random() * 5) + 10, - index: Math.floor(Math.random() * 50) - } - }; -}); - -// export const fakeRounds = Array.from({ length: 10 }).map((_, index) => { -// // generate random name -// const name = Math.random().toString(36).substring(7); -// return { -// name: "Air Hounds vs War Snippers", -// date: "10/10/2022", -// index: Math.floor(Math.random() * 50), -// war: fakeWar, -// }; -// }); diff --git a/app/web/components/Loader.tsx b/app/web/components/Loader.tsx index 05863f0..02303aa 100644 --- a/app/web/components/Loader.tsx +++ b/app/web/components/Loader.tsx @@ -3,7 +3,7 @@ import Skeleton from '@mui/material/Skeleton'; import Typography from '@mui/material/Typography'; import { Container, Stack } from '@mui/system'; -const Loader = ({ +export const Loader = ({ loading, message }: { @@ -57,4 +57,3 @@ const Loader = ({ ); }; -export default Loader; diff --git a/app/web/components/PlayerPage.tsx b/app/web/components/PlayerPage.tsx index 82404fc..8356df2 100644 --- a/app/web/components/PlayerPage.tsx +++ b/app/web/components/PlayerPage.tsx @@ -1,7 +1,7 @@ 'use client'; -import History from '@/app/web/components/History'; -import Loader from '@/app/web/components/Loader'; +import { History } from '@/app/web/components/History'; +import { Loader } from '@/app/web/components/Loader'; import Container from '@mui/material/Container'; import { useParams } from 'next/navigation'; import { useEffect, useState } from 'react'; diff --git a/components/BottomNav.tsx b/components/BottomNav.tsx index fabc187..4684c47 100644 --- a/components/BottomNav.tsx +++ b/components/BottomNav.tsx @@ -34,7 +34,7 @@ const navigationItems = [ } ]; -export default function BottomNav() { +export function BottomNav() { const _pathname = usePathname(); const { id } = useParams(); diff --git a/components/Landing.tsx b/components/Landing.tsx index ad4a6cb..1ac948b 100644 --- a/components/Landing.tsx +++ b/components/Landing.tsx @@ -22,7 +22,7 @@ import { } from 'react-icons/fa'; import { FiActivity } from 'react-icons/fi'; -export const FEATURES = [ +const FEATURES = [ { icon: FaSearch, title: 'Clash Search', @@ -72,7 +72,7 @@ export const FEATURES = [ } ]; -export default function LandingPage() { +export function LandingPage() { return ( <> diff --git a/components/MotionPresets.tsx b/components/MotionPresets.tsx index c010f8e..839c900 100644 --- a/components/MotionPresets.tsx +++ b/components/MotionPresets.tsx @@ -24,7 +24,7 @@ export const effects: Record = { } }; -export default function MotionPresets({ +export function MotionPresets({ children, motionType }: { diff --git a/components/SkeletonLoader.tsx b/components/SkeletonLoader.tsx index 832fa5e..525d3f1 100644 --- a/components/SkeletonLoader.tsx +++ b/components/SkeletonLoader.tsx @@ -1,7 +1,7 @@ import Skeleton from '@mui/material/Skeleton'; import Stack from '@mui/material/Stack'; -export default function SkeletonLoader() { +export function SkeletonLoader() { return ( diff --git a/components/TopNav.tsx b/components/TopNav.tsx index 4be8a47..204ea6d 100644 --- a/components/TopNav.tsx +++ b/components/TopNav.tsx @@ -5,7 +5,7 @@ import Stack from '@mui/material/Stack'; import Container from '@mui/material/Container'; import Typography from '@mui/material/Typography'; -export default function TopNav() { +export function TopNav() { return ( ; }); - -export default Transition; diff --git a/hooks/useAPI.ts b/hooks/useAPI.ts index 2662c1e..7028780 100644 --- a/hooks/useAPI.ts +++ b/hooks/useAPI.ts @@ -2,7 +2,7 @@ import { authCookieKey } from '@/lib/constants'; import { getCookie, setCookie } from 'cookies-next'; import { GuildClansAggregated } from './types'; -const useAPI = () => { +export const useAPI = () => { const login = async (email: string, password: string) => { const res = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/auth/login`, { method: 'POST', @@ -101,5 +101,3 @@ const useAPI = () => { return { login, signup, testToken, uploadFile, getClans }; }; - -export default useAPI; diff --git a/util/theme.ts b/util/theme.ts index 8337ad7..dd90773 100644 --- a/util/theme.ts +++ b/util/theme.ts @@ -9,7 +9,7 @@ const kanit = Kanit({ display: 'swap' }); -const theme = createTheme({ +export const theme = createTheme({ palette: { mode: 'dark' }, @@ -35,5 +35,3 @@ const theme = createTheme({ } } }); - -export default theme;