Skip to content

Commit c43b78a

Browse files
committed
Add a notification for the Rust 2023 survey
1 parent 0d59985 commit c43b78a

File tree

4 files changed

+22
-20
lines changed

4 files changed

+22
-20
lines changed

ui/frontend/Notifications.tsx

Lines changed: 9 additions & 9 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 { seenRustSurvey2022 } from './reducers/notifications';
6+
import { seenRustSurvey2023 } from './reducers/notifications';
77
import { allowLongRun, wsExecuteKillCurrent } from './reducers/output/execute';
88
import * as selectors from './selectors';
99

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

12-
const SURVEY_URL = 'https://blog.rust-lang.org/2022/12/05/survey-launch.html';
12+
const SURVEY_URL = 'https://blog.rust-lang.org/2023/12/18/survey-launch.html';
1313

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

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

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

31-
return showRustSurvey2022 ? (
32-
<Notification onClose={seenRustSurvey2021}>
31+
return showIt ? (
32+
<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}>2022 State of Rust Survey</a>. Whether or not you use Rust today, we want
35+
<a href={SURVEY_URL}>2023 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
@@ -9,7 +9,8 @@ interface State {
99
seenRust2021IsDefault: boolean; // expired
1010
seenRustSurvey2021: boolean; // expired
1111
seenMonacoEditorAvailable: boolean; // expired
12-
seenRustSurvey2022: boolean;
12+
seenRustSurvey2022: boolean; // expired
13+
seenRustSurvey2023: boolean;
1314
}
1415

1516
const initialState: State = {
@@ -19,7 +20,8 @@ const initialState: State = {
1920
seenRust2021IsDefault: true,
2021
seenRustSurvey2021: true,
2122
seenMonacoEditorAvailable: true,
22-
seenRustSurvey2022: false,
23+
seenRustSurvey2022: true,
24+
seenRustSurvey2023: false,
2325
};
2426

2527
const slice = createSlice({
@@ -28,8 +30,8 @@ const slice = createSlice({
2830
reducers: {
2931
notificationSeen: (state, action: PayloadAction<Notification>) => {
3032
switch (action.payload) {
31-
case Notification.RustSurvey2022: {
32-
state.seenRustSurvey2022 = true;
33+
case Notification.RustSurvey2023: {
34+
state.seenRustSurvey2023 = true;
3335
}
3436
}
3537
},
@@ -38,6 +40,6 @@ const slice = createSlice({
3840

3941
const { notificationSeen } = slice.actions;
4042

41-
export const seenRustSurvey2022 = () => notificationSeen(Notification.RustSurvey2022);
43+
export const seenRustSurvey2023 = () => notificationSeen(Notification.RustSurvey2023);
4244

4345
export default slice.reducer;

ui/frontend/selectors/index.ts

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

358358
const NOW = new Date();
359359

360-
const RUST_SURVEY_2022_END = new Date('2022-12-19T00:00:00Z');
361-
const RUST_SURVEY_2022_OPEN = NOW <= RUST_SURVEY_2022_END;
362-
export const showRustSurvey2022Selector = createSelector(
360+
const RUST_SURVEY_2023_END = new Date('2024-01-15T00:00:00Z');
361+
const RUST_SURVEY_2023_OPEN = NOW <= RUST_SURVEY_2023_END;
362+
export const showRustSurvey2023Selector = createSelector(
363363
notificationsSelector,
364-
notifications => RUST_SURVEY_2022_OPEN && !notifications.seenRustSurvey2022,
364+
notifications => RUST_SURVEY_2023_OPEN && !notifications.seenRustSurvey2023,
365365
);
366366

367367
export const anyNotificationsToShowSelector = createSelector(
368-
showRustSurvey2022Selector,
368+
showRustSurvey2023Selector,
369369
excessiveExecutionSelector,
370370
(...allNotifications) => allNotifications.some(n => n),
371371
);

ui/frontend/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,5 +159,5 @@ export enum Focus {
159159
}
160160

161161
export enum Notification {
162-
RustSurvey2022 = 'rust-survey-2022',
162+
RustSurvey2023 = 'rust-survey-2023',
163163
}

0 commit comments

Comments
 (0)