()
| 8 | import { useRouter } from 'next/router' |
| 9 | |
| 10 | export const SupportSection = () => { |
| 11 | const { currentVersion } = useVersion() |
| 12 | const { relativePath, enterpriseServerReleases } = useMainContext() |
| 13 | const router = useRouter() |
| 14 | |
| 15 | const isDeprecated = |
| 16 | enterpriseServerReleases.isOldestReleaseDeprecated && |
| 17 | currentVersion.includes(enterpriseServerReleases.oldestSupported) |
| 18 | const isEarlyAccess = relativePath?.includes('early-access/') |
| 19 | const isEnglish = router.locale === 'en' |
| 20 | const isSitePolicyDocs = router.asPath.startsWith('/site-policy') |
| 21 | |
| 22 | const showSurvey = !isDeprecated && !isSitePolicyDocs |
| 23 | const showContribution = !isDeprecated && !isEarlyAccess && isEnglish |
| 24 | const showSupport = true |
| 25 | const totalCols = Number(showSurvey) + Number(showContribution) + Number(showSupport) |
| 26 | |
| 27 | return ( |
| 28 | <section className="container-xl mt-lg-8 mt-6 px-3 px-md-6 no-print mx-auto"> |
| 29 | <div className="container-xl mx-auto py-6 py-lg-6 clearfix border-top border-color-secondary"> |
| 30 | {showSurvey && ( |
| 31 | <div |
| 32 | className={cx( |
| 33 | 'float-left pr-4 mb-6 mb-xl-0 col-12', |
| 34 | totalCols > 1 && 'col-lg-6', |
| 35 | totalCols > 2 && 'col-xl-3' |
| 36 | )} |
| 37 | > |
| 38 | <Survey /> |
| 39 | </div> |
| 40 | )} |
| 41 | {showContribution && ( |
| 42 | <div |
| 43 | className={cx( |
| 44 | 'float-left pr-4 mb-6 mb-xl-0 col-12', |
| 45 | totalCols > 1 && 'col-lg-6', |
| 46 | totalCols > 2 && 'col-xl-4', |
| 47 | totalCols > 2 && showSurvey && 'offset-xl-1' |
| 48 | )} |
| 49 | > |
| 50 | <Contribution /> |
| 51 | </div> |
| 52 | )} |
| 53 | {showSupport && ( |
| 54 | <div |
| 55 | className={cx( |
| 56 | 'float-left pr-4 mb-6 mb-xl-0 col-12', |
| 57 | totalCols > 1 && 'col-lg-6', |
| 58 | totalCols > 2 && 'col-xl-3', |
| 59 | totalCols > 2 && (showSurvey || showContribution) && 'offset-xl-1' |
| 60 | )} |
| 61 | > |
| 62 | <Support /> |
| 63 | </div> |
| 64 | )} |
| 65 | </div> |
| 66 | </section> |
| 67 | ) |
nothing calls this directly
no test coverage detected