Skip to content

Commit

Permalink
Merge pull request #454 from boostcamp-2020/dev_web
Browse files Browse the repository at this point in the history
[Web] Refactor and fix bugs
  • Loading branch information
kas136 authored Dec 18, 2020
2 parents c734b5d + d45fda8 commit be6ef60
Show file tree
Hide file tree
Showing 119 changed files with 641 additions and 593 deletions.
6 changes: 6 additions & 0 deletions client/src/@types/timer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
enum Timer {
TRANSCRIPT_EXISTS = 2000,
NO_TRANSCRIPT = 5000,
}

export default Timer;
12 changes: 12 additions & 0 deletions client/src/@types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@ enum SideBarStatus {
CHAT_ROOMS,
}

enum LangCodeFormattedForServer {
KOREAN = 'Korean',
ENGLISH = 'English',
}

enum TranslationCycle {
PROCESS,
DONE,
}

export {
RoomListType,
ParticipantsType,
Expand All @@ -97,4 +107,6 @@ export {
SideBarStatus,
JoiningRoomType,
CreatingRoomType,
LangCodeFormattedForServer,
TranslationCycle,
};
22 changes: 12 additions & 10 deletions client/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { useEffect } from 'react';
import React, { lazy, Suspense, useEffect } from 'react';
import { createGlobalStyle } from 'styled-components';
import reset from 'styled-reset';
import { Redirect, Route, Switch } from 'react-router-dom';
import { IntlProvider } from 'react-intl';

import ChatRoomPage from './pages/ChatRoomPage';
import MainPage from './pages/MainPage';
const ChatRoomPage = lazy(() => import('./pages/ChatRoomPage'));
const MainPage = lazy(() => import('./pages/MainPage'));
import SwitchRoomLoadingPage from './pages/SwitchRoomLoadingPage';
import Background from './components/atoms/resources/Background';
import ko from './assets/locale/ko';
Expand All @@ -14,7 +14,7 @@ import useUser from './hooks/useUser';
import LangCode from './@types/langCode';

export const GlobalStyle = createGlobalStyle`
${reset}
${reset}
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR&display=swap');
Expand Down Expand Up @@ -44,12 +44,14 @@ function App() {
<GlobalStyle />
<Background>
<IntlProvider locale={languageData} messages={languageData === LangCode.KOREAN ? ko : en}>
<Switch>
<Route path="/" component={MainPage} exact />
<Route path="/chat" component={ChatRoomPage} exact />
<Route path="/loading" component={SwitchRoomLoadingPage} exact />
<Redirect from="*" to="/" />
</Switch>
<Suspense fallback={<Background />}>
<Switch>
<Route path="/" component={MainPage} exact />
<Route path="/chat" component={ChatRoomPage} exact />
<Route path="/loading" component={SwitchRoomLoadingPage} exact />
<Redirect from="*" to="/" />
</Switch>
</Suspense>
</IntlProvider>
</Background>
</>
Expand Down
2 changes: 1 addition & 1 deletion client/src/assets/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const joinRoom = async (roomCode: string, isPrivate: 'true' | 'false') => {
};

const getRoomList = async () => {
return backend.get<{ roomList: RoomListType[] }>('/api/room');
return backend.get<{ rooms: RoomListType[] }>('/api/room');
};

const detectLanguage = async ({ query }: { query: string }) => {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/atoms/boxes/ChatBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export type ChatBoxPropsType = {
isMe: boolean;
};

export function ChatBox({ leftMessage = '', rightMessage = '', isMe }: ChatBoxPropsType) {
function ChatBox({ leftMessage = '', rightMessage = '', isMe }: ChatBoxPropsType) {
return (
<StyledChatBoxWrapper>
<LeftBox isMe={isMe}>{leftMessage}</LeftBox>
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/atoms/boxes/ChatLogsBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const StyledChatLogsBox = styled.div<ChatLogsBoxPropsType>`
}
`;

export function ChatLogsBox({ children }: ChatLogsBoxPropsType) {
function ChatLogsBox({ children }: ChatLogsBoxPropsType) {
return <StyledChatLogsBox>{children}</StyledChatLogsBox>;
}

Expand Down
4 changes: 2 additions & 2 deletions client/src/components/atoms/boxes/ChatModalBackground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ const StyledChatModalBackground = styled.div`
background-color: rgba(0, 0, 0, 0.4);
`;

export const ChatModalBackground = ({ ...props }: ChatModalBackgroundPropsType) => {
function ChatModalBackground({ ...props }: ChatModalBackgroundPropsType) {
return <StyledChatModalBackground {...props} />;
};
}

export default ChatModalBackground;
4 changes: 2 additions & 2 deletions client/src/components/atoms/boxes/ChatModalBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ const AbsoluteIcon = styled(IconButton)`
top: 16px;
`;

export const ChatModalBox = ({ onClickClose, children }: ChatModalPropsType) => {
function ChatModalBox({ onClickClose, children }: ChatModalPropsType) {
return (
<StyledChatModalBox>
<AbsoluteIcon onClick={onClickClose} iconType="Close" color={Palette.DARK_GREY} />
{children}
</StyledChatModalBox>
);
};
}

export default ChatModalBox;
2 changes: 1 addition & 1 deletion client/src/components/atoms/boxes/CheckBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const CheckBoxWrapper = styled.div`
align-items: center;
`;

export function CheckBox({ isChecked = false, children, isPrivateOnClick, isPrivate }: CheckBoxTypes) {
function CheckBox({ isChecked = false, children, isPrivateOnClick, isPrivate }: CheckBoxTypes) {
return (
<CheckBoxWrapper>
<StyledCheckBox
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/atoms/boxes/CodeBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const StyledCodeText = styled.p`
font-size: 48px;
`;

export function CodeBox({ isEntered, children }: CodeBoxPropsType) {
function CodeBox({ isEntered, children }: CodeBoxPropsType) {
return (
<StyledCodeBox isEntered={isEntered}>
<StyledCodeText>{children}</StyledCodeText>
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/atoms/boxes/MainPageBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const StyledMainpageBox = styled.div<MainPageBoxPropsType>`
background-color: rgba(255, 255, 255, 0.6);
`;

export function MainPageBox({ children }: MainPageBoxPropsType) {
function MainPageBox({ children }: MainPageBoxPropsType) {
return <StyledMainpageBox>{children}</StyledMainpageBox>;
}

Expand Down
2 changes: 1 addition & 1 deletion client/src/components/atoms/boxes/RoomItemBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const StyledRoomItemBox = styled.div<StyledRoomItemBoxPropsType>`
${(props) => (props.disabled ? '' : 'cursor: pointer;')}
`;

export function RoomItemBox({ size = 'big', children, onClickButton, disabled }: RoomItemBoxTypes) {
function RoomItemBox({ size = 'big', children, onClickButton, disabled }: RoomItemBoxTypes) {
return (
<StyledRoomItemBox
size={size}
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/atoms/buttons/IconButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const IconWrapper = styled.div`
cursor: pointer;
`;

export function IconButton({ iconType = 'Edit', color = 'black', onClick, className }: IconButtonPropsType) {
function IconButton({ iconType = 'Edit', color = 'black', onClick, className }: IconButtonPropsType) {
let icon;
const defaultIconProps = { fontSize: 24, color: color };

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const StyledButton = styled.button<LanguageSelectButtonPropsType>`
cursor: pointer;
`;

export function LanguageSelectButton({
function LanguageSelectButton({
selected = true,
language = LangCode.KOREAN,
...props
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/atoms/buttons/MainButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const Button = styled.button<StyledButtonPropsType>`
${(props) => (props.disabled ? '' : 'cursor: pointer;')}
`;

export function MainButton({ disabled, children, onClickButton }: ButtonPropsType) {
function MainButton({ disabled, children, onClickButton }: ButtonPropsType) {
return (
<Button
type="button"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const StyledRefreshIcon = styled(RefreshIcon)`
color: white;
`;

export function ProfileChangeButton() {
function ProfileChangeButton() {
return (
<StyledProfileChangeButton>
<StyledRefreshIcon />
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/atoms/buttons/RefreshButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const RefrshButtonWrapper = styled.div<RefreshButtonStyleType>`
}
`;

export function RefreshButton({ onClickRefresh, size }: RefreshButtonTypes) {
function RefreshButton({ onClickRefresh, size }: RefreshButtonTypes) {
return (
<RefrshButtonWrapper onClick={onClickRefresh} size={size}>
<IconWrapper size={size}>
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/atoms/logos/HomeLogo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const StyledLogo = styled.img`
cursor: pointer;
`;

export function HomeLogo({ onClick }: HomeLogoType) {
function HomeLogo({ onClick }: HomeLogoType) {
return <StyledLogo onClick={onClick} src={Images.HOME_LOGO} alt="pupago home logo" />;
}

Expand Down
2 changes: 1 addition & 1 deletion client/src/components/atoms/logos/LogoWithText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const StyledLogo = styled.img`
height: 72px;
`;

export function LogoWithText() {
function LogoWithText() {
return <StyledLogo src={Images.LOGO_WITH_THEXT} alt="pupago logo with text" />;
}

Expand Down
2 changes: 1 addition & 1 deletion client/src/components/atoms/logos/MiniLogo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const StyledLogo = styled.img`
height: 16px;
`;

export function MiniLogo() {
function MiniLogo() {
return <StyledLogo src={Images.MINI_LOGO} alt="pupago mini logo" />;
}

Expand Down
2 changes: 1 addition & 1 deletion client/src/components/atoms/resources/CryingPapago.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const Logo = styled.img`
height: 144px;
`;

export function CryingPapago() {
function CryingPapago() {
return <Logo src={Images.CRYING_PAPAGO} alt="crying papago" />;
}

Expand Down
2 changes: 1 addition & 1 deletion client/src/components/atoms/resources/LanguageTag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const StyledLanguageTag = styled.div<LanguageTagPropsType>`
color: white;
`;

export function LanguageTag({ language, isMe }: LanguageTagPropsType) {
function LanguageTag({ language, isMe }: LanguageTagPropsType) {
return (
<StyledLanguageTag language={language} isMe={isMe}>
{language === LangCode.KOREAN ? '가' : 'A'}
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/atoms/resources/ProfileImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const StyledProfileImage = styled.div<ProfileImagePropsType>`
background-color: WHITE;
`;

export function ProfileImage({ size, isMe, image }: ProfileImagePropsType) {
function ProfileImage({ size, isMe, image }: ProfileImagePropsType) {
return (
<StyledProfileImage size={size} isMe={isMe} image={image}>
{image && <StyledProfileImageSrc alt="profile image" src={image} imageSize={size}></StyledProfileImageSrc>}
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/atoms/texts/RoomCode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const StyledRoomCodeText = styled.p`
letter-spacing: 1.4px;
`;

export function RoomCode({ code, onClick }: RoomCodeTextPropsType) {
function RoomCode({ code, onClick }: RoomCodeTextPropsType) {
return (
<StyledRoomCode onClick={onClick}>
<StyledRoomCodeText>{code}</StyledRoomCodeText>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const MarginedText = styled(Text)`
margin-top: 2px;
`;

export const ParticipantCount = ({ maxCapacity, participatingCount }: ParticipantCountPropsType) => {
function ParticipantCount({ maxCapacity, participatingCount }: ParticipantCountPropsType) {
return (
<ParticipantCountWrapper>
<MiniLogo />
Expand All @@ -31,6 +31,6 @@ export const ParticipantCount = ({ maxCapacity, participatingCount }: Participan
</MarginedText>
</ParticipantCountWrapper>
);
};
}

export default ParticipantCount;
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const TextWrapper = styled.div`
width: 152px;
`;

export const ParticipantItem = ({ imageLink, language, isMe, nickname }: ParticipantItemPropsType) => {
function ParticipantItem({ imageLink, language, isMe, nickname }: ParticipantItemPropsType) {
return (
<ParticipantItemWrapper>
<ProfileImage size="size-40" image={imageLink} isMe={isMe} />
Expand All @@ -37,6 +37,6 @@ export const ParticipantItem = ({ imageLink, language, isMe, nickname }: Partici
<LanguageTag language={language} isMe={isMe} />
</ParticipantItemWrapper>
);
};
}

export default ParticipantItem;
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,7 @@ const ModalContentWrapper = styled.div`
height: inherit;
`;

export const RoomSwitchModal = ({
onClickConfirm,
onClickCancel,
onClickBackground,
onClickClose,
}: RoomSwitchModalPropsType) => {
function RoomSwitchModal({ onClickConfirm, onClickCancel, onClickBackground, onClickClose }: RoomSwitchModalPropsType) {
const { formatMessage } = useIntl();
return (
<div>
Expand All @@ -65,6 +60,6 @@ export const RoomSwitchModal = ({
</ChatModalBoxWrapper>
</div>
);
};
}

export default RoomSwitchModal;
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,28 @@ export type VoiceRecognitionModalPropsType = {
onClickBackground?: () => void;
};

const VoiceRecognitionModalWrapper = styled.div`
position: relative;
display: flex;
justify-content: center;
align-items: center;
`;

const VoiceRecognitionWrapper = styled.div`
position: absolute;
left: 520px;
top: 240px;
`;

export const VoiceRecognitionModal = ({ onClickBackground }: VoiceRecognitionModalPropsType) => {
function VoiceRecognitionModal({ onClickBackground }: VoiceRecognitionModalPropsType) {
return (
<div>
<VoiceRecognitionModalWrapper>
<ChatModalBackground onClick={onClickBackground} />
<VoiceRecognitionWrapper>
<VoiceRecognition />
</VoiceRecognitionWrapper>
</div>
</VoiceRecognitionModalWrapper>
);
};
}

export default VoiceRecognitionModal;
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ const RightAlignedText = styled(Text)`
margin-top: 4px;
`;

export const RoomCreation = ({
function RoomCreation({
TypedWordCount,
MaxWordCount,
privateSelected,
InputOnChange,
value,
isPrivateOnClick,
}: RoomCreationPropsType) => {
}: RoomCreationPropsType) {
const { formatMessage } = useIntl();
return (
<>
Expand All @@ -79,6 +79,6 @@ export const RoomCreation = ({
</RoomCreationWrapper>
</>
);
};
}

export default RoomCreation;
Loading

0 comments on commit be6ef60

Please sign in to comment.