implement registry for channel intro button (#2181)
This commit is contained in:
parent
a07a48a9ae
commit
7e0fb26875
3 changed files with 13 additions and 0 deletions
|
@ -20,6 +20,7 @@ import store from '../../../webapp/src/store'
|
|||
import GlobalHeader from '../../../webapp/src/components/globalHeader/globalHeader'
|
||||
import FocalboardIcon from '../../../webapp/src/widgets/icons/logo'
|
||||
import {setMattermostTheme} from '../../../webapp/src/theme'
|
||||
import {UserSettings} from '../../../webapp/src/userSettings'
|
||||
|
||||
import TelemetryClient, {TelemetryCategory, TelemetryActions} from '../../../webapp/src/telemetry/telemetryClient'
|
||||
|
||||
|
@ -139,6 +140,16 @@ export default class Plugin {
|
|||
window.open(`${windowAny.frontendBaseURL}/workspace/${currentChannel}`, '_blank', 'noopener')
|
||||
}
|
||||
this.channelHeaderButtonId = registry.registerChannelHeaderButtonAction(<FocalboardIcon/>, goToFocalboardWorkspace, 'Boards', 'Boards')
|
||||
|
||||
const goToFocalboardTemplate = () => {
|
||||
const currentChannel = mmStore.getState().entities.channels.currentChannelId
|
||||
TelemetryClient.trackEvent(TelemetryCategory, TelemetryActions.ClickChannelIntro, {workspaceID: currentChannel})
|
||||
UserSettings.lastBoardId = null
|
||||
UserSettings.lastViewId = null
|
||||
window.open(`${windowAny.frontendBaseURL}/workspace/${currentChannel}`, '_blank', 'noopener')
|
||||
}
|
||||
this.channelHeaderButtonId = registry.registerChannelIntroButtonAction(<FocalboardIcon/>, goToFocalboardTemplate, 'Boards')
|
||||
|
||||
this.registry.registerProduct('/boards', 'product-boards', 'Boards', '/boards/welcome', MainApp, HeaderComponent)
|
||||
this.registry.registerPostWillRenderEmbedComponent((embed) => embed.type === 'boards', BoardsUnfurl, false)
|
||||
} else {
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
export interface PluginRegistry {
|
||||
registerPostTypeComponent(typeName: string, component: React.ElementType)
|
||||
registerChannelHeaderButtonAction(icon: React.Element, action: () => void, dropdownText: string, tooltipText: string)
|
||||
registerChannelIntroButtonAction(icon: React.Element, action: () => void, tooltipText: string)
|
||||
registerCustomRoute(route: string, component: React.ElementType)
|
||||
registerProductRoute(route: string, component: React.ElementType)
|
||||
unregisterComponent(componentId: string)
|
||||
|
|
|
@ -8,6 +8,7 @@ export const TelemetryCategory = 'boards'
|
|||
|
||||
export const TelemetryActions = {
|
||||
ClickChannelHeader: 'clickChannelHeader',
|
||||
ClickChannelIntro: 'channelIntro_boardLink',
|
||||
ViewBoard: 'viewBoard',
|
||||
CreateBoard: 'createBoard',
|
||||
DuplicateBoard: 'duplicateBoard',
|
||||
|
|
Loading…
Reference in a new issue