mirror of
https://github.com/StanGirard/quivr.git
synced 2024-12-17 23:51:51 +03:00
526addb7f7
# Description Please include a summary of the changes and the related issue. Please also include relevant motivation and context. ## Checklist before requesting a review Please delete options that are not relevant. - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my code - [ ] I have commented hard-to-understand areas - [ ] I have ideally added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged ## Screenshots (if appropriate):
35 lines
866 B
TypeScript
35 lines
866 B
TypeScript
import { StripePricingModal } from "@/lib/components/Stripe";
|
|
import QuivrButton from "@/lib/components/ui/QuivrButton/QuivrButton";
|
|
import { useUserData } from "@/lib/hooks/useUserData";
|
|
|
|
const MANAGE_PLAN_URL = process.env.NEXT_PUBLIC_STRIPE_MANAGE_PLAN_URL;
|
|
|
|
export const StripePricingOrManageButton = (): JSX.Element => {
|
|
const { userData } = useUserData();
|
|
|
|
const is_premium = userData?.is_premium ?? false;
|
|
if (is_premium) {
|
|
return (
|
|
<a href={MANAGE_PLAN_URL} target="_blank" rel="noopener">
|
|
<QuivrButton
|
|
label="Manage my plan"
|
|
color="gold"
|
|
iconName="star"
|
|
></QuivrButton>
|
|
</a>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<StripePricingModal
|
|
Trigger={
|
|
<QuivrButton
|
|
label="Upgrade my plan"
|
|
color="gold"
|
|
iconName="star"
|
|
></QuivrButton>
|
|
}
|
|
/>
|
|
);
|
|
};
|