@@ -214,7 +214,6 @@ import {
214214 usePreviewMiniPlayerStore ,
215215} from "../previewMiniPlayerStore" ;
216216import { IssueDetailPanel } from "./issue/IssueDetailPanel" ;
217- import { IssuesPanel } from "./issue/IssuesPanel" ;
218217import { IssuesUnavailableState } from "./issue/IssuesUnavailableState" ;
219218import { pullRequestPanelContext } from "./pullRequest/pullRequestDetail.logic" ;
220219import { PullRequestDetailPanel } from "./pullRequest/PullRequestDetailPanel" ;
@@ -2036,8 +2035,10 @@ export default function ChatView(props: ChatViewProps) {
20362035 const activeIssueSurfaceId =
20372036 activeRightPanelSurface ?. kind === "issue"
20382037 ? activeRightPanelSurface . id
2039- : activeRightPanelSurface ?. kind === "issues" && activeRightPanelSurface . selected
2040- ? issueSurfaceId ( activeRightPanelSurface . selected )
2038+ : activeRightPanelSurface ?. kind === "repository" &&
2039+ activeRightPanelSurface . view === "issues" &&
2040+ activeRightPanelSurface . selectedIssue
2041+ ? issueSurfaceId ( activeRightPanelSurface . selectedIssue )
20412042 : undefined ;
20422043 const handleIssueTabStatusChange = useCallback (
20432044 ( status : IssueTabStatus ) => {
@@ -4611,15 +4612,30 @@ export default function ChatView(props: ChatViewProps) {
46114612 useRightPanelStore . getState ( ) . openRepository ( activeThreadRef , "pull-requests" ) ;
46124613 } , [ activeThreadRef , pullRequestsSurfaceAvailable ] ) ;
46134614 const addRepositorySurface = useCallback ( ( ) => {
4614- if ( ! activeThreadRef || ( ! ( isGitRepo && supportsGitHistory ) && ! pullRequestsSurfaceAvailable ) )
4615+ const issuesAvailable = supportsIssues && activeProject !== null ;
4616+ if (
4617+ ! activeThreadRef ||
4618+ ( ! ( isGitRepo && supportsGitHistory ) && ! pullRequestsSurfaceAvailable && ! issuesAvailable )
4619+ )
46154620 return ;
46164621 useRightPanelStore
46174622 . getState ( )
46184623 . openRepository (
46194624 activeThreadRef ,
4620- isGitRepo && supportsGitHistory ? "history" : "pull-requests" ,
4625+ isGitRepo && supportsGitHistory
4626+ ? "history"
4627+ : pullRequestsSurfaceAvailable
4628+ ? "pull-requests"
4629+ : "issues" ,
46214630 ) ;
4622- } , [ activeThreadRef , isGitRepo , pullRequestsSurfaceAvailable , supportsGitHistory ] ) ;
4631+ } , [
4632+ activeProject ,
4633+ activeThreadRef ,
4634+ isGitRepo ,
4635+ pullRequestsSurfaceAvailable ,
4636+ supportsGitHistory ,
4637+ supportsIssues ,
4638+ ] ) ;
46234639 const { state : deviceState , loaded : deviceStateLoaded } = useDeviceState (
46244640 activeThreadRef ?. environmentId ?? null ,
46254641 ) ;
@@ -4869,7 +4885,7 @@ export default function ChatView(props: ChatViewProps) {
48694885 ) {
48704886 panels . openProactive (
48714887 activeThreadRef ,
4872- { id : "repository" , kind : "repository" , view : "pull-requests" } ,
4888+ { id : "repository" , kind : "repository" , view : "pull-requests" , selectedIssue : null } ,
48734889 userActionRevision ,
48744890 ) ;
48754891 } else if (
@@ -5998,22 +6014,6 @@ export default function ChatView(props: ChatViewProps) {
59986014 } ,
59996015 [ composerOverlayElement ] ,
60006016 ) ;
6001- // Which issue is not something the chooser can know, so it opens the browser and the reader
6002- // picks inside it — in the same tab, rather than as one more of them.
6003- const addIssueSurface = useCallback ( ( ) => {
6004- if ( ! activeThreadRef ) return ;
6005- useRightPanelStore . getState ( ) . openIssues ( activeThreadRef ) ;
6006- } , [ activeThreadRef ] ) ;
6007- const selectIssueInPanel = useCallback (
6008- (
6009- target : { projectId : string ; provider ?: string ; repository : string ; number : number } | null ,
6010- ) => {
6011- if ( ! activeThreadRef ) return ;
6012- useRightPanelStore . getState ( ) . selectIssueInPanel ( activeThreadRef , target ) ;
6013- } ,
6014- [ activeThreadRef ] ,
6015- ) ;
6016- const issueSurfaceAvailable = supportsIssues && activeProject !== null ;
60176017 const publishComposerOverlayHeight = useCallback (
60186018 ( height : number ) => {
60196019 const nextHeight = Math . ceil ( height ) ;
@@ -9761,10 +9761,29 @@ export default function ChatView(props: ChatViewProps) {
97619761 environmentId = { environmentId }
97629762 cwd = { isGitRepo ? gitCwd : null }
97639763 threadRef = { activeThreadRef }
9764+ issueContext = {
9765+ activeProject && activeProjectRef
9766+ ? {
9767+ projectId : activeProject . id ,
9768+ handoffTarget : {
9769+ kind : "existing-thread" ,
9770+ projectRef : activeProjectRef ,
9771+ draftId : composerDraftTarget ,
9772+ } ,
9773+ }
9774+ : null
9775+ }
9776+ selectedIssue = { renderedRightPanelSurface . selectedIssue ?? null }
97649777 view = { renderedRightPanelSurface . view }
97659778 active = { rightPanelOpen }
97669779 gitHistoryAvailable = { supportsGitHistory && isGitRepo }
97679780 gitHistoryPanelStore = { gitHistoryPanelStore }
9781+ issuesAvailable = { supportsIssues && activeProject !== null && activeProjectRef !== null }
9782+ onSelectIssue = { ( selected ) =>
9783+ useRightPanelStore . getState ( ) . selectRepositoryIssue ( activeThreadRef , selected )
9784+ }
9785+ onIssueStateChange = { handleIssueTabStatusChange }
9786+ onOpenLinkedPullRequest = { openLinkedPullRequest }
97689787 onViewChange = { ( view ) =>
97699788 useRightPanelStore . getState ( ) . selectRepositoryView ( activeThreadRef , view )
97709789 }
@@ -9823,12 +9842,10 @@ export default function ChatView(props: ChatViewProps) {
98239842 }
98249843 onOpenLinkedIssue = { openLinkedIssue }
98259844 />
9826- ) : ( renderedRightPanelSurface ?. kind === "issue" ||
9827- renderedRightPanelSurface ?. kind === "issues" ) &&
9845+ ) : renderedRightPanelSurface ?. kind === "issue" &&
98289846 issuesSurfaceCapabilityState === "loading" ? (
98299847 < DetailGhost label = "Loading issues" />
9830- ) : ( renderedRightPanelSurface ?. kind === "issue" ||
9831- renderedRightPanelSurface ?. kind === "issues" ) &&
9848+ ) : renderedRightPanelSurface ?. kind === "issue" &&
98329849 issuesSurfaceCapabilityState === "unavailable" ? (
98339850 < IssuesUnavailableState
98349851 title = "Issues unavailable"
@@ -9859,19 +9876,6 @@ export default function ChatView(props: ChatViewProps) {
98599876 onStateChange = { handleIssueTabStatusChange }
98609877 onOpenLinkedPullRequest = { openLinkedPullRequest }
98619878 />
9862- ) : renderedRightPanelSurface ?. kind === "issues" && activeProject && activeProjectRef ? (
9863- < IssuesPanel
9864- environmentId = { activeThread . environmentId }
9865- projectId = { activeProject . id }
9866- selected = { renderedRightPanelSurface . selected }
9867- onSelect = { selectIssueInPanel }
9868- handoffTarget = { {
9869- kind : "existing-thread" ,
9870- projectRef : activeProjectRef ,
9871- draftId : composerDraftTarget ,
9872- } }
9873- onStateChange = { handleIssueTabStatusChange }
9874- />
98759879 ) : renderedRightPanelSurface ?. kind === "agents" ? (
98769880 < AgentsPanel
98779881 model = { agentPanelModel }
@@ -10536,17 +10540,18 @@ export default function ChatView(props: ChatViewProps) {
1053610540 onAddRepository = { addRepositorySurface }
1053710541 onAddFiles = { addFilesSurface }
1053810542 onAddPullRequest = { addPullRequestSurface }
10539- onAddIssue = { addIssueSurface }
1054010543 onAddAgents = { addAgentsSurface }
1054110544 onAddDevice = { addDeviceSurface }
1054210545 browserAvailable = { isPreviewSupportedInRuntime ( ) }
1054310546 terminalAvailable = { activeProject !== null }
1054410547 diffAvailable = { isServerThread && isGitRepo }
10545- repositoryAvailable = { ( isGitRepo && supportsGitHistory ) || pullRequestsSurfaceAvailable }
10548+ repositoryAvailable = {
10549+ ( isGitRepo && supportsGitHistory ) ||
10550+ pullRequestsSurfaceAvailable ||
10551+ ( supportsIssues && activeProject !== null )
10552+ }
1054610553 filesAvailable = { activeProject !== null }
1054710554 pullRequestAvailable = { pullRequestSurfaceAvailable }
10548- issueAvailable = { issueSurfaceAvailable }
10549- pullRequestsAvailable = { pullRequestsSurfaceAvailable }
1055010555 agentsAvailable
1055110556 issueStatuses = { issueTabStatuses }
1055210557 deviceAvailable = { activeThreadRef !== null }
@@ -10598,17 +10603,18 @@ export default function ChatView(props: ChatViewProps) {
1059810603 onAddRepository = { addRepositorySurface }
1059910604 onAddFiles = { addFilesSurface }
1060010605 onAddPullRequest = { addPullRequestSurface }
10601- onAddIssue = { addIssueSurface }
1060210606 onAddAgents = { addAgentsSurface }
1060310607 onAddDevice = { addDeviceSurface }
1060410608 browserAvailable = { isPreviewSupportedInRuntime ( ) }
1060510609 terminalAvailable = { activeProject !== null }
1060610610 diffAvailable = { isServerThread && isGitRepo }
10607- repositoryAvailable = { ( isGitRepo && supportsGitHistory ) || pullRequestsSurfaceAvailable }
10611+ repositoryAvailable = {
10612+ ( isGitRepo && supportsGitHistory ) ||
10613+ pullRequestsSurfaceAvailable ||
10614+ ( supportsIssues && activeProject !== null )
10615+ }
1060810616 filesAvailable = { activeProject !== null }
1060910617 pullRequestAvailable = { pullRequestSurfaceAvailable }
10610- issueAvailable = { issueSurfaceAvailable }
10611- pullRequestsAvailable = { pullRequestsSurfaceAvailable }
1061210618 agentsAvailable
1061310619 issueStatuses = { issueTabStatuses }
1061410620 deviceAvailable = { activeThreadRef !== null }
0 commit comments