feat: remove plausible

This commit is contained in:
Nevo David 2024-10-26 21:20:26 +07:00
parent 8fb33ab6e1
commit 98f36ec8ba
3 changed files with 25 additions and 10 deletions

View File

@ -10,10 +10,15 @@ import { Chakra_Petch } from 'next/font/google';
import PlausibleProvider from 'next-plausible';
import clsx from 'clsx';
import { VariableContextComponent } from '@gitroom/react/helpers/variable.context';
import { Fragment } from 'react';
const chakra = Chakra_Petch({ weight: '400', subsets: ['latin'] });
export default async function AppLayout({ children }: { children: ReactNode }) {
const Plausible = !!process.env.STRIPE_PUBLISHABLE_KEY
? PlausibleProvider
: Fragment;
return (
<html className={interClass}>
<head>
@ -25,7 +30,9 @@ export default async function AppLayout({ children }: { children: ReactNode }) {
</head>
<body className={clsx(chakra.className, 'text-primary dark')}>
<VariableContextComponent
storageProvider={process.env.STORAGE_PROVIDER! as 'local' | 'cloudflare'}
storageProvider={
process.env.STORAGE_PROVIDER! as 'local' | 'cloudflare'
}
backendUrl={process.env.NEXT_PUBLIC_BACKEND_URL!}
plontoKey={process.env.NEXT_PUBLIC_POLOTNO!}
billingEnabled={!!process.env.STRIPE_PUBLISHABLE_KEY}
@ -34,11 +41,11 @@ export default async function AppLayout({ children }: { children: ReactNode }) {
isGeneral={!!process.env.IS_GENERAL}
uploadDirectory={process.env.NEXT_PUBLIC_UPLOAD_STATIC_DIRECTORY!}
>
<PlausibleProvider
<Plausible
domain={!!process.env.IS_GENERAL ? 'postiz.com' : 'gitroom.com'}
>
<LayoutContext>{children}</LayoutContext>
</PlausibleProvider>
</Plausible>
</VariableContextComponent>
</body>
</html>

View File

@ -24,6 +24,7 @@ import { useModals } from '@mantine/modals';
import { AddProviderComponent } from '@gitroom/frontend/components/launches/add.provider.component';
import { TopTitle } from '@gitroom/frontend/components/launches/helpers/top.title.component';
import { Textarea } from '@gitroom/react/form/textarea';
import { useFireEvents } from '@gitroom/helpers/utils/use.fire.events';
export interface Tiers {
month: Array<{
@ -156,9 +157,11 @@ export const Features: FC<{
const Info: FC<{ proceed: (feedback: string) => void }> = (props) => {
const [feedback, setFeedback] = useState('');
const modal = useModals();
const events = useFireEvents();
const cancel = useCallback(() => {
props.proceed(feedback);
events('cancel_subscription');
modal.closeAll();
}, [modal, feedback]);

View File

@ -1,9 +1,14 @@
import {usePlausible} from 'next-plausible'
import {useCallback} from "react";
import { usePlausible } from 'next-plausible';
import { useCallback } from 'react';
import { useVariables } from '@gitroom/react/helpers/variable.context';
export const useFireEvents = () => {
const plausible = usePlausible();
return useCallback((name: string, props?: any) => {
plausible(name, {props});
}, []);
}
const { billingEnabled } = useVariables();
const plausible = usePlausible();
return useCallback((name: string, props?: any) => {
if (!billingEnabled) {
return;
}
plausible(name, { props });
}, []);
};