Skip to content

Commit

Permalink
🪢 Merge 3.5.1 into dev (#4843)
Browse files Browse the repository at this point in the history
  • Loading branch information
thesan committed Apr 25, 2024
2 parents 0440920 + 0e563b4 commit 0aa19fa
Show file tree
Hide file tree
Showing 10 changed files with 388 additions and 371 deletions.
20 changes: 19 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [3.5.1] - 2024-04-25

### Fixed
- Proxy API becoming unresponsive.

## [3.5.0 (Luxor)][3.5.0] - 2024-04-18

### Added
- Decrease council budget proposal.
- Update CRT pallet constraints proposal.
- Set Era Payout Damping Factor proposal.

### Fixed
- Keep the app usable if an error happen.
- Number input behavior.

## [3.4.0] - 2024-03-19

### Fixed
Expand Down Expand Up @@ -368,7 +384,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [0.1.1] - 2022-12-02

[unreleased]: https://github.com/Joystream/pioneer/compare/v3.4.0...HEAD
[unreleased]: https://github.com/Joystream/pioneer/compare/v3.5.1...HEAD
[3.5.1]: https://github.com/Joystream/pioneer/compare/v3.5.0...v3.5.1
[3.5.0]: https://github.com/Joystream/pioneer/compare/v3.4.0...v3.5.0
[3.4.0]: https://github.com/Joystream/pioneer/compare/v3.3.1...v3.4.0
[3.3.1]: https://github.com/Joystream/pioneer/compare/v3.3.0...v3.3.1
[3.3.0]: https://github.com/Joystream/pioneer/compare/v3.2.0...v3.3.0
Expand Down
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@
"@babel/traverse": "~7.21.0",
"@babel/types": "~7.21.0",
"@joystream/types": "4.5.0",
"@polkadot/api": "10.1.4",
"@polkadot/api-contract": "10.1.4",
"@polkadot/api-derive": "10.1.4",
"@polkadot/hw-ledger": "11.1.1",
"@polkadot/keyring": "11.1.1",
"@polkadot/networks": "11.1.1",
"@polkadot/rpc-core": "10.1.4",
"@polkadot/rpc-provider": "10.1.4",
"@polkadot/types": "10.1.4",
"@polkadot/types-known": "10.1.4",
"@polkadot/util": "11.1.1",
"@polkadot/util-crypto": "11.1.1",
"@polkadot/api": "10.7.1",
"@polkadot/api-contract": "10.7.1",
"@polkadot/api-derive": "10.7.1",
"@polkadot/hw-ledger": "12.2.1",
"@polkadot/keyring": "12.2.1",
"@polkadot/networks": "12.2.1",
"@polkadot/rpc-core": "10.7.1",
"@polkadot/rpc-provider": "10.7.1",
"@polkadot/types": "10.7.1",
"@polkadot/types-known": "10.7.1",
"@polkadot/util": "12.2.1",
"@polkadot/util-crypto": "12.2.1",
"bn.js": "^4.11.9"
},
"engines": {
Expand Down
18 changes: 9 additions & 9 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@joystream/pioneer",
"version": "3.4.0",
"version": "3.5.1",
"license": "GPL-3.0-only",
"scripts": {
"build": "node --max_old_space_size=4096 ./build.js",
Expand Down Expand Up @@ -34,14 +34,14 @@
"@nivo/core": "^0.79.0",
"@noble/hashes": "^1.1.5",
"@oneidentity/zstd-js": "^1.0.3",
"@polkadot/api": "10.1.4",
"@polkadot/extension-dapp": "0.45.3",
"@polkadot/keyring": "11.1.1",
"@polkadot/react-identicon": "3.1.1",
"@polkadot/types": "10.1.4",
"@polkadot/ui-keyring": "3.1.1",
"@polkadot/util": "11.1.1",
"@polkadot/util-crypto": "11.1.1",
"@polkadot/api": "10.7.1",
"@polkadot/extension-dapp": "0.46.3",
"@polkadot/keyring": "12.2.1",
"@polkadot/react-identicon": "3.4.1",
"@polkadot/types": "10.7.1",
"@polkadot/ui-keyring": "3.4.1",
"@polkadot/util": "12.2.1",
"@polkadot/util-crypto": "12.2.1",
"@popperjs/core": "^2.10.2",
"@types/jest": "^27.0.2",
"@types/react": "^17.0.27",
Expand Down
1 change: 0 additions & 1 deletion packages/ui/src/proposals/constants/regExp.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,36 @@ import { RowGapBlock } from '@/common/components/page/PageContent'
import { Tooltip, TooltipDefault } from '@/common/components/Tooltip'
import { TextMedium, TextSmall, TextInlineSmall } from '@/common/components/typography'
import { useResponsive } from '@/common/hooks/useResponsive'
import { isValidCSV } from '@/proposals/model/isValidCsv'

import { PreviewAndValidateModal } from './modals/PreviewAndValidate'
import { ErrorPrompt, Prompt } from './Prompt'

export const FundingRequest = () => {
const { watch, setValue, getFieldState } = useFormContext()
const { watch, setValue } = useFormContext()
const { isMobile, size } = useResponsive()
const [isPreviewModalShown, setIsPreviewModalShown] = useState(false)
const [payMultiple] = watch(['fundingRequest.payMultiple'])
const [hasPreviewedInput] = watch(['fundingRequest.hasPreviewedInput'], { 'fundingRequest.hasPreviewedInput': true })
const csvInput = watch('fundingRequest.csvInput')

const [hasPreviewedInput, setHasPreviewedInput] = useState(false)
const [canPreviewInput, setCanPreviewInput] = useState(false)

useEffect(() => {
if (getFieldState('fundingRequest.accountsAndAmounts')) {
setValue('fundingRequest.accountsAndAmounts', undefined, { shouldValidate: true })
setValue('fundingRequest.hasPreviewedInput', false, { shouldValidate: true })
}
}, [csvInput])
const canPreviewInput =
getFieldState('fundingRequest.csvInput').isDirty && !getFieldState('fundingRequest.csvInput').error
const subscription = watch((data, info) => {
if (info.name !== 'fundingRequest.csvInput' || info.type !== 'change') return

const isCsvInpuValid = isValidCSV(data.fundingRequest.csvInput)
setCanPreviewInput(isCsvInpuValid !== canPreviewInput)

if (hasPreviewedInput) {
setHasPreviewedInput(false)
setValue('fundingRequest.accountsAndAmounts', undefined, { shouldValidate: true })
}
})

return () => subscription.unsubscribe()
}, [watch])

return (
<RowGapBlock gap={24}>
<Row>
Expand Down Expand Up @@ -90,7 +101,8 @@ export const FundingRequest = () => {
<InputComponent
label="Destination accounts and transfer amounts"
required
message={'You can select up to 20 recipients'}
message={canPreviewInput ? 'You can select up to 20 recipients' : 'Not valid CSV format'}
validation={canPreviewInput ? undefined : 'invalid'}
name="fundingRequest.csvInput"
id="accounts-amounts"
inputSize="xl"
Expand Down
6 changes: 1 addition & 5 deletions packages/ui/src/proposals/modals/AddNewProposal/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
} from '@/common/utils/validation'
import { AccountSchema, StakingAccountSchema } from '@/memberships/model/validation'
import { Member } from '@/memberships/types'
import { equalToContext, isValidCSV } from '@/proposals/model/validation'
import { equalToContext } from '@/proposals/model/validation'
import { ProposalType } from '@/proposals/types'
import { GroupIdName } from '@/working-groups/types'

Expand Down Expand Up @@ -264,10 +264,6 @@ export const schemaFactory = (api?: Api) => {
.test('previewedinput', 'Please preview', (value) => typeof value !== 'undefined' && value)
.required('Field is required'),
}),
csvInput: Yup.string().when('payMultiple', {
is: true,
then: (schema) => schema.test(isValidCSV('Not valid CSV format')).required('Field is required'),
}),
accountsAndAmounts: Yup.array().when('payMultiple', {
is: true,
then: (schema) => schema.required(),
Expand Down
14 changes: 14 additions & 0 deletions packages/ui/src/proposals/model/isValidCsv.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export const CSV_PATTERN = /^([^,:;]+),([^,:;]+)(\n[^,:;]+,[^,:;]+)*(\n)?$/

export const isValidCSV = (value: string) => {
if (!CSV_PATTERN.test(value)) return false

const pairs = value.split('\n')

for (const pair of pairs) {
const [, amount] = pair.split(',')
if (!Number(amount)) return false
}

return true
}
20 changes: 0 additions & 20 deletions packages/ui/src/proposals/model/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,6 @@ import { get } from 'lodash'
import * as Yup from 'yup'
import { AnyObject } from 'yup/lib/types'

import { CSV_PATTERN } from '../constants/regExp'

export const isValidCSV = (message: string): Yup.TestConfig<any, AnyObject> => ({
message,
name: 'isValidCSV',
exclusive: false,
test(value: string) {
if (!CSV_PATTERN.test(value)) return false

const pairs = value.split('\n')

for (const pair of pairs) {
const [, amount] = pair.split(',')
if (!Number(amount)) return false
}

return true
},
})

export const equalToContext = (
msg: (value: any) => string,
contextPath: string,
Expand Down
5 changes: 3 additions & 2 deletions packages/ui/src/proxyApi/client/query.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AnyTuple } from '@polkadot/types/types'
import { uniqueId } from 'lodash'
import { filter, Observable, map } from 'rxjs'
import { filter, Observable, map, share } from 'rxjs'

import { deserializeMessage } from '../models/payload'
import { ApiKinds, PostMessage, RawWorkerMessageEvent } from '../types'
Expand Down Expand Up @@ -35,7 +35,8 @@ export const query = <K extends ApiQueryKinds>(
) => {
const queryMessages = messages.pipe(
filter(({ data }) => data.messageType === apiKind),
deserializeMessage<WorkerQueryMessage<K>>()
deserializeMessage<WorkerQueryMessage<K>>(),
share()
)

return apiInterfaceProxy<K>(
Expand Down

0 comments on commit 0aa19fa

Please sign in to comment.