diff --git a/.github/workflows/build-push-docker.yml b/.github/workflows/build-push-docker.yml index c171516..e2931ea 100644 --- a/.github/workflows/build-push-docker.yml +++ b/.github/workflows/build-push-docker.yml @@ -3,7 +3,7 @@ name: Build and push Docker on: push: branches: - - 'disabled-main' + - 'main' tags: - 'v[0-9]+.[0-9]+.[0-9]+' pull_request: diff --git a/.github/workflows/deploy-docker.yml b/.github/workflows/deploy-docker.yml index 2c1ac33..b13771a 100644 --- a/.github/workflows/deploy-docker.yml +++ b/.github/workflows/deploy-docker.yml @@ -3,7 +3,7 @@ name: Deploy Docker on: workflow_run: workflows: - - 'disabled-Build and push Docker' + - 'Build and push Docker' types: - completed diff --git a/app/[[...month]]/page.tsx b/app/[[...month]]/page.tsx index b9b5032..5424ba7 100644 --- a/app/[[...month]]/page.tsx +++ b/app/[[...month]]/page.tsx @@ -1,4 +1,5 @@ import { FC } from 'react'; +import { notFound } from 'next/navigation'; import LineChartMultiple from '@/components/charts/line-chart-multiple'; import Heading from '@/components/heading'; @@ -8,6 +9,7 @@ import { getNewOldCompaniesForMonthCached } from '@/modules/database/select/comp import { getNewOldCompaniesCountForAllMonthsCached } from '@/modules/database/select/line-chart'; import { getAllMonths } from '@/modules/database/select/month'; import { getStatisticsCached } from '@/modules/database/select/statistics'; +import { isValidMonthNameWithDb } from '@/utils/validation'; import { METADATA } from '@/constants/metadata'; import { MonthQueryParam } from '@/types/website'; @@ -26,6 +28,8 @@ const IndexPage: FC = async ({ params }) => { const { month } = await params; const selectedMonth = month?.[0] ?? allMonths[0].name; + if (!isValidMonthNameWithDb(selectedMonth)) return notFound(); + const newOldCompanies = await getNewOldCompaniesForMonthCached(selectedMonth); const { monthsCount, companiesCount, commentsCount, firstMonth, lastMonth } = statistics ?? { diff --git a/app/global-error.tsx b/app/global-error.tsx new file mode 100644 index 0000000..9c38106 --- /dev/null +++ b/app/global-error.tsx @@ -0,0 +1,57 @@ +'use client'; + +import { FC } from 'react'; +import Link from 'next/link'; + +import { RefreshCcw, Settings } from 'lucide-react'; + +import { Button } from '@/components/ui/button'; + +import { fontSans } from '@/libs/fonts'; +import { cn } from '@/utils/styles'; + +import '@/styles/globals.css'; + +interface Props { + error: Error & { digest?: string }; + reset: () => void; +} + +const GlobalError: FC = ({ error, reset }) => ( + + +
+
+
+ +
+ +

500 - Server Error

+

+ We are sorry, but something went wrong on our end. Please try again later. +

+ +
+ + +
+ + {error.digest && ( +

Error ID: {error.digest}

+ )} +
+
+ + +); + +export default GlobalError; diff --git a/app/layout.tsx b/app/layout.tsx index 7483793..ba9a9b2 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -13,6 +13,8 @@ import { SERVER_CONFIG } from '@/config/server'; import '@/styles/globals.css'; +import { FC } from 'react'; + // single in layout is enough for all pages export const dynamic = 'force-dynamic'; @@ -69,24 +71,24 @@ interface RootLayoutProps { children: React.ReactNode; } -export default function RootLayout({ children }: RootLayoutProps) { - return ( - - - - -
-
{children}
-