Skip to content

Commit

Permalink
refactor: fix import
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajat-Dabade committed Jun 18, 2024
1 parent 1f0304d commit a33c057
Show file tree
Hide file tree
Showing 17 changed files with 1,633 additions and 211 deletions.
1,603 changes: 1,492 additions & 111 deletions webapp/package-lock.json

Large diffs are not rendered by default.

57 changes: 45 additions & 12 deletions webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,48 @@
"dependencies": {
"core-js": "3.29.1",
"glob-parent": "6.0.2",
"marked": ">=4.0.12",
"mattermost-redux": "5.33.1",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-intl": "^5.20.0",
"react-redux": "8.0.5",
"react-router-dom": "^5.2.0",
"trim-newlines": "4.0.2",
"react-select": "^5.2.2"
"@draft-js-plugins/editor": "^4.1.2",
"@draft-js-plugins/emoji": "^4.6.0",
"@draft-js-plugins/mention": "^5.1.2",
"@fullcalendar/core": "^5.10.1",
"@fullcalendar/daygrid": "^5.10.1",
"@fullcalendar/interaction": "^5.10.1",
"@fullcalendar/react": "^5.10.1",
"@mattermost/compass-icons": "^0.1.39",
"@reduxjs/toolkit": "^1.8.0",
"@tippyjs/react": "4.2.6",
"color": "^4.2.1",
"draft-js": "^0.11.7",
"emoji-mart": "^3.0.1",
"fstream": "^1.0.12",
"fullcalendar": "^5.10.2",
"imagemin-gifsicle": "^7.0.0",
"imagemin-mozjpeg": "^10.0.0",
"imagemin-optipng": "^8.0.0",
"imagemin-pngquant": "^9.0.2",
"imagemin-svgo": "^10.0.1",
"imagemin-webp": "^7.0.0",
"lodash": "^4.17.21",
"marked": "^4.0.12",
"mini-create-react-context": "^0.4.1",
"moment": "^2.29.1",
"nanoevents": "^5.1.13",
"react": "17.0.2",
"react-beautiful-dnd": "^13.1.1",
"react-day-picker": "^7.4.10",
"react-dnd": "^14.0.2",
"react-dnd-html5-backend": "^14.0.0",
"react-dnd-scrolling": "^1.2.1",
"react-dnd-touch-backend": "^14.0.0",
"react-dom": "17.0.2",
"react-hot-keys": "^2.7.1",
"react-hotkeys-hook": "^3.4.4",
"react-intl": "^5.20.0",
"react-redux": "7.2.4",
"react-router-dom": "^5.2.0",
"react-select": "^5.2.2",
"trim-newlines": "^4.0.2"
},
"jest": {
"testEnvironment": "jsdom",
Expand All @@ -111,13 +144,13 @@
"text-summary"
],
"moduleNameMapper": {
"^.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/../../webapp/__mocks__/fileMock.js",
"^.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
"^.+\\.(scss|css)$": "<rootDir>/tests/style_mock.json",
"^.*i18n.*\\.(json)$": "<rootDir>/tests/i18n_mock.json",
"^bundle-loader\\?lazy\\!(.*)$": "$1",
"^react$": "<rootDir>/../../webapp/node_modules/react",
"^react-redux$": "<rootDir>/../../webapp/node_modules/react-redux",
"^react-intl$": "<rootDir>/../../webapp/node_modules/react-intl"
"^react$": "<rootDir>/node_modules/react",
"^react-redux$": "<rootDir>/node_modules/react-redux",
"^react-intl$": "<rootDir>/node_modules/react-intl"
},
"moduleDirectories": [
"",
Expand Down
2 changes: 2 additions & 0 deletions webapp/src/components/boardIconSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,6 @@ const BoardIconSelector = React.memo((props: Props) => {
)
})

BoardIconSelector.displayName = 'BoardIconSelector'

export default BoardIconSelector
8 changes: 4 additions & 4 deletions webapp/src/components/boardSelector.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import {mocked} from 'jest-mock'

import userEvent from '@testing-library/user-event'

import octoClient from '../../../../webapp/src/octoClient'
import {mockStateStore} from '../../../../webapp/src/testUtils'
import {createBoard} from '../../../../webapp/src/blocks/board'
import {wrapIntl} from '../../../../webapp/src/testUtils'
import octoClient from '../octoClient'
import {mockStateStore} from '../testUtils'
import {createBoard} from '../blocks/board'
import {wrapIntl} from '../testUtils'

import BoardSelector from './boardSelector'

Expand Down
36 changes: 18 additions & 18 deletions webapp/src/components/boardSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@ import React, {useState, useMemo, useCallback} from 'react'
import {IntlProvider, useIntl, FormattedMessage} from 'react-intl'
import debounce from 'lodash/debounce'

import {getMessages} from '../../../../webapp/src/i18n'
import {getLanguage} from '../../../../webapp/src/store/language'

import {useWebsockets} from '../../../../webapp/src/hooks/websockets'

import octoClient from '../../../../webapp/src/octoClient'
import mutator from '../../../../webapp/src/mutator'
import {getCurrentTeamId, getAllTeams, Team} from '../../../../webapp/src/store/teams'
import {createBoard, Board} from '../../../../webapp/src/blocks/board'
import {useAppSelector, useAppDispatch} from '../../../../webapp/src/store/hooks'
import {EmptySearch, EmptyResults} from '../../../../webapp/src/components/searchDialog/searchDialog'
import ConfirmationDialog from '../../../../webapp/src/components/confirmationDialogBox'
import Dialog from '../../../../webapp/src/components/dialog'
import SearchIcon from '../../../../webapp/src/widgets/icons/search'
import Button from '../../../../webapp/src/widgets/buttons/button'
import {getCurrentLinkToChannel, setLinkToChannel} from '../../../../webapp/src/store/boards'
import {WSClient} from '../../../../webapp/src/wsclient'
import {SuiteWindow} from '../../../../webapp/src/types/index'
import {getMessages} from '../i18n'
import {getLanguage} from '../store/language'

import {useWebsockets} from '../hooks/websockets'

import octoClient from '../octoClient'
import mutator from '../mutator'
import {getCurrentTeamId, getAllTeams, Team} from '../store/teams'
import {createBoard, Board} from '../blocks/board'
import {useAppSelector, useAppDispatch} from '../store/hooks'
import {EmptySearch, EmptyResults} from '../components/searchDialog/searchDialog'
import ConfirmationDialog from '../components/confirmationDialogBox'
import Dialog from '../components/dialog'
import SearchIcon from '../widgets/icons/search'
import Button from '../widgets/buttons/button'
import {getCurrentLinkToChannel, setLinkToChannel} from '../store/boards'
import {WSClient} from '../wsclient'
import {SuiteWindow} from '../types/index'

import BoardSelectorItem from './boardSelectorItem'

Expand Down
4 changes: 2 additions & 2 deletions webapp/src/components/boardSelectorItem.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {render, screen} from '@testing-library/react'

import userEvent from '@testing-library/user-event'

import {createBoard} from '../../../../webapp/src/blocks/board'
import {wrapIntl} from '../../../../webapp/src/testUtils'
import {createBoard} from '../blocks/board'
import {wrapIntl} from '../testUtils'

import BoardSelectorItem from './boardSelectorItem'

Expand Down
6 changes: 3 additions & 3 deletions webapp/src/components/boardSelectorItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import React from 'react'
import {useIntl, FormattedMessage} from 'react-intl'

import {Board} from '../../../../webapp/src/blocks/board'
import Button from '../../../../webapp/src/widgets/buttons/button'
import CompassIcon from '../../../../webapp/src/widgets/icons/compassIcon'
import {Board} from '../blocks/board'
import Button from '../widgets/buttons/button'
import CompassIcon from '../widgets/icons/compassIcon'

import './boardSelectorItem.scss'

Expand Down
4 changes: 2 additions & 2 deletions webapp/src/components/createBoardFromTemplate.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {render, screen, act} from '@testing-library/react'

import userEvent from '@testing-library/user-event'

import {mockStateStore} from '../../../../webapp/src/testUtils'
import {wrapIntl} from '../../../../webapp/src/testUtils'
import {mockStateStore} from '../testUtils'
import {wrapIntl} from '../testUtils'

import CreateBoardFromTemplate from './createBoardFromTemplate'

Expand Down
14 changes: 7 additions & 7 deletions webapp/src/components/createBoardFromTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import {SingleValue} from 'react-select'

import {CSSObject} from '@emotion/serialize'

import {getCurrentLanguage, getMessages} from '../../../../webapp/src/i18n'
import {getLanguage} from '../../../../webapp/src/store/language'
import CompassIcon from '../../../../webapp/src/widgets/icons/compassIcon'
import {useAppSelector} from '../../../../webapp/src/store/hooks'
import {mutator} from '../../../../webapp/src/mutator'
import {useGetAllTemplates} from '../../../../webapp/src/hooks/useGetAllTemplates'
import {getCurrentLanguage, getMessages} from '../i18n'
import {getLanguage} from '../store/language'
import CompassIcon from '../widgets/icons/compassIcon'
import {useAppSelector} from '../store/hooks'
import {mutator} from '../mutator'
import {useGetAllTemplates} from '../hooks/useGetAllTemplates'

import './createBoardFromTemplate.scss'
import {Board} from '../../../../webapp/src/blocks/board'
import {Board} from '../blocks/board'

type Props = {
setCanCreate: (canCreate: boolean) => void;
Expand Down
2 changes: 2 additions & 0 deletions webapp/src/components/flashMessages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,5 @@ export const FlashMessages = React.memo((props: Props) => {
</div>
)
})

FlashMessages.displayName = 'FlashMessages'
10 changes: 6 additions & 4 deletions webapp/src/components/iconSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import './iconSelector.scss'

type Props = {
readonly?: boolean
iconElement: any
onAddRandomIcon: any
onSelectEmoji: any
onRemoveIcon: any
iconElement: JSX.Element
onAddRandomIcon: () => Promise<void>
onSelectEmoji: (emoji: string) => void
onRemoveIcon: () => Promise<void>
}

const IconSelector = React.memo((props: Props) => {
Expand Down Expand Up @@ -55,4 +55,6 @@ const IconSelector = React.memo((props: Props) => {
)
})

IconSelector.displayName = 'IconSelector'

export default IconSelector
8 changes: 4 additions & 4 deletions webapp/src/components/rhsChannelBoardItem.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import {render, screen} from '@testing-library/react'

import userEvent from '@testing-library/user-event'

import {createBoard} from '../../../../webapp/src/blocks/board'
import {mockStateStore, wrapIntl} from '../../../../webapp/src/testUtils'
import {createBoard} from '../blocks/board'
import {mockStateStore, wrapIntl} from '../testUtils'

import {TestBlockFactory} from '../../../../webapp/src/test/testBlockFactory'
import {TestBlockFactory} from '../test/testBlockFactory'

import {Utils} from '../../../../webapp/src/utils'
import {Utils} from '../utils'

import RHSChannelBoardItem from './rhsChannelBoardItem'

Expand Down
30 changes: 15 additions & 15 deletions webapp/src/components/rhsChannelBoardItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
import React from 'react'
import {FormattedMessage, useIntl} from 'react-intl'

import mutator from '../../../../webapp/src/mutator'
import {Utils} from '../../../../webapp/src/utils'
import {getCurrentTeam} from '../../../../webapp/src/store/teams'
import {createBoard, Board} from '../../../../webapp/src/blocks/board'
import {useAppSelector} from '../../../../webapp/src/store/hooks'
import IconButton from '../../../../webapp/src/widgets/buttons/iconButton'
import OptionsIcon from '../../../../webapp/src/widgets/icons/options'
import Menu from '../../../../webapp/src/widgets/menu'
import MenuWrapper from '../../../../webapp/src/widgets/menuWrapper'
import {SuiteWindow} from '../../../../webapp/src/types/index'
import CompassIcon from '../../../../webapp/src/widgets/icons/compassIcon'
import mutator from '../mutator'
import {Utils} from '../utils'
import {getCurrentTeam} from '../store/teams'
import {createBoard, Board} from '../blocks/board'
import {useAppSelector} from '../store/hooks'
import IconButton from '../widgets/buttons/iconButton'
import OptionsIcon from '../widgets/icons/options'
import Menu from '../widgets/menu'
import MenuWrapper from '../widgets/menuWrapper'
import {SuiteWindow} from '../types/index'
import CompassIcon from '../widgets/icons/compassIcon'

import {Permission} from '../../../../webapp/src/constants'
import {Permission} from '../constants'

import BoardPermissionGate from '../../../../webapp/src/components/permissions/boardPermissionGate'
import TelemetryClient, {TelemetryActions, TelemetryCategory} from '../../../../webapp/src/telemetry/telemetryClient'
import BoardPermissionGate from '../components/permissions/boardPermissionGate'
import TelemetryClient, {TelemetryActions, TelemetryCategory} from '../telemetry/telemetryClient'

import './rhsChannelBoardItem.scss'

Expand Down Expand Up @@ -110,7 +110,7 @@ const RHSChannelBoardItem = (props: Props) => {
<FormattedMessage
id='rhs-boards.last-update-at'
defaultMessage='Last update at: {datetime}'
values={{datetime: Utils.displayDateTime(new Date(board.updateAt), intl as any)}}
values={{datetime: Utils.displayDateTime(new Date(board.updateAt), intl)}}
/>
</div>
</div>
Expand Down
10 changes: 5 additions & 5 deletions webapp/src/components/rhsChannelBoards.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import {act, render, screen} from '@testing-library/react'
import {mocked} from 'jest-mock'
import thunk from 'redux-thunk'

import octoClient from '../../../../webapp/src/octoClient'
import {BoardMember, createBoard} from '../../../../webapp/src/blocks/board'
import {mockStateStore, wrapIntl} from '../../../../webapp/src/testUtils'
import octoClient from '../octoClient'
import {BoardMember, createBoard} from '../blocks/board'
import {mockStateStore, wrapIntl} from '../testUtils'

import {Utils} from '../../../../webapp/src/utils'
import {Utils} from '../utils'

import RHSChannelBoards from './rhsChannelBoards'

jest.mock('../../../../webapp/src/octoClient')
jest.mock('../octoClient')
const mockedOctoClient = mocked(octoClient, true)

let mockDisplayDateTime: jest.SpyInstance
Expand Down
38 changes: 20 additions & 18 deletions webapp/src/components/rhsChannelBoards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,37 @@
import React, {useEffect} from 'react'
import {FormattedMessage, IntlProvider, useIntl} from 'react-intl'

import {getMessages} from '../../../../webapp/src/i18n'
import {getLanguage} from '../../../../webapp/src/store/language'
import {getLanguage} from '../store/language'

import {useWebsockets} from '../../../../webapp/src/hooks/websockets'
import {useWebsockets} from '../hooks/websockets'

import {Board, BoardMember} from '../../../../webapp/src/blocks/board'
import {getCurrentTeamId} from '../../../../webapp/src/store/teams'
import {IUser} from '../../../../webapp/src/user'
import {getMe, fetchMe} from '../../../../webapp/src/store/users'
import {loadBoards, loadMyBoardsMemberships} from '../../../../webapp/src/store/initialLoad'
import {getCurrentChannel} from '../../../../webapp/src/store/channels'
import {Board, BoardMember} from '../blocks/board'
import {getCurrentTeamId} from '../store/teams'
import {IUser} from '../user'
import {getMe, fetchMe} from '../store/users'
import {loadBoards, loadMyBoardsMemberships} from '../store/initialLoad'
import {getCurrentChannel} from '../store/channels'
import {
getMySortedBoards,
setLinkToChannel,
updateBoards,
updateMembersEnsuringBoardsAndUsers,
addMyBoardMemberships,
} from '../../../../webapp/src/store/boards'
import {useAppSelector, useAppDispatch} from '../../../../webapp/src/store/hooks'
import AddIcon from '../../../../webapp/src/widgets/icons/add'
import Button from '../../../../webapp/src/widgets/buttons/button'
} from '../store/boards'
import {useAppSelector, useAppDispatch} from '../store/hooks'
import AddIcon from '../widgets/icons/add'
import Button from '../widgets/buttons/button'

import {Utils} from '../../../../webapp/src/utils'
import {WSClient} from '../../../../webapp/src/wsclient'
import {Utils} from '../utils'
import {WSClient} from '../wsclient'

import boardsScreenshots from '../../../../webapp/static/boards-screenshots.png'
import boardsScreenshots from '../../static/boards-screenshots.png'

import {getMessages} from '../i18n'

import RHSChannelBoardItem from './rhsChannelBoardItem'


import './rhsChannelBoards.scss'

const RHSChannelBoards = () => {
Expand Down Expand Up @@ -117,7 +119,7 @@ const RHSChannelBoards = () => {
/>
</div>
<div className='boards-screenshots'><img src={Utils.buildURL(boardsScreenshots, true)}/></div>
{me?.permissions?.find((s) => s === 'create_post') &&
{me?.permissions?.find((s: string) => s === 'create_post') &&
<Button
onClick={() => dispatch(setLinkToChannel(currentChannel.id))}
emphasis='primary'
Expand Down Expand Up @@ -145,7 +147,7 @@ const RHSChannelBoards = () => {
defaultMessage='Linked boards'
/>
</span>
{me?.permissions?.find((s) => s === 'create_post') &&
{me?.permissions?.find((s: string) => s === 'create_post') &&
<Button
onClick={() => dispatch(setLinkToChannel(currentChannel.id))}
icon={<AddIcon/>}
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/rhsChannelBoardsHeader.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import React from 'react'
import {Provider as ReduxProvider} from 'react-redux'
import {render} from '@testing-library/react'

import {mockStateStore, wrapIntl} from '../../../../webapp/src/testUtils'
import {mockStateStore, wrapIntl} from '../testUtils'

import RHSChannelBoardsHeader from './rhsChannelBoardsHeader'

Expand Down
Loading

0 comments on commit a33c057

Please sign in to comment.