-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from boostcampwm-2024/dev-front
[FE] merge to main
- Loading branch information
Showing
33 changed files
with
387 additions
and
122 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,20 @@ | ||
import axios from 'axios'; | ||
|
||
const getGroups = async (generation: string) => { | ||
const getGroupNames = async (generation: string) => { | ||
const response = await axios.get( | ||
`${import.meta.env.VITE_API_URL}/api/project?generation=${generation}` | ||
`${import.meta.env.VITE_API_URL}/project?generation=${generation}` | ||
); | ||
return response.data; | ||
}; | ||
|
||
export { getGroups }; | ||
const getRakings = async () => { | ||
const response = await axios.get(`${import.meta.env.VITE_API_URL}/log/traffic/rank`); | ||
return response.data; | ||
}; | ||
|
||
const getTotalTraffic = async () => { | ||
const response = await axios.get(`${import.meta.env.VITE_API_URL}/log/traffic/`); | ||
return response.data; | ||
}; | ||
|
||
export { getGroupNames, getRakings, getTotalTraffic }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
type Props = { | ||
cssOption?: string; | ||
content: string; | ||
}; | ||
|
||
export default function Span({ cssOption, content = '' }: Props) { | ||
return <span className={cssOption}>{content}</span>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import useGroupNames from '@hook/useGroupNames'; | ||
|
||
import NavbarSelect from './NavbarSelect'; | ||
|
||
type Props = { | ||
generation: string; | ||
selectedGroup: string; | ||
setGeneration: (value: string) => void; | ||
setSelectedGroup: (value: string) => void; | ||
}; | ||
|
||
export default function NavbarCustomSelect({ | ||
generation, | ||
selectedGroup, | ||
setGeneration, | ||
setSelectedGroup | ||
}: Props) { | ||
const { data } = useGroupNames(generation); | ||
return ( | ||
<NavbarSelect | ||
generation={generation} | ||
selectedGroup={selectedGroup} | ||
setGeneration={setGeneration} | ||
setSelectedGroup={setSelectedGroup} | ||
groupOption={data} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { BOOST_CAMP_OPTION } from '@constant/NavbarSelect'; | ||
|
||
import NavbarSelect from './NavbarSelect'; | ||
|
||
type Props = { | ||
generation: string; | ||
selectedGroup: string; | ||
setGeneration: (value: string) => void; | ||
setSelectedGroup: (value: string) => void; | ||
}; | ||
|
||
export default function NavbarDefaultSelect({ | ||
generation, | ||
selectedGroup, | ||
setGeneration, | ||
setSelectedGroup | ||
}: Props) { | ||
return ( | ||
<NavbarSelect | ||
generation={generation} | ||
selectedGroup={selectedGroup} | ||
setGeneration={setGeneration} | ||
setSelectedGroup={setSelectedGroup} | ||
groupOption={BOOST_CAMP_OPTION} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import Img from '@component/atom/Img'; | ||
import P from '@component/atom/P'; | ||
import Span from '@component/atom/Span'; | ||
import { MEDALS } from '@constant/Medals'; | ||
import useRankings from '@hook/useRankings'; | ||
import { Ranking } from '@type/Navbar'; | ||
import { Fragment } from 'react'; | ||
|
||
export default function NavbarRanking() { | ||
const { data = [] } = useRankings(); | ||
|
||
const renderRankingItem = (item: Ranking, index: number) => { | ||
const rank = index; | ||
|
||
return ( | ||
<Fragment key={item.host}> | ||
<div className='group flex items-center justify-between gap-2 py-2 font-light hover:cursor-pointer'> | ||
<div className='flex items-center gap-2'> | ||
{rank <= 2 ? ( | ||
<Fragment> | ||
<Img src={MEDALS[rank as keyof typeof MEDALS].image} cssOption='flex-shrink-0' /> | ||
<P | ||
cssOption={`truncate ${MEDALS[rank as keyof typeof MEDALS].color}`} | ||
content={item.host} | ||
/> | ||
</Fragment> | ||
) : ( | ||
<Fragment> | ||
<Span cssOption='w-6 flex-shrink-0 font-medium' content={`${rank + 1}th`} /> | ||
<P cssOption='truncate' content={item.host} /> | ||
</Fragment> | ||
)} | ||
</div> | ||
<div className='flex min-w-0 items-center text-right'> | ||
<Span | ||
cssOption='text-[clamp(12px,1.5vw,14px)] group-hover:hidden' | ||
content={item.count} | ||
/> | ||
<Span cssOption='hidden font-medium group-hover:block' content='>' /> | ||
</div> | ||
</div> | ||
<hr className='border-gray-300' /> | ||
</Fragment> | ||
); | ||
}; | ||
|
||
return ( | ||
<div className='mt-8 rounded-10 border-1.5 border-solid border-gray p-4'> | ||
<P cssOption='text-12 mb-1 font-bold' content='TRAFFIC RANKING' /> | ||
{data.map((item, index) => renderRankingItem(item, index))} | ||
</div> | ||
); | ||
} |
Oops, something went wrong.