mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 13:27:46 +00:00
Merge pull request #744 from Infisical/usage-billing
Fix subscription context get organization from useOrganization
This commit is contained in:
@@ -3,8 +3,7 @@ import { createContext, ReactNode, useContext, useMemo } from "react";
|
|||||||
import { useGetOrgSubscription } from "@app/hooks/api";
|
import { useGetOrgSubscription } from "@app/hooks/api";
|
||||||
import { SubscriptionPlan } from "@app/hooks/api/types";
|
import { SubscriptionPlan } from "@app/hooks/api/types";
|
||||||
|
|
||||||
import { useWorkspace } from "../WorkspaceContext";
|
import { useOrganization } from "../OrganizationContext";
|
||||||
// import { Subscription } from '@app/hooks/api/workspace/types';
|
|
||||||
|
|
||||||
type TSubscriptionContext = {
|
type TSubscriptionContext = {
|
||||||
subscription?: SubscriptionPlan;
|
subscription?: SubscriptionPlan;
|
||||||
@@ -18,9 +17,10 @@ type Props = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const SubscriptionProvider = ({ children }: Props): JSX.Element => {
|
export const SubscriptionProvider = ({ children }: Props): JSX.Element => {
|
||||||
const { currentWorkspace } = useWorkspace();
|
const { currentOrg } = useOrganization();
|
||||||
|
|
||||||
const { data, isLoading } = useGetOrgSubscription({
|
const { data, isLoading } = useGetOrgSubscription({
|
||||||
orgID: currentWorkspace?.organization || ""
|
orgID: currentOrg?._id || ""
|
||||||
});
|
});
|
||||||
|
|
||||||
// memorize the workspace details for the context
|
// memorize the workspace details for the context
|
||||||
|
|||||||
+2
-2
@@ -69,7 +69,7 @@ export const PreviewSection = () => {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{subscription && subscription?.slug !== "enterprise" && subscription?.slug !== "pro" && subscription?.slug !== "pro-annual" && (
|
{subscription && subscription?.slug !== "enterprise" && subscription?.slug !== "pro" && subscription?.slug !== "pro-annual" && (
|
||||||
<div className="p-4 bg-mineshaft-900 rounded-lg flex-1 border border-mineshaft-600 mb-6 flex items-center bg-mineshaft-600 max-w-screen-lg">
|
<div className="p-4 bg-mineshaft-900 rounded-lg flex-1 border border-mineshaft-600 mb-6 flex items-center bg-mineshaft-600">
|
||||||
<div className="flex-1">
|
<div className="flex-1">
|
||||||
<h2 className="text-xl font-semibold text-mineshaft-50">Become Infisical</h2>
|
<h2 className="text-xl font-semibold text-mineshaft-50">Become Infisical</h2>
|
||||||
<p className="text-gray-400 mt-4">Unlimited members, projects, RBAC, smart alerts, and so much more</p>
|
<p className="text-gray-400 mt-4">Unlimited members, projects, RBAC, smart alerts, and so much more</p>
|
||||||
@@ -84,7 +84,7 @@ export const PreviewSection = () => {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{!isLoading && subscription && data && (
|
{!isLoading && subscription && data && (
|
||||||
<div className="flex mb-6 max-w-screen-lg">
|
<div className="flex mb-6">
|
||||||
<div className="p-4 bg-mineshaft-900 rounded-lg flex-1 mr-4 border border-mineshaft-600">
|
<div className="p-4 bg-mineshaft-900 rounded-lg flex-1 mr-4 border border-mineshaft-600">
|
||||||
<p className="mb-2 text-gray-400">Current plan</p>
|
<p className="mb-2 text-gray-400">Current plan</p>
|
||||||
<p className="text-2xl text-mineshaft-50 font-semibold mb-8">
|
<p className="text-2xl text-mineshaft-50 font-semibold mb-8">
|
||||||
|
|||||||
Reference in New Issue
Block a user