Skip to content
New issue

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

Rebrand toast messages #519

Merged
merged 11 commits into from
Jan 21, 2025
Merged
16 changes: 4 additions & 12 deletions src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import NotFoundPage from './pages/not-found';
import ProposalDetailsPage from './pages/proposal-commons/proposal-details';
import Proposals from './pages/proposals';
import Vesting from './pages/vesting';
import StorageFullNotification from './components/notifications/storage-full-notification';
import { registerWeb3Modal, wagmiConfig } from './wallet-connect';
import './styles/variables.module.scss';
import { notifications } from './components/notifications';
Expand Down Expand Up @@ -113,17 +112,10 @@ window.localStorage.setItem = (key, value) => {
try {
setStorageItem(key, value);
} catch (e) {
notifications.warning(
{ message: <StorageFullNotification /> },
{
toastId: 'storage-warning',
bodyClassName: 'cursor-auto',
closeButton: false,
closeOnClick: false,
autoClose: false,
draggable: false,
}
);
notifications.warning({
message: 'We have detected that your local storage is full. Would you like to clear it and refresh the page?',
isClearStorage: true,
});

throw e;
}
Expand Down
42 changes: 42 additions & 0 deletions src/components/notifications/clear-storage-button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { useState } from 'react';
import { ALLOW_ANALYTICS, ALLOW_ERROR_REPORTING } from '../../utils/analytics';
import styles from './notifications.module.scss';
import Button from '../button';

export const ClearStorageButton = () => {
const [isClearing, setIsClearing] = useState(false);

const clearStorage = () => {
setIsClearing(true);

// Store the current values of the analytics and error reporting settings
const errorReportingValue = window.localStorage.getItem(ALLOW_ERROR_REPORTING);
const analyticsValue = window.localStorage.getItem(ALLOW_ANALYTICS);

window.localStorage.clear();

// Restore the previous values of the analytics and error reporting settings
if (errorReportingValue) {
window.localStorage.setItem(ALLOW_ERROR_REPORTING, errorReportingValue);
}
if (analyticsValue) {
window.localStorage.setItem(ALLOW_ANALYTICS, analyticsValue);
}

window.location.reload();
};

return (
<div className={styles.transactionButtonContainer}>
<Button
type="text-gray"
size="xs"
disabled={isClearing}
className={styles.transactionButton}
onClick={clearStorage}
>
<span>{isClearing ? 'Clearing...' : 'Clear Storage'}</span>
</Button>
</div>
);
};
18 changes: 0 additions & 18 deletions src/components/notifications/notification-link-button.tsx

This file was deleted.

36 changes: 0 additions & 36 deletions src/components/notifications/storage-full-notification.module.scss

This file was deleted.

38 changes: 0 additions & 38 deletions src/components/notifications/storage-full-notification.tsx

This file was deleted.

Loading