diff --git a/web/app/layout.tsx b/web/app/layout.tsx index 1ed060c..b1e8066 100644 --- a/web/app/layout.tsx +++ b/web/app/layout.tsx @@ -1,10 +1,10 @@ import type { Metadata } from 'next' import { Inter } from 'next/font/google' import './globals.css' -import SessionWrapper from './providers/SessionProvider' +import SessionWrapper from './lib/providers/SessionProvider' import { ApolloClientProvider } from './apolloClient' import clsx from 'clsx' -import { Authentication } from './ui/Authentication/Authentication' +import { Authentication } from './lib/ui/Authentication/Authentication' const inter = Inter({ subsets: ['latin'] }) diff --git a/web/app/providers/SessionProvider.tsx b/web/app/lib/providers/SessionProvider.tsx similarity index 100% rename from web/app/providers/SessionProvider.tsx rename to web/app/lib/providers/SessionProvider.tsx diff --git a/web/app/ui/Authentication/Authentication.tsx b/web/app/lib/ui/Authentication/Authentication.tsx similarity index 100% rename from web/app/ui/Authentication/Authentication.tsx rename to web/app/lib/ui/Authentication/Authentication.tsx diff --git a/web/app/ui/Authentication/LoginButton.tsx b/web/app/lib/ui/Authentication/LoginButton.tsx similarity index 100% rename from web/app/ui/Authentication/LoginButton.tsx rename to web/app/lib/ui/Authentication/LoginButton.tsx diff --git a/web/app/ui/Authentication/LogoutButton.tsx b/web/app/lib/ui/Authentication/LogoutButton.tsx similarity index 100% rename from web/app/ui/Authentication/LogoutButton.tsx rename to web/app/lib/ui/Authentication/LogoutButton.tsx diff --git a/web/lib/component/home/Home.test.tsx b/web/app/lib/ui/Hero/Hero.test.tsx similarity index 75% rename from web/lib/component/home/Home.test.tsx rename to web/app/lib/ui/Hero/Hero.test.tsx index e472f2f..5a5bb7a 100644 --- a/web/lib/component/home/Home.test.tsx +++ b/web/app/lib/ui/Hero/Hero.test.tsx @@ -1,18 +1,16 @@ import { render, screen } from '@testing-library/react' -import Home from './Home' import { SessionProvider } from 'next-auth/react' - -const DEFAULT_PROPS = {} +import { Hero } from './Hero' const createComponent = () => { render( - + , ) } -describe('Home', () => { +describe('Hero', () => { it('should able to render component', () => { createComponent() expect(screen.getByText('SST Template')).toBeTruthy() diff --git a/web/lib/component/home/Splash/Splash.tsx b/web/app/lib/ui/Hero/Hero.tsx similarity index 71% rename from web/lib/component/home/Splash/Splash.tsx rename to web/app/lib/ui/Hero/Hero.tsx index 9735873..7a9323f 100644 --- a/web/lib/component/home/Splash/Splash.tsx +++ b/web/app/lib/ui/Hero/Hero.tsx @@ -1,15 +1,14 @@ -'use client'; +'use client' -import React, { useEffect, useRef, useState } from 'react'; +import React, { useEffect, useRef, useState } from 'react' +import STACK from './Stack' -import STACK from './Stack'; +const getRandomNumber = (min: number, max: number) => Math.random() * (max - min) + min -const getRandomNumber = (min: number, max: number) => Math.random() * (max - min) + min; - -export const Splash = () => { - const [drops, setDrops] = useState([]); - const rootRef = useRef(null); - const techIndex = useRef(0); +export const Hero = () => { + const [drops, setDrops] = useState([]) + const rootRef = useRef(null) + const techIndex = useRef(0) useEffect(() => { const interval = setInterval( @@ -23,14 +22,14 @@ export const Splash = () => { onAnimationEnd={() => setDrops((c) => c.slice(1))} > {STACK[techIndex.current++ % STACK.length]} - - ) + , + ), ), - 1000 - ); + 1000, + ) - return () => clearInterval(interval); - }, []); + return () => clearInterval(interval) + }, []) return (
@@ -42,5 +41,5 @@ export const Splash = () => { SST Template
- ); -}; + ) +} diff --git a/web/lib/component/home/Splash/Stack.tsx b/web/app/lib/ui/Hero/Stack.tsx similarity index 100% rename from web/lib/component/home/Splash/Stack.tsx rename to web/app/lib/ui/Hero/Stack.tsx diff --git a/web/app/page.tsx b/web/app/page.tsx index f890163..b0a91f3 100644 --- a/web/app/page.tsx +++ b/web/app/page.tsx @@ -1,9 +1,9 @@ -import Home from '@/lib/component/home/Home' +import { Hero } from './lib/ui/Hero/Hero' export default function Page() { return (
- +
) } diff --git a/web/app/sample/page.tsx b/web/app/sample/page.tsx index 0ecfd5b..3fe9027 100644 --- a/web/app/sample/page.tsx +++ b/web/app/sample/page.tsx @@ -6,8 +6,8 @@ import { TestGql } from './TestGql' export default () => { return ( -
+
-
+ ) } diff --git a/web/app/serverActions.ts b/web/app/serverActions.ts index a3ba638..6cc5831 100644 --- a/web/app/serverActions.ts +++ b/web/app/serverActions.ts @@ -20,5 +20,5 @@ export async function authenticate(redirectTo?: string) { } export async function unauthenticate() { - await signOut() + await signOut({ redirectTo: '/' }) } diff --git a/web/lib/component/home/Home.tsx b/web/lib/component/home/Home.tsx deleted file mode 100644 index 91e845c..0000000 --- a/web/lib/component/home/Home.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import React from 'react' - -import { Splash } from './Splash/Splash' - -const Home: React.FC = () => { - return ( -
- -
- ) -} - -export default Home