Skip to content

armgit / ente

Public Imported from GitHub
0

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

exhaustive-deps

Manav Rathi4fc68dc69fa3
diff --git a/web/apps/auth/src/pages/share.tsx b/web/apps/auth/src/pages/share.tsx
index adb7cf37e0..92deda823a 100644
--- a/web/apps/auth/src/pages/share.tsx
+++ b/web/apps/auth/src/pages/share.tsx
@@ -24,31 +24,6 @@ const Share: React.FC = () => {
progress: 0,
});
- const base64UrlToByteArray = (base64Url: string): Uint8Array => {
- const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
- return Uint8Array.from(atob(base64), (c) => c.charCodeAt(0));
- };
-
- const formatCode = (code: string): string =>
- code.replace(/(.{3})/g, "$1 ").trim();
-
- const getCodeDisplay = (
- codes: string[],
- startTime: number,
- stepDuration: number,
- ): CodeDisplay => {
- const currentTime = Date.now();
- const elapsedTime = (currentTime - startTime) / 1000;
- const index = Math.floor(elapsedTime / stepDuration);
- const progress = ((elapsedTime % stepDuration) / stepDuration) * 100;
-
- return {
- currentCode: formatCode(codes[index] || ""),
- nextCode: formatCode(codes[index + 1] || ""),
- progress,
- };
- };
-
const getTimeStatus = (
currentTime: number,
startTime: number,
@@ -241,3 +216,28 @@ const Share: React.FC = () => {
};
export default Share;
+
+const base64UrlToByteArray = (base64Url: string): Uint8Array => {
+ const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
+ return Uint8Array.from(atob(base64), (c) => c.charCodeAt(0));
+};
+
+const formatCode = (code: string): string =>
+ code.replace(/(.{3})/g, "$1 ").trim();
+
+const getCodeDisplay = (
+ codes: string[],
+ startTime: number,
+ stepDuration: number,
+): CodeDisplay => {
+ const currentTime = Date.now();
+ const elapsedTime = (currentTime - startTime) / 1000;
+ const index = Math.floor(elapsedTime / stepDuration);
+ const progress = ((elapsedTime % stepDuration) / stepDuration) * 100;
+
+ return {
+ currentCode: formatCode(codes[index] || ""),
+ nextCode: formatCode(codes[index + 1] || ""),
+ progress,
+ };
+};