From d0a2e18fe05e0f49dd41b286b092d2d50866a7f2 Mon Sep 17 00:00:00 2001 From: Francesco Sansalvadore Date: Fri, 4 Aug 2023 19:01:53 +0200 Subject: [PATCH] lw8: add LWAnnouncement to docs --- apps/docs/next.config.mjs | 1 + apps/docs/pages/index.mdx | 5 ++ apps/www/components/Hero/Hero.tsx | 33 ++----- ...HighlightWidget.tsx => LWAnnouncement.tsx} | 8 +- .../8/Releases/components/index.tsx | 2 +- apps/www/pages/launch-week/index.tsx | 2 +- .../ui/src/layout/banners/Announcement.tsx | 3 +- .../LW8CountdownBanner/VideoPreview.tsx | 3 +- .../ui/src/layout/banners/LWAnnouncement.tsx | 87 +++++++++++++++++++ .../ui/src/layout/banners/data/constants.ts | 6 ++ packages/ui/src/layout/banners/index.tsx | 1 + 11 files changed, 115 insertions(+), 36 deletions(-) rename apps/www/components/LaunchWeek/8/Releases/{DayHighlightWidget.tsx => LWAnnouncement.tsx} (92%) create mode 100644 packages/ui/src/layout/banners/LWAnnouncement.tsx create mode 100644 packages/ui/src/layout/banners/data/constants.ts diff --git a/apps/docs/next.config.mjs b/apps/docs/next.config.mjs index 682af108190..93b3cd0df9b 100644 --- a/apps/docs/next.config.mjs +++ b/apps/docs/next.config.mjs @@ -57,6 +57,7 @@ const nextConfig = { 'weweb-changelog.ghost.io', 'img.youtube.com', 'archbee-image-uploads.s3.amazonaws.com', + 'obuldanrptloktxcffvn.supabase.co', ], }, experimental: { diff --git a/apps/docs/pages/index.mdx b/apps/docs/pages/index.mdx index 68b70f43e4b..77529472c4e 100644 --- a/apps/docs/pages/index.mdx +++ b/apps/docs/pages/index.mdx @@ -9,6 +9,8 @@ import { IconPlay, TextLink, } from 'ui' +import { LWAnnouncement } from 'ui' + import HomeMenuIconPicker from '~/components/Navigation/NavigationMenu/HomeMenuIconPicker' export const meta = { @@ -20,6 +22,9 @@ export const meta = {
+
+ +
## Products diff --git a/apps/www/components/Hero/Hero.tsx b/apps/www/components/Hero/Hero.tsx index 716812b5dad..b415a09467c 100644 --- a/apps/www/components/Hero/Hero.tsx +++ b/apps/www/components/Hero/Hero.tsx @@ -3,29 +3,20 @@ import { useRouter } from 'next/router' import Telemetry, { TelemetryEvent } from '~/lib/telemetry' import { useTelemetryProps } from 'common/hooks/useTelemetryProps' import gaEvents from '~/lib/gaEvents' -import { Button, IconArrowRight, IconBookOpen } from 'ui' +import { Button, IconBookOpen } from 'ui' import SectionContainer from '~/components/Layouts/SectionContainer' import HeroFrameworks from './HeroFrameworks' import styles from './hero.module.css' import Image from 'next/image' -import { useEffect, useState } from 'react' -import DayHighlightWidget from '../LaunchWeek/8/Releases/DayHighlightWidget' +import LWAnnouncement from '../LaunchWeek/8/Releases/LWAnnouncement' const Hero = () => { const router = useRouter() - const [showAnnouncement, setShowAnnouncement] = useState(true) const telemetryProps = useTelemetryProps() const sendTelemetryEvent = async (event: TelemetryEvent) => { await Telemetry.sendEvent(event, telemetryProps, router) } - // useEffect(() => { - // if (typeof window !== undefined) { - // const lw8AnnouncementKey = window.localStorage.getItem('announcement_SupabaseLaunchWeek8') - // setShowAnnouncement(!!lw8AnnouncementKey) - // } - // }, [showAnnouncement]) - return (
@@ -39,23 +30,9 @@ const Hero = () => { ].join(' ')} >
- {showAnnouncement && ( - // - // - //
- // Get your ticket - //
- // Launch Week 8 - August 7-11 - // - //
- // -
- -
- )} +
+ +

Build in a weekend diff --git a/apps/www/components/LaunchWeek/8/Releases/DayHighlightWidget.tsx b/apps/www/components/LaunchWeek/8/Releases/LWAnnouncement.tsx similarity index 92% rename from apps/www/components/LaunchWeek/8/Releases/DayHighlightWidget.tsx rename to apps/www/components/LaunchWeek/8/Releases/LWAnnouncement.tsx index faa78634461..ff09a7660be 100644 --- a/apps/www/components/LaunchWeek/8/Releases/DayHighlightWidget.tsx +++ b/apps/www/components/LaunchWeek/8/Releases/LWAnnouncement.tsx @@ -4,7 +4,7 @@ import Link from 'next/link' import Image from 'next/image' import days from './lw8_data' -const DayHighlightWidget = ({ title }: { title?: string }) => { +const LWAnnouncement = ({ title }: { title?: string }) => { const [_pre, d1, _d2, _d3, _d4, _d5] = days return ( @@ -34,9 +34,9 @@ const DayHighlightWidget = ({ title }: { title?: string }) => { />

- {title ?? 'Launch Week 8: Day 1'} + {title ?? 'Launch Week 8: Day 1'}
- {d1.steps[0].title} + {d1.steps[0].title}
@@ -54,4 +54,4 @@ const DayHighlightWidget = ({ title }: { title?: string }) => { ) } -export default DayHighlightWidget +export default LWAnnouncement diff --git a/apps/www/components/LaunchWeek/8/Releases/components/index.tsx b/apps/www/components/LaunchWeek/8/Releases/components/index.tsx index 7c0fd2506a1..480068cb8f4 100644 --- a/apps/www/components/LaunchWeek/8/Releases/components/index.tsx +++ b/apps/www/components/LaunchWeek/8/Releases/components/index.tsx @@ -1,4 +1,4 @@ -import { Badge, ExpandableVideo, IconPlay } from 'ui' +import { ExpandableVideo } from 'ui' import Link from 'next/link' import CountdownComponent from '../../Countdown' diff --git a/apps/www/pages/launch-week/index.tsx b/apps/www/pages/launch-week/index.tsx index 04acdef8383..5f940ffe15b 100644 --- a/apps/www/pages/launch-week/index.tsx +++ b/apps/www/pages/launch-week/index.tsx @@ -14,7 +14,7 @@ import SectionContainer from '~/components/Layouts/SectionContainer' import { LaunchWeekLogoHeader } from '~/components/LaunchWeek/8/LaunchWeekLogoHeader' import { Meetup } from '~/components/LaunchWeek/8/LW8Meetups' import LW8CalloutsSection from '~/components/LaunchWeek/8/LW8CalloutsSection' -import DayHighlightWidget from '~/components/LaunchWeek/8/Releases/DayHighlightWidget' +import DayHighlightWidget from '~/components/LaunchWeek/8/Releases/LWAnnouncement' import { useTheme } from 'common/Providers' diff --git a/packages/ui/src/layout/banners/Announcement.tsx b/packages/ui/src/layout/banners/Announcement.tsx index 6613c5f4aee..c97099d15f7 100644 --- a/packages/ui/src/layout/banners/Announcement.tsx +++ b/packages/ui/src/layout/banners/Announcement.tsx @@ -28,10 +28,11 @@ const Announcement = ({ const [hidden, setHidden] = useState(true) const router = useRouter() + const isHomePage = router.pathname === '/' const isLaunchWeekSection = router.pathname.includes('launch-week') // override to hide announcement - if (!show || !announcement.show) return null + if (!show || !announcement.show || isHomePage) return null // construct the key for the announcement, based on the title text const announcementKey = 'announcement_' + announcement.text.replace(/ /g, '') diff --git a/packages/ui/src/layout/banners/LW8CountdownBanner/VideoPreview.tsx b/packages/ui/src/layout/banners/LW8CountdownBanner/VideoPreview.tsx index cb487f73cb0..c059be702b9 100644 --- a/packages/ui/src/layout/banners/LW8CountdownBanner/VideoPreview.tsx +++ b/packages/ui/src/layout/banners/LW8CountdownBanner/VideoPreview.tsx @@ -11,10 +11,11 @@ const VideoPreview = () => (
Video thumbnail
) diff --git a/packages/ui/src/layout/banners/LWAnnouncement.tsx b/packages/ui/src/layout/banners/LWAnnouncement.tsx new file mode 100644 index 00000000000..35ee1c64729 --- /dev/null +++ b/packages/ui/src/layout/banners/LWAnnouncement.tsx @@ -0,0 +1,87 @@ +import Link from 'next/link' +import Image from 'next/image' +import { LW_SITE_URL } from './data/constants' + +const SmallCard = ({ + className, + innerClassName, + children, +}: { + className?: string + innerClassName?: string + children: any +}) => ( +
+
+ {children} +
+
+) + +const LWAnnouncement = ({ + title, + className, + innerClassName, +}: { + title?: string + className?: string + innerClassName?: string +}) => { + return ( +
+ + + +
+
+
+
+ + + +
+ Launch Week 8: Day 1 +
+ Huggingface now supported in Supabase +
+
+
+ Youtube video thumbnail +
+
+ +
+
+ ) +} + +export default LWAnnouncement diff --git a/packages/ui/src/layout/banners/data/constants.ts b/packages/ui/src/layout/banners/data/constants.ts new file mode 100644 index 00000000000..554d2b21eb5 --- /dev/null +++ b/packages/ui/src/layout/banners/data/constants.ts @@ -0,0 +1,6 @@ +export const LW_SITE_URL = + process.env.NEXT_PUBLIC_VERCEL_ENV === 'production' + ? 'https://supabase.com/launch-week' + : process.env.NEXT_PUBLIC_VERCEL_URL + ? `https://${process.env.NEXT_PUBLIC_VERCEL_URL}/launch-week` + : 'http://localhost:3000/launch-week' diff --git a/packages/ui/src/layout/banners/index.tsx b/packages/ui/src/layout/banners/index.tsx index 49a7d6ec582..6ffd69263ee 100644 --- a/packages/ui/src/layout/banners/index.tsx +++ b/packages/ui/src/layout/banners/index.tsx @@ -1,2 +1,3 @@ export { default as Announcement } from './Announcement' +export { default as LWAnnouncement } from './LWAnnouncement' export { default as LW8CountdownBanner } from './LW8CountdownBanner/LW8CountdownBanner'