-
Notifications
You must be signed in to change notification settings - Fork 68
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
Freeze pallet proposal creation #4625
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
storybook test
...Proposal/components/SpecificParameters/UpdatePalletFrozenStatus/SelectPalletFrozenStatus.tsx
Outdated
Show resolved
Hide resolved
|
||
const setPalletFrozenStatus = (selected: PalletFrozenStatus) => { | ||
if (selected === 'Enabled') { | ||
setValue('updatePalletFrozenStatus.frozen', true, { shouldValidate: true }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So based on this:
"Enabled" should mean frozen to false
and "Disabled" frozen to true
Since a toggle should used instead of a select (see: #4625 (comment)) this isn't so relevant anymore but keep this in mind when labeling the toggle. It's kinda counterintuitive.
...c/proposals/modals/AddNewProposal/components/SpecificParameters/UpdatePalletFrozenStatus.tsx
Outdated
Show resolved
Hide resolved
packages/ui/src/proposals/modals/AddNewProposal/AddNewProposalModal.tsx
Outdated
Show resolved
Hide resolved
packages/ui/src/proposals/modals/AddNewProposal/AddNewProposalModal.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last thing:
...defaultProposalValues, | ||
updatePalletFrozenStatus: { | ||
pallet: 'ProjectToken', | ||
frozen: !palletFrozenStatus, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -20,3 +20,19 @@ export const isValidCSV = (message: string): Yup.TestConfig<any, AnyObject> => ( | |||
return true | |||
}, | |||
}) | |||
export const differentFromContext = (msg: string, type?: string): Yup.TestConfig<any, AnyObject> => ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make things more reusable:
- add a
contextPath: string
argument just like inmaxContext
for example.
Then the validation code becomes:const validationValue = get(this.options.context, contextPath).toJSON() if (validationValue === value) {
- Make the
msg
into a function:msg: (value: any) => string
.
So the returned message becomes:message: msg(value)
With this differentFromContext
becomes:
differentFromContext(
(isFrozen) => `The ProjectToken pallet is currently ${isFrozen ? 'disabled' : enabled}, so presently this proposal would fail due to execution constraints.`,
'palletFrozenStatus',
'execution'
)
Create proposal for freeze pallet #4557
> Designs
> Story
> Preview
┆Issue is synchronized with this Asana task by Unito