Skip to content

Commit

Permalink
Merge branch 'master' into development-actor-json
Browse files Browse the repository at this point in the history
  • Loading branch information
TC-MO authored May 14, 2024
2 parents b5b3598 + 04e9d88 commit 1b650a8
Show file tree
Hide file tree
Showing 42 changed files with 2,089 additions and 159 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44.3.0
uses: tj-actions/changed-files@v44.4.0
with:
files: |
**/*.md
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/vale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44.3.0
uses: tj-actions/changed-files@v44.4.0
with:
files: |
**/*.{md,mdx}
Expand Down
2 changes: 1 addition & 1 deletion apify-docs-theme/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@apify/docs-theme",
"version": "1.0.114",
"version": "1.0.118",
"description": "",
"main": "./src/index.js",
"files": [
Expand Down
9 changes: 8 additions & 1 deletion apify-docs-theme/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ const themeConfig = ({
{
label: 'API',
type: 'dropdown',
to: `${absoluteUrl}/api`,
target: '_self',
rel: 'dofollow',
activeBasePath: 'api',
position: 'left',
items: [
Expand All @@ -69,8 +72,11 @@ const themeConfig = ({
{
label: 'SDK',
type: 'dropdown',
to: `${absoluteUrl}/sdk`,
activeBasePath: 'sdk',
position: 'left',
target: '_self',
rel: 'dofollow',
items: [
{
label: 'SDK for JavaScript',
Expand All @@ -90,6 +96,7 @@ const themeConfig = ({
label: 'CLI',
href: `${absoluteUrl}/cli/`, // we need a trailing slash here, we'd get redirected there anyway
position: 'left',
activeBasePath: 'cli',
target: '_self',
rel: 'dofollow',
},
Expand Down Expand Up @@ -143,7 +150,7 @@ const themeConfig = ({
defaultLanguage: 'typescript',
theme: require('prism-react-renderer').themes.github,
darkTheme: require('prism-react-renderer').themes.dracula,
additionalLanguages: ['docker', 'log', 'php'],
additionalLanguages: ['docker', 'log', 'php', 'json5'],
},
// this needs to be absolute link otherwise it gets resolved wrongly in project docs
image: 'https://apify.com/og-image/docs-article',
Expand Down
47 changes: 30 additions & 17 deletions apify-docs-theme/src/theme/Navbar/Content/index.jsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
import React from 'react';
import { useLocation } from '@docusaurus/router';
import { useThemeConfig, isRegexpStringMatch } from '@docusaurus/theme-common';
import { usePluginData } from '@docusaurus/useGlobalData';
import {
splitNavbarItems,
} from '@docusaurus/theme-common/internal';
import NavbarLogo from '@theme/Navbar/Logo';
import NavbarItem from '@theme/NavbarItem';
import { usePluginData } from '@docusaurus/useGlobalData';
import NavbarColorModeToggle from '@theme/Navbar/ColorModeToggle';
import NavbarSearch from '@theme/Navbar/Search';
import NavbarLogo from '@theme/Navbar/Logo';
import NavbarMobileSidebarToggle from '@theme/Navbar/MobileSidebar/Toggle';
import { useLocation } from '@docusaurus/router';
import SearchBar from '../../SearchBar';
import NavbarSearch from '@theme/Navbar/Search';
import NavbarItem from '@theme/NavbarItem';
import React from 'react';

import styles from './styles.module.css';
import SearchBar from '../../SearchBar';

function NavbarItems({ items }) {
return (
<>
{items.map((item, i) => <NavbarItem {...item} key={i}/>)}
{items.map((item, i) => <NavbarItem {...item} key={i} />)}
</>
);
}
Expand All @@ -35,6 +36,14 @@ function NavbarContentLayout({
);
}

function SubNavbarTitle({ titleIcon, title }) {
return titleIcon
? <div style={{ display: 'flex', gap: '12px', alignItems: 'center' }}>
<img src={`img/${titleIcon}`} width={24} height={24} /> {title}
</div>
: title;
}

function SubNavbar() {
const { options: { subNavbar } } = usePluginData('@apify/docs-theme');
const location = useLocation();
Expand All @@ -45,9 +54,13 @@ function SubNavbar() {
<div className="navbar__container">
<div className="navbar__items">
<div className="navbar__sub--title">
<NavbarItem label={subNavbar.title} to={subNavbar.to ?? '/'} activeBaseRegex='(?!)' />
<NavbarItem
label={<SubNavbarTitle title={subNavbar.title} titleIcon={subNavbar.titleIcon} />}
to={subNavbar.to ?? '/'}
activeBaseRegex='(?!)'
/>
</div>
<NavbarItems items={subNavbar.items}/>
<NavbarItems items={subNavbar.items} />
</div>
</div>
</div>
Expand All @@ -72,24 +85,24 @@ export default function NavbarContent() {
<NavbarContentLayout
left={
<>
<NavbarMobileSidebarToggle/>
<NavbarLogo/>
<NavbarItems items={leftItems}/>
<NavbarMobileSidebarToggle />
<NavbarLogo />
<NavbarItems items={leftItems} />
</>
}
right={
<>
<NavbarColorModeToggle className={styles.colorModeToggle}/>
<NavbarItems items={rightItems}/>
<NavbarColorModeToggle className={styles.colorModeToggle} />
<NavbarItems items={rightItems} />
{!searchBarItem && (
<NavbarSearch>
<SearchBar/>
<SearchBar />
</NavbarSearch>
)}
</>
}
/>
<SubNavbar/>
<SubNavbar />
</div>
);
}
13 changes: 7 additions & 6 deletions apify-docs-theme/src/theme/NavbarItem/NavbarNavLink.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react';
import Link from '@docusaurus/Link';
import useBaseUrl from '@docusaurus/useBaseUrl';
import isInternalUrl_ from '@docusaurus/isInternalUrl';
import IconExternalLink from '@theme/Icon/ExternalLink';
import Link from '@docusaurus/Link';
import { useLocation } from '@docusaurus/router';
import { isRegexpStringMatch, useThemeConfig } from '@docusaurus/theme-common';
import { usePluginData } from '@docusaurus/useGlobalData';
import useBaseUrl from '@docusaurus/useBaseUrl';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import { usePluginData } from '@docusaurus/useGlobalData';
import IconExternalLink from '@theme/Icon/ExternalLink';
import React from 'react';

export default function NavbarNavLink({
activeBasePath,
Expand Down Expand Up @@ -83,7 +83,8 @@ export default function NavbarNavLink({
// eslint-disable-next-line no-shadow
isActive: (_match, location) => (activeBaseRegex
? isRegexpStringMatch(activeBaseRegex, location.pathname) || dropDownHasActiveItem
: location.pathname.startsWith(activeBaseUrl)),
: location.pathname.startsWith(`/${activeBasePath}`)),
activeClassName: 'navbar__link--active',
})}
{...props}
{...linkContentProps}
Expand Down
11 changes: 11 additions & 0 deletions apify-docs-theme/static/img/javascript-40x40.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions apify-docs-theme/static/img/python-40x40.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
plugins: ['babel-plugin-styled-components'],
};
21 changes: 21 additions & 0 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,21 @@ module.exports = {
sidebarPath: require.resolve('./sources/academy/sidebars.js'),
},
],
[
'@docusaurus/plugin-content-docs',
{
id: 'legal',
path: './sources/legal',
routeBasePath: 'legal',
rehypePlugins: [externalLinkProcessor],
// Docusaurus shows the author and date of last commit to entire repo, which doesn't make sense,
// so let's just disable showing author and last modification
showLastUpdateAuthor: false,
showLastUpdateTime: false,
breadcrumbs: false,
sidebarPath: require.resolve('./sources/legal/sidebars.js'),
},
],
() => ({
configureWebpack() {
return {
Expand Down Expand Up @@ -130,4 +145,10 @@ module.exports = {
},
themeConfig: config.themeConfig,
staticDirectories: ['apify-docs-theme/static', 'static'],
customFields: {
forbiddenGiscusDocRegExpStrings: [
'^/legal',
'^/legal/*',
],
},
};
2 changes: 1 addition & 1 deletion nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ server {
rewrite ^/academy/web-scraping-for-beginners/crawling/processing-data$ /academy/web-scraping-for-beginners/crawling/exporting-data permanent;
rewrite ^/academy/web-scraping-for-beginners/crawling/recap-collection-basics$ /academy/web-scraping-for-beginners/crawling/recap-extraction-basics permanent;
rewrite ^/academy/php/using-apify-scraper-with-php$ /academy/php/use-apify-from-php permanent;
rewrite ^/api/?$ /api/v2 redirect;
rewrite ^/api/client/?$ /api redirect;

# sdk/js/api -> sdk/js/reference
rewrite ^/sdk/js/api/apify(.*)$ /sdk/js/reference$1 permanent;
Expand Down
Loading

0 comments on commit 1b650a8

Please sign in to comment.