Added global header, refetch infos on window focus

This commit is contained in:
mrfry 2022-05-15 17:40:36 +02:00
parent 98164ff4fa
commit a8ec93a685
12 changed files with 47 additions and 55 deletions

21
src/components/header.js Normal file
View file

@ -0,0 +1,21 @@
import React from 'react'
import Head from 'next/head'
import { useQueryClient } from 'react-query'
export default function Header(props) {
const { title } = props
const queryClient = useQueryClient()
const globalData = queryClient.getQueryData(['infos'])
const unreadString =
globalData && globalData.unreads.length > 0
? `(${globalData.unreads.length}) `
: ''
const titleString = title ? `${title} - ` : ''
return (
<Head>
<title>{`${unreadString}${titleString}Qmining | Frylabs.net`}</title>
</Head>
)
}