PluginProbe
Extendify / 3.2.1
Extendify v3.2.1
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 / buttons / LinkButton.jsx

LinkButton.jsx in Extendify 3.2.1, at src/Assist/components/dashboard/buttons/LinkButton.jsx

29 lines 882 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { useTasksStore } from '@assist/state/tasks';
2 import { useEffect, useState } from '@wordpress/element';
3
4 const { frontPage } = window.extSharedData || {};
5
6 export const LinkButton = ({ task, completed }) => {
7 const [link, setLink] = useState(
8 task.slug === 'edit-homepage' ? null : task.link,
9 );
10 const { completeTask } = useTasksStore();
11
12 useEffect(() => {
13 if (task.slug === 'edit-homepage') {
14 const split = task.link.split('$');
15 setLink(`${split[0]}${frontPage}${split[1]}`);
16 }
17 }, [task, setLink]);
18
19 return (
20 <a
21 className="min-w-24 cursor-pointer rounded-xs bg-design-main px-4 py-2.5 text-center text-sm font-medium text-design-text no-underline hover:opacity-90"
22 href={window.extSharedData.adminUrl + link}
23 onClick={() => completeTask(task.slug)}
24 >
25 {completed ? task.buttonLabels.completed : task.buttonLabels.notCompleted}
26 </a>
27 );
28 };
29