Skip to content

Commit

Permalink
Merge pull request #734 from scooterthedev/fix-tutorial-mode
Browse files Browse the repository at this point in the history
Tutorial Mode Fix
  • Loading branch information
malted authored Nov 13, 2024
2 parents 8a5b24b + dd1110e commit 4ccd4a0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/app/harbor/tabs/tour.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Shepherd, { type Tour } from 'shepherd.js'
import './shepherd.css'
import { offset } from '@floating-ui/dom'
import Cookies from 'js-cookie'
import { fetchTutorialCompletionStatus } from '../../utils/airtable';

const waitForElement = (
selector: string,
Expand Down Expand Up @@ -56,8 +57,9 @@ const t = new Shepherd.Tour({
})

let hasSetUp = false
export function tour() {
sessionStorage.setItem('tutorial', 'true')
export async function tour() {
const tutorialCompletionStatus = await fetchTutorialCompletionStatus()
sessionStorage.setItem('tutorial', tutorialCompletionStatus ? 'true' : 'false')

const currentStepId = getCookie('tour-step')
if (currentStepId) {
Expand Down
5 changes: 5 additions & 0 deletions src/app/utils/airtable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,8 @@ export async function safePerson(): Promise<SafePerson> {
preexistingUser,
}
}

export const fetchTutorialCompletionStatus = async (): Promise<boolean> => {
const person = await getSelfPerson(slackId);
return person.fields.academy_completed === true;
};

0 comments on commit 4ccd4a0

Please sign in to comment.