Skip to content

armgit / ente

Public Imported from GitHub
0

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

feat(paste):ui-enhance

Aswin Asok0c95a7065a53
diff --git a/web/apps/paste/package.json b/web/apps/paste/package.json
index c12823c02c..d49af9d007 100644
--- a/web/apps/paste/package.json
+++ b/web/apps/paste/package.json
@@ -6,6 +6,8 @@
"build:post": "rm -f out/404.html"
},
"dependencies": {
+ "@hugeicons/core-free-icons": "^1.1.0",
+ "@hugeicons/react": "^1.1.4",
"ente-base": "*"
},
"devDependencies": {
diff --git a/web/apps/paste/public/arrow.json b/web/apps/paste/public/arrow.json
new file mode 100644
index 0000000000..903b7b0c86
--- /dev/null
+++ b/web/apps/paste/public/arrow.json
@@ -0,0 +1 @@
+{"nm":"Main Scene","ddd":0,"h":84,"w":150,"meta":{"g":"@lottiefiles/creator 1.78.1"},"layers":[{"ty":4,"nm":"Shape Layer 2","sr":1,"st":0,"op":480,"ip":0,"hd":false,"ddd":0,"bm":0,"hasMask":false,"ao":0,"ks":{"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[120.366,120.366,100],"ix":6},"sk":{"a":0,"k":0},"p":{"a":0,"k":[78.125,34.75],"ix":2},"r":{"a":0,"k":0,"ix":10},"sa":{"a":0,"k":0},"o":{"a":0,"k":100,"ix":11}},"shapes":[{"ty":"gr","bm":0,"hd":false,"mn":"ADBE Vector Group","nm":"Shape 2","ix":1,"cix":2,"np":4,"it":[{"ty":"sh","bm":0,"hd":false,"mn":"ADBE Vector Shape - Group","nm":"Path 1","ix":1,"d":1,"ks":{"a":0,"k":{"c":false,"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[-59.969,-3.304],[-51.469,-18.304]]},"ix":2}},{"ty":"tm","bm":0,"hd":false,"mn":"ADBE Vector Filter - Trim","nm":"Trim Paths 1","ix":2,"e":{"a":0,"k":100,"ix":2},"o":{"a":0,"k":0,"ix":3},"s":{"a":1,"k":[{"o":{"x":0.29,"y":0},"i":{"x":0.84,"y":1},"s":[100],"t":29},{"s":[0],"t":33}],"ix":1},"m":1},{"ty":"st","bm":0,"hd":false,"mn":"ADBE Vector Graphic - Stroke","nm":"Stroke 1","lc":2,"lj":2,"ml":1,"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":4,"ix":5},"c":{"a":0,"k":[1,1,1],"ix":3}},{"ty":"tr","a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"sk":{"a":0,"k":0,"ix":4},"p":{"a":0,"k":[0,0],"ix":2},"r":{"a":0,"k":0,"ix":6},"sa":{"a":0,"k":0,"ix":5},"o":{"a":0,"k":100,"ix":7}}]},{"ty":"gr","bm":0,"hd":false,"mn":"ADBE Vector Group","nm":"Shape 1","ix":2,"cix":2,"np":3,"it":[{"ty":"sh","bm":0,"hd":false,"mn":"ADBE Vector Shape - Group","nm":"Path 1","ix":1,"d":1,"ks":{"a":0,"k":{"c":false,"i":[[0,0],[-1.461,39.663],[-5.503,-21.447],[34.425,-3.569],[-0.964,8.679],[0,0]],"o":[[0,0],[0.766,-20.789],[1.12,4.366],[-30.132,3.124],[0.125,-0.5],[0,0]],"v":[[55.5,31.5],[-9.858,-2.485],[29.908,-5.761],[-1.75,24.5],[-51.5,-18.335],[-36.25,-9.375]]},"ix":2}},{"ty":"st","bm":0,"hd":false,"mn":"ADBE Vector Graphic - Stroke","nm":"Stroke 1","lc":2,"lj":1,"ml":4,"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":4,"ix":5},"c":{"a":0,"k":[1,1,1],"ix":3}},{"ty":"tr","a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"sk":{"a":0,"k":0,"ix":4},"p":{"a":0,"k":[0,0],"ix":2},"r":{"a":0,"k":0,"ix":6},"sa":{"a":0,"k":0,"ix":5},"o":{"a":0,"k":100,"ix":7}}]},{"ty":"tm","bm":0,"hd":false,"mn":"ADBE Vector Filter - Trim","nm":"Trim Paths 1","ix":3,"e":{"a":1,"k":[{"o":{"x":0.549,"y":0},"i":{"x":0.352,"y":1.044},"s":[0],"t":0},{"s":[100],"t":31}],"ix":2},"o":{"a":0,"k":0,"ix":3},"s":{"a":0,"k":0,"ix":1},"m":1}],"ind":1}],"v":"5.7.0","fr":30,"op":40,"ip":0,"assets":[]}
\ No newline at end of file
diff --git a/web/apps/paste/src/features/paste/components/PasteCreatePanel.tsx b/web/apps/paste/src/features/paste/components/PasteCreatePanel.tsx
index 393ae3906a..b7b31f8112 100644
--- a/web/apps/paste/src/features/paste/components/PasteCreatePanel.tsx
+++ b/web/apps/paste/src/features/paste/components/PasteCreatePanel.tsx
@@ -1,4 +1,6 @@
-import { Box, Button, TextField, Typography } from "@mui/material";
+import { Navigation06Icon } from "@hugeicons/core-free-icons";
+import { HugeiconsIcon } from "@hugeicons/react";
+import { Box, IconButton, TextField, Typography } from "@mui/material";
import { MAX_PASTE_CHARS } from "../constants";
import { PasteLinkCard } from "./PasteLinkCard";
import { pasteTextFieldSx } from "./textFieldSx";
@@ -23,62 +25,221 @@ export const PasteCreatePanel = ({
onCreate,
onCopyLink,
onShareLink,
-}: PasteCreatePanelProps) => (
- <>
- <TextField
- variant="filled"
- hiddenLabel
- slotProps={{
- input: { disableUnderline: true },
- htmlInput: { maxLength: MAX_PASTE_CHARS },
- }}
- multiline
- minRows={10}
- placeholder="Paste text (keys, snippets, notes, instructions...)"
- value={inputText}
- onChange={(event) => {
- onInputChange(event.target.value);
+}: PasteCreatePanelProps) => {
+ const isInputEmpty = inputText.trim().length === 0;
+ const frameBlue = "#2f6df7";
+ const inputGlassBg = "rgba(39, 42, 52, 0.76)";
+ const inputGlassBorder = "rgba(213, 225, 255, 0.14)";
+ const nearLimitThreshold = Math.floor(MAX_PASTE_CHARS * 0.9);
+ const isNearCharLimit = inputText.length >= nearLimitThreshold;
+ const mutedCounterColor = "rgba(234, 238, 255, 0.6)";
+ const softBlueCounterColor = "rgba(204, 224, 255, 0.96)";
+
+ return (
+ <>
+ <Box
+ sx={{
+ position: "relative",
+ width: "100%",
}}
- sx={pasteTextFieldSx()}
- />
+ >
+ <TextField
+ variant="filled"
+ hiddenLabel
+ fullWidth
+ slotProps={{
+ input: { disableUnderline: true },
+ htmlInput: { maxLength: MAX_PASTE_CHARS },
+ }}
+ multiline
+ minRows={5}
+ maxRows={12}
+ placeholder="Paste text (keys, snippets, notes, instructions...)"
+ value={inputText}
+ onChange={(event) => {
+ onInputChange(event.target.value);
+ }}
+ sx={[
+ pasteTextFieldSx(
+ "20px",
+ inputGlassBg,
+ inputGlassBorder,
+ ),
+ {
+ "& .MuiFilledInput-root": {
+ paddingBottom: "84px",
+ 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)",
+ },
+ },
+ "& .MuiInputBase-input": {
+ fontSize: "1.05rem",
+ lineHeight: 1.6,
+ },
+ },
+ ]}
+ />
+ <Box
+ sx={{
+ position: "absolute",
+ left: 18,
+ right: 18,
+ bottom: 18,
+ display: "flex",
+ justifyContent: "space-between",
+ alignItems: "center",
+ gap: 2,
+ pointerEvents: "none",
+ }}
+ >
+ <Typography
+ variant="mini"
+ sx={{
+ display: "flex",
+ alignItems: "center",
+ height: 44,
+ color: mutedCounterColor,
+ fontWeight: 600,
+ lineHeight: 1,
+ letterSpacing: "0.01em",
+ }}
+ >
+ <Box
+ component="span"
+ sx={{
+ color: isNearCharLimit
+ ? softBlueCounterColor
+ : mutedCounterColor,
+ }}
+ >
+ {inputText.length}
+ </Box>
+ <Box component="span" sx={{ color: mutedCounterColor }}>
+ /{MAX_PASTE_CHARS}
+ </Box>
+ </Typography>
+ <IconButton
+ aria-label="Create secure link"
+ onClick={() => {
+ void onCreate();
+ }}
+ disabled={creating || isInputEmpty}
+ sx={{
+ pointerEvents: "auto",
+ width: 44,
+ height: 44,
+ borderRadius: "14px",
+ bgcolor: frameBlue,
+ color: "#f4f7ff",
+ boxShadow: "none",
+ "&:hover": {
+ bgcolor: frameBlue,
+ boxShadow: "none",
+ },
+ "&.Mui-disabled": {
+ bgcolor: isInputEmpty
+ ? "rgba(255, 255, 255, 0.18)"
+ : "rgba(47, 109, 247, 0.45)",
+ color: isInputEmpty
+ ? "rgba(230, 236, 255, 0.44)"
+ : "rgba(244, 247, 255, 0.72)",
+ },
+ }}
+ >
+ <Box
+ sx={{
+ transform: "rotate(90deg)",
+ display: "flex",
+ }}
+ >
+ <HugeiconsIcon
+ icon={Navigation06Icon}
+ size={20}
+ strokeWidth={2}
+ />
+ </Box>
+ </IconButton>
+ </Box>
+ </Box>
<Box
sx={{
+ mt: { xs: "84px", md: "116px" },
display: "flex",
- justifyContent: "space-between",
+ flexDirection: "column",
alignItems: "center",
+ textAlign: "center",
}}
>
- <Typography variant="mini" color="text.muted">
- {inputText.length}/{MAX_PASTE_CHARS}
- </Typography>
- <Button
- variant="contained"
- onClick={() => {
- void onCreate();
- }}
- disabled={creating}
+ <Typography
sx={{
- textTransform: "none",
- borderRadius: "14px",
- bgcolor: "accent.main",
- color: "accent.contrastText",
- "&:hover": {
- bgcolor: "accent.dark",
- },
+ color: "rgba(220, 229, 255, 0.62)",
+ fontSize: "0.86rem",
+ fontWeight: 500,
+ lineHeight: 1.4,
+ maxWidth: 520,
+ mb: "3rem",
}}
>
- {creating ? "Creating..." : "Create secure link"}
- </Button>
+ 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>
</Box>
{createError && <Typography color="error">{createError}</Typography>}
{createdLink && (
- <PasteLinkCard
- link={createdLink}
- onCopy={onCopyLink}
- onShare={onShareLink}
- />
+ <Box sx={{ mt: { xs: 4.4, sm: 5.2 } }}>
+ <PasteLinkCard
+ link={createdLink}
+ onCopy={onCopyLink}
+ onShare={onShareLink}
+ />
+ </Box>
)}
- </>
-);
+ </>
+ );
+};
diff --git a/web/apps/paste/src/features/paste/components/PasteFooter.tsx b/web/apps/paste/src/features/paste/components/PasteFooter.tsx
index af5c0a0cb0..197d913f05 100644
--- a/web/apps/paste/src/features/paste/components/PasteFooter.tsx
+++ b/web/apps/paste/src/features/paste/components/PasteFooter.tsx
@@ -7,7 +7,7 @@ const footerLinkStyle = {
};
export const PasteFooter = () => (
- <Stack spacing={1.25} alignItems="center">
+ <Stack spacing={1.1} alignItems="center">
<a
href="https://ente.io"
target="_blank"
@@ -21,16 +21,22 @@ export const PasteFooter = () => (
>
<Box
sx={{
- color: "accent.main",
- "& svg": { color: "accent.main" },
- "& svg path": { fill: "accent.main" },
+ color: "#2f6df7",
+ "& svg": { color: "#2f6df7" },
+ "& svg path": { fill: "#2f6df7" },
}}
>
- <EnteLogo height={20} />
+ <EnteLogo height={28} />
</Box>
</a>
- <Typography variant="mini" color="text.muted">
+ <Typography
+ variant="mini"
+ sx={{
+ color: "rgba(230, 236, 255, 0.56)",
+ fontWeight: 600,
+ }}
+ >
<a
href="https://ente.io/photos"
target="_blank"
diff --git a/web/apps/paste/src/features/paste/components/PasteFrame.tsx b/web/apps/paste/src/features/paste/components/PasteFrame.tsx
index 1d8d509363..7d54e6055c 100644
--- a/web/apps/paste/src/features/paste/components/PasteFrame.tsx
+++ b/web/apps/paste/src/features/paste/components/PasteFrame.tsx
@@ -1,4 +1,5 @@
-import { Box } from "@mui/material";
+import GitHubIcon from "@mui/icons-material/GitHub";
+import { Box, IconButton, Typography } from "@mui/material";
import type { ReactNode } from "react";
interface PasteFrameProps {
@@ -10,57 +11,106 @@ export const PasteFrame = ({ children, footer }: PasteFrameProps) => (
<Box
sx={{
minHeight: "100dvh",
- bgcolor: "accent.main",
+ bgcolor: "#2f6df7",
+ fontFamily: '"Inter Variable", sans-serif',
display: "flex",
flexDirection: "column",
alignItems: "center",
- p: { xs: 1, md: 3 },
+ p: { xs: 1.25, md: 2 },
boxSizing: "border-box",
}}
>
<Box
sx={{
+ position: "relative",
minHeight: {
- xs: "calc(100dvh - 16px)",
- md: "calc(100dvh - 48px)",
+ xs: "calc(100dvh - 20px)",
+ md: "calc(100dvh - 32px)",
},
flex: 1,
width: "100%",
- bgcolor: "background.default",
- borderRadius: { xs: "20px", md: "40px" },
+ bgcolor: "#0d1016",
+ borderRadius: { xs: "24px", md: "34px" },
display: "grid",
- gridTemplateRows: "1fr auto",
+ gridTemplateRows: "auto 1fr auto",
alignItems: "stretch",
+ boxShadow: "inset 0 0 0 1px rgba(255, 255, 255, 0.04)",
"& ::selection": {
- backgroundColor: "accent.main",
- color: "fixed.white",
+ backgroundColor: "#2f6df7",
+ color: "#ffffff",
},
"& ::-moz-selection": {
- backgroundColor: "accent.main",
- color: "fixed.white",
+ backgroundColor: "#2f6df7",
+ color: "#ffffff",
},
}}
>
<Box
sx={{
width: "100%",
- maxWidth: 760,
- mx: "auto",
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "space-between",
+ px: { xs: 3, md: 4.5 },
+ pt: { xs: 3, md: 3.5 },
+ }}
+ >
+ <Typography
+ sx={{
+ fontSize: { xs: "1.5rem", md: "1.75rem" },
+ lineHeight: 1.05,
+ fontWeight: 700,
+ color: "#f4f7ff",
+ }}
+ >
+ Ente Paste
+ </Typography>
+ <IconButton
+ component="a"
+ href="https://github.com/ente-io/ente"
+ target="_blank"
+ rel="noopener noreferrer"
+ aria-label="View source on GitHub"
+ sx={{
+ width: 42,
+ height: 42,
+ bgcolor: "transparent",
+ color: "#f4f7ff",
+ "&:hover": {
+ bgcolor: "rgba(255, 255, 255, 0.12)",
+ },
+ }}
+ >
+ <GitHubIcon sx={{ fontSize: 30 }} />
+ </IconButton>
+ </Box>
+ <Box
+ sx={{
+ width: "100%",
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "center",
px: { xs: 3, md: 5 },
- pb: { xs: 2, md: 2.5 },
- mt: { xs: 4, md: 5 },
+ py: { xs: 2, md: 3 },
}}
>
- {children}
+ <Box
+ sx={{
+ width: "100%",
+ maxWidth: 700,
+ }}
+ >
+ {children}
+ </Box>
</Box>
<Box
sx={{
width: "100%",
- maxWidth: 760,
+ maxWidth: 700,
mx: "auto",
px: { xs: 3, md: 5 },
pt: { xs: 2, md: 2.5 },
- pb: { xs: 3, md: 3.5 },
+ pb: { xs: 3, md: 3.25 },
}}
>
{footer}
diff --git a/web/apps/paste/src/features/paste/components/PasteHero.tsx b/web/apps/paste/src/features/paste/components/PasteHero.tsx
index 0d76ae1a79..539059e2d8 100644
--- a/web/apps/paste/src/features/paste/components/PasteHero.tsx
+++ b/web/apps/paste/src/features/paste/components/PasteHero.tsx
@@ -1,38 +1,14 @@
-import { Chip, Stack, Typography } from "@mui/material";
+import { Typography } from "@mui/material";
export const PasteHero = () => (
- <>
- <Typography variant="h3" sx={{ fontWeight: 700, color: "text.base" }}>
- Ente Paste
- </Typography>
- <Typography color="text.muted">
- End-to-end encrypted paste sharing for quick, sensitive text. We
- cannot read your content.
- </Typography>
- <Stack direction="row" spacing={1} flexWrap="wrap" useFlexGap>
- <Chip variant="outlined" label="24 hour retention max" />
- <Chip variant="outlined" label="One-time view" />
- <Chip variant="outlined" label="Purged after open" />
- <Chip
- variant="filled"
- label="Open source"
- component="a"
- href="https://github.com/ente-io/ente"
- target="_blank"
- rel="noopener"
- clickable
- sx={{
- textDecoration: "none",
- bgcolor: "accent.main",
- color: "fixed.white",
- border: "1px solid",
- borderColor: "accent.main",
- "&:hover": {
- bgcolor: "accent.dark",
- borderColor: "accent.dark",
- },
- }}
- />
- </Stack>
- </>
+ <Typography
+ sx={{
+ fontSize: { xs: "2rem", md: "2.3rem" },
+ lineHeight: 1.05,
+ fontWeight: 700,
+ color: "#f4f7ff",
+ }}
+ >
+ Ente Paste
+ </Typography>
);
diff --git a/web/apps/paste/src/features/paste/components/PasteLinkCard.tsx b/web/apps/paste/src/features/paste/components/PasteLinkCard.tsx
index d7338074df..bbf8d75628 100644
--- a/web/apps/paste/src/features/paste/components/PasteLinkCard.tsx
+++ b/web/apps/paste/src/features/paste/components/PasteLinkCard.tsx
@@ -1,6 +1,7 @@
-import { Button, Stack, TextField, Typography } from "@mui/material";
-import { useEffect, useRef } from "react";
-import { pasteTextFieldSx } from "./textFieldSx";
+import { Link01Icon } from "@hugeicons/core-free-icons";
+import { HugeiconsIcon } from "@hugeicons/react";
+import { Box, Stack, Typography } from "@mui/material";
+import { useEffect, useRef, useState } from "react";
interface PasteLinkCardProps {
link: string;
@@ -8,8 +9,149 @@ interface PasteLinkCardProps {
onShare: (url: string) => Promise<void>;
}
+type LottiePoint = [number, number];
+
+type LottieShapePath = {
+ c: boolean;
+ i: LottiePoint[];
+ o: LottiePoint[];
+ v: LottiePoint[];
+};
+
+type ParsedArrowPath = {
+ color: string;
+ d: string;
+ lineCap: "butt" | "round" | "square";
+ lineJoin: "miter" | "round" | "bevel";
+ name: string;
+ strokeScale: number;
+ width: number;
+};
+
+type ParsedArrow = {
+ height: number;
+ paths: ParsedArrowPath[];
+ transform: string;
+ width: number;
+};
+
+type MeasuredPath = {
+ len: number;
+ parsed: ParsedArrowPath;
+ path: SVGPathElement;
+};
+
+const safePoint = (point?: LottiePoint): [number, number] => [
+ point?.[0] ?? 0,
+ point?.[1] ?? 0,
+];
+
+const toPathD = (shape: LottieShapePath) => {
+ if (!shape?.v?.length) return "";
+
+ const { c, i, o, v } = shape;
+ const [startX, startY] = safePoint(v[0]);
+ let d = `M ${startX} ${startY}`;
+
+ for (let idx = 1; idx < v.length; idx++) {
+ const [prevX, prevY] = safePoint(v[idx - 1]);
+ const [currX, currY] = safePoint(v[idx]);
+ const [prevOutX, prevOutY] = safePoint(o[idx - 1]);
+ const [currInX, currInY] = safePoint(i[idx]);
+ const hasCurve =
+ prevOutX !== 0 || prevOutY !== 0 || currInX !== 0 || currInY !== 0;
+
+ if (hasCurve) {
+ d += ` C ${prevX + prevOutX} ${prevY + prevOutY} ${
+ currX + currInX
+ } ${currY + currInY} ${currX} ${currY}`;
+ } else {
+ d += ` L ${currX} ${currY}`;
+ }
+ }
+
+ if (c) {
+ const lastIdx = v.length - 1;
+ const [prevX, prevY] = safePoint(v[lastIdx]);
+ const [currX, currY] = safePoint(v[0]);
+ const [prevOutX, prevOutY] = safePoint(o[lastIdx]);
+ const [currInX, currInY] = safePoint(i[0]);
+ const hasCurve =
+ prevOutX !== 0 || prevOutY !== 0 || currInX !== 0 || currInY !== 0;
+
+ if (hasCurve) {
+ d += ` C ${prevX + prevOutX} ${prevY + prevOutY} ${
+ currX + currInX
+ } ${currY + currInY} ${currX} ${currY}`;
+ } else {
+ d += ` L ${currX} ${currY}`;
+ }
+ d += " Z";
+ }
+
+ return d;
+};
+
+const toLineCap = (value: number): ParsedArrowPath["lineCap"] =>
+ value === 2 ? "round" : value === 3 ? "square" : "butt";
+
+const toLineJoin = (value: number): ParsedArrowPath["lineJoin"] =>
+ value === 2 ? "round" : value === 3 ? "bevel" : "miter";
+
+const toRGB = (rgb: number[]) => {
+ const r = Number(rgb?.[0] ?? 1);
+ const g = Number(rgb?.[1] ?? 1);
+ const b = Number(rgb?.[2] ?? 1);
+ return `rgb(${Math.round(r * 255)} ${Math.round(g * 255)} ${Math.round(b * 255)})`;
+};
+
+const parseArrowLottie = (lottie: any): ParsedArrow | null => {
+ const layer = lottie?.layers?.[0];
+ if (!layer?.shapes?.length) return null;
+
+ const sx = (Number(layer?.ks?.s?.k?.[0] ?? 100) || 100) / 100;
+ const sy = (Number(layer?.ks?.s?.k?.[1] ?? layer?.ks?.s?.k?.[0] ?? 100) || 100) / 100;
+ const px = Number(layer?.ks?.p?.k?.[0] ?? 0) || 0;
+ const py = Number(layer?.ks?.p?.k?.[1] ?? 0) || 0;
+
+ const paths: ParsedArrowPath[] = [];
+ for (const group of layer.shapes) {
+ if (group?.ty !== "gr" || !Array.isArray(group?.it)) continue;
+
+ const shape = group.it.find((item: any) => item?.ty === "sh")?.ks
+ ?.k as LottieShapePath | undefined;
+ const stroke = group.it.find((item: any) => item?.ty === "st");
+ if (!shape || !stroke) continue;
+
+ const groupName = String(group?.nm ?? "");
+ const d = toPathD(shape as LottieShapePath);
+ if (!d) continue;
+
+ paths.push({
+ color: toRGB(stroke?.c?.k),
+ d,
+ lineCap: toLineCap(Number(stroke?.lc ?? 1)),
+ lineJoin: toLineJoin(Number(stroke?.lj ?? 1)),
+ name: groupName,
+ strokeScale: 0.58,
+ width: Number(stroke?.w?.k ?? 2),
+ });
+ }
+
+ if (!paths.length) return null;
+
+ return {
+ height: Number(lottie?.h ?? 84) || 84,
+ paths,
+ transform: `translate(${px} ${py}) scale(${sx} ${sy})`,
+ width: Number(lottie?.w ?? 150) || 150,
+ };
+};
+
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);
useEffect(() => {
const linkCard = linkCardRef.current;
@@ -31,63 +173,288 @@ export const PasteLinkCard = ({ link, onCopy, onShare }: PasteLinkCardProps) =>
});
}, [link]);
+ useEffect(() => {
+ let cancelled = false;
+
+ const loadArrow = async () => {
+ try {
+ const response = await fetch("/arrow.json");
+ if (!response.ok) return;
+
+ const json = await response.json();
+ if (cancelled) return;
+
+ const parsed = parseArrowLottie(json);
+ if (!cancelled) setArrow(parsed);
+ } catch {
+ // No-op: The link row works without the hint animation.
+ }
+ };
+
+ void loadArrow();
+
+ return () => {
+ cancelled = true;
+ };
+ }, []);
+
+ useEffect(() => {
+ const svg = arrowSvgRef.current;
+ if (!arrow || !svg) return;
+
+ const paths = Array.from(
+ svg.querySelectorAll<SVGPathElement>('path[data-arrow-path="true"]'),
+ );
+ if (!paths.length) return;
+
+ const prefersReducedMotion = window.matchMedia(
+ "(prefers-reduced-motion: reduce)",
+ ).matches;
+
+ const measured = paths
+ .map((path) => {
+ const idx = Number(path.dataset.arrowIndex ?? -1);
+ const parsed = arrow.paths[idx];
+ return {
+ len: Math.max(path.getTotalLength(), 1),
+ parsed,
+ path,
+ };
+ })
+ .filter(
+ (item): item is MeasuredPath =>
+ item.parsed !== undefined && item.parsed !== null,
+ );
+
+ for (const { path, len, parsed } of measured) {
+ const isSecondaryStroke = /shape\s*2/i.test(parsed.name);
+ path.style.strokeDasharray = `${len} ${len}`;
+ path.style.strokeDashoffset = prefersReducedMotion
+ ? "0"
+ : `${isSecondaryStroke ? -len : len}`;
+ }
+
+ if (prefersReducedMotion) return;
+
+ const animations: Animation[] = [];
+ measured.forEach(({ path, len, parsed }) => {
+ const isSecondaryStroke = /shape\s*2/i.test(parsed.name);
+ const startOffset = isSecondaryStroke ? -len : len;
+ const keyframes: Keyframe[] = isSecondaryStroke
+ ? [
+ { strokeDashoffset: startOffset, offset: 0 },
+ { strokeDashoffset: startOffset, offset: 0.72 },
+ { strokeDashoffset: 0, offset: 0.93 },
+ { strokeDashoffset: 0, offset: 1 },
+ ]
+ : [
+ { strokeDashoffset: startOffset, offset: 0 },
+ { strokeDashoffset: startOffset, offset: 0.02 },
+ { strokeDashoffset: 0, offset: 0.78 },
+ { strokeDashoffset: 0, offset: 1 },
+ ];
+
+ animations.push(
+ path.animate(keyframes, {
+ duration: 1400,
+ iterations: 1,
+ fill: "forwards",
+ easing: "linear",
+ }),
+ );
+ });
+
+ return () => {
+ animations.forEach((anim) => anim.cancel());
+ };
+ }, [arrow]);
+
return (
<Stack
ref={linkCardRef}
- spacing={2}
+ spacing={1}
sx={{
- p: 2.5,
- borderRadius: "20px",
- bgcolor: "background.paper",
- border: "1px solid",
- borderColor: "stroke.muted",
scrollMarginTop: {
xs: "16px",
md: "24px",
},
}}
>
- <Typography sx={{ fontWeight: 600 }}>Your one-time link</Typography>
- <TextField
- variant="filled"
- hiddenLabel
- value={link}
- multiline
- minRows={2}
- slotProps={{
- input: {
- readOnly: true,
- disableUnderline: true,
- },
- }}
- sx={pasteTextFieldSx("12px", "background.default", "stroke.muted")}
- />
- <Stack direction={{ xs: "column", sm: "row" }} spacing={1}>
- <Button
- variant="outlined"
- onClick={() => {
- void onCopy(link);
- }}
+ <Stack
+ direction={{ xs: "column", sm: "row" }}
+ spacing={1}
+ alignItems={{ xs: "stretch", sm: "center" }}
+ sx={{ minWidth: 0 }}
+ >
+ <Box
sx={{
- textTransform: "none",
- borderRadius: "12px",
+ flex: 1,
+ minWidth: 0,
+ px: { xs: 1.9, sm: 2.2 },
+ py: { xs: 1.05, sm: 1.2 },
+ borderRadius: "14px",
+ border: "1px solid rgba(214, 226, 255, 0.16)",
+ bgcolor: "rgba(255, 255, 255, 0.05)",
+ backdropFilter: "blur(8px) saturate(108%)",
+ WebkitBackdropFilter: "blur(8px) saturate(108%)",
+ boxShadow: "inset 0 1px 0 rgba(255, 255, 255, 0.08)",
}}
>
- Copy
- </Button>
- <Button
- variant="outlined"
- onClick={() => {
- void onShare(link);
- }}
- sx={{
- textTransform: "none",
- borderRadius: "12px",
- }}
- >
- Share
- </Button>
+ <Typography
+ component="a"
+ href={link}
+ target="_blank"
+ rel="noopener noreferrer"
+ title={link}
+ sx={{
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "center",
+ gap: 0.9,
+ minWidth: 0,
+ color: "rgba(244, 247, 255, 0.9)",
+ textDecoration: "none",
+ fontSize: "0.93rem",
+ lineHeight: 1.4,
+ textAlign: "center",
+ overflow: "hidden",
+ textOverflow: "ellipsis",
+ whiteSpace: "nowrap",
+ "&:hover": {
+ textDecoration: "underline",
+ color: "rgba(244, 247, 255, 1)",
+ },
+ }}
+ >
+ <HugeiconsIcon
+ icon={Link01Icon}
+ size={17}
+ strokeWidth={1.9}
+ />
+ <Box
+ component="span"
+ sx={{
+ minWidth: 0,
+ overflow: "hidden",
+ textOverflow: "ellipsis",
+ whiteSpace: "nowrap",
+ display: "block",
+ }}
+ >
+ {link}
+ </Box>
+ </Typography>
+ </Box>
</Stack>
+ <Box
+ sx={{
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "flex-start",
+ gap: { xs: 0.75, sm: 1.1 },
+ pl: { xs: 0, sm: 0.5 },
+ mt: { xs: 0.8, sm: 1.1 },
+ opacity: 0.9,
+ }}
+ >
+ {arrow && (
+ <Box
+ sx={{
+ width: { xs: 132, sm: 178, md: 212 },
+ height: "auto",
+ transform: "rotate(28deg)",
+ transformOrigin: "50% 50%",
+ pointerEvents: "none",
+ }}
+ >
+ <svg
+ ref={arrowSvgRef}
+ viewBox={`0 0 ${arrow.width} ${arrow.height}`}
+ width="100%"
+ height="100%"
+ fill="none"
+ aria-hidden="true"
+ focusable="false"
+ >
+ <g transform={arrow.transform}>
+ {arrow.paths.map((path, idx) => (
+ <path
+ key={`${path.d}-${idx}`}
+ data-arrow-path="true"
+ data-arrow-index={idx}
+ d={path.d}
+ fill="none"
+ stroke={path.color}
+ strokeWidth={path.width * path.strokeScale}
+ strokeLinecap={path.lineCap}
+ strokeLinejoin={path.lineJoin}
+ />
+ ))}
+ </g>
+ </svg>
+ </Box>
+ )}
+ <Stack
+ direction="row"
+ spacing={{ xs: 2.7, sm: 3.2 }}
+ alignItems="flex-end"
+ >
+ <Typography
+ component="button"
+ onClick={() => {
+ void onShare(link);
+ }}
+ 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(-3px) rotate(-3deg)", sm: "translateY(-4px) rotate(-4deg)" },
+ "&:hover": {
+ color: "#2f6df7",
+ textDecoration: "underline",
+ textUnderlineOffset: "3px",
+ },
+ }}
+ >
+ Share
+ </Typography>
+ <Typography
+ component="button"
+ onClick={() => {
+ void onCopy(link);
+ }}
+ 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": {
+ color: "#2f6df7",
+ textDecoration: "underline",
+ textUnderlineOffset: "3px",
+ },
+ }}
+ >
+ Copy
+ </Typography>
+ </Stack>
+ </Box>
</Stack>
);
};
diff --git a/web/apps/paste/src/features/paste/components/textFieldSx.ts b/web/apps/paste/src/features/paste/components/textFieldSx.ts
index dc289bf661..14c3fa29b9 100644
--- a/web/apps/paste/src/features/paste/components/textFieldSx.ts
+++ b/web/apps/paste/src/features/paste/components/textFieldSx.ts
@@ -1,7 +1,7 @@
export const pasteTextFieldSx = (
radius = "16px",
- bgColor = "background.paper2",
- borderColor = "stroke.faint",
+ bgColor = "#24262c",
+ borderColor = "rgba(255, 255, 255, 0.12)",
) => ({
margin: 0,
"& .MuiFilledInput-root": {
@@ -11,14 +11,25 @@ export const pasteTextFieldSx = (
borderColor,
alignItems: "flex-start",
boxSizing: "border-box",
- padding: "10px 12px",
+ color: "#f4f7ff",
+ padding: "14px",
+ transition: "border-color 180ms ease, box-shadow 180ms ease",
"&:before": { display: "none" },
"&:after": { display: "none" },
"&:hover:not(.Mui-disabled, .Mui-error):before": { display: "none" },
"&:hover": { bgcolor: bgColor },
- "&.Mui-focused": { bgcolor: bgColor, borderColor: "accent.main" },
+ "&.Mui-focused": {
+ bgcolor: bgColor,
+ borderColor: "#2f6df7",
+ boxShadow: "0 0 0 2px rgba(47, 109, 247, 0.24)",
+ },
+ },
+ "& .MuiInputBase-input": {
+ padding: "0 !important",
+ color: "#f4f7ff",
+ fontSize: "1.02rem",
+ lineHeight: 1.55,
},
- "& .MuiInputBase-input": { padding: "0 !important" },
"& .MuiInputBase-inputMultiline": {
padding: "0 !important",
margin: "0 !important",
@@ -27,5 +38,13 @@ export const pasteTextFieldSx = (
padding: "0 !important",
margin: "0 !important",
},
- "& textarea": { padding: "0 !important", margin: "0 !important" },
+ "& textarea": {
+ padding: "0 !important",
+ margin: "0 !important",
+ overflowY: "auto",
+ },
+ "& textarea::placeholder": {
+ color: "rgba(230, 236, 255, 0.42)",
+ opacity: 1,
+ },
});
diff --git a/web/apps/paste/src/pages/index.tsx b/web/apps/paste/src/pages/index.tsx
index 6c3a6a5455..1a3927c67b 100644
--- a/web/apps/paste/src/pages/index.tsx
+++ b/web/apps/paste/src/pages/index.tsx
@@ -3,7 +3,6 @@ import Head from "next/head";
import { PasteCreatePanel } from "features/paste/components/PasteCreatePanel";
import { PasteFooter } from "features/paste/components/PasteFooter";
import { PasteFrame } from "features/paste/components/PasteFrame";
-import { PasteHero } from "features/paste/components/PasteHero";
import { PasteViewPanel } from "features/paste/components/PasteViewPanel";
import { useConsumePaste } from "features/paste/hooks/useConsumePaste";
import { useCreatePaste } from "features/paste/hooks/useCreatePaste";
@@ -37,12 +36,27 @@ const Page = () => {
name="description"
content="Share sensitive text with one-time, end-to-end encrypted links that auto-expire after 24 hours."
/>
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
+ <link
+ rel="preconnect"
+ href="https://fonts.gstatic.com"
+ crossOrigin="anonymous"
+ />
+ <link
+ href="https://fonts.googleapis.com/css2?family=Gochi+Hand&display=swap"
+ rel="stylesheet"
+ />
</Head>
<PasteFrame footer={<PasteFooter />}>
- <Stack spacing={2.5}>
- <PasteHero />
-
+ <Stack
+ spacing={2.5}
+ sx={{
+ width: "100%",
+ maxWidth: { xs: "100%", md: 620 },
+ mx: "auto",
+ }}
+ >
{mode === "create" && (
<PasteCreatePanel
inputText={inputText}