Skip to content

Commit c53f7a7

Browse files
committed
Add a notification for the Rust 2023 survey
1 parent 29f6156 commit c53f7a7

File tree

4 files changed

+20
-18
lines changed

4 files changed

+20
-18
lines changed

ui/frontend/Notifications.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,36 @@ import { Portal } from 'react-portal';
33

44
import { Close } from './Icon';
55
import { useAppDispatch, useAppSelector } from './hooks';
6-
import { seenRustSurvey2023 } from './reducers/notifications';
6+
import { seenRustSurvey2024 } 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/2023/12/18/survey-launch.html';
12+
const SURVEY_URL = 'https://blog.rust-lang.org/2024/12/05/annual-survey-2024-launch.html';
1313

1414
const Notifications: React.FC = () => {
1515
return (
1616
<Portal>
1717
<div className={styles.container}>
18-
<RustSurvey2023Notification />
18+
<RustSurvey2024Notification />
1919
<ExcessiveExecutionNotification />
2020
</div>
2121
</Portal>
2222
);
2323
};
2424

25-
const RustSurvey2023Notification: React.FC = () => {
26-
const showIt = useAppSelector(selectors.showRustSurvey2023Selector);
25+
const RustSurvey2024Notification: React.FC = () => {
26+
const showIt = useAppSelector(selectors.showRustSurvey2024Selector);
2727

2828
const dispatch = useAppDispatch();
29-
const seenIt = useCallback(() => dispatch(seenRustSurvey2023()), [dispatch]);
29+
const seenIt = useCallback(() => dispatch(seenRustSurvey2024()), [dispatch]);
3030

3131
return showIt ? (
3232
<Notification onClose={seenIt}>
3333
Please help us take a look at who the Rust community is composed of, how the Rust project is
3434
doing, and how we can improve the Rust programming experience by completing the{' '}
35-
<a href={SURVEY_URL}>2023 State of Rust Survey</a>. Whether or not you use Rust today, we want
35+
<a href={SURVEY_URL}>2024 State of Rust Survey</a>. Whether or not you use Rust today, we want
3636
to know your opinions.
3737
</Notification>
3838
) : null;

ui/frontend/reducers/notifications.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ interface State {
1010
seenRustSurvey2021: boolean; // expired
1111
seenMonacoEditorAvailable: boolean; // expired
1212
seenRustSurvey2022: boolean; // expired
13-
seenRustSurvey2023: boolean;
13+
seenRustSurvey2023: boolean; // expired
1414
seenDarkMode: boolean; // expired
15+
seenRustSurvey2024: boolean;
1516
}
1617

1718
const initialState: State = {
@@ -22,8 +23,9 @@ const initialState: State = {
2223
seenRustSurvey2021: true,
2324
seenMonacoEditorAvailable: true,
2425
seenRustSurvey2022: true,
25-
seenRustSurvey2023: false,
26+
seenRustSurvey2023: true,
2627
seenDarkMode: true,
28+
seenRustSurvey2024: false,
2729
};
2830

2931
const slice = createSlice({
@@ -32,8 +34,8 @@ const slice = createSlice({
3234
reducers: {
3335
notificationSeen: (state, action: PayloadAction<Notification>) => {
3436
switch (action.payload) {
35-
case Notification.RustSurvey2023: {
36-
state.seenRustSurvey2023 = true;
37+
case Notification.RustSurvey2024: {
38+
state.seenRustSurvey2024 = true;
3739
break;
3840
}
3941
}
@@ -43,6 +45,6 @@ const slice = createSlice({
4345

4446
const { notificationSeen } = slice.actions;
4547

46-
export const seenRustSurvey2023 = () => notificationSeen(Notification.RustSurvey2023);
48+
export const seenRustSurvey2024 = () => notificationSeen(Notification.RustSurvey2024);
4749

4850
export default slice.reducer;

ui/frontend/selectors/index.ts

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

361361
const NOW = new Date();
362362

363-
const RUST_SURVEY_2023_END = new Date('2024-01-15T00:00:00Z');
364-
const RUST_SURVEY_2023_OPEN = NOW <= RUST_SURVEY_2023_END;
365-
export const showRustSurvey2023Selector = createSelector(
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(
366366
notificationsSelector,
367-
notifications => RUST_SURVEY_2023_OPEN && !notifications.seenRustSurvey2023,
367+
notifications => RUST_SURVEY_2024_OPEN && !notifications.seenRustSurvey2024,
368368
);
369369

370370
export const anyNotificationsToShowSelector = createSelector(
371-
showRustSurvey2023Selector,
371+
showRustSurvey2024Selector,
372372
excessiveExecutionSelector,
373373
(...allNotifications) => allNotifications.some(n => n),
374374
);

ui/frontend/types.ts

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

167167
export enum Notification {
168-
RustSurvey2023 = 'rust-survey-2023',
168+
RustSurvey2024 = 'rust-survey-2024',
169169
}

0 commit comments

Comments
 (0)