Skip to content

Commit

Permalink
feat(web-ui): add fab for creating new chat (#849)
Browse files Browse the repository at this point in the history
Co-authored-by: Johan Book <{ID}+{username}@users.noreply.github.com>
  • Loading branch information
johanbook and Johan Book authored Jul 13, 2024
1 parent 7bc7b6a commit 616964e
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 6 deletions.
3 changes: 2 additions & 1 deletion services/web-ui/public/locales/en/chat-create.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"button": "Create",
"error": "There was an error when creating the chat",
"success": "Chat created"
}
},
"header": "Start a new chat"
}
3 changes: 2 additions & 1 deletion services/web-ui/public/locales/sv/chat-create.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"button": "Skapa chat",
"error": "Något gick fel när din chat skulle skapas",
"success": "Chat skapad"
}
},
"header": "Start a new chat"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { ReactElement, ReactNode } from "react";
import { Link } from "react-router-dom";

import { Box, Typography } from "@mui/material";
import { Edit } from "@mui/icons-material";
import { Box, Fab, Typography } from "@mui/material";

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

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

<Fab
component={Link}
color="primary"
sx={{ position: "absolute", bottom: 70, right: 10 }}
to="/chat/create"
>
<Edit />
</Fab>

{children}
</Box>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ReactElement, ReactNode } from "react";

import { Box } from "@mui/material";
import { NavLayout } from "src/components/layout";
import { useTranslation } from "src/core/i18n";

interface CreateChatPageNavProps {
children: ReactNode;
Expand All @@ -9,5 +10,11 @@ interface CreateChatPageNavProps {
export function CreateChatPageNav({
children,
}: CreateChatPageNavProps): ReactElement {
return <Box sx={{ p: 2 }}>{children}</Box>;
const { t } = useTranslation("chat-create");

return (
<NavLayout header={t("header")} linkText="Back" to="/chat">
{children}
</NavLayout>
);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { ReactElement } from "react";

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

export function CreateChatPageSkeleton(): ReactElement {
return <>Loading...</>;
return (
<>
<Skeleton />
</>
);
}

0 comments on commit 616964e

Please sign in to comment.