|
9 | 9 | useRef, |
10 | 10 | useState, |
11 | 11 | } from "react"; |
12 | | -import { steps } from "@/data/tutorial"; |
| 12 | +import { steps as articles } from "@/data/tutorial"; |
13 | 13 | import { useScrollShadow } from "@/hooks/use-scroll-shadow"; |
14 | 14 | import { cn } from "@/lib/utils"; |
15 | 15 | import { |
@@ -379,7 +379,7 @@ function FloatingWindow({ |
379 | 379 | isResizing ? "contain-strict" : "contain-none", |
380 | 380 | )} |
381 | 381 | > |
382 | | - {steps.map((step) => ( |
| 382 | + {articles.map((step) => ( |
383 | 383 | <TabsContent |
384 | 384 | key={step.title} |
385 | 385 | value={step.title} |
@@ -424,20 +424,26 @@ export function TutorialWindow({ |
424 | 424 | }) { |
425 | 425 | const [isClosed, setIsClosed] = useState(tutorialData.isClosed); |
426 | 426 |
|
427 | | - const { step: activeStepFromSearch } = useSearch({ strict: false }); |
| 427 | + const { article: activeArticleFromSearch } = useSearch({ strict: false }); |
428 | 428 |
|
429 | 429 | const [activeStep, setActiveStep] = useState( |
430 | | - tutorialData.tutorialStep || steps[0].title, |
| 430 | + tutorialData.tutorialStep || articles[0].title, |
431 | 431 | ); |
432 | 432 |
|
433 | 433 | useEffect(() => { |
434 | | - if (activeStepFromSearch && typeof activeStepFromSearch === "string") { |
435 | | - const stepInSearch = decodeURIComponent(activeStepFromSearch); |
436 | | - if (steps.find((step) => step.title === stepInSearch)) { |
437 | | - setActiveStep(stepInSearch); |
| 434 | + if ( |
| 435 | + activeArticleFromSearch && |
| 436 | + typeof activeArticleFromSearch === "string" |
| 437 | + ) { |
| 438 | + const articleInSearch = decodeURIComponent( |
| 439 | + activeArticleFromSearch.toLowerCase(), |
| 440 | + ); |
| 441 | + |
| 442 | + if (articles.find((a) => a.title === articleInSearch)) { |
| 443 | + setActiveStep(articleInSearch); |
438 | 444 | } |
439 | 445 | } |
440 | | - }, [activeStepFromSearch]); |
| 446 | + }, [activeArticleFromSearch]); |
441 | 447 |
|
442 | 448 | const router = useRouter(); |
443 | 449 |
|
|
0 commit comments