fix matches page filter params propagation
This commit is contained in:
parent
e3164246e1
commit
55c76db7b6
2 changed files with 38 additions and 26 deletions
|
@ -66,32 +66,34 @@
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<Visualizer {matchLog} {matchData} />
|
<Visualizer {matchLog} {matchData} />
|
||||||
<div class="output-pane">
|
{#if playersWithVisibleLog.length > 0}
|
||||||
<div class="player-select">
|
<div class="output-pane">
|
||||||
{#if playersWithVisibleLog.length == 1}
|
<div class="player-select">
|
||||||
<h3 class="player-log-header">
|
{#if playersWithVisibleLog.length == 1}
|
||||||
player log for
|
<h3 class="player-log-header">
|
||||||
<span style:color={selectedPlayer["color"]}>{selectedPlayer.displayName}</span>
|
player log for
|
||||||
</h3>
|
<span style:color={selectedPlayer["color"]}>{selectedPlayer.displayName}</span>
|
||||||
{:else}
|
</h3>
|
||||||
<Select
|
{:else}
|
||||||
items={playersWithVisibleLog}
|
<Select
|
||||||
label="displayName"
|
items={playersWithVisibleLog}
|
||||||
clearable={false}
|
label="displayName"
|
||||||
searchable={false}
|
clearable={false}
|
||||||
bind:value={dropdownSelectedPlayer}
|
searchable={false}
|
||||||
placeholder="Select player to see logs"
|
bind:value={dropdownSelectedPlayer}
|
||||||
>
|
placeholder="Select player to see logs"
|
||||||
<div slot="item" let:item>
|
>
|
||||||
<span style:color={item.color}>{item.displayName}</span>
|
<div slot="item" let:item>
|
||||||
</div>
|
<span style:color={item.color}>{item.displayName}</span>
|
||||||
</Select>
|
</div>
|
||||||
{/if}
|
</Select>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
<div class="player-log">
|
||||||
|
<PlayerLog {matchLog} playerId={selectedPlayer?.["playerId"]} />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="player-log">
|
{/if}
|
||||||
<PlayerLog {matchLog} playerId={selectedPlayer?.["playerId"]} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|
|
@ -8,11 +8,18 @@
|
||||||
const apiClient = new ApiClient(fetch);
|
const apiClient = new ApiClient(fetch);
|
||||||
const botName = url.searchParams.get("bot");
|
const botName = url.searchParams.get("bot");
|
||||||
|
|
||||||
|
let searchParams = removeUndefined({
|
||||||
|
bot: url.searchParams.get("bot"),
|
||||||
|
opponent: url.searchParams.get("opponent"),
|
||||||
|
outcome: url.searchParams.get("outcome"),
|
||||||
|
had_errors: url.searchParams.get("had_errors"),
|
||||||
|
});
|
||||||
|
|
||||||
let query = {
|
let query = {
|
||||||
count: PAGE_SIZE,
|
count: PAGE_SIZE,
|
||||||
before: url.searchParams.get("before"),
|
before: url.searchParams.get("before"),
|
||||||
after: url.searchParams.get("after"),
|
after: url.searchParams.get("after"),
|
||||||
bot: botName,
|
...searchParams,
|
||||||
};
|
};
|
||||||
|
|
||||||
let { matches, has_next } = await apiClient.get("/api/matches", removeUndefined(query));
|
let { matches, has_next } = await apiClient.get("/api/matches", removeUndefined(query));
|
||||||
|
@ -28,6 +35,7 @@
|
||||||
botName,
|
botName,
|
||||||
hasNext: has_next,
|
hasNext: has_next,
|
||||||
query,
|
query,
|
||||||
|
searchParams,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -57,6 +65,7 @@
|
||||||
// whether a next page exists in the current iteration direction (before/after)
|
// whether a next page exists in the current iteration direction (before/after)
|
||||||
export let hasNext: boolean;
|
export let hasNext: boolean;
|
||||||
export let query: object;
|
export let query: object;
|
||||||
|
export let searchParams: object;
|
||||||
|
|
||||||
type Cursor = {
|
type Cursor = {
|
||||||
before?: string;
|
before?: string;
|
||||||
|
@ -65,6 +74,7 @@
|
||||||
|
|
||||||
function pageLink(cursor: Cursor) {
|
function pageLink(cursor: Cursor) {
|
||||||
let paramsObj = {
|
let paramsObj = {
|
||||||
|
...searchParams,
|
||||||
...cursor,
|
...cursor,
|
||||||
};
|
};
|
||||||
if (botName) {
|
if (botName) {
|
||||||
|
|
Loading…
Reference in a new issue