quivr/frontend/app/user/components/StripePricingOrManageButton.tsx
Stan Girard a65eb5a9cd
feat: 🎸 models (#1967)
updated available models

# 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):
2024-01-04 01:14:03 +01:00

24 lines
753 B
TypeScript

import { useTranslation } from "react-i18next";
import { StripePricingModal } from "@/lib/components/Stripe";
import Button from "@/lib/components/ui/Button";
import { useUserData } from "@/lib/hooks/useUserData";
const MANAGE_PLAN_URL = process.env.NEXT_PUBLIC_STRIPE_MANAGE_PLAN_URL;
export const StripePricingOrManageButton = (): JSX.Element => {
const { t } = useTranslation("monetization");
const { userData } = useUserData();
const is_premium = userData?.is_premium ?? false;
if (is_premium) {
return (
<a href={MANAGE_PLAN_URL} target="_blank" rel="noopener">
<Button className="w-full">{t("manage_plan")}</Button>
</a>
);
}
return <StripePricingModal Trigger={<Button>{t("upgrade")}</Button>} />;
};