9509c737e0
Follow-up to #23199. The AI-chat onboarding is an instance-level rollout decision, not a per-workspace experiment, so `IS_ONBOARDING_AI_CHAT_ENABLED` becomes an instance config variable (default `false`, editable from the admin panel) exposed to the frontend through `ClientConfig`. The workspace feature flag is deleted; leftover `featureFlag` rows are inert since the column is plain text. `IS_WORKSPACE_COMPANY_ENRICHMENT_ENABLED` is removed as redundant: the PDL client already skips everything when no API key is set. Enrichment now runs when the AI chat is on and `PEOPLE_DATA_LABS_API_KEY` is configured. <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/twentyhq/twenty/pull/23439?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
50 lines
1.7 KiB
TypeScript
50 lines
1.7 KiB
TypeScript
import { useLingui } from '@lingui/react/macro';
|
|
import { useLocation, useNavigate } from 'react-router-dom';
|
|
import { AppPath, SidePanelPages } from 'twenty-shared/types';
|
|
import { IconLayoutSidebarRightExpand } from 'twenty-ui/icon';
|
|
import { IconButton } from 'twenty-ui/input';
|
|
import { useIsMobile } from 'twenty-ui/utilities';
|
|
|
|
import { aiChatExpandedReturnLocationState } from '@/ai/states/aiChatExpandedReturnLocationState';
|
|
import { isOnboardingAiChatEnabledState } from '@/client-config/states/isOnboardingAiChatEnabledState';
|
|
import { sidePanelPageState } from '@/side-panel/states/sidePanelPageState';
|
|
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
|
import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';
|
|
|
|
export const SidePanelExpandAiChatButton = () => {
|
|
const { t } = useLingui();
|
|
const navigate = useNavigate();
|
|
const location = useLocation();
|
|
const isMobile = useIsMobile();
|
|
const sidePanelPage = useAtomStateValue(sidePanelPageState);
|
|
const isOnboardingAiChatEnabled = useAtomStateValue(
|
|
isOnboardingAiChatEnabledState,
|
|
);
|
|
const setAiChatExpandedReturnLocation = useSetAtomState(
|
|
aiChatExpandedReturnLocationState,
|
|
);
|
|
|
|
const isOnAskAiPage = sidePanelPage === SidePanelPages.AskAI;
|
|
|
|
if (!isOnboardingAiChatEnabled || isMobile || !isOnAskAiPage) {
|
|
return null;
|
|
}
|
|
|
|
const handleClick = () => {
|
|
setAiChatExpandedReturnLocation(
|
|
`${location.pathname}${location.search}${location.hash}`,
|
|
);
|
|
navigate(AppPath.WorkspaceSetup);
|
|
};
|
|
|
|
return (
|
|
<IconButton
|
|
Icon={IconLayoutSidebarRightExpand}
|
|
size="small"
|
|
variant="tertiary"
|
|
onClick={handleClick}
|
|
ariaLabel={t`Expand chat`}
|
|
/>
|
|
);
|
|
};
|