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.

1.1 KB
Raw Blame
import type { ProviderViewProjectionModel } from './use-mobile-tasks-provider-view-projection'
import { useMobileTranslation } from '../i18n/use-mobile-translation'
import { classifyConnection } from './mobile-tasks-dependencies'
import { PROVIDER_EMPTY_LABELS } from './mobile-task-view-options'

export function useMobileTasksConnectionPresentation(model: ProviderViewProjectionModel) {
  useMobileTranslation()
  const {
    connState,
    githubMode,
    lastConnectedAt,
    provider,
    query,
    reconnectAttempts,
    relayRecovery
  } = model
  const headerVerdict = classifyConnection({
    state: connState,
    reconnectAttempts,
    lastConnectedAt,
    ...relayRecovery
  })
  const emptyLabel =
    connState !== 'connected'
      ? 'Connect to a host to load tasks'
      : query
        ? 'No matching tasks'
        : PROVIDER_EMPTY_LABELS[provider]
  const isGithubProjectSearch = provider === 'github' && githubMode === 'project'
  return Object.assign(model, { headerVerdict, emptyLabel, isGithubProjectSearch })
}

export type ConnectionPresentationModel = ReturnType<typeof useMobileTasksConnectionPresentation>