π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Format twoof3 files for web lint
Manav Rathiffcc6abd0d30
diff --git a/web/apps/twoof3/src/features/twoof3/utils/export.ts b/web/apps/twoof3/src/features/twoof3/utils/export.tsindex 8a2ac64aff..248cef793d 100644--- a/web/apps/twoof3/src/features/twoof3/utils/export.ts+++ b/web/apps/twoof3/src/features/twoof3/utils/export.ts@@ -72,7 +72,8 @@ const wrapCanvasTextToWidth = (if (overflowIndex <= 0) return null;const whitespaceIndex = remaining.lastIndexOf(" ", overflowIndex - 1);- const splitIndex = whitespaceIndex > 0 ? whitespaceIndex : overflowIndex;+ const splitIndex =+ whitespaceIndex > 0 ? whitespaceIndex : overflowIndex;const line = remaining.slice(0, splitIndex).trimEnd();if (!line) return null;@@ -96,18 +97,16 @@ const fitTitleLayout = (const lines = wrapCanvasTextToWidth(context, title, maxWidth, maxLines);if (!lines) continue;- return {- fontSize,- lineHeight: Math.round(fontSize * 1.14),- lines,- };+ return { fontSize, lineHeight: Math.round(fontSize * 1.14), lines };}context.font = '700 34px "Space Grotesk", sans-serif';return {fontSize: 34,lineHeight: 39,- lines: wrapCanvasTextToWidth(context, title, maxWidth, maxLines) ?? [title],+ lines: wrapCanvasTextToWidth(context, title, maxWidth, maxLines) ?? [+ title,+ ],};};diff --git a/web/apps/twoof3/src/features/twoof3/utils/offlineQrSource.ts b/web/apps/twoof3/src/features/twoof3/utils/offlineQrSource.tsindex 0cb16538c0..e123e592c4 100644--- a/web/apps/twoof3/src/features/twoof3/utils/offlineQrSource.ts+++ b/web/apps/twoof3/src/features/twoof3/utils/offlineQrSource.ts@@ -19,7 +19,10 @@ const toStandaloneDecodeSource = (source: string) =>["const decodeQR = (() => {",stripSourceMapComment(source)- .replace(/^import \{ Bitmap, utils \} from "\.\/index\.js";\n?/mu, "")+ .replace(+ /^import \{ Bitmap, utils \} from "\.\/index\.js";\n?/mu,+ "",+ ).replace(/^export function decodeQR\(/mu, "function decodeQR(").replace(/^export default decodeQR;\n?/mu, "").replace(/^export const _tests = /mu, "const qrDecodeTests = "),@@ -31,6 +34,6 @@ export const OFFLINE_QR_DECODER_SOURCE = ["(() => {",toStandaloneIndexSource(qrIndexModuleSource),toStandaloneDecodeSource(qrDecodeModuleSource),- 'globalThis.__twoOf3DecodeQR = decodeQR;',+ "globalThis.__twoOf3DecodeQR = decodeQR;","})();",].join("\n\n");diff --git a/web/apps/twoof3/src/features/twoof3/utils/qrCode.ts b/web/apps/twoof3/src/features/twoof3/utils/qrCode.tsindex 4ff4807d09..c7345ec61c 100644--- a/web/apps/twoof3/src/features/twoof3/utils/qrCode.ts+++ b/web/apps/twoof3/src/features/twoof3/utils/qrCode.ts@@ -165,10 +165,7 @@ const decodeQrImage = async (image: DecodableImage) => {const attempts: {image: DecodableImage;options?: { cropToSquare?: boolean };- }[] = [- { image, options: { cropToSquare: false } },- { image },- ];+ }[] = [{ image, options: { cropToSquare: false } }, { image }];const cardLikeCrops = [[0.086, 0.213, 0.829, 0.591],[0.135, 0.238, 0.73, 0.49],diff --git a/web/apps/twoof3/src/pages/_app.tsx b/web/apps/twoof3/src/pages/_app.tsxindex 7c5349ba49..118fd12c8a 100644--- a/web/apps/twoof3/src/pages/_app.tsx+++ b/web/apps/twoof3/src/pages/_app.tsx@@ -13,31 +13,16 @@ const twoOf3Theme = createTheme({colorSchemes: {light: {palette: {- primary: {- main: "rgb(252, 239, 93)",- contrastText: "#111111",- },- background: {- default: "#ffffff",- paper: "#ffffff",- },- text: {- primary: "#111111",- secondary: "rgba(17,17,17,0.68)",- },+ primary: { main: "rgb(252, 239, 93)", contrastText: "#111111" },+ background: { default: "#ffffff", paper: "#ffffff" },+ text: { primary: "#111111", secondary: "rgba(17,17,17,0.68)" },divider: "rgba(17,17,17,0.18)",},},dark: {palette: {- primary: {- main: "rgb(252, 239, 93)",- contrastText: "#111111",- },- background: {- default: "#0b0b0b",- paper: "#111111",- },+ primary: { main: "rgb(252, 239, 93)", contrastText: "#111111" },+ background: { default: "#0b0b0b", paper: "#111111" },text: {primary: "#fafafa",secondary: "rgba(250,250,250,0.68)",@@ -56,16 +41,8 @@ const twoOf3Theme = createTheme({h1: { fontWeight: 700, letterSpacing: "-0.05em" },h2: { fontWeight: 700, letterSpacing: "-0.04em" },h3: { fontWeight: 700, letterSpacing: "-0.04em" },- body1: {- fontWeight: 500,- lineHeight: 1.55,- letterSpacing: "-0.012em",- },- body2: {- fontWeight: 500,- lineHeight: 1.55,- letterSpacing: "-0.012em",- },+ body1: { fontWeight: 500, lineHeight: 1.55, letterSpacing: "-0.012em" },+ body2: { fontWeight: 500, lineHeight: 1.55, letterSpacing: "-0.012em" },subtitle1: { fontWeight: 500 },subtitle2: { fontWeight: 500 },button: {@@ -76,9 +53,7 @@ const twoOf3Theme = createTheme({},components: {MuiButton: {- styleOverrides: {- root: { borderRadius: 18, boxShadow: "none" },- },+ styleOverrides: { root: { borderRadius: 18, boxShadow: "none" } },},},});diff --git a/web/apps/twoof3/src/pages/index.tsx b/web/apps/twoof3/src/pages/index.tsxindex cb5fb1ea0c..abafde38db 100644--- a/web/apps/twoof3/src/pages/index.tsx+++ b/web/apps/twoof3/src/pages/index.tsx@@ -148,10 +148,10 @@ const HELP_FAQS = [question: "What if 2of3.ente.io is unavailable?",answer: (<>- A fully offline HTML recovery page is included when you use- {" "}"Download all cards". Open that file locally,- add any two matching cards, and recover without needing the- site. 2of3 is also{" "}+ A fully offline HTML recovery page is included when you use{" "}+ "Download all cards". Open that file locally, add any+ two matching cards, and recover without needing the site. 2of3+ is also{" "}<Boxcomponent="a"href="https://github.com/ente-io/ente"@@ -165,8 +165,8 @@ const HELP_FAQS = [>open source</Box>- , so the format is inspectable and recovery is not locked to- one hosted service.+ , so the format is inspectable and recovery is not locked to one+ hosted service.</>),},@@ -310,43 +310,41 @@ const Note = ({</Box>);-const QrPreview = memo(({- value,-}: {- value: NonNullable<ReturnType<typeof createQrSvgData>>;-}) => (- <svg- viewBox={`0 0 ${value.viewBoxSize} ${value.viewBoxSize}`}- role="img"- aria-label="QR code"- shapeRendering="crispEdges"- style={{- width: "100%",- height: "100%",- display: "block",- background: "#ffffff",- imageRendering: "pixelated",- }}- >- <rect- width={value.viewBoxSize}- height={value.viewBoxSize}- rx="2.5"- fill="#ffffff"- />- {value.modules.map((module) => (+const QrPreview = memo(+ ({ value }: { value: NonNullable<ReturnType<typeof createQrSvgData>> }) => (+ <svg+ viewBox={`0 0 ${value.viewBoxSize} ${value.viewBoxSize}`}+ role="img"+ aria-label="QR code"+ shapeRendering="crispEdges"+ style={{+ width: "100%",+ height: "100%",+ display: "block",+ background: "#ffffff",+ imageRendering: "pixelated",+ }}+ ><rect- key={`${module.x}-${module.y}`}- x={module.x}- y={module.y}- width="1"- height="1"- rx="0.08"- fill="#111111"+ width={value.viewBoxSize}+ height={value.viewBoxSize}+ rx="2.5"+ fill="#ffffff"/>- ))}- </svg>-));+ {value.modules.map((module) => (+ <rect+ key={`${module.x}-${module.y}`}+ x={module.x}+ y={module.y}+ width="1"+ height="1"+ rx="0.08"+ fill="#111111"+ />+ ))}+ </svg>+ ),+);interface ShareCardPanelProps {busy: boolean;@@ -515,7 +513,12 @@ const ShareCardPanel = memo(</Stack>)}- <Stack direction="row" spacing={0.8} useFlexGap flexWrap="wrap">+ <Stack+ direction="row"+ spacing={0.8}+ useFlexGap+ flexWrap="wrap"+ ><ActionButtondisabled={!card || busy}onClick={() => {@@ -529,7 +532,12 @@ const ShareCardPanel = memo(disabled={!card || busy}onClick={() => {if (!card) return;- onCardAction("download", card, index, cardLabel);+ onCardAction(+ "download",+ card,+ index,+ cardLabel,+ );}}>Download@@ -656,7 +664,9 @@ const readShareFile = async (file: File) => {const text = (await file.text()).trim();if (!text) {if (file.type.startsWith("text/") || /\.txt$/iu.test(file.name)) {- throw new Error("That text file does not look like a 2of3 share.");+ throw new Error(+ "That text file does not look like a 2of3 share.",+ );}} else {try {@@ -950,10 +960,7 @@ const Page = () => {[],);- const onRecoverFile = async (- slotIndex: number,- file: File,- ) => {+ const onRecoverFile = async (slotIndex: number, file: File) => {try {const value = await readShareFile(file);parseShare(value);@@ -1246,7 +1253,8 @@ const Page = () => {}slotProps={{htmlInput: {- maxLength: MAX_CARD_TITLE_LENGTH,+ maxLength:+ MAX_CARD_TITLE_LENGTH,},}}sx={fieldSx}@@ -1364,7 +1372,9 @@ const Page = () => {busy={busyCard === index}card={card}cardLabel={cardLabel}- copied={copiedCardIndex === index}+ copied={+ copiedCardIndex === index+ }index={index}onCardAction={onCardAction}onCopyCardCode={onCopyCardCode}@@ -1876,7 +1886,8 @@ const Page = () => {py: 0.42,borderRadius: "999px",border: "1.5px solid",- borderColor: "var(--accent-edge)",+ borderColor:+ "var(--accent-edge)",bgcolor: "var(--accent)",}}>@@ -1988,14 +1999,14 @@ const Page = () => {><Typographysx={{- fontSize: "0.75rem",- fontWeight: 700,- color: isAccent- ? "#111111"- : "var(--ink)",- letterSpacing:- "0.04em",- textTransform:+ fontSize: "0.75rem",+ fontWeight: 700,+ color: isAccent+ ? "#111111"+ : "var(--ink)",+ letterSpacing:+ "0.04em",+ textTransform:"uppercase",}}>@@ -2059,8 +2070,10 @@ const Page = () => {</Typography></Stack>{HELP_FAQS.map((item, index) => {- const layout = HELP_CARD_LAYOUTS[index]!;- const isAccent = layout.tone === "accent";+ const layout =+ HELP_CARD_LAYOUTS[index]!;+ const isAccent =+ layout.tone === "accent";const isSoft = layout.tone === "soft";return (@@ -2103,11 +2116,13 @@ const Page = () => {width: "fit-content",px: 0.8,py: 0.32,- borderRadius: "999px",+ borderRadius:+ "999px",border: "1.5px solid",- borderColor: isAccent- ? "rgba(17,17,17,0.2)"- : "var(--line-strong)",+ borderColor:+ isAccent+ ? "rgba(17,17,17,0.2)"+ : "var(--line-strong)",bgcolor: isAccent? "var(--chip-accent-bg)": "var(--chip-bg)",@@ -2205,7 +2220,10 @@ const Page = () => {sx={{color: "var(--ink)",fontWeight: 500,- fontSize: { xs: "0.98rem", md: "1.06rem" },+ fontSize: {+ xs: "0.98rem",+ md: "1.06rem",+ },textDecoration: "none",display: "inline-flex",alignItems: "center",@@ -2242,7 +2260,10 @@ const Page = () => {</Box></Box><Box component="span">by</Box>- <Box component="span" sx={{ fontWeight: 700 }}>+ <Box+ component="span"+ sx={{ fontWeight: 700 }}+ >Ente</Box></Box>@@ -2273,9 +2294,7 @@ const Page = () => {justifyContent: "center",opacity: 0.58,transition: "opacity 140ms ease",- "&:hover": {- opacity: 1,- },+ "&:hover": { opacity: 1 },}}><Box