mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-10-18 07:11:32 +08:00

* feat: added facing issues and requestIntegration section in integration pages * feat: changed text in integration facing issue button * feat: fixed facing-issue tooltip styles * feat: code cleanup * feat: added margin bottom to request more component
68 lines
1.7 KiB
TypeScript
68 lines
1.7 KiB
TypeScript
import './FacingIssueBtn.style.scss';
|
|
|
|
import { Button, Tooltip } from 'antd';
|
|
import logEvent from 'api/common/logEvent';
|
|
import cx from 'classnames';
|
|
import { FeatureKeys } from 'constants/features';
|
|
import useFeatureFlags from 'hooks/useFeatureFlag';
|
|
import { defaultTo } from 'lodash-es';
|
|
import { HelpCircle } from 'lucide-react';
|
|
import { isCloudUser } from 'utils/app';
|
|
|
|
export interface FacingIssueBtnProps {
|
|
eventName: string;
|
|
attributes: Record<string, unknown>;
|
|
message?: string;
|
|
buttonText?: string;
|
|
className?: string;
|
|
onHoverText?: string;
|
|
}
|
|
|
|
function FacingIssueBtn({
|
|
attributes,
|
|
eventName,
|
|
message = '',
|
|
buttonText = '',
|
|
className = '',
|
|
onHoverText = '',
|
|
}: FacingIssueBtnProps): JSX.Element | null {
|
|
const handleFacingIssuesClick = (): void => {
|
|
logEvent(eventName, attributes);
|
|
|
|
if (window.Intercom) {
|
|
window.Intercom('showNewMessage', defaultTo(message, ''));
|
|
}
|
|
};
|
|
|
|
const isChatSupportEnabled = useFeatureFlags(FeatureKeys.CHAT_SUPPORT)?.active;
|
|
const isCloudUserVal = isCloudUser();
|
|
|
|
return isCloudUserVal && isChatSupportEnabled ? ( // Note: we would need to move this condition to license based in future
|
|
<div className="facing-issue-button">
|
|
<Tooltip
|
|
title={onHoverText}
|
|
autoAdjustOverflow
|
|
style={{ padding: 8 }}
|
|
overlayClassName="tooltip-overlay"
|
|
>
|
|
<Button
|
|
className={cx('periscope-btn', 'facing-issue-button', className)}
|
|
onClick={handleFacingIssuesClick}
|
|
icon={<HelpCircle size={14} />}
|
|
>
|
|
{buttonText || 'Facing issues?'}
|
|
</Button>
|
|
</Tooltip>
|
|
</div>
|
|
) : null;
|
|
}
|
|
|
|
FacingIssueBtn.defaultProps = {
|
|
message: '',
|
|
buttonText: '',
|
|
className: '',
|
|
onHoverText: '',
|
|
};
|
|
|
|
export default FacingIssueBtn;
|