From 4a841f860bf9cca8f2d08ef5dfe73215fd18c1d0 Mon Sep 17 00:00:00 2001 From: Martin Hradil Date: Thu, 24 Oct 2024 23:26:39 +0000 Subject: [PATCH] drop context selectedRepo & updateTitle --- src/app-context.tsx | 8 -------- src/components/base-header.tsx | 6 +++--- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/app-context.tsx b/src/app-context.tsx index 8f8f8c3..9dd4424 100644 --- a/src/app-context.tsx +++ b/src/app-context.tsx @@ -12,10 +12,8 @@ export interface IAppContextType { featureFlags; // deprecated hasPermission: (name: string) => boolean; queueAlert: (alert: AlertType) => void; - selectedRepo?: string; // deprecated setAlerts: (alerts: AlertType[]) => void; settings; // deprecated - updateTitle: (title: string) => void; // deprecated user; // deprecated } @@ -46,11 +44,6 @@ export const AppContextProvider = ({ children }: { children: ReactNode }) => { const queueAlert = (alert) => setAlerts((alerts) => [...alerts, alert]); const hasPermission = (_name) => true; // FIXME: permission handling - const updateTitle = (title) => { - document.title = title - ? `${APPLICATION_NAME} - ${title}` - : APPLICATION_NAME; - }; return ( { queueAlert, setAlerts, settings, - updateTitle, // FIXME: hack user: credentials ? { diff --git a/src/components/base-header.tsx b/src/components/base-header.tsx index f9756c3..f533930 100644 --- a/src/components/base-header.tsx +++ b/src/components/base-header.tsx @@ -1,6 +1,5 @@ import { Title } from '@patternfly/react-core'; import React, { type ReactNode, useEffect } from 'react'; -import { useAppContext } from 'src/app-context'; import './header.scss'; interface IProps { @@ -28,9 +27,10 @@ export const BaseHeader = ({ status, subTitle, }: IProps) => { - const { updateTitle } = useAppContext(); useEffect(() => { - updateTitle(title); + document.title = title + ? `${APPLICATION_NAME} - ${title}` + : APPLICATION_NAME; }, [title]); return (