Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

2.6 KB
Raw Blame
import { View } from 'react-native'
import { useSafeAreaInsets } from 'react-native-safe-area-context'
import { colors } from '../../theme/mobile-theme'
import { themedStyleSheet } from '../../theme/themed-styles'
import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme'
import type { ConnectionState } from '../../transport/types'
import type { RpcClient } from '../../transport/rpc-client'
import type { MobileGitStatusResult } from '../../source-control/mobile-git-status'
import type { MobilePrSidebarController } from '../../session/use-mobile-pr-sidebar-controller'
import { MobilePRSidebar } from '../MobilePRSidebar'
import { useMobileTranslation } from '../../i18n/use-mobile-translation'

type Props = {
  client: RpcClient | null
  connState: ConnectionState
  worktreeId: string
  branch: string | null
  headSha: string | null
  gitStatus: MobileGitStatusResult | null
  isGithubRepo?: boolean
  branchContextLoaded?: boolean
  controller: MobilePrSidebarController
  workspaceLabel: string | null
}

// Hub owns PR header/segments/load/controller; one fetch feeds branch chip and chromeless sidebar body.
export function MobilePrViewPanelBody({
  client,
  connState,
  worktreeId,
  branch,
  headSha,
  gitStatus,
  isGithubRepo = true,
  branchContextLoaded = true,
  controller,
  workspaceLabel
}: Props) {
  useMobileColorScheme()
  const t = useMobileTranslation()
  const insets = useSafeAreaInsets()

  const sidebarState = !branchContextLoaded
    ? ({ kind: 'loading' } as const)
    : !isGithubRepo
      ? ({
          kind: 'blocked',
          message: t(
            'pullRequest.prViewPanel.providerUnavailable',
            'Hosted review panel unavailable for this provider.'
          )
        } as const)
      : branch === null
        ? ({
            kind: 'error',
            message: t('pullRequest.prViewPanel.branchUnavailable', 'Current branch unavailable.')
          } as const)
        : controller.prSidebarState

  return (
    <View style={styles.container}>
      <MobilePRSidebar
        state={sidebarState}
        onRetry={controller.retryPRSidebar}
        refetch={controller.refetchPRSidebar}
        client={client}
        connState={connState}
        worktreeId={worktreeId}
        gitBranch={branch}
        gitStatus={gitStatus}
        headSha={headSha}
        bottomInset={insets.bottom}
        // Hub header already hosts open-on-web while this segment is active.
        showOpenOnWeb={false}
        workspaceLabel={workspaceLabel}
      />
    </View>
  )
}

const styles = themedStyleSheet(() => ({
  container: {
    flex: 1,
    backgroundColor: colors.bgBase
  }
}))