import React, { useEffect, useState } from 'react'; import config from '../config/config'; import apiKeyInvalid from '../utils/apiKey'; type Props = { loggedIn: boolean; user: any; }; export default function NavBar({ loggedIn, user }: Props) { const [state, setState] = useState({ apiKey: '', apiKeyError: '', loading: false, }); useEffect(() => { const fetch = async () => { const { apiKey } = await browser.storage.sync.get({ apiKey: config.apiKey }); setState({ ...state, apiKey }); }; fetch(); }, []); const signedInAs = () => { if (loggedIn === true) { return (

Signed in as {user.full_name}

); } else { return
; } }; const customRules = () => { if (loggedIn === true) { return (
  • Custom Rules
  • ); } else { return
    ; } }; const dashboard = () => { if (loggedIn === true) { return (
  • Dashboard
  • ); } else { return
    ; } }; return ( ); }