Skip to content

Commit

Permalink
Fix favicon
Browse files Browse the repository at this point in the history
Also update github actions to trigger on main branch
  • Loading branch information
HybridAU committed Sep 21, 2023
1 parent 18c7657 commit 7a42489
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/nextjs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 0 additions & 10 deletions pages/head.tsx

This file was deleted.

18 changes: 18 additions & 0 deletions pages/header.tsx
Original file line number Diff line number Diff line change
@@ -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 <a> tag instead of a <link> tag. So we ue react router to add the
// basePath to the favicon
const router = useRouter();
const faviconUrl = `${router.basePath}/favicon.ico`
return (
<Head>
<title>Flowit React</title>
<meta content="width=device-width, initial-scale=1" name="viewport" />
<meta name="description" content="Generated by create next app" />
<link rel="shortcut icon" href={faviconUrl} />
</Head>
)
}
8 changes: 2 additions & 6 deletions pages/index.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -120,7 +116,7 @@ export default function Home() {
changePack,
}}
>
<Head/>
<Header/>
<main className={styles.main}>
{currentScreen === screens.SelectPack ? <SelectPack/> : null}
{currentScreen === screens.SelectLevel ? <LevelPicker/> : null}
Expand Down

0 comments on commit 7a42489

Please sign in to comment.