@@ -10,6 +10,7 @@ import { useState, useEffect, useMemo } from "react"
1010import { usePackageFileById , usePackageFiles } from "@/hooks/use-package-files"
1111import { getLicenseFromLicenseContent } from "@/lib/getLicenseFromLicenseContent"
1212import { PackageInfo } from "@/lib/types"
13+ import { useOrganization } from "@/hooks/use-organization"
1314
1415interface SidebarAboutSectionProps {
1516 packageInfo ?: PackageInfo
@@ -25,6 +26,14 @@ export default function SidebarAboutSection({
2526 include_ai_review : true ,
2627 } )
2728
29+ const { organization } = useOrganization (
30+ packageInfo ?. owner_org_id
31+ ? { orgId : String ( packageInfo . owner_org_id ) }
32+ : packageInfo ?. owner_github_username
33+ ? { github_handle : packageInfo . owner_github_username }
34+ : { } ,
35+ )
36+
2837 const { data : releaseFiles } = usePackageFiles (
2938 packageInfo ?. latest_package_release_id ,
3039 )
@@ -52,6 +61,14 @@ export default function SidebarAboutSection({
5261 packageInfo ?. owner_github_username ===
5362 useGlobalStore ( ( s ) => s . session ?. github_username )
5463
64+ const canManageOrg = useMemo ( ( ) => {
65+ if ( isOwner ) return isOwner
66+ if ( organization ) {
67+ return organization . user_permissions ?. can_manage_org
68+ }
69+ return false
70+ } , [ isOwner , organization ] )
71+
5572 // Local state to store updated values before the query refetches
5673 const [ localDescription , setLocalDescription ] = useState < string > ( "" )
5774 const [ localWebsite , setLocalWebsite ] = useState < string > ( "" )
@@ -106,7 +123,7 @@ export default function SidebarAboutSection({
106123 < div className = "mb-6" >
107124 < div className = "flex justify-between items-center mb-2" >
108125 < h2 className = "text-lg font-semibold" > About</ h2 >
109- { isOwner && (
126+ { canManageOrg && (
110127 < Button
111128 variant = "ghost"
112129 size = "sm"
0 commit comments