Skip to content

Commit

Permalink
fix(chat): fix review chat crash, hide unpublish option, adjust marke…
Browse files Browse the repository at this point in the history
…tplace grid (Issue #3029, #3016, #3014) (#3038)

Co-authored-by: Magomed-Elbi Dzhukalaev <[email protected]>
  • Loading branch information
Gimir and Magomed-Elbi Dzhukalaev authored Jan 28, 2025
1 parent 5b870fa commit 1cb8b67
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
6 changes: 3 additions & 3 deletions apps/chat/src/components/Chat/ChatCompareSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const ChatCompareSelect = ({
const isConversationVersionValid = (
conv: ConversationInfo,
publicVersionGroups: PublicVersionGroups,
selectedConversation: Conversation,
selectedConversationId: string,
) => {
if (!conv.publicationInfo?.version) {
return true;
Expand All @@ -95,7 +95,7 @@ export const ChatCompareSelect = ({
currentVersionGroup &&
conv.publicationInfo?.version !==
currentVersionGroup.selectedVersion.version &&
(currentVersionGroup.selectedVersion.id !== selectedConversation.id ||
(currentVersionGroup.selectedVersion.id !== selectedConversationId ||
currentVersionGroup.allVersions.find(
(ver) => ver.id !== currentVersionGroup.selectedVersion.id,
)?.id !== conv.id)
Expand All @@ -114,7 +114,7 @@ export const ChatCompareSelect = ({
isConversationVersionValid(
conv,
publicVersionGroups,
selectedConversation,
selectedConversation?.id,
),
),
[
Expand Down
14 changes: 11 additions & 3 deletions apps/chat/src/components/Chat/ConversationContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
} from '@/src/store/conversations/conversations.reducers';
import { useAppDispatch, useAppSelector } from '@/src/store/hooks';
import { ImportExportActions } from '@/src/store/import-export/importExport.reducers';
import { PublicationSelectors } from '@/src/store/publication/publication.reducers';
import { SettingsSelectors } from '@/src/store/settings/settings.reducers';
import { ShareActions } from '@/src/store/share/share.reducers';
import { UIActions, UISelectors } from '@/src/store/ui/ui.reducers';
Expand Down Expand Up @@ -92,6 +93,12 @@ export const ConversationContextMenu = ({
const allConversations = useAppSelector(
ConversationsSelectors.selectConversations,
);
const resourceToReview = useAppSelector((state) =>
PublicationSelectors.selectResourceToReviewByReviewUrl(
state,
conversation.id,
),
);
const isPublishingEnabled = useAppSelector((state) =>
SettingsSelectors.selectIsPublishingEnabled(state, FeatureType.Chat),
);
Expand Down Expand Up @@ -133,6 +140,9 @@ export const ConversationContextMenu = ({
(conversation as Conversation).messages?.length > 0
);

const isUnpublishVisible =
!(isHeaderMenu && resourceToReview) && !isReplay && !publicationUrl;

const dismiss = useDismiss(context);
const { getFloatingProps } = useInteractions([dismiss]);

Expand Down Expand Up @@ -372,9 +382,7 @@ export const ConversationContextMenu = ({
onShare={!isReplay ? handleOpenSharing : undefined}
onUnshare={!isReplay ? handleUnshare : undefined}
onPublish={!isReplay ? handleOpenPublishing : undefined}
onUnpublish={
isReplay || publicationUrl ? undefined : handleOpenUnpublishing
}
onUnpublish={isUnpublishVisible ? handleOpenUnpublishing : undefined}
onOpenChange={setIsOpen}
isOpen={isOpen}
isLoading={conversation.status !== UploadStatus.LOADED}
Expand Down
2 changes: 1 addition & 1 deletion apps/chat/src/components/Marketplace/CardsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const CardsList = ({
{!!title && <h2 className="text-xl font-semibold">{t(title)}</h2>}

<div
className="grid grid-cols-1 gap-3 sm:grid-cols-2 md:gap-4 xl:grid-cols-3 xl:gap-5 3xl:grid-cols-4 4xl:grid-cols-5 5xl:grid-cols-6"
className="grid grid-cols-1 gap-3 md:grid-cols-2 md:gap-4 xl:grid-cols-3 xl:gap-5 3xl:grid-cols-4 4xl:grid-cols-5 5xl:grid-cols-6"
data-qa="agents"
>
{entities.map((entity) => (
Expand Down

0 comments on commit 1cb8b67

Please sign in to comment.