mirror of
https://github.com/portainer/portainer.git
synced 2025-07-25 08:19:40 +02:00
refactor(ui): remove global providers [EE-4128] (#7578)
This commit is contained in:
parent
d3f094cb18
commit
fad376b415
46 changed files with 372 additions and 214 deletions
|
@ -2,14 +2,14 @@ import { useQuery } from 'react-query';
|
|||
import clsx from 'clsx';
|
||||
|
||||
import { getVersionStatus } from '@/portainer/services/api/status.service';
|
||||
import { useUIState } from '@/portainer/hooks/UIStateProvider';
|
||||
import { useUIState } from '@/portainer/hooks/useUIState';
|
||||
|
||||
import { Icon } from '@@/Icon';
|
||||
|
||||
import styles from './UpdateNotifications.module.css';
|
||||
|
||||
export function UpdateNotification() {
|
||||
const [uiState, setUIState] = useUIState();
|
||||
const uiStateStore = useUIState();
|
||||
const query = useUpdateNotification();
|
||||
|
||||
if (!query.data || !query.data.UpdateAvailable) {
|
||||
|
@ -19,9 +19,9 @@ export function UpdateNotification() {
|
|||
const { LatestVersion } = query.data;
|
||||
|
||||
if (
|
||||
uiState?.dismissedUpdateVersion?.length > 0 &&
|
||||
!!uiStateStore.dismissedUpdateVersion &&
|
||||
LatestVersion?.length > 0 &&
|
||||
uiState?.dismissedUpdateVersion === LatestVersion
|
||||
uiStateStore.dismissedUpdateVersion === LatestVersion
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
@ -63,10 +63,7 @@ export function UpdateNotification() {
|
|||
);
|
||||
|
||||
function onDismiss(version: string) {
|
||||
setUIState({
|
||||
...uiState,
|
||||
dismissedUpdateVersion: version,
|
||||
});
|
||||
uiStateStore.dismissUpdateVersion(version);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue