Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help Center: Update Was This Helpful section #98577

Merged
merged 7 commits into from
Jan 21, 2025
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import ChatWithSupportLabel from '../chat-with-support';
import CustomALink from './custom-a-link';
import DislikeFeedbackMessage from './dislike-feedback-message';
import ErrorMessage from './error-message';
import Sources from './sources';
import { uriTransformer } from './uri-transformer';
import { UserMessage } from './user-message';
import type { ZendeskMessage, Message } from '../../types';
Expand Down Expand Up @@ -100,7 +99,6 @@ export const MessageContent = ( {
) }
{ message.type === 'dislike-feedback' && <DislikeFeedbackMessage /> }
</div>
{ ! isMessageWithOnlyText && <Sources message={ message } /> }
</div>
{ displayChatWithSupportLabel && <ChatWithSupportLabel /> }
</>
Expand Down
3 changes: 2 additions & 1 deletion packages/odie-client/src/components/message/sources.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const Sources = ( { message }: { message: Message } ) => {
];
}
return [];
}, [ message?.context?.sources, trackEvent ] );
}, [ message.context?.sources, message?.message_id, trackEvent ] );
agrullon95 marked this conversation as resolved.
Show resolved Hide resolved

const hasSources = message?.context?.sources && message.context?.sources.length > 0;
if ( ! hasSources ) {
Expand All @@ -61,6 +61,7 @@ export const Sources = ( { message }: { message: Message } ) => {
} )
}
screenReaderText="More"
iconSize={ 16 }
>
<div className="odie-chatbox-message-sources">
{ sources.length > 0 &&
Expand Down
100 changes: 94 additions & 6 deletions packages/odie-client/src/components/message/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,102 @@ $blueberry-color: #3858e9;

.chat-feedback-wrapper {
width: 100%;
margin-left: 46px;
margin-right: 44px;

.card.odie-foldable-card.odie-sources-foldable-card {
margin-top: 4px;
border-radius: 4px;

&.is-expanded {
.odie-foldable-card__content {
border-top: none;
}
}

.odie-foldable-card__header{
font-size: 0.75rem;
agrullon95 marked this conversation as resolved.
Show resolved Hide resolved
min-height: 48px;
padding: 12px 16px;

.odie-foldable-card__expand {
&:focus {
outline: none;
}
.gridicon {
fill: #1E1E1E;
agrullon95 marked this conversation as resolved.
Show resolved Hide resolved
}
}
}

.odie-chatbox-message-sources {
margin: 0 12px 12px 12px;
.odie-support-doc-link__link {
.icon-background {
padding: 4px;
svg {
fill: $blueberry-color;
}
}
a {
color: $blueberry-color;
& span {
font-size: 0.75rem;
}
> svg:last-child {
display: none;
}
}
}
}

}

.disclaimer {
color: #000;
agrullon95 marked this conversation as resolved.
Show resolved Hide resolved
font-size: $font-body-extra-small;
text-align: start;
margin: 16px 0;

.odie-button-link, .components-external-link {
color: $blueberry-color;
}

.components-external-link {
text-decoration: underline;

&:hover {
text-decoration: none;
}

& > span:first-child::after {
content: "\00a0";

&:hover {
text-decoration: none;
}
}

.components-external-link__contents:hover {
text-decoration: none;
}

.components-external-link__icon {
margin-left: 0;
}
}

}
}

.disclaimer {
color: var( --studio-gray-80 );
font-size: $font-body-extra-small;
text-align: start;
margin: 16px 0;
.odie-feedback-component-container {
&.odie-question-collapse {
margin-top: 0;
}
margin-top: 32px;
font-size: 1rem;
}

}

.odie-button-link {
Expand Down Expand Up @@ -619,7 +707,7 @@ $custom-border-corner-size: 16px;
}

.odie-chatbox-message-sources-container {
padding-bottom: 16px;
padding-bottom: 28px;

.foldable-card {
margin: 0 !important;
Expand Down
12 changes: 6 additions & 6 deletions packages/odie-client/src/components/message/user-message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useOdieAssistantContext } from '../../context';
import CustomALink from './custom-a-link';
import { DirectEscalationLink } from './direct-escalation-link';
import { GetSupport } from './get-support';
import Sources from './sources';
import { uriTransformer } from './uri-transformer';
import WasThisHelpfulButtons from './was-this-helpful-buttons';
import type { Message } from '../../types';
Expand Down Expand Up @@ -64,12 +65,6 @@ export const UserMessage = ( {

const renderDisclaimers = () => (
<>
{ ! isConnectedToZendesk && (
<WasThisHelpfulButtons message={ message } isDisliked={ isDisliked } />
) }

{ ! showExtraContactOptions && <DirectEscalationLink messageId={ message.message_id } /> }

<div className="disclaimer">
{ createInterpolateElement(
__(
Expand All @@ -87,6 +82,10 @@ export const UserMessage = ( {
}
) }
</div>
{ ! showExtraContactOptions && <DirectEscalationLink messageId={ message.message_id } /> }
{ ! isConnectedToZendesk && (
<WasThisHelpfulButtons message={ message } isDisliked={ isDisliked } />
) }
</>
);

Expand All @@ -106,6 +105,7 @@ export const UserMessage = ( {
</div>
{ ! isMessageWithoutEscalationOption && isBot && (
<div className="chat-feedback-wrapper">
<Sources message={ message } />
{ showExtraContactOptions && renderExtraContactOptions() }
{ isMessageShowingDisclaimer && renderDisclaimers() }
</div>
Expand Down
Loading