fix: improve onboarding tour first step to show full canvas
- Add noSpotlight option for steps that dim the canvas without a cutout - Add center placement for viewport-centered tooltips - Update first step to welcome users to the full canvas space - Replace arbitrary square highlight with uniform overlay 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
0d663887b9
commit
b42b1d3887
|
|
@ -27,6 +27,12 @@ function calculateTooltipPosition(
|
||||||
const centerY = top + height / 2
|
const centerY = top + height / 2
|
||||||
|
|
||||||
switch (placement) {
|
switch (placement) {
|
||||||
|
case 'center':
|
||||||
|
// Center in viewport
|
||||||
|
return {
|
||||||
|
top: window.innerHeight / 2 - tooltipHeight / 2,
|
||||||
|
left: window.innerWidth / 2 - tooltipWidth / 2
|
||||||
|
}
|
||||||
case 'top':
|
case 'top':
|
||||||
return { top: top - tooltipHeight - gap, left: centerX - tooltipWidth / 2 }
|
return { top: top - tooltipHeight - gap, left: centerX - tooltipWidth / 2 }
|
||||||
case 'bottom':
|
case 'bottom':
|
||||||
|
|
@ -118,8 +124,23 @@ export function TourTooltip({
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* Spotlight overlay with cutout */}
|
{/* Spotlight overlay with cutout (or full overlay for noSpotlight steps) */}
|
||||||
{targetRect && (
|
{step.noSpotlight ? (
|
||||||
|
// Full overlay without cutout for intro/welcome steps
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
position: 'fixed',
|
||||||
|
top: 0,
|
||||||
|
left: 0,
|
||||||
|
width: '100vw',
|
||||||
|
height: '100vh',
|
||||||
|
background: colors.overlay,
|
||||||
|
zIndex: 99998,
|
||||||
|
pointerEvents: 'none',
|
||||||
|
transition: 'opacity 0.3s ease-out'
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
) : targetRect && (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
position: 'fixed',
|
position: 'fixed',
|
||||||
|
|
|
||||||
|
|
@ -9,25 +9,27 @@ export interface TourStep {
|
||||||
// Fallback positioning if element not found
|
// Fallback positioning if element not found
|
||||||
fallbackPosition?: { top: number; left: number }
|
fallbackPosition?: { top: number; left: number }
|
||||||
// Tooltip placement relative to target
|
// Tooltip placement relative to target
|
||||||
placement: 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'
|
placement: 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'center'
|
||||||
// Optional highlight padding around target element
|
// Optional highlight padding around target element
|
||||||
highlightPadding?: number
|
highlightPadding?: number
|
||||||
// Optional action hint (e.g., "Click to continue" vs "Press Enter")
|
// Optional action hint (e.g., "Click to continue" vs "Press Enter")
|
||||||
actionHint?: string
|
actionHint?: string
|
||||||
// Optional icon for visual interest
|
// Optional icon for visual interest
|
||||||
icon?: string
|
icon?: string
|
||||||
|
// If true, don't show spotlight cutout (for full-canvas intro steps)
|
||||||
|
noSpotlight?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export const TOUR_STEPS: TourStep[] = [
|
export const TOUR_STEPS: TourStep[] = [
|
||||||
{
|
{
|
||||||
id: 'local-first',
|
id: 'welcome-canvas',
|
||||||
title: 'Your Data, Your Device',
|
title: 'Welcome to Your Canvas',
|
||||||
content: 'This canvas stores everything locally in your browser first. Your work is saved automatically and works offline - no account required to start creating.',
|
content: 'This is your infinite creative space. Everything you create here is stored locally in your browser first - your work is saved automatically and works offline.',
|
||||||
targetSelector: '.tlui-menu__button',
|
targetSelector: '.tl-container',
|
||||||
placement: 'bottom-right',
|
placement: 'center',
|
||||||
highlightPadding: 8,
|
noSpotlight: true,
|
||||||
icon: '🏠',
|
icon: '✨',
|
||||||
actionHint: 'Your data never leaves your device unless you choose to sync'
|
actionHint: 'No account required to start creating'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'cryptid-login',
|
id: 'cryptid-login',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue