Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Production deployment #735

Merged
merged 7 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/renovate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions app/src/app/_components/CmdK/CmdKLoader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ export const CmdKLoader = ({ className, disableAlgolia }: Props) => {
<button
className={clsx(
className,
"hidden lg:block text-neutral-600 text-center text-sm hover:text-neutral-400 group",
"hidden lg:block text-neutral-600 text-center text-sm hover:text-neutral-400 active:text-neutral-300 group",
)}
type="button"
onClick={() => setOpen(true)}
>
Hotkey{" "}
<span className="px-2 py-1 rounded border border-neutral-800 group-hover:border-neutral-600">
<span className="px-2 py-1 rounded border border-neutral-800 group-hover:border-neutral-600 group-active:border-neutral-500">
Strg + K
</span>
</button>
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/_components/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function Modal({

return createPortal(
<div
className="fixed inset-0 z-30 flex cursor-pointer items-center justify-center bg-neutral-800/50 p-2 backdrop-blur"
className="fixed inset-0 z-30 flex cursor-pointer items-start lg:items-center justify-center bg-neutral-800/50 p-4 backdrop-blur"
onClick={onRequestClose || (() => router.back())}
>
<div
Expand Down
9 changes: 5 additions & 4 deletions app/src/app/_components/Sidebar/DesktopSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ export const DesktopSidebar = async () => {
<div>
<Account />

<CmdKLoader
disableAlgolia={disableAlgolia}
className="block mt-4 mx-auto"
/>
<div className="flex justify-evenly items-center mt-4">
<CmdKLoader disableAlgolia={disableAlgolia} />

{/* <InstallPWA /> */}
</div>

<nav
className="p-4 border-neutral-800 relative"
Expand Down
44 changes: 44 additions & 0 deletions app/src/app/_components/Sidebar/InstallPWA.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
"use client";

import clsx from "clsx";
import { useEffect, useRef } from "react";
import {
MdOutlineInstallDesktop,
MdOutlineInstallMobile,
} from "react-icons/md";

type Props = Readonly<{
className?: string;
}>;

export const InstallPWA = ({ className }: Props) => {
const installPrompt = useRef(null);

useEffect(() => {
window.addEventListener("beforeinstallprompt", (e) => {
installPrompt.current = e;
});
}, []);

const handleClick = async () => {
if (!installPrompt.current) return;
await installPrompt.current.prompt();
};

return (
<button
className={clsx(
className,
"text-neutral-600 text-center text-sm hover:text-neutral-400 active:text-neutral-300 inline-flex gap-2 items-center group",
)}
type="button"
onClick={handleClick}
>
App installieren
<span className="p-1 rounded border border-neutral-800 group-hover:border-neutral-600 group-active:border-neutral-500">
<MdOutlineInstallMobile className="lg:hidden" />
<MdOutlineInstallDesktop className="hidden lg:block" />
</span>
</button>
);
};
4 changes: 4 additions & 0 deletions app/src/app/_components/Sidebar/MobileActionBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ export const MobileActionBar = async ({ className }: Props) => {
<MobileActionBarFlyout>
<Account />

{/* <div className="flex justify-evenly items-center mt-4">
<InstallPWA />
</div> */}

<div className="p-4 relative" data-red-bar-container>
<ul>
<li>
Expand Down
9 changes: 6 additions & 3 deletions app/src/app/app/_components/Event.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,16 @@ export const Event = async ({ className, event, index }: Props) => {
</p>
</div>

<div className="flex-initial flex flex-col gap-2 p-4 pt-0 lg:pl-8 lg:pr-8 lg:pb-8 3xl:pt-8">
<DiscordButton path={`events/${event.guild_id}/${event.id}`} />
<div className="flex-initial flex 3xl:flex-col gap-2 p-4 pt-0 lg:pl-8 lg:pr-8 lg:pb-8 3xl:pt-8">
<DiscordButton
path={`events/${event.guild_id}/${event.id}`}
className="flex-1"
/>

{authentication.authorize("eventFleet", "read") && (
<Link
href={`/app/events/${event.id}`}
className="flex items-center justify-center gap-4 rounded uppercase h-11 border text-base border-sinister-red-500 text-sinister-red-500 hover:border-sinister-red-300 active:border-sinister-red-300 hover:text-sinister-red-300 active:text-sinister-red-300 px-6 whitespace-nowrap"
className="flex-1 flex items-center justify-center gap-4 rounded uppercase h-11 border text-base border-sinister-red-500 text-sinister-red-500 hover:border-sinister-red-300 active:border-sinister-red-300 hover:text-sinister-red-300 active:text-sinister-red-300 px-6 whitespace-nowrap"
>
Details
</Link>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ||
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/app/events/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default async function Page({ params }: Props) {
const { date, data: event } = await getEvent(params.id);

return (
<main className="p-2 pb-20 lg:p-8 max-w-[1920px] mx-auto">
<main className="p-4 pb-20 lg:p-8 max-w-[1920px] mx-auto">
<div className="flex gap-2 font-bold text-xl mb-4">
<span className="text-neutral-500">Event /</span>
<h1>{event.name}</h1>
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/app/events/error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface Props {

export default function Error({ error }: Readonly<Props>) {
return (
<main className="p-2 pb-20 lg:p-8">
<main className="p-4 pb-20 lg:p-8">
<Note
message="Beim Laden der Events ist ein Fehler aufgetreten."
error={error}
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/app/fleet/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default async function Page() {
const showMyFleetTile = authentication.authorize("ship", "manage");

return (
<main className="p-2 pb-20 lg:p-8 max-w-[1920px] mx-auto">
<main className="p-4 pb-20 lg:p-8 max-w-[1920px] mx-auto">
<div className="flex justify-center">
<Hero text="Flotte" />
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/app/fleet/settings/manufacturer/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type Props = Readonly<{

export default function Layout({ children, breadcrumbs }: Props) {
return (
<div className="p-2 pb-20 lg:p-8">
<div className="p-4 pb-20 lg:p-8">
<div className="mb-4">{breadcrumbs}</div>

{children}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const SquadronFlightPositionEmpty = ({ type, unit }: Readonly<Props>) => {

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",
Expand Down Expand Up @@ -177,7 +177,7 @@ const SquadronFlightPositionEmpty = ({ type, unit }: Readonly<Props>) => {
{memberShips?.map((member) => (
<optgroup key={member.userId} label={member.user.name!}>
{member.user.ships
.sort((a, b) =>
.toSorted((a, b) =>
(a.name || a.variant.name).localeCompare(
b.name || b.variant.name,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const SquadronTile = ({ className, unit }: Readonly<Props>) => {

<div className="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4 mt-4">
{unit.childUnits
.sort((a, b) => a.title.localeCompare(b.title))
.toSorted((a, b) => a.title.localeCompare(b.title))
.map((childUnit) => (
<SquadronFlightTile key={childUnit.id} unit={childUnit} />
))}
Expand Down
12 changes: 8 additions & 4 deletions app/src/app/app/operations/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export default async function Page({ params }: Readonly<Props>) {
);

return (
<main className="p-2 pb-20 lg:p-8">
<main className="p-4 pb-20 lg:p-8">
<div className="flex gap-2 font-bold text-xl">
<Link
href="/app/operations"
Expand All @@ -135,7 +135,7 @@ export default async function Page({ params }: Readonly<Props>) {
<div>
{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) => (
<SquadronTile key={unit.id} unit={unit} className="mt-4" />
))}
Expand All @@ -162,7 +162,9 @@ export default async function Page({ params }: Readonly<Props>) {

<ul className="mt-2 flex flex-col gap-1">
{confirmedMembers
.sort((a, b) => a.user.name!.localeCompare(b.user.name!))
.toSorted((a, b) =>
a.user.name!.localeCompare(b.user.name!),
)
.map((member) => (
<li
className="flex gap-2 items-center"
Expand Down Expand Up @@ -193,7 +195,9 @@ export default async function Page({ params }: Readonly<Props>) {

<ul className="mt-2 flex flex-col gap-1">
{unconfirmedMembers
.sort((a, b) => a.user.name!.localeCompare(b.user.name!))
.toSorted((a, b) =>
a.user.name!.localeCompare(b.user.name!),
)
.map((member) => (
<li
className="flex gap-2 items-center"
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/app/operations/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default async function Page() {
});

return (
<main className="p-2 pb-20 lg:p-8">
<main className="p-4 pb-20 lg:p-8">
<h1 className="text-xl font-bold">Operationen</h1>

<Note
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default async function Page({ searchParams }: Props) {
const showUwuHero = Object.hasOwn(searchParams, "uwu");

return (
<main className="p-2 pb-20 lg:p-8 max-w-[1920px] mx-auto">
<main className="p-4 pb-20 lg:p-8 max-w-[1920px] mx-auto">
<div className="flex justify-center">
{showUwuHero ? <UwuHero /> : <Hero text="S.A.M." />}
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/app/roles/_components/RolesTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const RolesTile = async ({ className }: Props) => {
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");

Expand Down
2 changes: 1 addition & 1 deletion app/src/app/app/roles/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default async function Page() {
authentication.authorizePage("role", "manage");

return (
<main className="p-2 pb-20 lg:p-8">
<main className="p-4 pb-20 lg:p-8">
<h1 className="text-xl font-bold">Rollen</h1>

<Suspense fallback={<RolesTileSkeleton className="mt-4" />}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface Props {
const ClassificationLevelsTile = async ({ className }: Readonly<Props>) => {
const classificationLevels = await prisma.classificationLevel.findMany();

const sortedClassificationLevels = classificationLevels.sort((a, b) =>
const sortedClassificationLevels = classificationLevels.toSorted((a, b) =>
a.name.localeCompare(b.name),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface Props {
const NoteTypesTile = async ({ className }: Readonly<Props>) => {
const noteTypes = await prisma.noteType.findMany();

const sortedNoteTypes = noteTypes.sort((a, b) =>
const sortedNoteTypes = noteTypes.toSorted((a, b) =>
a.name.localeCompare(b.name),
);

Expand Down
2 changes: 1 addition & 1 deletion app/src/app/app/settings/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default async function Page() {
}

return (
<main className="p-2 pb-20 lg:p-8">
<main className="p-4 pb-20 lg:p-8">
<h1 className="text-xl font-bold">Einstellungen</h1>

{showNoteTypes && <NoteTypesTile className="mt-4" />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
);

Expand Down
2 changes: 1 addition & 1 deletion app/src/app/app/spynet/citizen/_components/Tile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/app/spynet/citizen/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default async function Page({ searchParams: _searchParams }: Props) {
const searchParams = nextjsSearchParamsToNativeSearchParams(_searchParams);

return (
<main className="p-2 pb-20 lg:p-8">
<main className="p-4 pb-20 lg:p-8">
<div className="flex gap-2 font-bold text-xl">
<Link
href="/app/spynet/search"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ const Handles = ({ entity }: Readonly<Props>) => {
.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;
if (!authentication) return false;

return authentication.authorize("handle", "confirm");
})
.sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime());
.toSorted((a, b) => b.createdAt.getTime() - a.createdAt.getTime());

return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
);

Expand Down
2 changes: 1 addition & 1 deletion app/src/app/app/spynet/entity/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default async function Page({ params }: Props) {
);

return (
<main className="p-2 pb-20 lg:p-8 max-w-[1920px] mx-auto">
<main className="p-4 pb-20 lg:p-8 max-w-[1920px] mx-auto">
<div className="flex gap-2 font-bold text-xl">
<Link
href="/app/spynet"
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/app/spynet/notes/_components/Tile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ const Tile = async ({ searchParams }: Readonly<Props>) => {
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(
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/app/spynet/notes/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default async function Page({ searchParams: _searchParams }: Props) {
const searchParams = nextjsSearchParamsToNativeSearchParams(_searchParams);

return (
<main className="p-2 pb-20 lg:p-8">
<main className="p-4 pb-20 lg:p-8">
<div className="flex gap-2 font-bold text-xl">
<Link
href="/app/spynet/search"
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/app/spynet/organization/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default async function Page({ params }: Props) {
if (!organization) notFound();

return (
<main className="p-2 pb-20 lg:p-8 max-w-[1920px] mx-auto">
<main className="p-4 pb-20 lg:p-8 max-w-[1920px] mx-auto">
<div className="flex gap-2 font-bold text-xl">
<Link
href="/app/spynet"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const EntityLogTypeFilter = ({ entityLogTypes }: Readonly<Props>) => {
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]) => (
<div
key={type}
Expand Down
Loading