-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial demo flow improvements (#39)
* Fix Form -> FormDefinition name mismatch * Add ActionBar component and wire to prompts. * Move FormManager/prompts into Form/PromptSegment. * Simplify "create new form" workflow by initiating it via a PDF upload/extract operation. * Cleaned up routing and navigation; added menu component. * Add test and story modules for PDFFileSelect. * Add available form list, so we have a separate entrypoint to the public/SRL version of forms. * Wrap UI components with appropriate formService for client/service/test environments. This commit also fixes bugs that were identified through testing the UI with the complete workflow of pdf ingest, form save, form submit, download pdf. * Add uswds import back into design package * Add a debug tool to help clear local storage when it is incompatible with the current version.
- Loading branch information
1 parent
c0997fd
commit c61e56f
Showing
69 changed files
with
809 additions
and
279 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from 'react'; | ||
import { ErrorBoundary } from 'react-error-boundary'; | ||
|
||
import { AvailableFormList } from '@atj/design'; | ||
import { getAppContext } from '../context'; | ||
import { getFormUrl } from '../routes'; | ||
import DebugTools from './DebugTools'; | ||
|
||
export default () => { | ||
const ctx = getAppContext(); | ||
return ( | ||
<ErrorBoundary | ||
fallback={ | ||
<div> | ||
There was an unexpected error rendering the form list. | ||
<DebugTools /> | ||
</div> | ||
} | ||
> | ||
<AvailableFormList | ||
formService={ctx.formService} | ||
urlForForm={getFormUrl} | ||
/> | ||
</ErrorBoundary> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import React from 'react'; | ||
|
||
import { FormManager } from '@atj/design'; | ||
import { getAppContext } from '../context'; | ||
|
||
export default function () { | ||
const ctx = getAppContext(); | ||
return <FormManager formService={ctx.formService} baseUrl={ctx.baseUrl} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import React from 'react'; | ||
|
||
import { FormRouter } from '@atj/design'; | ||
import { getAppContext } from '../context'; | ||
|
||
export default function AppFormRouter() { | ||
const ctx = getAppContext(); | ||
return <FormRouter formService={ctx.formService} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from 'react'; | ||
|
||
export default function DebugTools() { | ||
return ( | ||
<section> | ||
<button | ||
className="usa-button" | ||
onClick={() => { | ||
console.log('clearing'); | ||
window.localStorage.clear(); | ||
window.location.reload(); | ||
}} | ||
> | ||
Delete all demo data (clear browser local storage) | ||
</button> | ||
</section> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,57 @@ | ||
--- | ||
import closeSvg from '@atj/design/static/uswds/images/usa-icons/close.svg'; | ||
import closeSvg from '@atj/design/static/uswds/img/usa-icons/close.svg'; | ||
import * as routes from '../routes'; | ||
const getNavLinkClasses = (url: string) => { | ||
if (url === Astro.url.pathname) { | ||
return 'usa-nav-link usa-current'; | ||
} else { | ||
return 'usa-nav-link'; | ||
} | ||
}; | ||
--- | ||
|
||
<header class="usa-header usa-header--basic usa-header--megamenu"></header> | ||
<div class="usa-overlay"></div> | ||
<header class="usa-header usa-header--basic"> | ||
<div class="usa-nav-container"> | ||
<div class="usa-navbar"> | ||
<div class="usa-logo"> | ||
<em class="usa-logo__text"> | ||
<a href={routes.getHomeUrl()} title="10x Access to Justice"> | ||
10x Access to Justice | ||
</a> | ||
</em> | ||
</div> | ||
<button type="button" class="usa-menu-btn">Menu</button> | ||
</div> | ||
<nav aria-label="Primary navigation" class="usa-nav"> | ||
<button type="button" class="usa-nav__close"> | ||
<img src={closeSvg.src} role="img" alt="Close" /> | ||
</button> | ||
<ul class="usa-nav__primary usa-accordion"> | ||
<li class="usa-nav__primary-item"> | ||
<a | ||
href={routes.getHomeUrl()} | ||
class={getNavLinkClasses(routes.getHomeUrl())}><span>Home</span></a | ||
> | ||
</li> | ||
<li class="usa-nav__primary-item"> | ||
<a | ||
href={routes.getManageUrl()} | ||
class={getNavLinkClasses(routes.getManageUrl())} | ||
><span>Manage forms</span></a | ||
> | ||
</li> | ||
<li class="usa-nav__primary-item"> | ||
<a | ||
href={routes.getStorybookUrl()} | ||
class={getNavLinkClasses(routes.getStorybookUrl())} | ||
><span>Storybook</span></a | ||
> | ||
</li> | ||
</ul> | ||
</nav> | ||
</div> | ||
</header> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
--- | ||
import { FormManager } from '@atj/design'; | ||
import AppFormRouter from '../../components/AppFormRouter'; | ||
import ContentLayout from '../../layouts/ContentLayout.astro'; | ||
--- | ||
|
||
<ContentLayout title="10x Access to Justice Spotlight"> | ||
<FormManager client:only /> | ||
<AppFormRouter client:only /> | ||
</ContentLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,11 @@ | ||
--- | ||
import { DocumentAssembler } from '@atj/design/src/experiments/document-assembler'; | ||
import ContentLayout from '../layouts/ContentLayout.astro'; | ||
import AppAvailableFormList from '../components/AppAvailableFormList'; | ||
import DebugTools from '../components/DebugTools'; | ||
--- | ||
|
||
<ContentLayout title="10x Access to Justice Spotlight"> | ||
<h1>10x Access to Justice Spotlight</h1> | ||
<ul> | ||
<li> | ||
<a href={`${import.meta.env.BASE_URL}design/index.html`} | ||
>View frontend workshop</a | ||
> | ||
</li> | ||
<li> | ||
<a href={`${import.meta.env.BASE_URL}forms`}>Manage my forms</a> | ||
</li> | ||
<li> | ||
<a href={`${import.meta.env.BASE_URL}form-sample`}>Sample form</a> | ||
</li> | ||
<li> | ||
<a href={`${import.meta.env.BASE_URL}ud105-evicition-form`} | ||
>UD 105 - Unlawful Detainment Eviction Form</a | ||
> | ||
</li> | ||
<li> | ||
<a href={`${import.meta.env.BASE_URL}forms/import-pdf`}>Import PDF</a> | ||
</li> | ||
</ul> | ||
<DocumentAssembler client:load /> | ||
<AppAvailableFormList client:only /> | ||
<DebugTools client:only /> | ||
</ContentLayout> |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
import AppFormManager from '../../components/AppFormManager'; | ||
import ContentLayout from '../../layouts/ContentLayout.astro'; | ||
--- | ||
|
||
<ContentLayout title="10x Access to Justice Spotlight"> | ||
<AppFormManager client:only /> | ||
</ContentLayout> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { getAppContext } from './context'; | ||
|
||
export const getFormUrl = (formId: string) => { | ||
const context = getAppContext(); | ||
return `${context.baseUrl}forms/#${formId}`; | ||
}; | ||
|
||
export const getManageUrl = () => { | ||
const context = getAppContext(); | ||
return `${context.baseUrl}manage/`; | ||
}; | ||
|
||
export const getHomeUrl = () => { | ||
const context = getAppContext(); | ||
return context.baseUrl; | ||
}; | ||
|
||
export const getStorybookUrl = () => { | ||
const context = getAppContext(); | ||
return `${context.baseUrl}design/index.html`; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
packages/design/src/AvailableFormList/AvailableFormList.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import AvailableFormList from '.'; | ||
import { createTestFormService } from '@atj/form-service'; | ||
import { createForm } from '@atj/forms'; | ||
|
||
export default { | ||
title: 'AvailableFormList', | ||
component: AvailableFormList, | ||
args: { | ||
formService: createTestFormService({ | ||
'form-1': createForm({ | ||
title: 'Form 1', | ||
description: 'Use this form to...', | ||
}), | ||
'form-2': createForm({ | ||
title: 'Form 2', | ||
description: 'Use this form to...', | ||
}), | ||
}), | ||
urlForForm: () => `#`, | ||
}, | ||
tags: ['autodocs'], | ||
} satisfies Meta<typeof AvailableFormList>; | ||
|
||
export const AvailableFormListDemo = {} satisfies StoryObj< | ||
typeof AvailableFormList | ||
>; |
Oops, something went wrong.