+const mapStateToProps = (state: RootState): NotificationsMenuProps => ({
+ isOpen: state.banner.isOpen,
+ bannerUUID: state.auth.config.clusterConfig.Workbench.BannerUUID,
+});
+
+const mapDispatchToProps = (dispatch: Dispatch) => ({
+ openBanner: () => dispatch<any>(bannerActions.openBanner()),
+});
+
+type NotificationsMenuProps = {
+ isOpen: boolean;
+ bannerUUID?: string;
+};
+
+type NotificationsMenuComponentProps = NotificationsMenuProps & {
+ openBanner: any;
+};
+
+export const NotificationsMenuComponent = (props: NotificationsMenuComponentProps) => {
+ const { isOpen, openBanner } = props;
+ const bannerResult = localStorage.getItem(BANNER_LOCAL_STORAGE_KEY);
+ const tooltipResult = localStorage.getItem(TOOLTIP_LOCAL_STORAGE_KEY);
+ const menuItems: any[] = [];
+
+ if (!isOpen && bannerResult) {
+ menuItems.push(
+ <MenuItem onClick={openBanner}>
+ <span>Restore Banner</span>
+ </MenuItem>
+ );
+ }
+
+ const toggleTooltips = useCallback(() => {
+ if (tooltipResult) {
+ localStorage.removeItem(TOOLTIP_LOCAL_STORAGE_KEY);
+ } else {
+ localStorage.setItem(TOOLTIP_LOCAL_STORAGE_KEY, "true");
+ }
+ window.location.reload();
+ }, [tooltipResult]);
+
+ if (tooltipResult) {
+ menuItems.push(
+ <MenuItem onClick={toggleTooltips}>
+ <span>Enable tooltips</span>
+ </MenuItem>
+ );
+ } else {
+ menuItems.push(
+ <MenuItem onClick={toggleTooltips}>
+ <span>Disable tooltips</span>
+ </MenuItem>
+ );
+ }
+
+ if (menuItems.length === 0) {
+ menuItems.push(<MenuItem>You are up to date</MenuItem>);
+ }
+
+ return (