@@ -12,6 +12,7 @@ import {
1212 SelectValue ,
1313} from "@/components/ui/select" ;
1414import { Separator } from "@/components/ui/separator" ;
15+ import { cn } from "@/lib/utils" ;
1516import placeholderAvatar from "@/public/placeholder_avatar.png" ;
1617import { ChatVisibility } from "@sourcebot/db" ;
1718import { Info , Link2Icon , Loader2 , Lock , X } from "lucide-react" ;
@@ -26,6 +27,8 @@ interface ShareSettingsProps {
2627 onOpenInviteView : ( ) => void ;
2728 currentUser ?: SessionUser ;
2829 sharedWithUsers : SessionUser [ ] ;
30+ isChatSharingEnabledInCurrentPlan : boolean ;
31+ isChatSharingEnabled : boolean ;
2932}
3033
3134export const ShareSettings = ( {
@@ -35,6 +38,8 @@ export const ShareSettings = ({
3538 onOpenInviteView,
3639 currentUser,
3740 sharedWithUsers,
41+ isChatSharingEnabledInCurrentPlan,
42+ isChatSharingEnabled,
3843} : ShareSettingsProps ) => {
3944 const [ isVisibilityUpdating , setIsVisibilityUpdating ] = useState ( false ) ;
4045 const [ removingUserIds , setRemovingUserIds ] = useState < Set < string > > ( new Set ( ) ) ;
@@ -65,18 +70,26 @@ export const ShareSettings = ({
6570 < Separator className = "-mx-4 w-auto mt-2 mb-4" />
6671
6772 { /* Fake Search Bar - Click to open invite view */ }
68- { isAuthenticated && (
73+ { ( isAuthenticated && isChatSharingEnabled ) && (
6974 < >
70- < Button
71- variant = "outline"
72- className = "w-full justify-start text-muted-foreground font-normal"
73- onClick = { onOpenInviteView }
74- >
75- Search for a user
76- </ Button >
75+ < span className = { cn ( { "cursor-not-allowed" : ! isChatSharingEnabledInCurrentPlan } ) } >
76+ < Button
77+ variant = "outline"
78+ className = { cn ( "w-full justify-start text-muted-foreground font-normal" , {
79+ "opacity-50 pointer-events-none" : ! isChatSharingEnabledInCurrentPlan ,
80+ } ) }
81+ onClick = { onOpenInviteView }
82+ disabled = { ! isChatSharingEnabledInCurrentPlan }
83+ >
84+ Search for a user
85+ </ Button >
86+ </ span >
7787
7888 { /* People with access */ }
79- < div className = "mt-4" >
89+ < div className = { cn ( "mt-4" , {
90+ "opacity-50 cursor-not-allowed" : ! isChatSharingEnabledInCurrentPlan ,
91+ "[&_*]:pointer-events-none" : ! isChatSharingEnabledInCurrentPlan ,
92+ } ) } >
8093 < label className = "text-sm text-muted-foreground mb-2 block" >
8194 People with access
8295 </ label >
@@ -143,6 +156,13 @@ export const ShareSettings = ({
143156 </ div >
144157 </ div >
145158
159+ { ! isChatSharingEnabledInCurrentPlan && (
160+ < p className = "text-xs text-muted-foreground mt-2.5" >
161+ < Info className = "h-3 w-3 inline-block mr-1.5 align-middle" />
162+ < span className = "align-middle" > Sharing with specific users is not available on your current < Link href = { 'https://sourcebot.dev/pricing' } target = "_blank" rel = "noopener noreferrer" className = "underline" > plan</ Link > .</ span >
163+ </ p >
164+ ) }
165+
146166 < Separator className = "-mx-4 w-auto my-4" />
147167 </ >
148168 ) }
0 commit comments