Skip to content

Commit

Permalink
chore: savepoint
Browse files Browse the repository at this point in the history
  • Loading branch information
olegshilov committed Feb 12, 2024
1 parent b6be4be commit 37ff893
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 37 deletions.
5 changes: 0 additions & 5 deletions apps/haqq-website/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,3 @@ export const TURNSTILE_SITEKEY = process.env['TURNSTILE_SITEKEY'];
export const NX_WALLETCONNECT_PROJECT_ID =
process.env['NX_WALLETCONNECT_PROJECT_ID'];
export const SITE_URL = 'https://haqq.network';

console.log({
VERCEL_URL: process.env['VERCEL_URL'],
NEXT_PUBLIC_VERCEL_URL: process.env['NEXT_PUBLIC_VERCEL_URL'],
});
2 changes: 1 addition & 1 deletion apps/islamic-website/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export default async function LocaleLayout({
vcrFont.variable,
)}
>
<PHProvider>
<PHProvider hostname={DEPLOY_URL}>
<body className="bg-islamic-bg-black font-alexandria flex min-h-screen flex-col text-white antialiased">
<PostHogPageView />
{isScamBannerShow && <ScamBanner />}
Expand Down
12 changes: 0 additions & 12 deletions apps/islamic-website/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,10 @@ export const DEPLOY_URL = process.env['VERCEL_URL']
: process.env['NEXT_PUBLIC_VERCEL_URL']
? `https://${process.env['NEXT_PUBLIC_VERCEL_URL']}`
: 'http://localhost:4200';

// export const DEPLOY_URL = process.env['VERCEL_URL']
// ? process.env['VERCEL_URL'] !== ''
// ? process.env['VERCEL_URL']
// : process.env['NEXT_PUBLIC_VERCEL_URL'] ?? 'http://localhost:3000'
// : process.env['NEXT_PUBLIC_VERCEL_URL'] ?? 'http://localhost:3000';

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: Readonly<string[]> = ['en', 'ar', 'id'];
export const SITE_URL = 'https://islamiccoin.net';
export const BLOCKED_COUNTRY = 'AE';

export const NEXT_PUBLIC_VERCEL_URL = process.env['NEXT_PUBLIC_VERCEL_URL'];
export const VERCEL_URL = process.env['VERCEL_URL'];

console.log({ NEXT_PUBLIC_VERCEL_URL, VERCEL_URL });
6 changes: 1 addition & 5 deletions apps/islamic-website/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,10 @@ const nextConfig = {
},
],
},
env: {
VERCEL_URL: process.env['VERCEL_URL'],
NEXT_PUBLIC_VERCEL_URL: process.env['NEXT_PUBLIC_VERCEL_URL'],
},
rewrites: async () => {
return [
{
source: '/ingest/:path*',
source: '/api/ingest/:path*',
destination: 'https://eu.posthog.com/:path*',
},
];
Expand Down
28 changes: 14 additions & 14 deletions apps/islamic-website/providers/posthog.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
'use client';

Check warning

Code scanning / CodeQL

Unknown directive Warning

Unknown directive: 'use client'.
import { PropsWithChildren } from 'react';
import posthog from 'posthog-js';
import { PostHogProvider } from 'posthog-js/react';
import { DEPLOY_URL, NEXT_PUBLIC_VERCEL_URL, VERCEL_URL } from '../constants';

if (typeof window !== 'undefined') {
console.log('posthog-init', {
DEPLOY_URL,
NEXT_PUBLIC_VERCEL_URL,
VERCEL_URL,
});
posthog.init(process.env['NEXT_PUBLIC_POSTHOG_KEY']!, {
api_host: new URL('/ingest', DEPLOY_URL).toString(),
ui_host: process.env['NEXT_PUBLIC_POSTHOG_HOST'],
capture_pageview: false,
});
}
export function PHProvider({
children,
hostname,
}: PropsWithChildren<{ hostname: string }>) {
if (typeof window !== 'undefined') {
console.log('posthog-init', { hostname });

posthog.init(process.env['NEXT_PUBLIC_POSTHOG_KEY']!, {
api_host: new URL('/api/ingest', hostname).toString(),
ui_host: process.env['NEXT_PUBLIC_POSTHOG_HOST'],
capture_pageview: false,
});
}

export function PHProvider({ children }: { children: React.ReactNode }) {
return <PostHogProvider client={posthog}>{children}</PostHogProvider>;
}

0 comments on commit 37ff893

Please sign in to comment.