()
| 7 | import { Link } from 'components/Link' |
| 8 | |
| 9 | export const SidebarHomepage = () => { |
| 10 | const router = useRouter() |
| 11 | const { currentVersion } = useVersion() |
| 12 | const { activeProducts, isFPT } = useMainContext() |
| 13 | |
| 14 | return ( |
| 15 | <ul data-testid="sidebar" className="mt-4"> |
| 16 | <li> |
| 17 | <ActionList variant="full"> |
| 18 | {activeProducts |
| 19 | .filter( |
| 20 | (product) => isFPT || product.versions?.includes(currentVersion) || product.external |
| 21 | ) |
| 22 | .map((product) => { |
| 23 | const href = `${!product.external ? `/${router.locale}` : ''}${ |
| 24 | product.versions?.includes(currentVersion) && !isFPT |
| 25 | ? `/${currentVersion}/${product.id}` |
| 26 | : product.href |
| 27 | }` |
| 28 | |
| 29 | return ( |
| 30 | <ActionList.Item |
| 31 | key={product.id} |
| 32 | title={`${product.name}${product.external ? '(External Site)' : ''}`} |
| 33 | className="width-full my-2" |
| 34 | sx={{ padding: 0 }} |
| 35 | > |
| 36 | <Link |
| 37 | href={href} |
| 38 | target={product.external ? '_blank' : undefined} |
| 39 | className="d-block f4 pl-4 pr-5 py-2 color-fg-default no-underline width-full" |
| 40 | > |
| 41 | {product.name} |
| 42 | {product.external && ( |
| 43 | <span className="ml-1"> |
| 44 | <LinkExternalIcon size="small" /> |
| 45 | </span> |
| 46 | )} |
| 47 | </Link> |
| 48 | </ActionList.Item> |
| 49 | ) |
| 50 | })} |
| 51 | </ActionList> |
| 52 | </li> |
| 53 | </ul> |
| 54 | ) |
| 55 | } |
nothing calls this directly
no test coverage detected