Skip to content

Commit 616964e

Browse files
johanbookJohan Book
and
Johan Book
authored
feat(web-ui): add fab for creating new chat (#849)
Co-authored-by: Johan Book <{ID}+{username}@users.noreply.github.com>
1 parent 7bc7b6a commit 616964e

File tree

5 files changed

+32
-6
lines changed

5 files changed

+32
-6
lines changed

services/web-ui/public/locales/en/chat-create.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
"button": "Create",
44
"error": "There was an error when creating the chat",
55
"success": "Chat created"
6-
}
6+
},
7+
"header": "Start a new chat"
78
}

services/web-ui/public/locales/sv/chat-create.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
"button": "Skapa chat",
44
"error": "Något gick fel när din chat skulle skapas",
55
"success": "Chat skapad"
6-
}
6+
},
7+
"header": "Start a new chat"
78
}

services/web-ui/src/features/chat/pages/ChatListPage/ChatListPage.nav.tsx

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { ReactElement, ReactNode } from "react";
2+
import { Link } from "react-router-dom";
23

3-
import { Box, Typography } from "@mui/material";
4+
import { Edit } from "@mui/icons-material";
5+
import { Box, Fab, Typography } from "@mui/material";
46

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

@@ -17,6 +19,15 @@ export function ChatListPageNav({
1719
<Box sx={{ pt: 3, px: 3 }}>
1820
<Typography variant="h5">{t("header")}</Typography>
1921

22+
<Fab
23+
component={Link}
24+
color="primary"
25+
sx={{ position: "absolute", bottom: 70, right: 10 }}
26+
to="/chat/create"
27+
>
28+
<Edit />
29+
</Fab>
30+
2031
{children}
2132
</Box>
2233
);
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { ReactElement, ReactNode } from "react";
22

3-
import { Box } from "@mui/material";
3+
import { NavLayout } from "src/components/layout";
4+
import { useTranslation } from "src/core/i18n";
45

56
interface CreateChatPageNavProps {
67
children: ReactNode;
@@ -9,5 +10,11 @@ interface CreateChatPageNavProps {
910
export function CreateChatPageNav({
1011
children,
1112
}: CreateChatPageNavProps): ReactElement {
12-
return <Box sx={{ p: 2 }}>{children}</Box>;
13+
const { t } = useTranslation("chat-create");
14+
15+
return (
16+
<NavLayout header={t("header")} linkText="Back" to="/chat">
17+
{children}
18+
</NavLayout>
19+
);
1320
}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import { ReactElement } from "react";
22

3+
import { Skeleton } from "@mui/material";
4+
35
export function CreateChatPageSkeleton(): ReactElement {
4-
return <>Loading...</>;
6+
return (
7+
<>
8+
<Skeleton />
9+
</>
10+
);
511
}

0 commit comments

Comments
 (0)