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: use ogp design system #7308

Draft
wants to merge 122 commits into
base: 04-23-feat_add_initial_vite_config_and_new_eslint_rules
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
ff0cda5
feat: update eslint packages to stable latest versions
karrui Apr 23, 2024
53b2849
fix: add back missed storybook lint import
karrui Apr 23, 2024
3e7e0ff
fix: remove react-app eslint rules due to incompatibility with eslint
karrui Apr 23, 2024
6963064
fix: add react-hooks eslint plugin since react-app plugin is removed
karrui Apr 23, 2024
4fe4461
feat: add eslint rules to ignore explicit anys in test code
karrui Apr 23, 2024
110d0f9
fix: ALL LINT ERRORS DUE TO ANYS
karrui Apr 23, 2024
4ffd43f
feat: add looser eslint rules for test files
karrui Apr 23, 2024
20009f1
feat: upgrade prettier to v3
karrui Apr 23, 2024
feca8df
fix: formatting changes
karrui Apr 23, 2024
05f5df4
fix: lint for shared
karrui Apr 23, 2024
b781424
fix: remove erroneous react type pkg install on root
karrui Apr 23, 2024
9f75cd7
fix: add react-email package to root
karrui Apr 24, 2024
53bd77a
feat: add initial vite config and new eslint rules
karrui Apr 23, 2024
13d7705
feat: replace CRA variables with Vite variables
karrui Apr 24, 2024
ed36c23
feat: update ts-config
karrui Apr 24, 2024
043c0bb
feat: remove craco, fix webpack -> esbuild errors
karrui Apr 24, 2024
dbcd5fd
feat: update vite config for proxy and node polyfills
karrui Apr 24, 2024
2429da3
feat: make decryption workers work on Vite
karrui Apr 24, 2024
1451c7e
fix: theme typing generation script
karrui Apr 24, 2024
ea79328
fix: bundle worker as es
karrui Apr 24, 2024
bf42e8e
fix: update storybook to work with vite
karrui Apr 24, 2024
6d6a269
feat: upgrade to storybook v8 package with vite builder
karrui Apr 24, 2024
12e2cd4
fix: remove deprecated turbo-build storybook addon
karrui Apr 24, 2024
b752d73
fix: add missing node-stdlib-browser package
karrui Apr 24, 2024
66eaf9c
feat: switch to vitest, fix storybook test invocations
karrui Apr 26, 2024
e056793
feat: format and lint
karrui Apr 26, 2024
0bbfe15
feat: update msw package (to v1 latest, not v2 yet)
karrui Apr 26, 2024
2304197
fix: set svgr loader to not inject default dimensions
karrui Apr 26, 2024
29cab93
fix: regression in storybook 7 that removes 100% height from stories
karrui Apr 26, 2024
49c7ef5
fix: remove preview changes from `.storybook/main.ts`
karrui Apr 26, 2024
a9396ad
fix(test): use expect instead of just awaiting canvas.findByText
karrui Apr 26, 2024
ba5e327
fix: flakey toast test due to multiple tests running at the same time
karrui Apr 29, 2024
3eeaa33
fix: modal bounding box for chromatic stories
karrui Apr 29, 2024
5bc0249
feat: reuse old github secret env var instead of renaming to VITE_APP
karrui Apr 30, 2024
02cbf14
feat: remove unused .builtime-env
karrui Apr 30, 2024
7db605c
fix: misrenamed import
karrui Apr 30, 2024
9177241
feat: load datadog-chunk as separate script from main react app
karrui Apr 30, 2024
da8ccfb
feat: upgrade react and chakra-ui
karrui Apr 26, 2024
91ee316
fix: breaking changes from Chakra v2
karrui Apr 26, 2024
31d8a56
fix: use React 18
karrui Apr 26, 2024
2534985
feat: update framer-motion, MotionBox instantiation
karrui Apr 26, 2024
eb20b26
feat: update changed React.FC to FCC prop type
karrui Apr 26, 2024
9214b3f
fix: sync all type-fest package types
karrui Apr 26, 2024
061620a
fix: remove unnecessary package patches
karrui Apr 26, 2024
661b4a0
feat: remove unnecessary scripts and script comments
karrui Apr 26, 2024
78fa391
fix: correctly generate chakra theme types
karrui Apr 26, 2024
3039e5b
fix: revert motionbox back to old implementation
karrui Apr 26, 2024
17bab42
fix: upgrade serverless type-fest to sync with rest of app
karrui Apr 26, 2024
89caa7c
fix: use updated useToken call signature
karrui Apr 26, 2024
b89ef64
fix: update react-joyride for React 18 compat
karrui Apr 26, 2024
648f468
fix: types for allowed MyInfo types
karrui Apr 29, 2024
6355ad9
fix: broken types assertions or code raised by linter
karrui Apr 29, 2024
07a0b0d
fix: invalid React SVG prop clip-path -> clipPath
karrui Apr 29, 2024
6884434
fix: replace dnd package with React 18 compatible package
karrui Apr 29, 2024
146bcb8
fix: update package to remove console warning about deprecated calls
karrui Apr 29, 2024
0ccd6f8
fix: temporary fix for menu focus color desync
karrui Apr 29, 2024
1b031d5
feat: update `@testing-library/*` packages
karrui Apr 29, 2024
262c43a
feat: lock storybook packages
karrui Apr 29, 2024
22b3fb7
fix: correctly upgrade virus-scanner type-fest package
karrui Apr 29, 2024
447d922
fix: use `isDisabled` prop over disabled
karrui Apr 29, 2024
92c0c73
fix: test assertions due to RTL changes
karrui Apr 29, 2024
76dda8b
fix: upgrade floating-ui package for compatibility
karrui Apr 29, 2024
7bdee34
fix: compat issues in ChakraUI v2
karrui Apr 29, 2024
a71e98c
feat: update input theming for ChakraUI v2
karrui Apr 29, 2024
7619d76
fix: NumberInput render
karrui Apr 29, 2024
3bd496c
feat: update Drawer and Modal themes to have background using cssVars
karrui Apr 29, 2024
b5c77c8
fix: use explicit style context required by Chakra V2
karrui Apr 29, 2024
fa26bee
fix: correctly import from component Button
karrui Apr 29, 2024
50bdf05
fix: update margin due to flex using `gap` now
karrui Apr 29, 2024
d3f96a1
fix: update Rating component spacing due to flex gap change in chakra
karrui Apr 29, 2024
56f2ea7
fix: update YesNo field margins due to Flex gap change
karrui Apr 29, 2024
a1e2527
fix: weird margins with collaborator menu, match width
karrui Apr 29, 2024
d404651
fix: use __css instead of sx for FeatureBanner
karrui Apr 29, 2024
03d5e5c
fix: button spacing for CreateWorkspaceModal
karrui Apr 29, 2024
50524d4
fix: button spacing for DeleteWorkspaceModal
karrui Apr 29, 2024
258b121
fix: button spacing for RenameWorkspaceModal
karrui Apr 29, 2024
eaa1a0a
fix: spacing on LandingPage sections
karrui Apr 29, 2024
b2b5498
feat: update ParagraphField story to catch multiline changes too
karrui Apr 29, 2024
0881617
feat: remove unnecessary focus-visible package
karrui Apr 29, 2024
4995aa1
feat: update `isTruncated` -> `noOfLines`
karrui Apr 29, 2024
f6038f3
feat: fix width of PermissionDropdown for consistent widths
karrui Apr 29, 2024
760160f
fix: align ViewOnlyPermission row margins
karrui Apr 29, 2024
9ad2b4a
fix: SingleSelect theme breaking because of Menu
karrui Apr 29, 2024
539ee1a
fix: add padding to prefill lock icon
karrui Apr 29, 2024
6899691
fix: add correct msw handlers for workspace page
karrui Apr 29, 2024
b6cb42b
fix: add back missing margins
karrui Apr 29, 2024
c9cc5e2
fix: make AvatarMenu have automatic height
karrui Apr 29, 2024
35a2616
fix: add back missing menuitem padding for SingleSelect
karrui Apr 29, 2024
40641cc
fix: update imported lottie file type
karrui Apr 29, 2024
a5ecd60
fix: correct modal story color scheme for cancel button
karrui Apr 29, 2024
1bba72f
fix: set minH of TagInput to input's var
karrui Apr 29, 2024
11334aa
fix: use input exported css variables for styling TagInput
karrui Apr 29, 2024
31a236b
fix: move combobox input to the top when focused
karrui Apr 29, 2024
e841129
feat: use mockdate decorator so skeleton width fixed in snapshot
karrui Apr 29, 2024
7c1f04a
fix: spacing of collaborator list view again
karrui Apr 29, 2024
9523779
fix: landing page margins
karrui Apr 29, 2024
8e5511e
fix: avatarmenudivider margins
karrui Apr 30, 2024
f663c06
fix: remove removed patches copy in dockerfile
karrui May 2, 2024
c8e9c95
feat: upgrade typescript to 5.4.5 across app
karrui Apr 30, 2024
140e07c
fix: all frontend type errors after typescript upgrade
karrui May 2, 2024
6f20922
fix: backend type errors after upgrading typescript
karrui May 2, 2024
960b421
feat: use ogp design system
karrui May 3, 2024
e6c0c78
feat: extend theme from ogp design system
karrui May 3, 2024
019e5a5
feat: simplify layout of FeatureBanner
karrui May 3, 2024
183d29a
fix: use ogpds colors for TOU, PP page
karrui May 3, 2024
e71f66f
feat: update landing pages to ogpds typography and colors
karrui May 3, 2024
74652a6
feat: use new colors in login page, markdown text in banner
karrui May 3, 2024
a224967
feat: simplify resend otp button
karrui May 3, 2024
ae26ed5
feat: use ogpds's theme provider
karrui May 3, 2024
99b540c
feat: add back public form theme colors
karrui May 3, 2024
fce3636
feat: first pass at changing some textstyles and colors
karrui May 3, 2024
a4eed36
feat: replace InlineMessage with OGPDS Infobox
karrui May 3, 2024
04fbe85
feat: replace GovtMasthead with OGPDS
karrui May 3, 2024
5504ed8
feat: replace AvatarMenu with OGPDS
karrui May 3, 2024
c966994
fix: OtpForm input group
karrui May 3, 2024
bc65392
feat: replace components with OGPDS components
karrui May 3, 2024
81f6c91
feat: remove unused component themes, use ogpds useToast
karrui May 3, 2024
4eb0ba4
feat: use custom components when needed
karrui May 3, 2024
e4753cd
feat: remove unused components
karrui May 6, 2024
b11baaa
fix: update story imports to import from ogpds too
karrui May 6, 2024
22e3a7e
feat: set all neutral.xxx colors to a grey mapping
karrui May 6, 2024
462e6b2
feat: update color stories
karrui May 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 8 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,16 @@
"typesafe/no-throw-sync-func": "error"
}
},
{ "files": ["*.spec.ts"], "extends": ["plugin:jest/recommended"] },
{
"files": ["**/*.spec.ts", "**/__tests__/**/*.ts"],
"extends": ["plugin:jest/recommended"],
"rules": {
"@typescript-eslint/no-explicit-any": "off"
}
},
{
"files": ["*.ts", "*.js"],
"excludedFiles": ["**/*.spec.ts", "**/.spec.js", "**/__tests__/**/*.ts"],
"excludedFiles": ["**/*.spec.ts", "**/__tests__/**/*.ts"],
"rules": {
"@typescript-eslint/no-non-null-assertion": "error"
}
Expand Down
28 changes: 14 additions & 14 deletions .github/workflows/deploy-eb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,21 @@ jobs:
echo "APP_VERSION=$(jq -r .version package.json)-$(echo ${GITHUB_REF##*/})-$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_ENV
- name: Inject frontend build env vars
env:
REACT_APP_DD_RUM_APP_ID: ${{ secrets.DD_RUM_APP_ID }}
REACT_APP_DD_RUM_CLIENT_TOKEN: ${{ secrets.DD_RUM_CLIENT_TOKEN }}
REACT_APP_DD_RUM_ENV: ${{ secrets.DD_ENV }}
REACT_APP_DD_SAMPLE_RATE: ${{ secrets.DD_SAMPLE_RATE }}
REACT_APP_GA_TRACKING_ID: ${{ secrets.GA_TRACKING_ID }}
REACT_APP_FORMSG_SDK_MODE: ${{ secrets.REACT_APP_FORMSG_SDK_MODE }}
REACT_APP_URL: ${{ secrets.APP_URL }}
VITE_APP_DD_RUM_APP_ID: ${{ secrets.DD_RUM_APP_ID }}
VITE_APP_DD_RUM_CLIENT_TOKEN: ${{ secrets.DD_RUM_CLIENT_TOKEN }}
VITE_APP_DD_RUM_ENV: ${{ secrets.DD_ENV }}
VITE_APP_DD_SAMPLE_RATE: ${{ secrets.DD_SAMPLE_RATE }}
VITE_APP_GA_TRACKING_ID: ${{ secrets.GA_TRACKING_ID }}
VITE_APP_FORMSG_SDK_MODE: ${{ secrets.REACT_APP_FORMSG_SDK_MODE }}
VITE_APP_URL: ${{ secrets.APP_URL }}
run: |
sed -i -e "s|@REACT_APP_URL|${{secrets.APP_URL}}|g" -e "s/@REACT_APP_DD_RUM_APP_ID/$REACT_APP_DD_RUM_APP_ID/g" -e "s/@REACT_APP_DD_RUM_CLIENT_TOKEN/$REACT_APP_DD_RUM_CLIENT_TOKEN/g" -e "s/@REACT_APP_DD_RUM_ENV/$REACT_APP_DD_RUM_ENV/g" -e "s/@REACT_APP_VERSION/${{env.APP_VERSION}}/g" -e "s/@REACT_APP_DD_SAMPLE_RATE/$REACT_APP_DD_SAMPLE_RATE/g" frontend/datadog-chunk.ts
echo REACT_APP_VERSION=${{env.APP_VERSION}} > frontend/.env
echo REACT_APP_URL=$REACT_APP_URL > frontend/.env
echo REACT_APP_GA_TRACKING_ID=$REACT_APP_GA_TRACKING_ID >> frontend/.env
echo REACT_APP_FORMSG_SDK_MODE=$REACT_APP_FORMSG_SDK_MODE >> frontend/.env
echo REACT_APP_DD_RUM_CLIENT_TOKEN=$REACT_APP_DD_RUM_CLIENT_TOKEN >> frontend/.env
echo REACT_APP_DD_RUM_ENV=$REACT_APP_DD_RUM_ENV >> frontend/.env
sed -i -e "s|@VITE_APP_URL|${{secrets.APP_URL}}|g" -e "s/@VITE_APP_DD_RUM_APP_ID/$VITE_APP_DD_RUM_APP_ID/g" -e "s/@VITE_APP_DD_RUM_CLIENT_TOKEN/$VITE_APP_DD_RUM_CLIENT_TOKEN/g" -e "s/@VITE_APP_DD_RUM_ENV/$VITE_APP_DD_RUM_ENV/g" -e "s/@VITE_APP_VERSION/${{env.APP_VERSION}}/g" -e "s/@VITE_APP_DD_SAMPLE_RATE/$VITE_APP_DD_SAMPLE_RATE/g" frontend/datadog-chunk.ts
echo VITE_APP_VERSION=${{env.APP_VERSION}} > frontend/.env
echo VITE_APP_URL=$VITE_APP_URL > frontend/.env
echo VITE_APP_GA_TRACKING_ID=$VITE_APP_GA_TRACKING_ID >> frontend/.env
echo VITE_APP_FORMSG_SDK_MODE=$VITE_APP_FORMSG_SDK_MODE >> frontend/.env
echo VITE_APP_DD_RUM_CLIENT_TOKEN=$VITE_APP_DD_RUM_CLIENT_TOKEN >> frontend/.env
echo VITE_APP_DD_RUM_ENV=$VITE_APP_DD_RUM_ENV >> frontend/.env

- name: Configure AWS credentials
uses: aws-actions/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Build
env:
NODE_OPTIONS: '--max-old-space-size=4096 --openssl-legacy-provider'
REACT_APP_FORMSG_SDK_MODE: 'test'
VITE_APP_FORMSG_SDK_MODE: 'test'
run: npm run build
- name: Run Playwright tests (login)
run: npx playwright test __tests__/e2e/login.spec.ts
Expand Down
1 change: 0 additions & 1 deletion Dockerfile.production
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ WORKDIR /build
COPY package.json package-lock.json ./
COPY shared/package.json shared/package-lock.json ./shared/
COPY frontend/package.json frontend/package-lock.json ./frontend/
COPY frontend/patches ./frontend/patches

# Allow running of postinstall scripts
# RUN npm config set unsafe-perm true
Expand Down
3 changes: 3 additions & 0 deletions __tests__/e2e/utils/field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ export const createMyInfoField = (
...fieldBase,
ValidationOptions: { selectedValidation: null, customVal: null },
}
default:
// eslint-disable-next-line typesafe/no-throw-sync-func
throw new Error(`Unimplemented MyInfo field type: ${fieldType}`)
}
}

Expand Down
4 changes: 2 additions & 2 deletions docs/DEPLOYMENT_SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ There are also environment secrets for each environment (`staging`, `staging-alt
|:---------|------------|
|`APP_NAME`|Application name for the environment.|
|`DEPLOY_ENV`|Deployment environment on elastic beanstalk.|
|`REACT_APP_FORMSG_SDK_MODE`|Determines the keys used in the formsg SDK. Set either `production` or `staging`.|
|`REACT_APP_FORMSG_SDK_MODE`| Determines the keys used in the formsg SDK. Set either `production` or `staging`.|

## Environment Variables

Expand Down Expand Up @@ -268,7 +268,7 @@ Forms can be protected with [recaptcha](https://www.google.com/recaptcha/about/)

| Variable | Description |
| :------------------------- | ----------------------------- |
| `REACT_APP_GA_TRACKING_ID` | Google Analytics tracking ID. |
| `VITE_APP_GA_TRACKING_ID` | Google Analytics tracking ID. |

#### Sentry.io

Expand Down
10 changes: 0 additions & 10 deletions frontend/.buildtime-env

This file was deleted.

4 changes: 3 additions & 1 deletion frontend/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@

node_modules

CREDITS.md
CREDITS.md

!.storybook
83 changes: 0 additions & 83 deletions frontend/.eslintrc

This file was deleted.

91 changes: 91 additions & 0 deletions frontend/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/* eslint-env node */

module.exports = {
root: true,
env: { browser: true, es2020: true },
plugins: [
'import',
'simple-import-sort',
'prettier',
'testing-library',
'react-refresh',
],
extends: [
'eslint:recommended',
'plugin:prettier/recommended',
'plugin:storybook/recommended',
'plugin:react-hooks/recommended',
],
overrides: [
{
files: ['*.ts', '*.tsx'],
extends: ['plugin:@typescript-eslint/recommended'],
parser: '@typescript-eslint/parser',
rules: {
'@typescript-eslint/no-unused-vars': 'warn',
},
},
{
files: ['*.stories.*'],
rules: {
'@typescript-eslint/explicit-module-boundary-types': 'off',
},
},
{
files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
extends: ['plugin:testing-library/react'],
rules: {
'@typescript-eslint/no-non-null-assertion': 'off',
'testing-library/no-unnecessary-act': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'no-unsafe-optional-chaining': 'off',
},
},
],
ignorePatterns: ['!.storybook'],
rules: {
// Rules for auto sort of imports
'simple-import-sort/imports': [
'error',
{
groups: [
// Side effect imports.
['^\\u0000'],
// Packages.
// Packages. `react` related packages come first.
// Things that start with a letter (or digit or underscore), or
// `@` followed by a letter.
['^react', '^@?\\w'],
// Root imports
// Shared imports should be separate from application imports.
['^(~shared)(/.*|$)'],
['^(~)(/.*|$)'],
['^(~typings)(/.*|$)'],
[
'^(~assets|~theme)(/.*|$)',
'^(~contexts)(/.*|$)',
'^(~constants)(/.*|$)',
'^(~hooks)(/.*|$)',
'^(~utils)(/.*|$)',
'^(~services)(/.*|$)',
'^(~components)(/.*|$)',
'^(~templates)(/.*|$)',
],
['^(~pages)(/.*|$)', '^(~features)(/.*|$)'],
// Parent imports. Put `..` last.
['^\\.\\.(?!/?$)', '^\\.\\./?$'],
// Other relative imports. Put same-folder imports and `.` last.
['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
],
},
],
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
'simple-import-sort/exports': 'error',
'import/first': 'error',
'import/newline-after-import': 'error',
'import/no-duplicates': 'error',
},
}
2 changes: 0 additions & 2 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,3 @@ build-storybook.log
# Lint cache
.eslintcache

#Datadog chunk files
datadog-chunk.*.js
1 change: 0 additions & 1 deletion frontend/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ storybook-static
build-storybook.log

tsconfig.json
tsconfig.dd.json

# all asset json files
**/assets/**/*.json
Expand Down
22 changes: 18 additions & 4 deletions frontend/.storybook/foundations/Colours/ColourTable.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
import { useTheme } from '@chakra-ui/react'
import { Table, TableCaption, Tbody, Td, Th, Thead, Tr } from '@chakra-ui/table'
import {
Table,
TableCaption,
Tbody,
Td,
Th,
Thead,
Tr,
useTheme,
} from '@chakra-ui/react'
import { get } from 'lodash'

interface ColourTableProps {
export interface ColourTableProps {
label: string
colours: {
palette: string
Expand All @@ -27,7 +36,12 @@ export const ColourTable = ({
</Thead>
<Tbody>
{colours.map((d) => {
const hexCode = theme.colors[d.palette][d.shade]
const hexCode = get(
theme.colors,
[d.palette, d.shade].join('.'),
'',
).toUpperCase()
if (!hexCode) return null
return (
<Tr key={d.shade}>
<Td>
Expand Down
Loading
Loading