fix: demo
This commit is contained in:
@@ -1,19 +1,18 @@
|
|||||||
|
import { useEffect, useMemo } from 'react';
|
||||||
import { PromptCard } from '@/components/organization/prompt-card';
|
import { PromptCard } from '@/components/organization/prompt-card';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { useAppContext } from '@/hooks/use-app-context';
|
import { useAppContext } from '@/hooks/use-app-context';
|
||||||
import { useCookieStore } from '@/hooks/use-cookie-store';
|
import { useCookieStore } from '@/hooks/use-cookie-store';
|
||||||
import { op } from '@/utils/op';
|
import { op } from '@/utils/op';
|
||||||
import { MessageSquareIcon } from 'lucide-react';
|
|
||||||
import { useEffect, useMemo } from 'react';
|
|
||||||
|
|
||||||
const THIRTY_DAYS_IN_SECONDS = 60 * 60 * 24 * 30;
|
const THIRTY_DAYS_IN_SECONDS = 60 * 60 * 24 * 30;
|
||||||
|
|
||||||
export default function FeedbackPrompt() {
|
export default function FeedbackPrompt() {
|
||||||
const { isSelfHosted } = useAppContext();
|
const { isSelfHosted, isDemo } = useAppContext();
|
||||||
const [feedbackPromptSeen, setFeedbackPromptSeen] = useCookieStore(
|
const [feedbackPromptSeen, setFeedbackPromptSeen] = useCookieStore(
|
||||||
'feedback-prompt-seen',
|
'feedback-prompt-seen',
|
||||||
'',
|
'',
|
||||||
{ maxAge: THIRTY_DAYS_IN_SECONDS },
|
{ maxAge: THIRTY_DAYS_IN_SECONDS }
|
||||||
);
|
);
|
||||||
|
|
||||||
const shouldShow = useMemo(() => {
|
const shouldShow = useMemo(() => {
|
||||||
@@ -21,6 +20,10 @@ export default function FeedbackPrompt() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isDemo) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!feedbackPromptSeen) {
|
if (!feedbackPromptSeen) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -36,7 +39,7 @@ export default function FeedbackPrompt() {
|
|||||||
// If date parsing fails, show the prompt
|
// If date parsing fails, show the prompt
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}, [isSelfHosted, feedbackPromptSeen]);
|
}, [isDemo, isSelfHosted, feedbackPromptSeen]);
|
||||||
|
|
||||||
const handleGiveFeedback = () => {
|
const handleGiveFeedback = () => {
|
||||||
// Open userjot widget
|
// Open userjot widget
|
||||||
@@ -61,14 +64,14 @@ export default function FeedbackPrompt() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<PromptCard
|
<PromptCard
|
||||||
title="Share Your Feedback"
|
gradientColor="rgb(59 130 246)"
|
||||||
subtitle="Help us improve OpenPanel with your insights"
|
|
||||||
onClose={handleClose}
|
onClose={handleClose}
|
||||||
show={shouldShow}
|
show={shouldShow}
|
||||||
gradientColor="rgb(59 130 246)"
|
subtitle="Help us improve OpenPanel with your insights"
|
||||||
|
title="Share Your Feedback"
|
||||||
>
|
>
|
||||||
<div className="px-6 col gap-4">
|
<div className="col gap-4 px-6">
|
||||||
<p className="text-sm text-foreground leading-normal">
|
<p className="text-foreground text-sm leading-normal">
|
||||||
Your feedback helps us build features you actually need. Share your
|
Your feedback helps us build features you actually need. Share your
|
||||||
thoughts, report bugs, or suggest improvements
|
thoughts, report bugs, or suggest improvements
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -1,7 +1,3 @@
|
|||||||
import { PromptCard } from '@/components/organization/prompt-card';
|
|
||||||
import { LinkButton } from '@/components/ui/button';
|
|
||||||
import { useAppContext } from '@/hooks/use-app-context';
|
|
||||||
import { useCookieStore } from '@/hooks/use-cookie-store';
|
|
||||||
import {
|
import {
|
||||||
AwardIcon,
|
AwardIcon,
|
||||||
HeartIcon,
|
HeartIcon,
|
||||||
@@ -11,6 +7,10 @@ import {
|
|||||||
SparklesIcon,
|
SparklesIcon,
|
||||||
ZapIcon,
|
ZapIcon,
|
||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
|
import { PromptCard } from '@/components/organization/prompt-card';
|
||||||
|
import { LinkButton } from '@/components/ui/button';
|
||||||
|
import { useAppContext } from '@/hooks/use-app-context';
|
||||||
|
import { useCookieStore } from '@/hooks/use-cookie-store';
|
||||||
|
|
||||||
const PERKS = [
|
const PERKS = [
|
||||||
{
|
{
|
||||||
@@ -55,42 +55,42 @@ function PerkPoint({
|
|||||||
description: string;
|
description: string;
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<div className="row gap-4 items-center">
|
<div className="row items-center gap-4">
|
||||||
<Icon className="size-4" />
|
<Icon className="size-4" />
|
||||||
<div className="flex-1 min-w-0 col gap-1.5">
|
<div className="col min-w-0 flex-1 gap-1.5">
|
||||||
<h3 className="font-medium text-sm">{text}</h3>
|
<h3 className="font-medium text-sm">{text}</h3>
|
||||||
<p className="text-xs text-muted-foreground">{description}</p>
|
<p className="text-muted-foreground text-xs">{description}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function SupporterPrompt() {
|
export default function SupporterPrompt() {
|
||||||
const { isSelfHosted } = useAppContext();
|
const { isSelfHosted, isDemo } = useAppContext();
|
||||||
const [supporterPromptClosed, setSupporterPromptClosed] = useCookieStore(
|
const [supporterPromptClosed, setSupporterPromptClosed] = useCookieStore(
|
||||||
'supporter-prompt-closed',
|
'supporter-prompt-closed',
|
||||||
false,
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!isSelfHosted) {
|
if (!isSelfHosted || isDemo) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PromptCard
|
<PromptCard
|
||||||
title="Support OpenPanel"
|
gradientColor="rgb(16 185 129)"
|
||||||
subtitle="Help us build the future of open analytics"
|
|
||||||
onClose={() => setSupporterPromptClosed(true)}
|
onClose={() => setSupporterPromptClosed(true)}
|
||||||
show={!supporterPromptClosed}
|
show={!supporterPromptClosed}
|
||||||
gradientColor="rgb(16 185 129)"
|
subtitle="Help us build the future of open analytics"
|
||||||
|
title="Support OpenPanel"
|
||||||
>
|
>
|
||||||
<div className="col gap-3 px-6">
|
<div className="col gap-3 px-6">
|
||||||
{PERKS.map((perk) => (
|
{PERKS.map((perk) => (
|
||||||
<PerkPoint
|
<PerkPoint
|
||||||
key={perk.text}
|
|
||||||
icon={perk.icon}
|
|
||||||
text={perk.text}
|
|
||||||
description={perk.description}
|
description={perk.description}
|
||||||
|
icon={perk.icon}
|
||||||
|
key={perk.text}
|
||||||
|
text={perk.text}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
@@ -102,13 +102,13 @@ export default function SupporterPrompt() {
|
|||||||
>
|
>
|
||||||
Become a Supporter
|
Become a Supporter
|
||||||
</LinkButton>
|
</LinkButton>
|
||||||
<p className="text-xs text-muted-foreground text-center mt-4">
|
<p className="mt-4 text-center text-muted-foreground text-xs">
|
||||||
Starting at $20/month • Cancel anytime •{' '}
|
Starting at $20/month • Cancel anytime •{' '}
|
||||||
<a
|
<a
|
||||||
href="https://openpanel.dev/supporter"
|
|
||||||
target="_blank"
|
|
||||||
rel="noreferrer"
|
|
||||||
className="text-primary underline-offset-4 hover:underline"
|
className="text-primary underline-offset-4 hover:underline"
|
||||||
|
href="https://openpanel.dev/supporter"
|
||||||
|
rel="noreferrer"
|
||||||
|
target="_blank"
|
||||||
>
|
>
|
||||||
Learn more
|
Learn more
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -6,8 +6,7 @@ export function useAppContext() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!params.apiUrl ||
|
!(params.apiUrl && params.dashboardUrl) ||
|
||||||
!params.dashboardUrl ||
|
|
||||||
typeof params.isSelfHosted === 'undefined'
|
typeof params.isSelfHosted === 'undefined'
|
||||||
) {
|
) {
|
||||||
throw new Error('API URL or dashboard URL is not set');
|
throw new Error('API URL or dashboard URL is not set');
|
||||||
@@ -18,5 +17,6 @@ export function useAppContext() {
|
|||||||
dashboardUrl: params.dashboardUrl,
|
dashboardUrl: params.dashboardUrl,
|
||||||
isSelfHosted: params.isSelfHosted,
|
isSelfHosted: params.isSelfHosted,
|
||||||
isMaintenance: params.isMaintenance ?? false,
|
isMaintenance: params.isMaintenance ?? false,
|
||||||
|
isDemo: params.isDemo ?? false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user