-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Feat/client/#175
- Loading branch information
Showing
64 changed files
with
1,733 additions
and
602 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
VITE_API_URL=http://localhost:3000 | ||
VITE_MODE=dev |
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 @@ | ||
VITE_API_URL=https://api.cloudcanvas.kro.kr | ||
VITE_MODE=prod |
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 |
---|---|---|
@@ -1,37 +1,13 @@ | ||
import CloudGraph from '@/src/CloudGraph'; | ||
import Header from '@components/Layout/Header'; | ||
import Sidebar from '@components/Layout/Sidebar'; | ||
import NetworksBar from '@components/NCloud/NetworksBar/index'; | ||
import PropertiesBar from '@components/NCloud/PropertiesBar'; | ||
import Box from '@mui/material/Box'; | ||
|
||
function App() { | ||
export const App = () => { | ||
return ( | ||
<> | ||
<Box | ||
sx={{ | ||
height: '100%', | ||
display: 'flex', | ||
}} | ||
> | ||
<Sidebar /> | ||
<Box | ||
sx={{ | ||
width: '100%', | ||
display: 'flex', | ||
flexDirection: 'column', | ||
overflow: 'hidden', | ||
}} | ||
> | ||
<Header /> | ||
<CloudGraph /> | ||
</Box> | ||
</Box> | ||
|
||
<CloudGraph /> | ||
<NetworksBar /> | ||
<PropertiesBar /> | ||
</> | ||
); | ||
} | ||
|
||
export default App; | ||
}; |
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,15 @@ | ||
import { useLoaderData } from 'react-router-dom'; | ||
import CloudGraphProvider from '@components/CloudGraphProvider'; | ||
import Layout from '@components/Layout'; | ||
|
||
function Root() { | ||
const loader = useLoaderData(); | ||
|
||
return ( | ||
<CloudGraphProvider initialData={loader?.data.architecture}> | ||
<Layout /> | ||
</CloudGraphProvider> | ||
); | ||
} | ||
|
||
export default Root; |
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,15 @@ | ||
const BASE_URL = import.meta.env.VITE_API_URL; | ||
export const URLS = { | ||
login: 'auth/login', | ||
share: 'public-architectures', // POST | ||
privateArchi: (id: string) => `private-architectures/${id}`, | ||
}; | ||
|
||
export const urls = (path: keyof typeof URLS, slug?: any) => { | ||
const urls = URLS[path]; | ||
if (typeof urls === 'function') { | ||
return `${BASE_URL}/${urls(slug)}`; | ||
} | ||
|
||
return `${BASE_URL}/${urls}`; | ||
}; |
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,43 @@ | ||
import { LoaderFunctionArgs } from 'react-router-dom'; | ||
import { urls } from '.'; | ||
import { undefinedReviver } from '@utils'; | ||
|
||
export const rootLoader = async ({ params }: LoaderFunctionArgs) => { | ||
const loginResponse = await fetch(urls('login'), { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify({}), | ||
credentials: 'include', | ||
}); | ||
|
||
if (!loginResponse.ok) { | ||
throw new Response('Login failed', { status: loginResponse.status }); | ||
} | ||
|
||
if (!params.id) return null; | ||
const archiResponse = await fetch(urls('privateArchi', params.id), { | ||
method: 'GET', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
credentials: 'include', | ||
}); | ||
|
||
if (!archiResponse.ok) { | ||
throw new Response('Data fetch failed', { | ||
status: archiResponse.status, | ||
}); | ||
} | ||
|
||
const text = await archiResponse.text(); | ||
let data; | ||
try { | ||
data = JSON.parse(text, undefinedReviver); | ||
} catch (error) { | ||
throw new Response('Invalid JSON response', { status: 500 }); | ||
} | ||
|
||
return { data }; | ||
}; |
Oops, something went wrong.