Removing other unneeded injectIntl
This commit is contained in:
parent
94ee5eb844
commit
323f02f7ac
2 changed files with 8 additions and 11 deletions
|
@ -1,7 +1,7 @@
|
||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
import React, {useState, useRef, useEffect} from 'react'
|
import React, {useState, useRef, useEffect} from 'react'
|
||||||
import {injectIntl, IntlShape} from 'react-intl'
|
import {useIntl, IntlShape} from 'react-intl'
|
||||||
|
|
||||||
import {PropertyType} from '../blocks/board'
|
import {PropertyType} from '../blocks/board'
|
||||||
import {Utils} from '../utils'
|
import {Utils} from '../utils'
|
||||||
|
@ -15,7 +15,6 @@ type Props = {
|
||||||
onNameChanged: (newName: string) => void
|
onNameChanged: (newName: string) => void
|
||||||
onTypeChanged: (newType: PropertyType) => void
|
onTypeChanged: (newType: PropertyType) => void
|
||||||
onDelete: (id: string) => void
|
onDelete: (id: string) => void
|
||||||
intl: IntlShape
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function typeDisplayName(intl: IntlShape, type: PropertyType): string {
|
function typeDisplayName(intl: IntlShape, type: PropertyType): string {
|
||||||
|
@ -46,7 +45,7 @@ function typeMenuTitle(intl: IntlShape, type: PropertyType): string {
|
||||||
}
|
}
|
||||||
|
|
||||||
const PropertyMenu = React.memo((props: Props) => {
|
const PropertyMenu = React.memo((props: Props) => {
|
||||||
const {intl} = props
|
const intl = useIntl()
|
||||||
const nameTextbox = useRef<HTMLInputElement>(null)
|
const nameTextbox = useRef<HTMLInputElement>(null)
|
||||||
const [name, setName] = useState(props.propertyName)
|
const [name, setName] = useState(props.propertyName)
|
||||||
|
|
||||||
|
@ -83,7 +82,7 @@ const PropertyMenu = React.memo((props: Props) => {
|
||||||
>
|
>
|
||||||
<Menu.Label>
|
<Menu.Label>
|
||||||
<b>
|
<b>
|
||||||
{props.intl.formatMessage({id: 'PropertyMenu.changeType', defaultMessage: 'Change property type'})}
|
{intl.formatMessage({id: 'PropertyMenu.changeType', defaultMessage: 'Change property type'})}
|
||||||
</b>
|
</b>
|
||||||
</Menu.Label>
|
</Menu.Label>
|
||||||
|
|
||||||
|
@ -144,4 +143,4 @@ const PropertyMenu = React.memo((props: Props) => {
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default injectIntl(PropertyMenu)
|
export default PropertyMenu
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
import React, {useState} from 'react'
|
import React, {useState} from 'react'
|
||||||
import {injectIntl, IntlShape} from 'react-intl'
|
import {useIntl} from 'react-intl'
|
||||||
import {ActionMeta, ValueType, FormatOptionLabelMeta} from 'react-select'
|
import {ActionMeta, ValueType, FormatOptionLabelMeta} from 'react-select'
|
||||||
import CreatableSelect from 'react-select/creatable'
|
import CreatableSelect from 'react-select/creatable'
|
||||||
import {CSSObject} from '@emotion/serialize'
|
import {CSSObject} from '@emotion/serialize'
|
||||||
|
@ -26,7 +26,6 @@ type Props = {
|
||||||
onChange: (value: string) => void
|
onChange: (value: string) => void
|
||||||
onChangeColor: (option: IPropertyOption, color: string) => void
|
onChangeColor: (option: IPropertyOption, color: string) => void
|
||||||
onDeleteOption: (option: IPropertyOption) => void
|
onDeleteOption: (option: IPropertyOption) => void
|
||||||
intl: IntlShape
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type LabelProps = {
|
type LabelProps = {
|
||||||
|
@ -34,11 +33,11 @@ type LabelProps = {
|
||||||
meta: FormatOptionLabelMeta<IPropertyOption, false>
|
meta: FormatOptionLabelMeta<IPropertyOption, false>
|
||||||
onChangeColor: (option: IPropertyOption, color: string) => void
|
onChangeColor: (option: IPropertyOption, color: string) => void
|
||||||
onDeleteOption: (option: IPropertyOption) => void
|
onDeleteOption: (option: IPropertyOption) => void
|
||||||
intl: IntlShape
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const ValueSelectorLabel = React.memo((props: LabelProps): JSX.Element => {
|
const ValueSelectorLabel = React.memo((props: LabelProps): JSX.Element => {
|
||||||
const {option, meta} = props
|
const {option, meta} = props
|
||||||
|
const intl = useIntl()
|
||||||
if (meta.context === 'value') {
|
if (meta.context === 'value') {
|
||||||
return <Label color={option.color}>{option.value}</Label>
|
return <Label color={option.color}>{option.value}</Label>
|
||||||
}
|
}
|
||||||
|
@ -53,7 +52,7 @@ const ValueSelectorLabel = React.memo((props: LabelProps): JSX.Element => {
|
||||||
<Menu.Text
|
<Menu.Text
|
||||||
id='delete'
|
id='delete'
|
||||||
icon={<DeleteIcon/>}
|
icon={<DeleteIcon/>}
|
||||||
name={props.intl.formatMessage({id: 'BoardComponent.delete', defaultMessage: 'Delete'})}
|
name={intl.formatMessage({id: 'BoardComponent.delete', defaultMessage: 'Delete'})}
|
||||||
onClick={() => props.onDeleteOption(option)}
|
onClick={() => props.onDeleteOption(option)}
|
||||||
/>
|
/>
|
||||||
<Menu.Separator/>
|
<Menu.Separator/>
|
||||||
|
@ -138,7 +137,6 @@ function ValueSelector(props: Props): JSX.Element {
|
||||||
option={option}
|
option={option}
|
||||||
meta={meta}
|
meta={meta}
|
||||||
onChangeColor={props.onChangeColor}
|
onChangeColor={props.onChangeColor}
|
||||||
intl={props.intl}
|
|
||||||
onDeleteOption={props.onDeleteOption}
|
onDeleteOption={props.onDeleteOption}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
@ -163,4 +161,4 @@ function ValueSelector(props: Props): JSX.Element {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default injectIntl(ValueSelector)
|
export default ValueSelector
|
||||||
|
|
Loading…
Reference in a new issue