Skip to content

Commit

Permalink
Changed tutorial will show when an error raise
Browse files Browse the repository at this point in the history
  • Loading branch information
biplobsd committed Jan 8, 2025
1 parent 1ca6fc0 commit 625af43
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/components/Tutorial.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import { X } from "lucide-svelte";
import { closeTutorialWritable } from "src/utils/storage";
import TutorialCard from "./Tutorial_Card.svelte";
export let forceOpen = false;
let closingProgress = 0;
const interval = setInterval(() => {
Expand All @@ -13,15 +15,17 @@
}, 1000);
</script>

{#if closingProgress !== 100}
{#if closingProgress !== 100 || forceOpen}
<div class="flex justify-center py-1">
<div transition:slide class="indicator w-[16.5rem]">
{#if !forceOpen}
<button
on:click={() => closeTutorialWritable.set(true)}
class="indicator-item btn btn-circle btn-xs"
>
<X class=" w-4 h-4 " />
</button>
{/if}
<TutorialCard bind:closingProgress />
</div>
</div>
Expand Down
12 changes: 10 additions & 2 deletions src/components/pages/API.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
let successCount = 0;
let actionName = "";
let lastChannelIDsTotal = 0;
let isError = false;
function getAccessToken() {
return $primaryChannelWritable === "0"
Expand Down Expand Up @@ -190,19 +191,22 @@
case "accept":
isReady = true;
isRunning = false;
isError = false;
return;
case "error":
setStatus(status.msg, true);
isRunning = false;
isReady = true;
primaryChannelWritable.set("-1");
isError = true;
return;
case "authToken":
if ($primaryChannelWritable === "-1") {
setStatus(
"Received OAuth token, but it was rejected due to not arriving on time",
true,
);
isError = true;
return;
}
Expand All @@ -214,13 +218,16 @@
if (userData0) {
firstUserWritable.set(userData0);
}
isError = false;
break;
case "1":
secondOAuthKeyWritable.set(status.authToken);
const userData1 = await getUserInfo();
if (userData1) {
secondUserWritable.set(userData1);
}
isError = false;
break;
default:
break;
}
Expand All @@ -229,6 +236,7 @@
isReady = true;
setStatus("OAuth token receive successful");
isError = false;
break;
default:
break;
Expand Down Expand Up @@ -489,8 +497,8 @@
});
</script>

{#if !$closeTutorialWritable}
<Tutorial />
{#if !$closeTutorialWritable || isError}
<Tutorial forceOpen={isError} />
{/if}

{#if status.msg === "Done" && successCount / lastChannelIDsTotal >= 0.6}
Expand Down

0 comments on commit 625af43

Please sign in to comment.