Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,10 @@ export default function ImportantFilesView({
const canManagePackage = useMemo(() => {
if (isOwner) return isOwner
if (organization) {
return organization.user_permissions?.can_manage_package
return organization.user_permissions?.can_manage_org
}
return false
}, [isOwner, organization])

// File type utilities
const isLicenseFile = useCallback((filePath: string) => {
const lowerPath = filePath.toLowerCase()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { useState, useEffect, useMemo } from "react"
import { usePackageFileById, usePackageFiles } from "@/hooks/use-package-files"
import { getLicenseFromLicenseContent } from "@/lib/getLicenseFromLicenseContent"
import { PackageInfo } from "@/lib/types"
import { useOrganization } from "@/hooks/use-organization"

interface SidebarAboutSectionProps {
packageInfo?: PackageInfo
Expand All @@ -25,6 +26,14 @@ export default function SidebarAboutSection({
include_ai_review: true,
})

const { organization } = useOrganization(
packageInfo?.owner_org_id
? { orgId: String(packageInfo.owner_org_id) }
: packageInfo?.owner_github_username
? { github_handle: packageInfo.owner_github_username }
: {},
)

const { data: releaseFiles } = usePackageFiles(
packageInfo?.latest_package_release_id,
)
Expand Down Expand Up @@ -52,6 +61,14 @@ export default function SidebarAboutSection({
packageInfo?.owner_github_username ===
useGlobalStore((s) => s.session?.github_username)

const canManageOrg = useMemo(() => {
if (isOwner) return isOwner
if (organization) {
return organization.user_permissions?.can_manage_org
}
return false
}, [isOwner, organization])

// Local state to store updated values before the query refetches
const [localDescription, setLocalDescription] = useState<string>("")
const [localWebsite, setLocalWebsite] = useState<string>("")
Expand Down Expand Up @@ -106,7 +123,7 @@ export default function SidebarAboutSection({
<div className="mb-6">
<div className="flex justify-between items-center mb-2">
<h2 className="text-lg font-semibold">About</h2>
{isOwner && (
{canManageOrg && (
<Button
variant="ghost"
size="sm"
Expand Down