Skip to content

Commit

Permalink
Use safeperson for tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
malted committed Nov 14, 2024
1 parent aa73562 commit 12539f3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
9 changes: 5 additions & 4 deletions src/app/harbor/tabs/tour.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +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'
import { safePerson } from '../../utils/airtable'

const waitForElement = (
selector: string,
Expand Down Expand Up @@ -58,9 +58,10 @@ const t = new Shepherd.Tour({

let hasSetUp = false
export function tour() {
fetchTutorialCompletionStatus().then((res) =>
sessionStorage.setItem('tutorial', res.toString()),
)
safePerson().then(({ hasCompletedTutorial }) => {
console.log('Setting tutorial sessionstorage to', hasCompletedTutorial)
sessionStorage.setItem('tutorial', hasCompletedTutorial.toString())
})

const currentStepId = getCookie('tour-step')
if (currentStepId) {
Expand Down
5 changes: 0 additions & 5 deletions src/app/utils/airtable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,3 @@ 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 12539f3

Please sign in to comment.