Skip to content

Commit

Permalink
Docs: 자잘한거
Browse files Browse the repository at this point in the history
  • Loading branch information
lucy726j committed Sep 28, 2024
1 parent 674751b commit 61e9d91
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/Component/Game/GameHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const GameHeader: React.FC<GameHeaderProp> = ({ text }) => {
<Container>
<>{text}</>
{rule === "gameStocks" ||
rule === "total" ||
rule === "result" ||
rule === "rank" ||
rule === "info" ? (
<></>
Expand Down
4 changes: 3 additions & 1 deletion src/Component/Game/Rank/rankBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ const RankBox: React.FC<RankDataProps> = ({
<S.UserContainer>
<S.Nickname>{nickname}</S.Nickname>
<S.Budget>{formatPrice(total)}</S.Budget>
<S.Rate style={formatRateColor(profitRate)}>{profitRate} %</S.Rate>
<S.Rate style={formatRateColor(profitRate)}>
{profitRate.toFixed(1)} %
</S.Rate>
</S.UserContainer>
</S.Container>
);
Expand Down
2 changes: 1 addition & 1 deletion src/Pages/game/rank.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const Rank = () => {
<TitleContainer>
<p style={{ marginLeft: "1.7rem" }}>순위</p>
<p style={{ marginLeft: "2rem" }}>닉네임</p>
<p style={{ marginLeft: "10rem" }}>수익금</p>
<p style={{ marginLeft: "9rem" }}>수익금</p>
<p style={{ marginLeft: "5rem" }}>수익률</p>
</TitleContainer>
<RankList data={rankList} />
Expand Down
19 changes: 8 additions & 11 deletions src/util/gameUtil.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
import React from "react";
import { P } from "../Component/GoogleLogin/loginStyle";

export const formatPrice = (num: number): string => {
if (num === 0) {
return "-";
return "0";
}

return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
};

export const formatPriceWithYear = (num: number, year: string): string => {
if (num === 0 && year !== "2014") {
return "상장폐지";
}
if (num === 0) {
return "-";
}
if (num === 0 && year !== "2014") {
return "상장폐지";
}
if (num === 0) {
return "-";
}

return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
};

export const formatChangeRate = (changeRate: number): string => {
Expand Down

0 comments on commit 61e9d91

Please sign in to comment.