mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
dd1ab1ca72
* chore: add prettier as a dev dependency The project has a .prettierrc, so seems to depend on that for its formatting, but there was no prettier installed with the node modules. * chore: add autofocus to all clearly defined first inputs on dialogs. * fix: wrap the disable env input in a form and give it autofocus. * fix: submit form when pressing enter * fix: only autofocus the submit button if there is no other content. When multiple (enabled) elements have the autofocus attribute, the browser picks the last element in the tree. This means that if there is a form with a text input with autofocus and a submit button with autofocus, the button will win, causing the user to have to tab back up. Only doing this if there are no children will cause some changes, however: Dialogs with textual children will no longer focus the accept-button when appearing. However, dialogs such as the create new api token dialog will give the focus to the first input field instead of to the create button. * fix: add formId prop to dialog element; adapt behavior If the component receives a form id, it will treat the primary button as the submit button for that form. To stop a full page reload, we call the `preventDefault` on the submit event before calling the handler. * chore: remove redundant spacing in component. * fix: hook environment disable form up with the new form id system. * chore: Update existing modal forms to pass in formId * fix: Type the dialog event wrapper * fix: change 'allows' => 'allow' because the noun is pluralized. * fix: add autofocus to js add-tag-dialog-component. I've got a feeling this component isn't in use anymore, though, as the exact same text appears in a TS-version of this component. * fix: add autofocus to add user form. This seems to only be used as the main piece of a modal, so adding autofocus seems pretty safe here, but I could be wrong. * fix: Update snapshot test after changing wording. * fix: add autofocus to update user form * fix: add autofocus to the create toggle form. This is a little besides the task's actual point. However! This form is only ever used on the page where it's the only bit of content. I'd argue that when the user navigates to this form, it's because they want to create a feature. Thus, adding autofocus to the first field makes a lot of sense to me. * refactor: set button type to 'undefined' when it isn't 'submit' This allows Material to use their default type based on whatever heuristics they use. It's most likely going to be 'button' for the foreseeable future, but in the event that they change it, passing undefined instead should future-proof this a bit. * fix: set type to button when formId is not present Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com> |
||
---|---|---|
.. | ||
.github/workflows | ||
cypress | ||
public | ||
src | ||
.editorconfig | ||
.gitignore | ||
.nvmrc | ||
.prettierignore | ||
.prettierrc | ||
CHANGELOG.md | ||
craco.config.js | ||
cypress.json | ||
index.js | ||
LICENSE | ||
package.json | ||
README.md | ||
renovate.json | ||
tsconfig.json | ||
typings.json | ||
vercel.json | ||
yarn.lock |
Developing
Why did you render
This application is set up with WDYR and craco in order to find, debug and remove uneccesary re-renders. This configuration can be found in /src/wdyr.ts.
In order to turn it on, change the configuration accordingly:
if (process.env.NODE_ENV === 'development') {
const whyDidYouRender = require('@welldone-software/why-did-you-render');
whyDidYouRender(React, {
trackAllPureComponents: true,
});
}
Now you should be able to review rendering information in the console. If you do utilise this functionality, please remember to set the configuration back to spare other developers the noise in the console.
Run with together with local unleash-api:
You need to first start the unleash-api on port 4242 before you can start working on unleash-frontend. Start webpack-dev-server with hot-reload:
cd ~/unleash-frontend
yarn install
yarn run start
Run with heroku hosted unleash-api:
cd ~/unleash-frontend
yarn install
yarn run start:heroku
UI Framework
We are using material-ui.
Happy coding!