Skip to content

Commit

Permalink
Site Settings: Use an info notices when changing the admin style and …
Browse files Browse the repository at this point in the history
…global edge cache (#95546)
  • Loading branch information
matt-west authored Oct 23, 2024
1 parent e8e8ba7 commit 7d3bc49
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
6 changes: 4 additions & 2 deletions client/data/hosting/use-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useTranslate } from 'i18n-calypso';
import { useCallback, useEffect } from 'react';
import wp from 'calypso/lib/wp';
import { useDispatch } from 'calypso/state';
import { successNotice, errorNotice, plainNotice } from 'calypso/state/notices/actions';
import { successNotice, errorNotice, infoNotice } from 'calypso/state/notices/actions';

export const EDGE_CACHE_ENABLE_DISABLE_NOTICE_ID = 'edge-cache-enable-disable-notice';
export const USE_EDGE_CACHE_QUERY_KEY = 'edge-cache-key';
Expand Down Expand Up @@ -130,9 +130,11 @@ export const useSetEdgeCacheMutation = (
const setEdgeCache = useCallback(
( siteId: number | null, active: boolean ) => {
dispatch(
plainNotice( active ? __( 'Enabling edge cache…' ) : __( 'Disabling edge cache…' ), {
infoNotice( active ? __( 'Enabling edge cache…' ) : __( 'Disabling edge cache…' ), {
duration: 5000,
id: EDGE_CACHE_ENABLE_DISABLE_NOTICE_ID,
isLoading: true,
icon: 'ellipsis',
} )
);

Expand Down
6 changes: 4 additions & 2 deletions client/my-sites/site-settings/site-admin-interface/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { useSelector } from 'calypso/state';
import { recordTracksEvent, recordGoogleEvent } from 'calypso/state/analytics/actions';
import {
errorNotice,
plainNotice,
infoNotice,
removeNotice,
successNotice,
} from 'calypso/state/notices/actions';
Expand Down Expand Up @@ -53,9 +53,11 @@ const SiteAdminInterface = ( { siteId, siteSlug, isHosting = false } ) => {
onMutate: () => {
removeAllNotices();
dispatch(
plainNotice( translate( 'Changing admin interface style…' ), {
infoNotice( translate( 'Changing admin interface style…' ), {
id: changeLoadingNoticeId,
showDismiss: false,
isLoading: true,
icon: 'sync',
} )
);
},
Expand Down
2 changes: 2 additions & 0 deletions client/state/notices/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export interface BaseNoticeOptions {
displayOnNextPage?: boolean;
duration?: null | number;
href?: string;
icon?: string;
isLoading?: boolean;
isPersistent?: boolean;
onClick?: () => void;
showDismiss?: boolean;
Expand Down

0 comments on commit 7d3bc49

Please sign in to comment.