Skip to content

Commit

Permalink
Merge pull request #162 from osu-tournament-rating/fix/user-object-ch…
Browse files Browse the repository at this point in the history
…ange

Fix rename generalStats to baseStats
  • Loading branch information
hburn7 authored Apr 23, 2024
2 parents 11b34ef + 7ef3299 commit 22076e3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 19 deletions.
6 changes: 3 additions & 3 deletions app/dashboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ export default async function page({
}) {
const data = await fetchDashboard();

if (!data.generalStats || !data.playerInfo) {
if (!data.baseStats || !data.playerInfo) {
throw Error('4');
return;
}

return (
<main className={styles.main}>
<UserMainCard data={data?.generalStats} />
<UserMainCard data={data?.baseStats} />
<div className={styles.mainGraphContainer}>
<FilterButtons params={searchParams} />
<div className={styles.graphContainer}>
<div className={styles.header}>
<div className={styles.rating}>
<span>{Math.round(data.generalStats?.rating)}</span>
<span>{Math.round(data.baseStats?.rating)}</span>
<span
className={clsx(
styles.change,
Expand Down
7 changes: 2 additions & 5 deletions app/users/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,13 @@ export default async function page({

return (
<main className={styles.main}>
<UserMainCard
generalStats={data?.generalStats}
playerInfo={data?.playerInfo}
/>
<UserMainCard baseStats={data?.baseStats} playerInfo={data?.playerInfo} />
<div className={styles.mainGraphContainer}>
<FilterButtons params={searchParams} />
<div className={styles.graphContainer}>
<div className={styles.header}>
<div className={styles.rating}>
<span>{Math.round(data.generalStats.rating)}</span>
<span>{Math.round(data.baseStats.rating)}</span>
<span
className={clsx(
styles.change,
Expand Down
22 changes: 11 additions & 11 deletions components/Profile/UserMainCard/UserMainCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { Tooltip } from 'react-tooltip';
import styles from './UserMainCard.module.css';

export default function UserMainCardProfile({
generalStats,
baseStats,
playerInfo,
}: {
generalStats: object;
baseStats: object;
playerInfo: object;
}) {
return (
Expand All @@ -26,7 +26,7 @@ export default function UserMainCardProfile({
<div className={styles.item} id="Rating">
<div className={styles.label}>Rating</div>
<div className={styles.value}>
{Math.round(generalStats?.rating)}
{Math.round(baseStats?.rating)}
{/* <FontAwesomeIcon
icon={faAngleUp}
className={clsx(styles.arrowIcon, styles.positiveTrend)}
Expand All @@ -36,7 +36,7 @@ export default function UserMainCardProfile({
<div className={styles.item} id="Global">
<div className={styles.label}>Global</div>
<div className={styles.value}>
{`#${generalStats?.globalRank.toLocaleString('en-US')}`}
{`#${baseStats?.globalRank.toLocaleString('en-US')}`}
{/* <FontAwesomeIcon
icon={faAngleUp}
className={clsx(styles.arrowIcon, styles.negativeTrend)}
Expand All @@ -47,19 +47,19 @@ export default function UserMainCardProfile({
<div className={styles.label}>Country</div>
<div
className={styles.value}
>{`#${generalStats?.countryRank.toLocaleString('en-US')}`}</div>
>{`#${baseStats?.countryRank.toLocaleString('en-US')}`}</div>
</div>
<div className={styles.item} id="Percentile">
<div className={styles.label}>Percentile</div>
<div className={styles.value}>{`${(
generalStats?.percentile * 100
baseStats?.percentile * 100
).toFixed(1)}%`}</div>
</div>
<div className={styles.item} id="Tier">
<div className={styles.label}>Tier</div>
<div className={styles.image}>
<Tooltip
id={`tooltip-${generalStats?.rankProgress.currentTier}`}
id={`tooltip-${baseStats?.rankProgress.currentTier}`}
style={{
borderRadius: '0.6em',
fontWeight: '500',
Expand All @@ -70,10 +70,10 @@ export default function UserMainCardProfile({
place={'right'}
/>
<Image
src={`/icons/ranks/${generalStats?.rankProgress.currentTier}.svg`}
alt={generalStats?.rankProgress.currentTier}
data-tooltip-id={`tooltip-${generalStats?.rankProgress.currentTier}`}
data-tooltip-content={generalStats?.rankProgress.currentTier}
src={`/icons/ranks/${baseStats?.rankProgress.currentTier}.svg`}
alt={baseStats?.rankProgress.currentTier}
data-tooltip-id={`tooltip-${baseStats?.rankProgress.currentTier}`}
data-tooltip-content={baseStats?.rankProgress.currentTier}
data-tooltip-delay-show={400}
fill
/>
Expand Down

0 comments on commit 22076e3

Please sign in to comment.