Merge branch 'master' into develop
This commit is contained in:
21
web-app/app/ui/ParamsYearInvalidMessage.tsx
Normal file
21
web-app/app/ui/ParamsYearInvalidMessage.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
"use client";
|
||||
import { FC, useEffect } from 'react';
|
||||
import { redirect } from 'next/navigation';
|
||||
|
||||
export const ParamsYearInvalidMessage:FC<{ firstAvailableYear?: number }> = ({ firstAvailableYear }) => {
|
||||
|
||||
// Redirect to the first available year after showing the message
|
||||
useEffect(() => {
|
||||
if(firstAvailableYear) {
|
||||
redirect(`/?year=${firstAvailableYear}`);
|
||||
} else {
|
||||
redirect(`/`);
|
||||
}
|
||||
});
|
||||
|
||||
return(
|
||||
<main className="flex min-h-screen flex-col p-6 bg-base-300">
|
||||
<p className="text-center text-2xl text-red-500">The year specified in the URL is invalid ... redirecting</p>
|
||||
</main>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user