Skip to content

armgit / ente

Public Imported from GitHub
0

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

[photos] Reuse external link helper

AswinAsok89f9d2c2fa48
diff --git a/web/apps/photos/src/components/collections/AlbumCastDialog.tsx b/web/apps/photos/src/components/collections/AlbumCastDialog.tsx
index 758e329e92..7ebe7f28b2 100644
--- a/web/apps/photos/src/components/collections/AlbumCastDialog.tsx
+++ b/web/apps/photos/src/components/collections/AlbumCastDialog.tsx
@@ -1,5 +1,6 @@
import { publishCastPayload, revokeAllCastTokens } from "@/services/cast";
import { loadCast } from "@/utils/chromecast-sender";
+import { externalLink } from "@/utils/link";
import {
AlertCircleIcon,
ArrowLeft02Icon,
@@ -13,7 +14,6 @@ import {
Box,
Dialog,
IconButton,
- Link,
Stack,
Typography,
type Theme,
@@ -326,15 +326,7 @@ const AlbumCastDialogContents: React.FC<AlbumCastDialogProps> = ({
<Typography sx={instructionSx}>
<Trans
i18nKey="visit_cast_url"
- components={{
- a: (
- <Link
- target="_blank"
- rel="noopener"
- href={castURL}
- />
- ),
- }}
+ components={{ a: externalLink(castURL) }}
values={{ url: castHost }}
/>
</Typography>
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index 50d0662f15..df374f67a8 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -66,10 +66,11 @@ import {
visibleAlbumFilters,
type AlbumFilter,
} from "@/utils/album-filters";
+import { externalLink } from "@/utils/link";
import { sortPeople, type PeopleSortBy } from "@/utils/people-sort";
import { visibleQuickLinks } from "@/utils/quick-links";
import CheckCircleIcon from "@mui/icons-material/CheckCircle";
-import { Link, Typography } from "@mui/material";
+import { Typography } from "@mui/material";
import { sessionExpiredDialogAttributes } from "ente-accounts/components/utils/dialog";
import {
getAndClearIsFirstLogin,
@@ -2651,21 +2652,13 @@ const createAppDownloadFooter = (): FileListHeaderOrFooter => ({
}}
>
<Trans
- i18nKey={"install_mobile_app"}
+ i18nKey="install_mobile_app"
components={{
- a: (
- <Link
- href="https://play.google.com/store/apps/details?id=io.ente.photos"
- target="_blank"
- rel="noopener"
- />
+ a: externalLink(
+ "https://play.google.com/store/apps/details?id=io.ente.photos",
),
- b: (
- <Link
- href="https://apps.apple.com/in/app/ente-photos/id1542026904"
- target="_blank"
- rel="noopener"
- />
+ b: externalLink(
+ "https://apps.apple.com/in/app/ente-photos/id1542026904",
),
}}
/>
diff --git a/web/apps/photos/src/utils/link.tsx b/web/apps/photos/src/utils/link.tsx
new file mode 100644
index 0000000000..b9787cb8ac
--- /dev/null
+++ b/web/apps/photos/src/utils/link.tsx
@@ -0,0 +1,5 @@
+import { Link } from "@mui/material";
+
+export const externalLink = (href: string) => (
+ <Link href={href} target="_blank" rel="noopener" />
+);