Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
3bae956
feat(error): 시간 카운트다운 마이너스 시 -1에서 멈추고 오류 토스트 출력
gyuZzang Dec 7, 2021
00e0a59
Merge branch 'develop' of https://github.com/strong-win/stock-craft i…
gyuZzang Dec 10, 2021
fcc8a9f
feat(error): 빈 아이템 처리 요청, 빈 거래 처리 요청 오류 메시지 출력
gyuZzang Dec 10, 2021
0ab89a1
receiveErrorSaga 추가
rxdcxdrnine Dec 12, 2021
32cd7c4
feat: 페이지 전반 레이아웃 조정 및 뷰 수정
gyuZzang Dec 12, 2021
e0f4b57
feat(ban): 자물쇠 아이콘 중앙 정렬
gyuZzang Dec 12, 2021
2678623
fix(item): 서버 오류 메시지 출력 및 아이템 오류 수정
gyuZzang Dec 12, 2021
d9b893c
feat(game): 게임 종료 시 대기방으로 이동 및 스테이트 정리
gyuZzang Dec 13, 2021
1c01c89
feat(main): 메인 페이지 레이아웃 중앙정렬, 타이틀 수정
gyuZzang Dec 13, 2021
eda53c4
Merge branch 'feature/error-toast' of https://github.com/strong-win/s…
gyuZzang Dec 13, 2021
5e2679d
dayScore/weekScore Saga 함수 추가
rxdcxdrnine Dec 13, 2021
4756304
feat(score): 최종 스코어 보드 고도화
gyuZzang Dec 13, 2021
dc9f3cb
feat(role): 역할 카드 점수 적용 및 스코어보드 수정
gyuZzang Dec 13, 2021
c9db50b
fix(exit): 게임 나갈 때 time, chart 리셋 안되는 오류 수정
gyuZzang Dec 13, 2021
ad245b4
chart 범위 수정 및 소숫점 추가
rxdcxdrnine Dec 13, 2021
d33ad43
feat(role): 롤카드, 롤 안내 모달에 세력 타겟 정보 추가
gyuZzang Dec 13, 2021
07c66a1
Merge branch 'feature/fe-cssQA' of https://github.com/strong-win/stoc…
gyuZzang Dec 13, 2021
306af8c
feat(waiting): 대기방 play중인 유저들 상태 색상 표시
gyuZzang Dec 13, 2021
520b85c
fix(item): 플레이어 업데이트시 아이템 추가로 생기는 에러 수정
gyuZzang Dec 13, 2021
c108c08
feat(font): 플레이 페이지 폰트 적용
gyuZzang Dec 13, 2021
1789f2f
feat(font): waitingPage 폰트 적용
gyuZzang Dec 13, 2021
c189ed3
fix(item): 아이템 선택 안 되는 오류 수정
gyuZzang Dec 13, 2021
7b80e4c
feat(role): 세력 기관 역할카드 이미지 삽입
gyuZzang Dec 13, 2021
3f02627
feat(score): 스코어 보드 헤더 적용
gyuZzang Dec 13, 2021
1c9e738
fix(ban): 전체 페이지 떨림 현상 오류 수정
gyuZzang Dec 13, 2021
4d2e701
fix(QA): FE QA 피드백 수정
gyuZzang Dec 20, 2021
6f7290d
fix(QA): fe 2차 QA 피드백 수정
gyuZzang Dec 20, 2021
43915ad
fix(tutorial): 튜토리얼 이미지 변경
gyuZzang Dec 20, 2021
6332ecc
fix(room): 없는 방 입장할 때 자동으로 새로운 방 생성되도록
gyuZzang Dec 20, 2021
48dd209
fix: qa 3차 - 시간 20초로 변경 및 결과표 오류 개선
gyuZzang Dec 20, 2021
3ec86e4
feat(favicon): favicon 코인 이미지로 변경
gyuZzang Dec 20, 2021
4816642
user state 내 infoMessages 추가
rxdcxdrnine Dec 20, 2021
94ccbe4
feat(toast): 거래 처리 결과 메시지 출력
gyuZzang Dec 20, 2021
111d4dc
fix(scoreBoard): corp tab 뜨는 이슈 해결
gyuZzang Dec 20, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20,883 changes: 20,851 additions & 32 deletions app/package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"react-redux": "^7.2.5",
"react-router-dom": "5.3.0",
"react-scripts": "4.0.3",
"react-toastify": "^8.1.0",
"reactstrap": "8.10.0",
"recharts": "2.1.4",
"redux": "^4.1.1",
Expand Down
Binary file modified app/public/favicon.ico
Binary file not shown.
Binary file added app/src/assets/institution.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/assets/party.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/assets/tutorial2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions app/src/components/Asset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const Asset = ({ cash, assets, corps, tick }) => {
{
name: "평균 수익률",
value: totalPurchaseAmount
? Math.floor((totalDiff / totalPurchaseAmount) * 100)
? ((totalDiff / totalPurchaseAmount) * 100).toFixed(1)
: 0,
unit: "%",
},
Expand All @@ -95,10 +95,10 @@ const Asset = ({ cash, assets, corps, tick }) => {
<AssetItem name={asset.name} value={asset.value} unit={asset.unit} />
));
return (
<>
<div className="assetWrapper">
<div className="assetTitle">보유 자산</div>
{AssetItemsComponent}
</>
</div>
);
};

Expand Down
5 changes: 3 additions & 2 deletions app/src/components/Chatting/Message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ type MessageProps = {
name: string;
user: string;
text: string;
hideName: boolean;
};

const Message = ({ name, user, text }: MessageProps) => {
const Message = ({ hideName, name, user, text }: MessageProps) => {
const isMessageByUser: boolean = name === user ? true : false;
const isMessageByManager: boolean = user === "관리자";
return isMessageByUser ? (
Expand All @@ -15,7 +16,7 @@ const Message = ({ name, user, text }: MessageProps) => {
</div>
) : (
<div className="messageWrapper justifyStart">
<div>{user}</div>
{!hideName && <div>{user}</div>}
<div
className={
isMessageByManager
Expand Down
7 changes: 6 additions & 1 deletion app/src/components/Chatting/Messages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ const Messages = ({ name, messages }: ChattingProps) => {
<div className="messages">
{messages.map(({ user, text }, index) => (
<div key={index}>
<Message name={name} user={user} text={text} />
<Message
hideName={index && messages[index - 1].user === user}
name={name}
user={user}
text={text}
/>
</div>
))}
<div ref={messagesEndRef} />
Expand Down
58 changes: 26 additions & 32 deletions app/src/components/Chatting/RoleCard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ROLE_TYPE } from "../../constants/role";
import { AssetState } from "../../modules/user";
import "../../styles/Chatting.css";

const AssetItem = ({ name, value, unit }) => {
Expand All @@ -13,49 +12,27 @@ const AssetItem = ({ name, value, unit }) => {
);
};

const RoleCard = ({ role, cash, assets, corps, tick }) => {
const totalPurchaseAmount = assets
.map((asset: AssetState) => asset.purchaseAmount)
.reduce(
(previousValue: number, currentValue: number) =>
previousValue + currentValue
);

const currentAmounts: number[] = corps.map((corp) => {
const nowPrice =
corp?.todayChart[tick - 1] || corp?.totalChart?.at(-1) || 0;
return (
nowPrice *
assets.find((asset: AssetState) => asset.corpId === corp.corpId)
?.totalQuantity
);
});

const totalCurrentAmount = currentAmounts.reduce(
(previousValue: number, currentValue: number) =>
previousValue + currentValue
);

const totalDiff = totalCurrentAmount - totalPurchaseAmount;

const RoleCard = ({ role, score, corps }) => {
const assetData = [
{
name: "거래 이익",
value: Math.floor(totalDiff) || 0,
name: "기본 점수",
value: Math.floor(score?.basic) || 0,
unit: "점",
},
{
name: "보너스 점수",
value: 0,
name: "직업 점수",
value: Math.floor(score?.bonus) || 0,
unit: "점",
},
{
name: "최종 점수",
value: totalCurrentAmount + cash?.totalCash || 0,
value: Math.floor(score?.basic + score?.bonus),
unit: "점",
},
];

const targetCorp = corps.find((corp) => corp.target !== 0);

const roleAssetItems = assetData.map((asset) => (
<AssetItem name={asset.name} value={asset.value} unit={asset.unit} />
));
Expand All @@ -68,8 +45,25 @@ const RoleCard = ({ role, cash, assets, corps, tick }) => {
<div className="roleImageWrapper">
<img className="roleImage" src={ROLE_TYPE[role]?.IMAGE} />
</div>
<div className="roleAssetWrapper">{roleAssetItems}</div>
<div className="roleAssetWrapper">
{roleAssetItems}
{role === "party" && (
<div className="partyTarget">
<AssetItem
name="타겟 종목"
value={targetCorp?.corpName}
unit=""
/>
<AssetItem
name="타겟 가격"
value={targetCorp?.target}
unit="원"
/>
</div>
)}
</div>
</div>
<div className="roleNotice">점수는 하루 간격으로 업데이트 됩니다.</div>
</div>
);
};
Expand Down
26 changes: 7 additions & 19 deletions app/src/components/Chatting/index.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
import React, { useState } from "react";
import { Card, CardHeader, CardBody, CardFooter, Tooltip } from "reactstrap";
import { AssetState, CashState, MessageState } from "../../modules/user";
import { MessageState, PlayerScore } from "../../modules/user";
import { FiUser } from "react-icons/fi";

import "../../styles/Chatting.css";

import ChatInput from "./ChatInput";
import Messages from "./Messages";
import RoleCard from "./RoleCard";
import { ChartState } from "../../modules/stock";
import Ban from "../Ban";

import { ChartState } from "../../modules/stock";

type ChattingProps = {
name: string;
room: string;
message: string;
userStatus: string;
cash: CashState;
assets: AssetState[];
corps: ChartState[];
score: PlayerScore;
role: string;
tick: number;
corps: ChartState[];
disabled: boolean;
setMessage: React.Dispatch<React.SetStateAction<string>>;
sendMessage: (e: any) => void;
Expand All @@ -35,11 +32,9 @@ const Chatting = ({
message,
messages,
userStatus,
cash,
role,
score,
corps,
tick,
assets,
role,
setMessage,
sendMessage,
}: ChattingProps) => {
Expand All @@ -65,13 +60,7 @@ const Chatting = ({
</CardHeader>
<CardBody className="chattingBody">
{userStatus === "play" && isNickNameHover && (
<RoleCard
assets={assets}
corps={corps}
tick={tick}
cash={cash}
role={role}
/>
<RoleCard score={score} role={role} corps={corps} />
)}
<Messages name={name} messages={messages} />
</CardBody>
Expand All @@ -85,7 +74,6 @@ const Chatting = ({
</CardFooter>
</Card>
</>

);
};

Expand Down
15 changes: 9 additions & 6 deletions app/src/components/Clock.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useState, useEffect, useRef } from "react";
import { Col, Row } from "reactstrap";
import { toast } from "react-toastify";

import "../styles/Clock.css";

Expand All @@ -10,19 +11,19 @@ const Tick = {
},
1: {
status: "아침",
duration: 15,
duration: 20,
},
2: {
status: "점심",
duration: 15,
duration: 20,
},
3: {
status: "저녁",
duration: 15,
duration: 20,
},
4: {
status: "밤",
duration: 15,
duration: 20,
},
};

Expand Down Expand Up @@ -50,12 +51,14 @@ const Clock = ({ week, day, tick, handleTimeOut }) => {
const isDark = day === 0 || tick % 4 === 0;

useInterval(() => {
setSecond(second - 1);
if (second >= 0) setSecond(second - 1);
}, 1000);

useEffect(() => {
if (second <= 0) {
if (second === 0) {
handleTimeOut();
} else if (second < 0) {
toast.error("네트워크 오류로 시간이 지연됩니다. 잠시만 기다려주세요");
}
}, [second]);

Expand Down
Loading