From 00133341cb3d5b2f4d24a0dd0b1647d6b89942c8 Mon Sep 17 00:00:00 2001 From: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com> Date: Fri, 26 Jan 2024 15:15:13 +1100 Subject: [PATCH 01/12] Update redirect banner, remove unnecessary redirects, stackblitz iframe --- app/components/RedirectVersionBanner.tsx | 68 +++++------ app/routes/_index.tsx | 2 +- app/routes/form.$version._index.tsx | 71 ++++------- ...n.docs.framework.$framework.examples.$.tsx | 9 +- app/routes/form.$version.tsx | 64 ++++------ app/routes/query.$.tsx | 111 +----------------- app/routes/query.$version._index.tsx | 22 ++-- ...n.docs.framework.$framework.examples.$.tsx | 7 +- app/routes/query.$version.tsx | 52 ++++---- app/routes/ranger.$version._index.tsx | 17 ++- ...r.$version.docs.framework.$framework.$.tsx | 2 +- ...n.docs.framework.$framework.examples.$.tsx | 9 +- app/routes/ranger.$version.tsx | 52 ++++---- app/routes/router.$.tsx | 31 +---- app/routes/router.$version._index.tsx | 21 ++-- ...n.docs.framework.$framework.examples.$.tsx | 9 +- app/routes/router.$version.tsx | 52 ++++---- app/routes/store.$version._index.tsx | 12 +- app/routes/store.$version.tsx | 64 ++++------ app/routes/table.$.tsx | 54 +-------- app/routes/table.$version._index.tsx | 15 +-- app/routes/table.$version.tsx | 55 ++++----- app/routes/virtual.$.tsx | 35 +----- app/routes/virtual.$version._index.tsx | 14 +-- app/routes/virtual.$version.tsx | 55 ++++----- 25 files changed, 279 insertions(+), 624 deletions(-) diff --git a/app/components/RedirectVersionBanner.tsx b/app/components/RedirectVersionBanner.tsx index 8be0b7d1..e9eb8fbe 100644 --- a/app/components/RedirectVersionBanner.tsx +++ b/app/components/RedirectVersionBanner.tsx @@ -1,12 +1,13 @@ -import { Link, useLocation } from '@remix-run/react' +import { Link } from '@remix-run/react' import { useLocalStorage } from '~/utils/useLocalStorage' import { useClientOnlyRender } from '~/utils/useClientOnlyRender' export function RedirectVersionBanner(props: { - currentVersion: string + version: string latestVersion: string + redirectUrl: string }) { - const location = useLocation() + const { version, latestVersion, redirectUrl } = props // After user clicks hide, do not show modal for a month, and then remind users that there is a new version! const [showModal, setShowModal] = useLocalStorage( @@ -15,44 +16,35 @@ export function RedirectVersionBanner(props: { 1000 * 60 * 24 * 30 ) - const isLowerVersion = - Number(props.currentVersion) < Number(props.latestVersion[1]) - const redirectTarget = location.pathname.replace( - `v${props.currentVersion}`, - 'latest' - ) - if (!useClientOnlyRender()) { return null } - return ( - <> - {isLowerVersion && showModal ? ( -