Skip to content
Open
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
3 changes: 0 additions & 3 deletions .env.local.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
NEXT_PUBLIC_RECAPTCHA_SITE_KEY=6LeoV2MsAAAAALq93j1sqFN8y1WzNpHZHUC7PXGU
RECAPTCHA_SECRET_KEY=6LeoV2MsAAAAAH6o_YnnDgcW4fWYhd2Bvb6_WYZo

API_BASE_URL=http://localhost:8080/api

# The uri that next js will use to build the redirect uri
Expand Down
8 changes: 5 additions & 3 deletions app/[locale]/auth/[...nextauth]/route.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import NextAuth, { AuthOptions } from "next-auth"
import AzureAD from "next-auth/providers/azure-ad"
import Authentik from "next-auth/providers/authentik"
import { JWT } from "next-auth/jwt";

Expand Down Expand Up @@ -78,7 +77,10 @@ async function refreshToken(token: JWT): Promise<JWT>{
console.log("Failed to refresh");
const text = await refreshResponse.text();
console.log(text);
throw new Error("Failed to refresh token");
return {
...token,
error: "RefreshTokenError",
}
}
const response = await refreshResponse.json();

Expand Down Expand Up @@ -109,4 +111,4 @@ declare module "next-auth/jwt" {
refresh_token?: string
error?: "RefreshTokenError"
}
};
}
5 changes: 3 additions & 2 deletions app/[locale]/dashboard/accounts/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import { getUsers } from '@/lib/get-users';
import { getActivityAreas } from '@/lib/get-activity-areas';

interface Props {
params: { locale: string };
params: Promise<{ locale: string }>;
}

export default async function Approbations({ params: { locale } }: Props) {
export default async function Approbations({ params }: Props) {
const {locale} = await params;
const activityAreas = await getActivityAreas();

return <UsersTable locale={locale} activityAreas={activityAreas} />;
Expand Down
8 changes: 5 additions & 3 deletions app/[locale]/dashboard/approbations/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ import { getTags } from '@/lib/get-tags';
import { getActivityAreas } from '@/lib/get-activity-areas';

type Props = {
params: { locale: string };
searchParams: { id: string };
params: Promise<{ locale: string }>;
searchParams: Promise<{ id: string }>;
};

export default async function Approbations({ params: { locale }, searchParams: { id } }: Props) {
export default async function Approbations({ params, searchParams }: Props) {
const { locale } = await params;
const { id } = await searchParams;
const tags = await getTags();
const activityAreas = await getActivityAreas();

Expand Down
9 changes: 5 additions & 4 deletions app/[locale]/dashboard/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { ReactElement, use } from 'react';
import DashboardLayout from './components/dashboardLayout';
import { getTranslations, unstable_setRequestLocale } from 'next-intl/server';
import { getTranslations, setRequestLocale } from 'next-intl/server';
import { getAuthenticatedUser } from '@/lib/get-authenticated-user';
import { UserTypes } from '@/models/user-types';
import ToastProvider from '@/utils/provider/ToastProvider';
Expand All @@ -9,11 +9,12 @@ import UserProvider from '@/utils/provider/UserProvider';

type Props = {
children: ReactElement;
params: { locale: string };
params: Promise<{ locale: string }>;
};

export default async function Layout({ children, params: { locale } }: Props) {
unstable_setRequestLocale(locale);
export default async function Layout({ children, params }: Props) {
const { locale } = await params;
setRequestLocale(locale);

const t = await getTranslations('Dashboard');
let user;
Expand Down
8 changes: 5 additions & 3 deletions app/[locale]/dashboard/news/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import NewsPage from './components/NewsPage';
import { getActivityAreas } from '@/lib/get-activity-areas';

interface Props {
params: {locale: string};
searchParams: {id: string};
params: Promise<{ locale: string }>;
searchParams: Promise<{id: string}>;
}

export default async function News({ params: {locale}, searchParams: {id} }: Props) {
export default async function News({ params, searchParams }: Props) {
const { id } = await searchParams;
const { locale } = await params;
const events = await getEvents();
const activityAreas = await getActivityAreas();
const eventsCards = events.map((event, i) => ({ ...event, cardId: i + 1 }));
Expand Down
31 changes: 19 additions & 12 deletions app/[locale]/dashboard/profile/[userId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,68 +11,75 @@ import redditIcon from '@/public/Socials/Reddit.svg';
import xIcon from '@/public/Socials/X.svg';

type Props = {
params: { locale: string; userId: string };
params: Promise<{ locale: string; userId: string }>;
};

export default async function Profile({ params: { userId, locale } }: Props) {
const organizer = await getOrganizer(userId);
export default async function Profile(props: Props) {
const params = await props.params;

organizer.socials = [];
if (organizer.facebookLink) {
const {
userId,
locale
} = params;

const organizer = await getOrganizer(userId);

organizer.socials = [];
if (organizer.facebookLink) {
organizer.socials.push({
icon: facebookIcon,
inputName: 'facebookIcon',
link: organizer.facebookLink,
});
}

if (organizer.discordLink) {
if (organizer.discordLink) {
organizer.socials.push({
icon: discordIcon,
inputName: 'discordIcon',
link: organizer.discordLink,
});
}

if (organizer.instagramLink) {
if (organizer.instagramLink) {
organizer.socials.push({
icon: instagramIcon,
inputName: 'instagramIcon',
link: organizer.instagramLink,
});
}

if (organizer.linkedInLink) {
if (organizer.linkedInLink) {
organizer.socials.push({
icon: linkedinIcon,
inputName: 'linkedinIcon',
link: organizer.linkedInLink,
});
}

if (organizer.tikTokLink) {
if (organizer.tikTokLink) {
organizer.socials.push({
icon: tiktokIcon,
inputName: 'tiktokIcon',
link: organizer.tikTokLink,
});
}

if (organizer.redditLink) {
if (organizer.redditLink) {
organizer.socials.push({
icon: redditIcon,
inputName: 'redditIcon',
link: organizer.redditLink,
});
}

if (organizer.xLink) {
if (organizer.xLink) {
organizer.socials.push({
icon: xIcon,
inputName: 'xIcon',
link: organizer.xLink,
});
}

return <ProfileClient organizer={organizer} locale={locale} />;
return <ProfileClient organizer={organizer} locale={locale} />;
}
24 changes: 18 additions & 6 deletions app/[locale]/dashboard/publications/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,24 @@ import { getTags } from '@/lib/get-tags';
import { getActivityAreas } from '@/lib/get-activity-areas';

type Props = {
params: { locale: string };
searchParams: { id: string };
params: Promise<{ locale: string }>;
searchParams: Promise<{ id: string }>;
};

export default async function Publications({ params: { locale }, searchParams: { id } }: Props) {
const tags = await getTags();
const activityAreas = await getActivityAreas();
return <PublicationsTable locale={locale} tags={tags} id={id} activityAreas={activityAreas} />;
export default async function Publications(props: Props) {
const searchParams = await props.searchParams;

const {
id
} = searchParams;

const params = await props.params;

const {
locale
} = params;

const tags = await getTags();
const activityAreas = await getActivityAreas();
return <PublicationsTable locale={locale} tags={tags} id={id} activityAreas={activityAreas} />;
}
14 changes: 8 additions & 6 deletions app/[locale]/dashboard/settings/display/page.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import { use } from "react";
import { useTranslations } from 'next-intl';
import { unstable_setRequestLocale } from 'next-intl/server';
import { setRequestLocale } from 'next-intl/server';
import ThemeDropdown from './components/ThemeDropdown';
import LanguageDropdown from './components/LanguageDropdown';

type Props = {
params: { locale: string };
params: Promise<{ locale: string }>;
};

export default function Display({ params }: Props) {
unstable_setRequestLocale(params.locale);
const t = useTranslations('Settings.display-section');
export default function Display(props: Props) {
const params = use(props.params);
setRequestLocale(params.locale);
const t = useTranslations('Settings.display-section');

return (
return (
<form className="flex flex-col basis-4/5">
<div className="flex-grow">
<label className="text-xl font-bold">{t('title')}</label>
Expand Down
22 changes: 16 additions & 6 deletions app/[locale]/dashboard/settings/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
import React, { ReactElement } from 'react';
import { getTranslations, unstable_setRequestLocale } from 'next-intl/server';
import { getTranslations, setRequestLocale } from 'next-intl/server';
import SettingsLayout from './components/settingsLayout';

type Props = {
children: ReactElement;
params: { locale: string };
params: Promise<{ locale: string }>;
};

export default async function Layout({ children, params: { locale } }: Props) {
unstable_setRequestLocale(locale);
export default async function Layout(props: Props) {
const params = await props.params;

const t = await getTranslations('Settings');
const {
locale
} = params;

return (
const {
children
} = props;

setRequestLocale(locale);

const t = await getTranslations('Settings');

return (
<SettingsLayout locale={locale} sectionTitle={t('title')}>
{children}
</SettingsLayout>
Expand Down
5 changes: 3 additions & 2 deletions app/[locale]/dashboard/settings/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { redirect } from 'next/navigation';

export default function Settings({ params }: { params: { locale: string } }) {
return redirect(`/${params.locale}/dashboard/settings/profile`);
export default async function Settings(props: { params: Promise<{ locale: string }> }) {
const params = await props.params;
return redirect(`/${params.locale}/dashboard/settings/profile`);
}
7 changes: 4 additions & 3 deletions app/[locale]/dashboard/settings/password/page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { unstable_setRequestLocale } from 'next-intl/server';
import { setRequestLocale } from 'next-intl/server';
import PasswordClient from './pageClient';

type Props = {
params: { locale: string };
params: Promise<{ locale: string }>;
};

export default async function Password({ params }: Props) {
unstable_setRequestLocale(params.locale);
const { locale } = await params;
setRequestLocale(locale);

return <PasswordClient />;
}
13 changes: 7 additions & 6 deletions app/[locale]/dashboard/settings/profile/page.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { unstable_setRequestLocale } from 'next-intl/server';
import { setRequestLocale } from 'next-intl/server';
import ProfileClient from './pageClient';
import { getActivityAreas } from '@/lib/get-activity-areas';

type Props = {
params: { locale: string };
params: Promise<{ locale: string }>;
};

export default async function Profile({ params }: Props) {
unstable_setRequestLocale(params.locale);
const activityAreas = await getActivityAreas();
return <ProfileClient activityAreas={activityAreas} locale={params.locale} />;
export default async function Profile(props: Props) {
const params = await props.params;
setRequestLocale(params.locale);
const activityAreas = await getActivityAreas();
return <ProfileClient activityAreas={activityAreas} locale={params.locale} />;
}
11 changes: 6 additions & 5 deletions app/[locale]/dashboard/settings/socials/page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { unstable_setRequestLocale } from 'next-intl/server';
import { setRequestLocale } from 'next-intl/server';
import SocialsClient from './pageClient';

type Props = {
params: { locale: string };
params: Promise<{ locale: string }>;
};

export default async function Socials({ params }: Props) {
unstable_setRequestLocale(params.locale);
export default async function Socials(props: Props) {
const params = await props.params;
setRequestLocale(params.locale);

return <SocialsClient />;
return <SocialsClient />;
}
13 changes: 10 additions & 3 deletions app/[locale]/dashboard/unsubscribe/[token]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
'use client';
import { use } from "react";

import UnsubscribeClient from './clientPage';

interface Props {
params: { token: string };
params: Promise<{ token: string }>;
}

export default function Unsubscribe({ params: { token } }: Readonly<Props>) {
return <UnsubscribeClient token={token} />;
export default function Unsubscribe(props: Props) {
const params = use(props.params);

const {
token
} = params;

return <UnsubscribeClient token={token} />;
}
Loading