Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,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
Expand Down
Binary file added public/app-bar-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions webapp/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import {Store, Action} from 'redux';

import {GlobalState} from 'mattermost-redux/types/store';
import {getConfig} from 'mattermost-redux/selectors/entities/general';

import manifest from './manifest';

Expand All @@ -22,6 +23,18 @@ export default class Plugin {
'Chess',
'Start a chess game.',
);

if (registry.registerAppBarComponent) {
const siteUrl = getConfig(store.getState())?.SiteURL || '';
const iconURL = `${siteUrl}/plugins/${manifest.id}/public/app-bar-icon.png`;
registry.registerAppBarComponent(
iconURL,
() => {
store.dispatch(challenge() as any);
},
'Start a chess game.',
);
}
}
}

Expand Down
1 change: 1 addition & 0 deletions webapp/src/types/mattermost-webapp/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface PluginRegistry {
registerReducer(reducer: Reducer);
registerChannelHeaderButtonAction(icon: React.ReactNode, action: (channel: Channel, channelMembership: ChannelMembership) => void, dropdownText: string, tooltip: string);
registerMainMenuAction(text: React.ReactNode, action: () => void, mobileIcon: React.ReactNode);
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
}
Expand Down