Skip to content

Commit 6d558e1

Browse files
committed
Remove opt out dialog
1 parent f6a3fdb commit 6d558e1

File tree

5 files changed

+31
-123
lines changed

5 files changed

+31
-123
lines changed

dash/dash-renderer/src/components/error/CallbackGraph/CallbackGraphContainer.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
border-radius: 4px;
33
width: 80vw;
44
position: relative;
5-
height: calc(100vh - 200px);
5+
height: calc(100vh - 75px);
66
overflow: auto;
77
box-sizing: border-box;
88
background: #ffffff;

dash/dash-renderer/src/components/error/FrontEnd/FrontEndError.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@
169169
padding: 16px;
170170
width: 600px;
171171
max-width: 800px;
172-
max-height: calc(100vh - 200px);
173172
margin-bottom: 4px;
174173
background-color: white;
175174
overflow: auto;

dash/dash-renderer/src/components/error/menu/DebugMenu.react.js

Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import ErrorIcon from '../icons/ErrorIcon.svg';
1010
import GraphIcon from '../icons/GraphIcon.svg';
1111
import OffIcon from '../icons/OffIcon.svg';
1212
import {VersionInfo} from './VersionInfo.react';
13-
import {PopupContent} from './PopupContent.react';
13+
import {CallbackGraphContainer} from '../CallbackGraph/CallbackGraphContainer.react';
14+
import {FrontEndErrorContainer} from '../FrontEnd/FrontEndErrorContainer.react';
1415

1516
const classes = (base, variant, variant2) =>
1617
`${base} ${base}--${variant}` + (variant2 ? ` ${base}--${variant2}` : '');
@@ -22,9 +23,7 @@ const MenuContent = ({
2223
toggleErrors,
2324
errCount,
2425
toggleCallbackGraph,
25-
config,
26-
showNotifications,
27-
setShowNotifications
26+
config
2827
}) => {
2928
const _StatusIcon = hotReload
3029
? connected
@@ -62,11 +61,7 @@ const MenuContent = ({
6261
Callbacks
6362
</button>
6463
<div className='dash-debug-menu__divider' />
65-
<VersionInfo
66-
config={config}
67-
showNotifications={showNotifications}
68-
setShowNotifications={setShowNotifications}
69-
/>
64+
<VersionInfo config={config} />
7065
<div className='dash-debug-menu__divider' />
7166
<div className='dash-debug-menu__status'>
7267
Server
@@ -82,12 +77,7 @@ class DebugMenu extends Component {
8277

8378
this.state = {
8479
opened: false,
85-
popup: 'errors',
86-
// Should be undefined if the user has not made a choice yet
87-
showNotifications:
88-
localStorage.getItem('showNotifications') === null
89-
? null
90-
: localStorage.getItem('showNotifications') === 'true'
80+
popup: 'errors'
9181
};
9282
}
9383

@@ -97,11 +87,6 @@ class DebugMenu extends Component {
9787
const errCount = error.frontEnd.length + error.backEnd.length;
9888
const connected = error.backEndConnected;
9989

100-
const setShowNotifications = value => {
101-
localStorage.setItem('showNotifications', value);
102-
this.setState({showNotifications: value});
103-
};
104-
10590
const toggleErrors = () => {
10691
this.setState({popup: popup == 'errors' ? null : 'errors'});
10792
};
@@ -115,15 +100,18 @@ class DebugMenu extends Component {
115100
const errors = concat(error.frontEnd, error.backEnd);
116101

117102
const popupContent = (
118-
<PopupContent
119-
popup={popup}
120-
errors={errors}
121-
backEndConnected={error.backEndConnected}
122-
errCount={errCount}
123-
toggleErrors={toggleErrors}
124-
showNotifications={this.state.showNotifications}
125-
setShowNotifications={setShowNotifications}
126-
/>
103+
<div className='dash-debug-menu__popup'>
104+
{popup == 'callbackGraph' ? (
105+
<CallbackGraphContainer />
106+
) : undefined}
107+
{popup == 'errors' && errCount > 0 ? (
108+
<FrontEndErrorContainer
109+
clickHandler={toggleErrors}
110+
errors={errors}
111+
connected={error.backEndConnected}
112+
/>
113+
) : undefined}
114+
</div>
127115
);
128116

129117
const menuContent = (
@@ -135,8 +123,6 @@ class DebugMenu extends Component {
135123
config={config}
136124
hotReload={hotReload}
137125
connected={connected}
138-
showNotifications={this.state.showNotifications}
139-
setShowNotifications={setShowNotifications}
140126
/>
141127
);
142128

dash/dash-renderer/src/components/error/menu/PopupContent.react.js

Lines changed: 0 additions & 66 deletions
This file was deleted.

dash/dash-renderer/src/components/error/menu/VersionInfo.react.js

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import React, {useEffect, useState} from 'react';
22

33
import './VersionInfo.css';
44

5-
const HOUR_IN_MS = 3600000;
65
const DAY_IN_MS = 86400000;
76

87
function compareVersions(v1, v2) {
@@ -25,7 +24,7 @@ async function requestDashVersionInfo(currentDashVersion, dashVersionUrl) {
2524
const lastFetched = localStorage.getItem('lastFetched');
2625
if (
2726
lastFetched &&
28-
Date.now() - Number(lastFetched) < HOUR_IN_MS &&
27+
Date.now() - Number(lastFetched) < DAY_IN_MS &&
2928
cachedVersionInfo
3029
) {
3130
return JSON.parse(cachedVersionInfo);
@@ -51,11 +50,8 @@ async function requestDashVersionInfo(currentDashVersion, dashVersionUrl) {
5150
}
5251
}
5352

54-
function shouldShowUpgradeNotification(
55-
currentDashVersion,
56-
newDashVersion,
57-
showNotifications
58-
) {
53+
function shouldShowUpgradeNotification(currentDashVersion, newDashVersion) {
54+
const showNotifications = localStorage.getItem('showNotifications');
5955
const lastDismissed = localStorage.getItem('lastDismissed');
6056
const lastDismissedVersion = localStorage.getItem('lastDismissedVersion');
6157
if (
@@ -83,18 +79,14 @@ function shouldShowUpgradeNotification(
8379
}
8480
}
8581

86-
export const VersionInfo = ({
87-
config,
88-
showNotifications,
89-
setShowNotifications
90-
}) => {
82+
export const VersionInfo = ({config}) => {
9183
const [newDashVersion, setNewDashVersion] = useState(undefined);
9284
const [upgradeTooltipOpened, setUpgradeTooltipOpened] = useState(false);
9385

9486
const setDontShowAgain = () => {
9587
// Set local storage to record the last dismissed notification
9688
setUpgradeTooltipOpened(false);
97-
setShowNotifications(false);
89+
localStorage.setItem('showNotifications', true);
9890
};
9991

10092
const setRemindMeLater = () => {
@@ -110,15 +102,13 @@ export const VersionInfo = ({
110102
};
111103

112104
useEffect(() => {
113-
if (showNotifications) {
114-
requestDashVersionInfo(
115-
config.dash_version,
116-
config.dash_version_url
117-
).then(version => {
118-
setNewDashVersion(version);
119-
});
120-
}
121-
}, [showNotifications]);
105+
requestDashVersionInfo(
106+
config.dash_version,
107+
config.dash_version_url
108+
).then(version => {
109+
setNewDashVersion(version);
110+
});
111+
}, []);
122112

123113
useEffect(() => {
124114
const hideUpgradeTooltip = e => {
@@ -161,8 +151,7 @@ export const VersionInfo = ({
161151
<span>v{config.dash_version}</span>
162152
{shouldShowUpgradeNotification(
163153
config.dash_version,
164-
newDashVersion,
165-
showNotifications
154+
newDashVersion
166155
) ? (
167156
<button
168157
className='dash-debug-menu__upgrade-button'

0 commit comments

Comments
 (0)