-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
214 additions
and
72 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './char' | ||
export * from './lightCone' | ||
export * from './relic' |
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,8 @@ | ||
import type { UISheetElement } from '@genshin-optimizer/pando/ui-sheet' | ||
import type { LightConeKey } from '@genshin-optimizer/sr/consts' | ||
import PastSelfInMirror from './sheets/PastSelfInMirror' | ||
|
||
export const lightConeUiSheets: Partial<Record<LightConeKey, UISheetElement>> = | ||
{ | ||
PastSelfInMirror, | ||
} |
74 changes: 74 additions & 0 deletions
74
libs/sr/formula-ui/src/lightCone/sheets/PastSelfInMirror.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,74 @@ | ||
import { ImgIcon } from '@genshin-optimizer/common/ui' | ||
import type { UISheetElement } from '@genshin-optimizer/pando/ui-sheet' | ||
import { lightConeAsset } from '@genshin-optimizer/sr/assets' | ||
import type { LightConeKey } from '@genshin-optimizer/sr/consts' | ||
import { buffs, conditionals } from '@genshin-optimizer/sr/formula' | ||
import { mappedStats } from '@genshin-optimizer/sr/stats' | ||
import { StatDisplay } from '@genshin-optimizer/sr/ui' | ||
import { trans } from '../../util' | ||
import { SuperImposeWrapper } from '../util' | ||
|
||
const key: LightConeKey = 'PastSelfInMirror' | ||
|
||
const [chg, _ch] = trans('lightcone', key) | ||
const dm = mappedStats.lightCone[key] | ||
const icon = lightConeAsset(key, 'cover') | ||
const cond = conditionals[key] | ||
const buff = buffs[key] | ||
const sheet: UISheetElement = { | ||
title: chg('passive.name'), | ||
img: icon, | ||
documents: [ | ||
{ | ||
type: 'text', | ||
text: chg('passive.description'), // TODO: getInterpolateObject for lightcone | ||
}, | ||
{ | ||
type: 'conditional', | ||
conditional: { | ||
targeted: true, | ||
header: { | ||
icon: <ImgIcon src={icon} sx={{ width: 'auto' }} size={2} />, | ||
text: chg('passive.name'), | ||
}, | ||
metadata: cond.useUltimate, | ||
label: 'Wearer use their Ultimate', | ||
fields: [ | ||
{ | ||
title: <StatDisplay statKey="dmg_" />, | ||
fieldRef: buff.cond_dmg_.tag, | ||
}, | ||
// TODO: translate DM "Duration" | ||
{ | ||
title: 'Duration', | ||
fieldValue: ( | ||
<SuperImposeWrapper> | ||
{(superimpose) => dm.duration[superimpose]} | ||
</SuperImposeWrapper> | ||
), | ||
}, | ||
{ | ||
// TODO: should only show when wearer brEffect_ > dm.brEffect_thresh_[superimpose] | ||
title: 'Skill POint recovered', | ||
fieldValue: 1, | ||
}, | ||
], | ||
}, | ||
}, | ||
{ | ||
type: 'fields', | ||
fields: [ | ||
{ | ||
title: 'Energy regen at start of each wave', | ||
fieldValue: ( | ||
<SuperImposeWrapper> | ||
{(superimpose) => dm.enerRegn[superimpose]} | ||
</SuperImposeWrapper> | ||
), | ||
}, | ||
], | ||
}, | ||
], | ||
} | ||
|
||
export default sheet |
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,13 @@ | ||
import { own } from '@genshin-optimizer/sr/formula' | ||
import { useSrCalcContext } from '@genshin-optimizer/sr/ui' | ||
import type { ReactNode } from 'react' | ||
|
||
export function SuperImposeWrapper({ | ||
children, | ||
}: { | ||
children: (superimpose: number) => ReactNode | ||
}) { | ||
const calc = useSrCalcContext() | ||
const superimpose = calc?.compute(own.lightCone.superimpose).val ?? 1 | ||
return children(superimpose) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { CardThemed, NextImage } from '@genshin-optimizer/common/ui' | ||
import type { UISheetElement } from '@genshin-optimizer/pando/ui-sheet' | ||
import { DocumentDisplay } from '@genshin-optimizer/pando/ui-sheet' | ||
import { lightConeAsset } from '@genshin-optimizer/sr/assets' | ||
import type { LightConeKey } from '@genshin-optimizer/sr/consts' | ||
import { lightConeUiSheets } from '@genshin-optimizer/sr/formula-ui' | ||
import { LightConeName } from '@genshin-optimizer/sr/ui' | ||
import { | ||
Box, | ||
CardContent, | ||
CardHeader, | ||
Divider, | ||
Stack, | ||
Typography, | ||
} from '@mui/material' | ||
|
||
export function LightConeSheetDisplay({ lcKey }: { lcKey: LightConeKey }) { | ||
const lcSheet = lightConeUiSheets[lcKey] | ||
if (!lcSheet) return null | ||
return ( | ||
<CardThemed> | ||
<CardContent> | ||
<Box sx={{ display: 'flex', gap: 1, alignItems: 'center' }}> | ||
<Box | ||
component={NextImage ? NextImage : 'img'} | ||
alt="Light Cone Cover Image" | ||
src={lightConeAsset(lcKey, 'cover')} | ||
sx={{ | ||
maxHeight: '5em', | ||
width: 'auto', | ||
}} | ||
/> | ||
<Typography variant="h6"> | ||
<LightConeName lcKey={lcKey} /> | ||
</Typography> | ||
</Box> | ||
<LightConeUiSheetElement uiSheetElement={lcSheet} /> | ||
</CardContent> | ||
</CardThemed> | ||
) | ||
} | ||
function LightConeUiSheetElement({ | ||
uiSheetElement, | ||
}: { | ||
uiSheetElement: UISheetElement | ||
}) { | ||
const { documents, title } = uiSheetElement | ||
return ( | ||
<CardThemed bgt="light"> | ||
<CardHeader title={title} titleTypographyProps={{ variant: 'h6' }} /> | ||
<Divider /> | ||
<CardContent> | ||
<Stack spacing={1}> | ||
{documents.map((doc, i) => ( | ||
<DocumentDisplay key={i} document={doc} /> | ||
))} | ||
</Stack> | ||
</CardContent> | ||
</CardThemed> | ||
) | ||
} |
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,22 @@ | ||
import { CardThemed } from '@genshin-optimizer/common/ui' | ||
import type { LightConeKey } from '@genshin-optimizer/sr/consts' | ||
import { CardContent, Grid } from '@mui/material' | ||
import { LightConeSheetDisplay } from './LightConeSheetDisplay' | ||
|
||
// TODO: hardcoded to LightConeSheetsDisplay.tsx for now. Can be expanded to all lightcones with sheets | ||
const cones: LightConeKey[] = ['PastSelfInMirror'] as const | ||
export function LightConeSheetsDisplay() { | ||
return ( | ||
<CardThemed bgt="dark"> | ||
<CardContent> | ||
<Grid container columns={3} spacing={1}> | ||
{cones.map((lcKey) => ( | ||
<Grid item xs={1} key={lcKey}> | ||
<LightConeSheetDisplay lcKey={lcKey} /> | ||
</Grid> | ||
))} | ||
</Grid> | ||
</CardContent> | ||
</CardThemed> | ||
) | ||
} |
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.