Skip to content

armgit / ente

Public Imported from GitHub
0

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

feat(paste):ui-revamped

Aswin Asok568b95bd0e28
diff --git a/web/apps/paste/src/features/paste/components/PasteCreatePanel.tsx b/web/apps/paste/src/features/paste/components/PasteCreatePanel.tsx
index b7b31f8112..e930d89928 100644
--- a/web/apps/paste/src/features/paste/components/PasteCreatePanel.tsx
+++ b/web/apps/paste/src/features/paste/components/PasteCreatePanel.tsx
@@ -34,6 +34,12 @@ export const PasteCreatePanel = ({
const isNearCharLimit = inputText.length >= nearLimitThreshold;
const mutedCounterColor = "rgba(234, 238, 255, 0.6)";
const softBlueCounterColor = "rgba(204, 224, 255, 0.96)";
+ const privacyPills = [
+ "Private",
+ "End To End Encrypted",
+ "One-Time View",
+ "Deletes In 24 Hrs",
+ ];
return (
<>
@@ -104,9 +110,10 @@ export const PasteCreatePanel = ({
left: 18,
right: 18,
bottom: 18,
+ height: 48,
display: "flex",
justifyContent: "space-between",
- alignItems: "center",
+ alignItems: "flex-end",
gap: 2,
pointerEvents: "none",
}}
@@ -117,6 +124,7 @@ export const PasteCreatePanel = ({
display: "flex",
alignItems: "center",
height: 44,
+ transform: { xs: "translateY(10px)", md: "translateY(12px)" },
color: mutedCounterColor,
fontWeight: 600,
lineHeight: 1,
@@ -189,44 +197,43 @@ export const PasteCreatePanel = ({
textAlign: "center",
}}
>
- <Typography
+ <Box
sx={{
- color: "rgba(220, 229, 255, 0.62)",
- fontSize: "0.86rem",
- fontWeight: 500,
- lineHeight: 1.4,
- maxWidth: 520,
+ display: "flex",
+ flexWrap: { xs: "wrap", md: "nowrap" },
+ justifyContent: "center",
+ gap: 1,
+ maxWidth: { xs: 520, md: "none" },
mb: "3rem",
+ pointerEvents: "none",
+ userSelect: "none",
}}
>
- Your paste is{" "}
- <Box
- component="span"
- sx={{ fontWeight: 700, color: "rgba(232, 240, 255, 0.9)" }}
- >
- private
- </Box>
- .{" "}
- <Box
- component="span"
- sx={{ fontWeight: 700, color: "rgba(232, 240, 255, 0.9)" }}
- >
- End-to-end encrypted
- </Box>
- ,{" "}
- <Box component="span" sx={{ color: frameBlue, fontWeight: 600 }}>
- one-time view
- </Box>
- ,{" "}
- <Box component="span" sx={{ color: frameBlue, fontWeight: 600 }}>
- purged after view
- </Box>{" "}
- and{" "}
- <Box component="span" sx={{ color: frameBlue, fontWeight: 600 }}>
- auto-deleted in 24 hours
- </Box>
- .
- </Typography>
+ {privacyPills.map((label) => (
+ <Box
+ key={label}
+ component="span"
+ aria-disabled="true"
+ sx={{
+ px: 1.4,
+ py: 0.6,
+ borderRadius: "999px",
+ border: "1px solid rgba(147, 155, 177, 0.24)",
+ bgcolor: "rgba(255, 255, 255, 0.045)",
+ color: "rgba(220, 229, 255, 0.55)",
+ fontSize: "0.79rem",
+ fontWeight: 600,
+ letterSpacing: "0.01em",
+ lineHeight: 1.2,
+ whiteSpace: "nowrap",
+ boxShadow: "inset 0 1px 0 rgba(255, 255, 255, 0.05)",
+ opacity: 0.78,
+ }}
+ >
+ {label}
+ </Box>
+ ))}
+ </Box>
</Box>
{createError && <Typography color="error">{createError}</Typography>}
diff --git a/web/apps/paste/src/features/paste/components/PasteLinkCard.tsx b/web/apps/paste/src/features/paste/components/PasteLinkCard.tsx
index bbf8d75628..7522f45ffb 100644
--- a/web/apps/paste/src/features/paste/components/PasteLinkCard.tsx
+++ b/web/apps/paste/src/features/paste/components/PasteLinkCard.tsx
@@ -152,6 +152,7 @@ export const PasteLinkCard = ({ link, onCopy, onShare }: PasteLinkCardProps) =>
const linkCardRef = useRef<HTMLDivElement | null>(null);
const arrowSvgRef = useRef<SVGSVGElement | null>(null);
const [arrow, setArrow] = useState<ParsedArrow | null>(null);
+ const [showCopied, setShowCopied] = useState(false);
useEffect(() => {
const linkCard = linkCardRef.current;
@@ -269,6 +270,27 @@ export const PasteLinkCard = ({ link, onCopy, onShare }: PasteLinkCardProps) =>
};
}, [arrow]);
+ useEffect(() => {
+ if (!showCopied) return;
+ const timeoutId = window.setTimeout(() => {
+ setShowCopied(false);
+ }, 1400);
+ return () => {
+ window.clearTimeout(timeoutId);
+ };
+ }, [showCopied]);
+
+ const handleCopyClick = () => {
+ setShowCopied(false);
+ void onCopy(link)
+ .then(() => {
+ setShowCopied(true);
+ })
+ .catch(() => {
+ setShowCopied(false);
+ });
+ };
+
return (
<Stack
ref={linkCardRef}
@@ -280,6 +302,16 @@ export const PasteLinkCard = ({ link, onCopy, onShare }: PasteLinkCardProps) =>
},
}}
>
+ <Typography
+ sx={{
+ fontSize: "0.88rem",
+ fontWeight: 600,
+ letterSpacing: "0.01em",
+ color: "rgba(220, 229, 255, 0.76)",
+ }}
+ >
+ One-Time Link
+ </Typography>
<Stack
direction={{ xs: "column", sm: "row" }}
spacing={1}
@@ -408,17 +440,18 @@ export const PasteLinkCard = ({ link, onCopy, onShare }: PasteLinkCardProps) =>
fontFamily:
'"Gochi Hand", "Comic Sans MS", "Bradley Hand", cursive',
fontSize: { xs: "2.3rem", sm: "2.5rem" },
- color: "rgba(219, 232, 255, 0.94)",
+ color: "#2f6df7",
background: "none",
border: "none",
p: 0,
m: 0,
lineHeight: 1,
cursor: "pointer",
- textDecoration: "none",
- transform: { xs: "translateY(-3px) rotate(-3deg)", sm: "translateY(-4px) rotate(-4deg)" },
+ textDecoration: "underline",
+ textUnderlineOffset: "3px",
+ transform: { xs: "translateY(60px) rotate(-3deg)", sm: "translateY(68px) rotate(-4deg)" },
"&:hover": {
- color: "#2f6df7",
+ color: "#5d92ff",
textDecoration: "underline",
textUnderlineOffset: "3px",
},
@@ -426,33 +459,60 @@ export const PasteLinkCard = ({ link, onCopy, onShare }: PasteLinkCardProps) =>
>
Share
</Typography>
- <Typography
- component="button"
- onClick={() => {
- void onCopy(link);
- }}
+ <Box
sx={{
- fontFamily:
- '"Gochi Hand", "Comic Sans MS", "Bradley Hand", cursive',
- fontSize: { xs: "2.3rem", sm: "2.5rem" },
- color: "rgba(219, 232, 255, 0.94)",
- background: "none",
- border: "none",
- p: 0,
- m: 0,
- lineHeight: 1,
- cursor: "pointer",
- textDecoration: "none",
- transform: { xs: "translateY(5px) rotate(3deg)", sm: "translateY(6px) rotate(4deg)" },
- "&:hover": {
+ transform: { xs: "translateY(86px) rotate(3deg)", sm: "translateY(94px) rotate(4deg)" },
+ display: "flex",
+ flexDirection: "column",
+ alignItems: "center",
+ minWidth: 84,
+ }}
+ >
+ <Typography
+ component="button"
+ onClick={handleCopyClick}
+ sx={{
+ fontFamily:
+ '"Gochi Hand", "Comic Sans MS", "Bradley Hand", cursive',
+ fontSize: { xs: "2.3rem", sm: "2.5rem" },
color: "#2f6df7",
+ background: "none",
+ border: "none",
+ p: 0,
+ m: 0,
+ lineHeight: 1,
+ cursor: "pointer",
textDecoration: "underline",
textUnderlineOffset: "3px",
- },
- }}
- >
- Copy
- </Typography>
+ "&:hover": {
+ color: "#5d92ff",
+ textDecoration: "underline",
+ textUnderlineOffset: "3px",
+ },
+ }}
+ >
+ Copy
+ </Typography>
+ <Typography
+ variant="mini"
+ sx={{
+ fontFamily:
+ '"Gochi Hand", "Comic Sans MS", "Bradley Hand", cursive',
+ mt: 0.5,
+ minHeight: "1.1rem",
+ color: "rgba(182, 190, 208, 0.9)",
+ fontSize: "0.94rem",
+ fontWeight: 600,
+ lineHeight: 1,
+ letterSpacing: "0.06em",
+ opacity: showCopied ? 1 : 0,
+ transition: "opacity 150ms ease",
+ pointerEvents: "none",
+ }}
+ >
+ Copied to clipboard.
+ </Typography>
+ </Box>
</Stack>
</Box>
</Stack>
diff --git a/web/apps/paste/src/features/paste/components/PasteViewPanel.tsx b/web/apps/paste/src/features/paste/components/PasteViewPanel.tsx
index 7083d90197..cd025b04c0 100644
--- a/web/apps/paste/src/features/paste/components/PasteViewPanel.tsx
+++ b/web/apps/paste/src/features/paste/components/PasteViewPanel.tsx
@@ -1,4 +1,8 @@
+import ContentCopyRoundedIcon from "@mui/icons-material/ContentCopyRounded";
+import { Alert02Icon } from "@hugeicons/core-free-icons";
+import { HugeiconsIcon } from "@hugeicons/react";
import {
+ Box,
Button,
CircularProgress,
Stack,
@@ -19,67 +23,236 @@ export const PasteViewPanel = ({
consumeError,
resolvedText,
onCopyText,
-}: PasteViewPanelProps) => (
- <>
- {consuming && (
- <Stack direction="row" spacing={1.5} alignItems="center">
- <CircularProgress size={18} sx={{ color: "accent.main" }} />
- <Typography>Opening secure paste...</Typography>
- </Stack>
- )}
+}: PasteViewPanelProps) => {
+ const frameBlue = "#2f6df7";
+ const inputGlassBg = "rgba(39, 42, 52, 0.76)";
+ const inputGlassBorder = "rgba(213, 225, 255, 0.14)";
- {consumeError && (
- <Stack spacing={1.5} alignItems="flex-start">
- <Typography color="error">{consumeError}</Typography>
- <Button
- variant="outlined"
- component="a"
- href="/"
+ return (
+ <>
+ {consuming && (
+ <Stack
+ spacing={1.1}
+ alignItems="center"
sx={{
- mt: 0.75,
- textTransform: "none",
- borderRadius: "12px",
+ width: "100%",
+ pt: { xs: 1.5, md: 2 },
+ pb: { xs: 0.5, md: 1 },
}}
>
- Create new paste
- </Button>
- </Stack>
- )}
+ <CircularProgress
+ size={58}
+ thickness={4.5}
+ sx={{
+ color: "rgba(176, 198, 234, 0.76)",
+ mb: { xs: 0.7, md: 0.9 },
+ }}
+ />
+ <Typography
+ sx={{
+ color: "rgba(201, 212, 236, 0.66)",
+ fontWeight: 600,
+ fontSize: { xs: "1rem", md: "1.1rem" },
+ lineHeight: 1.2,
+ letterSpacing: "0.01em",
+ textAlign: "center",
+ }}
+ >
+ Opening secure paste...
+ </Typography>
+ <Typography
+ variant="mini"
+ sx={{
+ color: "rgba(188, 201, 230, 0.44)",
+ fontWeight: 500,
+ textAlign: "center",
+ }}
+ >
+ Decrypting in your browser.
+ </Typography>
+ </Stack>
+ )}
- {resolvedText && (
- <Stack spacing={2}>
- <Typography sx={{ fontWeight: 600 }}>Paste contents</Typography>
- <TextField
- variant="filled"
- hiddenLabel
- multiline
- minRows={10}
- value={resolvedText}
- slotProps={{
- input: {
- readOnly: true,
- disableUnderline: true,
- },
- }}
- sx={pasteTextFieldSx()}
- />
- <Typography variant="mini" color="text.muted">
- This paste has now been removed from Ente servers.
- </Typography>
- <Button
- variant="outlined"
- onClick={() => {
- void onCopyText(resolvedText);
- }}
+ {consumeError && (
+ <Stack
+ spacing={1.25}
+ alignItems="center"
sx={{
- alignSelf: "flex-start",
- textTransform: "none",
- borderRadius: "12px",
+ width: "100%",
+ pt: { xs: 1.5, md: 2 },
+ pb: { xs: 0.5, md: 1 },
}}
>
- Copy text
- </Button>
- </Stack>
- )}
- </>
-);
+ <HugeiconsIcon
+ icon={Alert02Icon}
+ size={56}
+ strokeWidth={2}
+ style={{
+ color: "rgba(180, 198, 232, 0.76)",
+ }}
+ />
+ <Stack spacing={{ xs: 2.2, md: 2.6 }} alignItems="center">
+ <Typography
+ sx={{
+ maxWidth: 560,
+ color: "rgba(186, 201, 232, 0.46)",
+ fontWeight: 500,
+ fontSize: { xs: "0.85rem", md: "0.92rem" },
+ lineHeight: 1.3,
+ textAlign: "center",
+ }}
+ >
+ {consumeError}
+ </Typography>
+ <Button
+ variant="contained"
+ component="a"
+ href="/"
+ disableElevation
+ sx={{
+ px: "34px",
+ py: "14px",
+ minHeight: 54,
+ borderRadius: "10px",
+ textTransform: "none",
+ fontWeight: 600,
+ fontSize: "1rem",
+ lineHeight: 1,
+ bgcolor: frameBlue,
+ color: "rgba(231, 238, 252, 0.9)",
+ "&:hover": {
+ bgcolor: frameBlue,
+ boxShadow: "none",
+ },
+ }}
+ >
+ Create new paste
+ </Button>
+ </Stack>
+ </Stack>
+ )}
+
+ {resolvedText && (
+ <Stack spacing={1.8}>
+ <Typography
+ sx={{
+ fontSize: "0.82rem",
+ color: "rgba(186, 201, 232, 0.56)",
+ fontWeight: 600,
+ letterSpacing: "0.01em",
+ }}
+ >
+ Paste contents
+ </Typography>
+ <Box sx={{ position: "relative", width: "100%" }}>
+ <TextField
+ variant="filled"
+ hiddenLabel
+ fullWidth
+ multiline
+ minRows={10}
+ value={resolvedText}
+ slotProps={{
+ input: {
+ readOnly: true,
+ disableUnderline: true,
+ },
+ }}
+ sx={[
+ pasteTextFieldSx(
+ "20px",
+ inputGlassBg,
+ inputGlassBorder,
+ ),
+ {
+ "& .MuiFilledInput-root": {
+ paddingBottom: "72px",
+ backdropFilter:
+ "blur(9px) saturate(112%)",
+ WebkitBackdropFilter:
+ "blur(9px) saturate(112%)",
+ background:
+ "linear-gradient(160deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 58%, rgba(255, 255, 255, 0.015) 100%)",
+ boxShadow:
+ "0 12px 28px rgba(0, 0, 0, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.1)",
+ "&:hover": {
+ bgcolor: inputGlassBg,
+ borderColor: inputGlassBorder,
+ background:
+ "linear-gradient(160deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 58%, rgba(255, 255, 255, 0.015) 100%)",
+ boxShadow:
+ "0 12px 28px rgba(0, 0, 0, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.1)",
+ },
+ "&.Mui-focused": {
+ bgcolor: inputGlassBg,
+ borderColor: inputGlassBorder,
+ background:
+ "linear-gradient(160deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 58%, rgba(255, 255, 255, 0.015) 100%)",
+ boxShadow:
+ "0 12px 28px rgba(0, 0, 0, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.1)",
+ },
+ },
+ },
+ ]}
+ />
+ <Box
+ sx={{
+ position: "absolute",
+ left: 18,
+ right: 18,
+ bottom: 18,
+ display: "flex",
+ justifyContent: "space-between",
+ alignItems: "center",
+ gap: 1.2,
+ pointerEvents: "none",
+ }}
+ >
+ <Typography
+ variant="mini"
+ sx={{
+ color: "rgba(182, 197, 229, 0.44)",
+ fontWeight: 500,
+ }}
+ >
+ This paste has been removed from Ente servers.
+ </Typography>
+ <Button
+ variant="contained"
+ size="small"
+ disableElevation
+ onClick={() => {
+ void onCopyText(resolvedText);
+ }}
+ startIcon={
+ <ContentCopyRoundedIcon
+ sx={{ fontSize: 16 }}
+ />
+ }
+ sx={{
+ pointerEvents: "auto",
+ minHeight: 34,
+ px: 1.25,
+ borderRadius: "10px",
+ textTransform: "none",
+ fontWeight: 600,
+ fontSize: "0.78rem",
+ bgcolor: frameBlue,
+ color: "rgba(231, 238, 252, 0.9)",
+ boxShadow: "none",
+ "& .MuiButton-startIcon": { mr: 0.6 },
+ "&:hover": {
+ bgcolor: frameBlue,
+ boxShadow: "none",
+ },
+ }}
+ >
+ Copy
+ </Button>
+ </Box>
+ </Box>
+ </Stack>
+ )}
+ </>
+ );
+};
diff --git a/web/apps/paste/src/features/paste/hooks/useCreatePaste.ts b/web/apps/paste/src/features/paste/hooks/useCreatePaste.ts
index 2bfcfc4be1..e41a06807b 100644
--- a/web/apps/paste/src/features/paste/hooks/useCreatePaste.ts
+++ b/web/apps/paste/src/features/paste/hooks/useCreatePaste.ts
@@ -34,6 +34,7 @@ export const useCreatePaste = () => {
);
const response = await createPaste(payload);
setCreatedLink(buildPasteLink(response.accessToken, fragmentSecret));
+ setInputText("");
} catch (error) {
const message =
error instanceof Error ? error.message : "Failed to create paste";