Skip to content

Commit

Permalink
fix build of orangelogic-extension
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaskikutis committed Jan 24, 2024
1 parent 23f4901 commit d016d8c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
8 changes: 5 additions & 3 deletions client/extensions/orangelogic-extension/src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import {ISuperdesk, IExtension} from 'superdesk-api';
import {ISuperdesk, IExtension, IExtensionActivationResult} from 'superdesk-api';
import {searchPanelWidgetFactory} from './search-panel-widget';

const extension: IExtension = {
activate: (superdesk: ISuperdesk) => {
return Promise.resolve({
const result: IExtensionActivationResult = {
contributions: {
searchPanelWidgets: [
searchPanelWidgetFactory(superdesk.localization.gettext),
],
}
});
};

return Promise.resolve(result);
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ interface IMediaTypeLabel {
label: string;
}

export const searchPanelWidgetFactory = (gettext: ISuperdesk['localization']['gettext']) => {
export const searchPanelWidgetFactory = (
gettext: ISuperdesk['localization']['gettext'],
): React.ComponentType<ISearchPanelWidgetProps<unknown>> => {
const mediaTypes: Array<IMediaTypeLabel> = [
{
type: 'Image',
Expand All @@ -28,8 +30,7 @@ export const searchPanelWidgetFactory = (gettext: ISuperdesk['localization']['ge
},
];

return class SearchPanelWidget extends React.PureComponent<ISearchPanelWidgetProps<IParams>> {

class SearchPanelWidget extends React.PureComponent<ISearchPanelWidgetProps<IParams>> {
toggleMediaType(type: IMediaType) {
const mediaTypes = this.props.params.mediaTypes || {};

Expand All @@ -43,7 +44,7 @@ export const searchPanelWidgetFactory = (gettext: ISuperdesk['localization']['ge

render() {
const {params} = this.props;

if (this.props.provider !== 'orangelogic') {
return null;
}
Expand Down Expand Up @@ -75,4 +76,7 @@ export const searchPanelWidgetFactory = (gettext: ISuperdesk['localization']['ge
);
}
};

// casting is required because of limitations on use of generics in superdesk-api
return SearchPanelWidget as React.ComponentType<ISearchPanelWidgetProps<unknown>>;
};

0 comments on commit d016d8c

Please sign in to comment.