diff --git a/mattermost-plugin/Makefile b/mattermost-plugin/Makefile index a25ccdb19..2e274e7e9 100644 --- a/mattermost-plugin/Makefile +++ b/mattermost-plugin/Makefile @@ -131,7 +131,7 @@ ifneq ($(wildcard $(ASSETS_DIR)/.),) cp -r $(ASSETS_DIR) dist/$(PLUGIN_ID)/ endif ifneq ($(HAS_PUBLIC),) - cp -r public dist/$(PLUGIN_ID)/ + cp -r public dist/$(PLUGIN_ID)/public/ endif ifneq ($(HAS_SERVER),) mkdir -p dist/$(PLUGIN_ID)/server diff --git a/mattermost-plugin/public/app-bar-icon.png b/mattermost-plugin/public/app-bar-icon.png new file mode 100644 index 000000000..0441cbbc9 Binary files /dev/null and b/mattermost-plugin/public/app-bar-icon.png differ diff --git a/mattermost-plugin/webapp/src/index.tsx b/mattermost-plugin/webapp/src/index.tsx index 2a0550e9e..dfe89cfba 100644 --- a/mattermost-plugin/webapp/src/index.tsx +++ b/mattermost-plugin/webapp/src/index.tsx @@ -195,6 +195,12 @@ export default class Plugin { } this.registry.registerProduct('/boards', 'product-boards', 'Boards', '/boards/welcome', MainApp, HeaderComponent) + + if (this.registry.registerAppBarComponent) { + const appBarIconURL = windowAny.baseURL + '/public/app-bar-icon.png' + this.registry.registerAppBarComponent(appBarIconURL, goToFocalboardWorkspace, 'Open Boards Workspace') + } + this.registry.registerPostWillRenderEmbedComponent((embed) => embed.type === 'boards', BoardsUnfurl, false) } else { windowAny.frontendBaseURL = subpath + '/plug/focalboard' diff --git a/mattermost-plugin/webapp/src/types/mattermost-webapp/index.d.ts b/mattermost-plugin/webapp/src/types/mattermost-webapp/index.d.ts index 1c69d7f8f..9e64bb4b2 100644 --- a/mattermost-plugin/webapp/src/types/mattermost-webapp/index.d.ts +++ b/mattermost-plugin/webapp/src/types/mattermost-webapp/index.d.ts @@ -1,5 +1,8 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. + +import {Channel, ChannelMembership} from 'mattermost-redux/types/channels'; + export interface PluginRegistry { registerPostTypeComponent(typeName: string, component: React.ElementType) registerChannelHeaderButtonAction(icon: React.Element, action: () => void, dropdownText: string, tooltipText: string) @@ -11,6 +14,7 @@ export interface PluginRegistry { registerPostWillRenderEmbedComponent(match: (embed: {type: string, data: any}) => void, component: any, toggleable: boolean) registerWebSocketEventHandler(event: string, handler: (e: any) => void) unregisterWebSocketEventHandler(event: string) + registerAppBarComponent(iconURL: string, action: (channel: Channel, member: ChannelMembership) => void, tooltipText: React.ReactNode) // Add more if needed from https://developers.mattermost.com/extend/plugins/webapp/reference }