Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: new form builder settings UI #7098

Merged
merged 88 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from 83 commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
13b17de
refactor: move form title input to left and mode buttons to center
pauloiankoski Oct 19, 2023
94da49f
feature: set tabs for editor modes
pauloiankoski Oct 19, 2023
a41cb67
refactor: replace classnames for header tabs
pauloiankoski Oct 19, 2023
1e87094
fix: set maxWidth and keep tabs centered
pauloiankoski Oct 19, 2023
937d1e3
refactor: add icon to form title field and style it
pauloiankoski Oct 20, 2023
9ca8dc9
refactor: move form settings tab to be a page content
pauloiankoski Oct 20, 2023
12383f4
fix: check if design sidebar must be displayed
pauloiankoski Oct 20, 2023
dabde8e
feature: add form settings container with menu stack
pauloiankoski Nov 23, 2023
bb9eff6
feature: style menu
pauloiankoski Nov 5, 2023
0748cca
feature: style sections
pauloiankoski Nov 5, 2023
5158410
feature: adjust main fields on general group
pauloiankoski Nov 6, 2023
3c5b2f8
feature: adjust donation confirmation group
pauloiankoski Nov 6, 2023
47a08f3
feature: destruct email settings from modal
pauloiankoski Nov 6, 2023
f679213
feature: adjust email settings
pauloiankoski Nov 6, 2023
edf241e
feature: wrap recipient field in a section
pauloiankoski Nov 6, 2023
ad2d0f3
feature: replace hidden div with conditional
pauloiankoski Nov 6, 2023
b19c1f2
feature: replace editor with new ClassicEditor component
pauloiankoski Nov 23, 2023
eba5c15
feature: adjust fields to match design
pauloiankoski Nov 13, 2023
7f7d9c3
feature: make settings components available for add-ons
pauloiankoski Nov 13, 2023
f2466c7
feature: move hook up
pauloiankoski Nov 13, 2023
bddb4b2
feature: update content when children change
pauloiankoski Nov 13, 2023
216d2d3
refactor: remove wrapper for extra padding
pauloiankoski Nov 14, 2023
ebba33d
fix: enforce styles to design selection modal
pauloiankoski Nov 20, 2023
5f08e9f
refactor: update tour step pointing to new tabs
pauloiankoski Nov 20, 2023
384d8b2
refactor: fix input color and borders
pauloiankoski Nov 20, 2023
257220e
fix: prevent other editors from showing when in fullscreen
pauloiankoski Nov 20, 2023
70dfba8
feature: hide email options if not enabled
pauloiankoski Nov 20, 2023
0ef554e
feature: change back button position
pauloiankoski Nov 20, 2023
342fc7a
feature: close email preview when changing tab
pauloiankoski Nov 20, 2023
374d354
feature: change help copy
pauloiankoski Nov 20, 2023
ca52555
refactor: split permalink input
pauloiankoski Nov 20, 2023
4cff959
chore: change file extension to jsx
pauloiankoski Nov 20, 2023
5989a5c
test: update test with new attribute
pauloiankoski Nov 20, 2023
705cfa6
feature: truncate long domains
pauloiankoski Nov 20, 2023
4559a66
feature: add spacing to + button and hide sidebar when in settings
pauloiankoski Nov 20, 2023
3681e42
feature: update editor content when it's changed from outside
pauloiankoski Nov 20, 2023
9a85bff
feature: rename form design with form layout
pauloiankoski Nov 20, 2023
53f91db
feature: set secondary button hover bg
pauloiankoski Nov 21, 2023
de9a840
refactor: hide guided tour link from settings tab
pauloiankoski Nov 21, 2023
03203a9
fix: change word case
pauloiankoski Nov 21, 2023
2032d5d
refactor: change classic editor style
pauloiankoski Nov 23, 2023
b0f6302
refactor: replace trashicon
pauloiankoski Nov 21, 2023
680f398
refactor: remove bigger font size from last tour step
pauloiankoski Nov 21, 2023
45548f4
feature: set tour title weight to 700
pauloiankoski Nov 21, 2023
39b929b
feature: add responsive style for tablets
pauloiankoski Nov 23, 2023
1993b6f
feature: simplify editor main toolbar
pauloiankoski Nov 23, 2023
235d27a
fix: remove duplicated import
pauloiankoski Nov 23, 2023
c93de46
refactor: revert unnecessary changes
pauloiankoski Nov 23, 2023
6cccc57
refactor: change responsive breakpoint
pauloiankoski Nov 23, 2023
cf2d1b3
fix: turn label optional and remove unnecessary wrappers
pauloiankoski Nov 27, 2023
457b797
refactor: optimize reducer actions
pauloiankoski Nov 27, 2023
1b8591b
refactor: replace useEffect hooks with simple if statements
pauloiankoski Nov 27, 2023
df832e9
refactor: implement custom router system
pauloiankoski Nov 28, 2023
654eb67
fix: only show submenu if in current parent
pauloiankoski Nov 28, 2023
d3b1d8c
refactor: type and memoize routes
pauloiankoski Dec 1, 2023
bc43565
feature: add conditional visibility to routes
pauloiankoski Dec 1, 2023
d3cee64
refactor: move inline css to css file
pauloiankoski Dec 1, 2023
67503d0
refactor: remove unused variables
pauloiankoski Dec 2, 2023
00ae82a
refactor: move SettingsSection component to library repo
pauloiankoski Dec 2, 2023
c48cf66
refactor: import ClassicEditor and SettingsSection from library
pauloiankoski Dec 2, 2023
d0ed651
Merge branch 'develop' into feature/form-builder-settings-ui
pauloiankoski Dec 11, 2023
a528c80
chore: add form-builder-library
pauloiankoski Dec 12, 2023
f613dc2
chore: revert dependencies updates
pauloiankoski Dec 12, 2023
6a67801
chore: add missing textdomain
pauloiankoski Dec 13, 2023
2b3a4b3
feature: pass item back to showWhen function
pauloiankoski Dec 13, 2023
8cb6367
fix: prevent tags to be sanitized too early in preview mode
pauloiankoski Dec 14, 2023
9b0182d
refactor: create a shared TemplateTags component
pauloiankoski Jan 5, 2024
2ec138d
refactor: update PopoverContentWithTemplateTags to use the new shared…
pauloiankoski Jan 5, 2024
2f52f2e
fix: enqueue missing css
pauloiankoski Jan 5, 2024
8e444e4
fix: update Donation Confirmation template tags description
pauloiankoski Jan 5, 2024
1ae31f0
Merge branch 'develop' into feature/form-builder-settings-ui
jonwaldstein Jan 8, 2024
c564046
chore: remove ClassicEditor component
pauloiankoski Jan 8, 2024
6e01c46
doc: add unreleased tag
pauloiankoski Jan 8, 2024
79f7728
feature: validate routes received via wp filter
pauloiankoski Jan 8, 2024
f7ae8dc
refactor: extract action type strings to constants
pauloiankoski Jan 8, 2024
32371ee
refactor: reuse shared TemplateTags component
pauloiankoski Jan 8, 2024
a06389a
chore: remove ClassicEditor styles
pauloiankoski Jan 8, 2024
31e72b2
doc: type Menu and Content functions
pauloiankoski Jan 8, 2024
af414a3
refactor: reword menu class names
pauloiankoski Jan 8, 2024
230d25b
refactor: elevate hook so the callback function receives it directly
pauloiankoski Jan 8, 2024
6596c88
refactor: revert exposing ClassicEditor component through the window …
pauloiankoski Jan 8, 2024
64fa35e
refactor: pass settings and setSettings as props of the route element
pauloiankoski Jan 8, 2024
372d524
fix: pass settings and setSettings on FormPrepublishingPanel component
pauloiankoski Jan 9, 2024
e44f568
refactor: extract routes object and validate for duplicated paths
pauloiankoski Jan 9, 2024
51e2dba
fix: add templateTagsRef to TemplateTags component
pauloiankoski Jan 9, 2024
30415a3
chore: upgrade form-builder-library dependency
pauloiankoski Jan 9, 2024
c8bc344
fix: guarantee email recipients are an array
pauloiankoski Jan 9, 2024
ccf89ff
fix: only convert to array when valid
pauloiankoski Jan 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
468 changes: 364 additions & 104 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
],
"devDependencies": {
"@types/lodash": "^4.14.199",
"@types/react": "^18.0.27",
"@types/react": "^18.0.38",
"@types/react-datepicker": "^4.15.0",
"@types/react-dom": "^18.0.10",
"@types/react-dom": "^18.0.11",
"@types/wordpress__blocks": "^12.5.0",
"@types/wordpress__components": "^23.0.1",
"@wordpress/dependency-extraction-webpack-plugin": "^3.3.2",
Expand Down Expand Up @@ -69,6 +69,7 @@
"@fortawesome/free-solid-svg-icons": "^5.15.1",
"@fortawesome/react-fontawesome": "^0.1.12",
"@givewp/design-system-foundation": "^1.1.0",
"@givewp/form-builder-library": "^1.1.2",
"@hookform/error-message": "^2.0.1",
"@hookform/resolvers": "^2.9.10",
"@paypal/paypal-js": "^5.1.4",
Expand Down Expand Up @@ -141,6 +142,7 @@
"swr": "^2.0.1",
"uiblocker": "latest",
"use-immer": "^0.9.0",
"uuid": "^9.0.1",
"vhtml": "^2.2.0"
},
"overrides": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function __invoke($var)
if (is_array($var)) {
return array_map($this, $var);
} else {
return is_string($var) ? wp_unslash(wp_kses_post($var)) : $var;
return is_string($var) ? wp_unslash($var) : $var;
}
}
}
1 change: 1 addition & 0 deletions src/FormBuilder/ViewModels/FormBuilderViewModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public function storageData(int $donationFormId): array
// Note: Boolean values must be nested in an array to maintain boolean type, see \WP_Scripts::localize().
'permalink' => add_query_arg(['p' => $donationFormId], site_url('?post_type=give_forms')),
'rewriteSlug' => get_post_type_object('give_forms')->rewrite['slug'],
'baseUrl' => preg_replace('/^https?:\/\//', '', site_url()),
],
'gateways' => $this->getGateways(),
'gatewaySettingsUrl' => admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import {__} from '@wordpress/i18n';
import {BlockEditProps} from '@wordpress/blocks';
import {InspectorControls} from '@wordpress/block-editor';
import {Markup} from 'interweave';
import {ClassicEditor} from '@givewp/form-builder-library';
import GlobalSettingsLink from '@givewp/form-builder/blocks/fields/terms-and-conditions/GlobalSettingsLink';
import {getFormBuilderWindowData} from '@givewp/form-builder/common/getWindowData';
import ControlForPopover from '@givewp/form-builder/components/settings/ControlForPopover';
import StyledPopover from '@givewp/form-builder/blocks/fields/terms-and-conditions/StyledPopover';

import './styles.scss';
import ClassicEditor from '@givewp/form-builder/components/ClassicEditor';

const DisplayTypeEnum = {
SHOW_MODAL_TERMS: 'showModalTerms',
Expand Down
JasonTheAdams marked this conversation as resolved.
Outdated
Show resolved Hide resolved

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import React, {useMemo} from 'react';
import FormSettingsContainer from '@givewp/form-builder/components/canvas/FormSettingsContainer';
import FormGeneralSettingsGroup from '@givewp/form-builder/settings/group-general';
import FormDonationConfirmationSettingsGroup from '@givewp/form-builder/settings/group-donation-confirmation';
import {__} from '@wordpress/i18n';
import EmailGeneralSettings from '@givewp/form-builder/settings/group-email-settings/general';
import getEmailSettings from '@givewp/form-builder/settings/group-email-settings';

/**
* @unreleased
*/
export default function FormSettings() {
jonwaldstein marked this conversation as resolved.
Show resolved Hide resolved
const routes: Route[] = useMemo(() => {
const additionalSettings = validateRoutes(
wp.hooks.applyFilters('givewp_form_builder_settings_additional_routes', [])
);

return [
{
name: __('General', 'give'),
path: 'general',
JasonTheAdams marked this conversation as resolved.
Show resolved Hide resolved
jonwaldstein marked this conversation as resolved.
Show resolved Hide resolved
element: FormGeneralSettingsGroup,
},
{
name: __('Donation Confirmation', 'give'),
path: 'donation-confirmation',
element: FormDonationConfirmationSettingsGroup,
},
{
name: __('Email Settings', 'give'),
path: 'email-settings',
element: null,
childRoutes: [
{
name: __('General', 'give'),
path: 'email-settings/general',
element: EmailGeneralSettings,
},
...getEmailSettings(),
],
},
...additionalSettings,
];
}, []);

return <FormSettingsContainer routes={routes} />;
}

/**
* @unreleased
*/
function validateRoutes(routes: Route[]): Route[] {
return routes.filter((route) => {
let isValid = isValidRoute(route);
jonwaldstein marked this conversation as resolved.
Show resolved Hide resolved

if (route.childRoutes) {
if (Array.isArray(route.childRoutes)) {
route.childRoutes = validateRoutes(route.childRoutes);
} else {
delete route.childRoutes;
isValid = false;
}
}

return isValid;
});
}

/**
* @unreleased
*/
function isValidRoute(route: Route) {
return (
route.name &&
typeof route.name === 'string' &&
route.path &&
typeof route.path === 'string' &&
'element' in route
);
}

/**
* @unreleased
*/
export type Route = {
name: string;
path: string;
element?: React.FC<{settings: any; setSettings: any}>;
childRoutes?: Route[];
showWhen?: ({item, settings}) => boolean;
};
Loading
Loading