Skip to content

Commit 4d4aebf

Browse files
authored
Merge pull request #756 from integer32llc/survey
Add a notification for the Rust 2021 survey
2 parents b17d039 + 175688f commit 4d4aebf

File tree

8 files changed

+92
-29
lines changed

8 files changed

+92
-29
lines changed

compiler/base/Cargo.toml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ version = "=1.3.2"
8888

8989
[dependencies.block_buffer]
9090
package = "block-buffer"
91+
version = "=0.10.0"
92+
93+
[dependencies.block_buffer_0_9_0]
94+
package = "block-buffer"
9195
version = "=0.9.0"
9296

9397
[dependencies.bstr]
@@ -160,6 +164,10 @@ version = "=0.3.2"
160164
package = "crossbeam-utils"
161165
version = "=0.8.5"
162166

167+
[dependencies.crypto_common]
168+
package = "crypto-common"
169+
version = "=0.1.0"
170+
163171
[dependencies.crypto_mac]
164172
package = "crypto-mac"
165173
version = "=0.11.1"
@@ -190,6 +198,10 @@ version = "=2.2.0"
190198

191199
[dependencies.digest]
192200
package = "digest"
201+
version = "=0.10.0"
202+
203+
[dependencies.digest_0_9_0]
204+
package = "digest"
193205
version = "=0.9.0"
194206

195207
[dependencies.dtoa]
@@ -202,7 +214,7 @@ version = "=1.6.1"
202214

203215
[dependencies.encoding_rs]
204216
package = "encoding_rs"
205-
version = "=0.8.29"
217+
version = "=0.8.30"
206218

207219
[dependencies.env_logger]
208220
package = "env_logger"
@@ -315,7 +327,7 @@ version = "=0.3.0"
315327

316328
[dependencies.h2]
317329
package = "h2"
318-
version = "=0.3.7"
330+
version = "=0.3.8"
319331

320332
[dependencies.hashbrown]
321333
package = "hashbrown"
@@ -388,7 +400,7 @@ version = "=2.3.1"
388400

389401
[dependencies.itertools]
390402
package = "itertools"
391-
version = "=0.10.1"
403+
version = "=0.10.3"
392404

393405
[dependencies.itoa]
394406
package = "itoa"
@@ -404,15 +416,15 @@ version = "=1.4.0"
404416

405417
[dependencies.libc]
406418
package = "libc"
407-
version = "=0.2.108"
419+
version = "=0.2.109"
408420

409421
[dependencies.libm]
410422
package = "libm"
411423
version = "=0.2.1"
412424

413425
[dependencies.libsqlite3_sys]
414426
package = "libsqlite3-sys"
415-
version = "=0.23.1"
427+
version = "=0.23.2"
416428

417429
[dependencies.linked_hash_map]
418430
package = "linked-hash-map"
@@ -642,7 +654,7 @@ version = "=0.1.0"
642654

643655
[dependencies.pkg_config]
644656
package = "pkg-config"
645-
version = "=0.3.22"
657+
version = "=0.3.23"
646658

647659
[dependencies.png]
648660
package = "png"
@@ -670,7 +682,7 @@ version = "=0.1.1"
670682

671683
[dependencies.proc_macro2]
672684
package = "proc-macro2"
673-
version = "=1.0.32"
685+
version = "=1.0.33"
674686
features = ["span-locations"]
675687

676688
[dependencies.proc_macro_hack]
@@ -762,7 +774,7 @@ version = "=0.16.20"
762774

763775
[dependencies.rusqlite]
764776
package = "rusqlite"
765-
version = "=0.26.1"
777+
version = "=0.26.3"
766778
features = ["bundled-full"]
767779

768780
[dependencies.rustc_demangle]
@@ -807,12 +819,12 @@ version = "=0.10.2"
807819

808820
[dependencies.serde]
809821
package = "serde"
810-
version = "=1.0.130"
822+
version = "=1.0.131"
811823
features = ["derive", "rc"]
812824

813825
[dependencies.serde_derive]
814826
package = "serde_derive"
815-
version = "=1.0.130"
827+
version = "=1.0.131"
816828

817829
[dependencies.serde_json]
818830
package = "serde_json"

compiler/base/crate-information.json

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,14 @@
9696
},
9797
{
9898
"name": "block-buffer",
99-
"version": "0.9.0",
99+
"version": "0.10.0",
100100
"id": "block_buffer"
101101
},
102+
{
103+
"name": "block-buffer",
104+
"version": "0.9.0",
105+
"id": "block_buffer_0_9_0"
106+
},
102107
{
103108
"name": "bstr",
104109
"version": "0.2.17",
@@ -184,6 +189,11 @@
184189
"version": "0.8.5",
185190
"id": "crossbeam_utils"
186191
},
192+
{
193+
"name": "crypto-common",
194+
"version": "0.1.0",
195+
"id": "crypto_common"
196+
},
187197
{
188198
"name": "crypto-mac",
189199
"version": "0.11.1",
@@ -216,9 +226,14 @@
216226
},
217227
{
218228
"name": "digest",
219-
"version": "0.9.0",
229+
"version": "0.10.0",
220230
"id": "digest"
221231
},
232+
{
233+
"name": "digest",
234+
"version": "0.9.0",
235+
"id": "digest_0_9_0"
236+
},
222237
{
223238
"name": "dtoa",
224239
"version": "0.4.8",
@@ -231,7 +246,7 @@
231246
},
232247
{
233248
"name": "encoding_rs",
234-
"version": "0.8.29",
249+
"version": "0.8.30",
235250
"id": "encoding_rs"
236251
},
237252
{
@@ -371,7 +386,7 @@
371386
},
372387
{
373388
"name": "h2",
374-
"version": "0.3.7",
389+
"version": "0.3.8",
375390
"id": "h2"
376391
},
377392
{
@@ -461,7 +476,7 @@
461476
},
462477
{
463478
"name": "itertools",
464-
"version": "0.10.1",
479+
"version": "0.10.3",
465480
"id": "itertools"
466481
},
467482
{
@@ -481,7 +496,7 @@
481496
},
482497
{
483498
"name": "libc",
484-
"version": "0.2.108",
499+
"version": "0.2.109",
485500
"id": "libc"
486501
},
487502
{
@@ -491,7 +506,7 @@
491506
},
492507
{
493508
"name": "libsqlite3-sys",
494-
"version": "0.23.1",
509+
"version": "0.23.2",
495510
"id": "libsqlite3_sys"
496511
},
497512
{
@@ -781,7 +796,7 @@
781796
},
782797
{
783798
"name": "pkg-config",
784-
"version": "0.3.22",
799+
"version": "0.3.23",
785800
"id": "pkg_config"
786801
},
787802
{
@@ -821,7 +836,7 @@
821836
},
822837
{
823838
"name": "proc-macro2",
824-
"version": "1.0.32",
839+
"version": "1.0.33",
825840
"id": "proc_macro2"
826841
},
827842
{
@@ -926,7 +941,7 @@
926941
},
927942
{
928943
"name": "rusqlite",
929-
"version": "0.26.1",
944+
"version": "0.26.3",
930945
"id": "rusqlite"
931946
},
932947
{
@@ -981,7 +996,7 @@
981996
},
982997
{
983998
"name": "serde",
984-
"version": "1.0.130",
999+
"version": "1.0.131",
9851000
"id": "serde"
9861001
},
9871002
{
@@ -991,7 +1006,7 @@
9911006
},
9921007
{
9931008
"name": "serde_derive",
994-
"version": "1.0.130",
1009+
"version": "1.0.131",
9951010
"id": "serde_derive"
9961011
},
9971012
{

compiler/base/modify-cargo-toml/Cargo.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui/frontend/Notifications.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@ import * as selectors from './selectors';
1010
import styles from './Notifications.module.css';
1111

1212
const EDITION_URL = 'https://doc.rust-lang.org/edition-guide/';
13+
const SURVEY_URL = 'https://blog.rust-lang.org/2021/12/08/survey-launch.html';
1314

1415
const Notifications: React.SFC = () => {
1516
return (
1617
<Portal>
1718
<div className={styles.container}>
1819
<Rust2021IsDefaultNotification />
20+
<RustSurvey2021Notification />
1921
</div>
2022
</Portal>
2123
);
@@ -36,6 +38,24 @@ const Rust2021IsDefaultNotification: React.SFC = () => {
3638
);
3739
};
3840

41+
42+
const RustSurvey2021Notification: React.SFC = () => {
43+
const showRustSurvey2021 = useSelector(selectors.showRustSurvey2021Selector);
44+
45+
const dispatch = useDispatch();
46+
const seenRustSurvey2021 = useCallback(() => dispatch(actions.seenRustSurvey2021()), [dispatch]);
47+
48+
return showRustSurvey2021 && (
49+
<Notification onClose={seenRustSurvey2021}>
50+
Please help us take a look at who the Rust community is
51+
composed of, how the Rust project is doing, and how we can
52+
improve the Rust programming experience by completing the <a
53+
href={SURVEY_URL}>2021 State of Rust Survey</a>. Whether or
54+
not you use Rust today, we want to know your opinions.
55+
</Notification>
56+
);
57+
};
58+
3959
interface NotificationProps {
4060
onClose: () => void;
4161
}

ui/frontend/actions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,7 @@ const notificationSeen = (notification: Notification) =>
702702
createAction(ActionType.NotificationSeen, { notification });
703703

704704
export const seenRust2021IsDefault = () => notificationSeen(Notification.Rust2021IsDefault);
705+
export const seenRustSurvey2021 = () => notificationSeen(Notification.RustSurvey2021);
705706

706707
export const browserWidthChanged = (isSmall: boolean) =>
707708
createAction(ActionType.BrowserWidthChanged, { isSmall });

ui/frontend/reducers/notifications.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ interface State {
66
seenRust2018IsDefault: boolean; // expired
77
seenRustSurvey2020: boolean; // expired
88
seenRust2021IsDefault: boolean;
9+
seenRustSurvey2021: boolean;
910
}
1011

1112
const DEFAULT: State = {
1213
seenRustSurvey2018: true,
1314
seenRust2018IsDefault: true,
1415
seenRustSurvey2020: true,
1516
seenRust2021IsDefault: false,
17+
seenRustSurvey2021: false,
1618
};
1719

1820
export default function notifications(state = DEFAULT, action: Action): State {
@@ -22,6 +24,9 @@ export default function notifications(state = DEFAULT, action: Action): State {
2224
case Notification.Rust2021IsDefault: {
2325
return { ...state, seenRust2021IsDefault: true };
2426
}
27+
case Notification.RustSurvey2021: {
28+
return { ...state, seenRustSurvey2021: true };
29+
}
2530
}
2631
}
2732
default:

ui/frontend/selectors/index.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,16 +249,25 @@ export const codeUrlSelector = createSelector(
249249
const notificationsSelector = (state: State) => state.notifications;
250250

251251
const NOW = new Date();
252+
252253
const RUST_2021_DEFAULT_END = new Date('2022-01-01T00:00:00Z');
253254
const RUST_2021_DEFAULT_OPEN = NOW <= RUST_2021_DEFAULT_END;
254255
export const showRust2021IsDefaultSelector = createSelector(
255256
notificationsSelector,
256257
notifications => RUST_2021_DEFAULT_OPEN && !notifications.seenRust2021IsDefault,
257258
);
258259

260+
const RUST_SURVEY_2021_END = new Date('2021-12-22T00:00:00Z');
261+
const RUST_SURVEY_2021_OPEN = NOW <= RUST_SURVEY_2021_END;
262+
export const showRustSurvey2021Selector = createSelector(
263+
notificationsSelector,
264+
notifications => RUST_SURVEY_2021_OPEN && !notifications.seenRustSurvey2021,
265+
);
266+
259267
export const anyNotificationsToShowSelector = createSelector(
260268
showRust2021IsDefaultSelector,
261-
allNotifications => allNotifications,
269+
showRustSurvey2021Selector,
270+
(...allNotifications) => allNotifications.some(n => n),
262271
);
263272

264273
export const clippyRequestSelector = createSelector(

ui/frontend/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ export enum Focus {
120120

121121
export enum Notification {
122122
Rust2021IsDefault = 'rust-2021-is-default',
123+
RustSurvey2021 = 'rust-survey-2021',
123124
}
124125

125126
export type AceResizeKey = [Focus, number];

0 commit comments

Comments
 (0)