Skip to content

Commit

Permalink
fix: adjust stat chart sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
hyochan committed Sep 27, 2024
1 parent b22f762 commit e0401fd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/components/uis/Scouter/StatsChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ import SvgStatsWater from '../../svgs/SvgStatsWater';

type Axis = {x: number; y: number};

const Container = styled.View`
const Container = styled.View<{width: number}>`
padding: 32px;
width: ${({width}) => width} + 'px';
justify-content: center;
align-items: center;
Expand Down Expand Up @@ -229,7 +230,7 @@ const StatsChart = ({
const posTree = convertPosition(centerPosition, tree, 'tree');

return (
<Container style={{width: width + 72}}>
<Container width={width + 72}>
<StatUnits centerPosition={centerPosition} onPressStat={onPressStat} />
<StatsContainer>
<ImageBackground
Expand Down
9 changes: 8 additions & 1 deletion src/components/uis/Scouter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const Scouter = ({
>;
style?: StyleProp<ViewStyle>;
}): ReactElement => {
const [width, setWidth] = useState(0);
const [selectedStat, setSelectedStat] = useState<StatType | null>(null);
const [tierName, setTierName] = useState<ScoreType['tierName']>('Silver');
const pluginStats = !githubLogin
Expand Down Expand Up @@ -68,8 +69,14 @@ const Scouter = ({
};

return (
<Container style={style}>
<Container
style={style}
onLayout={(e) => {
setWidth(e.nativeEvent.layout.width);
}}
>
<StatsChart
width={width > 330 ? 330 : width - 64}
selectedStat={selectedStat}
onPressStat={onPressStat}
statsScore={{
Expand Down

0 comments on commit e0401fd

Please sign in to comment.