import { ScreenScrollContainer } from 'src/components/layout'
import { BodyText, LinkRowGroup, type LinkRowProps } from 'src/components/ui'
import { YStack } from 'tamagui'

const PIXELFED_SUPPORT: LinkRowProps[] = [
  {
    kind: 'external',
    title: 'Support Pixelfed',
    description: 'Official project page with ways to contribute financially.',
    url: 'https://pixelfed.org/support-our-project',
    icon: 'heart',
  },
  {
    kind: 'external',
    title: 'GitHub Sponsors',
    description: 'Monthly sponsorship for @dansup, Pixelfed’s creator.',
    url: 'https://github.com/sponsors/dansup',
    icon: 'github',
  },
  {
    kind: 'external',
    title: 'Patreon',
    description: 'Recurring support via Patreon.',
    url: 'https://www.patreon.com/dansup',
    icon: 'dollar-sign',
  },
  {
    kind: 'external',
    title: 'Open Collective',
    description: 'Transparent, one-time or recurring donations.',
    url: 'https://opencollective.com/pixelfed',
    icon: 'gift',
  },
]

const PIXELFED_REPOS: LinkRowProps[] = [
  {
    kind: 'external',
    title: 'pixelfed/pixelfed',
    description: 'The federated photo-sharing server this app connects to.',
    url: 'https://github.com/pixelfed/pixelfed',
  },
  {
    kind: 'external',
    title: 'pixelfed/pixelfed-rn',
    description: 'The original React Native client this app forks from.',
    url: 'https://github.com/pixelfed/pixelfed-rn',
  },
]

// Curated list of the projects and maintainers whose work makes Halflight
// possible. Grouped at the org/maintainer level per the project guideline of
// "acknowledge the people and small teams, not the large corporations that
// don’t need the signal boost." Intentionally omits dependencies pulled in
// transitively or whose author is a large corporation.
const OTHER_PROJECTS: LinkRowProps[] = [
  { kind: 'external', title: 'Tamagui', url: 'https://tamagui.dev' },
  { kind: 'external', title: 'Expo', url: 'https://expo.dev' },
  { kind: 'external', title: 'TanStack', url: 'https://tanstack.com' },
  { kind: 'external', title: 'Biome', url: 'https://biomejs.dev' },
  { kind: 'external', title: 'Software Mansion', url: 'https://swmansion.com' },
  { kind: 'external', title: 'Mo Gorhom', url: 'https://github.com/gorhom' },
  { kind: 'external', title: 'nandorojo', url: 'https://github.com/nandorojo' },
  { kind: 'external', title: 'Marc Rousavy', url: 'https://mrousavy.com' },
  { kind: 'external', title: 'Dominic Go', url: 'https://github.com/dominicstop' },
]

export default function Screen() {
  return (
    <ScreenScrollContainer variant="scroll" header="Open Source">
      <YStack px="$5" pt="$4" pb="$2" gap="$2">
        <BodyText tone="secondary">
          Halflight stands on the work of Pixelfed and the wider open-source community. If
          the project has been useful to you, please consider supporting them directly.
        </BodyText>
      </YStack>

      <LinkRowGroup header="Support Pixelfed" rows={PIXELFED_SUPPORT} />
      <LinkRowGroup header="Pixelfed Projects" rows={PIXELFED_REPOS} />
      <LinkRowGroup header="Other Open Source Projects" rows={OTHER_PROJECTS} />

      <YStack pb="$6" />
    </ScreenScrollContainer>
  )
}
