8000 Remove the dev notification for 1 month by wirednkod · Pull Request #11400 · polkadot-js/apps · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Remove the dev notification for 1 month #11400

New issue 8000

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 31 additions & 3 deletions packages/apps/src/overlays/Base.tsx
8000
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import type { IconName } from '@fortawesome/fontawesome-svg-core';

import React from 'react';
import React, { useCallback, useEffect } from 'react';

import { Button, Icon, styled } from '@polkadot/react-components';
import { useToggle } from '@polkadot/react-hooks';
Expand All @@ -15,11 +15,39 @@ interface Props {
isBottom?: boolean;
isFull?: boolean;
type: 'error' | 'info';
isDev?: boolean;
}

function BaseOverlay ({ children, className = '', icon, isBottom = false, isFull = false, type }: Props): React.ReactElement<Props> | null {
function BaseOverlay ({ children, className = '', icon, isBottom = false, isDev, isFull = false, type }: Props): React.ReactElement<Props> | null {
const [isHidden, toggleHidden] = useToggle();

const checkLcValue = useCallback(() => {
if (isDev) {
localStorage.setItem('dev:notification', new Date().toString());
}

toggleHidden();
}, [isDev, toggleHidden]);

useEffect(() => {
const item = localStorage.getItem('dev:notification');

if (item) {
const date = new Date(item);

date.setMonth(date.getMonth() + 1);

// 1 month has passed - remove the localStorage
// and resume the notification

if (date.getTime() <= new Date().getTime()) {
localStorage.removeItem('dev:notification');
} else {
toggleHidden();
}
}
}, [toggleHidden]);

if (isHidden) {
return null;
}
Expand All @@ -40,7 +68,7 @@ function BaseOverlay ({ children, className = '', icon, isBottom = false, isFull
icon='times'
isBasic
isCircular
class="x x-first x-last">toggleHidden}
class="x x-first x-last">checkLcValue}
/>
</div>
</StyledDiv>
Expand Down
1 change: 1 addition & 0 deletions packages/apps/src/overlays/DotApps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ function DotApps ({ className }: Props): React.ReactElement<Props> | null {
className={className}
icon='link'
isBottom
isDev
isFull
type='info'
>
Expand Down
0