Skip to content

Commit

Permalink
fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
im2nguyen committed Jul 9, 2024
1 parent e567fe2 commit cf6c99f
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const generateBasicSuggestedPages = (productSlug: ProductSlug) => {

/**
* These are pages listed after the main pages for a product, and just before a
* link to the Ttorials Library.
* link to the Tutorials Library.
*/
const EXTRA_PAGES: Record<
Exclude<ProductSlug, 'sentinel'>,
Expand Down
2 changes: 1 addition & 1 deletion src/components/icon-tile/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ProductSlug } from 'types/products'
export type ProductBrandColor =
| 'neutral'
| 'neutral-dark'
| Exclude<ProductSlug, 'sentinel' | 'hcp'>
| Exclude<ProductSlug, 'hcp'>

export interface IconTileProps {
/** Pass a single child, which should be a Flight icon. For 'small' and 'medium' size, pass the 16px icon size; for other sizes pass the 24px icon size. Note that non-"color" icons will be colored using the "brandColor". */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,11 @@ export function getNavItems(currentProduct: ProductData): NavItem[] {

/**
* Tutorials
*
* Note: we exclude Sentinel, as it does not have tutorials yet.
*/
if (currentProduct.slug !== 'sentinel') {
items.push({
label: 'Tutorials',
url: `/${currentProduct.slug}/tutorials`,
})
}
items.push({
label: 'Tutorials',
url: `/${currentProduct.slug}/tutorials`,
})

/**
* Documentation categories
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,11 @@ export const generateProductLandingSidebarMenuItems = (
menuItems.push(introNavItem)
}

// Add a "Tutorials" link for all products except sentinel
if (product.slug !== 'sentinel') {
menuItems.push({
title: 'Tutorials',
fullPath: `/${product.slug}/tutorials`,
})
}
// Add a "Tutorials" link for all products
menuItems.push({
title: 'Tutorials',
fullPath: `/${product.slug}/tutorials`,
})

// Add "Documentation" item links for all products
menuItems.push(...docsItems)
Expand Down
14 changes: 5 additions & 9 deletions src/components/sidebar/helpers/generate-resources-nav-items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,11 @@ function generateResourcesNavItems(

return [
{ heading: 'Resources' },
...(productSlug !== 'sentinel'
? [
{
// Add a "Tutorials" link for all products except Sentinel
title: 'Tutorial Library',
href: getTutorialLibraryUrl(productSlug),
},
]
: []),
{
// Add a "Tutorials" link for all products except Sentinel
title: 'Tutorial Library',
href: getTutorialLibraryUrl(productSlug),
},
...getCertificationsLink(productSlug),
{
title: 'Community Forum',
Expand Down
1 change: 1 addition & 0 deletions src/components/tutorial-card/helpers/build-aria-label.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const PRODUCT_LABEL_MAP: Record<ProductOption, string> = {
vault: 'Vault',
vagrant: 'Vagrant',
waypoint: 'Waypoint',
sentinel: 'Sentinel',
}

export function getSpeakableDuration(duration: TutorialCardProps['duration']) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const PRODUCT_ICON_MAP: Record<ProductOption, JSX.Element> = {
vault: <ProductIcon productSlug="vault" />,
vagrant: <ProductIcon productSlug="vagrant" />,
waypoint: <ProductIcon productSlug="waypoint" />,
sentinel: <ProductIcon productSlug="sentinel" />,
}
/**
* Map all card badge options to icons
Expand All @@ -46,6 +47,7 @@ const PRODUCT_LABEL_MAP: Record<ProductOption, string> = {
vault: 'Vault',
vagrant: 'Vagrant',
waypoint: 'Waypoint',
sentinel: 'Sentinel',
}
/**
* Map all card badge options to badge labels
Expand Down
13 changes: 1 addition & 12 deletions src/data/sentinel.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,30 +42,19 @@
},
"version": "0.18.6",
"subnavItems": [
{
"url": "/sentinel/intro",
"text": "Intro",
"type": "inbound"
},
{
"url": "/sentinel",
"text": "Docs",
"type": "inbound"
}
],
"basePaths": ["docs", "intro", "downloads"],
"basePaths": ["docs", "install"],
"rootDocsPaths": [
{
"basePathForLoader": "sentinel",
"iconName": "docs",
"name": "Docs",
"path": "docs"
},
{
"basePathForLoader": "sentinel/intro",
"iconName": "docs",
"name": "Intro",
"path": "intro"
}
]
}
1 change: 1 addition & 0 deletions src/lib/learn-client/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ export enum ProductOption {
vagrant = 'vagrant',
vault = 'vault',
waypoint = 'waypoint',
sentinel = 'sentinel',
}

export enum SectionOption {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/products.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ function isProductSlug(string: string): string is ProductSlug {
const productSlugs = Object.keys(productSlugsToNames) as ProductSlug[]

/**
* An array of product slugs which are "active" on the site. Currently all but sentinel.
* An array of product slugs which are "active" on the site. Currently all products.
*/
const activeProductSlugs = productSlugs.filter((slug) => slug !== 'sentinel')
const activeProductSlugs = productSlugs

/**
* Generates an array of Product objects from `productSlugs`.
Expand Down
7 changes: 2 additions & 5 deletions src/types/products.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,15 @@ interface Product extends ProductMeta {
slug: ProductSlug
}

type LearnProductSlug = Exclude<ProductSlug, 'hcp' | 'sentinel'>
type LearnProductSlug = Exclude<ProductSlug, 'hcp'>

/**
* This is needed so that `LearnProductData` can extend both `ProductData` and
* `LearnProduct`. Otherwise, we get the following error:
*
* "Types of property 'name' are incompatible"
*/
type LearnProductName = Exclude<
ProductName,
'HashiCorp Cloud Platform' | 'Sentinel'
>
type LearnProductName = Exclude<ProductName, 'HashiCorp Cloud Platform'>

type HcpProductName = Exclude<
ProductName,
Expand Down
2 changes: 1 addition & 1 deletion src/views/tutorial-library/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ export const VALID_EDITION_SLUGS_FOR_FILTERING = EDITIONS.map(
*/
export const VALID_PRODUCT_SLUGS_FOR_FILTERING = Object.keys(
productSlugsToNames
).filter((slug) => !['hcp', 'sentinel'].includes(slug))
).filter((slug) => !['hcp'].includes(slug))
7 changes: 3 additions & 4 deletions src/views/tutorials-landing/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ const PAGE_SUBTITLE =
* ProductSection constants
*/

const PRODUCT_SECTIONS_ORDER_BY_SLUG: Exclude<
ProductSlug,
'hcp' | 'sentinel'
>[] = [
const PRODUCT_SECTIONS_ORDER_BY_SLUG: Exclude<ProductSlug, 'hcp'>[] = [
'terraform',
'vault',
'consul',
Expand All @@ -34,6 +31,7 @@ const PRODUCT_SECTIONS_ORDER_BY_SLUG: Exclude<
'boundary',
'vagrant',
'waypoint',
'sentinel',
]

const PRODUCT_DESCRIPTIONS = {
Expand All @@ -53,6 +51,7 @@ const PRODUCT_DESCRIPTIONS = {
'Build a developer platform with a PaaS-like interface for infrastructure self-service',
vagrant:
'Build, manage, and share virtual machine environments with a single workflow',
sentinel: 'Enforce policy as code for HashiCorp products',
}

/**
Expand Down

0 comments on commit cf6c99f

Please sign in to comment.