fix(dashboard): focus on add proxy button in modal

This commit is contained in:
Jake/Rads 2022-06-23 22:27:47 +02:00
parent 9efa8d4289
commit 990c2d9f4c

View File

@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import { createEventDispatcher, tick } from "svelte"; import {tick } from "svelte";
import { Col, Row, Input, Label, Button, Alert, Spinner, InputGroup } from "sveltestrap"; import { Col, Row, Input, Label, Button, Alert, Spinner, InputGroup } from "sveltestrap";
import { Member } from '../../api/types'; import { Member } from '../../api/types';
@ -12,12 +12,6 @@
let err: string; let err: string;
const dispatch = createEventDispatcher();
function update() {
dispatch('update', member);
}
let input = member.proxy_tags; let input = member.proxy_tags;
async function submit() { async function submit() {
@ -34,7 +28,6 @@
let res = await api().members(member.id).patch({data}); let res = await api().members(member.id).patch({data});
member = res; member = res;
err = null; err = null;
update();
loading = false; loading = false;
toggleProxyModal(); toggleProxyModal();
} catch (error) { } catch (error) {
@ -66,7 +59,7 @@
</Col> </Col>
{/each} {/each}
<Col xs={12} lg={6} class="mb-2"> <Col xs={12} lg={6} class="mb-2">
<Button class="w-100" color="secondary" on:click={() => {input.push({prefix: "", suffix: ""}); input = input;}}>New</Button> <button class="w-100 btn btn-secondary" use:focus={member.proxy_tags.length > 0 ? false : true} on:click={() => {input.push({prefix: "", suffix: ""}); input = input;}}>New</button>
</Col> </Col>
</Row> </Row>
{#if !loading}<Button style="flex 0" color="primary" on:click={submit} aria-label="submit proxy tags">Submit</Button> <Button style="flex: 0" color="secondary" on:click={toggleProxyModal} aria-label="go back">Back</Button> {#if !loading}<Button style="flex 0" color="primary" on:click={submit} aria-label="submit proxy tags">Submit</Button> <Button style="flex: 0" color="secondary" on:click={toggleProxyModal} aria-label="go back">Back</Button>