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

feat: Add new MapAndLabel component to @planx components #3446

Merged
merged 18 commits into from
Jul 24, 2024

Conversation

RODO94
Copy link
Contributor

@RODO94 RODO94 commented Jul 22, 2024

What does this PR do?

This PR creates the framework for a new Editor "@planx" component.

To create this PR, I have followed the steps laid out here: https://github.com/theopensystemslab/planx-new/blob/main/editor.planx.uk/docs/adding-a-new-component.md

*Replacing SetValue with MapAndLabel

With this PR, there has also been an update to the planx-core ref in the package.json

Still To-Do In Other PRs

  • Refine MapAndLabel modal component
  • Define shape of data outputted from MapAndLabel component
  • Create tests for new component

import { useFormik } from "formik";
import React from "react";

import { EditorProps } from "../ui";
Copy link
Contributor Author

@RODO94 RODO94 Jul 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried to get this working with the path "@planx/..." but it kept throwing an error so I changed to a relative path.

If the "@planx/components/ui" path is required, I can switch it

@RODO94
Copy link
Contributor Author

RODO94 commented Jul 22, 2024

@DafyddLlyr and @jessicamcinchak would be great to get a sense check on these changes. There's a lot more detail and work to be done, but I hope I've at least set it all up in the right places.

Copy link

github-actions bot commented Jul 22, 2024

Removed vultr server and associated DNS entries

Copy link
Member

@jessicamcinchak jessicamcinchak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recognise this is still draft, but just a few initial spots ! Definitely on the right track, always nice to see the component library growing 📚

@RODO94 RODO94 force-pushed the rory/add-map-and-label-comp branch from 313460f to 5a3ed31 Compare July 23, 2024 13:04
@RODO94 RODO94 marked this pull request as ready for review July 23, 2024 14:32
@RODO94 RODO94 requested a review from jessicamcinchak July 23, 2024 14:35
Copy link
Member

@jessicamcinchak jessicamcinchak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for changes so far! A couple more spots on another review - especially please watch package versions on rebase!

e2e/tests/api-driven/package.json Outdated Show resolved Hide resolved
e2e/tests/ui-driven/package.json Outdated Show resolved Hide resolved
editor.planx.uk/src/pages/Preview/Node.tsx Outdated Show resolved Hide resolved
@@ -62,6 +62,9 @@ const NodeTypeSelect: React.FC<{
<option value={TYPES.AddressInput}>Address Input</option>
<option value={TYPES.ContactInput}>Contact Input</option>
<option value={TYPES.List}>List</option>
{hasFeatureFlag("TREES") && (
<option value={TYPES.MapAndLabel}>Map and Label</option>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jessicamcinchak do you think this should be under Inputs or Location?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thinking with Inputs was that the user needs to input data we need...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inputs makes sense to me too! Existing location components typically fetch/present external data, which isn't necessarily a requirement here. And as long as it's feature flagged we can change our minds later without issue 🙂

@RODO94
Copy link
Contributor Author

RODO94 commented Jul 23, 2024

Thanks for changes so far! A couple more spots on another review - especially please watch package versions on rebase!

Yeah, sorry to miss those, I always forget the e2e package.json.

Should be all good now, and I've updated the Node file which was pulling in the Editor component instead of the Public one.

@RODO94 RODO94 requested a review from jessicamcinchak July 23, 2024 15:24
Copy link
Member

@jessicamcinchak jessicamcinchak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most recent changes look good, but I can't open flows on this pizza? Can you?

Would like to be able to do one final in-editor manual test before approving! Maybe Vultr needs a destroy/re-create ?

@RODO94 RODO94 requested a review from jessicamcinchak July 24, 2024 09:21
Copy link
Member

@jessicamcinchak jessicamcinchak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two minor last things - but overall working for me!

Since feature flagged, feels safe to merge whenever you're ready !

placeholder={"Title"}
value={formik.values.title}
onChange={formik.handleChange}
/>
Copy link
Member

@jessicamcinchak jessicamcinchak Jul 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: while manually testing in the Editor, I can currently create a new component without entering any input, which doesn't match the types you've defined in model.ts (eg I'd expect title & fn to be required and throw an error if no value!)

Simply adding the required prop on the Input should do the trick! (Will just throw a native browser error if empty then, not full Gov UK styled error - but that's fine for the Editor for now)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! I'll update before merging

name="fn"
placeholder={"Data Field"}
value={formik.values.fn}
disabled
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this one disabled ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lingering mistake from me turning things off and on! I'll correct before merging

@RODO94 RODO94 force-pushed the rory/add-map-and-label-comp branch 2 times, most recently from 7b2ba93 to 1d53d5f Compare July 24, 2024 10:34
@RODO94 RODO94 merged commit 65953c6 into main Jul 24, 2024
12 checks passed
@RODO94 RODO94 deleted the rory/add-map-and-label-comp branch July 24, 2024 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants