// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import manifest from 'manifest'; import React from 'react'; import type {Store, Action} from 'redux'; import type {GlobalState} from '@mattermost/types/store'; import RHSPanel from 'components/rhs_panel'; import type {PluginRegistry} from 'types/mattermost-webapp'; export default class Plugin { public async initialize(registry: PluginRegistry, store: Store) { const {toggleRHSPlugin} = registry.registerRightHandSidebarComponent(RHSPanel, 'Shelfmark'); const iconURL = `/plugins/${manifest.id}/public/icon.png`; const icon = React.createElement('img', {src: iconURL, width: 16, height: 16}); registry.registerChannelHeaderButtonAction( icon, () => store.dispatch(toggleRHSPlugin as Action), 'Shelfmark', 'Toggle Shelfmark panel', ); } } declare global { interface Window { registerPlugin(pluginId: string, plugin: Plugin): void; } } window.registerPlugin(manifest.id, new Plugin());