diff --git a/frontend/web/src/components/FeatureBadge.tsx b/frontend/web/src/components/FeatureBadge.tsx new file mode 100644 index 0000000..3074be9 --- /dev/null +++ b/frontend/web/src/components/FeatureBadge.tsx @@ -0,0 +1,16 @@ +import { Tooltip } from "@mui/joy"; +import Icon from "./Icon"; + +interface Props { + className?: string; +} + +const FeatureBadge = ({ className }: Props) => { + return ( + + + + ); +}; + +export default FeatureBadge; diff --git a/frontend/web/src/components/Logo.tsx b/frontend/web/src/components/Logo.tsx index b2bff10..ddc17b4 100644 --- a/frontend/web/src/components/Logo.tsx +++ b/frontend/web/src/components/Logo.tsx @@ -1,5 +1,6 @@ import classNames from "classnames"; import { useWorkspaceStore } from "@/stores"; +import { PlanType } from "@/types/proto/api/v1/subscription_service"; import Icon from "./Icon"; interface Props { @@ -8,7 +9,8 @@ interface Props { const Logo = ({ className }: Props) => { const workspaceStore = useWorkspaceStore(); - const branding = workspaceStore.setting.branding ? new TextDecoder().decode(workspaceStore.setting.branding) : ""; + const hasCustomBranding = workspaceStore.profile.plan === PlanType.PRO; + const branding = hasCustomBranding && workspaceStore.setting.branding ? new TextDecoder().decode(workspaceStore.setting.branding) : ""; return (
{branding ? ( diff --git a/frontend/web/src/components/setting/WorkspaceSection.tsx b/frontend/web/src/components/setting/WorkspaceSection.tsx index 0a7887e..8ce21ec 100644 --- a/frontend/web/src/components/setting/WorkspaceSection.tsx +++ b/frontend/web/src/components/setting/WorkspaceSection.tsx @@ -6,7 +6,9 @@ import { useTranslation } from "react-i18next"; import { workspaceServiceClient } from "@/grpcweb"; import { useWorkspaceStore } from "@/stores"; 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"; +import FeatureBadge from "../FeatureBadge"; import Icon from "../Icon"; const getDefaultVisibility = (visibility?: Visibility) => { @@ -31,7 +33,8 @@ const WorkspaceSection = () => { const [workspaceSetting, setWorkspaceSetting] = useState(workspaceStore.setting); const originalWorkspaceSetting = useRef(workspaceStore.setting); const allowSave = !isEqual(originalWorkspaceSetting.current, workspaceSetting); - const branding = workspaceSetting.branding ? new TextDecoder().decode(workspaceSetting.branding) : ""; + const hasCustomBranding = workspaceStore.profile.plan === PlanType.PRO; + const branding = hasCustomBranding && workspaceSetting.branding ? new TextDecoder().decode(workspaceSetting.branding) : ""; const onBrandingChange = async (event: React.ChangeEvent) => { const files: File[] = Array.from(event.target.files || []); @@ -96,22 +99,32 @@ const WorkspaceSection = () => {
-

Custom branding

+

+ Custom branding + +

Recommand logo ratio: 1:1

-
+
{branding ? ( -
- branding +
+ branding setWorkspaceSetting({ ...workspaceSetting, branding: new TextEncoder().encode("") })} />
) : ( - + )} - + +

(Click to select file)