fix(onboarding): fix widget links, isComplete logic, and event slugs
Use dynamic href for external links, check completedAt for graduation, link events by slug instead of _id, and remove stale click handler.
This commit is contained in:
parent
50a358b294
commit
e791a0d480
3 changed files with 8 additions and 8 deletions
|
|
@ -19,7 +19,7 @@
|
|||
</NuxtLink>
|
||||
<a
|
||||
v-else-if="currentSuggestion.isExternal"
|
||||
href="https://wiki.ghostguild.org"
|
||||
:href="currentSuggestion.action"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
class="btn btn-primary ow-action"
|
||||
|
|
@ -83,7 +83,6 @@
|
|||
target="_blank"
|
||||
rel="noopener"
|
||||
class="ow-rec-link"
|
||||
@click="trackGoal('wikiClicked')"
|
||||
>
|
||||
{{ currentSuggestion.actionText }} →
|
||||
</a>
|
||||
|
|
|
|||
|
|
@ -22,10 +22,11 @@ export function useOnboarding(options = {}) {
|
|||
const _fetched = useState('onboarding._fetched', () => false)
|
||||
|
||||
const isComplete = computed(() =>
|
||||
goals.value.hasProfileTags &&
|
||||
!!completedAt.value ||
|
||||
(goals.value.hasProfileTags &&
|
||||
goals.value.hasVisitedEvent &&
|
||||
goals.value.hasEngagedEcology &&
|
||||
goals.value.hasClickedWiki
|
||||
goals.value.hasClickedWiki)
|
||||
)
|
||||
|
||||
const pickCategory = options.pickCategory || ((categories) => {
|
||||
|
|
@ -63,7 +64,7 @@ export function useOnboarding(options = {}) {
|
|||
return {
|
||||
key: 'wiki',
|
||||
text: 'Browse the wiki for resources and guides',
|
||||
action: null,
|
||||
action: 'https://wiki.ghostguild.org',
|
||||
actionText: 'Browse wiki',
|
||||
isExternal: true,
|
||||
}
|
||||
|
|
@ -101,7 +102,7 @@ export function useOnboarding(options = {}) {
|
|||
return {
|
||||
key: 'event',
|
||||
text: `Upcoming event: ${item.title}`,
|
||||
action: `/events/${item._id}`,
|
||||
action: `/events/${item.slug}`,
|
||||
actionText: 'View event',
|
||||
}
|
||||
}
|
||||
|
|
@ -139,7 +140,7 @@ export function useOnboarding(options = {}) {
|
|||
_fetched.value = true
|
||||
|
||||
// If graduated, fetch recommendations
|
||||
if (isComplete.value) {
|
||||
if (completedAt.value) {
|
||||
await fetchRecommendations()
|
||||
}
|
||||
} catch {
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ describe('useOnboarding', () => {
|
|||
})
|
||||
|
||||
expect(currentSuggestion.value.key).toBe('wiki')
|
||||
expect(currentSuggestion.value.action).toBeNull()
|
||||
expect(currentSuggestion.value.action).toBe('https://wiki.ghostguild.org')
|
||||
expect(currentSuggestion.value.isExternal).toBe(true)
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue