PluginProbe
Extendify / 3.1.5
Extendify v3.1.5
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
extendify / src / Assist / components / dashboard / CardContent.jsx

CardContent.jsx in Extendify 3.1.5, at src/Assist/components/dashboard/CardContent.jsx

67 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { ActionButton } from '@assist/components/dashboard/buttons/ActionButton';
2 import { DismissButton } from '@assist/components/dashboard/buttons/DismissButton';
3 import { DemoCard } from '@assist/components/dashboard/cards/DemoCard';
4 import { GenericCard } from '@assist/components/dashboard/cards/GenericCard';
5 import { NoActionBtnCard } from '@assist/components/dashboard/cards/NoActionBtnCard';
6 import { DomainCard } from '@assist/components/dashboard/domains/DomainCard';
7 import { SecondaryDomainCard } from '@assist/components/dashboard/domains/SecondaryDomainCard';
8 import { LaunchCard } from '@assist/components/dashboard/LaunchCard';
9 import { useTours } from '@assist/hooks/useTours';
10 import { useTasksStore } from '@assist/state/tasks';
11 import { useRef } from '@wordpress/element';
12
13 export const CardContent = ({ task }) => {
14 if (task.type === 'html-text-button') return <GenericCard task={task} />;
15
16 if (task.type === 'domain-task') return <DomainCard task={task} />;
17
18 if (task.type === 'secondary-domain-task')
19 return <SecondaryDomainCard task={task} />;
20
21 if (task.type === 'site-launcher-task') return <LaunchCard task={task} />;
22
23 if (task.type === 'demo-card') return <DemoCard task={task} />;
24 if (task.type === 'no-action-btn-card')
25 return <NoActionBtnCard task={task} />;
26
27 return <TaskContent task={task} />;
28 };
29
30 const TaskContent = ({ task }) => {
31 const { isCompleted, dismissTask } = useTasksStore();
32 const { finishedTour } = useTours();
33 const isCompletedTask = isCompleted(task.slug) || finishedTour(task.slug);
34 // lock state on internal Link buttons if task is not completed
35 const lockedState = useRef(
36 task.type === 'internalLink' && !isCompletedTask ? task : null,
37 );
38 const handleDismiss = () => {
39 lockedState.current = null;
40 dismissTask(task.slug);
41 };
42 return (
43 <div
44 className="flex h-full w-full bg-cover bg-right-bottom bg-no-repeat"
45 style={{
46 backgroundImage: `url(${task?.backgroundImage})`,
47 }}
48 >
49 <div className="flex h-full w-full grow flex-col bg-white/95 px-8 py-8 lg:mr-48 lg:bg-transparent">
50 <div className="title text-2xl font-semibold leading-10 md:mt-32 lg:text-3xl">
51 {task.title}
52 </div>
53 <div className="description mt-2 text-sm md:text-base">
54 {task.description}
55 </div>
56
57 <div className="cta mt-8 flex flex-wrap items-center text-sm md:gap-3 rtl:justify-end">
58 <ActionButton task={lockedState.current ?? task} />
59 {lockedState.current || !isCompletedTask ? (
60 <DismissButton task={task} onClick={handleDismiss} />
61 ) : null}
62 </div>
63 </div>
64 </div>
65 );
66 };
67