| 1 |
import { EventButton } from '@assist/components/dashboard/buttons/EventButton'; |
| 2 |
import { LinkButton } from '@assist/components/dashboard/buttons/LinkButton'; |
| 3 |
import { ModalButton } from '@assist/components/dashboard/buttons/ModalButton'; |
| 4 |
import { TourButton } from '@assist/components/dashboard/buttons/TourButton'; |
| 5 |
import { useTours } from '@assist/hooks/useTours'; |
| 6 |
import { useTasksStore } from '@assist/state/tasks'; |
| 7 |
|
| 8 |
export const ActionButton = ({ task }) => { |
| 9 |
const { isCompleted } = useTasksStore(); |
| 10 |
const { finishedTour } = useTours(); |
| 11 |
|
| 12 |
if (task.event) { |
| 13 |
return <EventButton task={task} completed={isCompleted(task.slug)} />; |
| 14 |
} |
| 15 |
|
| 16 |
if (task.type === 'modal') |
| 17 |
return <ModalButton task={task} completed={isCompleted(task.slug)} />; |
| 18 |
|
| 19 |
if (['html-text-button', 'internalLink'].includes(task.type)) |
| 20 |
return <LinkButton task={task} completed={isCompleted(task.slug)} />; |
| 21 |
|
| 22 |
if (task.type === 'tour') |
| 23 |
return ( |
| 24 |
<TourButton |
| 25 |
task={task} |
| 26 |
completed={finishedTour(task.slug) || isCompleted(task.slug)} |
| 27 |
/> |
| 28 |
); |
| 29 |
return null; |
| 30 |
}; |
| 31 |
|