forked from boostcampwm-2024/web20-camon
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from boostcampwm-2024/Refactor/3
[Refactor] FSD 아키텍처로 마이그레이션
- Loading branch information
Showing
156 changed files
with
840 additions
and
800 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Outlet } from 'react-router-dom'; | ||
import { Toaster } from '@/shared/ui/shadcn/toaster'; | ||
import { Header } from '@/widgets'; | ||
import { FloatingButton } from '@/shared/ui'; | ||
import { Providers } from '../providers'; | ||
|
||
export function Layout() { | ||
return ( | ||
<Providers> | ||
<Header /> | ||
<main className="pt-[74px] h-full"> | ||
<Outlet /> | ||
</main> | ||
<Toaster /> | ||
<FloatingButton /> | ||
</Providers> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { Layout } from './Layout'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { useMemo, useState } from 'react'; | ||
import { AuthContext } from '@/shared/contexts'; | ||
|
||
export function AuthProvider({ children }: { children: React.ReactNode }) { | ||
const [isLoggedIn, setIsLoggedIn] = useState(() => !!localStorage.getItem('accessToken')); | ||
const value = useMemo(() => ({ isLoggedIn, setIsLoggedIn }), [isLoggedIn, setIsLoggedIn]); | ||
return <AuthContext.Provider value={value}>{children}</AuthContext.Provider>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { ThemeProvider } from '@/app/providers/ThemeProvider'; | ||
import { AuthProvider } from '@/app/providers/AuthProvider'; | ||
|
||
export function Providers({ children }: { children: React.ReactNode }) { | ||
return ( | ||
<AuthProvider> | ||
<ThemeProvider>{children}</ThemeProvider> | ||
</AuthProvider> | ||
); | ||
} |
15 changes: 2 additions & 13 deletions
15
apps/client/src/contexts/ThemeContext.tsx → ...lient/src/app/providers/ThemeProvider.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { Providers } from './Providers'; |
2 changes: 1 addition & 1 deletion
2
apps/client/src/ProtectedRoute.tsx → .../client/src/app/routes/ProtectedRoute.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { routerOptions } from './options'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export const routerOptions = { | ||
future: { | ||
v7_startTransition: true, | ||
v7_relativeSplatPath: true, | ||
v7_fetcherPersist: true, | ||
v7_normalizeFormMethod: true, | ||
v7_partialHydration: true, | ||
v7_skipActionErrorRevalidation: true, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { router } from './router'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { createBrowserRouter } from 'react-router-dom'; | ||
import { HomePage } from '@pages/Home'; | ||
import { LivePage } from '@pages/Live'; | ||
import { BroadcastPage } from '@pages/Broadcast'; | ||
import { AuthPage } from '@pages/Auth'; | ||
import { RecordPage } from '@pages/Record'; | ||
import { ProfilePage } from '@/pages/Profile'; | ||
import { Layout } from '@/app/layouts'; | ||
import ProtectedRoute from './ProtectedRoute'; | ||
import { routerOptions } from './config'; | ||
|
||
export const router = createBrowserRouter( | ||
[ | ||
{ | ||
path: '/', | ||
element: <Layout />, | ||
children: [ | ||
{ | ||
path: '', | ||
element: <HomePage />, | ||
}, | ||
{ | ||
path: 'live/:liveId', | ||
element: <LivePage />, | ||
}, | ||
{ | ||
path: 'auth', | ||
element: <AuthPage />, | ||
}, | ||
{ | ||
path: '', | ||
element: <ProtectedRoute />, | ||
children: [ | ||
{ | ||
path: 'profile', | ||
element: <ProfilePage />, | ||
}, | ||
|
||
{ | ||
path: 'record/:attendanceId', | ||
element: <RecordPage />, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
{ | ||
path: 'broadcast', | ||
element: <ProtectedRoute />, | ||
children: [ | ||
{ | ||
path: '', | ||
element: <BroadcastPage />, | ||
}, | ||
], | ||
}, | ||
], | ||
routerOptions, | ||
); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { useAuth, AuthContext } from './model'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { createContext } from 'react'; | ||
|
||
const initialState = { | ||
isLoggedIn: !!localStorage.getItem('accessToken'), | ||
setIsLoggedIn: () => {}, | ||
}; | ||
|
||
type AuthContextValue = { | ||
isLoggedIn: boolean; | ||
setIsLoggedIn: React.Dispatch<React.SetStateAction<boolean>>; | ||
}; | ||
|
||
export const AuthContext = createContext<AuthContextValue>(initialState); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { useAuth } from './useAuth'; | ||
export { AuthContext } from './AuthContext'; |
2 changes: 1 addition & 1 deletion
2
apps/client/src/hooks/useAuth.ts → ...client/src/features/auth/model/useAuth.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export { BroadcastPlayer, BroadcastTitle, RecordButton } from './ui'; | ||
export { useRoom, useProducer, useMedia, useScreenShare } from './model'; | ||
|
||
export type { Tracks } from './model'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export { useMedia } from './useMedia'; | ||
export { useRoom, useProducer } from './mediasoup'; | ||
export { useScreenShare } from './useScreenShare'; | ||
export type { Tracks } from './trackTypes'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
apps/client/src/features/broadcasting/model/mediasoup/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { useRoom } from './useRoom'; | ||
export { useProducer } from './useProducer'; |
Oops, something went wrong.