π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Merge @/ui into @/next
Manav Rathi26b35cec9ef3
diff --git a/web/apps/accounts/src/pages/_app.tsx b/web/apps/accounts/src/pages/_app.tsxindex 8ff4c6a9fa..513844237e 100644--- a/web/apps/accounts/src/pages/_app.tsx+++ b/web/apps/accounts/src/pages/_app.tsx@@ -1,4 +1,4 @@-import { setupI18n } from "@/ui/i18n";+import { setupI18n } from "@/next/i18n";import { APPS, APP_TITLES } from "@ente/shared/apps/constants";import { Overlay } from "@ente/shared/components/Container";import DialogBoxV2 from "@ente/shared/components/DialogBoxV2";diff --git a/web/apps/auth/src/pages/_app.tsx b/web/apps/auth/src/pages/_app.tsxindex 06dfc2402c..891dde1dd8 100644--- a/web/apps/auth/src/pages/_app.tsx+++ b/web/apps/auth/src/pages/_app.tsx@@ -1,4 +1,4 @@-import { setupI18n } from "@/ui/i18n";+import { setupI18n } from "@/next/i18n";import {APPS,APP_TITLES,diff --git a/web/apps/photos/src/components/Sidebar/Preferences/LanguageSelector.tsx b/web/apps/photos/src/components/Sidebar/Preferences/LanguageSelector.tsxindex c832be356a..a9474a37d9 100644--- a/web/apps/photos/src/components/Sidebar/Preferences/LanguageSelector.tsx+++ b/web/apps/photos/src/components/Sidebar/Preferences/LanguageSelector.tsx@@ -3,7 +3,7 @@ import {setLocaleInUse,supportedLocales,type SupportedLocale,-} from "@/ui/i18n";+} from "@/next/i18n";import DropdownInput, { DropdownOption } from "components/DropdownInput";import { t } from "i18next";import { useRouter } from "next/router";diff --git a/web/apps/photos/src/pages/_app.tsx b/web/apps/photos/src/pages/_app.tsxindex ce06b00da6..07662daf44 100644--- a/web/apps/photos/src/pages/_app.tsx+++ b/web/apps/photos/src/pages/_app.tsx@@ -1,4 +1,4 @@-import { setupI18n } from "@/ui/i18n";+import { setupI18n } from "@/next/i18n";import {APPS,APP_TITLES,diff --git a/web/docs/dependencies.md b/web/docs/dependencies.mdindex a1daaf0b2f..0a7e2b38d5 100644--- a/web/docs/dependencies.md+++ b/web/docs/dependencies.md@@ -47,10 +47,10 @@ bit more exhaustively when changing the crypto layer.## UI-The UI package uses "react". This is our core framework.+### React-React also has a sibling "react-dom" package that renders "React" interfaces to-the DOM.+[React](https://react.dev) ("react") is our core framework. It also has a+sibling "react-dom" package that renders JSX to the DOM.### MUI and Emotion@@ -75,6 +75,8 @@ Emotion itself comes in many parts, of which we need the following:> Keep `@emotion/styled` as a dependency of your project. Even if you never> use it explicitly, it's a peer dependency of `@mui/material`.+#### Component selectors+Note that currently the SWC plugin doesn't allow the use of the componentselectors API (i.e using `styled.div` instead of `styled("div")`).@@ -104,3 +106,18 @@ Note that inspite of the "next" in the name of the library, it has nothing to dowith Next.js.For more details, see [translations.md](translations.md).++## Meta Frameworks++### Next.js++[Next.js](https://nextjs.org) ("next") provides the meta framework for both the+Photos and the Auth app, and also for some of the sidecar apps like accounts and+cast.++We use a limited subset of Next. The main thing we get out of it is a reasonable+set of defaults for bundling our app into a static export which we can then+deploy to our webserver. In addition, the Next.js page router is convenient.+Apart from this, while we use a few tidbits from Next.js here and there, overall+our apps are regular React SPAs, and are not particularly tied to Next.+diff --git a/web/packages/next/README.md b/web/packages/next/README.mdindex 1602f873fd..4a4dc45bad 100644--- a/web/packages/next/README.md+++ b/web/packages/next/README.md@@ -1,8 +1,9 @@## @/next-Like [@/ui](../ui/README.md), but for things that require Next.+A base package for our UI layer code, for sharing ode between our Next.js apps.### PackagingThis (internal) package exports a React TypeScript library. We rely on theimporting project to transpile and bundle it.+diff --git a/web/packages/ui/components/Card.tsx b/web/packages/next/components/Card.tsxsimilarity index 100%rename from web/packages/ui/components/Card.tsxrename to web/packages/next/components/Card.tsxdiff --git a/web/packages/ui/i18n.ts b/web/packages/next/i18n.tssimilarity index 100%rename from web/packages/ui/i18n.tsrename to web/packages/next/i18n.tsdiff --git a/web/packages/next/next.config.base.js b/web/packages/next/next.config.base.jsindex 89b7456383..f0d1481b40 100644--- a/web/packages/next/next.config.base.js+++ b/web/packages/next/next.config.base.js@@ -51,7 +51,7 @@ const nextConfig = {emotion: true,},// Use Next.js to transpile our internal packages before bundling them.- transpilePackages: ["@/next", "@/ui", "@/utils"],+ transpilePackages: ["@/next", "@/utils"],// Add environment variables to the JavaScript bundle. They will be// available as `process.env.VAR_NAME` to our code.diff --git a/web/packages/next/package.json b/web/packages/next/package.jsonindex 03f2c17b54..d21ee5c53d 100644--- a/web/packages/next/package.json+++ b/web/packages/next/package.json@@ -3,11 +3,21 @@"version": "0.0.0","private": true,"dependencies": {- "@/ui": "*",- "next": "^14.1"+ "@emotion/react": "^11.11",+ "@emotion/styled": "^11.11",+ "@mui/icons-material": "^5.15",+ "@mui/material": "^5.15",+ "get-user-locale": "^2.3",+ "i18next": "^23.10",+ "i18next-http-backend": "^2.5",+ "next": "^14.1",+ "react": "^18",+ "react-dom": "^18",+ "react-i18next": "^14"},"devDependencies": {"@/build-config": "*",- "@types/node": "^20"+ "@types/react": "^18",+ "@types/react-dom": "^18"}}diff --git a/web/packages/shared/README.md b/web/packages/shared/README.mdindex eaa7babe35..ba92b46f16 100644--- a/web/packages/shared/README.md+++ b/web/packages/shared/README.md@@ -1,3 +1,3 @@Deprecated in favor of [@/utils](../utils/README.md) and-[@/ui](../ui/README.md). Don't add new code here - we'll slowly be migrating+[@/next](../next/README.md). Don't add new code here - we'll slowly be migratingexisting code from here to those two packages.diff --git a/web/packages/ui/.eslintrc.js b/web/packages/ui/.eslintrc.jsdeleted file mode 100644index 7372de7294..0000000000--- a/web/packages/ui/.eslintrc.js+++ /dev/null@@ -1,6 +0,0 @@-module.exports = {- extends: ["@/build-config/eslintrc-typescript-react"],- parserOptions: {- tsconfigRootDir: __dirname,- },-};diff --git a/web/packages/ui/README.md b/web/packages/ui/README.mddeleted file mode 100644index 69c0a71e22..0000000000--- a/web/packages/ui/README.md+++ /dev/null@@ -1,8 +0,0 @@-## @/ui--Like [@/utils](../utils/README.md), but for things that require React.--### Packaging--This (internal) package exports a React TypeScript library. We rely on the-importing project to transpile and bundle it.diff --git a/web/packages/ui/package.json b/web/packages/ui/package.jsondeleted file mode 100644index 125b8de7c7..0000000000--- a/web/packages/ui/package.json+++ /dev/null@@ -1,22 +0,0 @@-{- "name": "@/ui",- "version": "0.0.0",- "private": true,- "dependencies": {- "@emotion/react": "^11.11",- "@emotion/styled": "^11.11",- "@mui/icons-material": "^5.15",- "@mui/material": "^5.15",- "get-user-locale": "^2.3",- "i18next": "^23.10",- "i18next-http-backend": "^2.5",- "react": "^18",- "react-dom": "^18",- "react-i18next": "^14"- },- "devDependencies": {- "@/build-config": "*",- "@types/react": "^18",- "@types/react-dom": "^18"- }-}diff --git a/web/packages/ui/tsconfig.json b/web/packages/ui/tsconfig.jsondeleted file mode 100644index f5c1248424..0000000000--- a/web/packages/ui/tsconfig.json+++ /dev/null@@ -1,5 +0,0 @@-{- "extends": "@/build-config/tsconfig.transpile.json",- /* Typecheck all files with the given extensions (here or in subfolders) */- "include": ["**/*.ts", "**/*.tsx"]-}