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(api): fix typo #826

Merged
merged 5 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
feat(web-ui): improve error view
  • Loading branch information
Johan Book authored and Johan Book committed Jul 11, 2024
commit 6bd923356eed2bbb783e5ce3905f3194dce98479
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function ConversationsPageContainer(): ReactElement {
if (error) {
return (
<ConversationsPageNav>
<ErrorView error={error} />
<ErrorView message="Unable to get chats" />
</ConversationsPageNav>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ export function AuthenticationGuardContainer({
}

if (error) {
const message = `Unable to verify if logged in. Try refreshing the page.`;
return (
<AuthenticationGuardNav>
<ErrorView error={error} message={message} />
<ErrorView
description="We cannot verify your credentials right now. Try waiting a bit and refreshing the page."
message="Unable to verify login"
/>
</AuthenticationGuardNav>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ export interface AuthenticationGuardNavProps {
export function AuthenticationGuardNav({
children,
}: AuthenticationGuardNavProps): React.ReactElement {
return <Box sx={{ p: 3 }}>{children}</Box>;
return <Box sx={{ p: 3, height: "100vh" }}>{children}</Box>;
}
2 changes: 1 addition & 1 deletion services/web-ui/src/pages/ChatPage/ChatPage.container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export function ChatPageContainer(): ReactElement {
if (error) {
return (
<ChatPageNav>
<ErrorView error={error} />
<ErrorView />
</ChatPageNav>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function CurrentOrganizationPageContainer(): ReactElement {
if (error) {
return (
<CurrentOrganizationPageNav>
<ErrorView error={error} />
<ErrorView />
</CurrentOrganizationPageNav>
);
}
Expand All @@ -40,7 +40,7 @@ export function CurrentOrganizationPageContainer(): ReactElement {
if (!data) {
return (
<CurrentOrganizationPageNav>
<ErrorView error="Organization not found" />
<ErrorView message="Organization not found" />
</CurrentOrganizationPageNav>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function CurrentProfilePageContainer(): ReactElement {
if (error) {
return (
<CurrentProfilePageNav>
<ErrorView error={error} />
<ErrorView />
</CurrentProfilePageNav>
);
}
Expand All @@ -34,7 +34,7 @@ export function CurrentProfilePageContainer(): ReactElement {
if (!data) {
return (
<CurrentProfilePageNav>
<ErrorView error="Unable to fetch profile" />
<ErrorView message="Unable to fetch profile" />
</CurrentProfilePageNav>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function OrganizationListPageContainer(): ReactElement {
if (error) {
return (
<OrganizationListPageNav>
<ErrorView error={error} />
<ErrorView />
</OrganizationListPageNav>
);
}
Expand All @@ -50,7 +50,7 @@ export function OrganizationListPageContainer(): ReactElement {
if (!data || data.length === 0) {
return (
<OrganizationListPageNav>
<ErrorView error={t("organization-list.error")} />
<ErrorView message={t("organization-list.error") ||""} />
</OrganizationListPageNav>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function ProfilePageContainer(): ReactElement {
if (error) {
return (
<ProfilePageNav>
<ErrorView error={error} />
<ErrorView />
</ProfilePageNav>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function SettingsPageContainer(): ReactElement {
return (
<>
<SettingsPageHeader />
<ErrorView error={error} />
<ErrorView />
</>
);
}
Expand All @@ -67,7 +67,7 @@ export function SettingsPageContainer(): ReactElement {
return (
<>
<SettingsPageHeader />
<ErrorView error="Settings not found" />
<ErrorView message="Settings not found" />
</>
);
}
Expand Down
32 changes: 23 additions & 9 deletions services/web-ui/src/views/ErrorView/ErrorView.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,38 @@
import { ReactElement } from "react";

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

import { ErrorMessage } from "src/components/ui/ErrorMessage";
import { ErrorMessageProps } from "src/components/ui/ErrorMessage/ErrorMessage";

export interface ErrorViewProps extends ErrorMessageProps {}
interface ErrorViewProps {
description?: string;
message?: string;
}

export function ErrorView(props: ErrorViewProps): ReactElement {
export function ErrorView({
description,
message="Un unexpected error occured",
}: ErrorViewProps): ReactElement {
return (
<Box
sx={{
display: "flex",
alignItems: "center",
justifyContent: "center",
paddingTop: "10px",
height: "100%",
}}
>
<Box>
<ErrorMessage {...props} />
<Box
sx={{ display: "flex", flexDirection: "column", alignItems: "center" }}
>
<HeartBroken color="error" sx={{ fontSize: 60, mb: 2 }} />

<Typography gutterBottom variant="h5">
{message}
</Typography>

{description && (
<Typography color="textSecondary">{description}</Typography>
)}
</Box>
</Box>
);
Expand Down
Loading