From b7f248fa93105ad42b9c25ec2412fb7786f85530 Mon Sep 17 00:00:00 2001 From: Crowdin Bot Date: Fri, 24 May 2024 02:06:42 +0000 Subject: [PATCH 001/131] New Crowdin translations by GitHub Action --- auth/lib/l10n/arb/app_ja.arb | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/auth/lib/l10n/arb/app_ja.arb b/auth/lib/l10n/arb/app_ja.arb index 8fea34c5e..46ba7b9dd 100644 --- a/auth/lib/l10n/arb/app_ja.arb +++ b/auth/lib/l10n/arb/app_ja.arb @@ -20,6 +20,8 @@ "codeIssuerHint": "発行者", "codeSecretKeyHint": "秘密鍵", "codeAccountHint": "アカウント (you@domain.com)", + "codeTagHint": "タグ", + "accountKeyType": "鍵の種類", "sessionExpired": "セッションが失効しました", "@sessionExpired": { "description": "Title of the dialog when the users current session is invalid/expired" @@ -77,6 +79,7 @@ "data": "データ", "importCodes": "コードをインポート", "importTypePlainText": "プレーンテキスト", + "importTypeEnteEncrypted": "Ente 暗号化されたエクスポート", "passwordForDecryptingExport": "復号化用パスワード", "passwordEmptyError": "パスワードは空欄にできません", "importFromApp": "{appName} からコードをインポート", @@ -121,6 +124,7 @@ "suggestFeatures": "機能を提案", "faq": "FAQ", "faq_q_1": "Authはどのくらい安全ですか?", + "faq_a_1": "Ente Authでバックアップされたコードはすべてエンドツーエンドで暗号化されて保存されます。つまり、コードにアクセスできるのはあなただけです。当社のアプリはオープンソースであり、暗号化技術は外部監査を受けています。", "faq_q_2": "パソコンから私のコードにアクセスできますか?", "faq_a_2": "auth.ente.io で Web からコードにアクセス可能です。", "faq_q_3": "コードを削除するにはどうすればいいですか?", @@ -154,6 +158,7 @@ } } }, + "invalidQRCode": "QRコードが無効です", "noRecoveryKeyTitle": "回復キーがありませんか?", "enterEmailHint": "メールアドレスを入力してください", "invalidEmailTitle": "メールアドレスが無効です", @@ -347,6 +352,7 @@ "deleteCodeAuthMessage": "コードを削除するためには認証が必要です", "showQRAuthMessage": "QR コードを表示するためには認証が必要です", "confirmAccountDeleteTitle": "アカウントの削除に同意", + "confirmAccountDeleteMessage": "このアカウントは他のEnteアプリも使用している場合はそれらにも紐づけされています。\nすべてのEnteアプリでアップロードされたデータは削除され、アカウントは完全に削除されます。", "androidBiometricHint": "本人を確認する", "@androidBiometricHint": { "description": "Hint message advising the user how to authenticate with biometrics. It is used on Android side. Maximum 60 characters." @@ -417,5 +423,18 @@ "invalidEndpoint": "無効なエンドポイントです", "invalidEndpointMessage": "入力されたエンドポイントは無効です。有効なエンドポイントを入力して再試行してください。", "endpointUpdatedMessage": "エンドポイントの更新に成功しました", - "customEndpoint": "{endpoint} に接続しました" + "customEndpoint": "{endpoint} に接続しました", + "pinText": "固定", + "unpinText": "固定を解除", + "pinnedCodeMessage": "{code} を固定しました", + "unpinnedCodeMessage": "{code} の固定が解除されました", + "tags": "タグ", + "createNewTag": "新しいタグの作成", + "tag": "タグ", + "create": "作成", + "editTag": "タグの編集", + "deleteTagTitle": "タグを削除しますか?", + "deleteTagMessage": "このタグを削除してもよろしいですか?この操作は取り消しできません。", + "somethingWentWrongParsingCode": "{x} のコードを解析できませんでした。", + "updateNotAvailable": "アップデートは利用できません" } \ No newline at end of file From 7d634aa703b57bb98793ea4081b89670e3855f22 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Fri, 24 May 2024 17:16:16 +0530 Subject: [PATCH 002/131] Add a note --- web/apps/auth/.env | 3 +++ 1 file changed, 3 insertions(+) diff --git a/web/apps/auth/.env b/web/apps/auth/.env index 3f3b1cc9a..49fd5c743 100644 --- a/web/apps/auth/.env +++ b/web/apps/auth/.env @@ -1 +1,4 @@ NEXT_TELEMETRY_DISABLED = 1 + +# For details on how to populate a .env.local to run auth and get it to connect +# to an arbitrary Ente instance, see `apps/photos/.env`. From 0adb94f405097bc1bbe719a7bd37d984a62b104b Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Fri, 24 May 2024 17:17:55 +0530 Subject: [PATCH 003/131] Link to @/build-config --- web/apps/auth/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/web/apps/auth/package.json b/web/apps/auth/package.json index 268f6f5c6..d16b973ab 100644 --- a/web/apps/auth/package.json +++ b/web/apps/auth/package.json @@ -3,6 +3,7 @@ "version": "0.0.0", "private": true, "dependencies": { + "@/build-config": "*", "@/next": "*", "@ente/accounts": "*", "@ente/eslint-config": "*", From 54e33d3f42cc3923e856c9ccaeaa1b7e4860ec65 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Fri, 24 May 2024 17:29:06 +0530 Subject: [PATCH 004/131] Create a WIP replacement --- web/apps/auth/tsconfig.json | 46 ++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/web/apps/auth/tsconfig.json b/web/apps/auth/tsconfig.json index d9092609d..3c5fb3cb3 100644 --- a/web/apps/auth/tsconfig.json +++ b/web/apps/auth/tsconfig.json @@ -1,24 +1,32 @@ { - "extends": "../../tsconfig.base.json", - "compilerOptions": { - "baseUrl": "./src", - "downlevelIteration": true, - "jsx": "preserve", - "jsxImportSource": "@emotion/react", - "lib": ["dom", "dom.iterable", "esnext", "webworker"], - "noImplicitAny": false, - "noUnusedLocals": false, - "noUnusedParameters": false, - "strictNullChecks": false, - "target": "es5", - "useUnknownInCatchVariables": false - }, + "extends": "@/build-config/tsconfig-typecheck.json", "include": [ - "next-env.d.ts", - "**/*.ts", - "**/*.tsx", - "**/*.js", + "src/**/*.ts", + "src/**/*.tsx", + "src/**/*.d.ts", "../../packages/shared/themes/mui-theme.d.ts" ], - "exclude": ["node_modules", "out", ".next", "thirdparty"] + // Temporarily disable some things to get the existing code to compile + // without warnings. + "compilerOptions": { + "baseUrl": "./src", + + "jsxImportSource": "@emotion/react", + + /* Also indicate expectation of a WebWorker runtime */ + "lib": ["ESnext", "DOM", "DOM.Iterable", "WebWorker"], + + "verbatimModuleSyntax": false, + "resolveJsonModule": false, + + "strict": false, + /* Stricter than strict */ + "noImplicitReturns": false, + "noUnusedParameters": false, + "noUnusedLocals": false, + "noFallthroughCasesInSwitch": false, + /* e.g. makes array indexing returns undefined */ + "noUncheckedIndexedAccess": false, + "exactOptionalPropertyTypes": false + } } From 74bb169f0d809149a7bf1e315195b82d45df4756 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Fri, 24 May 2024 17:49:49 +0530 Subject: [PATCH 005/131] Equivalent to "**/*.ts", "**/*.tsx", "**/*.d.ts" From the docs: https://www.typescriptlang.org/tsconfig/#include > If the last path segment in a pattern does not contain a file extension or wildcard character, then it is treated as a directory, and files with supported extensions inside that directory are included (e.g. .ts, .tsx, and d.ts by default). --- web/packages/media/tsconfig.json | 6 +----- web/packages/next/tsconfig.json | 3 +-- web/packages/utils/tsconfig.json | 3 +-- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/web/packages/media/tsconfig.json b/web/packages/media/tsconfig.json index bcc1151c1..5ec77ed60 100644 --- a/web/packages/media/tsconfig.json +++ b/web/packages/media/tsconfig.json @@ -5,9 +5,5 @@ "lib": ["ESnext", "DOM", "DOM.Iterable", "WebWorker"] }, /* Typecheck all files with the given extensions (here or in subfolders) */ - "include": [ - "**/*.ts", - "**/*.tsx", - "../../packages/next/global-electron.d.ts" - ] + "include": [".", "../../packages/next/global-electron.d.ts"] } diff --git a/web/packages/next/tsconfig.json b/web/packages/next/tsconfig.json index 9c7ee3ef6..887a3743a 100644 --- a/web/packages/next/tsconfig.json +++ b/web/packages/next/tsconfig.json @@ -4,6 +4,5 @@ /* Also indicate expectation of a WebWorker runtime */ "lib": ["ESnext", "DOM", "DOM.Iterable", "WebWorker"] }, - /* Typecheck all files with the given extensions (here or in subfolders) */ - "include": ["**/*.ts", "**/*.tsx", "**/*.d.ts", "global-electron.d.ts"] + "include": ["."] } diff --git a/web/packages/utils/tsconfig.json b/web/packages/utils/tsconfig.json index 7c0ebd678..d890ecabe 100644 --- a/web/packages/utils/tsconfig.json +++ b/web/packages/utils/tsconfig.json @@ -1,5 +1,4 @@ { "extends": "@/build-config/tsconfig-typecheck.json", - /* Typecheck all files with the given extensions (here or in subfolders) */ - "include": ["**/*.ts"] + "include": ["."] } From 3c0cb20a9b394127ab230a2a651cf6c5b695efc3 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Fri, 24 May 2024 18:13:09 +0530 Subject: [PATCH 006/131] [mob] Use custom assetPickerTextDelegate to use en as default --- .../gallery/hooks/add_photos_sheet.dart | 41 ++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/mobile/lib/ui/viewer/gallery/hooks/add_photos_sheet.dart b/mobile/lib/ui/viewer/gallery/hooks/add_photos_sheet.dart index 0ccdc93e1..aeeadc198 100644 --- a/mobile/lib/ui/viewer/gallery/hooks/add_photos_sheet.dart +++ b/mobile/lib/ui/viewer/gallery/hooks/add_photos_sheet.dart @@ -167,7 +167,13 @@ class AddPhotosPhotoWidget extends StatelessWidget { Future _onPickFromDeviceClicked(BuildContext context) async { try { - final List? result = await AssetPicker.pickAssets(context); + final assetPickerTextDelegate = await _getAssetPickerTextDelegate(); + final List? result = await AssetPicker.pickAssets( + context, + pickerConfig: AssetPickerConfig( + textDelegate: assetPickerTextDelegate, + ), + ); if (result != null && result.isNotEmpty) { final ca = CollectionActions( CollectionsService.instance, @@ -204,6 +210,39 @@ class AddPhotosPhotoWidget extends StatelessWidget { } } } + + // _getAssetPickerTextDelegate returns the text delegate for the asset picker + // This custom method is required to enforce English as the default fallback + // instead of Chinese. + Future _getAssetPickerTextDelegate() async { + final Locale locale = await getLocale(); + switch (locale.languageCode.toLowerCase()) { + case "en": + return const EnglishAssetPickerTextDelegate(); + case "he": + return const HebrewAssetPickerTextDelegate(); + case "de": + return const GermanAssetPickerTextDelegate(); + case "ru": + return const RussianAssetPickerTextDelegate(); + case "ja": + return const JapaneseAssetPickerTextDelegate(); + case "ar": + return const ArabicAssetPickerTextDelegate(); + case "fr": + return const FrenchAssetPickerTextDelegate(); + case "vi": + return const VietnameseAssetPickerTextDelegate(); + case "tr": + return const TurkishAssetPickerTextDelegate(); + case "ko": + return const KoreanAssetPickerTextDelegate(); + case "zh": + return const AssetPickerTextDelegate(); + default: + return const EnglishAssetPickerTextDelegate(); + } + } } class DelayedGallery extends StatefulWidget { From 3b8c48e92dc5368357cde48a063381eca74cbc74 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Fri, 24 May 2024 18:11:04 +0530 Subject: [PATCH 007/131] Create a next specific base The include still needs to be specified in the importing tsconfig otherwise the "." is resolved relative to the @/build-config. --- web/apps/auth/tsconfig.json | 12 ++---------- web/packages/build-config/tsconfig-next.json | 8 ++++++++ web/packages/media/tsconfig.json | 7 +------ web/packages/next/tsconfig.json | 6 +----- 4 files changed, 12 insertions(+), 21 deletions(-) create mode 100644 web/packages/build-config/tsconfig-next.json diff --git a/web/apps/auth/tsconfig.json b/web/apps/auth/tsconfig.json index 3c5fb3cb3..3b238836d 100644 --- a/web/apps/auth/tsconfig.json +++ b/web/apps/auth/tsconfig.json @@ -1,11 +1,6 @@ { - "extends": "@/build-config/tsconfig-typecheck.json", - "include": [ - "src/**/*.ts", - "src/**/*.tsx", - "src/**/*.d.ts", - "../../packages/shared/themes/mui-theme.d.ts" - ], + "extends": "@/build-config/tsconfig-next.json", + "include": ["src", "../../packages/shared/themes/mui-theme.d.ts"], // Temporarily disable some things to get the existing code to compile // without warnings. "compilerOptions": { @@ -13,9 +8,6 @@ "jsxImportSource": "@emotion/react", - /* Also indicate expectation of a WebWorker runtime */ - "lib": ["ESnext", "DOM", "DOM.Iterable", "WebWorker"], - "verbatimModuleSyntax": false, "resolveJsonModule": false, diff --git a/web/packages/build-config/tsconfig-next.json b/web/packages/build-config/tsconfig-next.json new file mode 100644 index 000000000..922ba7a7c --- /dev/null +++ b/web/packages/build-config/tsconfig-next.json @@ -0,0 +1,8 @@ +{ + /* A base TSConfig for typechecking our Next.js apps and packages. */ + "extends": "@/build-config/tsconfig-typecheck.json", + "compilerOptions": { + /* Also indicate expectation of a WebWorker runtime */ + "lib": ["ESnext", "DOM", "DOM.Iterable", "WebWorker"] + } +} diff --git a/web/packages/media/tsconfig.json b/web/packages/media/tsconfig.json index 5ec77ed60..01e2dc60c 100644 --- a/web/packages/media/tsconfig.json +++ b/web/packages/media/tsconfig.json @@ -1,9 +1,4 @@ { - "extends": "@/build-config/tsconfig-typecheck.json", - "compilerOptions": { - /* Also indicate expectation of a WebWorker runtime */ - "lib": ["ESnext", "DOM", "DOM.Iterable", "WebWorker"] - }, - /* Typecheck all files with the given extensions (here or in subfolders) */ + "extends": "@/build-config/tsconfig-next.json", "include": [".", "../../packages/next/global-electron.d.ts"] } diff --git a/web/packages/next/tsconfig.json b/web/packages/next/tsconfig.json index 887a3743a..b39c0995b 100644 --- a/web/packages/next/tsconfig.json +++ b/web/packages/next/tsconfig.json @@ -1,8 +1,4 @@ { - "extends": "@/build-config/tsconfig-typecheck.json", - "compilerOptions": { - /* Also indicate expectation of a WebWorker runtime */ - "lib": ["ESnext", "DOM", "DOM.Iterable", "WebWorker"] - }, + "extends": "@/build-config/tsconfig-next.json", "include": ["."] } From 2cd1dfd7209cf495f1cbcbc9648a1943b5fab52f Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Fri, 24 May 2024 18:20:40 +0530 Subject: [PATCH 008/131] Chip away --- web/apps/accounts/src/pages/_app.tsx | 2 +- .../accounts/src/pages/passkeys/index.tsx | 10 +---- web/apps/auth/src/pages/_app.tsx | 6 +-- web/apps/auth/tsconfig.json | 3 -- .../src/components/AuthenticateUserModal.tsx | 4 +- .../photos/src/components/CaptionedText.tsx | 2 +- .../photos/src/components/CheckboxInput.tsx | 2 +- .../Collections/CollectionInfoWithOptions.tsx | 2 +- .../Collections/CollectionNamer.tsx | 2 +- .../CollectionOptions/AlbumCastDialog.tsx | 2 +- .../Collections/CollectionOptions/index.tsx | 3 +- .../emailShare/AddParticipantForm.tsx | 2 +- .../manage/linkPassword/setPassword.tsx | 2 +- .../src/components/DeleteAccountModal.tsx | 2 +- .../photos/src/components/DropdownInput.tsx | 2 +- .../photos/src/components/EnteSpinner.tsx | 2 +- .../src/components/Menu/EnteMenuItem.tsx | 4 +- .../photos/src/components/Notification.tsx | 2 +- .../FileInfo/FileNameEditDialog.tsx | 2 +- .../PhotoViewer/FileInfo/MapButton.tsx | 4 +- .../ImageEditorOverlay/ColoursMenu.tsx | 2 +- .../PhotoViewer/ImageEditorOverlay/index.tsx | 12 +----- .../CircularProgressWithLabel.tsx | 2 +- .../Upload/UploadProgress/section.tsx | 2 +- .../components/pages/gallery/LinkButton.tsx | 13 +++---- web/apps/photos/src/pages/_app.tsx | 6 +-- web/apps/photos/src/pages/gallery/index.tsx | 2 +- web/apps/photos/src/pages/index.tsx | 7 +++- .../photos/src/pages/shared-albums/index.tsx | 2 +- .../photos/src/services/collectionService.ts | 2 +- .../photos/src/services/download/index.ts | 2 +- web/apps/photos/src/services/export/index.ts | 2 +- .../photos/src/services/export/migration.ts | 2 +- web/apps/photos/src/services/ffmpeg.ts | 2 +- .../src/services/upload/uploadManager.ts | 2 +- .../src/services/upload/uploadService.ts | 4 +- web/apps/photos/src/services/userService.ts | 2 +- web/apps/photos/src/types/gallery/index.ts | 2 +- web/apps/photos/src/utils/billing/index.ts | 2 +- web/apps/photos/src/utils/collection/index.ts | 2 +- .../src/utils/comlink/ComlinkSearchWorker.ts | 2 +- web/apps/photos/src/utils/file/index.ts | 2 +- web/apps/photos/src/utils/user/family.ts | 2 +- web/packages/accounts/api/srp.ts | 2 +- web/packages/accounts/api/user.ts | 6 +-- .../accounts/components/ChangeEmail.tsx | 4 +- web/packages/accounts/components/Login.tsx | 2 +- web/packages/accounts/components/SignUp.tsx | 4 +- .../two-factor/InvalidInputMessage.tsx | 6 +-- .../components/two-factor/VerifyForm.tsx | 2 +- .../two-factor/setup/ManualMode.tsx | 2 +- .../components/two-factor/setup/QRMode.tsx | 2 +- .../components/two-factor/setup/index.tsx | 2 +- web/packages/accounts/pages/change-email.tsx | 2 +- .../accounts/pages/change-password.tsx | 39 +++++++++---------- web/packages/accounts/pages/credentials.tsx | 10 ++--- web/packages/accounts/pages/generate.tsx | 4 +- web/packages/accounts/pages/login.tsx | 2 +- web/packages/accounts/pages/recover.tsx | 6 +-- web/packages/accounts/pages/signup.tsx | 2 +- .../accounts/pages/two-factor/recover.tsx | 8 ++-- .../accounts/pages/two-factor/setup.tsx | 6 +-- .../accounts/pages/two-factor/verify.tsx | 4 +- web/packages/accounts/pages/verify.tsx | 17 ++++---- web/packages/accounts/services/srp.ts | 4 +- web/packages/accounts/types/srp.ts | 2 +- web/packages/accounts/types/user.ts | 2 +- web/packages/accounts/utils/srp.ts | 4 +- web/packages/shared/apps/types.ts | 2 +- .../shared/components/CaptionedText.tsx | 2 +- .../components/CodeBlock/CopyButton.tsx | 4 +- .../shared/components/CodeBlock/index.tsx | 2 +- .../DialogBox/TitleWithCloseButton.tsx | 2 +- .../shared/components/DialogBoxV2/index.tsx | 4 +- .../shared/components/DialogBoxV2/types.ts | 2 +- web/packages/shared/components/EnteButton.tsx | 4 +- .../shared/components/EnteSpinner.tsx | 2 +- .../components/Form/FormPaper/Footer.tsx | 6 +-- .../components/Form/FormPaper/Title.tsx | 6 +-- web/packages/shared/components/LinkButton.tsx | 13 +++---- .../shared/components/Menu/EnteMenuItem.tsx | 2 +- .../shared/components/OverflowMenu/menu.tsx | 2 +- .../shared/components/OverflowMenu/option.tsx | 2 +- .../shared/components/RecoveryKey/index.tsx | 2 +- .../shared/components/SingleInputForm.tsx | 2 +- .../shared/components/SubmitButton.tsx | 6 +-- .../components/VerifyMasterPasswordForm.tsx | 8 ++-- web/packages/shared/crypto/helpers.ts | 2 +- web/packages/shared/crypto/index.ts | 2 +- .../shared/crypto/internal/crypto.worker.ts | 2 +- .../shared/crypto/internal/libsodium.ts | 4 +- web/packages/shared/hooks/useLocalState.tsx | 3 +- web/packages/shared/network/HTTPService.ts | 2 +- web/packages/shared/themes/colors/dark.ts | 2 +- web/packages/shared/themes/colors/fixed.ts | 2 +- web/packages/shared/themes/colors/index.ts | 2 +- web/packages/shared/themes/colors/light.ts | 2 +- web/packages/shared/themes/components.ts | 6 +-- web/packages/shared/themes/mui-theme.d.ts | 2 +- web/packages/shared/themes/palette/index.tsx | 2 +- web/packages/shared/themes/typography.ts | 2 +- web/packages/shared/user/index.ts | 2 +- 102 files changed, 186 insertions(+), 206 deletions(-) diff --git a/web/apps/accounts/src/pages/_app.tsx b/web/apps/accounts/src/pages/_app.tsx index a1927f52b..421680f5e 100644 --- a/web/apps/accounts/src/pages/_app.tsx +++ b/web/apps/accounts/src/pages/_app.tsx @@ -6,7 +6,7 @@ import { accountLogout } from "@ente/accounts/services/logout"; import { APPS, APP_TITLES } from "@ente/shared/apps/constants"; import { Overlay } from "@ente/shared/components/Container"; import DialogBoxV2 from "@ente/shared/components/DialogBoxV2"; -import { +import type { DialogBoxAttributesV2, SetDialogBoxAttributesV2, } from "@ente/shared/components/DialogBoxV2/types"; diff --git a/web/apps/accounts/src/pages/passkeys/index.tsx b/web/apps/accounts/src/pages/passkeys/index.tsx index 977595af6..dec8916cc 100644 --- a/web/apps/accounts/src/pages/passkeys/index.tsx +++ b/web/apps/accounts/src/pages/passkeys/index.tsx @@ -9,14 +9,8 @@ import { t } from "i18next"; import _sodium from "libsodium-wrappers"; import { useRouter } from "next/router"; import { AppContext } from "pages/_app"; -import { - Dispatch, - SetStateAction, - createContext, - useContext, - useEffect, - useState, -} from "react"; +import type { Dispatch, SetStateAction } from "react"; +import { createContext, useContext, useEffect, useState } from "react"; import { Passkey } from "types/passkey"; import { finishPasskeyRegistration, diff --git a/web/apps/auth/src/pages/_app.tsx b/web/apps/auth/src/pages/_app.tsx index a0a579a80..bd3134462 100644 --- a/web/apps/auth/src/pages/_app.tsx +++ b/web/apps/auth/src/pages/_app.tsx @@ -12,7 +12,7 @@ import { } from "@ente/shared/apps/constants"; import { Overlay } from "@ente/shared/components/Container"; import DialogBoxV2 from "@ente/shared/components/DialogBoxV2"; -import { +import type { DialogBoxAttributesV2, SetDialogBoxAttributesV2, } from "@ente/shared/components/DialogBoxV2/types"; @@ -25,12 +25,12 @@ import HTTPService from "@ente/shared/network/HTTPService"; import { LS_KEYS, getData } from "@ente/shared/storage/localStorage"; import { getTheme } from "@ente/shared/themes"; import { THEME_COLOR } from "@ente/shared/themes/constants"; -import { SetTheme } from "@ente/shared/themes/types"; +import type { SetTheme } from "@ente/shared/themes/types"; import type { User } from "@ente/shared/user/types"; import { CssBaseline, useMediaQuery } from "@mui/material"; import { ThemeProvider } from "@mui/material/styles"; import { t } from "i18next"; -import { AppProps } from "next/app"; +import type { AppProps } from "next/app"; import { useRouter } from "next/router"; import { createContext, useEffect, useRef, useState } from "react"; import LoadingBar from "react-top-loading-bar"; diff --git a/web/apps/auth/tsconfig.json b/web/apps/auth/tsconfig.json index 3b238836d..e0e985f33 100644 --- a/web/apps/auth/tsconfig.json +++ b/web/apps/auth/tsconfig.json @@ -8,9 +8,6 @@ "jsxImportSource": "@emotion/react", - "verbatimModuleSyntax": false, - "resolveJsonModule": false, - "strict": false, /* Stricter than strict */ "noImplicitReturns": false, diff --git a/web/apps/photos/src/components/AuthenticateUserModal.tsx b/web/apps/photos/src/components/AuthenticateUserModal.tsx index 97f47e7fb..52be5b7de 100644 --- a/web/apps/photos/src/components/AuthenticateUserModal.tsx +++ b/web/apps/photos/src/components/AuthenticateUserModal.tsx @@ -1,10 +1,10 @@ import log from "@/next/log"; import DialogBoxV2 from "@ente/shared/components/DialogBoxV2"; import VerifyMasterPasswordForm, { - VerifyMasterPasswordFormProps, + type VerifyMasterPasswordFormProps, } from "@ente/shared/components/VerifyMasterPasswordForm"; import { LS_KEYS, getData } from "@ente/shared/storage/localStorage"; -import { KeyAttributes, User } from "@ente/shared/user/types"; +import type { KeyAttributes, User } from "@ente/shared/user/types"; import { t } from "i18next"; import { AppContext } from "pages/_app"; import { useContext, useEffect, useState } from "react"; diff --git a/web/apps/photos/src/components/CaptionedText.tsx b/web/apps/photos/src/components/CaptionedText.tsx index 64d6c344d..5cc07a88e 100644 --- a/web/apps/photos/src/components/CaptionedText.tsx +++ b/web/apps/photos/src/components/CaptionedText.tsx @@ -1,5 +1,5 @@ import { VerticallyCenteredFlex } from "@ente/shared/components/Container"; -import { ButtonProps, Typography } from "@mui/material"; +import { Typography, type ButtonProps } from "@mui/material"; interface Iprops { mainText: string; diff --git a/web/apps/photos/src/components/CheckboxInput.tsx b/web/apps/photos/src/components/CheckboxInput.tsx index 7cdc95e3a..df139fd2e 100644 --- a/web/apps/photos/src/components/CheckboxInput.tsx +++ b/web/apps/photos/src/components/CheckboxInput.tsx @@ -3,7 +3,7 @@ import { FormControlLabel, FormGroup, Typography, - TypographyProps, + type TypographyProps, } from "@mui/material"; interface Iprops { diff --git a/web/apps/photos/src/components/Collections/CollectionInfoWithOptions.tsx b/web/apps/photos/src/components/Collections/CollectionInfoWithOptions.tsx index 405e22c28..925956d60 100644 --- a/web/apps/photos/src/components/Collections/CollectionInfoWithOptions.tsx +++ b/web/apps/photos/src/components/Collections/CollectionInfoWithOptions.tsx @@ -6,7 +6,7 @@ import PeopleIcon from "@mui/icons-material/People"; import { SetCollectionNamerAttributes } from "components/Collections/CollectionNamer"; import CollectionOptions from "components/Collections/CollectionOptions"; import { CollectionSummaryType } from "constants/collection"; -import { Dispatch, SetStateAction } from "react"; +import type { Dispatch, SetStateAction } from "react"; import { Collection, CollectionSummary } from "types/collection"; import { SetFilesDownloadProgressAttributesCreator } from "types/gallery"; import { shouldShowOptions } from "utils/collection"; diff --git a/web/apps/photos/src/components/Collections/CollectionNamer.tsx b/web/apps/photos/src/components/Collections/CollectionNamer.tsx index 0f7abf99f..ebe18127e 100644 --- a/web/apps/photos/src/components/Collections/CollectionNamer.tsx +++ b/web/apps/photos/src/components/Collections/CollectionNamer.tsx @@ -1,6 +1,6 @@ import DialogBoxV2 from "@ente/shared/components/DialogBoxV2"; import SingleInputForm, { - SingleInputFormProps, + type SingleInputFormProps, } from "@ente/shared/components/SingleInputForm"; import { t } from "i18next"; import React from "react"; diff --git a/web/apps/photos/src/components/Collections/CollectionOptions/AlbumCastDialog.tsx b/web/apps/photos/src/components/Collections/CollectionOptions/AlbumCastDialog.tsx index 8b92f1cbb..c56917dbf 100644 --- a/web/apps/photos/src/components/Collections/CollectionOptions/AlbumCastDialog.tsx +++ b/web/apps/photos/src/components/Collections/CollectionOptions/AlbumCastDialog.tsx @@ -4,7 +4,7 @@ import DialogBoxV2 from "@ente/shared/components/DialogBoxV2"; import EnteButton from "@ente/shared/components/EnteButton"; import EnteSpinner from "@ente/shared/components/EnteSpinner"; import SingleInputForm, { - SingleInputFormProps, + type SingleInputFormProps, } from "@ente/shared/components/SingleInputForm"; import { boxSeal } from "@ente/shared/crypto/internal/libsodium"; import castGateway from "@ente/shared/network/cast"; diff --git a/web/apps/photos/src/components/Collections/CollectionOptions/index.tsx b/web/apps/photos/src/components/Collections/CollectionOptions/index.tsx index ffdc6ad1f..61dcbc9e7 100644 --- a/web/apps/photos/src/components/Collections/CollectionOptions/index.tsx +++ b/web/apps/photos/src/components/Collections/CollectionOptions/index.tsx @@ -11,7 +11,8 @@ import { import { t } from "i18next"; import { AppContext } from "pages/_app"; import { GalleryContext } from "pages/gallery"; -import { Dispatch, SetStateAction, useContext, useRef, useState } from "react"; +import type { Dispatch, SetStateAction } from "react"; +import { useContext, useRef, useState } from "react"; import { Trans } from "react-i18next"; import * as CollectionAPI from "services/collectionService"; import * as TrashService from "services/trashService"; diff --git a/web/apps/photos/src/components/Collections/CollectionShare/emailShare/AddParticipantForm.tsx b/web/apps/photos/src/components/Collections/CollectionShare/emailShare/AddParticipantForm.tsx index 55daa1edc..84089743f 100644 --- a/web/apps/photos/src/components/Collections/CollectionShare/emailShare/AddParticipantForm.tsx +++ b/web/apps/photos/src/components/Collections/CollectionShare/emailShare/AddParticipantForm.tsx @@ -8,7 +8,7 @@ import MenuItemDivider from "components/Menu/MenuItemDivider"; import { MenuItemGroup } from "components/Menu/MenuItemGroup"; import MenuSectionTitle from "components/Menu/MenuSectionTitle"; import Avatar from "components/pages/gallery/Avatar"; -import { Formik, FormikHelpers } from "formik"; +import { Formik, type FormikHelpers } from "formik"; import { t } from "i18next"; import { useMemo, useState } from "react"; import * as Yup from "yup"; diff --git a/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/linkPassword/setPassword.tsx b/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/linkPassword/setPassword.tsx index 349e41d7b..c98926f91 100644 --- a/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/linkPassword/setPassword.tsx +++ b/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/linkPassword/setPassword.tsx @@ -1,5 +1,5 @@ import SingleInputForm, { - SingleInputFormProps, + type SingleInputFormProps, } from "@ente/shared/components/SingleInputForm"; import ComlinkCryptoWorker from "@ente/shared/crypto"; import { Dialog, Stack, Typography } from "@mui/material"; diff --git a/web/apps/photos/src/components/DeleteAccountModal.tsx b/web/apps/photos/src/components/DeleteAccountModal.tsx index d6eb3a037..3fce47f4d 100644 --- a/web/apps/photos/src/components/DeleteAccountModal.tsx +++ b/web/apps/photos/src/components/DeleteAccountModal.tsx @@ -3,7 +3,7 @@ import DialogBoxV2 from "@ente/shared/components/DialogBoxV2"; import EnteButton from "@ente/shared/components/EnteButton"; import { DELETE_ACCOUNT_EMAIL } from "@ente/shared/constants/urls"; import { Button, Link, Stack } from "@mui/material"; -import { Formik, FormikHelpers } from "formik"; +import { Formik, type FormikHelpers } from "formik"; import { t } from "i18next"; import { AppContext } from "pages/_app"; import { GalleryContext } from "pages/gallery"; diff --git a/web/apps/photos/src/components/DropdownInput.tsx b/web/apps/photos/src/components/DropdownInput.tsx index 76f9e7423..11591612a 100644 --- a/web/apps/photos/src/components/DropdownInput.tsx +++ b/web/apps/photos/src/components/DropdownInput.tsx @@ -6,7 +6,7 @@ import { SelectChangeEvent, Stack, Typography, - TypographyProps, + type TypographyProps, } from "@mui/material"; export interface DropdownOption { diff --git a/web/apps/photos/src/components/EnteSpinner.tsx b/web/apps/photos/src/components/EnteSpinner.tsx index 8a5d0a289..5e7b5e803 100644 --- a/web/apps/photos/src/components/EnteSpinner.tsx +++ b/web/apps/photos/src/components/EnteSpinner.tsx @@ -1,5 +1,5 @@ import CircularProgress, { - CircularProgressProps, + type CircularProgressProps, } from "@mui/material/CircularProgress"; export default function EnteSpinner(props: CircularProgressProps) { diff --git a/web/apps/photos/src/components/Menu/EnteMenuItem.tsx b/web/apps/photos/src/components/Menu/EnteMenuItem.tsx index 21a9889af..eb473ebd6 100644 --- a/web/apps/photos/src/components/Menu/EnteMenuItem.tsx +++ b/web/apps/photos/src/components/Menu/EnteMenuItem.tsx @@ -4,10 +4,10 @@ import { } from "@ente/shared/components/Container"; import { Box, - ButtonProps, MenuItem, Typography, - TypographyProps, + type ButtonProps, + type TypographyProps, } from "@mui/material"; import { CaptionedText } from "components/CaptionedText"; import PublicShareSwitch from "components/Collections/CollectionShare/publicShare/switch"; diff --git a/web/apps/photos/src/components/Notification.tsx b/web/apps/photos/src/components/Notification.tsx index f000d229e..490fb2df6 100644 --- a/web/apps/photos/src/components/Notification.tsx +++ b/web/apps/photos/src/components/Notification.tsx @@ -2,7 +2,7 @@ import CloseIcon from "@mui/icons-material/Close"; import { Box, Button, - ButtonProps, + type ButtonProps, Snackbar, Stack, SxProps, diff --git a/web/apps/photos/src/components/PhotoViewer/FileInfo/FileNameEditDialog.tsx b/web/apps/photos/src/components/PhotoViewer/FileInfo/FileNameEditDialog.tsx index 214b120f1..c7f731367 100644 --- a/web/apps/photos/src/components/PhotoViewer/FileInfo/FileNameEditDialog.tsx +++ b/web/apps/photos/src/components/PhotoViewer/FileInfo/FileNameEditDialog.tsx @@ -1,6 +1,6 @@ import DialogBoxV2 from "@ente/shared/components/DialogBoxV2"; import SingleInputForm, { - SingleInputFormProps, + type SingleInputFormProps, } from "@ente/shared/components/SingleInputForm"; import { t } from "i18next"; diff --git a/web/apps/photos/src/components/PhotoViewer/FileInfo/MapButton.tsx b/web/apps/photos/src/components/PhotoViewer/FileInfo/MapButton.tsx index 12b665199..ea5005da5 100644 --- a/web/apps/photos/src/components/PhotoViewer/FileInfo/MapButton.tsx +++ b/web/apps/photos/src/components/PhotoViewer/FileInfo/MapButton.tsx @@ -1,5 +1,5 @@ -import { Button, ButtonProps, styled } from "@mui/material"; -import { CSSProperties } from "@mui/material/styles/createTypography"; +import { Button, styled, type ButtonProps } from "@mui/material"; +import { type CSSProperties } from "@mui/material/styles/createTypography"; export const MapButton = styled((props: ButtonProps) => ( - + ); }; + +const Footer_ = styled("div")` + margin-block-start: 2rem; + margin-block-end: 4rem; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; +`; From 2e93281368dbea460f34a8dacca4c5a79ac6a801 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Sat, 25 May 2024 16:51:58 +0530 Subject: [PATCH 062/131] tsc --- web/apps/auth/src/pages/_app.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/apps/auth/src/pages/_app.tsx b/web/apps/auth/src/pages/_app.tsx index e4bff37e7..10002c89a 100644 --- a/web/apps/auth/src/pages/_app.tsx +++ b/web/apps/auth/src/pages/_app.tsx @@ -33,7 +33,7 @@ import { t } from "i18next"; import type { AppProps } from "next/app"; import { useRouter } from "next/router"; import { createContext, useEffect, useRef, useState } from "react"; -import LoadingBar from "react-top-loading-bar"; +import LoadingBar, { type LoadingBarRef } from "react-top-loading-bar"; import "../../public/css/global.css"; type AppContextType = { @@ -58,8 +58,8 @@ export default function App({ Component, pageProps }: AppProps) { typeof window !== "undefined" && !window.navigator.onLine, ); const [showNavbar, setShowNavBar] = useState(false); - const isLoadingBarRunning = useRef(false); - const loadingBar = useRef(null); + const isLoadingBarRunning = useRef(false); + const loadingBar = useRef(null); const [dialogBoxAttributeV2, setDialogBoxAttributesV2] = useState(); const [dialogBoxV2View, setDialogBoxV2View] = useState(false); From b42759d473c20667e9f358fc9b461c66093f79d9 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Sat, 25 May 2024 16:55:31 +0530 Subject: [PATCH 063/131] tsc --- web/apps/auth/src/pages/_app.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web/apps/auth/src/pages/_app.tsx b/web/apps/auth/src/pages/_app.tsx index 10002c89a..0eddf2d7c 100644 --- a/web/apps/auth/src/pages/_app.tsx +++ b/web/apps/auth/src/pages/_app.tsx @@ -61,7 +61,7 @@ export default function App({ Component, pageProps }: AppProps) { const isLoadingBarRunning = useRef(false); const loadingBar = useRef(null); const [dialogBoxAttributeV2, setDialogBoxAttributesV2] = - useState(); + useState({}); const [dialogBoxV2View, setDialogBoxV2View] = useState(false); const isMobile = useMediaQuery("(max-width:428px)"); const [themeColor, setThemeColor] = useLocalState( @@ -134,9 +134,10 @@ export default function App({ Component, pageProps }: AppProps) { void accountLogout().then(() => router.push(PAGES.ROOT)); }; + // TODO: Refactor this to have a fallback const title = isI18nReady ? t("TITLE", { context: APPS.AUTH }) - : APP_TITLES.get(APPS.AUTH); + : APP_TITLES.get(APPS.AUTH) ?? ""; return ( <> From 4a0c93373db30c1dc5ea0ddffa3d5e57ad594db3 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Sat, 25 May 2024 17:00:03 +0530 Subject: [PATCH 064/131] st --- web/apps/auth/src/pages/_app.tsx | 3 +-- web/apps/photos/src/components/Sidebar/index.tsx | 2 +- web/apps/photos/src/pages/_app.tsx | 3 +-- web/packages/shared/components/ThemeSwitcher.tsx | 4 +++- web/packages/shared/themes/types.ts | 3 --- 5 files changed, 6 insertions(+), 9 deletions(-) delete mode 100644 web/packages/shared/themes/types.ts diff --git a/web/apps/auth/src/pages/_app.tsx b/web/apps/auth/src/pages/_app.tsx index 0eddf2d7c..355b76e08 100644 --- a/web/apps/auth/src/pages/_app.tsx +++ b/web/apps/auth/src/pages/_app.tsx @@ -25,7 +25,6 @@ import HTTPService from "@ente/shared/network/HTTPService"; import { LS_KEYS, getData } from "@ente/shared/storage/localStorage"; import { getTheme } from "@ente/shared/themes"; import { THEME_COLOR } from "@ente/shared/themes/constants"; -import type { SetTheme } from "@ente/shared/themes/types"; import type { User } from "@ente/shared/user/types"; import { CssBaseline, useMediaQuery } from "@mui/material"; import { ThemeProvider } from "@mui/material/styles"; @@ -42,7 +41,7 @@ type AppContextType = { finishLoading: () => void; isMobile: boolean; themeColor: THEME_COLOR; - setThemeColor: SetTheme; + setThemeColor: (themeColor: THEME_COLOR) => void; somethingWentWrong: () => void; setDialogBoxAttributesV2: SetDialogBoxAttributesV2; logout: () => void; diff --git a/web/apps/photos/src/components/Sidebar/index.tsx b/web/apps/photos/src/components/Sidebar/index.tsx index 300d06ed6..a59c36b14 100644 --- a/web/apps/photos/src/components/Sidebar/index.tsx +++ b/web/apps/photos/src/components/Sidebar/index.tsx @@ -529,7 +529,7 @@ const UtilitySection: React.FC = ({ closeSidebar }) => { }); const toggleTheme = () => { - setThemeColor((themeColor) => + setThemeColor( themeColor === THEME_COLOR.DARK ? THEME_COLOR.LIGHT : THEME_COLOR.DARK, diff --git a/web/apps/photos/src/pages/_app.tsx b/web/apps/photos/src/pages/_app.tsx index fddf8624c..d9df703b7 100644 --- a/web/apps/photos/src/pages/_app.tsx +++ b/web/apps/photos/src/pages/_app.tsx @@ -36,7 +36,6 @@ import { } from "@ente/shared/storage/localStorage/helpers"; import { getTheme } from "@ente/shared/themes"; import { THEME_COLOR } from "@ente/shared/themes/constants"; -import type { SetTheme } from "@ente/shared/themes/types"; import type { User } from "@ente/shared/user/types"; import ArrowForward from "@mui/icons-material/ArrowForward"; import { CssBaseline, useMediaQuery } from "@mui/material"; @@ -95,7 +94,7 @@ type AppContextType = { setWatchFolderFiles: (files: FileList) => void; isMobile: boolean; themeColor: THEME_COLOR; - setThemeColor: SetTheme; + setThemeColor: (themeColor: THEME_COLOR) => void; somethingWentWrong: () => void; setDialogBoxAttributesV2: SetDialogBoxAttributesV2; isCFProxyDisabled: boolean; diff --git a/web/packages/shared/components/ThemeSwitcher.tsx b/web/packages/shared/components/ThemeSwitcher.tsx index 121d2e233..bde2fdafb 100644 --- a/web/packages/shared/components/ThemeSwitcher.tsx +++ b/web/packages/shared/components/ThemeSwitcher.tsx @@ -2,10 +2,12 @@ import { THEME_COLOR } from "@ente/shared/themes/constants"; import DarkModeIcon from "@mui/icons-material/DarkMode"; import LightModeIcon from "@mui/icons-material/LightMode"; import { ToggleButton, ToggleButtonGroup } from "@mui/material"; + interface Iprops { themeColor: THEME_COLOR; - setThemeColor: (theme: THEME_COLOR) => void; + setThemeColor: (themeColor: THEME_COLOR) => void; } + export default function ThemeSwitcher({ themeColor, setThemeColor }: Iprops) { const handleChange = (event, themeColor: THEME_COLOR) => { if (themeColor !== null) { diff --git a/web/packages/shared/themes/types.ts b/web/packages/shared/themes/types.ts deleted file mode 100644 index 7b8996429..000000000 --- a/web/packages/shared/themes/types.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { THEME_COLOR } from "./constants"; - -export type SetTheme = React.Dispatch>; From bb713cfc7695353abbc8d67b8fb314b9b8c0937f Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Sat, 25 May 2024 17:10:25 +0530 Subject: [PATCH 065/131] Cannot avoid a undefined initial app context --- web/apps/auth/src/pages/_app.tsx | 2 +- web/apps/auth/src/pages/auth.tsx | 9 +++++---- web/apps/auth/src/pages/change-email.tsx | 11 +++++++---- web/apps/auth/src/pages/change-password.tsx | 9 ++++++--- web/apps/auth/src/pages/credentials.tsx | 11 +++++++---- web/apps/auth/src/pages/generate.tsx | 11 +++++++---- web/apps/auth/src/pages/index.tsx | 6 +++--- web/apps/auth/src/pages/login.tsx | 11 +++++++---- web/apps/auth/src/pages/passkeys/finish.tsx | 12 ++---------- web/apps/auth/src/pages/recover.tsx | 11 +++++++---- web/apps/auth/src/pages/signup.tsx | 11 +++++++---- web/apps/auth/src/pages/two-factor/recover.tsx | 11 +++++++---- web/apps/auth/src/pages/two-factor/setup.tsx | 9 ++++++--- web/apps/auth/src/pages/two-factor/verify.tsx | 11 +++++++---- web/apps/auth/src/pages/verify.tsx | 11 +++++++---- 15 files changed, 86 insertions(+), 60 deletions(-) diff --git a/web/apps/auth/src/pages/_app.tsx b/web/apps/auth/src/pages/_app.tsx index 355b76e08..bf1167ee2 100644 --- a/web/apps/auth/src/pages/_app.tsx +++ b/web/apps/auth/src/pages/_app.tsx @@ -47,7 +47,7 @@ type AppContextType = { logout: () => void; }; -export const AppContext = createContext(null); +export const AppContext = createContext(undefined); export default function App({ Component, pageProps }: AppProps) { const router = useRouter(); diff --git a/web/apps/auth/src/pages/auth.tsx b/web/apps/auth/src/pages/auth.tsx index 93a95c880..fb005ca07 100644 --- a/web/apps/auth/src/pages/auth.tsx +++ b/web/apps/auth/src/pages/auth.tsx @@ -1,3 +1,4 @@ +import { ensure } from "@/utils/ensure"; import { HorizontalFlex, VerticallyCentered, @@ -20,8 +21,8 @@ import React, { useContext, useEffect, useState } from "react"; import { generateOTPs, type Code } from "services/code"; import { getAuthCodes } from "services/remote"; -const AuthenticatorCodesPage = () => { - const appContext = useContext(AppContext); +const Page: React.FC = () => { + const appContext = ensure(useContext(AppContext)); const router = useRouter(); const [codes, setCodes] = useState([]); const [hasFetched, setHasFetched] = useState(false); @@ -122,10 +123,10 @@ const AuthenticatorCodesPage = () => { ); }; -export default AuthenticatorCodesPage; +export default Page; const AuthNavbar: React.FC = () => { - const { isMobile, logout } = useContext(AppContext); + const { isMobile, logout } = ensure(useContext(AppContext)); return ( diff --git a/web/apps/auth/src/pages/change-email.tsx b/web/apps/auth/src/pages/change-email.tsx index 8be39d9e8..bcde88a05 100644 --- a/web/apps/auth/src/pages/change-email.tsx +++ b/web/apps/auth/src/pages/change-email.tsx @@ -1,9 +1,12 @@ +import { ensure } from "@/utils/ensure"; import ChangeEmailPage from "@ente/accounts/pages/change-email"; import { APPS } from "@ente/shared/apps/constants"; import { AppContext } from "pages/_app"; -import { useContext } from "react"; +import React, { useContext } from "react"; -export default function ChangeEmail() { - const appContext = useContext(AppContext); +const Page: React.FC = () => { + const appContext = ensure(useContext(AppContext)); return ; -} +}; + +export default Page; diff --git a/web/apps/auth/src/pages/change-password.tsx b/web/apps/auth/src/pages/change-password.tsx index 612288049..f84efa4c6 100644 --- a/web/apps/auth/src/pages/change-password.tsx +++ b/web/apps/auth/src/pages/change-password.tsx @@ -1,9 +1,12 @@ +import { ensure } from "@/utils/ensure"; import ChangePasswordPage from "@ente/accounts/pages/change-password"; import { APPS } from "@ente/shared/apps/constants"; import { AppContext } from "pages/_app"; -import { useContext } from "react"; +import React, { useContext } from "react"; -export default function ChangePassword() { - const appContext = useContext(AppContext); +const Page: React.FC = () => { + const appContext = ensure(useContext(AppContext)); return ; } + +export default Page; diff --git a/web/apps/auth/src/pages/credentials.tsx b/web/apps/auth/src/pages/credentials.tsx index 9b3c0c9c5..5e19957a3 100644 --- a/web/apps/auth/src/pages/credentials.tsx +++ b/web/apps/auth/src/pages/credentials.tsx @@ -1,9 +1,12 @@ +import { ensure } from "@/utils/ensure"; import CredentialPage from "@ente/accounts/pages/credentials"; import { APPS } from "@ente/shared/apps/constants"; import { AppContext } from "pages/_app"; -import { useContext } from "react"; +import React, { useContext } from "react"; -export default function Credential() { - const appContext = useContext(AppContext); +const Page: React.FC = () => { + const appContext = ensure(useContext(AppContext)); return ; -} +}; + +export default Page; diff --git a/web/apps/auth/src/pages/generate.tsx b/web/apps/auth/src/pages/generate.tsx index df3851357..4edfa25a2 100644 --- a/web/apps/auth/src/pages/generate.tsx +++ b/web/apps/auth/src/pages/generate.tsx @@ -1,9 +1,12 @@ +import { ensure } from "@/utils/ensure"; import GeneratePage from "@ente/accounts/pages/generate"; import { APPS } from "@ente/shared/apps/constants"; import { AppContext } from "pages/_app"; -import { useContext } from "react"; +import React, { useContext } from "react"; -export default function Generate() { - const appContext = useContext(AppContext); +const Page: React.FC = () => { + const appContext = ensure(useContext(AppContext)); return ; -} +}; + +export default Page; diff --git a/web/apps/auth/src/pages/index.tsx b/web/apps/auth/src/pages/index.tsx index 09b22fe49..e5540896e 100644 --- a/web/apps/auth/src/pages/index.tsx +++ b/web/apps/auth/src/pages/index.tsx @@ -1,8 +1,8 @@ import { PHOTOS_PAGES as PAGES } from "@ente/shared/constants/pages"; import { useRouter } from "next/router"; -import { useEffect } from "react"; +import React, { useEffect } from "react"; -const IndexPage = () => { +const Page: React.FC = () => { const router = useRouter(); useEffect(() => { router.push(PAGES.LOGIN); @@ -11,4 +11,4 @@ const IndexPage = () => { return <>; }; -export default IndexPage; +export default Page; diff --git a/web/apps/auth/src/pages/login.tsx b/web/apps/auth/src/pages/login.tsx index ee2407b54..3f87f8247 100644 --- a/web/apps/auth/src/pages/login.tsx +++ b/web/apps/auth/src/pages/login.tsx @@ -1,9 +1,12 @@ +import { ensure } from "@/utils/ensure"; import LoginPage from "@ente/accounts/pages/login"; import { APPS } from "@ente/shared/apps/constants"; import { AppContext } from "pages/_app"; -import { useContext } from "react"; +import React, { useContext } from "react"; -export default function Login() { - const appContext = useContext(AppContext); +const Page: React.FC = () => { + const appContext = ensure(useContext(AppContext)); return ; -} +}; + +export default Page; diff --git a/web/apps/auth/src/pages/passkeys/finish.tsx b/web/apps/auth/src/pages/passkeys/finish.tsx index 289f351de..866dcf9e3 100644 --- a/web/apps/auth/src/pages/passkeys/finish.tsx +++ b/web/apps/auth/src/pages/passkeys/finish.tsx @@ -1,11 +1,3 @@ -import PasskeysFinishPage from "@ente/accounts/pages/passkeys/finish"; +import Page from "@ente/accounts/pages/passkeys/finish"; -const PasskeysFinish = () => { - return ( - <> - - - ); -}; - -export default PasskeysFinish; +export default Page; diff --git a/web/apps/auth/src/pages/recover.tsx b/web/apps/auth/src/pages/recover.tsx index 64404ca35..8081bd545 100644 --- a/web/apps/auth/src/pages/recover.tsx +++ b/web/apps/auth/src/pages/recover.tsx @@ -1,9 +1,12 @@ +import { ensure } from "@/utils/ensure"; import RecoverPage from "@ente/accounts/pages/recover"; import { APPS } from "@ente/shared/apps/constants"; import { AppContext } from "pages/_app"; -import { useContext } from "react"; +import React, { useContext } from "react"; -export default function Recover() { - const appContext = useContext(AppContext); +const Page: React.FC = () => { + const appContext = ensure(useContext(AppContext)); return ; -} +}; + +export default Page; diff --git a/web/apps/auth/src/pages/signup.tsx b/web/apps/auth/src/pages/signup.tsx index d272b5c51..1fcdeb832 100644 --- a/web/apps/auth/src/pages/signup.tsx +++ b/web/apps/auth/src/pages/signup.tsx @@ -1,9 +1,12 @@ +import { ensure } from "@/utils/ensure"; import SignupPage from "@ente/accounts/pages/signup"; import { APPS } from "@ente/shared/apps/constants"; import { AppContext } from "pages/_app"; -import { useContext } from "react"; +import React, { useContext } from "react"; -export default function Sigup() { - const appContext = useContext(AppContext); +const Page: React.FC = () => { + const appContext = ensure(useContext(AppContext)); return ; -} +}; + +export default Page; diff --git a/web/apps/auth/src/pages/two-factor/recover.tsx b/web/apps/auth/src/pages/two-factor/recover.tsx index a67c7b816..1561922c4 100644 --- a/web/apps/auth/src/pages/two-factor/recover.tsx +++ b/web/apps/auth/src/pages/two-factor/recover.tsx @@ -1,9 +1,12 @@ +import { ensure } from "@/utils/ensure"; import TwoFactorRecoverPage from "@ente/accounts/pages/two-factor/recover"; import { APPS } from "@ente/shared/apps/constants"; import { AppContext } from "pages/_app"; -import { useContext } from "react"; +import React, { useContext } from "react"; -export default function TwoFactorRecover() { - const appContext = useContext(AppContext); +const Page: React.FC = () => { + const appContext = ensure(useContext(AppContext)); return ; -} +}; + +export default Page; diff --git a/web/apps/auth/src/pages/two-factor/setup.tsx b/web/apps/auth/src/pages/two-factor/setup.tsx index b007ab01b..3b3fe7d93 100644 --- a/web/apps/auth/src/pages/two-factor/setup.tsx +++ b/web/apps/auth/src/pages/two-factor/setup.tsx @@ -1,9 +1,12 @@ +import { ensure } from "@/utils/ensure"; import TwoFactorSetupPage from "@ente/accounts/pages/two-factor/setup"; import { APPS } from "@ente/shared/apps/constants"; import { AppContext } from "pages/_app"; -import { useContext } from "react"; +import React, { useContext } from "react"; -export default function TwoFactorSetup() { - const appContext = useContext(AppContext); +const Page: React.FC = () => { + const appContext = ensure(useContext(AppContext)); return ; } + +export default Page; diff --git a/web/apps/auth/src/pages/two-factor/verify.tsx b/web/apps/auth/src/pages/two-factor/verify.tsx index 85eb7ff1b..5ffd007a3 100644 --- a/web/apps/auth/src/pages/two-factor/verify.tsx +++ b/web/apps/auth/src/pages/two-factor/verify.tsx @@ -1,9 +1,12 @@ +import { ensure } from "@/utils/ensure"; import TwoFactorVerifyPage from "@ente/accounts/pages/two-factor/verify"; import { APPS } from "@ente/shared/apps/constants"; -import { useContext } from "react"; +import React, { useContext } from "react"; import { AppContext } from "../_app"; -export default function TwoFactorVerify() { - const appContext = useContext(AppContext); +const Page: React.FC = () => { + const appContext = ensure(useContext(AppContext)); return ; -} +}; + +export default Page; diff --git a/web/apps/auth/src/pages/verify.tsx b/web/apps/auth/src/pages/verify.tsx index 5171462e7..573ee79d1 100644 --- a/web/apps/auth/src/pages/verify.tsx +++ b/web/apps/auth/src/pages/verify.tsx @@ -1,9 +1,12 @@ +import { ensure } from "@/utils/ensure"; import VerifyPage from "@ente/accounts/pages/verify"; import { APPS } from "@ente/shared/apps/constants"; import { AppContext } from "pages/_app"; -import { useContext } from "react"; +import React, { useContext } from "react"; -export default function Verify() { - const appContext = useContext(AppContext); +const Page: React.FC = () => { + const appContext = ensure(useContext(AppContext)); return ; -} +}; + +export default Page; From 5690d613bbf1d977eac8103a25928c3cc4906e6c Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Sat, 25 May 2024 17:17:21 +0530 Subject: [PATCH 066/131] tsc --- web/apps/auth/src/pages/change-password.tsx | 2 +- web/apps/auth/src/pages/two-factor/setup.tsx | 2 +- web/apps/photos/src/components/Sidebar/index.tsx | 7 ++++--- web/packages/shared/components/DialogBoxV2/index.tsx | 4 +++- web/packages/shared/themes/palette/index.tsx | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/web/apps/auth/src/pages/change-password.tsx b/web/apps/auth/src/pages/change-password.tsx index f84efa4c6..cc0bfe472 100644 --- a/web/apps/auth/src/pages/change-password.tsx +++ b/web/apps/auth/src/pages/change-password.tsx @@ -7,6 +7,6 @@ import React, { useContext } from "react"; const Page: React.FC = () => { const appContext = ensure(useContext(AppContext)); return ; -} +}; export default Page; diff --git a/web/apps/auth/src/pages/two-factor/setup.tsx b/web/apps/auth/src/pages/two-factor/setup.tsx index 3b3fe7d93..5ef376776 100644 --- a/web/apps/auth/src/pages/two-factor/setup.tsx +++ b/web/apps/auth/src/pages/two-factor/setup.tsx @@ -7,6 +7,6 @@ import React, { useContext } from "react"; const Page: React.FC = () => { const appContext = ensure(useContext(AppContext)); return ; -} +}; export default Page; diff --git a/web/apps/photos/src/components/Sidebar/index.tsx b/web/apps/photos/src/components/Sidebar/index.tsx index a59c36b14..c01ffe48b 100644 --- a/web/apps/photos/src/components/Sidebar/index.tsx +++ b/web/apps/photos/src/components/Sidebar/index.tsx @@ -157,9 +157,9 @@ const UserDetailsSection: React.FC = ({ }) => { const galleryContext = useContext(GalleryContext); - const [userDetails, setUserDetails] = useLocalState( - LS_KEYS.USER_DETAILS, - ); + const [userDetails, setUserDetails] = useLocalState< + UserDetails | undefined + >(LS_KEYS.USER_DETAILS, undefined); const [memberSubscriptionManageView, setMemberSubscriptionManageView] = useState(false); @@ -198,6 +198,7 @@ const UserDetailsSection: React.FC = ({ openMemberSubscriptionManage(); } else { if ( + userDetails && hasStripeSubscription(userDetails.subscription) && isSubscriptionPastDue(userDetails.subscription) ) { diff --git a/web/packages/shared/components/DialogBoxV2/index.tsx b/web/packages/shared/components/DialogBoxV2/index.tsx index 3f318594e..a0e226c87 100644 --- a/web/packages/shared/components/DialogBoxV2/index.tsx +++ b/web/packages/shared/components/DialogBoxV2/index.tsx @@ -96,7 +96,9 @@ export default function DialogBoxV2({ size="large" color={attributes.proceed?.variant} onClick={async () => { - await attributes.proceed?.action(setLoading); + await attributes.proceed?.action( + setLoading, + ); onClose(); }} diff --git a/web/packages/shared/themes/palette/index.tsx b/web/packages/shared/themes/palette/index.tsx index 14d33eb74..81d6cd598 100644 --- a/web/packages/shared/themes/palette/index.tsx +++ b/web/packages/shared/themes/palette/index.tsx @@ -1,6 +1,6 @@ +import { ensure } from "@/utils/ensure"; import type { PaletteOptions, ThemeColorsOptions } from "@mui/material"; import { THEME_COLOR } from "../constants"; -import { ensure } from "@/utils/ensure"; export const getPallette = ( themeColor: THEME_COLOR, From b19b34b3dc9a9bece205bb7c3923c55f6fc6cad8 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Sat, 25 May 2024 17:38:52 +0530 Subject: [PATCH 067/131] Prune --- web/apps/auth/tsconfig.json | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/web/apps/auth/tsconfig.json b/web/apps/auth/tsconfig.json index 2ee2af539..11ae2368d 100644 --- a/web/apps/auth/tsconfig.json +++ b/web/apps/auth/tsconfig.json @@ -6,22 +6,13 @@ "../../packages/next/global-electron.d.ts", "../../packages/shared/themes/mui-theme.d.ts" ], - // Temporarily disable some things to get the existing code to compile - // without warnings. "compilerOptions": { + /* Set the base directory from which to resolve bare module names */ "baseUrl": "./src", - "jsxImportSource": "@emotion/react", - - "strict": true, - "strictNullChecks": true, - /* Stricter than strict */ - "noImplicitReturns": true, - "noUnusedParameters": true, - "noUnusedLocals": true, - "noFallthroughCasesInSwitch": true, - /* e.g. makes array indexing returns undefined */ + /* TODO: Enable these */ "noUncheckedIndexedAccess": false, + /* MUI doesn't play great with exactOptionalPropertyTypes currently */ "exactOptionalPropertyTypes": false } } From 390b4b1f810c7b8b7aa5598be2618fe6beede785 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Sat, 25 May 2024 17:44:29 +0530 Subject: [PATCH 068/131] Towards noUncheckedIndexedAccess --- web/apps/auth/src/services/code.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/apps/auth/src/services/code.ts b/web/apps/auth/src/services/code.ts index 82e369a8e..1df085b4e 100644 --- a/web/apps/auth/src/services/code.ts +++ b/web/apps/auth/src/services/code.ts @@ -146,8 +146,8 @@ const parseIssuer = (url: URL, path: string): string => { let p = decodeURIComponent(path); if (p.startsWith("/")) p = p.slice(1); - if (p.includes(":")) p = p.split(":")[0]; - else if (p.includes("-")) p = p.split("-")[0]; + if (p.includes(":")) p = ensure(p.split(":")[0]); + else if (p.includes("-")) p = ensure(p.split("-")[0]); return p; }; From c5b6297ceaba1d0fbdecf56f5ec47c7e11e693d3 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Sat, 25 May 2024 17:52:19 +0530 Subject: [PATCH 069/131] Wrap --- web/apps/auth/tsconfig.json | 6 ++++-- web/packages/build-config/tsconfig-typecheck.json | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/web/apps/auth/tsconfig.json b/web/apps/auth/tsconfig.json index 11ae2368d..507ae19bd 100644 --- a/web/apps/auth/tsconfig.json +++ b/web/apps/auth/tsconfig.json @@ -10,9 +10,11 @@ /* Set the base directory from which to resolve bare module names */ "baseUrl": "./src", - /* TODO: Enable these */ + /* This is hard to enforce in certain cases where we do a lot of array + indexing, e.g. image/ML ops, and TS doesn't currently have a way to + disable this for blocks of code. */ "noUncheckedIndexedAccess": false, - /* MUI doesn't play great with exactOptionalPropertyTypes currently */ + /* MUI doesn't play great with exactOptionalPropertyTypes currently. */ "exactOptionalPropertyTypes": false } } diff --git a/web/packages/build-config/tsconfig-typecheck.json b/web/packages/build-config/tsconfig-typecheck.json index 3db22b5d2..9f3d5fcb4 100644 --- a/web/packages/build-config/tsconfig-typecheck.json +++ b/web/packages/build-config/tsconfig-typecheck.json @@ -67,8 +67,10 @@ "noUnusedParameters": true, "noUnusedLocals": true, "noFallthroughCasesInSwitch": true, - /* e.g. makes array indexing returns undefined */ + /* e.g. makes array indexing returns undefined. */ "noUncheckedIndexedAccess": true, + /* Treat optional (?) properties and properties where undefined is a + valid value separately */ "exactOptionalPropertyTypes": true } } From 38d6464f55f717f082f231bc0aba8794e803c65e Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Sat, 25 May 2024 18:13:11 +0530 Subject: [PATCH 070/131] muppets --- web/packages/build-config/tsconfig-next.json | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/web/packages/build-config/tsconfig-next.json b/web/packages/build-config/tsconfig-next.json index 922ba7a7c..07d38312d 100644 --- a/web/packages/build-config/tsconfig-next.json +++ b/web/packages/build-config/tsconfig-next.json @@ -3,6 +3,12 @@ "extends": "@/build-config/tsconfig-typecheck.json", "compilerOptions": { /* Also indicate expectation of a WebWorker runtime */ - "lib": ["ESnext", "DOM", "DOM.Iterable", "WebWorker"] - } + "lib": ["ESnext", "DOM", "DOM.Iterable", "WebWorker"], + + /* Next.js insists on adding these. Sigh. */ + "allowJs": true, + "incremental": true + }, + /* Next.js insists on adding this, even though we don't need it. */ + "exclude": ["node_modules"] } From 39a706ea200c33747be29cdb3f1d48816c52f6f1 Mon Sep 17 00:00:00 2001 From: vishnukvmd Date: Sat, 25 May 2024 18:47:19 +0530 Subject: [PATCH 071/131] Update verification email address --- server/pkg/controller/user/userauth.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/pkg/controller/user/userauth.go b/server/pkg/controller/user/userauth.go index 087e00194..5d9664e99 100644 --- a/server/pkg/controller/user/userauth.go +++ b/server/pkg/controller/user/userauth.go @@ -302,7 +302,7 @@ func emailOTT(c *gin.Context, to string, ott string, client string, purpose stri inlineImage["content"] = "iVBORw0KGgoAAAANSUhEUgAAALAAAACwCAYAAACvt+ReAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABHlSURBVHgB7Z1tjFxV/ce/U7ZGxa3bEsrflr+d5o+x5W9tN/ZJAu60PFi1ursm9SnSbuWFwZIAMTFAom6jKdEX0iYg+AK7SzRqfNHWmABa2qmokW61iwq7QA23L7oiaLvs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gIEVSFTBhRiprgsYd3Zpj2KTYlGS1oRapC9hDdmVs21l/difRYQtLaklcLURy1yM+7IedYtMNRtudcc82NEvmAia2QqEdDlJO1mqRmYXwI38RnbC+WAf4HHWqIF6iRAT2I6JxH6rb9a2lUAtaBvrdpo5+ShrlBEykpaAvLsGiAmXEPIgeF0pYiNnwFyXPCmCVwshLfWkCf/e3yxKZAwVRMgL7kdG4Hwofrm0oZSgadf0oGYH9yGjch+p+OweWpHHE6lU56vpRPgL7kUPyLJobce06xfAubLk3i45aq2glYA9rK2JnAE2ejK4KWgrYwwo5MmVo4HProbwHrofPHy+HAVcUTZEBsZbr4nProXUEno0vInfBtqVno6XHbYRRAvYjO3o8myLvu6LLYh1C9Qh/42rqxgrYQwiZAmblIk9R2btIO89jKMNgjBewHyHmkvjQBzPFnBvR+smVgP1IMXMWmWLW1WZwf+Ex5Ey0fnIrYD8y+aOIKejVUFfQDqp+lsI9aKKnbRYr4ABkx2+NXJ7dSFPUFKaDqlCflB+HrWDnYgXcBDJS+9cyVOeWg1YQ43hrus7xfX1afu0u3WuzafJf05durhLhbZAAAAAASUVORK5CYII=" } inlineImages = append(inlineImages, inlineImage) - err := emailUtil.SendTemplatedEmail([]string{to}, "ente", "verification@ente.io", + err := emailUtil.SendTemplatedEmail([]string{to}, "ente", "verify@ente.io", ente.OTTEmailSubject, templateName, map[string]interface{}{ "VerificationCode": ott, }, inlineImages) From 1548bcd37808af9b8ae85c6732b89a607bbac765 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Sat, 25 May 2024 20:24:55 +0530 Subject: [PATCH 072/131] Fix dialog --- web/apps/accounts/src/pages/_app.tsx | 15 ++++++--------- web/apps/auth/src/pages/_app.tsx | 12 +++++------- web/apps/photos/src/pages/_app.tsx | 12 +++++------- web/packages/shared/apps/types.ts | 4 ++-- .../shared/components/DialogBoxV2/index.tsx | 2 +- .../shared/components/DialogBoxV2/types.ts | 4 ---- 6 files changed, 19 insertions(+), 30 deletions(-) diff --git a/web/apps/accounts/src/pages/_app.tsx b/web/apps/accounts/src/pages/_app.tsx index e08aacb3f..f2ef890b4 100644 --- a/web/apps/accounts/src/pages/_app.tsx +++ b/web/apps/accounts/src/pages/_app.tsx @@ -6,10 +6,7 @@ import { accountLogout } from "@ente/accounts/services/logout"; import { APPS, APP_TITLES } from "@ente/shared/apps/constants"; import { Overlay } from "@ente/shared/components/Container"; import DialogBoxV2 from "@ente/shared/components/DialogBoxV2"; -import type { - DialogBoxAttributesV2, - SetDialogBoxAttributesV2, -} from "@ente/shared/components/DialogBoxV2/types"; +import type { DialogBoxAttributesV2 } from "@ente/shared/components/DialogBoxV2/types"; import EnteSpinner from "@ente/shared/components/EnteSpinner"; import { AppNavbar } from "@ente/shared/components/Navbar/app"; import { useLocalState } from "@ente/shared/hooks/useLocalState"; @@ -28,7 +25,7 @@ import "styles/global.css"; interface AppContextProps { isMobile: boolean; showNavBar: (show: boolean) => void; - setDialogBoxAttributesV2: SetDialogBoxAttributesV2; + setDialogBoxAttributesV2: (attrs: DialogBoxAttributesV2) => void; logout: () => void; } @@ -39,8 +36,9 @@ export default function App({ Component, pageProps }: AppProps) { const [showNavbar, setShowNavBar] = useState(false); - const [dialogBoxAttributeV2, setDialogBoxAttributesV2] = - useState(); + const [dialogBoxAttributeV2, setDialogBoxAttributesV2] = useState< + DialogBoxAttributesV2 | undefined + >(); const [dialogBoxV2View, setDialogBoxV2View] = useState(false); @@ -106,8 +104,7 @@ export default function App({ Component, pageProps }: AppProps) { value={{ isMobile, showNavBar, - setDialogBoxAttributesV2: - setDialogBoxAttributesV2 as any, + setDialogBoxAttributesV2, logout, }} > diff --git a/web/apps/auth/src/pages/_app.tsx b/web/apps/auth/src/pages/_app.tsx index bf1167ee2..a01b8fb8d 100644 --- a/web/apps/auth/src/pages/_app.tsx +++ b/web/apps/auth/src/pages/_app.tsx @@ -12,10 +12,7 @@ import { } from "@ente/shared/apps/constants"; import { Overlay } from "@ente/shared/components/Container"; import DialogBoxV2 from "@ente/shared/components/DialogBoxV2"; -import type { - DialogBoxAttributesV2, - SetDialogBoxAttributesV2, -} from "@ente/shared/components/DialogBoxV2/types"; +import type { DialogBoxAttributesV2 } from "@ente/shared/components/DialogBoxV2/types"; import EnteSpinner from "@ente/shared/components/EnteSpinner"; import { MessageContainer } from "@ente/shared/components/MessageContainer"; import { AppNavbar } from "@ente/shared/components/Navbar/app"; @@ -43,7 +40,7 @@ type AppContextType = { themeColor: THEME_COLOR; setThemeColor: (themeColor: THEME_COLOR) => void; somethingWentWrong: () => void; - setDialogBoxAttributesV2: SetDialogBoxAttributesV2; + setDialogBoxAttributesV2: (attrs: DialogBoxAttributesV2) => void; logout: () => void; }; @@ -59,8 +56,9 @@ export default function App({ Component, pageProps }: AppProps) { const [showNavbar, setShowNavBar] = useState(false); const isLoadingBarRunning = useRef(false); const loadingBar = useRef(null); - const [dialogBoxAttributeV2, setDialogBoxAttributesV2] = - useState({}); + const [dialogBoxAttributeV2, setDialogBoxAttributesV2] = useState< + DialogBoxAttributesV2 | undefined + >(); const [dialogBoxV2View, setDialogBoxV2View] = useState(false); const isMobile = useMediaQuery("(max-width:428px)"); const [themeColor, setThemeColor] = useLocalState( diff --git a/web/apps/photos/src/pages/_app.tsx b/web/apps/photos/src/pages/_app.tsx index d9df703b7..0c8084c59 100644 --- a/web/apps/photos/src/pages/_app.tsx +++ b/web/apps/photos/src/pages/_app.tsx @@ -18,10 +18,7 @@ import { SetDialogBoxAttributes, } from "@ente/shared/components/DialogBox/types"; import DialogBoxV2 from "@ente/shared/components/DialogBoxV2"; -import type { - DialogBoxAttributesV2, - SetDialogBoxAttributesV2, -} from "@ente/shared/components/DialogBoxV2/types"; +import type { DialogBoxAttributesV2 } from "@ente/shared/components/DialogBoxV2/types"; import EnteSpinner from "@ente/shared/components/EnteSpinner"; import { MessageContainer } from "@ente/shared/components/MessageContainer"; import { AppNavbar } from "@ente/shared/components/Navbar/app"; @@ -96,7 +93,7 @@ type AppContextType = { themeColor: THEME_COLOR; setThemeColor: (themeColor: THEME_COLOR) => void; somethingWentWrong: () => void; - setDialogBoxAttributesV2: SetDialogBoxAttributesV2; + setDialogBoxAttributesV2: (attrs: DialogBoxAttributesV2) => void; isCFProxyDisabled: boolean; setIsCFProxyDisabled: (disabled: boolean) => void; logout: () => void; @@ -118,8 +115,9 @@ export default function App({ Component, pageProps }: AppProps) { const isLoadingBarRunning = useRef(false); const loadingBar = useRef(null); const [dialogMessage, setDialogMessage] = useState(); - const [dialogBoxAttributeV2, setDialogBoxAttributesV2] = - useState(); + const [dialogBoxAttributeV2, setDialogBoxAttributesV2] = useState< + DialogBoxAttributesV2 | undefined + >(); useState(null); const [messageDialogView, setMessageDialogView] = useState(false); const [dialogBoxV2View, setDialogBoxV2View] = useState(false); diff --git a/web/packages/shared/apps/types.ts b/web/packages/shared/apps/types.ts index 4c189ee0e..6c6e4fe1a 100644 --- a/web/packages/shared/apps/types.ts +++ b/web/packages/shared/apps/types.ts @@ -1,12 +1,12 @@ import { TwoFactorType } from "@ente/accounts/constants/twofactor"; -import type { SetDialogBoxAttributesV2 } from "@ente/shared/components/DialogBoxV2/types"; +import type { DialogBoxAttributesV2 } from "@ente/shared/components/DialogBoxV2/types"; import { APPS } from "./constants"; export interface PageProps { appContext: { showNavBar: (show: boolean) => void; isMobile: boolean; - setDialogBoxAttributesV2: SetDialogBoxAttributesV2; + setDialogBoxAttributesV2: (attrs: DialogBoxAttributesV2) => void; logout: () => void; }; appName: APPS; diff --git a/web/packages/shared/components/DialogBoxV2/index.tsx b/web/packages/shared/components/DialogBoxV2/index.tsx index a0e226c87..aa0173156 100644 --- a/web/packages/shared/components/DialogBoxV2/index.tsx +++ b/web/packages/shared/components/DialogBoxV2/index.tsx @@ -15,7 +15,7 @@ import type { DialogBoxAttributesV2 } from "./types"; type IProps = React.PropsWithChildren< Omit & { onClose: () => void; - attributes: DialogBoxAttributesV2; + attributes?: DialogBoxAttributesV2; } >; diff --git a/web/packages/shared/components/DialogBoxV2/types.ts b/web/packages/shared/components/DialogBoxV2/types.ts index dbb5b11a2..f2ac31f0b 100644 --- a/web/packages/shared/components/DialogBoxV2/types.ts +++ b/web/packages/shared/components/DialogBoxV2/types.ts @@ -39,7 +39,3 @@ export interface DialogBoxAttributesV2 { }[]; buttonDirection?: "row" | "column"; } - -export type SetDialogBoxAttributesV2 = React.Dispatch< - React.SetStateAction ->; From 99f1ba799d6ceeefdd863441e440e9207c523b86 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Sat, 25 May 2024 20:52:52 +0530 Subject: [PATCH 073/131] lhs of && cannot be a number needs to be false for the hole --- web/apps/auth/src/pages/auth.tsx | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/web/apps/auth/src/pages/auth.tsx b/web/apps/auth/src/pages/auth.tsx index fb005ca07..9774ee3e7 100644 --- a/web/apps/auth/src/pages/auth.tsx +++ b/web/apps/auth/src/pages/auth.tsx @@ -78,7 +78,9 @@ const Page: React.FC = () => { }} >
- {(filteredCodes.length || searchTerm.length) && ( + {filteredCodes.length == 0 && searchTerm.length == 0 ? ( + <> + ) : ( { justifyContent: "center", }} > - {filteredCodes.length ? ( - filteredCodes.map((code) => ( - - )) - ) : ( + {filteredCodes.length == 0 ? (
{ marginTop: "32px", }} > - {searchTerm.length &&

{t("NO_RESULTS")}

} + {searchTerm.length > 0 ? ( +

{t("NO_RESULTS")}

+ ) : ( + <> + )}
+ ) : ( + filteredCodes.map((code) => ( + + )) )}