Skip to content

Commit

Permalink
Upgrade to React 19, Lingui 5, and update dependencies (#645)
Browse files Browse the repository at this point in the history
### Summary & Motivation

The following changes were made:
- Upgrade the project to React 19
- Update Lingui to v 5 and split Lingui macro imports according to v5
guidelines.
- Upgrade TypeScript from 5.6 to 5.7, with adjustments to suppress
render prop type errors.
- Update all remaining npm packages to their latest versions.

### Downstream Projects

Update all translations in the self-contained system to align with
Lingui macro imports according to v5 guidelines. Change:

```TypeScript
import { t, Trans } from "@lingui/macro";

```
to
```TypeScript
import { t } from "@lingui/core/macro";
import { Trans } from "@lingui/react/macro";
```


### Checklist

- [x] I have added a Label to the pull-request
- [x] I have added tests, and done manual regression tests
- [x] I have updated the documentation, if necessary
  • Loading branch information
tjementum authored Dec 16, 2024
2 parents 679a769 + 50486d2 commit b4ce066
Showing 25 changed files with 4,272 additions and 4,220 deletions.
Original file line number Diff line number Diff line change
@@ -9,7 +9,8 @@ import { Dialog } from "@repo/ui/components/Dialog";
import { FormErrorMessage } from "@repo/ui/components/FormErrorMessage";
import { Modal } from "@repo/ui/components/Modal";
import { api } from "@/shared/lib/api/client";
import { t, Trans } from "@lingui/macro";
import { t } from "@lingui/core/macro";
import { Trans } from "@lingui/react/macro";

type InviteUserModalProps = {
isOpen: boolean;
Original file line number Diff line number Diff line change
@@ -2,7 +2,8 @@ import { ListFilterIcon } from "lucide-react";
import { useState } from "react";
import { Button } from "@repo/ui/components/Button";
import { SearchField } from "@repo/ui/components/SearchField";
import { t, Trans } from "@lingui/macro";
import { t } from "@lingui/core/macro";
import { Trans } from "@lingui/react/macro";

export function UserQuerying() {
const [searchTerm, setSearchTerm] = useState<string>("");
Original file line number Diff line number Diff line change
@@ -10,7 +10,8 @@ import { Button } from "@repo/ui/components/Button";
import { Avatar } from "@repo/ui/components/Avatar";
import { api, type components, SortableUserProperties, SortOrder, useApi } from "@/shared/lib/api/client";
import { useNavigate, useSearch } from "@tanstack/react-router";
import { t, Trans } from "@lingui/macro";
import { t } from "@lingui/core/macro";
import { Trans } from "@lingui/react/macro";
import { AlertDialog } from "@repo/ui/components/AlertDialog";
import { Modal } from "@repo/ui/components/Modal";
import { useUserInfo } from "@repo/infrastructure/auth/hooks";
@@ -23,7 +24,7 @@ export function UserTable() {
const userInfo = useUserInfo();

const [sortDescriptor, setSortDescriptor] = useState<SortDescriptor>(() => ({
column: orderBy,
column: orderBy ?? "email",
direction: sortOrder === "Ascending" ? "ascending" : "descending"
}));

3 changes: 2 additions & 1 deletion application/account-management/WebApp/routes/login/index.tsx
Original file line number Diff line number Diff line change
@@ -9,7 +9,8 @@ import logoMarkUrl from "@/shared/images/logo-mark.svg";
import poweredByUrl from "@/shared/images/powered-by.svg";
import { TextField } from "@repo/ui/components/TextField";
import { useFormState } from "react-dom";
import { t, Trans } from "@lingui/macro";
import { t } from "@lingui/core/macro";
import { Trans } from "@lingui/react/macro";
import { useState } from "react";
import { api } from "@/shared/lib/api/client";
import { setLoginState } from "./-shared/loginState";
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { createFileRoute } from "@tanstack/react-router";
import { HorizontalHeroLayout } from "@/shared/layouts/HorizontalHeroLayout";
import { ErrorMessage } from "@/shared/components/ErrorMessage";
import { t, Trans } from "@lingui/macro";
import { t } from "@lingui/core/macro";
import { Trans } from "@lingui/react/macro";
import { Button } from "@repo/ui/components/Button";
import { DigitPattern } from "@repo/ui/components/Digit";
import { Form } from "@repo/ui/components/Form";
Original file line number Diff line number Diff line change
@@ -2,7 +2,8 @@ import { createFileRoute, Navigate } from "@tanstack/react-router";
import { HorizontalHeroLayout } from "@/shared/layouts/HorizontalHeroLayout";
import { ErrorMessage } from "@/shared/components/ErrorMessage";
import { DotIcon } from "lucide-react";
import { t, Trans } from "@lingui/macro";
import { t } from "@lingui/core/macro";
import { Trans } from "@lingui/react/macro";
import { Button } from "@repo/ui/components/Button";
import { Heading } from "@repo/ui/components/Heading";
import { Link } from "@repo/ui/components/Link";
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { createFileRoute } from "@tanstack/react-router";
import { HorizontalHeroLayout } from "@/shared/layouts/HorizontalHeroLayout";
import { ErrorMessage } from "@/shared/components/ErrorMessage";
import { t, Trans } from "@lingui/macro";
import { t } from "@lingui/core/macro";
import { Trans } from "@lingui/react/macro";
import { Button } from "@repo/ui/components/Button";
import { DigitPattern } from "@repo/ui/components/Digit";
import { Form } from "@repo/ui/components/Form";
Original file line number Diff line number Diff line change
@@ -8,7 +8,8 @@ import DeleteAccountModal from "@/shared/components/accountModals/DeleteAccountC
import { Avatar } from "@repo/ui/components/Avatar";
import { useUserInfo } from "@repo/infrastructure/auth/hooks";
import { api } from "@/shared/lib/api/client";
import { t, Trans } from "@lingui/macro";
import { t } from "@lingui/core/macro";
import { Trans } from "@lingui/react/macro";

export default function AvatarButton() {
const [isProfileModalOpen, setIsProfileModalOpen] = useState(false);
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type React from "react";
import { MenuButton, SideMenu, SideMenuSeparator } from "@repo/ui/components/SideMenu";
import { CircleUserIcon, HomeIcon, UsersIcon } from "lucide-react";
import { t, Trans } from "@lingui/macro";
import { t } from "@lingui/core/macro";
import { Trans } from "@lingui/react/macro";

type SharedSideMenuProps = {
children?: React.ReactNode;
Original file line number Diff line number Diff line change
@@ -6,7 +6,8 @@ import { TextField } from "@repo/ui/components/TextField";
import { Heading, Label, Separator } from "react-aria-components";
import { Trash2, XIcon } from "lucide-react";
import React from "react";
import { t, Trans } from "@lingui/macro";
import { t } from "@lingui/core/macro";
import { Trans } from "@lingui/react/macro";

type AccountSettingsModal = {
isOpen: boolean;
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { AlertDialog } from "@repo/ui/components/AlertDialog";
import { Modal } from "@repo/ui/components/Modal";
import { t, Trans } from "@lingui/macro";
import { t } from "@lingui/core/macro";
import { Trans } from "@lingui/react/macro";

type DeleteAccountConfirmationProps = {
isOpen: boolean;
Original file line number Diff line number Diff line change
@@ -5,7 +5,8 @@ import { Button } from "@repo/ui/components/Button";
import { LifeBuoyIcon } from "lucide-react";
import type { ReactNode } from "react";
import AvatarButton from "../AvatarButton";
import { t, Trans } from "@lingui/macro";
import { t } from "@lingui/core/macro";
import { Trans } from "@lingui/react/macro";

interface TopMenuProps {
children?: ReactNode;
Original file line number Diff line number Diff line change
@@ -10,7 +10,8 @@ import { Modal } from "@repo/ui/components/Modal";
import { TextField } from "@repo/ui/components/TextField";
import type { Schemas } from "@/shared/lib/api/client";
import { api } from "@/shared/lib/api/client";
import { t, Trans } from "@lingui/macro";
import { t } from "@lingui/core/macro";
import { Trans } from "@lingui/react/macro";

const MAX_FILE_SIZE = 1024 * 1024; // 1MB in bytes
const ALLOWED_FILE_TYPES = ["image/jpeg", "image/png", "image/gif", "image/webp"]; // Align with backend
Original file line number Diff line number Diff line change
@@ -43,9 +43,11 @@ msgstr "Tilføjet"
msgid "All Users"
msgstr "Alle brugere"

#. placeholder {0}: error.message
msgid "An error occurred while processing your request. {0}"
msgstr "Der opstod en fejl under behandlingen af din anmodning. {0}"

#. placeholder {0}: `${userToDelete?.firstName ?? ""} ${userToDelete?.lastName ?? ""}`.trim() || userToDelete?.email
msgid "Are you sure you want to delete {0}?"
msgstr "Er du sikker på, at du vil slette {0}?"

Original file line number Diff line number Diff line change
@@ -43,9 +43,11 @@ msgstr "Added"
msgid "All Users"
msgstr "All Users"

#. placeholder {0}: error.message
msgid "An error occurred while processing your request. {0}"
msgstr "An error occurred while processing your request. {0}"

#. placeholder {0}: `${userToDelete?.firstName ?? ""} ${userToDelete?.lastName ?? ""}`.trim() || userToDelete?.email
msgid "Are you sure you want to delete {0}?"
msgstr "Are you sure you want to delete {0}?"

Original file line number Diff line number Diff line change
@@ -43,9 +43,11 @@ msgstr "Toegevoegd"
msgid "All Users"
msgstr "Alle gebruikers"

#. placeholder {0}: error.message
msgid "An error occurred while processing your request. {0}"
msgstr "Er is een fout opgetreden bij het verwerken van uw verzoek. {0}"

#. placeholder {0}: `${userToDelete?.firstName ?? ""} ${userToDelete?.lastName ?? ""}`.trim() || userToDelete?.email
msgid "Are you sure you want to delete {0}?"
msgstr "Weet je zeker dat je {0} wilt verwijderen?"

Original file line number Diff line number Diff line change
@@ -5,7 +5,8 @@ import { Button } from "@repo/ui/components/Button";
import { LifeBuoyIcon } from "lucide-react";
import type { ReactNode } from "react";
import { lazy } from "react";
import { t, Trans } from "@lingui/macro";
import { t } from "@lingui/core/macro";
import { Trans } from "@lingui/react/macro";

const AvatarButton = lazy(() => import("account-management/AvatarButton"));

Loading
Oops, something went wrong.

0 comments on commit b4ce066

Please sign in to comment.