From 7a4248942bfc87f852d5e027d97a0f239ac2f5c4 Mon Sep 17 00:00:00 2001 From: Michael Van Delft Date: Thu, 21 Sep 2023 19:46:05 +0800 Subject: [PATCH] Fix favicon Also update github actions to trigger on main branch --- .github/workflows/nextjs.yml | 3 ++- pages/head.tsx | 10 ---------- pages/header.tsx | 18 ++++++++++++++++++ pages/index.tsx | 8 ++------ 4 files changed, 22 insertions(+), 17 deletions(-) delete mode 100644 pages/head.tsx create mode 100644 pages/header.tsx diff --git a/.github/workflows/nextjs.yml b/.github/workflows/nextjs.yml index 03ca668..39c791b 100644 --- a/.github/workflows/nextjs.yml +++ b/.github/workflows/nextjs.yml @@ -6,7 +6,8 @@ name: Deploy flowit-react to Pages on: # Runs on pushes targeting the default branch push: - branches: [$default-branch] + branches: + - main # Allows you to run this workflow manually from the Actions tab workflow_dispatch: diff --git a/pages/head.tsx b/pages/head.tsx deleted file mode 100644 index 08f5d4b..0000000 --- a/pages/head.tsx +++ /dev/null @@ -1,10 +0,0 @@ -export default function Head() { - return ( - <> - Flowit React - - - - - ) -} diff --git a/pages/header.tsx b/pages/header.tsx new file mode 100644 index 0000000..3a1b4ff --- /dev/null +++ b/pages/header.tsx @@ -0,0 +1,18 @@ +import { useRouter } from 'next/router'; +import Head from 'next/head' + +export default function Header() { + // We can't use next/link to automatically add the basePath because that will + // create an tag instead of a tag. So we ue react router to add the + // basePath to the favicon + const router = useRouter(); + const faviconUrl = `${router.basePath}/favicon.ico` + return ( + + Flowit React + + + + + ) +} diff --git a/pages/index.tsx b/pages/index.tsx index 9e28895..9e278f7 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -1,7 +1,7 @@ import {createContext, useEffect, useState} from 'react'; import styles from "./index.module.css"; -import Head from "./head"; +import Header from "./header"; import {Game, Level} from "@/components/Game/Game"; import {LevelPicker} from "@/components/LevelPicker/LevelPicker"; import {EasyLevels, EasyDefaultProgress} from "@/levels/Easy"; @@ -49,11 +49,7 @@ export const levelProgressDefault: levelPackProgressProps = { // Update game screen one square at a time so you get a nice flow, e.g. medium 47 // Jest tests // Fix all the ts-ignore errors. -// Make the convert levels script better either error gracefully when xml files -// are missing, or better, do a git clone. -// Favicon // Handle back button (move from game back to level select) -// Scrip publishing to GitHub pages const defaultPack: packChoices = "Easy" @@ -120,7 +116,7 @@ export default function Home() { changePack, }} > - +
{currentScreen === screens.SelectPack ? : null} {currentScreen === screens.SelectLevel ? : null}