-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add conditional search/filter for relic sets/lightcones
- Loading branch information
Showing
6 changed files
with
77 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,37 @@ | ||
import { allLightConeKeys } from '@genshin-optimizer/sr/consts' | ||
import { Grid } from '@mui/material' | ||
import type { LightConeKey } from '@genshin-optimizer/sr/consts' | ||
import { isLightConeKey } from '@genshin-optimizer/sr/consts' | ||
import { LightConeAutocomplete } from '@genshin-optimizer/sr/ui' | ||
import { Box, Grid, Stack } from '@mui/material' | ||
import { useMemo, useState } from 'react' | ||
import { LightConeSheetDisplay } from './LightConeSheetDisplay' | ||
import { useTeamContext } from './context' | ||
|
||
export function LightConeSheetsDisplay() { | ||
const { team } = useTeamContext() | ||
const conditionals = team.conditionals | ||
const [lcKey, setLcKey] = useState<LightConeKey | ''>('') | ||
const lcList = useMemo(() => { | ||
const sets = conditionals.map((c) => c.sheet).filter(isLightConeKey) | ||
if (lcKey) sets.push(lcKey) | ||
// Make sure the currently selected lc is at the front | ||
return [...new Set(sets)].sort((set) => (set === lcKey ? -1 : 1)) | ||
}, [conditionals, lcKey]) | ||
return ( | ||
<Grid container columns={3} spacing={1}> | ||
{allLightConeKeys.map((lcKey) => ( | ||
<Grid item xs={1} key={lcKey}> | ||
<LightConeSheetDisplay lcKey={lcKey} /> | ||
<Stack spacing={1} sx={{ pt: 1 }}> | ||
<LightConeAutocomplete | ||
lcKey={lcKey} | ||
setLCKey={setLcKey} | ||
label="Search Light Cone" // TODO: translation | ||
/> | ||
<Box> | ||
<Grid container columns={3} spacing={1}> | ||
{lcList.map((setKey) => ( | ||
<Grid item xs={1} key={setKey}> | ||
<LightConeSheetDisplay lcKey={setKey} /> | ||
</Grid> | ||
))} | ||
</Grid> | ||
))} | ||
</Grid> | ||
</Box> | ||
</Stack> | ||
) | ||
} |
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,15 +1,38 @@ | ||
import { allRelicSetKeys } from '@genshin-optimizer/sr/consts' | ||
import { Grid } from '@mui/material' | ||
import { isRelicSetKey, type RelicSetKey } from '@genshin-optimizer/sr/consts' | ||
import { RelicSetAutocomplete } from '@genshin-optimizer/sr/ui' | ||
import { Box, Grid, Stack } from '@mui/material' | ||
import { useMemo, useState } from 'react' | ||
import { useTeamContext } from './context' | ||
import { RelicSheetDisplay } from './RelicSheetDisplay' | ||
|
||
export function RelicSheetsDisplay() { | ||
const { team } = useTeamContext() | ||
const conditionals = team.conditionals | ||
const [relicSetKey, setRelicSetKey] = useState<RelicSetKey | ''>('') | ||
const relicList = useMemo(() => { | ||
const sets = conditionals | ||
.map((c) => c.sheet) | ||
.filter(isRelicSetKey) as RelicSetKey[] | ||
if (relicSetKey) sets.push(relicSetKey) | ||
// Make sure the currently selected set is at the front | ||
return [...new Set(sets)].sort((set) => (set === relicSetKey ? -1 : 1)) | ||
}, [conditionals, relicSetKey]) | ||
return ( | ||
<Grid container columns={3} spacing={1}> | ||
{allRelicSetKeys.map((setKey) => ( | ||
<Grid item xs={1} key={setKey}> | ||
<RelicSheetDisplay setKey={setKey} /> | ||
<Stack spacing={1} sx={{ pt: 1 }}> | ||
<RelicSetAutocomplete | ||
relicSetKey={relicSetKey} | ||
setRelicSetKey={setRelicSetKey} | ||
label="Search Relic Set" // TODO: translation | ||
/> | ||
<Box> | ||
<Grid container columns={3} spacing={1}> | ||
{relicList.map((setKey) => ( | ||
<Grid item xs={1} key={setKey}> | ||
<RelicSheetDisplay setKey={setKey} /> | ||
</Grid> | ||
))} | ||
</Grid> | ||
))} | ||
</Grid> | ||
</Box> | ||
</Stack> | ||
) | ||
} |
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