chore: tweak feature matrix

This commit is contained in:
Steven
2024-08-12 21:29:57 +08:00
parent 00e2a6fd96
commit 7c31fd444c
13 changed files with 176 additions and 198 deletions

View File

@ -1,6 +1,6 @@
import { Tooltip } from "@mui/joy";
import { FeatureType, checkFeatureAvailable } from "@/helpers/feature";
import { useWorkspaceStore } from "@/stores";
import { FeatureType } from "@/stores/workspace";
import Icon from "./Icon";
interface Props {
@ -10,7 +10,7 @@ interface Props {
const FeatureBadge = ({ feature, className }: Props) => {
const workspaceStore = useWorkspaceStore();
const isFeatureEnabled = checkFeatureAvailable(feature, workspaceStore.profile.plan);
const isFeatureEnabled = workspaceStore.checkFeatureAvailable(feature);
if (isFeatureEnabled) {
return null;

View File

@ -3,8 +3,8 @@ import { useEffect, useState } from "react";
import toast from "react-hot-toast";
import { useTranslation } from "react-i18next";
import { workspaceServiceClient } from "@/grpcweb";
import { checkFeatureAvailable, FeatureType } from "@/helpers/feature";
import { useWorkspaceStore } from "@/stores";
import { FeatureType } from "@/stores/workspace";
import { IdentityProvider } from "@/types/proto/api/v1/workspace_service";
import CreateIdentityProviderDrawer from "../CreateIdentityProviderDrawer";
import FeatureBadge from "../FeatureBadge";
@ -21,7 +21,7 @@ const SSOSection = () => {
const workspaceStore = useWorkspaceStore();
const [identityProviderList, setIdentityProviderList] = useState<IdentityProvider[]>([]);
const [editState, setEditState] = useState<EditState>({ open: false, identityProvider: undefined });
const isSSOFeatureEnabled = checkFeatureAvailable(FeatureType.SSO, workspaceStore.profile.plan);
const isSSOFeatureEnabled = workspaceStore.checkFeatureAvailable(FeatureType.SSO);
useEffect(() => {
fetchIdentityProviderList();

View File

@ -4,8 +4,8 @@ import { useRef, useState } from "react";
import toast from "react-hot-toast";
import { useTranslation } from "react-i18next";
import { workspaceServiceClient } from "@/grpcweb";
import { FeatureType } from "@/helpers/feature";
import { useWorkspaceStore } from "@/stores";
import { FeatureType } from "@/stores/workspace";
import { Visibility } from "@/types/proto/api/v1/common";
import { PlanType } from "@/types/proto/api/v1/subscription_service";
import { WorkspaceSetting } from "@/types/proto/api/v1/workspace_service";