PluginProbe
Extendify / 0.10.2
Extendify v0.10.2
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 / TasksList.js

TasksList.js in Extendify 0.10.2, at src/Assist/components/TasksList.js

91 lines 3.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { ExternalLink, Spinner } from '@wordpress/components'
2 import { __ } from '@wordpress/i18n'
3 import classNames from 'classnames'
4 import { Checkmark } from '@onboarding/svg'
5 import { useTasks } from '@assist/hooks/useTasks'
6 import { useTasksStoreReady, useTasksStore } from '@assist/state/Tasks'
7
8 export const TasksList = () => {
9 const { tasks, loading, error } = useTasks()
10 const ready = useTasksStoreReady()
11
12 if (loading || !ready || error) {
13 return (
14 <div className="my-4 w-full flex items-center max-w-3/4 mx-auto bg-gray-100 p-12">
15 <Spinner />
16 </div>
17 )
18 }
19
20 if (tasks.length === 0) {
21 return (
22 <div className="my-4 max-w-3/4 w-full mx-auto bg-gray-100 p-12">
23 {__('No tasks found...', 'extendify')}
24 </div>
25 )
26 }
27
28 return (
29 <div className="my-4 max-w-3/4 w-full mx-auto bg-gray-100 p-12">
30 <div className="flex gap-2 items-center justify-center">
31 <h2 className="mb-0 text-lg text-center">
32 {__('Get ready to go live', 'extendify')}
33 </h2>
34 <span className="rounded-full bg-gray-700 text-white text-base px-3 py-0.5">
35 {tasks.length}
36 </span>
37 </div>
38 <div className="w-full">
39 {tasks.map((task) => (
40 <TaskCheckBox key={task.slug} task={task} />
41 ))}
42 </div>
43 </div>
44 )
45 }
46
47 const TaskCheckBox = ({ task }) => {
48 const { isCompleted, toggleCompleted } = useTasksStore()
49 return (
50 <div className="p-3 flex border border-solid border-gray-400 bg-white mt-4 relative">
51 <span className="block mt-1 relative">
52 <input
53 id={`task-${task.slug}`}
54 type="checkbox"
55 className={classNames(
56 'hide-checkmark h-6 w-6 rounded-full border-gray-400 outline-none focus:ring-wp ring-partner-primary-bg ring-offset-2 ring-offset-white m-0 focus:outline-none focus:shadow-none',
57 {
58 'bg-partner-primary-bg': isCompleted(task.slug),
59 },
60 )}
61 checked={isCompleted(task.slug)}
62 value={task.slug}
63 name={task.slug}
64 onChange={() => toggleCompleted(task.slug)}
65 />
66 <Checkmark className="text-white fill-current absolute h-6 w-6 block top-0" />
67 </span>
68 <span className="flex flex-col pl-2">
69 <label
70 htmlFor={`task-${task.slug}`}
71 className="text-base font-semibold">
72 <span
73 aria-hidden="true"
74 className="absolute inset-0"></span>
75 {task.title}
76 </label>
77 <span>
78 {task.description}{' '}
79 {task.link && (
80 <ExternalLink
81 className="relative z-10"
82 href={task.link}>
83 {__('Learn more', 'extendify')}
84 </ExternalLink>
85 )}
86 </span>
87 </span>
88 </div>
89 )
90 }
91