From 54b4b8982bdc62da63214dc80aa168de2f072af4 Mon Sep 17 00:00:00 2001 From: Simon Knittel Date: Thu, 23 May 2024 17:07:28 +0200 Subject: [PATCH 1/7] chore(Renovate): stretch schedule to prevent rate limiting --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 417ff678..2264e60a 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -2,7 +2,7 @@ name: Renovate on: schedule: - - cron: "0,15,30,45 3,4 * * *" # Every day eight chances for Renovate to create or rebase branches and create, rebase or merge PRs + - cron: "0,30 2,3,4 * * *" # Every day six chances for Renovate to create or rebase branches and create, rebase or merge PRs workflow_dispatch: # Manually run the workflow push: # Run the workflow on changes to the configuration branches: From 0c39508003c04727c4bf8766de4cd9f9b8ac0db6 Mon Sep 17 00:00:00 2001 From: Simon Knittel Date: Thu, 23 May 2024 19:19:55 +0200 Subject: [PATCH 2/7] refactor: replace .sort() with .toSorted() in most cases --- .../app/events/[id]/_components/ParticipantsTile.tsx | 2 +- .../[id]/_components/SquadronFlightPositionEmpty.tsx | 4 ++-- .../app/operations/[id]/_components/SquadronTile.tsx | 2 +- app/src/app/app/operations/[id]/page.tsx | 10 +++++++--- app/src/app/app/roles/_components/RolesTile.tsx | 2 +- .../classification-level/ClassificationLevelsTile.tsx | 2 +- .../settings/_components/note-type/NoteTypesTile.tsx | 2 +- .../spynet/_components/ActivityTile/ActivityTile.tsx | 2 +- app/src/app/app/spynet/citizen/_components/Tile.tsx | 2 +- .../spynet/entity/[id]/_components/handle/Handles.tsx | 4 ++-- .../app/spynet/entity/[id]/_components/notes/Notes.tsx | 2 +- app/src/app/app/spynet/notes/_components/Tile.tsx | 2 +- .../spynet/other/_components/EntityLogTypeFilter.tsx | 2 +- app/src/app/app/spynet/other/_components/Tile.tsx | 2 +- 14 files changed, 22 insertions(+), 18 deletions(-) diff --git a/app/src/app/app/events/[id]/_components/ParticipantsTile.tsx b/app/src/app/app/events/[id]/_components/ParticipantsTile.tsx index 9e080957..6cba99ea 100644 --- a/app/src/app/app/events/[id]/_components/ParticipantsTile.tsx +++ b/app/src/app/app/events/[id]/_components/ParticipantsTile.tsx @@ -33,7 +33,7 @@ export const ParticipantsTile = async ({ className, event }: Props) => { discord: user, }; }) - .sort((a, b) => { + .toSorted((a, b) => { return ( a.entity?.handle || a.discord.member.nick || diff --git a/app/src/app/app/operations/[id]/_components/SquadronFlightPositionEmpty.tsx b/app/src/app/app/operations/[id]/_components/SquadronFlightPositionEmpty.tsx index 9432b83b..493d6bb5 100644 --- a/app/src/app/app/operations/[id]/_components/SquadronFlightPositionEmpty.tsx +++ b/app/src/app/app/operations/[id]/_components/SquadronFlightPositionEmpty.tsx @@ -100,7 +100,7 @@ const SquadronFlightPositionEmpty = ({ type, unit }: Readonly) => { const users = allOperationMembers ?.filter((member) => member.status === "confirmed") - .sort((a, b) => a.user.name!.localeCompare(b.user.name!)); + .toSorted((a, b) => a.user.name!.localeCompare(b.user.name!)); const memberShips = allOperationMembers?.filter( (member) => member.status === "confirmed", @@ -177,7 +177,7 @@ const SquadronFlightPositionEmpty = ({ type, unit }: Readonly) => { {memberShips?.map((member) => ( {member.user.ships - .sort((a, b) => + .toSorted((a, b) => (a.name || a.variant.name).localeCompare( b.name || b.variant.name, ), diff --git a/app/src/app/app/operations/[id]/_components/SquadronTile.tsx b/app/src/app/app/operations/[id]/_components/SquadronTile.tsx index 1572cca8..61b3e472 100644 --- a/app/src/app/app/operations/[id]/_components/SquadronTile.tsx +++ b/app/src/app/app/operations/[id]/_components/SquadronTile.tsx @@ -41,7 +41,7 @@ const SquadronTile = ({ className, unit }: Readonly) => {
{unit.childUnits - .sort((a, b) => a.title.localeCompare(b.title)) + .toSorted((a, b) => a.title.localeCompare(b.title)) .map((childUnit) => ( ))} diff --git a/app/src/app/app/operations/[id]/page.tsx b/app/src/app/app/operations/[id]/page.tsx index 23384e6f..7ed6813d 100644 --- a/app/src/app/app/operations/[id]/page.tsx +++ b/app/src/app/app/operations/[id]/page.tsx @@ -135,7 +135,7 @@ export default async function Page({ params }: Readonly) {
{operation.units .filter((unit) => unit.type === "squadron") - .sort((a, b) => a.title.localeCompare(b.title)) + .toSorted((a, b) => a.title.localeCompare(b.title)) .map((unit) => ( ))} @@ -162,7 +162,9 @@ export default async function Page({ params }: Readonly) {
    {confirmedMembers - .sort((a, b) => a.user.name!.localeCompare(b.user.name!)) + .toSorted((a, b) => + a.user.name!.localeCompare(b.user.name!), + ) .map((member) => (
  • ) {
      {unconfirmedMembers - .sort((a, b) => a.user.name!.localeCompare(b.user.name!)) + .toSorted((a, b) => + a.user.name!.localeCompare(b.user.name!), + ) .map((member) => (
    • { prisma.classificationLevel.findMany(), ]); - const sortedRoles = roles.sort((a, b) => a.name.localeCompare(b.name)); + const sortedRoles = roles.toSorted((a, b) => a.name.localeCompare(b.name)); const enableOperations = await dedupedGetUnleashFlag("EnableOperations"); diff --git a/app/src/app/app/settings/_components/classification-level/ClassificationLevelsTile.tsx b/app/src/app/app/settings/_components/classification-level/ClassificationLevelsTile.tsx index 34a71205..392ec8b7 100644 --- a/app/src/app/app/settings/_components/classification-level/ClassificationLevelsTile.tsx +++ b/app/src/app/app/settings/_components/classification-level/ClassificationLevelsTile.tsx @@ -12,7 +12,7 @@ interface Props { const ClassificationLevelsTile = async ({ className }: Readonly) => { const classificationLevels = await prisma.classificationLevel.findMany(); - const sortedClassificationLevels = classificationLevels.sort((a, b) => + const sortedClassificationLevels = classificationLevels.toSorted((a, b) => a.name.localeCompare(b.name), ); diff --git a/app/src/app/app/settings/_components/note-type/NoteTypesTile.tsx b/app/src/app/app/settings/_components/note-type/NoteTypesTile.tsx index 54a11320..de1d7380 100644 --- a/app/src/app/app/settings/_components/note-type/NoteTypesTile.tsx +++ b/app/src/app/app/settings/_components/note-type/NoteTypesTile.tsx @@ -12,7 +12,7 @@ interface Props { const NoteTypesTile = async ({ className }: Readonly) => { const noteTypes = await prisma.noteType.findMany(); - const sortedNoteTypes = noteTypes.sort((a, b) => + const sortedNoteTypes = noteTypes.toSorted((a, b) => a.name.localeCompare(b.name), ); diff --git a/app/src/app/app/spynet/_components/ActivityTile/ActivityTile.tsx b/app/src/app/app/spynet/_components/ActivityTile/ActivityTile.tsx index ab83f1da..a7f3a2d3 100644 --- a/app/src/app/app/spynet/_components/ActivityTile/ActivityTile.tsx +++ b/app/src/app/app/spynet/_components/ActivityTile/ActivityTile.tsx @@ -94,7 +94,7 @@ export const ActivityTile = async ({ className }: Props) => { ...(await mapOrganizationMembershipHistoryEntries(result[2])), ]; - const sortedEntries = entries.sort( + const sortedEntries = entries.toSorted( (a, b) => b.date.getTime() - a.date.getTime(), ); diff --git a/app/src/app/app/spynet/citizen/_components/Tile.tsx b/app/src/app/app/spynet/citizen/_components/Tile.tsx index 1ce515fc..5cad94f8 100644 --- a/app/src/app/app/spynet/citizen/_components/Tile.tsx +++ b/app/src/app/app/spynet/citizen/_components/Tile.tsx @@ -78,7 +78,7 @@ export const Tile = async ({ searchParams }: Props) => { return unknown && role; }); - const sortedRows = filteredRows.sort((a, b) => { + const sortedRows = filteredRows.toSorted((a, b) => { switch (searchParams.get("sort")) { case "handle-asc": return sortAscWithAndNullLast(a.entity.handle, b.entity.handle); diff --git a/app/src/app/app/spynet/entity/[id]/_components/handle/Handles.tsx b/app/src/app/app/spynet/entity/[id]/_components/handle/Handles.tsx index 55f454c0..41f32034 100644 --- a/app/src/app/app/spynet/entity/[id]/_components/handle/Handles.tsx +++ b/app/src/app/app/spynet/entity/[id]/_components/handle/Handles.tsx @@ -32,7 +32,7 @@ const Handles = ({ entity }: Readonly) => { .filter((log) => log.type === "handle") .filter((log) => { const confirmed = log.attributes - .sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime()) + .toSorted((a, b) => b.createdAt.getTime() - a.createdAt.getTime()) .find((attribute) => attribute.key === "confirmed"); if (confirmed && confirmed.value === "confirmed") return true; @@ -40,7 +40,7 @@ const Handles = ({ entity }: Readonly) => { return authentication.authorize("handle", "confirm"); }) - .sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime()); + .toSorted((a, b) => b.createdAt.getTime() - a.createdAt.getTime()); return ( <> diff --git a/app/src/app/app/spynet/entity/[id]/_components/notes/Notes.tsx b/app/src/app/app/spynet/entity/[id]/_components/notes/Notes.tsx index 4ab4ec88..f9d3a5d7 100644 --- a/app/src/app/app/spynet/entity/[id]/_components/notes/Notes.tsx +++ b/app/src/app/app/spynet/entity/[id]/_components/notes/Notes.tsx @@ -43,7 +43,7 @@ export const Notes = async ({ className, entity }: Props) => { prisma.noteType.findMany(), ]); - const sortedNotes = notes.sort( + const sortedNotes = notes.toSorted( (a, b) => b.createdAt.getTime() - a.createdAt.getTime(), ); diff --git a/app/src/app/app/spynet/notes/_components/Tile.tsx b/app/src/app/app/spynet/notes/_components/Tile.tsx index a2cca9c9..4cd09df9 100644 --- a/app/src/app/app/spynet/notes/_components/Tile.tsx +++ b/app/src/app/app/spynet/notes/_components/Tile.tsx @@ -147,7 +147,7 @@ const Tile = async ({ searchParams }: Readonly) => { return confirmation && noteType && classificationLevel; }); - const sortedRows = filteredRows.sort((a, b) => { + const sortedRows = filteredRows.toSorted((a, b) => { switch (searchParams.get("sort")) { case "confirmed-at-asc": return sortAscWithAndNullLast( diff --git a/app/src/app/app/spynet/other/_components/EntityLogTypeFilter.tsx b/app/src/app/app/spynet/other/_components/EntityLogTypeFilter.tsx index 8471e71a..0654d17e 100644 --- a/app/src/app/app/spynet/other/_components/EntityLogTypeFilter.tsx +++ b/app/src/app/app/spynet/other/_components/EntityLogTypeFilter.tsx @@ -62,7 +62,7 @@ const EntityLogTypeFilter = ({ entityLogTypes }: Readonly) => { onSubmit={handleSubmit(onSubmit)} > {Array.from(entityLogTypes) - .sort((a, b) => a[1].localeCompare(b[1])) + .toSorted((a, b) => a[1].localeCompare(b[1])) .map(([type, translation]) => (
      ) => { return confirmation && type; }); - const sortedRows = filteredRows.sort((a, b) => { + const sortedRows = filteredRows.toSorted((a, b) => { switch (searchParams.get("sort")) { case "confirmed-at-asc": return sortAscWithAndNullLast( From 543d534ebc29f013886cd577b5ce1230eee0d206 Mon Sep 17 00:00:00 2001 From: Simon Knittel Date: Thu, 23 May 2024 19:43:06 +0200 Subject: [PATCH 3/7] feat: add --- app/src/app/_components/CmdK/CmdKLoader.tsx | 4 +- .../_components/Sidebar/DesktopSidebar.tsx | 9 ++-- .../app/_components/Sidebar/InstallPWA.tsx | 44 +++++++++++++++++++ .../_components/Sidebar/MobileActionBar.tsx | 4 ++ 4 files changed, 55 insertions(+), 6 deletions(-) create mode 100644 app/src/app/_components/Sidebar/InstallPWA.tsx diff --git a/app/src/app/_components/CmdK/CmdKLoader.tsx b/app/src/app/_components/CmdK/CmdKLoader.tsx index f4be895b..7d6d4a0b 100644 --- a/app/src/app/_components/CmdK/CmdKLoader.tsx +++ b/app/src/app/_components/CmdK/CmdKLoader.tsx @@ -19,13 +19,13 @@ export const CmdKLoader = ({ className, disableAlgolia }: Props) => { diff --git a/app/src/app/_components/Sidebar/DesktopSidebar.tsx b/app/src/app/_components/Sidebar/DesktopSidebar.tsx index b84dffb5..dbff06f1 100644 --- a/app/src/app/_components/Sidebar/DesktopSidebar.tsx +++ b/app/src/app/_components/Sidebar/DesktopSidebar.tsx @@ -33,10 +33,11 @@ export const DesktopSidebar = async () => {
      - +
      + + + {/* */} +