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

Mock api / Throwaway Edit UI Changes #50

Merged
merged 8 commits into from
Feb 27, 2024
Merged

Mock api / Throwaway Edit UI Changes #50

merged 8 commits into from
Feb 27, 2024

Conversation

jimmoffet
Copy link
Contributor

This is a WIP, but don't let me block you from merging it if you're comfortable.

I built into the stub of the fakeCache function Document's suggestFormDetails(). There's a small hard-coded fieldsMap object I was using for testing and a parseJson() function in mock-api.ts that can produce a complete fieldsMap object from a json object (currently being read in from a file).

The primary remaining work is to continue refining the relationship between parsedPDF and the fieldsMap object.

The biggest tension is figuring out groups of elements. The quality of what the parsing routine is able to deliver jumps quite a bit once we're able to accommodate element groups that look like:

<text> 
[<input>,<input>,<input>]

For reasons that are hard to explain succinctly, but easy to see in practice, treating all of those objects as independent elements creates lots of friction and extra work for the content author.

The next biggest tension is forcing users to treat every line of non-input text parsed from the pdf as a independent editable object, rather than lumping them together. Google forms has a very opinionated take that privileges architecture simplicity over flexible UX, it's worth looking at for early iterations of our editing UI. We can probably leapfrog a lot of time coming around to the same conclusions.

I tweaked some things in the edit UI mostly for my own education/edification, hopefully those changes will be washed away soon by new incoming designs.

TODO: I barely touched the display side at all. The non-input paragraph element needs an appropriate representation. I noticed the paragraphBlock object in the unwired fieldset comments, but I didn't dig into it. The only change I made was to substitute the label over the input fields with element.instructions because we have instructions now and it seemed more appropriate than element.name.

TODO: Make sure the createPrompt() in the paragraph element definition is sensible. I don't totally understand its purpose and implications.

TODO: I'm not sure the paragraph element is appropriately named or actually wants to be tied to a paragraph html tag. Realistically, it's probably going to be hard to avoid a div level container of multiple text tags, unless we get much better at parsing and auto-combining elements. Even then, we'll have to see how much users are willing to put up with in terms of forcing them to edit closely-related chunks of text as separate objects.

@@ -118,12 +119,12 @@ const SequenceElementEdit: FormElementComponent<SequenceElement> = ({
<input type="hidden" {...register(`${element.id}.id`)} />
<input type="hidden" {...register(`${element.id}.type`)} />
<input type="hidden" {...register(`${element.id}.elements`)} />
{elements.map(elements => (
{elements.map(el => (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was tracking down an error and having a bunch of nested objects using the same variable name was making me slightly bananas. This doesn't strictly need to be changed

],
"include": [
"./packages/*/src/**/*.json",
],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Various config changes to permit importing a local .json file in an idiomatic way

@jimmoffet jimmoffet requested a review from danielnaab February 26, 2024 07:05
@jimmoffet jimmoffet changed the base branch from main to dependabot/npm_and_yarn/babel/traverse-7.23.2 February 27, 2024 03:02
@jimmoffet jimmoffet changed the base branch from dependabot/npm_and_yarn/babel/traverse-7.23.2 to main February 27, 2024 03:02
@danielnaab danielnaab merged commit b4ecf4b into main Feb 27, 2024
0 of 2 checks passed
@danielnaab danielnaab deleted the jim/mock-api-cache branch February 27, 2024 21:38
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