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

fix(Omnichannel): Use Correct components on ChatInfo #32592

Merged
merged 6 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/nervous-rockets-impress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixes Missing line breaks on Omnichannel Room Info Panel
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ import { useEndpoint, useTranslation } from '@rocket.chat/ui-contexts';
import { useQuery } from '@tanstack/react-query';
import React from 'react';

import InfoPanel from '../../../components/InfoPanel';
import { FormSkeleton } from '../directory/components/FormSkeleton';
import Field from './Field';
import Info from './Info';
import Label from './Label';

type CustomFieldProps = {
id: string;
Expand All @@ -33,10 +31,10 @@ const CustomField = ({ id, value }: CustomFieldProps) => {
}

return (
<Field>
<Label>{label}</Label>
<Info>{value}</Info>
</Field>
<InfoPanel.Field>
<InfoPanel.Label>{label}</InfoPanel.Label>
<InfoPanel.Text>{value}</InfoPanel.Text>
</InfoPanel.Field>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ import moment from 'moment';
import React, { useEffect, useMemo, useState } from 'react';

import { ContextualbarScrollableContent, ContextualbarFooter } from '../../../../../components/Contextualbar';
import InfoPanel from '../../../../../components/InfoPanel';
import MarkdownText from '../../../../../components/MarkdownText';
import { useEndpointData } from '../../../../../hooks/useEndpointData';
import { useFormatDateAndTime } from '../../../../../hooks/useFormatDateAndTime';
import { useFormatDuration } from '../../../../../hooks/useFormatDuration';
import CustomField from '../../../components/CustomField';
import Field from '../../../components/Field';
import Info from '../../../components/Info';
import Label from '../../../components/Label';
import { AgentField, SlaField, ContactField, SourceField } from '../../components';
import PriorityField from '../../components/PriorityField';
import { useOmnichannelRoomInfo } from '../../hooks/useOmnichannelRoomInfo';
Expand Down Expand Up @@ -105,66 +104,68 @@ function ChatInfo({ id, route }) {
{servedBy && <AgentField agent={servedBy} />}
{departmentId && <DepartmentField departmentId={departmentId} />}
{tags && tags.length > 0 && (
<Field>
<Label>{t('Tags')}</Label>
<Info>
<InfoPanel.Field>
<InfoPanel.Label>{t('Tags')}</InfoPanel.Label>
<InfoPanel.Text>
{tags.map((tag) => (
<Box key={tag} mie={4} display='inline'>
<Tag style={{ display: 'inline' }} disabled>
{tag}
</Tag>
</Box>
))}
</Info>
</Field>
</InfoPanel.Text>
</InfoPanel.Field>
)}
{topic && (
<Field>
<Label>{t('Topic')}</Label>
<Info>{topic}</Info>
</Field>
<InfoPanel.Field>
<InfoPanel.Label>{t('Topic')}</InfoPanel.Label>
<InfoPanel.Text withTruncatedText={false}>
<MarkdownText variant='inline' content={topic} />
</InfoPanel.Text>
</InfoPanel.Field>
)}
{queueStartedAt && (
<Field>
<Label>{t('Queue_Time')}</Label>
<Info>{queueTime}</Info>
</Field>
<InfoPanel.Field>
<InfoPanel.Label>{t('Queue_Time')}</InfoPanel.Label>
<InfoPanel.Text>{queueTime}</InfoPanel.Text>
</InfoPanel.Field>
)}
{closedAt && (
<Field>
<Label>{t('Chat_Duration')}</Label>
<Info>{moment(closedAt).from(moment(ts), true)}</Info>
</Field>
<InfoPanel.Field>
<InfoPanel.Label>{t('Chat_Duration')}</InfoPanel.Label>
<InfoPanel.Text>{moment(closedAt).from(moment(ts), true)}</InfoPanel.Text>
</InfoPanel.Field>
)}
{ts && (
<Field>
<Label>{t('Created_at')}</Label>
<Info>{formatDateAndTime(ts)}</Info>
</Field>
<InfoPanel.Field>
<InfoPanel.Label>{t('Created_at')}</InfoPanel.Label>
<InfoPanel.Text>{formatDateAndTime(ts)}</InfoPanel.Text>
</InfoPanel.Field>
)}
{closedAt && (
<Field>
<Label>{t('Closed_At')}</Label>
<Info>{formatDateAndTime(closedAt)}</Info>
</Field>
<InfoPanel.Field>
<InfoPanel.Label>{t('Closed_At')}</InfoPanel.Label>
<InfoPanel.Text>{formatDateAndTime(closedAt)}</InfoPanel.Text>
</InfoPanel.Field>
)}
{servedBy?.ts && (
<Field>
<Label>{t('Taken_at')}</Label>
<Info>{formatDateAndTime(servedBy.ts)}</Info>
</Field>
<InfoPanel.Field>
<InfoPanel.Label>{t('Taken_at')}</InfoPanel.Label>
<InfoPanel.Text>{formatDateAndTime(servedBy.ts)}</InfoPanel.Text>
</InfoPanel.Field>
)}
{metrics?.response?.avg && formatDuration(metrics.response.avg) && (
<Field>
<Label>{t('Avg_response_time')}</Label>
<Info>{formatDuration(metrics.response.avg)}</Info>
</Field>
<InfoPanel.Field>
<InfoPanel.Label>{t('Avg_response_time')}</InfoPanel.Label>
<InfoPanel.Text>{formatDuration(metrics.response.avg)}</InfoPanel.Text>
</InfoPanel.Field>
)}
{!waitingResponse && responseBy?.lastMessageTs && (
<Field>
<Label>{t('Inactivity_Time')}</Label>
<Info>{moment(responseBy.lastMessageTs).fromNow(true)}</Info>
</Field>
<InfoPanel.Field>
<InfoPanel.Label>{t('Inactivity_Time')}</InfoPanel.Label>
<InfoPanel.Text>{moment(responseBy.lastMessageTs).fromNow(true)}</InfoPanel.Text>
</InfoPanel.Field>
)}
{canViewCustomFields && customFieldEntries.map(([key, value]) => <CustomField key={key} id={key} value={value} />)}
{slaId && <SlaField id={slaId} />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ import React, { useEffect, useMemo, useState } from 'react';

import { hasPermission } from '../../../../../../app/authorization/client';
import { ContextualbarScrollableContent, ContextualbarFooter } from '../../../../../components/Contextualbar';
import InfoPanel from '../../../../../components/InfoPanel';
import MarkdownText from '../../../../../components/MarkdownText';
import { useEndpointData } from '../../../../../hooks/useEndpointData';
import { useFormatDateAndTime } from '../../../../../hooks/useFormatDateAndTime';
import { useFormatDuration } from '../../../../../hooks/useFormatDuration';
import CustomField from '../../../components/CustomField';
import Field from '../../../components/Field';
import Info from '../../../components/Info';
import Label from '../../../components/Label';
import { AgentField, ContactField, SlaField } from '../../components';
import PriorityField from '../../components/PriorityField';
import { formatQueuedAt } from '../../utils/formatQueuedAt';
Expand Down Expand Up @@ -101,66 +100,68 @@ function ChatInfoDirectory({ id, route = undefined, room }) {
{servedBy && <AgentField agent={servedBy} />}
{departmentId && <DepartmentField departmentId={departmentId} />}
{tags && tags.length > 0 && (
<Field>
<Label>{t('Tags')}</Label>
<Info>
<InfoPanel.Field>
<InfoPanel.Label>{t('Tags')}</InfoPanel.Label>
<InfoPanel.Text>
{tags.map((tag) => (
<Box key={tag} mie={4} display='inline'>
<Tag style={{ display: 'inline' }} disabled>
{tag}
</Tag>
</Box>
))}
</Info>
</Field>
</InfoPanel.Text>
</InfoPanel.Field>
)}
{topic && (
<Field>
<Label>{t('Topic')}</Label>
<Info>{topic}</Info>
</Field>
<InfoPanel.Field>
<InfoPanel.Label>{t('Topic')}</InfoPanel.Label>
<InfoPanel.Text withTruncatedText={false}>
<MarkdownText variant='inline' content={topic} />
</InfoPanel.Text>
</InfoPanel.Field>
)}
{queueStartedAt && (
<Field>
<Label>{t('Queue_Time')}</Label>
<InfoPanel.Field>
<InfoPanel.Label>{t('Queue_Time')}</InfoPanel.Label>
{queueTime}
</Field>
</InfoPanel.Field>
)}
{closedAt && (
<Field>
<Label>{t('Chat_Duration')}</Label>
<Info>{moment(closedAt).from(moment(ts), true)}</Info>
</Field>
<InfoPanel.Field>
<InfoPanel.Label>{t('Chat_Duration')}</InfoPanel.Label>
<InfoPanel.Text>{moment(closedAt).from(moment(ts), true)}</InfoPanel.Text>
</InfoPanel.Field>
)}
{ts && (
<Field>
<Label>{t('Created_at')}</Label>
<Info>{formatDateAndTime(ts)}</Info>
</Field>
<InfoPanel.Field>
<InfoPanel.Label>{t('Created_at')}</InfoPanel.Label>
<InfoPanel.Text>{formatDateAndTime(ts)}</InfoPanel.Text>
</InfoPanel.Field>
)}
{closedAt && (
<Field>
<Label>{t('Closed_At')}</Label>
<Info>{formatDateAndTime(closedAt)}</Info>
</Field>
<InfoPanel.Field>
<InfoPanel.Label>{t('Closed_At')}</InfoPanel.Label>
<InfoPanel.Text>{formatDateAndTime(closedAt)}</InfoPanel.Text>
</InfoPanel.Field>
)}
{servedBy?.ts && (
<Field>
<Label>{t('Taken_at')}</Label>
<Info>{formatDateAndTime(servedBy.ts)}</Info>
</Field>
<InfoPanel.Field>
<InfoPanel.Label>{t('Taken_at')}</InfoPanel.Label>
<InfoPanel.Text>{formatDateAndTime(servedBy.ts)}</InfoPanel.Text>
</InfoPanel.Field>
)}
{metrics?.response?.avg && formatDuration(metrics.response.avg) && (
<Field>
<Label>{t('Avg_response_time')}</Label>
<Info>{formatDuration(metrics.response.avg)}</Info>
</Field>
<InfoPanel.Field>
<InfoPanel.Label>{t('Avg_response_time')}</InfoPanel.Label>
<InfoPanel.Text>{formatDuration(metrics.response.avg)}</InfoPanel.Text>
</InfoPanel.Field>
)}
{!waitingResponse && responseBy?.lastMessageTs && (
<Field>
<Label>{t('Inactivity_Time')}</Label>
<Info>{moment(responseBy.lastMessageTs).fromNow(true)}</Info>
</Field>
<InfoPanel.Field>
<InfoPanel.Label>{t('Inactivity_Time')}</InfoPanel.Label>
<InfoPanel.Text>{moment(responseBy.lastMessageTs).fromNow(true)}</InfoPanel.Text>
</InfoPanel.Field>
)}
{canViewCustomFields() &&
livechatData &&
Expand Down
Loading