Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

New

Manav Rathi1713510f2b29
diff --git a/web/packages/base/components/ErrorIndicator.tsx b/web/packages/base/components/ErrorIndicator.tsx
new file mode 100644
index 0000000000..dfed07b059
--- /dev/null
+++ b/web/packages/base/components/ErrorIndicator.tsx
@@ -0,0 +1,41 @@
+import ErrorOutline from "@mui/icons-material/ErrorOutline";
+import { Box, Stack, Typography } from "@mui/material";
+import { t } from "i18next";
+import type React from "react";
+
+/**
+ * An error message indicator, styled to complement {@link ActivityIndicator}.
+ *
+ * If a child is provided, it is used as the error message to show (after being
+ * wrapped in a suitable {@link Typography}). Otherwise the default generic
+ * error message is shown.
+ */
+export const ActivityErrorIndicator: React.FC<React.PropsWithChildren> = ({
+ children,
+}) => (
+ <Stack sx={{ gap: 2, alignItems: "center" }}>
+ <ErrorOutline color="secondary" sx={{ color: "critical" }} />
+ <Typography color="text.muted">
+ {children ?? t("generic_error")}
+ </Typography>
+ </Stack>
+);
+
+/**
+ * An smaller error message indicator suitable for being shown above or below
+ * text fields.
+ *
+ * If a child is provided, it is used as the error message to show (after being
+ * wrapped in a suitable {@link Typography}). Otherwise the default generic
+ * error message is shown.
+ */
+export const InlineErrorIndicator: React.FC<React.PropsWithChildren> = ({
+ children,
+}) => (
+ <Box sx={{ display: "flex", gap: 2, alignItems: "center" }}>
+ <ErrorOutline color="secondary" sx={{ color: "critical" }} />
+ <Typography variant="small" color="critical.main">
+ {children ?? t("generic_error")}
+ </Typography>
+ </Box>
+);
diff --git a/web/packages/new/photos/components/gallery/PeopleHeader.tsx b/web/packages/new/photos/components/gallery/PeopleHeader.tsx
index 0ee68e77cb..bda66fa1fb 100644
--- a/web/packages/new/photos/components/gallery/PeopleHeader.tsx
+++ b/web/packages/new/photos/components/gallery/PeopleHeader.tsx
@@ -1,7 +1,5 @@
-import {
- ActivityIndicator,
- ErrorIndicator,
-} from "@/base/components/mui/ActivityIndicator";
+import { ActivityErrorIndicator } from "@/base/components/ErrorIndicator";
+import { ActivityIndicator } from "@/base/components/mui/ActivityIndicator";
import { CenteredBox, SpaceBetweenFlex } from "@/base/components/mui/Container";
import { FocusVisibleButton } from "@/base/components/mui/FocusVisibleButton";
import { LoadingButton } from "@/base/components/mui/LoadingButton";
@@ -685,7 +683,7 @@ const SuggestionsDialog: React.FC<SuggestionsDialogProps> = ({
</CenteredBox>
) : state.fetchFailed ? (
<CenteredBox>
- <ErrorIndicator />
+ <ActivityErrorIndicator />
</CenteredBox>
) : state.showChoices ? (
<SuggestionOrChoiceList