Skip to content

Commit 27e40d8

Browse files
committed
Add a notification for the Rust 2025 survey
1 parent eba91e3 commit 27e40d8

File tree

4 files changed

+37
-1
lines changed

4 files changed

+37
-1
lines changed

ui/frontend/Notifications.tsx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,22 @@ import { Portal } from 'react-portal';
33

44
import { Close } from './Icon';
55
import { useAppDispatch, useAppSelector } from './hooks';
6-
import { seenRust2024IsDefault } from './reducers/notifications';
6+
import { seenRust2024IsDefault, seenRustSurvey2025 } 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

1212
const EDITION_URL = 'https://doc.rust-lang.org/edition-guide/';
1313

14+
const SURVEY_URL = 'https://blog.rust-lang.org/2025/11/17/launching-the-2025-state-of-rust-survey/';
15+
1416
const Notifications: React.FC = () => {
1517
return (
1618
<Portal>
1719
<div className={styles.container}>
1820
<Rust2024IsDefaultNotification />
21+
<RustSurvey2025Notification />
1922
<ExcessiveExecutionNotification />
2023
</div>
2124
</Portal>
@@ -37,6 +40,22 @@ const Rust2024IsDefaultNotification: React.FC = () => {
3740
) : null;
3841
};
3942

43+
const RustSurvey2025Notification: React.FC = () => {
44+
const showIt = useAppSelector(selectors.showRustSurvey2025Selector);
45+
46+
const dispatch = useAppDispatch();
47+
const seenIt = useCallback(() => dispatch(seenRustSurvey2025()), [dispatch]);
48+
49+
return showIt ? (
50+
<Notification onClose={seenIt}>
51+
Please help us take a look at who the Rust community is composed of, how the Rust project is
52+
doing, and how we can improve the Rust programming experience by completing the{' '}
53+
<a href={SURVEY_URL}>2025 State of Rust Survey</a>. Whether or not you use Rust today, we want
54+
to know your opinions.
55+
</Notification>
56+
) : null;
57+
};
58+
4059
const ExcessiveExecutionNotification: React.FC = () => {
4160
const showExcessiveExecution = useAppSelector(selectors.excessiveExecutionSelector);
4261
const time = useAppSelector(selectors.excessiveExecutionTimeSelector);

ui/frontend/reducers/notifications.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ interface State {
1414
seenDarkMode: boolean; // expired
1515
seenRustSurvey2024: boolean; // expired
1616
seenRust2024IsDefault: boolean;
17+
seenRustSurvey2025: boolean;
1718
}
1819

1920
const initialState: State = {
@@ -28,6 +29,7 @@ const initialState: State = {
2829
seenDarkMode: true,
2930
seenRustSurvey2024: true,
3031
seenRust2024IsDefault: false,
32+
seenRustSurvey2025: false,
3133
};
3234

3335
const slice = createSlice({
@@ -40,6 +42,10 @@ const slice = createSlice({
4042
state.seenRust2024IsDefault = true;
4143
break;
4244
}
45+
case Notification.RustSurvey2025: {
46+
state.seenRustSurvey2025 = true;
47+
break;
48+
}
4349
}
4450
},
4551
},
@@ -49,4 +55,6 @@ const { notificationSeen } = slice.actions;
4955

5056
export const seenRust2024IsDefault = () => notificationSeen(Notification.Rust2024IsDefault);
5157

58+
export const seenRustSurvey2025 = () => notificationSeen(Notification.RustSurvey2025);
59+
5260
export default slice.reducer;

ui/frontend/selectors/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,16 @@ export const showRust2024IsDefaultSelector = createSelector(
374374
notifications => RUST_2024_IS_DEFAULT_OPEN && !notifications.seenRust2024IsDefault,
375375
);
376376

377+
const RUST_SURVEY_2025_END = new Date('2025-12-17T00:00:00Z');
378+
const RUST_SURVEY_2025_OPEN = NOW <= RUST_SURVEY_2025_END;
379+
export const showRustSurvey2025Selector = createSelector(
380+
notificationsSelector,
381+
notifications => RUST_SURVEY_2025_OPEN && !notifications.seenRustSurvey2025,
382+
);
383+
377384
export const anyNotificationsToShowSelector = createSelector(
378385
showRust2024IsDefaultSelector,
386+
showRustSurvey2025Selector,
379387
excessiveExecutionSelector,
380388
(...allNotifications) => allNotifications.some(n => n),
381389
);

ui/frontend/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,4 +171,5 @@ export enum Focus {
171171

172172
export enum Notification {
173173
Rust2024IsDefault = 'rust-2024-is-default',
174+
RustSurvey2025 = 'rust-survey-2025',
174175
}

0 commit comments

Comments
 (0)