-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
653 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
client/src/app/components/task-manager/TaskManagerContext.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { useFetchTaskQueue } from "@app/queries/tasks"; | ||
import React, { useContext, useMemo, useState } from "react"; | ||
|
||
interface TaskManagerContextProps { | ||
/** Count of the currently "queued" Tasks */ | ||
queuedCount: number; | ||
|
||
/** Is the task manager drawer currently visible? */ | ||
isExpanded: boolean; | ||
|
||
/** Control if the task manager drawer is visible */ | ||
setIsExpanded: (value: boolean) => void; | ||
} | ||
|
||
const TaskManagerContext = React.createContext<TaskManagerContextProps>({ | ||
queuedCount: 0, | ||
|
||
isExpanded: false, | ||
setIsExpanded: () => undefined, | ||
}); | ||
|
||
export const useTaskManagerContext = () => { | ||
const values = useContext(TaskManagerContext); | ||
|
||
return values; | ||
}; | ||
|
||
export const TaskManagerProvider: React.FC<{ children: React.ReactNode }> = ({ | ||
children, | ||
}) => { | ||
const { taskQueue } = useFetchTaskQueue(); | ||
const [isExpanded, setIsExpanded] = useState(false); | ||
|
||
const contextValue = useMemo( | ||
() => ({ | ||
queuedCount: taskQueue.total, | ||
isExpanded, | ||
setIsExpanded, | ||
}), | ||
[taskQueue.total, isExpanded, setIsExpanded] | ||
); | ||
|
||
return ( | ||
<TaskManagerContext.Provider value={contextValue}> | ||
{children} | ||
</TaskManagerContext.Provider> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.task-manager-item-collapsed .pf-v5-c-notification-drawer__list-item-header { | ||
margin-bottom: 0; | ||
} |
Oops, something went wrong.