Skip to content

fix(web-ui): improve chat page styling #866

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

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -51,48 +51,34 @@ export function ChatPageContainer(): ReactElement {
if (isLoading) {
return (
<ChatPageNav>
<ChatPageSkeleton />
<Box sx={{ flexGrow: 1 }}>
<ChatPageSkeleton />
</Box>

<ChatTextField conversationId={id} onSentMessage={refetch} />
</ChatPageNav>
);
}

if (!data || data.length === 0) {
return (
<Box
sx={{
display: "flex",
flexDirection: "column",
height: "100%",
}}
>
<ChatPageNav>
<Box sx={{ flexGrow: 1 }}>
<Typography color="textSecondary">{t("no-messages")}</Typography>
</Box>

<ChatTextField conversationId={id} onSentMessage={refetch} />
</ChatPageNav>
</Box>
);
}

return (
<Box
sx={{
display: "flex",
flexDirection: "column",
height: "100%",
px: 3,
pt: 1
}}
>
<ChatPageNav>
<Box sx={{ flexGrow: 1 }}>
<ChatMessageList messages={data} />
<Typography color="textSecondary">{t("no-messages")}</Typography>
</Box>

<ChatTextField conversationId={id} onSentMessage={refetch} />
</ChatPageNav>
</Box>
);
}

return (
<ChatPageNav>
<Box sx={{ flexGrow: 1 }}>
<ChatMessageList messages={data} />
</Box>

<ChatTextField conversationId={id} onSentMessage={refetch} />
</ChatPageNav>
);
}
14 changes: 11 additions & 3 deletions services/web-ui/src/features/chat/pages/ChatPage/ChatPage.nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { ReactNode } from "react";
import { Link as ReactRouterLink } from "react-router-dom";

import { ArrowBackIosNew } from "@mui/icons-material";
import { Link as MuiLink, Typography } from "@mui/material";
import { Box, Link as MuiLink, Typography } from "@mui/material";

import { useTranslation } from "src/core/i18n";

Expand All @@ -16,7 +16,15 @@ export function ChatPageNav({
const { t } = useTranslation("chat");

return (
<>
<Box
sx={{
display: "flex",
flexDirection: "column",
height: "100%",
px: 3,
pt: 1,
}}
>
<MuiLink
component={ReactRouterLink}
sx={{
Expand All @@ -36,6 +44,6 @@ export function ChatPageNav({
</Typography>

{children}
</>
</Box>
);
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
import React from "react";
import { ReactElement } from "react";

import { Skeleton } from "@mui/material";
import { Box, Skeleton } from "@mui/material";

export function ChatPageSkeleton(): React.ReactElement {
export function ChatPageSkeleton(): ReactElement {
const messages = [89, 168, 104, 67, 184, 110, 80];
return (
<>
<Skeleton />
{messages.map((width, index) => (
<Box
key={width}
sx={{
display: "flex",
justifyContent: index % 2 ? "right" : "left",
}}
>
<Skeleton
height={42}
sx={{
borderRadius: 3,
my: 1,
}}
width={width}
variant="rectangular"
/>
</Box>
))}
</>
);
}
Loading