Skip to content

Commit

Permalink
fix: added missing files
Browse files Browse the repository at this point in the history
  • Loading branch information
mxgic1337 committed Jan 3, 2025
1 parent 5a31819 commit 6ae62fb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/generator/tabs/StatisticsTab.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {tl} from "../../translations/translations.ts";
import {InfoBox} from "../../components/generator/InfoBox.tsx";
import {Dispatch, useContext} from "react";
import {Statistic} from "../../components/generator/Statistic.tsx";
Expand Down
14 changes: 9 additions & 5 deletions widget/src/widget/Widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ export const Widget = ({preview}: { preview: boolean }) => {
const [customBorderColor, setCustomBorderColor] = useState<string>()
const [customBorderColor2, setCustomBorderColor2] = useState<string>()
const overrides = useContext(SettingsContext);

const translate = useCallback((text: string, args?: string[])=>{
return tl(language, text, args)
}, [language])

/* Apply settings from query params */
useLayoutEffect(() => {
Expand Down Expand Up @@ -365,9 +369,9 @@ export const Widget = ({preview}: { preview: boolean }) => {
diff = elo - startingElo
}

let text = tl(language, `widget.elo${!showEloSuffix ? "_no_suffix" : ""}`, [String(currentElo)])
let text = translate(`widget.elo${!showEloSuffix ? "_no_suffix" : ""}`, [String(currentElo)])
if (showEloDiff) {
text += tl(language, `widget.elo_diff`, [`${diff >= 0 ? `+${diff}` : String(diff)}`])
text += translate(`widget.elo_diff`, [`${diff >= 0 ? `+${diff}` : String(diff)}`])
}
return text;
}, [language, elo, startingElo, showEloDiff, showEloSuffix]);
Expand Down Expand Up @@ -407,16 +411,16 @@ export const Widget = ({preview}: { preview: boolean }) => {
</div>
<div className={'matches'}>
<div className={'stats'}>
<Statistic color={'green'} value={String(wins)} text={tl(language, 'widget.wins')}/>
<Statistic color={'red'} value={String(losses)} text={tl(language, 'widget.losses')}/>
<Statistic color={'green'} value={String(wins)} text={translate('widget.wins')}/>
<Statistic color={'red'} value={String(losses)} text={translate('widget.losses')}/>
</div>
</div>
</div>
{showStatistics &&
<div className={'average'}>
{stats.map(stat => {
return <div className={'stat'}>
<p>{tl(language, `widget.${stat.toLowerCase()}`)}</p>
<p>{translate(`widget.${stat.toLowerCase()}`)}</p>
<p>{getStat(stat)}</p>
</div>
})}
Expand Down

0 comments on commit 6ae62fb

Please sign in to comment.