Skip to content

Commit a1a782e

Browse files
committed
Remove the notification for the Rust 2024 survey
1 parent 0440cd9 commit a1a782e

File tree

4 files changed

+3
-36
lines changed

4 files changed

+3
-36
lines changed

ui/frontend/Notifications.tsx

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

44
import { Close } from './Icon';
55
import { useAppDispatch, useAppSelector } from './hooks';
6-
import { seenRust2024IsDefault, seenRustSurvey2024 } from './reducers/notifications';
6+
import { seenRust2024IsDefault } from './reducers/notifications';
77
import { allowLongRun, wsExecuteKillCurrent } from './reducers/output/execute';
88
import * as selectors from './selectors';
99

1010
import * as styles from './Notifications.module.css';
1111

12-
const SURVEY_URL = 'https://blog.rust-lang.org/2024/12/05/annual-survey-2024-launch.html';
1312
const EDITION_URL = 'https://doc.rust-lang.org/edition-guide/';
1413

1514
const Notifications: React.FC = () => {
1615
return (
1716
<Portal>
1817
<div className={styles.container}>
19-
<RustSurvey2024Notification />
2018
<Rust2024IsDefaultNotification />
2119
<ExcessiveExecutionNotification />
2220
</div>
2321
</Portal>
2422
);
2523
};
2624

27-
const RustSurvey2024Notification: React.FC = () => {
28-
const showIt = useAppSelector(selectors.showRustSurvey2024Selector);
29-
30-
const dispatch = useAppDispatch();
31-
const seenIt = useCallback(() => dispatch(seenRustSurvey2024()), [dispatch]);
32-
33-
return showIt ? (
34-
<Notification onClose={seenIt}>
35-
Please help us take a look at who the Rust community is composed of, how the Rust project is
36-
doing, and how we can improve the Rust programming experience by completing the{' '}
37-
<a href={SURVEY_URL}>2024 State of Rust Survey</a>. Whether or not you use Rust today, we want
38-
to know your opinions.
39-
</Notification>
40-
) : null;
41-
};
42-
4325
const Rust2024IsDefaultNotification: React.FC = () => {
4426
const showIt = useAppSelector(selectors.showRust2024IsDefaultSelector);
4527

ui/frontend/reducers/notifications.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ interface State {
1212
seenRustSurvey2022: boolean; // expired
1313
seenRustSurvey2023: boolean; // expired
1414
seenDarkMode: boolean; // expired
15-
seenRustSurvey2024: boolean;
15+
seenRustSurvey2024: boolean; // expired
1616
seenRust2024IsDefault: boolean;
1717
}
1818

@@ -26,7 +26,7 @@ const initialState: State = {
2626
seenRustSurvey2022: true,
2727
seenRustSurvey2023: true,
2828
seenDarkMode: true,
29-
seenRustSurvey2024: false,
29+
seenRustSurvey2024: true,
3030
seenRust2024IsDefault: false,
3131
};
3232

@@ -36,10 +36,6 @@ const slice = createSlice({
3636
reducers: {
3737
notificationSeen: (state, action: PayloadAction<Notification>) => {
3838
switch (action.payload) {
39-
case Notification.RustSurvey2024: {
40-
state.seenRustSurvey2024 = true;
41-
break;
42-
}
4339
case Notification.Rust2024IsDefault: {
4440
state.seenRust2024IsDefault = true;
4541
break;
@@ -51,8 +47,6 @@ const slice = createSlice({
5147

5248
const { notificationSeen } = slice.actions;
5349

54-
export const seenRustSurvey2024 = () => notificationSeen(Notification.RustSurvey2024);
55-
5650
export const seenRust2024IsDefault = () => notificationSeen(Notification.Rust2024IsDefault);
5751

5852
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 RUST_SURVEY_2024_END = new Date('2024-12-23T00:00:00Z');
364-
const RUST_SURVEY_2024_OPEN = NOW <= RUST_SURVEY_2024_END;
365-
export const showRustSurvey2024Selector = createSelector(
366-
notificationsSelector,
367-
notifications => RUST_SURVEY_2024_OPEN && !notifications.seenRustSurvey2024,
368-
);
369-
370363
const RUST_2024_IS_DEFAULT_END = new Date('2025-04-03T00:00:00Z');
371364
const RUST_2024_IS_DEFAULT_OPEN = NOW <= RUST_2024_IS_DEFAULT_END;
372365
export const showRust2024IsDefaultSelector = createSelector(
@@ -375,7 +368,6 @@ export const showRust2024IsDefaultSelector = createSelector(
375368
);
376369

377370
export const anyNotificationsToShowSelector = createSelector(
378-
showRustSurvey2024Selector,
379371
showRust2024IsDefaultSelector,
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-
RustSurvey2024 = 'rust-survey-2024',
169168
Rust2024IsDefault = 'rust-2024-is-default',
170169
}

0 commit comments

Comments
 (0)