mirror of https://github.com/hykilpikonna/AquaDX
[+] Unlink frontend
parent
dd55e336e4
commit
f5c2dc747d
|
@ -82,6 +82,12 @@ button.error
|
||||||
background: $c-error
|
background: $c-error
|
||||||
border-color: transparent
|
border-color: transparent
|
||||||
|
|
||||||
|
button.icon
|
||||||
|
padding: 0.6em
|
||||||
|
font-size: 1.2em
|
||||||
|
border-radius: 50px
|
||||||
|
@extend .flex-center
|
||||||
|
|
||||||
.level-0
|
.level-0
|
||||||
--lv-color: $c-lv0
|
--lv-color: $c-lv0
|
||||||
|
|
||||||
|
|
|
@ -96,4 +96,6 @@ export const CARD = {
|
||||||
post('/api/v2/card/summary', { cardId }),
|
post('/api/v2/card/summary', { cardId }),
|
||||||
link: (props: { cardId: string, migrate: string }) =>
|
link: (props: { cardId: string, migrate: string }) =>
|
||||||
post('/api/v2/card/link', props),
|
post('/api/v2/card/link', props),
|
||||||
|
unlink: (cardId: string) =>
|
||||||
|
post('/api/v2/card/unlink', { cardId }),
|
||||||
}
|
}
|
|
@ -3,9 +3,10 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { slide, fade } from "svelte/transition"
|
import { slide, fade } from "svelte/transition"
|
||||||
import { clz } from "../../libs/ui";
|
import { clz } from "../../libs/ui";
|
||||||
import type { CardSummary, CardSummaryGame, UserMe } from "../../libs/generalTypes";
|
import type { Card, CardSummary, CardSummaryGame, UserMe } from "../../libs/generalTypes";
|
||||||
import { CARD, USER } from "../../libs/sdk";
|
import { CARD, USER } from "../../libs/sdk";
|
||||||
import moment from "moment"
|
import moment from "moment"
|
||||||
|
import Icon from "@iconify/svelte";
|
||||||
|
|
||||||
// State
|
// State
|
||||||
let state: 'ready' | 'linking-AC' | 'linking-SN' = "ready"
|
let state: 'ready' | 'linking-AC' | 'linking-SN' = "ready"
|
||||||
|
@ -141,6 +142,11 @@
|
||||||
conflictToMigrate = []
|
conflictToMigrate = []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function unlink(card: Card) {
|
||||||
|
await CARD.unlink(card.luid)
|
||||||
|
await updateMe()
|
||||||
|
}
|
||||||
|
|
||||||
// Access code input
|
// Access code input
|
||||||
const inputACRegex = /^(\d{4} ){0,4}\d{0,4}$/
|
const inputACRegex = /^(\d{4} ){0,4}\d{0,4}$/
|
||||||
let inputAC = ""
|
let inputAC = ""
|
||||||
|
@ -209,6 +215,9 @@
|
||||||
<span class="last">Last used: {moment(card.accessTime).format("YYYY MMM DD")}</span>
|
<span class="last">Last used: {moment(card.accessTime).format("YYYY MMM DD")}</span>
|
||||||
<div/>
|
<div/>
|
||||||
<span class="id">{formatLUID(card.luid, card.ghost)}</span>
|
<span class="id">{formatLUID(card.luid, card.ghost)}</span>
|
||||||
|
{#if !card.ghost}
|
||||||
|
<button class="icon error" on:click={() => unlink(card)}><Icon icon="tabler:trash-x-filled"/></button>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
@ -313,6 +322,7 @@
|
||||||
|
|
||||||
.existing.card
|
.existing.card
|
||||||
min-height: 90px
|
min-height: 90px
|
||||||
|
position: relative
|
||||||
|
|
||||||
&.ghost
|
&.ghost
|
||||||
background: rgba($c-darker, 0.8)
|
background: rgba($c-darker, 0.8)
|
||||||
|
@ -326,6 +336,11 @@
|
||||||
> div
|
> div
|
||||||
flex: 1
|
flex: 1
|
||||||
|
|
||||||
|
button
|
||||||
|
position: absolute
|
||||||
|
right: 10px
|
||||||
|
bottom: 10px
|
||||||
|
|
||||||
.conflict-cards
|
.conflict-cards
|
||||||
.card
|
.card
|
||||||
transition: $transition
|
transition: $transition
|
||||||
|
|
Loading…
Reference in New Issue