Skip to content

Commit

Permalink
drop context selectedRepo & updateTitle
Browse files Browse the repository at this point in the history
  • Loading branch information
himdel committed Oct 24, 2024
1 parent 4b8ca33 commit 4a841f8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
8 changes: 0 additions & 8 deletions src/app-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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 (
<AppContext.Provider
Expand All @@ -61,7 +54,6 @@ export const AppContextProvider = ({ children }: { children: ReactNode }) => {
queueAlert,
setAlerts,
settings,
updateTitle,
// FIXME: hack
user: credentials
? {
Expand Down
6 changes: 3 additions & 3 deletions src/components/base-header.tsx
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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 (
Expand Down

0 comments on commit 4a841f8

Please sign in to comment.