mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-04 15:26:20 +00:00
feat: resolved plan text generator
This commit is contained in:
@@ -9,18 +9,26 @@ import {
|
|||||||
DropdownMenuItem,
|
DropdownMenuItem,
|
||||||
DropdownMenuTrigger
|
DropdownMenuTrigger
|
||||||
} from "@app/components/v2";
|
} from "@app/components/v2";
|
||||||
import { useOrganization } from "@app/context";
|
import { useOrganization, useSubscription } from "@app/context";
|
||||||
import { useGetOrganizations, useLogoutUser } from "@app/hooks/api";
|
import { useGetOrganizations, useLogoutUser } from "@app/hooks/api";
|
||||||
|
import { SubscriptionPlan } from "@app/hooks/api/types";
|
||||||
import { AuthMethod } from "@app/hooks/api/users/types";
|
import { AuthMethod } from "@app/hooks/api/users/types";
|
||||||
|
|
||||||
type Prop = {
|
type Prop = {
|
||||||
onChangeOrg: (orgId: string) => void;
|
onChangeOrg: (orgId: string) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getPlan = (subscription: SubscriptionPlan) => {
|
||||||
|
if (subscription.dynamicSecret) return "Enterprise Plan";
|
||||||
|
if (subscription.pitRecovery) return "Pro Plan";
|
||||||
|
return "Free Plan";
|
||||||
|
};
|
||||||
|
|
||||||
export const SidebarHeader = ({ onChangeOrg }: Prop) => {
|
export const SidebarHeader = ({ onChangeOrg }: Prop) => {
|
||||||
const { currentOrg } = useOrganization();
|
const { currentOrg } = useOrganization();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { data: orgs } = useGetOrganizations();
|
const { data: orgs } = useGetOrganizations();
|
||||||
|
const { subscription } = useSubscription();
|
||||||
|
|
||||||
const logout = useLogoutUser();
|
const logout = useLogoutUser();
|
||||||
const logOutUser = async () => {
|
const logOutUser = async () => {
|
||||||
@@ -45,7 +53,7 @@ export const SidebarHeader = ({ onChangeOrg }: Prop) => {
|
|||||||
<div className="max-w-36 truncate text-ellipsis text-sm font-medium capitalize">
|
<div className="max-w-36 truncate text-ellipsis text-sm font-medium capitalize">
|
||||||
{currentOrg?.name}
|
{currentOrg?.name}
|
||||||
</div>
|
</div>
|
||||||
<div className="text-xs text-mineshaft-400">Free Plan</div>
|
<div className="text-xs text-mineshaft-400">{getPlan(subscription)}</div>
|
||||||
</div>
|
</div>
|
||||||
<FontAwesomeIcon icon={faSort} className="text-xs text-mineshaft-400" />
|
<FontAwesomeIcon icon={faSort} className="text-xs text-mineshaft-400" />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user