Skip to content

Commit c65c693

Browse files
authored
Merge pull request #1021 from rust-lang/survey
Add a notification for the Rust 2023 survey
2 parents b82b4c6 + c43b78a commit c65c693

File tree

6 files changed

+24
-69
lines changed

6 files changed

+24
-69
lines changed

ui/frontend/.eslintrc.js

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -87,30 +87,7 @@ module.exports = {
8787
'editor/SimpleEditor.tsx',
8888
'hooks.ts',
8989
'observer.ts',
90-
'reducers/browser.ts',
91-
'reducers/client.ts',
92-
'reducers/code.ts',
93-
'reducers/configuration.ts',
94-
'reducers/crates.ts',
95-
'reducers/featureFlags.ts',
96-
'reducers/globalConfiguration.ts',
97-
'reducers/notifications.ts',
98-
'reducers/output/assembly.ts',
99-
'reducers/output/clippy.ts',
100-
'reducers/output/execute.ts',
101-
'reducers/output/format.ts',
102-
'reducers/output/gist.ts',
103-
'reducers/output/hir.ts',
104-
'reducers/output/llvmIr.ts',
105-
'reducers/output/macroExpansion.ts',
106-
'reducers/output/meta.ts',
107-
'reducers/output/mir.ts',
108-
'reducers/output/miri.ts',
109-
'reducers/output/wasm.ts',
110-
'reducers/page.ts',
111-
'reducers/position.ts',
112-
'reducers/selection.ts',
113-
'reducers/versions.ts',
90+
'reducers/**/*.ts',
11491
'reducers/websocket.ts',
11592
'selectors/index.spec.ts',
11693
'types.ts',

ui/frontend/.prettierignore

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -27,31 +27,7 @@ node_modules
2727
!editor/SimpleEditor.tsx
2828
!hooks.ts
2929
!observer.ts
30-
!reducers/browser.ts
31-
!reducers/client.ts
32-
!reducers/code.ts
33-
!reducers/configuration.ts
34-
!reducers/crates.ts
35-
!reducers/featureFlags.ts
36-
!reducers/globalConfiguration.ts
37-
!reducers/notifications.ts
38-
!reducers/output/assembly.ts
39-
!reducers/output/clippy.ts
40-
!reducers/output/execute.ts
41-
!reducers/output/format.ts
42-
!reducers/output/gist.ts
43-
!reducers/output/hir.ts
44-
!reducers/output/llvmIr.ts
45-
!reducers/output/macroExpansion.ts
46-
!reducers/output/meta.ts
47-
!reducers/output/mir.ts
48-
!reducers/output/miri.ts
49-
!reducers/output/wasm.ts
50-
!reducers/page.ts
51-
!reducers/position.ts
52-
!reducers/selection.ts
53-
!reducers/versions.ts
54-
!reducers/websocket.ts
30+
!reducers/**/*.ts
5531
!selectors/index.spec.ts
5632
!types.ts
5733
!websocketActions.ts

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)