Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/#12 #15

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
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
6,176 changes: 6,176 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"preview": "vite preview"
},
"dependencies": {
"npm": "^10.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
Expand Down
4 changes: 3 additions & 1 deletion src/App.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.App {
width: 100vi;
height: 100vh;
height: 100dvh;
background-color: #1F2329;
}
display: flex;
}
12 changes: 6 additions & 6 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import './reset.css'
import Sidebar from "./components/sidebar/sidebar";

function App() {
return (
<div className="App">
<Sidebar />
</div>
);
return (
<div className="App">
<Sidebar />
</div>
);
}

export default App;
export default App;
Binary file added src/assets/betting/list-page/img/whale_3d.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 0 additions & 18 deletions src/components/betting/BettingDetail.jsx

This file was deleted.

18 changes: 18 additions & 0 deletions src/components/betting/betting-teams/BettingDetail.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react';
import './bettingDetail.css';
import RightTeam from './RightTeam';
import LeftTeam from './LeftTeam';

function BettingDetail({ teams }){
return (
<div id={"BettingDetail"}>
<LeftTeam info={teams.LeftTeam} />
<div className='line-box'>
<div className="line" />
</div>
<RightTeam info={teams.RightTeam} />
</div>
);
}

export default BettingDetail;
2 changes: 1 addition & 1 deletion src/components/betting/betting-teams/LeftTeam.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
}

#LeftTeam .LeftTeam-bettingpercent{
width: 4.5rem;
width: 5.5rem;
height: 2.25rem;
flex-shrink: 0;

Expand Down
43 changes: 26 additions & 17 deletions src/components/betting/betting-teams/LeftTeam.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import './LeftTeam.css';

import money from '../../../assets/betting/img/blue_money.svg'
import people from '../../../assets/betting/img/blue_people.svg'
import percent from '../../../assets/betting/img/blue_percent.svg'
import money from '../../../assets/betting/component/img/blue_money.svg'
import people from '../../../assets/betting/component/img/blue_people.svg'
import percent from '../../../assets/betting/component/img/blue_percent.svg'

function LeftTeam({ info }) {
let progressbarLength = info ? info.bettingpercent/10 : 10;
let totalBettingMoney = info ? info.totalbettingmoney : 0;
let UnitIndex = 0;
let moneyUnit = ['', 'K', 'M', 'B', 'T', 'Qd', 'Qnt', 'Sxt', 'Sep', 'Oct', 'Non', 'Dec'];

function LeftTeam(props) {
const LeftTeamProgressbar = {
width: `${props.info.progressbarLength}rem`,
width: `${progressbarLength}rem`,
height: '0.75rem',
flexShrink: '0',

Expand All @@ -16,31 +21,35 @@ function LeftTeam(props) {
background: '#3879FE',
};

while (totalBettingMoney >= 1000){
totalBettingMoney = totalBettingMoney / 1000;
UnitIndex += 1;
}

return (
<div id={"LeftTeam"}>
<div className='LeftTeam-name'>{props.info.name}</div>
<div id='LeftTeam'>
<div className='LeftTeam-name'>{info ? info.name : '0반'}</div>
<div className='LeftTeam-totalbettingmoney'>
<div className='img'>
<img src={money} alt='money' />
</div>
<img src={money} alt='money' />
<div className='LeftTeam-totalbettingmoney-text'>
{props.info.totalbettingmoney}
{/* {totalBettingMoney}{moneyUnit[UnitIndex] ? moneyUnit[UnitIndex] : moneyUnit[0]} */}
{0}
</div>
</div>
<div className='LeftTeam-odds'>
<img src={percent} alt='percent' />
<img src={people} alt='people' />
<div className='LeftTeam-odds-text'>
{props.info.odds}
{info ? info.odds : 0}
</div>
</div>
<div className='LeftTeam-personnel'>
<img src={people} alt='people' />
<img src={percent} alt='percent' />
<div className='LeftTeam-personnel-text'>
{props.info.personnel}
{info ? info.personnel : 0}
</div>
</div>
<div className='LeftTeam-bettingpercent'>{props.info.bettingpercent}%</div>
<div className='LeftTeam-progressbar' style={LeftTeamProgressbar}>{props.info.progressbar}</div>
<div className='LeftTeam-bettingpercent'>{info ? info.bettingpercent : 100}%</div>
<div style={LeftTeamProgressbar}></div>
</div>
)
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/betting/betting-teams/RightTeam.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
}

#RightTeam .RightTeam-bettingpercent{
width: 4.5rem;
width: 5.5rem;
height: 2.25rem;
flex-shrink: 0;

Expand Down
32 changes: 21 additions & 11 deletions src/components/betting/betting-teams/RightTeam.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import './RightTeam.css';

import money from '../../../assets/betting/img/red_money.svg'
import people from '../../../assets/betting/img/red_people.svg'
import percent from '../../../assets/betting/img/red_percent.svg'
import money from '../../../assets/betting/component/img/red_money.svg'
import people from '../../../assets/betting/component/img/red_people.svg'
import percent from '../../../assets/betting/component/img/red_percent.svg'

function RightTeam({ info }){
let progressbarLength = info ? info.bettingpercent/10 : 10;
let totalBettingMoney = info ? info.totalbettingMoney : 0;
let UnitIndex = 0;
let moneyUnit = ['', 'K', 'M', 'B', 'T', 'Qd', 'Qnt', 'Sxt', 'Sep', 'Oct', 'Non', 'Dec'];

function RightTeam(props){
const RightTeamProgressbar = {
width: `${props.info.progressbarLength}rem`,
width: `${progressbarLength}rem`,
height: '0.75rem',
flexShrink: '0',

Expand All @@ -16,29 +21,34 @@ function RightTeam(props){
background: '#F5019B',
};

while (totalBettingMoney >= 1000){
totalBettingMoney = totalBettingMoney / 1000;
UnitIndex += 1;
}

return (
<div id='RightTeam'>
<div className='RightTeam-name'>{props.info.name}</div>
<div className='RightTeam-name'>{info ? info.name : '0반'}</div>
<div className='RightTeam-totalbettingmoney'>
<div className='RightTeam-totalbettingmoney-text'>
{props.info.totalbettingmoney}
{totalBettingMoney}{moneyUnit[UnitIndex] ? moneyUnit[UnitIndex] : ''}
</div>
<img src={money} alt='money' />
</div>
<div className='RightTeam-odds'>
<div className='RightTeam-odds-text'>
{props.info.odds}
{info ? info.odds : 0}
</div>
<img src={people} alt='people' />
</div>
<div className='RightTeam-personnel'>
<div className='RightTeam-personnel-text'>
{props.info.personnel}
{info ? info.personnel : 0}
</div>
<img src={percent} alt='percent' />
</div>
<div className='RightTeam-bettingpercent'>{props.info.bettingpercent}%</div>
<div style={RightTeamProgressbar}>{props.info.progressbar}</div>
<div className='RightTeam-bettingpercent'>{info ? info.bettingpercent : 100}%</div>
<div style={RightTeamProgressbar}></div>
</div>
)
}
Expand Down
15 changes: 15 additions & 0 deletions src/components/betting/set/BettingSet.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import './bettingSet.css'
import BettingTitle from '../title/BettingTitle';
import BettingDetail from './../betting-teams/BettingDetail';

function BettingSet({ betting }){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아마 실제로 사용하게 된다면 이 함수가 호출되고 난 뒤에 데이터를 불러올것 같은데 불러오는 코드는 어디있죠?
그리고 지금 DB를 연결할 수 없어서 연결해서 데이터를 불러온것처럼 코드 작성을 요청드렸었는데 그 코드 어디있죠..?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 함수가 호출되기 전에 페이지에서 api로 데이터를 끌고 와서 보여줄 거로 저는 생각을 하고 개발을 하였는데 이 함수에서 데이터를 호출시키는 거 였나요?

return (
<div id="BettingSet" className="BettingSet">
<BettingTitle title={betting.title} />
<div className='emptyspace'></div>
<BettingDetail teams={betting.teams} />
</div>
);
}

export default BettingSet;
9 changes: 9 additions & 0 deletions src/components/betting/set/bettingSet.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#BettingSet {
width: 22.5rem;
height: 13.6rem;
}

#BettingSet .emptyspace {
width: 22.5rem;
height: 0.25rem;
}
19 changes: 11 additions & 8 deletions src/components/betting/title/BettingTitle.jsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import './bettingTitle.css'

function BettingTitle(props) {
let deadline = ``;
function BettingTitle({ title }) {
let deadline;

if (props.hour){
deadline += `${props.hour}시간 ${props.minute}분`;
} else if (props.minute){
deadline += `${props.minute}분`;
}
switch(true) {
case !!title.hour:
deadline = `${title.hour}시간 ${title.minute}분`;
case !!title.minute:
deadline = `${title.minute}분`;
default:
deadline = '0시간 0분';
};

return (
<div id={"BettingTitle"}>
<h4 className="main-title">{props.title}</h4>
<h4 className="main-title">{title ? title.title : 'BTO 배팅'}</h4>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아.. 진짜 임의 데이터를 넣으셨군요...
퍼블리싱 할때는 DB 연결됬다고 가정한 후 코드를 작성해 주세요.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

알겠습니다.

<p className="deadline">{deadline} 후에 마감이 됩니다</p>
</div>
);
Expand Down
4 changes: 2 additions & 2 deletions src/components/betting/title/bettingTitle.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
background: #363636;
}

#BettingTitle > .main-title {
#BettingTitle .main-title {
width: 8.37881rem;
height: 1.08694rem;
flex-shrink: 0;
Expand All @@ -32,7 +32,7 @@
line-height: normal;
}

#BettingTitle > .deadline {
#BettingTitle .deadline {
width: 10.24913rem;
height: 0.86956rem;
flex-shrink: 0;
Expand Down
File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions src/pages/betting/list/BettingList.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#BettingList {
margin: 0;
padding: 0;
}

#BettingList .event {
display: flex;
}

#BettingList .pageTitle {
color: #FFF;
text-align: center;
font-family: WAGURI;
font-size: 1.25rem;
font-style: normal;
font-weight: 400;
line-height: normal;
}
29 changes: 29 additions & 0 deletions src/pages/betting/list/BettingList.jsx
Copy link
Collaborator Author

@ljhy07 ljhy07 Jun 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기 이 파일에 json을 이용해서 betting-set 컴포넌트을 활용한 코드가 있습니다.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feat/#12 에서 개발하실때 app.jsx에서 실제로 적용시킨 다음에 개발해 주시고 거기서 실행된다는것을 보여주시면 됩니다.

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import './BettingList.css';
import BettingSet from './../../../components/betting/set/BettingSet';

function BettingList({ eventList }){
let bettingEvents = Object.keys(eventList); // 배팅 종목들 ex) 농구, 축구, 이어달리기

let bettingList = Object.values(eventList).map((bettings, index) => {
return (
<div key={index} className='event'>
<h2>{bettingEvents[index]}</h2>
{
Object.values(bettings).map((betting, index) => {
return (
<BettingSet key={betting.id || index} betting={betting} />
);
})
}
</div>
);
});

return (
<div id='BettingList'>
{bettingList}
</div>
);
}

export default BettingList;
30 changes: 30 additions & 0 deletions src/pages/betting/list/banner/Banner.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#Banner {
/* width: 92.5rem;
height: 21.625rem; */
width: 65rem;
height: 15rem;
flex-shrink: 0;

border-radius: 1.25rem;
background: linear-gradient(90deg, #4D4FE2 0%, #1A8FEC 100%);
}

#Banner .bettingTitleText {
color: #FFF;
text-align: center;
font-family: WAGURI;
font-size: 2.625rem;
font-style: normal;
font-weight: 400;
line-height: normal;
}

#Banner .bettingTeamText {
color: #FFF;
text-align: center;
font-family: WAGURI;
font-size: 1.25rem;
font-style: normal;
font-weight: 400;
line-height: normal;
}
Loading