1 import { type LearningPathStepType } from "@/providers/LearningPath"
2 import { Rating } from "docs-ui"
3 import React from "react"
4
5 export type LearningPathFinishType =
6 | {
7 type: "rating"
8 step: Omit<LearningPathStepType, "descriptionJSX"> & {
9 eventName?: string
10 }
11 }
12 | {
13 type: "custom"
14 step: LearningPathStepType & {
15 descriptionJSX: JSX.Element
16 }
17 }
18
19 type LearningPathFinishProps = LearningPathFinishType & {
20 onRating?: () => void
21 }
22
23 export const LearningPathFinish = ({
24 type,
25 step,
26 onRating,
27 }: LearningPathFinishProps) => {
28 return (
29 <>
30 {type === "rating" && (
31 <Rating event={step.eventName} onRating={onRating} />
32 )}
33 {type === "custom" && (
34 <span className="text-compact-small text-medusa-fg-subtle">
35 {step.descriptionJSX as React.ReactNode}
36 </span>
37 )}
38 </>
39 )
40 }