PluginProbe
Extendify / trunk
Extendify vtrunk
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 / AutoLaunch / hooks / useMigrateChoice.js

useMigrateChoice.js in Extendify trunk, at src/AutoLaunch/hooks/useMigrateChoice.js

47 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { checkIn } from '@auto-launch/functions/insights';
2 import { sparkles } from '@auto-launch/icons';
3 import { launchStrings } from '@auto-launch/strings';
4 import { useEffect } from '@wordpress/element';
5 import { cloudUpload } from '@wordpress/icons';
6
7 const migrateSearchUrl = (search) =>
8 `${window.extSharedData.adminUrl}plugin-install.php?tab=search&s=${encodeURIComponent(search)}`;
9
10 export const useMigrateChoice = ({ onBuildNew }) => {
11 const strings = launchStrings();
12
13 useEffect(() => {
14 checkIn({ stage: 'migrate_screen' });
15 }, []);
16
17 return {
18 title: strings.migrateTitle,
19 options: [
20 {
21 key: 'migrate',
22 icon: cloudUpload,
23 heading: strings.migrateHeading,
24 buttonLabel: strings.migrateAction,
25 description: strings.migrateBody,
26 onClick: () => {
27 checkIn({ stage: 'migrate_screen_migrate' });
28 window.location.assign(migrateSearchUrl(strings.migrationSearch));
29 },
30 },
31 {
32 key: 'build',
33 icon: sparkles,
34 heading: strings.buildHeading,
35 highlight: true,
36 badgeLabel: strings.buildBadge,
37 buttonLabel: strings.buildAction,
38 description: strings.buildBody,
39 onClick: () => {
40 checkIn({ stage: 'migrate_screen_build' });
41 onBuildNew();
42 },
43 },
44 ],
45 };
46 };
47