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.
TypeScript adeagent-ideai-agentsautomationbotclaude-codecodexghosttygrok-bothermes-agentmobile-appmuseopenclawopencodeorchestrationpiruntimeterminalworktreesyc-backed
import { useCallback, useState } from 'react'
import { ActivityIndicator, Pressable, Text, View } from 'react-native'
import { colors, radii, spacing, typography } from '../../theme/mobile-theme'
import { themedStyleSheet } from '../../theme/themed-styles'
import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme'
import type { RpcClient } from '../../transport/rpc-client'
import { triggerError, triggerSuccess } from '../../platform/haptics'
import {
parseGitHubIssueOrPRLink,
parseGitHubIssueOrPRNumber
} from '../../../../src/shared/github/links'
import { linkMobilePr } from '../../source-control/mobile-pr-link'
import { TextField } from '../composer-input/TextField'
import { useMobileTranslation } from '../../i18n/use-mobile-translation'
type Props = {
client: RpcClient | null
worktreeId: string
onCancel: () => void
onLinked: () => void
}
// Desktop's parser accepts any GitHub host (GHES included); an issue URL is not a PR link.
function parsePrReference(input: string): number | null {
const link = parseGitHubIssueOrPRLink(input)
if (link) {
return link.type === 'pr' ? link.number : null
}
return parseGitHubIssueOrPRNumber(input)
}
// Use inline View inside sidebar ScrollView; nested BottomDrawer overlay clips, matching compose-form constraint.
export function MobileLinkPrForm({ client, worktreeId, onCancel, onLinked }: Props) {
useMobileColorScheme()
const t = useMobileTranslation()
const [input, setInput] = useState('')
const [submitting, setSubmitting] = useState(false)
const [error, setError] = useState<string | null>(null)
const parsed = parsePrReference(input)
const submit = useCallback(async () => {
if (!client || submitting || parsed === null) {
return
}
setSubmitting(true)
setError(null)
try {
const outcome = await linkMobilePr(client, worktreeId, parsed)
if (outcome.ok) {
triggerSuccess()
onLinked()
} else {
triggerError()
setError(outcome.error)
}
} finally {
setSubmitting(false)
}
}, [client, onLinked, parsed, submitting, worktreeId])
return (
<View>
<View style={styles.headingRow}>
<Text style={styles.heading}>
{t('pullRequest.linkPrForm.title', 'Link existing pull request')}
</Text>
<Pressable
onPress={onCancel}
disabled={submitting}
accessibilityRole="button"
accessibilityLabel={t('common.cancel', 'Cancel')}
hitSlop={8}
>
<Text style={styles.cancelText}>{t('common.cancel', 'Cancel')}</Text>
</Pressable>
</View>
<Text style={styles.label}>
{t('pullRequest.linkPrForm.referenceLabel', 'PR number or GitHub URL')}
</Text>
<TextField
value={input}
onChangeText={setInput}
placeholder={t(
'pullRequest.linkPrForm.referencePlaceholder',
'#123 or https://github.com/owner/repo/pull/123'
)}
autoCapitalize="none"
autoCorrect={false}
editable={!submitting}
/>
{error ? <Text style={styles.error}>{error}</Text> : null}
<Pressable
style={({ pressed }) => [
styles.submit,
(submitting || parsed === null) && styles.submitDisabled,
pressed && styles.submitPressed
]}
disabled={submitting || parsed === null}
onPress={() => void submit()}
>
{submitting ? (
<ActivityIndicator size="small" color={colors.bgBase} />
) : (
<Text style={styles.submitText}>
{parsed
? t('pullRequest.linkPrForm.linkNumber', 'Link #{{number}}', { number: parsed })
: t('pullRequest.linkPrForm.linkButton', 'Link pull request')}
</Text>
)}
</Pressable>
</View>
)
}
const styles = themedStyleSheet(() => ({
headingRow: {
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between',
marginBottom: spacing.sm
},
heading: {
color: colors.textPrimary,
fontSize: typography.bodySize,
fontWeight: '700'
},
cancelText: {
color: colors.textSecondary,
fontSize: typography.metaSize,
fontWeight: '600'
},
label: {
color: colors.textSecondary,
fontSize: typography.metaSize,
marginTop: spacing.sm,
marginBottom: spacing.xs
},
error: { color: colors.statusRed, fontSize: typography.metaSize, marginTop: spacing.md },
submit: {
marginTop: spacing.lg,
minHeight: 46,
borderRadius: radii.button,
backgroundColor: colors.textPrimary,
alignItems: 'center',
justifyContent: 'center'
},
submitDisabled: { opacity: 0.45 },
submitPressed: { opacity: 0.8 },
submitText: { color: colors.bgBase, fontSize: typography.bodySize, fontWeight: '600' }
}))