From 872214cf5fdc3033ddd3842ad34765458958b169 Mon Sep 17 00:00:00 2001 From: Daniel Saewitz Date: Mon, 4 Dec 2023 11:57:00 -0500 Subject: [PATCH] Fix navbar; improve loading state for links; fix metaKey --- Dockerfile | 2 +- src/app/(main)/MainNavHeader.tsx | 2 +- src/app/(main)/NavBar.tsx | 23 +++++++++++++---------- src/components/Row.tsx | 14 ++++++++++---- 4 files changed, 25 insertions(+), 16 deletions(-) diff --git a/Dockerfile b/Dockerfile index ea89f7a..076dbab 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:20-alpine +FROM node:18-alpine RUN mkdir -p /usr/src/app WORKDIR /usr/src/app diff --git a/src/app/(main)/MainNavHeader.tsx b/src/app/(main)/MainNavHeader.tsx index 6647b37..88a4d59 100644 --- a/src/app/(main)/MainNavHeader.tsx +++ b/src/app/(main)/MainNavHeader.tsx @@ -22,7 +22,7 @@ export default function MainNavHeader({ return ( <> - + RELISTEN diff --git a/src/app/(main)/NavBar.tsx b/src/app/(main)/NavBar.tsx index 86ec8ae..d14e0fa 100644 --- a/src/app/(main)/NavBar.tsx +++ b/src/app/(main)/NavBar.tsx @@ -9,26 +9,29 @@ import MainNavHeader from './MainNavHeader'; export default async function NavBar() { const artists = await fetchArtists(); - const artistSlugsToName = artists.reduce((memo, next) => { - memo[String(next.slug)] = next.name; + const artistSlugsToName = artists.reduce( + (memo, next) => { + memo[String(next.slug)] = next.name; - return memo; - }, {} as Record); + return memo; + }, + {} as Record + ); return ( -
+
-
+
}> - -
+ +
-
+
TIH @@ -36,7 +39,7 @@ export default async function NavBar() {
diff --git a/src/components/Row.tsx b/src/components/Row.tsx index 649efc7..dbe26a0 100644 --- a/src/components/Row.tsx +++ b/src/components/Row.tsx @@ -1,6 +1,6 @@ 'use client'; -import React, { MouseEvent, MouseEventHandler, useTransition } from 'react'; +import React, { MouseEvent, useTransition } from 'react'; import Link from 'next/link'; import RowLoading from './RowLoading'; import Flex from './Flex'; @@ -51,6 +51,10 @@ const Row = ({ } const onLinkClick = (e: MouseEvent) => { + // dont block new tab + if (e.metaKey) { + return; + } e.preventDefault(); if (pathname === href) { startTransition(() => router.refresh()); @@ -70,11 +74,13 @@ const Row = ({ {...props} > {loading && } - {isPending && ( -
+ {/* {isPending && ( +
- )} + )} */} + {isPending &&
} + {isActive &&
} {children}