diff --git a/src/renderer/src/components/GitHubItemDialog.tsx b/src/renderer/src/components/GitHubItemDialog.tsx index 7f81e1327..3673336ab 100644 --- a/src/renderer/src/components/GitHubItemDialog.tsx +++ b/src/renderer/src/components/GitHubItemDialog.tsx @@ -38,6 +38,7 @@ import { Plus, RefreshCw, Send, + Settings, UndoDot, Users, Wrench, @@ -179,6 +180,27 @@ function parseOwnerRepoFromItemUrl(url: string): GitHubOwnerRepo | null { } } +function getGitHubRepositoryLabelsUrl(itemUrl: string): string | null { + try { + const parsed = new URL(itemUrl) + if (parsed.protocol !== 'https:' && parsed.protocol !== 'http:') { + return null + } + const segments = parsed.pathname.split('/').filter(Boolean) + if (segments.length < 2) { + return null + } + // Why: label management is repository-scoped; preserving the origin keeps + // GitHub Enterprise URLs working while navigating away from the issue path. + parsed.pathname = `/${segments[0]}/${segments[1]}/labels` + parsed.search = '' + parsed.hash = '' + return parsed.toString() + } catch { + return null + } +} + const MonacoCodeExcerpt = lazy(() => import('@/components/editor/MonacoCodeExcerpt')) export type ItemDialogTab = 'conversation' | 'checks' | 'files' @@ -4102,6 +4124,37 @@ async function runPullRequestStateUpdate(args: { } } +function GitHubLabelsSettingsLink({ + url, + separated, + onOpen +}: { + url: string | null + separated?: boolean + onOpen?: () => void +}): React.JSX.Element | null { + if (!url) { + return null + } + + return ( +
+ +
+ ) +} + function GHEditSection({ item, repoPath, @@ -4173,6 +4226,7 @@ function GHEditSection({ ) const repoLabelsBySlug = useRepoLabelsBySlug(slugOwner, slugRepo) const repoLabels = projectOrigin ? repoLabelsBySlug : repoLabelsByPath + const repositoryLabelsUrl = useMemo(() => getGitHubRepositoryLabelsUrl(item.url), [item.url]) const repoAssigneesByPath = useRepoAssignees( projectOrigin ? null : repoPath, projectOrigin ? null : repoId @@ -4578,7 +4632,8 @@ function GHEditSection({
{repoLabels.error}
- ) : ( + ) : null} + {!repoLabels.error ? (
{repoLabels.data.map((label) => (
- )} + ) : null} + 0} + onOpen={() => setLabelPopoverOpen(false)} + /> @@ -4745,7 +4805,8 @@ function GHEditSection({
{repoLabels.error}
- ) : ( + ) : null} + {!repoLabels.error ? (
{repoLabels.data.map((label) => (
- )} + ) : null} + 0} + onOpen={() => setLabelPopoverOpen(false)} + />