computer-scienceangular-roadmapbackend-roadmapblockchain-roadmapdba-roadmapdeveloper-roadmapdevops-roadmapfrontend-roadmapgo-roadmaphactoberfestjava-roadmapjavascript-roadmapnodejs-roadmappython-roadmapqa-roadmapreact-roadmaproadmapstudy-planvue-roadmapweb3-roadmap
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
935 B
34 lines
935 B
import { GitForkIcon } from 'lucide-react'; |
|
import { getUser } from '../../lib/jwt'; |
|
|
|
type ForkCourseAlertProps = { |
|
courseSlug: string; |
|
creatorId?: string; |
|
onForkCourse: () => void; |
|
}; |
|
|
|
export function ForkCourseAlert(props: ForkCourseAlertProps) { |
|
const { courseSlug, creatorId, onForkCourse } = props; |
|
|
|
const currentUser = getUser(); |
|
|
|
if (!currentUser || !creatorId || currentUser?.id === creatorId) { |
|
return null; |
|
} |
|
|
|
return ( |
|
<div className="mb-4 flex items-center justify-between gap-2 rounded-lg bg-yellow-200 p-3 text-black"> |
|
<p className="text-sm text-balance"> |
|
To start tracking your progress, you can fork the course. |
|
</p> |
|
|
|
<button |
|
className="flex shrink-0 items-center gap-2 rounded-md bg-yellow-400 p-1 px-2 text-sm text-black" |
|
onClick={onForkCourse} |
|
> |
|
<GitForkIcon className="size-3.5" /> |
|
Fork Course |
|
</button> |
|
</div> |
|
); |
|
}
|
|
|