From 126103cc5c36702d5dec7e14e4240a6e501716d2 Mon Sep 17 00:00:00 2001 From: p1n9d3v Date: Thu, 5 Dec 2024 21:45:50 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=90=9E=20Fix(client):=20svg=20?= =?UTF-8?q?=EC=A3=BC=EC=86=8C=20=EC=88=98=EC=A0=95,=20=EC=9B=90=ED=99=94?= =?UTF-8?q?=20=ED=91=9C=EC=8B=9C=20=EB=B3=80=EA=B2=BD,?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/client/src/Root.tsx | 2 +- .../src/components/CloudGraphProvider.tsx | 92 +++++++++++-------- .../NCloud/NetworksBar/RegionSelect.tsx | 2 +- apps/client/src/components/SaveDialog.tsx | 15 ++- apps/client/src/models/ncloud/ImageBlock.ts | 2 +- apps/hub/public/JP.svg | 15 +++ apps/hub/public/KR.svg | 16 ++++ apps/hub/public/SG.svg | 10 ++ apps/hub/public/upload.svg | 5 + apps/hub/src/app/architectures/[id]/page.tsx | 2 +- .../ArchitectureBoard/ArchitectureItem.tsx | 2 +- 11 files changed, 119 insertions(+), 44 deletions(-) create mode 100644 apps/hub/public/JP.svg create mode 100644 apps/hub/public/KR.svg create mode 100644 apps/hub/public/SG.svg create mode 100644 apps/hub/public/upload.svg diff --git a/apps/client/src/Root.tsx b/apps/client/src/Root.tsx index f7ef7377..c4d0754d 100644 --- a/apps/client/src/Root.tsx +++ b/apps/client/src/Root.tsx @@ -6,7 +6,7 @@ function Root() { const loader = useLoaderData(); return ( - + ); diff --git a/apps/client/src/components/CloudGraphProvider.tsx b/apps/client/src/components/CloudGraphProvider.tsx index 0d1f0c2c..3d1a771b 100644 --- a/apps/client/src/components/CloudGraphProvider.tsx +++ b/apps/client/src/components/CloudGraphProvider.tsx @@ -7,52 +7,70 @@ import { SelectionProvider } from '@contexts/SelectionContext'; import { SvgProvider } from '@contexts/SvgContext'; import { calcViewBoxBounds } from '@helpers/viewBox'; import { Edge, Group, Node } from '@types'; -import { ReactNode } from 'react'; +import { createContext, ReactNode, useContext, useRef, useState } from 'react'; type Props = { children: ReactNode; initialData: { - nodes: Record; - edges: Record; - groups: Record; + id: string; + title: string; + architecture: { + nodes: Record; + edges: Record; + groups: Record; + }; }; }; +const CloudGraphContext = createContext({}); + export default ({ children, initialData }: Props) => { + const architecture = initialData?.architecture; + const [data, setData] = useState(initialData); return ( - - - + + + - - - - - {children} - - - - - - - + width: document.body.clientWidth * 2, + height: document.body.clientHeight * 2, + } + } + > + + + + + {children} + + + + + + + + ); }; + +export const useCloudGraph = () => { + const state = useContext(CloudGraphContext); + return state; +}; diff --git a/apps/client/src/components/NCloud/NetworksBar/RegionSelect.tsx b/apps/client/src/components/NCloud/NetworksBar/RegionSelect.tsx index 2d2f4131..f6f849ce 100644 --- a/apps/client/src/components/NCloud/NetworksBar/RegionSelect.tsx +++ b/apps/client/src/components/NCloud/NetworksBar/RegionSelect.tsx @@ -91,7 +91,7 @@ export default ({ region, disabled = false, onChangeRegion }: Props) => { > flag diff --git a/apps/client/src/components/SaveDialog.tsx b/apps/client/src/components/SaveDialog.tsx index 5237e5c6..5da25d6f 100644 --- a/apps/client/src/components/SaveDialog.tsx +++ b/apps/client/src/components/SaveDialog.tsx @@ -11,6 +11,7 @@ import DialogTitle from '@mui/material/DialogTitle'; import TextField from '@mui/material/TextField'; import { useNavigate, useParams } from 'react-router-dom'; import { urls } from '../apis'; +import { useCloudGraph } from './CloudGraphProvider'; type Props = { open: boolean; onClose: () => void; @@ -26,6 +27,7 @@ export default ({ open, onClose }: Props) => { const { state: { edges }, } = useEdgeContext(); + const { data: graphData, setData: setGraphData } = useCloudGraph(); const navigate = useNavigate(); const params = useParams(); @@ -42,6 +44,7 @@ export default ({ open, onClose }: Props) => { const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); + const title = (e.target as any).title.value; const resp = await saveArchitecture({ @@ -53,9 +56,14 @@ export default ({ open, onClose }: Props) => { }, title, }); - if (resp.id) { + if (resp?.id) { navigate(`${resp.id}`); } + + setGraphData((prev: any) => ({ + ...prev, + title, + })); onClose(); }; return ( @@ -78,9 +86,12 @@ export default ({ open, onClose }: Props) => { + + + + + + + + + + + + + + diff --git a/apps/hub/public/KR.svg b/apps/hub/public/KR.svg new file mode 100644 index 00000000..0db03b64 --- /dev/null +++ b/apps/hub/public/KR.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/apps/hub/public/SG.svg b/apps/hub/public/SG.svg new file mode 100644 index 00000000..ab5b833d --- /dev/null +++ b/apps/hub/public/SG.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/apps/hub/public/upload.svg b/apps/hub/public/upload.svg new file mode 100644 index 00000000..4b0ae604 --- /dev/null +++ b/apps/hub/public/upload.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/apps/hub/src/app/architectures/[id]/page.tsx b/apps/hub/src/app/architectures/[id]/page.tsx index 342bee94..f62bb61d 100644 --- a/apps/hub/src/app/architectures/[id]/page.tsx +++ b/apps/hub/src/app/architectures/[id]/page.tsx @@ -133,7 +133,7 @@ export default function ArchitectureDetailPage() {
- ₩{Math.floor(cost)} + ₩{Math.floor(cost).toLocaleString()} / month
diff --git a/apps/hub/src/components/ArchitectureBoard/ArchitectureItem.tsx b/apps/hub/src/components/ArchitectureBoard/ArchitectureItem.tsx index 388b4b10..2556020e 100644 --- a/apps/hub/src/components/ArchitectureBoard/ArchitectureItem.tsx +++ b/apps/hub/src/components/ArchitectureBoard/ArchitectureItem.tsx @@ -38,7 +38,7 @@ export const ArchitectureItem = ({ ))}
-
₩ {Math.floor(cost)}
+
₩ {Math.floor(cost).toLocaleString()}
{stars}
{imports}
From ffb9e0faa9b07d6fb6bac59a8d85fda912e43826 Mon Sep 17 00:00:00 2001 From: p1n9d3v Date: Thu, 5 Dec 2024 21:50:17 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=90=9E=20Fix(hub):=20fix=20dockerfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/hub/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/hub/Dockerfile b/apps/hub/Dockerfile index 4ce43f43..040e4f39 100644 --- a/apps/hub/Dockerfile +++ b/apps/hub/Dockerfile @@ -14,6 +14,7 @@ WORKDIR /app RUN mkdir -p /app/server COPY --from=build /build/.next/standalone/ ./standalone/ COPY --from=build /build/.next/static/ ./standalone/.next/static +COPY --from=build /build/public/ ./standalone/public ENV BACK_URL=https://api.cloudcanvas.kro.kr -ENTRYPOINT ["sh", "-c", "node standalone/server.js"] \ No newline at end of file +ENTRYPOINT ["sh", "-c", "node standalone/server.js"]