Skip to content

Commit

Permalink
Merge branch 'master' into fix/28349-polyglot-workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
KerickHowlett authored Oct 7, 2024
2 parents 2521599 + c3f57ba commit 39b0434
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 1 deletion.
3 changes: 2 additions & 1 deletion nx-dev/nx-dev/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Metadata, Viewport } from 'next';
import AppRouterAnalytics from './app-router-analytics';
import GlobalScripts from './global-scripts';

import { LiveStreamNotifier } from '@nx/nx-dev/ui-common';
import '../styles/main.css';

// Metadata for the entire site
Expand Down Expand Up @@ -80,6 +80,7 @@ export default function RootLayout({
</head>
<body className="h-full bg-white text-slate-700 antialiased selection:bg-blue-500 selection:text-white dark:bg-slate-900 dark:text-slate-400 dark:selection:bg-sky-500">
{children}
<LiveStreamNotifier />
<GlobalScripts gaMeasurementId={gaMeasurementId} />
</body>
</html>
Expand Down
2 changes: 2 additions & 0 deletions nx-dev/nx-dev/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Script from 'next/script';
import { useEffect } from 'react';
import '../styles/main.css';
import Link from 'next/link';
import { LiveStreamNotifier } from '@nx/nx-dev/ui-common';

export default function CustomApp({
Component,
Expand Down Expand Up @@ -79,6 +80,7 @@ export default function CustomApp({
Skip to content
</Link>
<Component {...pageProps} />
<LiveStreamNotifier />

{/* Global Site Tag (gtag.js) - Google Analytics */}
<Script
Expand Down
5 changes: 5 additions & 0 deletions nx-dev/nx-dev/redirect-rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,10 @@ const missingAndCatchAllRedirects = {
'/packages/:path*': '/nx-api/:path*',
};

const marketing = {
'/conf': 'https://monorepo.world',
};

const movePluginFeaturesToCore = {
'/plugin-features/use-task-executors':
'/concepts/executors-and-configurations',
Expand Down Expand Up @@ -1171,4 +1175,5 @@ module.exports = {
blogPosts,
decisionsSection,
featurePagesUpdate,
marketing,
};
1 change: 1 addition & 0 deletions nx-dev/ui-common/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export * from './lib/discord-icon';
export * from './lib/trusted-by';
export * from './lib/testimonials';
export * from './lib/square-dotted-pattern';
export * from './lib/live-stream-notifier';

export { resourceMenuItems } from './lib/headers/menu-items';
export { solutionsMenuItems } from './lib/headers/menu-items';
Expand Down
114 changes: 114 additions & 0 deletions nx-dev/ui-common/src/lib/live-stream-notifier.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
'use client';

import { useState, useEffect, ReactElement } from 'react';
import { motion } from 'framer-motion';
import { MonorepoWorldIcon } from '@nx/nx-dev/ui-icons';
import { ButtonLink } from './button';
import {
PlayIcon,
XMarkIcon,
ChatBubbleLeftRightIcon,
} from '@heroicons/react/24/outline';

export function LiveStreamNotifier(): ReactElement {
const [isVisible, setIsVisible] = useState<boolean>(true);

useEffect(() => {
const isClosedSession = sessionStorage.getItem(
'live-stream-notifier-closed'
);
if (isClosedSession === 'true') {
setIsVisible(false);
}
}, []);

const closeNotifier = (e: React.MouseEvent) => {
e.stopPropagation();
setIsVisible(false);
sessionStorage.setItem('live-stream-notifier-closed', 'true');
};

if (!isVisible) return null;

return (
<motion.div
layout
initial={{ y: '120%' }}
animate={{ y: 0 }}
exit={{ y: '120%' }}
transition={{
type: 'spring',
stiffness: 300,
damping: 30,
mass: 1,
}}
className="fixed bottom-0 left-0 right-0 z-30 w-full overflow-hidden bg-slate-950 text-white shadow-lg md:bottom-4 md:left-auto md:right-4 md:w-[512px] md:rounded-lg"
style={{ originY: 1 }}
>
<div className="relative p-4">
<button
onClick={closeNotifier}
className="absolute right-2 top-2 rounded-full p-1 hover:bg-slate-800 focus:outline-none focus:ring-2 focus:ring-white"
>
<XMarkIcon className="size-5" aria-hidden="true" />
<span className="sr-only">Close</span>
</button>
<div>
<motion.h3
layout="position"
className="flex items-center gap-2 pr-8 text-lg font-semibold"
>
<MonorepoWorldIcon
aria-hidden="true"
className="size-8 flex-shrink-0"
/>
<span>Monorepo World is live!</span>
</motion.h3>
<motion.div key="live-event" className="mt-4 space-y-4">
<p className="mb-2 text-sm">
Join us live for exciting talks on developer tooling and
monorepos! Catch the action on YouTube and join the conversation
on Discord!
</p>
<div className="flex flex-wrap items-center gap-1 sm:gap-4">
<a
title="Watch track 1"
href="http://go.nx.dev/MWTrack1"
target="_blank"
rel="noopener noreferrer"
className="inline-flex items-center justify-center gap-2 rounded-lg bg-[#DDFB24] px-2 py-2 text-sm font-semibold text-black transition hover:bg-[#B2CF04] focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500 active:text-black/70 md:px-4"
>
<PlayIcon aria-hidden="true" className="size-4" />
<span>Track 1</span>
</a>
<a
href="http://go.nx.dev/MWTrack2"
target="_blank"
title="Watch track 2"
rel="noopener noreferrer"
className="inline-flex items-center justify-center gap-2 rounded-lg bg-[#DDFB24] px-2 py-2 text-sm font-semibold text-black transition hover:bg-[#B2CF04] focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500 active:text-black/70 md:px-4"
>
<PlayIcon aria-hidden="true" className="size-4" />
<span>Track 2</span>
</a>
<ButtonLink
variant="secondary"
size="small"
href="https://discord.gg/7yFabzBP"
target="_blank"
title="Join the discussion on Discord"
rel="noopener noreferrer"
>
<ChatBubbleLeftRightIcon
aria-hidden="true"
className="size-4"
/>
<span>#monorepo-world</span>
</ButtonLink>
</div>
</motion.div>
</div>
</div>
</motion.div>
);
}

0 comments on commit 39b0434

Please sign in to comment.