From afa39b29ed14f884b96eb4cdc5db5f511d5e0c12 Mon Sep 17 00:00:00 2001 From: Azalea <22280294+hykilpikonna@users.noreply.github.com> Date: Thu, 22 Feb 2024 10:30:28 -0500 Subject: [PATCH] [+] Implement link conflict resolution --- AquaNet/src/App.svelte | 2 +- AquaNet/src/app.sass | 14 +++++--- AquaNet/src/components/BindCard.svelte | 46 ++++++++++++++++++-------- 3 files changed, 42 insertions(+), 20 deletions(-) diff --git a/AquaNet/src/App.svelte b/AquaNet/src/App.svelte index eef7d7f1..1eabe2f5 100644 --- a/AquaNet/src/App.svelte +++ b/AquaNet/src/App.svelte @@ -67,7 +67,7 @@ > div, > a cursor: pointer - transition: all 0.2s ease + transition: $transition text-decoration: underline 1px solid transparent text-underline-offset: 0.1em diff --git a/AquaNet/src/app.sass b/AquaNet/src/app.sass index 37b9924a..66c297a7 100644 --- a/AquaNet/src/app.sass +++ b/AquaNet/src/app.sass @@ -67,17 +67,21 @@ button background-color: $ov-lighter opacity: 0.9 cursor: pointer - transition: all 0.25s - + transition: $transition button:hover - border: 1px solid $c-main - + border-color: $c-main button:focus, button:focus-visible color: $c-main outline: none +button.error + color: unset + &:hover + background: $c-error + border-color: transparent + .level-0 --lv-color: $c-lv0 @@ -101,7 +105,7 @@ input font-weight: 500 font-family: inherit background-color: $ov-lighter - transition: all 0.25s + transition: $transition box-sizing: border-box diff --git a/AquaNet/src/components/BindCard.svelte b/AquaNet/src/components/BindCard.svelte index 54dde535..1bc02c8c 100644 --- a/AquaNet/src/components/BindCard.svelte +++ b/AquaNet/src/components/BindCard.svelte @@ -58,13 +58,24 @@ else { conflictSummary = summary conflictCardID = id - await linkConflictContinue() + await linkConflictContinue(null) } } - async function linkConflictContinue() { + async function linkConflictContinue(choose: "old" | "new" | null) { console.log("linking card with migration") + if (choose) { + // If old is chosen, nothing needs to be migrated + // If new is chosen, we need to migrate the data + if (choose === "new") { + conflictToMigrate.push(conflictGame) + } + // Continue to the next card + // @ts-ignore + conflictSummary[conflictGame] = null + } + let isConflict = false for (const k in conflictSummary) { // @ts-ignore @@ -82,17 +93,21 @@ if (!isConflict) { await CARD.link({cardId: conflictCardID, migrate: conflictToMigrate.join(",")}) await updateMe() - state = "" - - // Reset conflict data - conflictSummary = null - conflictCardID = "" - conflictGame = "" - conflictNew = null - conflictOld = null - conflictToMigrate = [] + + // Reset the conflict state + linkConflictCancel() } } + + function linkConflictCancel() { + state = "" + conflictSummary = null + conflictCardID = "" + conflictGame = "" + conflictNew = null + conflictOld = null + conflictToMigrate = [] + } // Access code input const inputACRegex = /^(\d{4} ){0,4}\d{0,4}$/ @@ -214,14 +229,16 @@

The card contains data for {conflictGame}, which is already present on your account. Please choose the data you would like to keep

-
+
linkConflictContinue('old')} + role="button" tabindex="0" on:keydown={e => e.key === "Enter" && linkConflictContinue('old')}> Account Card Name: {conflictOld.name} Rating: {conflictOld.rating} Last Login: {moment(conflictOld.lastLogin).format("YYYY MMM DD")} {formatLUID(me.ghostCard.luid)}
-
+
linkConflictContinue('new')} + role="button" tabindex="0" on:keydown={e => e.key === "Enter" && linkConflictContinue('new')}> {cardType(conflictCardID)} Name: {conflictNew.name} Rating: {conflictNew.rating} @@ -229,6 +246,7 @@ {conflictCardID}
+
{/if} @@ -269,7 +287,7 @@ .conflict-cards .card - transition: background 0.2s + transition: $transition .card:hover background: $c-darker