-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Standardize scalesWith across character UI (#2460)
* Standardize scalesWith across character UI * unify scaling stats by removing minTotal in buildTC * remove test in gi-solver-tc * format * add ScalesWith * alert variant
- Loading branch information
Showing
32 changed files
with
364 additions
and
451 deletions.
There are no files selected for viewing
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
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
36 changes: 36 additions & 0 deletions
36
libs/gi/page-team/src/CharacterDisplay/Tabs/TabOptimize/ScalesWith.tsx
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,36 @@ | ||
import { iconInlineProps } from '@genshin-optimizer/common/svgicons' | ||
import { StatIcon } from '@genshin-optimizer/gi/svgicons' | ||
import { | ||
ArtifactStatWithUnit, | ||
OptTargetContext, | ||
} from '@genshin-optimizer/gi/ui' | ||
import { Alert } from '@mui/material' | ||
import { useContext } from 'react' | ||
import { Trans, useTranslation } from 'react-i18next' | ||
|
||
export default function ScalesWith() { | ||
const { t } = useTranslation('page_character_optimize') | ||
const { scalesWith } = useContext(OptTargetContext) | ||
return ( | ||
!!scalesWith.size && ( | ||
<Alert severity="info" variant="standard"> | ||
<Trans t={t} i18nKey="optAlert.scalesWith"> | ||
The selected Optimization target and constraints scales with:{' '} | ||
</Trans> | ||
{new Intl.ListFormat() | ||
.format(Array(scalesWith.size).fill('\u200B')) | ||
.split(/([^\u200B]+)/) | ||
.map((str, i) => | ||
str === '\u200B' | ||
? ((k) => ( | ||
<strong key={k}> | ||
<StatIcon statKey={k} iconProps={iconInlineProps} /> | ||
<ArtifactStatWithUnit statKey={k} /> | ||
</strong> | ||
))([...scalesWith][i / 2]) | ||
: str | ||
)} | ||
</Alert> | ||
) | ||
) | ||
} |
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
Oops, something went wrong.