From af6129f7c22c7fe61757c90beb323e89391063f0 Mon Sep 17 00:00:00 2001 From: Minhyeok Park Date: Sun, 20 Aug 2023 20:20:37 +0900 Subject: [PATCH] fix: use modern layout --- src/components/InstanceTable/index.tsx | 22 ++++- src/components/TopNav/index.tsx | 8 +- src/pages/Invites.tsx | 130 +++++++++++++------------ 3 files changed, 91 insertions(+), 69 deletions(-) diff --git a/src/components/InstanceTable/index.tsx b/src/components/InstanceTable/index.tsx index be6abb0..bffae39 100644 --- a/src/components/InstanceTable/index.tsx +++ b/src/components/InstanceTable/index.tsx @@ -1,4 +1,4 @@ -import { StatusIndicator, Table } from '@cloudscape-design/components' +import { Alert, StatusIndicator, Table } from '@cloudscape-design/components' import { useReducer, type FC, useState } from 'react' import { type InstancesType } from '../../utils/interfaces' import Button from '@cloudscape-design/components/button' @@ -9,6 +9,7 @@ import showStatus from '../../utils/showStatus' import { useRefreshNotifier } from '../RefreshNotifier' import style from './style.module.scss' +import { toast } from 'react-hot-toast' interface Props { instances: InstancesType[] @@ -19,6 +20,7 @@ const InstanceTable: FC = ({ instances, isLoading }) => { const { refresh } = useRefreshNotifier() const [uuid, setUuid] = useState('') const [updateModalStatus, setUpdateModal] = useState(false) + const [isInviteLoading, setIsInviteLoading] = useState(false) const [isUpdateLoading, setIsUpdateLoading] = useState(false) const [event, dispatch] = useReducer(updateModalReducer, { category: '', @@ -107,6 +109,9 @@ const InstanceTable: FC = ({ instances, isLoading }) => { } async function inviteInstance (uuid: string): Promise { + if (isInviteLoading) return + setIsInviteLoading(true) + await axios('/api/invites', { method: 'POST', data: { @@ -114,8 +119,19 @@ const InstanceTable: FC = ({ instances, isLoading }) => { } }).then((res) => { void navigator.clipboard.writeText(`${window.location.origin}/invites/${res.data.body.id as string}`) - alert('초대링크를 복사했습니다.') + toast.custom((t) => ( +
+ + 초대 링크를 복사했습니다! + +
+ )) }) + + setIsInviteLoading(false) } return ( @@ -160,7 +176,7 @@ const InstanceTable: FC = ({ instances, isLoading }) => { cell: (item: InstancesType) => (
+ {isSearchablePage && ( + + )}
) diff --git a/src/pages/Invites.tsx b/src/pages/Invites.tsx index d173b98..1397af0 100644 --- a/src/pages/Invites.tsx +++ b/src/pages/Invites.tsx @@ -7,6 +7,7 @@ import invitesReducer from '../modules/InvitesReducer' import { styled } from 'styled-components' import { Box, Container, Header, Link, SpaceBetween } from '@cloudscape-design/components' import ButtonCloudScape from '@cloudscape-design/components/button' +import ContainerComponent from '../components/Container' const Invites: FC = () => { const [event, dispatch] = useReducer(invitesReducer, { @@ -84,71 +85,74 @@ const Invites: FC = () => { } return ( - - - 인스턴스 -
- - - -
-
-
- - - ), - position: 'side', - width: '33%' - }} - > - - - - - GBSW AWS 메뉴얼 - - - 경북소프트웨어고등학교 - - + + + + 인스턴스 +
+ + + +
+
+
+ + + ), + position: 'side', + width: '33%' + }} + > + + + + + GBSW AWS 메뉴얼 + + + 경북소프트웨어고등학교 + + - - - 혹시 메뉴얼이 필요하신가요? + + + 혹시 메뉴얼이 필요하신가요? + + 이동 - 이동 - - - - - - {event.ip} -
- {event.ports} - - } - header={ -
- {event.name} -
- } - > - 인스턴스 수정 관련은 관리자 문의 -
-
-
- +
+
+ + + IP 주소: {event.ip}
+ 열린 포트: {event.ports}
+ 유저 아이디: ubuntu + + } + header={ +
+ {event.name} +
+ } + > + 인스턴스 수정 관련은 관리자 문의 +
+
+
+ + + ) }