mirror of
https://github.com/mattermost/focalboard.git
synced 2025-01-08 15:06:08 +02:00
adding some selectors to the create new cards modal
This commit is contained in:
parent
2a14d8a41d
commit
1f6a500b21
@ -9,10 +9,10 @@ import {Card} from '../blocks/card'
|
|||||||
import octoClient from '../octoClient'
|
import octoClient from '../octoClient'
|
||||||
import mutator from '../mutator'
|
import mutator from '../mutator'
|
||||||
import {getCard} from '../store/cards'
|
import {getCard} from '../store/cards'
|
||||||
import {getCardComments} from '../store/comments'
|
import {getCardComments, getCardComments1} from '../store/comments'
|
||||||
import {getCardContents} from '../store/contents'
|
import {getCardContents} from '../store/contents'
|
||||||
import {useAppDispatch, useAppSelector} from '../store/hooks'
|
import {useAppDispatch, useAppSelector} from '../store/hooks'
|
||||||
import {getCardAttachments, updateAttachments, updateUploadPrecent} from '../store/attachments'
|
import {getCardAttachments, getCardAttachments1, updateAttachments, updateUploadPrecent} from '../store/attachments'
|
||||||
import TelemetryClient, {TelemetryActions, TelemetryCategory} from '../telemetry/telemetryClient'
|
import TelemetryClient, {TelemetryActions, TelemetryCategory} from '../telemetry/telemetryClient'
|
||||||
import {Utils} from '../utils'
|
import {Utils} from '../utils'
|
||||||
import CompassIcon from '../widgets/icons/compassIcon'
|
import CompassIcon from '../widgets/icons/compassIcon'
|
||||||
@ -39,6 +39,7 @@ import Dialog from './dialog'
|
|||||||
|
|
||||||
import './cardDialog.scss'
|
import './cardDialog.scss'
|
||||||
import CardActionsMenu from './cardActionsMenu/cardActionsMenu'
|
import CardActionsMenu from './cardActionsMenu/cardActionsMenu'
|
||||||
|
import {RootState} from '../store'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
board: Board
|
board: Board
|
||||||
@ -55,8 +56,8 @@ const CardDialog = (props: Props): JSX.Element => {
|
|||||||
const {board, activeView, cards, views} = props
|
const {board, activeView, cards, views} = props
|
||||||
const card = useAppSelector(getCard(props.cardId))
|
const card = useAppSelector(getCard(props.cardId))
|
||||||
const contents = useAppSelector(getCardContents(props.cardId))
|
const contents = useAppSelector(getCardContents(props.cardId))
|
||||||
const comments = useAppSelector(getCardComments(props.cardId))
|
const comments = useAppSelector((state: RootState) => getCardComments1(state, props.cardId))
|
||||||
const attachments = useAppSelector(getCardAttachments(props.cardId))
|
const attachments = useAppSelector((state: RootState) => getCardAttachments1(state, props.cardId))
|
||||||
const clientConfig = useAppSelector(getClientConfig)
|
const clientConfig = useAppSelector(getClientConfig)
|
||||||
const intl = useIntl()
|
const intl = useIntl()
|
||||||
const dispatch = useAppDispatch()
|
const dispatch = useAppDispatch()
|
||||||
|
@ -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 {createSlice, PayloadAction} from '@reduxjs/toolkit'
|
import {createSelector, createSlice, PayloadAction} from '@reduxjs/toolkit'
|
||||||
|
|
||||||
import {AttachmentBlock} from '../blocks/attachmentBlock'
|
import {AttachmentBlock} from '../blocks/attachmentBlock'
|
||||||
|
|
||||||
@ -90,3 +90,10 @@ export function getUploadPercent(blockId: string): (state: RootState) => number
|
|||||||
return (state.attachments.attachments[blockId].uploadingPercent)
|
return (state.attachments.attachments[blockId].uploadingPercent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const getCardAttachments1: (state: RootState, cardId: string) => AttachmentBlock[] = createSelector(
|
||||||
|
(state: RootState, cardId: string) => state.attachments.attachmentsByCard[cardId],
|
||||||
|
(attachments) => {
|
||||||
|
return attachments || []
|
||||||
|
},
|
||||||
|
)
|
||||||
|
@ -86,6 +86,14 @@ export function getCardComments(cardId: string): (state: RootState) => CommentBl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const getCardComments1: (state: RootState, cardId: string) => CommentBlock[] = createSelector(
|
||||||
|
(state: RootState, cardId: string) => state.comments?.commentsByCard[cardId],
|
||||||
|
(comments) => {
|
||||||
|
console.log(comments)
|
||||||
|
return comments || []
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
export function getLastCardComment(cardId: string): (state: RootState) => CommentBlock|undefined {
|
export function getLastCardComment(cardId: string): (state: RootState) => CommentBlock|undefined {
|
||||||
return (state: RootState): CommentBlock|undefined => {
|
return (state: RootState): CommentBlock|undefined => {
|
||||||
const comments = state.comments?.commentsByCard && state.comments.commentsByCard[cardId]
|
const comments = state.comments?.commentsByCard && state.comments.commentsByCard[cardId]
|
||||||
|
Loading…
Reference in New Issue
Block a user