Skip to content

Commit

Permalink
fix(chat): hide 'Go to my workspace' link if Marketplace feature is d…
Browse files Browse the repository at this point in the history
…isabled (Issue #2780, #2759) (#2823)
  • Loading branch information
IlyaBondar authored Dec 16, 2024
1 parent 3b8d44d commit 16868e4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
2 changes: 1 addition & 1 deletion apps/chat/src/components/Chat/ModelVersionSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const ModelVersionSelect = ({
</span>
<ChevronDownIcon
className={classNames(
'shrink-0 text-primary transition-all',
'ml-1 shrink-0 text-primary transition-all',
isOpen && 'rotate-180',
)}
width={18}
Expand Down
38 changes: 22 additions & 16 deletions apps/chat/src/components/Chat/TalkTo/TalkToModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { ApplicationActions } from '@/src/store/application/application.reducers
import { ConversationsActions } from '@/src/store/conversations/conversations.reducers';
import { useAppSelector } from '@/src/store/hooks';
import { ModelsSelectors } from '@/src/store/models/models.reducers';
import { SettingsSelectors } from '@/src/store/settings/settings.reducers';

import { REPLAY_AS_IS_MODEL } from '@/src/constants/chat';
import { MarketplaceQueryParams } from '@/src/constants/marketplace';
Expand All @@ -47,7 +48,7 @@ import { NoResultsFound } from '@/src/components/Common/NoResultsFound';

import { TalkToCard } from './TalkToCard';

import { PublishActions, ShareEntity } from '@epam/ai-dial-shared';
import { Feature, PublishActions, ShareEntity } from '@epam/ai-dial-shared';
import chunk from 'lodash-es/chunk';
import orderBy from 'lodash-es/orderBy';
import range from 'lodash-es/range';
Expand Down Expand Up @@ -206,6 +207,9 @@ const TalkToModalView = ({
const isPlayback = conversation.playback?.isPlayback;
const isReplay = conversation.replay?.isReplay;
const config = getMaxChunksCountConfig();
const isMarketplaceEnabled = useAppSelector((state) =>
SettingsSelectors.isFeatureEnabled(state, Feature.Marketplace),
);

const displayedModels = useMemo(() => {
const currentModel = modelsMap[conversation.model.id];
Expand Down Expand Up @@ -577,21 +581,23 @@ const TalkToModalView = ({
</>
)}
</div>
<button
onClick={() =>
router.push(
`/marketplace?${MarketplaceQueryParams.fromConversation}=${ApiUtils.encodeApiUrl(conversation.id)}`,
)
}
className={classNames(
'mt-4 text-accent-primary md:mt-0',
conversation.playback?.isPlayback && 'cursor-not-allowed',
)}
data-qa="go-to-my-workspace"
disabled={conversation.playback?.isPlayback}
>
{t('Go to My workspace')}
</button>
{isMarketplaceEnabled && (
<button
onClick={() =>
router.push(
`/marketplace?${MarketplaceQueryParams.fromConversation}=${ApiUtils.encodeApiUrl(conversation.id)}`,
)
}
className={classNames(
'mt-4 text-accent-primary md:mt-0',
conversation.playback?.isPlayback && 'cursor-not-allowed',
)}
data-qa="go-to-my-workspace"
disabled={conversation.playback?.isPlayback}
>
{t('Go to My workspace')}
</button>
)}
</div>
</div>

Expand Down

0 comments on commit 16868e4

Please sign in to comment.