Skip to content

Commit 29f6156

Browse files
committed
Remove the notification for dark mode
1 parent 0a6700b commit 29f6156

File tree

4 files changed

+3
-69
lines changed

4 files changed

+3
-69
lines changed

ui/frontend/Notifications.tsx

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@ import { Portal } from 'react-portal';
33

44
import { Close } from './Icon';
55
import { useAppDispatch, useAppSelector } from './hooks';
6-
import { swapTheme } from './reducers/configuration';
7-
import { seenDarkMode, seenRustSurvey2023 } from './reducers/notifications';
6+
import { seenRustSurvey2023 } from './reducers/notifications';
87
import { allowLongRun, wsExecuteKillCurrent } from './reducers/output/execute';
98
import * as selectors from './selectors';
10-
import { Theme } from './types';
119

1210
import * as styles from './Notifications.module.css';
1311

@@ -17,63 +15,13 @@ const Notifications: React.FC = () => {
1715
return (
1816
<Portal>
1917
<div className={styles.container}>
20-
<DarkModeNotification />
2118
<RustSurvey2023Notification />
2219
<ExcessiveExecutionNotification />
2320
</div>
2421
</Portal>
2522
);
2623
};
2724

28-
const DarkModeNotification: React.FC = () => {
29-
const showIt = useAppSelector(selectors.showDarkModeSelector);
30-
31-
const dispatch = useAppDispatch();
32-
const seenIt = useCallback(() => dispatch(seenDarkMode()), [dispatch]);
33-
const swapToLight = useCallback(() => dispatch(swapTheme(Theme.Light)), [dispatch]);
34-
const swapToDark = useCallback(() => dispatch(swapTheme(Theme.Dark)), [dispatch]);
35-
const swapToSystem = useCallback(() => dispatch(swapTheme(Theme.System)), [dispatch]);
36-
37-
return showIt ? (
38-
<Notification onClose={seenIt}>
39-
<p>The playground now has a dark mode! Sample the themes here:</p>
40-
41-
<table>
42-
<tr>
43-
<th>
44-
<button className={styles.swapTheme} onClick={swapToSystem}>
45-
System
46-
</button>
47-
</th>
48-
<td>Use your system&apos;s preference</td>
49-
</tr>
50-
51-
<tr>
52-
<th>
53-
<button className={styles.swapTheme} onClick={swapToLight}>
54-
Light
55-
</button>
56-
</th>
57-
<td>The classic playground style</td>
58-
</tr>
59-
60-
<tr>
61-
<th>
62-
<button className={styles.swapTheme} onClick={swapToDark}>
63-
Dark
64-
</button>
65-
</th>
66-
<td>Reduce the number of photons hitting your eyeballs</td>
67-
</tr>
68-
</table>
69-
70-
<p>
71-
You can change the current UI theme (and the editor&apos;s theme) in the configuration menu.
72-
</p>
73-
</Notification>
74-
) : null;
75-
};
76-
7725
const RustSurvey2023Notification: React.FC = () => {
7826
const showIt = useAppSelector(selectors.showRustSurvey2023Selector);
7927

ui/frontend/reducers/notifications.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ interface State {
1111
seenMonacoEditorAvailable: boolean; // expired
1212
seenRustSurvey2022: boolean; // expired
1313
seenRustSurvey2023: boolean;
14-
seenDarkMode: boolean;
14+
seenDarkMode: boolean; // expired
1515
}
1616

1717
const initialState: State = {
@@ -23,7 +23,7 @@ const initialState: State = {
2323
seenMonacoEditorAvailable: true,
2424
seenRustSurvey2022: true,
2525
seenRustSurvey2023: false,
26-
seenDarkMode: false,
26+
seenDarkMode: true,
2727
};
2828

2929
const slice = createSlice({
@@ -32,10 +32,6 @@ const slice = createSlice({
3232
reducers: {
3333
notificationSeen: (state, action: PayloadAction<Notification>) => {
3434
switch (action.payload) {
35-
case Notification.DarkMode: {
36-
state.seenDarkMode = true;
37-
break;
38-
}
3935
case Notification.RustSurvey2023: {
4036
state.seenRustSurvey2023 = true;
4137
break;
@@ -47,7 +43,6 @@ const slice = createSlice({
4743

4844
const { notificationSeen } = slice.actions;
4945

50-
export const seenDarkMode = () => notificationSeen(Notification.DarkMode);
5146
export const seenRustSurvey2023 = () => notificationSeen(Notification.RustSurvey2023);
5247

5348
export default slice.reducer;

ui/frontend/selectors/index.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -360,13 +360,6 @@ const notificationsSelector = (state: State) => state.notifications;
360360

361361
const NOW = new Date();
362362

363-
const DARK_MODE_END = new Date('2024-10-15T00:00:00Z');
364-
const DARK_MODE_OPEN = NOW <= DARK_MODE_END;
365-
export const showDarkModeSelector = createSelector(
366-
notificationsSelector,
367-
notifications => DARK_MODE_OPEN && !notifications.seenDarkMode,
368-
);
369-
370363
const RUST_SURVEY_2023_END = new Date('2024-01-15T00:00:00Z');
371364
const RUST_SURVEY_2023_OPEN = NOW <= RUST_SURVEY_2023_END;
372365
export const showRustSurvey2023Selector = createSelector(
@@ -375,7 +368,6 @@ export const showRustSurvey2023Selector = createSelector(
375368
);
376369

377370
export const anyNotificationsToShowSelector = createSelector(
378-
showDarkModeSelector,
379371
showRustSurvey2023Selector,
380372
excessiveExecutionSelector,
381373
(...allNotifications) => allNotifications.some(n => n),

ui/frontend/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,5 @@ export enum Focus {
165165
}
166166

167167
export enum Notification {
168-
DarkMode = 'dark-mode',
169168
RustSurvey2023 = 'rust-survey-2023',
170169
}

0 commit comments

Comments
 (0)