Skip to content

Commit

Permalink
Artifact Upgrade Probability Calculator (dev-mode only) (#1209)
Browse files Browse the repository at this point in the history
* Please dont go into master please please

* fast eval matches

* fast eval w/ 4th sub working!

* golf?

* :)

* slowEval working :)

* big ass comment

* integrate new class (I think)

* strip out old code

* delet old code

* explain some magic numbers

* sigma is so scuffed lmao

* format differentiate

* fix (?) import errors

* fix and refactor code

* finish implementing calcExact

* update page layout

* fix wacky percents

* clicking button calls calcExact (UI doesnt update tho)

* fix rendering, annotate bug

* unify visualization for exact & approximation. Theres a bug w/ calcExact4th.

* fix lint

* fix 4thExact

* close the opening histogram :)

* fix type

* bugfix: calcExact index

* fix exactConstrained; change text & color for exact.

* make exact & est colors more similar

* lint/format?

* lazy load exact graph, show equipped

* bugfix: graph left of red line disappears

* bugfix on bugfix: last "fix" was wrong oop

* fix lint

* Hide UI behind dev flag

* Fix api calls

* Fix spacing

* Add translation key to NoArtWarning

* Remove dead code

---------

Co-authored-by: frzyc <[email protected]>
Co-authored-by: Van Nguyen <[email protected]>
Co-authored-by: Polomo <[email protected]>
  • Loading branch information
4 people authored Nov 12, 2023
1 parent eb2a4a2 commit 5333ea4
Show file tree
Hide file tree
Showing 9 changed files with 943 additions and 32 deletions.
14 changes: 14 additions & 0 deletions apps/frontend/src/app/Components/AddArtInfo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Alert, Link } from '@mui/material'
import { Link as RouterLink } from 'react-router-dom'

export default function AddArtInfo() {
return (
<Alert severity="info" variant="filled">
Looks like you haven't added any artifacts yet. If you want, there are
<Link color="warning.main" component={RouterLink} to="/scanner">
automatic scanners
</Link>
that can speed up the import process!
</Alert>
)
}
19 changes: 19 additions & 0 deletions apps/frontend/src/app/Components/NoArtWarning.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Alert, Link } from '@mui/material'
import { Trans, useTranslation } from 'react-i18next'
import { Link as RouterLink } from 'react-router-dom'

export default function NoArtWarning() {
const { t } = useTranslation('page_character_optimize')
return (
<Alert severity="warning" variant="filled">
<Trans t={t} i18nKey="noArtis">
Oops! It looks like you haven't added any artifacts to GO yet! You
should go to the
<Link component={RouterLink} to="/artifacts">
Artifacts
</Link>
page and add some!
</Trans>
</Alert>
)
}
14 changes: 2 additions & 12 deletions apps/frontend/src/app/PageArtifact/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ import { clamp, filterFunction, sortFunction } from '@genshin-optimizer/util'
import { Add } from '@mui/icons-material'
import DifferenceIcon from '@mui/icons-material/Difference'
import {
Alert,
Box,
Button,
CardContent,
Grid,
Link,
Pagination,
Skeleton,
Typography,
Expand All @@ -30,7 +28,7 @@ import React, {
} from 'react'
import ReactGA from 'react-ga4'
import { Trans, useTranslation } from 'react-i18next'
import { Link as RouterLink } from 'react-router-dom'
import AddArtInfo from '../Components/AddArtInfo'
import SubstatToggle from '../Components/Artifact/SubstatToggle'
import BootstrapTooltip from '../Components/BootstrapTooltip'
import CardDark from '../Components/Card/CardDark'
Expand Down Expand Up @@ -197,15 +195,7 @@ export default function PageArtifact() {
<InfoDisplay />
</InfoComponent>

{noArtifact && (
<Alert severity="info" variant="filled">
Looks like you haven't added any artifacts yet. If you want, there are
<Link color="warning.main" component={RouterLink} to="/scanner">
automatic scanners
</Link>
that can speed up the import process!
</Alert>
)}
{noArtifact && <AddArtInfo />}

<ArtifactFilter
numShowing={artifactIds.length}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ import {
import NotificationsActiveIcon from '@mui/icons-material/NotificationsActive'
import NotificationsOffIcon from '@mui/icons-material/NotificationsOff'
import {
Alert,
Box,
Button,
ButtonGroup,
CardContent,
Divider,
Grid,
Link,
MenuItem,
Skeleton,
ToggleButton,
Expand All @@ -37,7 +35,7 @@ import React, {
useState,
} from 'react'
import { Trans, useTranslation } from 'react-i18next'
import { Link as RouterLink, useLocation, useNavigate } from 'react-router-dom'
import { useLocation, useNavigate } from 'react-router-dom'
import ArtifactLevelSlider from '../../../../Components/Artifact/ArtifactLevelSlider'
import BootstrapTooltip from '../../../../Components/BootstrapTooltip'
import CardLight from '../../../../Components/Card/CardLight'
Expand All @@ -48,6 +46,7 @@ import {
ReactionToggle,
} from '../../../../Components/HitModeEditor'
import InfoTooltip from '../../../../Components/InfoTooltip'
import NoArtWarning from '../../../../Components/NoArtWarning'
import SolidToggleButtonGroup from '../../../../Components/SolidToggleButtonGroup'
import SqBadge from '../../../../Components/SqBadge'
import { CharacterContext } from '../../../../Context/CharacterContext'
Expand Down Expand Up @@ -503,18 +502,7 @@ export default function TabBuild() {
const getNormBuildLabel = useCallback((index: number) => `#${index + 1}`, [])
return (
<Box display="flex" flexDirection="column" gap={1}>
{noArtifact && (
<Alert severity="warning" variant="filled">
<Trans t={t} i18nKey="noArtis">
Oops! It looks like you haven't added any artifacts to GO yet! You
should go to the
<Link component={RouterLink} to="/artifacts">
Artifacts
</Link>
page and add some!
</Trans>
</Alert>
)}
{noArtifact && <NoArtWarning />}
{/* Build Generator Editor */}
{dataContext && (
<DataContext.Provider value={dataContext}>
Expand Down
Loading

0 comments on commit 5333ea4

Please sign in to comment.