1
0
mirror of synced 2026-02-02 06:01:58 -05:00

Merge pull request #7200 from github/repo-sync

repo sync
This commit is contained in:
Octomerger Bot
2021-06-09 09:43:14 +10:00
committed by GitHub
5 changed files with 24 additions and 20 deletions

View File

@@ -19,7 +19,15 @@ type Notif = {
export const HeaderNotifications = () => {
const router = useRouter()
const { currentVersion } = useVersion()
const { relativePath, allVersions, data, languages, currentLanguage, userLanguage, currentPathWithoutLanguage } = useMainContext()
const {
relativePath,
allVersions,
data,
languages,
currentLanguage,
userLanguage,
currentPathWithoutLanguage,
} = useMainContext()
const { t } = useTranslation('header')
const translationNotices: Array<Notif> = []
@@ -39,13 +47,12 @@ export const HeaderNotifications = () => {
type: NotificationType.TRANSLATION,
content: t('notices.localization_in_progress'),
})
}
}
} else {
if (userLanguage && userLanguage !== 'en' && languages[userLanguage]?.wip === false) {
translationNotices.push({
type: NotificationType.TRANSLATION,
content:
`This article is also available in your language of choice. Click <a href="/${userLanguage}${currentPathWithoutLanguage}">here</a>`
content: `This article is also available in your language of choice. Click <a href="/${userLanguage}${currentPathWithoutLanguage}">here</a>`,
})
}
}

View File

@@ -10,6 +10,7 @@ export type TocLandingContextT = {
title: string
introPlainText: string
tocItems: Array<TocItem>
variant?: 'compact' | 'expanded'
}
export const TocLandingContext = createContext<TocLandingContextT | null>(null)
@@ -28,6 +29,7 @@ export const getTocLandingContextFromRequest = (req: any): TocLandingContextT =>
return {
title: req.context.page.title,
introPlainText: req.context.page.introPlainText,
tocItems: req.context.tocItems || [],
tocItems: req.context.genericTocFlat || req.context.genericTocNested || [],
variant: req.context.genericTocFlat ? 'expanded' : 'compact',
}
}

View File

@@ -7,11 +7,9 @@ import { Breadcrumbs } from 'components/Breadcrumbs'
import { useTocLandingContext } from 'components/context/TocLandingContext'
import { ArticleTitle } from 'components/article/ArticleTitle'
type Props = {
variant?: 'compact' | 'expanded'
}
export const TocLanding = ({ variant = 'expanded' }: Props) => {
const { title, introPlainText, tocItems } = useTocLandingContext()
type Props = {}
export const TocLanding = (props: Props) => {
const { title, introPlainText, tocItems, variant } = useTocLandingContext()
return (
<DefaultLayout>
<div className="container-xl px-3 px-md-6 my-4 my-lg-4">

View File

@@ -13,8 +13,11 @@ const { HEROKU_RELEASE_VERSION, FEATURE_NEXTJS } = process.env
const defaultNextJSRoutes = FEATURE_NEXTJS
? [
'/en/sponsors',
'/en/discussions'
'/en/billing',
'/en/code-security',
'/en/communities',
'/en/discussions',
'/en/sponsors'
]
: []
const pageCacheDatabaseNumber = 1

View File

@@ -39,7 +39,7 @@ const GlobalPage = ({
tocLandingContext,
articleContext,
}: Props) => {
const { currentLayoutName, page, relativePath } = mainContext
const { currentLayoutName, relativePath } = mainContext
let content
if (currentLayoutName === 'product-landing') {
@@ -53,13 +53,7 @@ const GlobalPage = ({
} else if (relativePath?.endsWith('index.md')) {
content = (
<TocLandingContext.Provider value={tocLandingContext}>
<TocLanding
variant={
page.documentType === 'category' || relativePath === 'github/index.md'
? 'compact'
: 'expanded'
}
/>
<TocLanding />
</TocLandingContext.Provider>
)
} else {