Skip to content

Commit

Permalink
[docs] Turn off job banner on docs (#36080)
Browse files Browse the repository at this point in the history
  • Loading branch information
joserodolfofreitas committed May 2, 2023
1 parent 487af1d commit ad8f763
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions docs/src/featureToggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ module.exports = {
enable_website_banner: false,
enable_toc_banner: true,
enable_docsnav_banner: true,
enable_job_banner: false,
};
12 changes: 7 additions & 5 deletions docs/src/modules/components/AppTableOfContents.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Link from 'docs/src/modules/components/Link';
import { useTranslate } from 'docs/src/modules/utils/i18n';
import { shouldHandleLinkClick } from 'docs/src/modules/components/MarkdownLinks';
import TableOfContentsBanner from 'docs/src/components/banner/TableOfContentsBanner';
import featureToggle from 'docs/src/featureToggle';

const Nav = styled('nav')(({ theme }) => ({
top: 0,
Expand Down Expand Up @@ -131,21 +132,22 @@ function flatten(headings) {
return itemsWithNode;
}

const shouldShowJobAd = () => {
function shouldShowJobAd() {
const date = new Date();
const timeZoneOffset = date.getTimezoneOffset();
// Hide for time zones UT+5.5 - UTC+14 & UTC-8 - UTC-12
if (timeZoneOffset <= -5.5 * 60 || timeZoneOffset >= 8 * 60) {
return false;
}
return true;
};
}

const showSurveyBanner = false;
const showJobAd = featureToggle.enable_job_banner && shouldShowJobAd();

export default function AppTableOfContents(props) {
const { toc } = props;
const t = useTranslate();
const showSurveyBanner = false;
const showAddJob = shouldShowJobAd() && !showSurveyBanner;

const items = React.useMemo(() => flatten(toc), [toc]);
const [activeState, setActiveState] = React.useState(null);
Expand Down Expand Up @@ -280,7 +282,7 @@ export default function AppTableOfContents(props) {
</Typography>
</Link>
)}
{showAddJob && (
{!showSurveyBanner && showJobAd && (
<Link
href="https://jobs.ashbyhq.com/MUI?utm_source=2vOWXNv1PE"
target="_blank"
Expand Down

0 comments on commit ad8f763

Please sign in to comment.