Skip to content

A games launcher for GOG, Amazon and Epic Games for Linux, Windows and macOS.

2.3 KB
Raw Blame
import { MouseEvent } from 'react'
import type { TFunction } from 'i18next'
import { useTranslation } from 'react-i18next'
import Link from 'frontend/components/UI/Link'
import { createNewWindow } from 'frontend/helpers'
import Alert from '../Alert'

const TITLE = 'Fortnite on Linux (beta)'
const GUIDE = 'https://www.easy.ac/support/articles#linux-setup'

function FortniteLinuxCopy() {
  const { t } = useTranslation()

  const onGuideClick = (event: MouseEvent) => {
    event.preventDefault()
    createNewWindow(GUIDE)
  }

  return (
    <>
      <span className="fortniteLinuxCopy__body">
        {t(
          'anticheat.fortnite_linux.body',
          "Epic has enabled Easy Anti-Cheat for Linux in Fortnite. Fortnite runs in Heroic through Proton on systems that meet Epic's requirements: Secure Boot (using your distro's keys), TPM 2.0, and IOMMU enabled."
        )}
      </span>
      <span className="fortniteLinuxCopy__caveat">
        {t(
          'anticheat.fortnite_linux.caveat',
          'Steam Deck and SteamOS are not supported for Fortnite yet.'
        )}
      </span>
      <span className="fortniteLinuxCopy__trackerNote">
        {t(
          'anticheat.fortnite_linux.tracker_note',
          'AreWeAntiCheatYet may still list Fortnite as unsupported.'
        )}
      </span>
      <Link
        external
        href={GUIDE}
        className="fortniteLinuxCopy__guide"
        onClick={onGuideClick}
      >
        {t('anticheat.fortnite_linux.guide', "Read Epic's Linux setup guide")}
      </Link>
    </>
  )
}

export default function FortniteLinuxNotice() {
  const { t } = useTranslation()

  return (
    <Alert
      className="anticheatInfo"
      variant="info"
      title={t('anticheat.fortnite_linux.title', TITLE)}
    >
      <FortniteLinuxCopy />
    </Alert>
  )
}

export const getFortniteLinuxConfirmOptions = (
  t: TFunction,
  handleInstall: (path?: string, ignoreAnticheat?: boolean) => unknown,
  path?: string
) => ({
  title: t('anticheat.fortnite_linux.title', TITLE),
  message: <FortniteLinuxCopy />,
  buttons: [
    {
      text: t(
        'anticheat.fortnite_linux.continue_installation',
        'Continue installation'
      ),
      onClick: () => {
        void handleInstall(path, true)
      }
    },
    {
      text: t('button.cancel', 'Cancel'),
      onClick: () => null
    }
  ]
})