Skip to content

Commit

Permalink
Added svals to NP search
Browse files Browse the repository at this point in the history
  • Loading branch information
squaresmile committed Jan 27, 2024
1 parent a4a0270 commit b92f510
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/db/src/Page/NoblePhantasmsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ interface IState {
numFunctions: number[];
minNpNpGain?: number;
maxNpNpGain?: number;
svalsContain?: string;
}

class NoblePhantasmsPage extends React.Component<IProps, IState> {
Expand All @@ -70,6 +71,7 @@ class NoblePhantasmsPage extends React.Component<IProps, IState> {
...defaultState,
name: searchParams.get("name") ?? undefined,
card: searchParams.getAll("card") as Card[],
svalsContain: searchParams.get("svalsContain") ?? undefined,
individuality: getQueryNums("individuality"),
hits: getQueryNums("hits"),
strengthStatus: getQueryNums("strengthStatus"),
Expand Down Expand Up @@ -125,13 +127,15 @@ class NoblePhantasmsPage extends React.Component<IProps, IState> {
numFunctions: this.state.numFunctions,
minNpNpGain: this.state.minNpNpGain,
maxNpNpGain: this.state.maxNpNpGain,
svalsContain: this.state.svalsContain,
}).toString();
}

private search() {
// no filter set
if (
!this.state.name &&
!this.state.svalsContain &&
this.state.card.length === 0 &&
this.state.individuality.length === 0 &&
this.state.hits.length === 0 &&
Expand All @@ -157,6 +161,7 @@ class NoblePhantasmsPage extends React.Component<IProps, IState> {
numFunctions: this.state.numFunctions,
minNpNpGain: this.state.minNpNpGain,
maxNpNpGain: this.state.maxNpNpGain,
svalsContain: this.state.svalsContain,
})
.then((noblePhantasms) => {
this.setQueryURL();
Expand Down Expand Up @@ -328,6 +333,21 @@ class NoblePhantasmsPage extends React.Component<IProps, IState> {
}}
/>
</Form.Group>
<Form.Group>
<Form.Label>
<code>svals</code> {t("raw string should contain the following snippet")}
</Form.Label>
<Form.Control
value={this.state.svalsContain ?? ""}
onChange={(ev: ChangeEvent) => {
if (ev.target.value !== "") {
this.setState({ svalsContain: ev.target.value });
} else {
this.setState({ svalsContain: undefined });
}
}}
/>
</Form.Group>
<Button variant={"primary"} onClick={() => this.search()}>
{t("Search")} <FontAwesomeIcon icon={faSearch} />
</Button>
Expand Down

0 comments on commit b92f510

Please sign in to comment.