• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

alkem-io / client-web / #5508

18 Aug 2023 12:07PM UTC coverage: 5.597%. First build
#5508

Pull #4567

travis-ci

Pull Request #4567: Moving all code to src/[core|domain|main]

154 of 7687 branches covered (2.0%)

Branch coverage included in aggregate %.

1125 of 1125 new or added lines in 33 files covered. (100.0%)

1050 of 13826 relevant lines covered (7.59%)

0.46 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/ui/helpButton/PlatformHelpButton.tsx
1
import { useState, Suspense } from 'react';
2
import HelpIcon from '@mui/icons-material/Help';
3
import HelpDialog from '@/core/help/dialog/HelpDialog';
4
import { IconButton } from '@mui/material';
5
import { useConfig } from '@/domain/platform/config/useConfig';
6
import { useCurrentUserContext } from '@/domain/community/userCurrent/useCurrentUserContext';
×
7
import { AuthorizationPrivilege, PlatformFeatureFlagName } from '@/core/apollo/generated/graphql-schema';
×
8
import { useFullscreen } from '@/core/ui/fullscreen/useFullscreen';
9
import { useTranslation } from 'react-i18next';
×
10
import { lazyWithGlobalErrorHandler } from '@/core/lazyLoading/lazyWithGlobalErrorHandler';
×
11

12
const ChatWidget = lazyWithGlobalErrorHandler(() => import('@/main/guidance/chatWidget/ChatWidget'));
13

×
14
const PlatformHelpButton = () => {
15
  const { t } = useTranslation();
16
  const [dialogOpen, setDialogOpen] = useState(false);
17
  const openHelpDialog = () => {
18
    setDialogOpen(true);
×
19
  };
20

21
  const { fullscreen } = useFullscreen();
22
  const { isFeatureEnabled } = useConfig();
23
  const isGuidanceEnabled = isFeatureEnabled(PlatformFeatureFlagName.GuidenceEngine);
24
  const { platformPrivilegeWrapper: userWrapper } = useCurrentUserContext();
25
  const shouldDisplayChatWidget =
26
    !fullscreen && // Never show the widget when there's something in fullscreen
27
    userWrapper?.hasPlatformPrivilege(AuthorizationPrivilege.AccessInteractiveGuidance) &&
28
    isGuidanceEnabled;
29

30
  return (
31
    <>
32
      {shouldDisplayChatWidget ? (
33
        <Suspense fallback={null}>
34
          <ChatWidget />
35
        </Suspense>
36
      ) : (
37
        <IconButton onClick={openHelpDialog} aria-label={t('common.help')}>
38
          <HelpIcon color="primary" fontSize="large" sx={{ filter: 'drop-shadow(0px 4px 4px rgba(0, 0, 0, 0.25));' }} />
39
        </IconButton>
40
      )}
41
      <HelpDialog open={dialogOpen} onClose={() => setDialogOpen(false)} />
42
    </>
43
  );
44
};
45

46
export default PlatformHelpButton;
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc