Skip to content

Commit

Permalink
fix(islamic-website): update codebase to work with latest next-intl
Browse files Browse the repository at this point in the history
- cleaup
  • Loading branch information
olegshilov committed Jan 3, 2024
1 parent 2f291c0 commit 6ab1061
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 22 deletions.
3 changes: 1 addition & 2 deletions apps/haqq-website/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
"**/*.tsx",
"**/*.js",
"**/*.jsx",
"../../apps/haqq-website/.next/types/**/*.ts",
"../../dist/apps/haqq-website/.next/types/**/*.ts",
".next/types/**/*.ts",
"next-env.d.ts"
],
"exclude": [
Expand Down
17 changes: 8 additions & 9 deletions apps/islamic-website/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export default async function LocaleLayout({
>
<body className="bg-islamic-bg-black font-alexandria flex min-h-screen flex-col text-white antialiased">
{isScamBannerShow && <ScamBanner />}

{isMobileUserAgent ? (
<MobileHeader locale={locale} isBannerVisible={isScamBannerShow} />
) : (
Expand All @@ -95,9 +96,9 @@ export default async function LocaleLayout({
<main className="flex-1">{children}</main>
<Footer socialLinks={SOCIAL_LINKS} />

<div>
{VERCEL_ENV === 'production' && (
<script
{VERCEL_ENV === 'production' && (
<div>
<Script
async={true}
defer={true}
id="fb-pixel"
Expand All @@ -117,8 +118,6 @@ export default async function LocaleLayout({
`,
}}
/>
)}
{VERCEL_ENV === 'production' && (
<Script
async={true}
defer={true}
Expand All @@ -134,10 +133,10 @@ export default async function LocaleLayout({
`,
}}
/>
)}
{VERCEL_ENV === 'production' && <CookieConsentModal />}
{VERCEL_ENV === 'production' && <Analytics mode="auto" />}
</div>
<CookieConsentModal />
<Analytics mode="auto" />
</div>
)}
</body>
</html>
</NextIntlClientProvider>
Expand Down
5 changes: 0 additions & 5 deletions apps/islamic-website/app/api/sentry-test/route.ts

This file was deleted.

2 changes: 1 addition & 1 deletion apps/islamic-website/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ export const VERCEL_ENV = process.env['VERCEL_ENV'];
export const REVALIDATE_TIME = 300;
export const FALCONER_ENDPOINT = process.env['FALCONER_ENDPOINT'];
export const TURNSTILE_SITEKEY = process.env['TURNSTILE_SITEKEY'];
export const SUPPORTED_LOCALES = ['en', 'ar', 'id'] as const;
export const SUPPORTED_LOCALES: Readonly<string[]> = ['en', 'ar', 'id'];
export const SITE_URL = 'https://islamiccoin.net';
9 changes: 8 additions & 1 deletion apps/islamic-website/i18n.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import { notFound } from 'next/navigation';
import { getRequestConfig } from 'next-intl/server';
import { SUPPORTED_LOCALES } from './constants';

export default getRequestConfig(async ({ locale }) => {
// Validate that the incoming `locale` parameter is valid
if (!SUPPORTED_LOCALES.includes(locale)) {
notFound();
}

export default getRequestConfig(async ({ locale }: { locale: string }) => {
return {
messages: (await import(`./messages/${locale}.json`)).default,
};
Expand Down
1 change: 1 addition & 0 deletions apps/islamic-website/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export default createMiddleware({
locales: SUPPORTED_LOCALES,
defaultLocale: SUPPORTED_LOCALES[0],
localePrefix: 'as-needed',
localeDetection: true,
});

export const config = {
Expand Down
6 changes: 2 additions & 4 deletions apps/islamic-website/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@
"**/*.tsx",
"**/*.js",
"**/*.jsx",
"../../apps/islamic-website/.next/types/**/*.ts",
"../../dist/apps/islamic-website/.next/types/**/*.ts",
"next-env.d.ts",
".next/types/**/*.ts"
".next/types/**/*.ts",
"next-env.d.ts"
],
"exclude": [
"node_modules",
Expand Down

0 comments on commit 6ab1061

Please sign in to comment.