Skip to content

armgit / ente

Public Imported from GitHub
0

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

Merge branch 'main' into locker-col-web-main

AmanRajSinghMouryae877c1aacae6
diff --cc web/apps/share/src/components/file-share/FileShareView.tsx
index 715a456d5c,a95308d384..d51b2476a6
--- a/web/apps/share/src/components/file-share/FileShareView.tsx
+++ b/web/apps/share/src/components/file-share/FileShareView.tsx
@@@ -1,5 -1,7 +1,6 @@@
import { Box, Button, CircularProgress, Typography } from "@mui/material";
-import { useColorScheme } from "@mui/material/styles";
import { Notification } from "ente-new/photos/components/Notification";
+ import Head from "next/head";
import React from "react";
import { useFileShare } from "../../hooks/useFileShare";
import { formatFileSize } from "../../services/file-share";
@@@ -17,262 -22,264 +18,271 @@@ export const FileShareView: React.FC =
handleCopyContent,
setNotificationAttributes,
} = useFileShare();
+ const iconInfo = fileInfo
+ ? getLockerFileIcon(fileInfo.fileName, {
+ lockerType: fileInfo.lockerType,
+ })
+ : null;
return (
- <Box
- sx={{
- minHeight: "100dvh",
- width: "100%",
- maxWidth: "100%",
- bgcolor: "accent.main",
- display: "flex",
- flexDirection: "column",
- alignItems: "center",
- p: { xs: 1.25, md: 2 },
- boxSizing: "border-box",
- overflowX: "hidden",
- }}
- >
+ <>
+ <Head>
+ <meta name="robots" content="noindex, nofollow" />
+ </Head>
<Box
sx={{
- height: {
- xs: "calc(100dvh - 20px)",
- md: "calc(100dvh - 32px)",
- },
+ minHeight: "100dvh",
+ width: "100%",
- bgcolor: "background.default",
- borderRadius: { xs: "24px", md: "34px" },
++ maxWidth: "100%",
+ bgcolor: "accent.main",
display: "flex",
flexDirection: "column",
alignItems: "center",
- overflow: "hidden",
- "& ::selection": {
- backgroundColor: "accent.main",
- color: "fixed.white",
- },
- "& ::-moz-selection": {
- backgroundColor: "accent.main",
- color: "fixed.white",
- },
- padding: { xs: 1, md: 3 },
++ p: { xs: 1.25, md: 2 },
+ boxSizing: "border-box",
++ overflowX: "hidden",
}}
>
- {/* Ente Locker Logo */}
<Box
sx={{
- minHeight: {
- xs: "calc(100dvh - 16px)",
- md: "calc(100dvh - 48px)",
- },
width: "100%",
- display: "flex",
- alignItems: "center",
- justifyContent: { xs: "center", md: "flex-end" },
- minHeight: { xs: 88, md: 104 },
- px: { xs: 3, md: 4.5 },
- mb: fileInfo?.lockerType ? { xs: 16, md: 0 } : 0,
- }}
- >
- <a
- href="https://ente.com/locker"
- target="_blank"
- rel="noopener noreferrer"
- style={{ display: "block", lineHeight: 0 }}
- >
- <picture>
- <source
- srcSet="/images/ente-locker-white.svg"
- media="(prefers-color-scheme: dark)"
- />
- <Box
- component="img"
- src="/images/ente-locker.svg"
- alt="Ente Locker"
- sx={{ height: "56px", cursor: "pointer" }}
- />
- </picture>
- </a>
- </Box>
-
- {/* Main Container */}
- <Box
- sx={{
++ height: {
++ xs: "calc(100dvh - 20px)",
++ md: "calc(100dvh - 32px)",
++ },
+ bgcolor: "background.default",
- borderRadius: { xs: "20px", md: "40px" },
++ borderRadius: { xs: "24px", md: "34px" },
display: "flex",
flexDirection: "column",
alignItems: "center",
- justifyContent: fileInfo?.lockerType
- ? "flex-start"
- : "center",
- width: "100%",
- maxWidth: 400,
- flex: 1,
- px: 3,
- pb: 8,
- mt: fileInfo?.lockerType ? { xs: 0, md: "20dvh" } : 0,
++ overflow: "hidden",
+ "& ::selection": {
+ backgroundColor: "accent.main",
+ color: "fixed.white",
+ },
+ "& ::-moz-selection": {
+ backgroundColor: "accent.main",
+ color: "fixed.white",
+ },
}}
>
- {/* Loading State */}
- {loading && (
- <Box
- sx={{
- flex: 1,
- display: "flex",
- alignItems: "center",
- justifyContent: "center",
- }}
+ {/* Ente Locker Logo */}
+ <Box
+ sx={{
- mt: { xs: 5, md: 6 },
++ width: "100%",
++ display: "flex",
++ alignItems: "center",
++ justifyContent: { xs: "center", md: "flex-end" },
++ minHeight: { xs: 88, md: 104 },
++ px: { xs: 3, md: 4.5 },
+ mb: fileInfo?.lockerType ? { xs: 16, md: 0 } : 0,
- alignSelf: { xs: "center", md: "flex-end" },
- mr: { xs: 0, md: 6 },
+ }}
+ >
+ <a
+ href="https://ente.com/locker"
+ target="_blank"
- rel="noopener"
++ rel="noopener noreferrer"
+ style={{ display: "block", lineHeight: 0 }}
>
- <CircularProgress
- sx={{ color: "accent.main" }}
- size={32}
- <Box
- component="img"
- src={
- isDarkMode
- ? "/images/ente-locker-white.svg"
- : "/images/ente-locker.svg"
- }
- alt="Ente Locker"
- sx={{ height: "56px", cursor: "pointer" }}
-- />
- </Box>
- )}
++ <picture>
++ <source
++ srcSet="/images/ente-locker-white.svg"
++ media="(prefers-color-scheme: dark)"
++ />
++ <Box
++ component="img"
++ src="/images/ente-locker.svg"
++ alt="Ente Locker"
++ sx={{ height: "56px", cursor: "pointer" }}
++ />
++ </picture>
+ </a>
+ </Box>
- {/* Error State */}
- {error && !loading && (
- <Box
- sx={{
- flex: 1,
- display: "flex",
- alignItems: "center",
- justifyContent: "center",
- textAlign: "center",
- p: 3,
- }}
- >
- <Typography variant="body" color="error">
- {error}
- </Typography>
- </Box>
- )}
+ {/* Main Container */}
+ <Box
+ sx={{
+ display: "flex",
+ flexDirection: "column",
+ alignItems: "center",
+ justifyContent: fileInfo?.lockerType
+ ? "flex-start"
+ : "center",
+ width: "100%",
+ maxWidth: 400,
+ flex: 1,
+ px: 3,
+ pb: 8,
+ mt: fileInfo?.lockerType
+ ? { xs: 0, md: "20dvh" }
+ : 0,
+ }}
+ >
+ {/* Loading State */}
+ {loading && (
+ <Box
+ sx={{
+ flex: 1,
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "center",
+ }}
+ >
+ <CircularProgress
+ sx={{ color: "accent.main" }}
+ size={32}
+ />
+ </Box>
+ )}
- {/* File Info Display */}
- {fileInfo && iconInfo && !loading && (
- <>
- {/* File Info - Centered */}
+ {/* Error State */}
+ {error && !loading && (
<Box
sx={{
+ flex: 1,
display: "flex",
- flexDirection: "column",
alignItems: "center",
justifyContent: "center",
- gap: 3,
- width: "100%",
- marginBottom: 4,
+ textAlign: "center",
+ p: 3,
}}
>
- {/* Large File Icon */}
+ <Typography variant="body" color="error">
+ {error}
+ </Typography>
+ </Box>
+ )}
+
+ {/* File Info Display */}
- {fileInfo && !loading && (
++ {fileInfo && iconInfo && !loading && (
+ <>
+ {/* File Info - Centered */}
<Box
sx={{
- backgroundColor:
- iconInfo.backgroundColor,
- borderRadius: "20px",
- padding: 1.8,
display: "flex",
+ flexDirection: "column",
alignItems: "center",
justifyContent: "center",
+ gap: 3,
+ width: "100%",
+ marginBottom: 4,
}}
>
- {iconInfo.icon}
- </Box>
-
- {/* File Name */}
- <Typography
- variant="h5"
- sx={{
- fontWeight: 600,
- fontSize: fileInfo.lockerType
- ? "24px"
- : "22px",
- textAlign: "center",
- wordBreak: "break-word",
- color: "text.base",
- }}
- >
- {fileInfo.fileName}
- </Typography>
+ {/* Large File Icon */}
+ <Box
+ sx={{
- backgroundColor: getLockerFileIcon(
- fileInfo.fileName,
- fileInfo.lockerType,
- ).backgroundColor,
++ backgroundColor:
++ iconInfo.backgroundColor,
+ borderRadius: "20px",
+ padding: 1.8,
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "center",
+ }}
+ >
- {
- getLockerFileIcon(
- fileInfo.fileName,
- fileInfo.lockerType,
- ).icon
- }
++ {iconInfo.icon}
+ </Box>
- {/* File Size - only show if no locker type */}
- {!fileInfo.lockerType && (
+ {/* File Name */}
<Typography
- variant="body"
+ variant="h5"
sx={{
- color: "text.muted",
- mt: -2,
- fontSize: "1rem",
+ fontWeight: 600,
+ fontSize: fileInfo.lockerType
+ ? "24px"
+ : "22px",
+ textAlign: "center",
+ wordBreak: "break-word",
+ color: "text.base",
}}
>
- {fileInfo.fileSize > 0
- ? formatFileSize(fileInfo.fileSize)
- : "Unknown size"}
+ {fileInfo.fileName}
</Typography>
- )}
- {/* Locker Type Display */}
- {fileInfo.lockerType &&
- fileInfo.lockerInfoData && (
- <LockerTypeDisplay
- type={fileInfo.lockerType}
- data={fileInfo.lockerInfoData}
- onCopy={handleCopyContent}
- />
+ {/* File Size - only show if no locker type */}
+ {!fileInfo.lockerType && (
+ <Typography
+ variant="body"
+ sx={{
+ color: "text.muted",
+ mt: -2,
+ fontSize: "1rem",
+ }}
+ >
+ {fileInfo.fileSize > 0
+ ? formatFileSize(
+ fileInfo.fileSize,
+ )
+ : "Unknown size"}
+ </Typography>
)}
- </Box>
- {/* Download Button - Only show if not a LockerInfoType */}
- {!fileInfo.lockerType && (
- <Box sx={{ width: "100%", mt: 4 }}>
- <Button
- variant="contained"
- size="large"
- fullWidth
- onClick={handleDownload}
- disabled={downloading}
- sx={{
- py: 2.5,
- fontSize: "1rem",
- fontWeight: 600,
- bgcolor: "accent.main",
- color: "accent.contrastText",
- "&:hover": {
- bgcolor: "accent.dark",
- },
- "&:disabled": {
- bgcolor: "accent.main",
- color: "accent.contrastText",
- opacity: 0.7,
- },
- borderRadius: "22px",
- textTransform: "none",
- }}
- >
- {downloading ? (
- <>
- <CircularProgress
- size={20}
- sx={{
- mr: 1,
- color: "accent.contrastText",
- }}
- />
- Downloading...
- </>
- ) : (
- "Download"
+ {/* Locker Type Display */}
+ {fileInfo.lockerType &&
+ fileInfo.lockerInfoData && (
+ <LockerTypeDisplay
+ type={fileInfo.lockerType}
+ data={fileInfo.lockerInfoData}
+ onCopy={handleCopyContent}
+ />
)}
- </Button>
</Box>
- )}
- </>
- )}
- </Box>
- <Notification
- open={!!notificationAttributes}
- onClose={() => setNotificationAttributes(undefined)}
- attributes={notificationAttributes}
- />
+ {/* Download Button - Only show if not a LockerInfoType */}
+ {!fileInfo.lockerType && (
+ <Box sx={{ width: "100%", mt: 4 }}>
+ <Button
+ variant="contained"
+ size="large"
+ fullWidth
+ onClick={handleDownload}
+ disabled={downloading}
+ sx={{
+ py: 2.5,
+ fontSize: "1rem",
+ fontWeight: 600,
+ bgcolor: "accent.main",
+ color: "accent.contrastText",
+ "&:hover": {
+ bgcolor: "accent.dark",
+ },
+ "&:disabled": {
+ bgcolor: "accent.main",
+ color: "accent.contrastText",
+ opacity: 0.7,
+ },
+ borderRadius: "22px",
+ textTransform: "none",
+ }}
+ >
+ {downloading ? (
+ <>
+ <CircularProgress
+ size={20}
+ sx={{
+ mr: 1,
+ color: "accent.contrastText",
+ }}
+ />
+ Downloading...
+ </>
+ ) : (
+ "Download"
+ )}
+ </Button>
+ </Box>
+ )}
+ </>
+ )}
+ </Box>
+
+ <Notification
+ open={!!notificationAttributes}
+ onClose={() => setNotificationAttributes(undefined)}
+ attributes={notificationAttributes}
+ />
+ </Box>
</Box>
- </Box>
+ </>
);
};