-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #688 from haqq-network/dev
release
- Loading branch information
Showing
18 changed files
with
4,795 additions
and
4,509 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
672 changes: 336 additions & 336 deletions
672
.yarn/releases/yarn-4.0.2.cjs → .yarn/releases/yarn-4.1.0.cjs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,21 @@ | ||
import { cache } from 'react'; | ||
import { getIslamicWhitepaperData } from '@haqq/data-access-falconer'; | ||
import { getHaqqWhitepaperData } from '@haqq/data-access-falconer'; | ||
import { REVALIDATE_TIME } from '../constants'; | ||
|
||
export const revalidate = REVALIDATE_TIME; | ||
|
||
export const getWhitepaperContentFromFalconer = cache( | ||
async (locale?: string) => { | ||
try { | ||
const data = await getIslamicWhitepaperData( | ||
{ | ||
next: { | ||
revalidate, | ||
}, | ||
}, | ||
locale ?? 'en', | ||
); | ||
export const getWhitepaperContentFromFalconer = cache(async () => { | ||
try { | ||
const data = await getHaqqWhitepaperData({ | ||
next: { | ||
revalidate, | ||
}, | ||
}); | ||
|
||
return data; | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
return data; | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
|
||
return ''; | ||
}, | ||
); | ||
return ''; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use client'; | ||
import { PropsWithChildren } from 'react'; | ||
import posthog from 'posthog-js'; | ||
import { PostHogProvider } from 'posthog-js/react'; | ||
|
||
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, | ||
}); | ||
} | ||
|
||
return <PostHogProvider client={posthog}>{children}</PostHogProvider>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'use client'; | ||
|
||
import { useEffect } from 'react'; | ||
import { usePathname, useSearchParams } from 'next/navigation'; | ||
import { usePostHog } from 'posthog-js/react'; | ||
|
||
export function PostHogPageView() { | ||
const pathname = usePathname(); | ||
const searchParams = useSearchParams(); | ||
const posthog = usePostHog(); | ||
|
||
// Track pageviews | ||
useEffect(() => { | ||
if (pathname && posthog) { | ||
let url = window.origin + pathname; | ||
if (searchParams.toString()) { | ||
url = url + `?${searchParams.toString()}`; | ||
} | ||
posthog.capture('$pageview', { | ||
$current_url: url, | ||
}); | ||
} | ||
}, [pathname, searchParams, posthog]); | ||
|
||
return null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
libs/data-access/falconer/src/lib/haqq/get-haqq-whitepaper.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { FALCONER_ENDPOINT } from '../../constants'; | ||
import { FalconerRequestInit } from '../../types'; | ||
|
||
export async function getHaqqWhitepaperData( | ||
options: Partial<FalconerRequestInit>, | ||
) { | ||
const requestUrl = new URL('/haqq/wp', FALCONER_ENDPOINT); | ||
|
||
const response = await fetch(requestUrl, { | ||
method: 'GET', | ||
...options, | ||
}); | ||
|
||
if (!response.ok) { | ||
throw new Error('Whitepaper fetch failed'); | ||
} | ||
|
||
const responseJson = await response.json(); | ||
|
||
return responseJson.wp as string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.