feat: improve landing page (#36826)
* feat/ add smooth scroll from landing to map * feat: scroll to currentChallengeId if it exist * fix: update tests * refactor: migrate from componentWillMount * fix: update Map and Block's tests and mocks Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
committed by
mrugesh
parent
f9a112b43e
commit
203ca92a20
100
client/package-lock.json
generated
100
client/package-lock.json
generated
@ -4474,8 +4474,7 @@
|
||||
"ansi-regex": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
|
||||
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
|
||||
"optional": true
|
||||
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8="
|
||||
},
|
||||
"aproba": {
|
||||
"version": "1.2.0",
|
||||
@ -4496,14 +4495,12 @@
|
||||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
|
||||
"optional": true
|
||||
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
@ -4518,20 +4515,17 @@
|
||||
"code-point-at": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
|
||||
"integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=",
|
||||
"optional": true
|
||||
"integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c="
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
|
||||
"optional": true
|
||||
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
|
||||
},
|
||||
"console-control-strings": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
|
||||
"integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=",
|
||||
"optional": true
|
||||
"integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4="
|
||||
},
|
||||
"core-util-is": {
|
||||
"version": "1.0.2",
|
||||
@ -4648,8 +4642,7 @@
|
||||
"inherits": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
|
||||
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
|
||||
"optional": true
|
||||
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
|
||||
},
|
||||
"ini": {
|
||||
"version": "1.3.5",
|
||||
@ -4661,7 +4654,6 @@
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
|
||||
"integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"number-is-nan": "^1.0.0"
|
||||
}
|
||||
@ -4676,7 +4668,6 @@
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
@ -4684,14 +4675,12 @@
|
||||
"minimist": {
|
||||
"version": "0.0.8",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
|
||||
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
|
||||
"optional": true
|
||||
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
|
||||
},
|
||||
"minipass": {
|
||||
"version": "2.3.5",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.5.tgz",
|
||||
"integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"safe-buffer": "^5.1.2",
|
||||
"yallist": "^3.0.0"
|
||||
@ -4710,7 +4699,6 @@
|
||||
"version": "0.5.1",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
|
||||
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"minimist": "0.0.8"
|
||||
}
|
||||
@ -4791,8 +4779,7 @@
|
||||
"number-is-nan": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz",
|
||||
"integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=",
|
||||
"optional": true
|
||||
"integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0="
|
||||
},
|
||||
"object-assign": {
|
||||
"version": "4.1.1",
|
||||
@ -4804,7 +4791,6 @@
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
@ -4890,8 +4876,7 @@
|
||||
"safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
|
||||
"optional": true
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
||||
},
|
||||
"safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
@ -4927,7 +4912,6 @@
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
|
||||
"integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"code-point-at": "^1.0.0",
|
||||
"is-fullwidth-code-point": "^1.0.0",
|
||||
@ -4947,7 +4931,6 @@
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
|
||||
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"ansi-regex": "^2.0.0"
|
||||
}
|
||||
@ -4991,14 +4974,12 @@
|
||||
"wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
|
||||
"optional": true
|
||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
|
||||
},
|
||||
"yallist": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz",
|
||||
"integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==",
|
||||
"optional": true
|
||||
"integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A=="
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -8164,8 +8145,7 @@
|
||||
"ansi-regex": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
|
||||
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
|
||||
"optional": true
|
||||
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8="
|
||||
},
|
||||
"aproba": {
|
||||
"version": "1.2.0",
|
||||
@ -8186,14 +8166,12 @@
|
||||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
|
||||
"optional": true
|
||||
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
@ -8208,20 +8186,17 @@
|
||||
"code-point-at": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
|
||||
"integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=",
|
||||
"optional": true
|
||||
"integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c="
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
|
||||
"optional": true
|
||||
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
|
||||
},
|
||||
"console-control-strings": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
|
||||
"integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=",
|
||||
"optional": true
|
||||
"integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4="
|
||||
},
|
||||
"core-util-is": {
|
||||
"version": "1.0.2",
|
||||
@ -8338,8 +8313,7 @@
|
||||
"inherits": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
|
||||
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
|
||||
"optional": true
|
||||
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
|
||||
},
|
||||
"ini": {
|
||||
"version": "1.3.5",
|
||||
@ -8351,7 +8325,6 @@
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
|
||||
"integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"number-is-nan": "^1.0.0"
|
||||
}
|
||||
@ -8366,7 +8339,6 @@
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
@ -8374,14 +8346,12 @@
|
||||
"minimist": {
|
||||
"version": "0.0.8",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
|
||||
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
|
||||
"optional": true
|
||||
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
|
||||
},
|
||||
"minipass": {
|
||||
"version": "2.3.5",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.5.tgz",
|
||||
"integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"safe-buffer": "^5.1.2",
|
||||
"yallist": "^3.0.0"
|
||||
@ -8400,7 +8370,6 @@
|
||||
"version": "0.5.1",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
|
||||
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"minimist": "0.0.8"
|
||||
}
|
||||
@ -8487,8 +8456,7 @@
|
||||
"number-is-nan": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz",
|
||||
"integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=",
|
||||
"optional": true
|
||||
"integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0="
|
||||
},
|
||||
"object-assign": {
|
||||
"version": "4.1.1",
|
||||
@ -8500,7 +8468,6 @@
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
@ -8586,8 +8553,7 @@
|
||||
"safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
|
||||
"optional": true
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
||||
},
|
||||
"safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
@ -8623,7 +8589,6 @@
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
|
||||
"integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"code-point-at": "^1.0.0",
|
||||
"is-fullwidth-code-point": "^1.0.0",
|
||||
@ -8643,7 +8608,6 @@
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
|
||||
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"ansi-regex": "^2.0.0"
|
||||
}
|
||||
@ -8687,14 +8651,12 @@
|
||||
"wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
|
||||
"optional": true
|
||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
|
||||
},
|
||||
"yallist": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz",
|
||||
"integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==",
|
||||
"optional": true
|
||||
"integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A=="
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -10429,8 +10391,7 @@
|
||||
"ansi-regex": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
|
||||
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
|
||||
"optional": true
|
||||
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg=="
|
||||
},
|
||||
"cli-cursor": {
|
||||
"version": "2.1.0",
|
||||
@ -10510,7 +10471,6 @@
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
|
||||
"integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"ansi-regex": "^4.1.0"
|
||||
}
|
||||
@ -13512,8 +13472,7 @@
|
||||
"ansi-regex": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
|
||||
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
|
||||
"optional": true
|
||||
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg=="
|
||||
},
|
||||
"cli-cursor": {
|
||||
"version": "2.1.0",
|
||||
@ -13558,7 +13517,6 @@
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
|
||||
"integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"ansi-regex": "^4.1.0"
|
||||
}
|
||||
@ -16988,6 +16946,15 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"react-scroll": {
|
||||
"version": "1.7.14",
|
||||
"resolved": "https://registry.npmjs.org/react-scroll/-/react-scroll-1.7.14.tgz",
|
||||
"integrity": "sha512-zQ2/8+TaEBctA9RSQspP5GWMffA6g7u+AB9gMWB42btZZTBcGEyomvxnm52UVVELjqXOpD9U1/tHhVTNXyntbQ==",
|
||||
"requires": {
|
||||
"lodash.throttle": "^4.1.1",
|
||||
"prop-types": "^15.5.8"
|
||||
}
|
||||
},
|
||||
"react-side-effect": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/react-side-effect/-/react-side-effect-1.1.5.tgz",
|
||||
@ -17959,7 +17926,6 @@
|
||||
"version": "0.13.6",
|
||||
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.13.6.tgz",
|
||||
"integrity": "sha512-IWnObHt413ucAYKsD9J1QShUKkbKLQQHdxRyw73sw4FN26iWr3DY/H34xGPe4nmL1DwXyWmSWmMrA9TfQbE/XQ==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"loose-envify": "^1.1.0",
|
||||
"object-assign": "^4.1.1"
|
||||
|
@ -60,6 +60,7 @@
|
||||
"react-redux": "^5.0.7",
|
||||
"react-reflex": "^3.0.16",
|
||||
"react-responsive": "^6.1.1",
|
||||
"react-scroll": "^1.7.14",
|
||||
"react-spinkit": "^3.0.0",
|
||||
"react-stripe-elements": "^2.0.3",
|
||||
"react-tooltip": "^3.10.0",
|
||||
|
@ -67,7 +67,7 @@ export default [
|
||||
},
|
||||
{
|
||||
fields: {
|
||||
slug: '/super-block-one/block-a/challenge-one',
|
||||
slug: '/super-block-two/block-a/challenge-one',
|
||||
blockName: 'Block A'
|
||||
},
|
||||
id: 'f',
|
||||
@ -80,7 +80,7 @@ export default [
|
||||
},
|
||||
{
|
||||
fields: {
|
||||
slug: '/super-block-one/block-a/challenge-two',
|
||||
slug: '/super-block-two/block-a/challenge-two',
|
||||
blockName: 'Block A'
|
||||
},
|
||||
id: 'g',
|
||||
@ -93,7 +93,7 @@ export default [
|
||||
},
|
||||
{
|
||||
fields: {
|
||||
slug: '/super-block-one/block-b/challenge-one',
|
||||
slug: '/super-block-two/block-b/challenge-one',
|
||||
blockName: 'Block B'
|
||||
},
|
||||
id: 'h',
|
||||
@ -106,7 +106,7 @@ export default [
|
||||
},
|
||||
{
|
||||
fields: {
|
||||
slug: '/super-block-one/block-b/challenge-two',
|
||||
slug: '/super-block-two/block-b/challenge-two',
|
||||
blockName: 'Block B'
|
||||
},
|
||||
id: 'i',
|
||||
@ -116,5 +116,31 @@ export default [
|
||||
isPrivate: false,
|
||||
superBlock: 'Super Block Two',
|
||||
dashedName: 'challenge-two'
|
||||
},
|
||||
{
|
||||
fields: {
|
||||
slug: '/super-block-three/block-a/challenge-one',
|
||||
blockName: 'Block A'
|
||||
},
|
||||
id: 'j',
|
||||
block: 'block-a',
|
||||
title: 'Challenge One',
|
||||
isRequired: false,
|
||||
isPrivate: false,
|
||||
superBlock: 'Super Block Three',
|
||||
dashedName: 'challenge-one'
|
||||
},
|
||||
{
|
||||
fields: {
|
||||
slug: '/super-block-three/block-c/challenge-two',
|
||||
blockName: 'Block C'
|
||||
},
|
||||
id: 'k',
|
||||
block: 'block-c',
|
||||
title: 'Challenge Two',
|
||||
isRequired: false,
|
||||
isPrivate: false,
|
||||
superBlock: 'Super Block Three',
|
||||
dashedName: 'challenge-two'
|
||||
}
|
||||
];
|
||||
|
@ -1,72 +0,0 @@
|
||||
/* eslint-disable max-len */
|
||||
import React from 'react';
|
||||
|
||||
const propTypes = {};
|
||||
|
||||
function SpotifyLogo(props) {
|
||||
return (
|
||||
<svg
|
||||
viewBox='93.907 430.751 1326.093 259.249'
|
||||
xmlns='http://www.w3.org/2000/svg'
|
||||
xmlnsXlink='http://www.w3.org/1999/xlink'
|
||||
{...props}
|
||||
fill='var(--secondary-color)'
|
||||
>
|
||||
<g>
|
||||
<path
|
||||
d=' M 627.609 633.492 C 577.617 670.34 505.156 690 442.768 690 C 355.291 690 276.539 657.645 216.96 603.833 C 212.279 599.602 216.473 593.835 222.09 597.13 C 286.387 634.54 365.888 657.046 448.011 657.046 C 503.396 657.046 564.323 645.587 620.344 621.808 C 628.808 618.213 635.885 627.35 627.609 633.492'
|
||||
fillRule='evenodd'
|
||||
/>
|
||||
<path
|
||||
d=' M 648.393 609.712 C 642.027 601.549 606.152 605.855 590.049 607.765 C 585.144 608.364 584.395 604.095 588.814 601.025 C 617.386 580.915 664.27 586.72 669.738 593.46 C 675.205 600.238 668.315 647.235 641.465 669.666 C 637.346 673.111 633.414 671.276 635.249 666.708 C 641.278 651.654 654.796 617.914 648.393 609.712'
|
||||
fillRule='evenodd'
|
||||
/>
|
||||
<path
|
||||
d=' M 591.173 459.061 L 591.173 439.513 C 591.173 436.555 593.42 434.57 596.116 434.57 L 683.631 434.57 C 686.439 434.57 688.686 436.593 688.686 439.513 L 688.686 456.252 C 688.649 459.061 686.289 462.731 682.095 468.535 L 636.746 533.282 C 653.598 532.87 671.385 535.379 686.664 543.992 C 690.109 545.939 691.045 548.785 691.308 551.594 L 691.308 572.452 C 691.308 575.298 688.162 578.631 684.867 576.908 C 657.942 562.791 622.179 561.255 592.409 577.058 C 589.375 578.706 586.192 575.411 586.192 572.565 L 586.192 552.755 C 586.192 549.572 586.23 544.142 589.413 539.311 L 641.952 463.967 L 596.228 463.967 C 593.42 463.967 591.173 461.982 591.173 459.061'
|
||||
fillRule='evenodd'
|
||||
/>
|
||||
<path
|
||||
d=' M 271.933 581.028 L 245.307 581.028 C 242.761 580.84 240.739 578.931 240.552 576.497 L 240.552 439.85 C 240.552 437.117 242.836 434.945 245.682 434.945 L 270.51 434.945 C 273.093 435.057 275.153 437.042 275.34 439.513 L 275.34 457.376 L 275.827 457.376 C 282.306 440.113 294.476 432.061 310.878 432.061 C 327.542 432.061 337.953 440.113 345.442 457.376 C 351.883 440.113 366.525 432.061 382.216 432.061 C 393.375 432.061 405.583 436.667 413.035 447.003 C 421.461 458.499 419.738 475.201 419.738 489.843 L 419.701 576.085 C 419.701 578.818 417.416 581.028 414.57 581.028 L 387.983 581.028 C 385.324 580.84 383.189 578.706 383.189 576.085 L 383.189 503.661 C 383.189 497.894 383.713 483.514 382.44 478.047 C 380.456 468.872 374.501 466.288 366.787 466.288 C 360.346 466.288 353.606 470.595 350.872 477.485 C 348.138 484.376 348.4 495.909 348.4 503.661 L 348.4 576.085 C 348.4 578.818 346.116 581.028 343.27 581.028 L 316.682 581.028 C 313.986 580.84 311.889 578.706 311.889 576.085 L 311.852 503.661 C 311.852 488.42 314.361 465.989 295.45 465.989 C 276.314 465.989 277.063 487.858 277.063 503.661 L 277.063 576.085 C 277.063 578.818 274.779 581.028 271.933 581.028'
|
||||
fillRule='evenodd'
|
||||
/>
|
||||
<path
|
||||
d=' M 764.031 432.061 C 803.538 432.061 824.92 465.989 824.92 509.128 C 824.92 550.808 801.291 583.874 764.031 583.874 C 725.235 583.874 704.115 549.946 704.115 507.668 C 704.115 465.128 725.497 432.061 764.031 432.061 Z M 764.255 459.96 C 744.633 459.96 743.397 486.697 743.397 503.362 C 743.397 520.063 743.135 555.713 764.031 555.713 C 784.664 555.713 785.638 526.953 785.638 509.428 C 785.638 497.894 785.151 484.113 781.668 473.179 C 778.673 463.667 772.718 459.96 764.255 459.96 Z '
|
||||
fillRule='evenodd'
|
||||
/>
|
||||
<path
|
||||
d=' M 876.149 581.028 L 849.636 581.028 C 846.977 580.84 844.842 578.706 844.842 576.085 L 844.805 439.401 C 845.03 436.892 847.239 434.945 849.935 434.945 L 874.613 434.945 C 876.935 435.057 878.845 436.63 879.369 438.765 L 879.369 459.66 L 879.856 459.66 C 887.308 440.974 897.756 432.061 916.142 432.061 C 928.088 432.061 939.734 436.368 947.224 448.164 C 954.189 459.099 954.189 477.485 954.189 490.704 L 954.189 576.721 C 953.89 579.118 951.68 581.028 949.059 581.028 L 922.359 581.028 C 919.925 580.84 917.902 579.043 917.64 576.721 L 917.64 502.5 C 917.64 487.559 919.363 465.689 900.976 465.689 C 894.498 465.689 888.544 470.033 885.585 476.624 C 881.841 484.975 881.354 493.288 881.354 502.5 L 881.354 576.085 C 881.316 578.818 878.995 581.028 876.149 581.028'
|
||||
fillRule='evenodd'
|
||||
/>
|
||||
<path
|
||||
d=' M 970.853 570.168 C 970.853 563.278 976.733 557.735 983.96 557.735 C 991.187 557.735 997.067 563.278 997.067 570.168 C 997.067 577.021 991.187 582.638 983.96 582.638 C 976.733 582.638 970.853 577.021 970.853 570.168 Z '
|
||||
fillRule='evenodd'
|
||||
/>
|
||||
<path
|
||||
d=' M 1252.946 581.065 C 1250.174 580.953 1248.003 578.818 1248.003 576.122 L 1248.003 439.476 C 1248.152 437.042 1250.212 435.132 1252.758 434.982 L 1262.532 434.982 C 1265.228 434.982 1267.4 436.93 1267.625 439.476 L 1267.625 459.398 C 1274.59 443.595 1287.547 431.238 1303.912 431.238 L 1304.923 431.238 L 1305.896 431.238 C 1323.272 431.238 1335.967 444.045 1340.685 462.656 C 1348.062 444.269 1361.918 431.238 1380.192 431.238 L 1381.128 431.238 L 1382.214 431.238 C 1395.134 431.238 1407.566 439.551 1414.007 452.208 C 1420.224 464.304 1419.999 480.406 1419.999 493.925 L 1419.962 576.122 C 1419.999 578.743 1417.865 580.878 1415.206 581.065 L 1403.522 581.065 C 1400.976 580.953 1398.916 579.155 1398.579 576.796 L 1398.579 493.925 C 1398.579 484.151 1399.066 473.778 1395.096 464.865 C 1391.052 455.766 1383.301 450.074 1374.987 449.662 C 1365.7 450.111 1357.162 456.889 1351.62 466.026 C 1344.43 477.822 1344.692 488.457 1344.692 502.238 L 1344.692 576.871 C 1344.355 579.118 1342.37 580.878 1339.936 581.065 L 1328.328 581.065 C 1325.556 580.953 1323.347 578.818 1323.347 576.122 L 1323.272 488.457 C 1323.272 480.406 1322.785 470.932 1319.078 463.705 C 1314.772 455.466 1307.057 450.074 1298.969 449.662 C 1290.58 450.149 1282.117 456.552 1277.099 464.004 C 1270.621 473.516 1269.385 485.274 1269.385 497.37 L 1269.385 576.122 C 1269.385 578.743 1267.251 580.878 1264.592 581.065 L 1252.946 581.065'
|
||||
fillRule='evenodd'
|
||||
/>
|
||||
<path
|
||||
d=' M 1172.733 583.911 C 1134.948 583.911 1118.022 545.378 1118.022 506.844 C 1118.022 466.326 1137.907 431.238 1175.953 431.238 L 1176.927 431.238 L 1177.976 431.238 C 1214.974 431.238 1233.398 468.61 1233.398 507.144 C 1233.398 547.961 1212.989 583.911 1174.718 583.911 L 1173.744 583.911 L 1172.733 583.911 M 1175.504 565.225 C 1187.937 564.813 1197.748 557.099 1203.552 544.254 C 1208.757 532.72 1209.769 519.501 1209.769 506.844 C 1209.769 493.063 1208.271 478.684 1201.792 466.888 C 1195.988 456.59 1186.027 450.036 1175.467 449.662 C 1163.708 450.074 1153.185 458.05 1147.905 470.333 C 1143.149 480.968 1141.689 495.086 1141.689 506.844 C 1141.689 520.063 1143.412 535.342 1148.879 546.838 C 1154.196 557.735 1164.42 564.813 1175.504 565.225'
|
||||
fillRule='evenodd'
|
||||
/>
|
||||
<path
|
||||
d=' M 1054.661 564.626 C 1071.625 564.101 1080.537 550.508 1084.207 532.908 C 1084.956 530.698 1086.641 529.013 1089.113 529.013 L 1100.309 528.976 C 1102.968 529.088 1105.402 531.11 1105.178 533.582 C 1100.01 563.577 1081.923 583.911 1056.159 583.911 L 1055.11 583.911 L 1054.137 583.911 C 1016.614 583.911 1000.437 546.239 1000.437 508.005 C 1000.437 470.071 1016.839 431.238 1054.361 431.238 L 1055.372 431.238 L 1056.383 431.238 C 1082.447 431.238 1101.021 451.309 1105.065 481.305 C 1105.065 483.552 1102.968 485.499 1100.497 485.761 L 1088.776 485.611 C 1086.304 485.274 1084.694 483.177 1084.319 480.818 C 1081.511 464.079 1071.887 450.748 1055.859 450.223 C 1030.357 451.047 1023.093 482.428 1023.093 506.582 C 1023.093 529.837 1029.159 563.802 1054.661 564.626'
|
||||
fillRule='evenodd'
|
||||
/>
|
||||
<path
|
||||
d=' M 521.408 515.757 C 521.408 526.13 521.67 534.78 516.427 543.992 C 512.196 551.482 505.455 556.088 498.003 556.088 C 487.78 556.088 481.789 548.299 481.789 536.802 C 481.789 514.109 502.123 509.99 521.408 509.99 L 521.408 515.757 Z M 548.258 580.653 C 546.498 582.226 543.951 582.338 541.967 581.29 C 533.129 573.95 531.519 570.542 526.688 563.54 C 512.084 578.444 501.711 582.9 482.8 582.9 C 460.369 582.9 442.955 569.082 442.955 541.408 C 442.955 519.801 454.639 505.084 471.341 497.894 C 485.795 491.528 505.98 490.405 521.408 488.645 L 521.408 485.199 C 521.408 478.871 521.895 471.381 518.15 465.914 C 514.93 461.008 508.713 458.986 503.209 458.986 C 493.06 458.986 484.035 464.191 481.826 474.976 C 481.377 477.373 479.617 479.732 477.182 479.844 L 451.381 477.073 C 449.209 476.587 446.775 474.826 447.412 471.494 C 453.328 440.188 481.639 430.751 506.953 430.751 C 519.91 430.751 536.836 434.196 547.06 444.007 C 560.016 456.103 558.781 472.243 558.781 489.805 L 558.781 531.297 C 558.781 543.767 563.948 549.235 568.817 555.975 C 570.502 558.372 570.876 561.255 568.704 563.053 C 563.274 567.584 553.613 576.01 548.295 580.728 L 548.258 580.653'
|
||||
fillRule='evenodd'
|
||||
/>
|
||||
<path
|
||||
d=' M 172.36 515.757 C 172.36 526.13 172.622 534.78 167.379 543.992 C 163.147 551.482 156.444 556.088 148.955 556.088 C 138.732 556.088 132.778 548.299 132.778 536.802 C 132.778 514.109 153.112 509.99 172.36 509.99 L 172.36 515.757 Z M 199.209 580.653 C 197.449 582.226 194.903 582.338 192.918 581.29 C 184.081 573.95 182.508 570.542 177.64 563.54 C 163.035 578.444 152.7 582.9 133.751 582.9 C 111.358 582.9 93.907 569.082 93.907 541.408 C 93.907 519.801 105.628 505.084 122.292 497.894 C 136.747 491.528 156.931 490.405 172.36 488.645 L 172.36 485.199 C 172.36 478.871 172.846 471.381 169.139 465.914 C 165.881 461.008 159.665 458.986 154.198 458.986 C 144.049 458.986 134.987 464.191 132.778 474.976 C 132.328 477.373 130.568 479.732 128.172 479.844 L 102.333 477.073 C 100.161 476.587 97.764 474.826 98.363 471.494 C 104.317 440.188 132.59 430.751 157.905 430.751 C 170.862 430.751 187.788 434.196 198.011 444.007 C 210.968 456.103 209.732 472.243 209.732 489.805 L 209.732 531.297 C 209.732 543.767 214.9 549.235 219.768 555.975 C 221.491 558.372 221.865 561.255 219.693 563.053 C 214.263 567.584 204.602 576.01 199.284 580.728 L 199.209 580.653'
|
||||
fillRule='evenodd'
|
||||
/>
|
||||
</g>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
SpotifyLogo.displayName = 'SpotifyLogo';
|
||||
SpotifyLogo.propTypes = propTypes;
|
||||
|
||||
export default SpotifyLogo;
|
@ -1,26 +0,0 @@
|
||||
/* eslint-disable max-len */
|
||||
import React from 'react';
|
||||
|
||||
const propTypes = {};
|
||||
|
||||
function AppleLogo(props) {
|
||||
return (
|
||||
<svg
|
||||
viewBox='0 0 1300 572'
|
||||
xmlns='http://www.w3.org/2000/svg'
|
||||
xmlnsXlink='http://www.w3.org/1999/xlink'
|
||||
{...props}
|
||||
fill='var(--secondary-color)'
|
||||
>
|
||||
<g>
|
||||
<path d=' M 856.091 303.9 C 855.442 231.513 915.212 196.762 917.915 195.068 C 884.281 145.861 831.938 139.12 813.265 138.327 C 768.744 133.82 726.35 164.534 703.784 164.534 C 681.217 164.534 646.321 138.975 609.407 139.697 C 560.813 140.417 516.076 167.923 491.058 211.398 C 440.625 298.889 478.188 428.558 527.287 499.575 C 551.332 534.29 579.955 573.403 617.59 571.961 C 653.855 570.519 667.554 548.529 711.318 548.529 C 755.081 548.529 767.41 571.961 805.73 571.276 C 844.7 570.519 869.429 535.804 893.294 500.981 C 920.835 460.678 932.227 421.673 932.876 419.618 C 932.01 419.257 856.884 390.454 856.091 303.9 Z ' />
|
||||
<path d=' M 784.1 91.348 C 804.071 67.159 817.553 33.524 813.839 0 C 785.07 1.155 750.249 19.179 729.592 43.368 C 711.099 64.746 694.877 98.991 699.273 131.833 C 731.358 134.32 764.125 115.501 784.1 91.348' />
|
||||
</g>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
AppleLogo.displayName = 'AppleLogo';
|
||||
AppleLogo.propTypes = propTypes;
|
||||
|
||||
export default AppleLogo;
|
@ -1,30 +0,0 @@
|
||||
/* eslint-disable max-len */
|
||||
import React from 'react';
|
||||
|
||||
const propTypes = {};
|
||||
|
||||
function GoogleLogo(props) {
|
||||
return (
|
||||
<svg
|
||||
viewBox='1635 326.06 1187.437 390.88'
|
||||
xmlns='http://www.w3.org/2000/svg'
|
||||
xmlnsXlink='http://www.w3.org/1999/xlink'
|
||||
{...props}
|
||||
fill='var(--secondary-color)'
|
||||
>
|
||||
<g>
|
||||
<path d=' M 2143.153 531.761 C 2143.153 587.997 2099.159 629.437 2045.169 629.437 C 1991.178 629.437 1947.184 587.997 1947.184 531.761 C 1947.184 475.128 1991.178 434.085 2045.169 434.085 C 2099.159 434.085 2143.153 475.128 2143.153 531.761 Z M 2100.26 531.761 C 2100.26 496.619 2074.762 472.574 2045.169 472.574 C 2015.575 472.574 1990.077 496.619 1990.077 531.761 C 1990.077 566.551 2015.575 590.948 2045.169 590.948 C 2074.762 590.948 2100.26 566.507 2100.26 531.761 Z ' />
|
||||
<path d=' M 2354.534 531.761 C 2354.534 587.997 2310.541 629.437 2256.55 629.437 C 2202.56 629.437 2158.566 587.997 2158.566 531.761 C 2158.566 475.172 2202.56 434.085 2256.55 434.085 C 2310.541 434.085 2354.534 475.128 2354.534 531.761 Z M 2311.642 531.761 C 2311.642 496.619 2286.144 472.574 2256.55 472.574 C 2226.957 472.574 2201.459 496.619 2201.459 531.761 C 2201.459 566.551 2226.957 590.948 2256.55 590.948 C 2286.144 590.948 2311.642 566.507 2311.642 531.761 Z ' />
|
||||
<path d=' M 2557.109 439.986 L 2557.109 615.345 C 2557.109 687.479 2514.568 716.94 2464.277 716.94 C 2416.936 716.94 2388.444 685.277 2377.698 659.383 L 2415.043 643.837 C 2421.692 659.735 2437.986 678.495 2464.233 678.495 C 2496.424 678.495 2516.374 658.634 2516.374 621.246 L 2516.374 607.198 L 2514.876 607.198 C 2505.276 619.044 2486.78 629.393 2463.44 629.393 C 2414.602 629.393 2369.86 586.852 2369.86 532.113 C 2369.86 476.978 2414.602 434.085 2463.44 434.085 C 2486.736 434.085 2505.232 444.434 2514.876 455.928 L 2516.374 455.928 L 2516.374 440.03 L 2557.109 440.03 L 2557.109 439.986 Z M 2519.412 532.113 C 2519.412 497.72 2496.468 472.574 2467.271 472.574 C 2437.678 472.574 2412.885 497.72 2412.885 532.113 C 2412.885 566.154 2437.678 590.948 2467.271 590.948 C 2496.468 590.948 2519.412 566.154 2519.412 532.113 Z ' />
|
||||
<path d=' M 2624.266 337.202 L 2624.266 623.448 L 2582.43 623.448 L 2582.43 337.202 L 2624.266 337.202 Z ' />
|
||||
<path d=' M 2787.294 563.908 L 2820.587 586.104 C 2809.842 602.001 2783.948 629.393 2739.205 629.393 C 2683.717 629.393 2642.278 586.5 2642.278 531.717 C 2642.278 473.631 2684.07 434.041 2734.405 434.041 C 2785.093 434.041 2809.886 474.379 2817.989 496.178 L 2822.437 507.276 L 2691.864 561.354 C 2701.861 580.951 2717.406 590.948 2739.205 590.948 C 2761.048 590.948 2776.197 580.202 2787.294 563.908 Z M 2684.818 528.766 L 2772.101 492.523 C 2767.301 480.325 2752.857 471.825 2735.858 471.825 C 2714.06 471.825 2683.717 491.07 2684.818 528.766 L 2684.818 528.766 Z ' />
|
||||
<path d=' M 1788.824 506.351 L 1788.824 464.911 L 1928.468 464.911 C 1929.833 472.134 1930.538 480.677 1930.538 489.925 C 1930.538 521.016 1922.039 559.461 1894.647 586.852 C 1868.004 614.596 1833.963 629.393 1788.868 629.393 C 1705.284 629.393 1635 561.31 1635 477.726 C 1635 394.143 1705.284 326.06 1788.868 326.06 C 1835.108 326.06 1868.048 344.204 1892.798 367.852 L 1863.556 397.093 C 1845.809 380.447 1821.765 367.5 1788.824 367.5 C 1727.788 367.5 1680.051 416.69 1680.051 477.726 C 1680.051 538.763 1727.788 587.953 1788.824 587.953 C 1828.414 587.953 1850.962 572.055 1865.406 557.611 C 1877.12 545.897 1884.827 529.163 1887.865 506.307 L 1788.824 506.351 Z ' />
|
||||
</g>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
GoogleLogo.displayName = 'GoogleLogo';
|
||||
GoogleLogo.propTypes = propTypes;
|
||||
|
||||
export default GoogleLogo;
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -4,12 +4,13 @@ import React from 'react';
|
||||
import ShallowRenderer from 'react-test-renderer/shallow';
|
||||
import Enzyme, { shallow } from 'enzyme';
|
||||
import Adapter from 'enzyme-adapter-react-16';
|
||||
import store from 'store';
|
||||
|
||||
import { Map } from './';
|
||||
import mockChallengeNodes from '../../__mocks__/challenge-nodes';
|
||||
import mockIntroNodes from '../../__mocks__/intro-nodes';
|
||||
|
||||
import { dasherize } from '../../../../utils/slugs';
|
||||
|
||||
Enzyme.configure({ adapter: new Adapter() });
|
||||
const renderer = new ShallowRenderer();
|
||||
|
||||
@ -21,11 +22,15 @@ const baseProps = {
|
||||
resetExpansion: () => {}
|
||||
};
|
||||
|
||||
// set .scrollTo to avoid errors in default test environment
|
||||
window.scrollTo = jest.fn();
|
||||
|
||||
test('<Map /> snapshot', () => {
|
||||
const componentToRender = (
|
||||
<Map
|
||||
introNodes={mockIntroNodes}
|
||||
nodes={mockChallengeNodes}
|
||||
resetExpansion={() => {}}
|
||||
toggleBlock={() => {}}
|
||||
toggleSuperBlock={() => {}}
|
||||
/>
|
||||
@ -36,42 +41,74 @@ test('<Map /> snapshot', () => {
|
||||
|
||||
describe('<Map/>', () => {
|
||||
describe('after reload', () => {
|
||||
let initializeSpy = null;
|
||||
beforeEach(() => {
|
||||
initializeSpy = jest.spyOn(Map.prototype, 'initializeExpandedState');
|
||||
});
|
||||
afterEach(() => {
|
||||
initializeSpy.mockRestore();
|
||||
store.clearAll();
|
||||
});
|
||||
// 7 was chosen because it has a different superblock from the first node.
|
||||
const currentChallengeId = mockChallengeNodes[7].id;
|
||||
const defaultNode = mockChallengeNodes[0];
|
||||
const idNode = mockChallengeNodes[7];
|
||||
const hashNode = mockChallengeNodes[9];
|
||||
const currentChallengeId = idNode.id;
|
||||
const hash = dasherize(hashNode.superBlock);
|
||||
|
||||
it('should expand the block with the most recent challenge', () => {
|
||||
const initializeSpy = jest.spyOn(
|
||||
Map.prototype,
|
||||
'initializeExpandedState'
|
||||
);
|
||||
|
||||
const blockSpy = jest.fn();
|
||||
const superSpy = jest.fn();
|
||||
const props = {
|
||||
...baseProps,
|
||||
toggleBlock: blockSpy,
|
||||
toggleSuperBlock: superSpy
|
||||
};
|
||||
const mapToRender = <Map {...props} />;
|
||||
shallow(mapToRender);
|
||||
expect(blockSpy).toHaveBeenCalledTimes(1);
|
||||
expect(superSpy).toHaveBeenCalledTimes(1);
|
||||
expect(initializeSpy).toHaveBeenCalledTimes(1);
|
||||
initializeSpy.mockRestore();
|
||||
});
|
||||
|
||||
it('should use the hash prop if it exists', () => {
|
||||
const blockSpy = jest.fn();
|
||||
const superSpy = jest.fn();
|
||||
const props = {
|
||||
...baseProps,
|
||||
hash,
|
||||
toggleBlock: blockSpy,
|
||||
toggleSuperBlock: superSpy,
|
||||
currentChallengeId
|
||||
};
|
||||
|
||||
const mapToRender = <Map {...props} />;
|
||||
shallow(mapToRender);
|
||||
|
||||
expect(blockSpy).toHaveBeenCalledTimes(1);
|
||||
// the block here should always be the first block of the superblock
|
||||
// this is tested implicitly, as there is a second block in the mock nodes
|
||||
expect(blockSpy).toHaveBeenCalledWith(hashNode.block);
|
||||
|
||||
expect(superSpy).toHaveBeenCalledTimes(1);
|
||||
expect(superSpy).toHaveBeenCalledWith(hashNode.superBlock);
|
||||
});
|
||||
|
||||
it('should use the currentChallengeId prop if there is no hash', () => {
|
||||
const blockSpy = jest.fn();
|
||||
const superSpy = jest.fn();
|
||||
const props = {
|
||||
...baseProps,
|
||||
toggleBlock: blockSpy,
|
||||
toggleSuperBlock: superSpy,
|
||||
currentChallengeId: currentChallengeId
|
||||
currentChallengeId
|
||||
};
|
||||
|
||||
const mapToRender = <Map {...props} />;
|
||||
shallow(mapToRender);
|
||||
|
||||
expect(blockSpy).toHaveBeenCalledTimes(1);
|
||||
expect(blockSpy).toHaveBeenCalledWith(mockChallengeNodes[7].block);
|
||||
expect(blockSpy).toHaveBeenCalledWith(idNode.block);
|
||||
|
||||
expect(superSpy).toHaveBeenCalledTimes(1);
|
||||
expect(superSpy).toHaveBeenCalledWith(mockChallengeNodes[7].superBlock);
|
||||
});
|
||||
|
||||
it('should use the currentChallengeId prop if it exists', () => {
|
||||
const props = { ...baseProps, currentChallengeId };
|
||||
const mapToRender = <Map {...props} />;
|
||||
shallow(mapToRender);
|
||||
|
||||
expect(initializeSpy).toHaveBeenCalledTimes(1);
|
||||
expect(initializeSpy).toHaveBeenCalledWith(currentChallengeId);
|
||||
expect(superSpy).toHaveBeenCalledWith(idNode.superBlock);
|
||||
});
|
||||
|
||||
it('should default to the first challenge otherwise', () => {
|
||||
@ -85,10 +122,10 @@ describe('<Map/>', () => {
|
||||
const mapToRender = <Map {...props} />;
|
||||
shallow(mapToRender);
|
||||
expect(blockSpy).toHaveBeenCalledTimes(1);
|
||||
expect(blockSpy).toHaveBeenCalledWith(mockChallengeNodes[0].block);
|
||||
expect(blockSpy).toHaveBeenCalledWith(defaultNode.block);
|
||||
|
||||
expect(superSpy).toHaveBeenCalledTimes(1);
|
||||
expect(superSpy).toHaveBeenCalledWith(mockChallengeNodes[0].superBlock);
|
||||
expect(superSpy).toHaveBeenCalledWith(defaultNode.superBlock);
|
||||
});
|
||||
|
||||
it('calls resetExpansion when initializing', () => {
|
||||
|
@ -120,7 +120,7 @@ exports[`<Map /> snapshot: Map 1`] = `
|
||||
"dashedName": "challenge-one",
|
||||
"fields": Object {
|
||||
"blockName": "Block A",
|
||||
"slug": "/super-block-one/block-a/challenge-one",
|
||||
"slug": "/super-block-two/block-a/challenge-one",
|
||||
},
|
||||
"id": "f",
|
||||
"isPrivate": false,
|
||||
@ -133,7 +133,7 @@ exports[`<Map /> snapshot: Map 1`] = `
|
||||
"dashedName": "challenge-two",
|
||||
"fields": Object {
|
||||
"blockName": "Block A",
|
||||
"slug": "/super-block-one/block-a/challenge-two",
|
||||
"slug": "/super-block-two/block-a/challenge-two",
|
||||
},
|
||||
"id": "g",
|
||||
"isPrivate": false,
|
||||
@ -146,7 +146,7 @@ exports[`<Map /> snapshot: Map 1`] = `
|
||||
"dashedName": "challenge-one",
|
||||
"fields": Object {
|
||||
"blockName": "Block B",
|
||||
"slug": "/super-block-one/block-b/challenge-one",
|
||||
"slug": "/super-block-two/block-b/challenge-one",
|
||||
},
|
||||
"id": "h",
|
||||
"isPrivate": false,
|
||||
@ -159,7 +159,7 @@ exports[`<Map /> snapshot: Map 1`] = `
|
||||
"dashedName": "challenge-two",
|
||||
"fields": Object {
|
||||
"blockName": "Block B",
|
||||
"slug": "/super-block-one/block-b/challenge-two",
|
||||
"slug": "/super-block-two/block-b/challenge-two",
|
||||
},
|
||||
"id": "i",
|
||||
"isPrivate": false,
|
||||
@ -167,6 +167,32 @@ exports[`<Map /> snapshot: Map 1`] = `
|
||||
"superBlock": "Super Block Two",
|
||||
"title": "Challenge Two",
|
||||
},
|
||||
Object {
|
||||
"block": "block-a",
|
||||
"dashedName": "challenge-one",
|
||||
"fields": Object {
|
||||
"blockName": "Block A",
|
||||
"slug": "/super-block-three/block-a/challenge-one",
|
||||
},
|
||||
"id": "j",
|
||||
"isPrivate": false,
|
||||
"isRequired": false,
|
||||
"superBlock": "Super Block Three",
|
||||
"title": "Challenge One",
|
||||
},
|
||||
Object {
|
||||
"block": "block-c",
|
||||
"dashedName": "challenge-two",
|
||||
"fields": Object {
|
||||
"blockName": "Block C",
|
||||
"slug": "/super-block-three/block-c/challenge-two",
|
||||
},
|
||||
"id": "k",
|
||||
"isPrivate": false,
|
||||
"isRequired": false,
|
||||
"superBlock": "Super Block Three",
|
||||
"title": "Challenge Two",
|
||||
},
|
||||
]
|
||||
}
|
||||
superBlock="Super Block One"
|
||||
@ -275,7 +301,7 @@ exports[`<Map /> snapshot: Map 1`] = `
|
||||
"dashedName": "challenge-one",
|
||||
"fields": Object {
|
||||
"blockName": "Block A",
|
||||
"slug": "/super-block-one/block-a/challenge-one",
|
||||
"slug": "/super-block-two/block-a/challenge-one",
|
||||
},
|
||||
"id": "f",
|
||||
"isPrivate": false,
|
||||
@ -288,7 +314,7 @@ exports[`<Map /> snapshot: Map 1`] = `
|
||||
"dashedName": "challenge-two",
|
||||
"fields": Object {
|
||||
"blockName": "Block A",
|
||||
"slug": "/super-block-one/block-a/challenge-two",
|
||||
"slug": "/super-block-two/block-a/challenge-two",
|
||||
},
|
||||
"id": "g",
|
||||
"isPrivate": false,
|
||||
@ -301,7 +327,7 @@ exports[`<Map /> snapshot: Map 1`] = `
|
||||
"dashedName": "challenge-one",
|
||||
"fields": Object {
|
||||
"blockName": "Block B",
|
||||
"slug": "/super-block-one/block-b/challenge-one",
|
||||
"slug": "/super-block-two/block-b/challenge-one",
|
||||
},
|
||||
"id": "h",
|
||||
"isPrivate": false,
|
||||
@ -314,7 +340,7 @@ exports[`<Map /> snapshot: Map 1`] = `
|
||||
"dashedName": "challenge-two",
|
||||
"fields": Object {
|
||||
"blockName": "Block B",
|
||||
"slug": "/super-block-one/block-b/challenge-two",
|
||||
"slug": "/super-block-two/block-b/challenge-two",
|
||||
},
|
||||
"id": "i",
|
||||
"isPrivate": false,
|
||||
@ -322,10 +348,217 @@ exports[`<Map /> snapshot: Map 1`] = `
|
||||
"superBlock": "Super Block Two",
|
||||
"title": "Challenge Two",
|
||||
},
|
||||
Object {
|
||||
"block": "block-a",
|
||||
"dashedName": "challenge-one",
|
||||
"fields": Object {
|
||||
"blockName": "Block A",
|
||||
"slug": "/super-block-three/block-a/challenge-one",
|
||||
},
|
||||
"id": "j",
|
||||
"isPrivate": false,
|
||||
"isRequired": false,
|
||||
"superBlock": "Super Block Three",
|
||||
"title": "Challenge One",
|
||||
},
|
||||
Object {
|
||||
"block": "block-c",
|
||||
"dashedName": "challenge-two",
|
||||
"fields": Object {
|
||||
"blockName": "Block C",
|
||||
"slug": "/super-block-three/block-c/challenge-two",
|
||||
},
|
||||
"id": "k",
|
||||
"isPrivate": false,
|
||||
"isRequired": false,
|
||||
"superBlock": "Super Block Three",
|
||||
"title": "Challenge Two",
|
||||
},
|
||||
]
|
||||
}
|
||||
superBlock="Super Block Two"
|
||||
/>
|
||||
<Connect(SuperBlock)
|
||||
introNodes={
|
||||
Array [
|
||||
Object {
|
||||
"fields": Object {
|
||||
"slug": "/super-block-one/block-a",
|
||||
},
|
||||
"frontmatter": Object {
|
||||
"block": "Block A",
|
||||
"title": "Introduction to Block A",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"fields": Object {
|
||||
"slug": "/super-block-one/block-b",
|
||||
},
|
||||
"frontmatter": Object {
|
||||
"block": "Block B",
|
||||
"title": "Introduction to Block B",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"fields": Object {
|
||||
"slug": "/super-block-one/block-c",
|
||||
},
|
||||
"frontmatter": Object {
|
||||
"block": "Block C",
|
||||
"title": "Introduction to Block C",
|
||||
},
|
||||
},
|
||||
]
|
||||
}
|
||||
nodes={
|
||||
Array [
|
||||
Object {
|
||||
"block": "block-a",
|
||||
"dashedName": "challenge-one",
|
||||
"fields": Object {
|
||||
"blockName": "Block A",
|
||||
"slug": "/super-block-one/block-a/challenge-one",
|
||||
},
|
||||
"id": "a",
|
||||
"isPrivate": false,
|
||||
"isRequired": false,
|
||||
"superBlock": "Super Block One",
|
||||
"title": "Challenge One",
|
||||
},
|
||||
Object {
|
||||
"block": "block-a",
|
||||
"dashedName": "challenge-two",
|
||||
"fields": Object {
|
||||
"blockName": "Block A",
|
||||
"slug": "/super-block-one/block-a/challenge-two",
|
||||
},
|
||||
"id": "b",
|
||||
"isPrivate": false,
|
||||
"isRequired": false,
|
||||
"superBlock": "Super Block One",
|
||||
"title": "Challenge Two",
|
||||
},
|
||||
Object {
|
||||
"block": "block-b",
|
||||
"dashedName": "challenge-one",
|
||||
"fields": Object {
|
||||
"blockName": "Block B",
|
||||
"slug": "/super-block-one/block-b/challenge-one",
|
||||
},
|
||||
"id": "c",
|
||||
"isPrivate": false,
|
||||
"isRequired": false,
|
||||
"superBlock": "Super Block One",
|
||||
"title": "Challenge One",
|
||||
},
|
||||
Object {
|
||||
"block": "block-b",
|
||||
"dashedName": "challenge-two",
|
||||
"fields": Object {
|
||||
"blockName": "Block B",
|
||||
"slug": "/super-block-one/block-b/challenge-two",
|
||||
},
|
||||
"id": "d",
|
||||
"isPrivate": false,
|
||||
"isRequired": false,
|
||||
"superBlock": "Super Block One",
|
||||
"title": "Challenge Two",
|
||||
},
|
||||
Object {
|
||||
"block": "block-c",
|
||||
"dashedName": "challenge-one",
|
||||
"fields": Object {
|
||||
"blockName": "Block C",
|
||||
"slug": "/super-block-one/block-c/challenge-one",
|
||||
},
|
||||
"id": "e",
|
||||
"isPrivate": true,
|
||||
"isRequired": false,
|
||||
"superBlock": "Super Block One",
|
||||
"title": "Challenge One",
|
||||
},
|
||||
Object {
|
||||
"block": "block-a",
|
||||
"dashedName": "challenge-one",
|
||||
"fields": Object {
|
||||
"blockName": "Block A",
|
||||
"slug": "/super-block-two/block-a/challenge-one",
|
||||
},
|
||||
"id": "f",
|
||||
"isPrivate": false,
|
||||
"isRequired": false,
|
||||
"superBlock": "Super Block Two",
|
||||
"title": "Challenge One",
|
||||
},
|
||||
Object {
|
||||
"block": "block-a",
|
||||
"dashedName": "challenge-two",
|
||||
"fields": Object {
|
||||
"blockName": "Block A",
|
||||
"slug": "/super-block-two/block-a/challenge-two",
|
||||
},
|
||||
"id": "g",
|
||||
"isPrivate": false,
|
||||
"isRequired": false,
|
||||
"superBlock": "Super Block Two",
|
||||
"title": "Challenge Two",
|
||||
},
|
||||
Object {
|
||||
"block": "block-b",
|
||||
"dashedName": "challenge-one",
|
||||
"fields": Object {
|
||||
"blockName": "Block B",
|
||||
"slug": "/super-block-two/block-b/challenge-one",
|
||||
},
|
||||
"id": "h",
|
||||
"isPrivate": false,
|
||||
"isRequired": false,
|
||||
"superBlock": "Super Block Two",
|
||||
"title": "Challenge One",
|
||||
},
|
||||
Object {
|
||||
"block": "block-b",
|
||||
"dashedName": "challenge-two",
|
||||
"fields": Object {
|
||||
"blockName": "Block B",
|
||||
"slug": "/super-block-two/block-b/challenge-two",
|
||||
},
|
||||
"id": "i",
|
||||
"isPrivate": false,
|
||||
"isRequired": false,
|
||||
"superBlock": "Super Block Two",
|
||||
"title": "Challenge Two",
|
||||
},
|
||||
Object {
|
||||
"block": "block-a",
|
||||
"dashedName": "challenge-one",
|
||||
"fields": Object {
|
||||
"blockName": "Block A",
|
||||
"slug": "/super-block-three/block-a/challenge-one",
|
||||
},
|
||||
"id": "j",
|
||||
"isPrivate": false,
|
||||
"isRequired": false,
|
||||
"superBlock": "Super Block Three",
|
||||
"title": "Challenge One",
|
||||
},
|
||||
Object {
|
||||
"block": "block-c",
|
||||
"dashedName": "challenge-two",
|
||||
"fields": Object {
|
||||
"blockName": "Block C",
|
||||
"slug": "/super-block-three/block-c/challenge-two",
|
||||
},
|
||||
"id": "k",
|
||||
"isPrivate": false,
|
||||
"isRequired": false,
|
||||
"superBlock": "Super Block Three",
|
||||
"title": "Challenge Two",
|
||||
},
|
||||
]
|
||||
}
|
||||
superBlock="Super Block Three"
|
||||
/>
|
||||
<Spacer />
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -13,6 +13,7 @@ import { blockNameify } from '../../../../utils/blockNameify';
|
||||
import GreenPass from '../../../assets/icons/GreenPass';
|
||||
import GreenNotCompleted from '../../../assets/icons/GreenNotCompleted';
|
||||
import IntroInformation from '../../../assets/icons/IntroInformation';
|
||||
import { dasherize } from '../../../../../utils/slugs';
|
||||
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
const expandedSelector = makeExpandedBlockSelector(ownProps.blockDashedName);
|
||||
@ -92,6 +93,11 @@ export class Block extends Component {
|
||||
return (
|
||||
<li
|
||||
className={'map-challenge-title' + completedClass}
|
||||
id={
|
||||
challenge.title
|
||||
? dasherize(challenge.title)
|
||||
: dasherize(challenge.frontmatter.title)
|
||||
}
|
||||
key={'map-challenge' + challenge.fields.slug}
|
||||
>
|
||||
<span className='badge map-badge'>
|
||||
|
@ -4,6 +4,7 @@ import { bindActionCreators } from 'redux';
|
||||
import { connect } from 'react-redux';
|
||||
import { createSelector } from 'reselect';
|
||||
import { uniq, find } from 'lodash';
|
||||
import { dasherize } from '../../../../../utils/slugs';
|
||||
|
||||
import Block from './Block';
|
||||
|
||||
@ -88,7 +89,10 @@ export class SuperBlock extends Component {
|
||||
render() {
|
||||
const { superBlock, isExpanded, toggleSuperBlock } = this.props;
|
||||
return (
|
||||
<li className={`superblock ${isExpanded ? 'open' : ''}`}>
|
||||
<li
|
||||
className={`superblock ${isExpanded ? 'open' : ''}`}
|
||||
id={dasherize(superBlock)}
|
||||
>
|
||||
<button
|
||||
aria-expanded={isExpanded}
|
||||
className='map-title'
|
||||
|
@ -28,7 +28,7 @@ exports[`<Block /> not expanded snapshot: block-not-expanded 1`] = `
|
||||
/>
|
||||
</span>
|
||||
<span>
|
||||
2/4
|
||||
2/5
|
||||
</span>
|
||||
</div>
|
||||
</button>
|
||||
@ -64,13 +64,14 @@ exports[`<Block expanded snapshot: block-expanded 1`] = `
|
||||
/>
|
||||
</span>
|
||||
<span>
|
||||
2/4
|
||||
2/5
|
||||
</span>
|
||||
</div>
|
||||
</button>
|
||||
<ul>
|
||||
<li
|
||||
className="map-challenge-title"
|
||||
id="introduction-to-block-a"
|
||||
>
|
||||
<span
|
||||
className="badge map-badge"
|
||||
@ -94,6 +95,7 @@ exports[`<Block expanded snapshot: block-expanded 1`] = `
|
||||
</li>
|
||||
<li
|
||||
className="map-challenge-title map-challenge-title-completed"
|
||||
id="challenge-one"
|
||||
>
|
||||
<span
|
||||
className="badge map-badge"
|
||||
@ -117,6 +119,7 @@ exports[`<Block expanded snapshot: block-expanded 1`] = `
|
||||
</li>
|
||||
<li
|
||||
className="map-challenge-title"
|
||||
id="challenge-two"
|
||||
>
|
||||
<span
|
||||
className="badge map-badge"
|
||||
@ -140,6 +143,7 @@ exports[`<Block expanded snapshot: block-expanded 1`] = `
|
||||
</li>
|
||||
<li
|
||||
className="map-challenge-title"
|
||||
id="challenge-one"
|
||||
>
|
||||
<span
|
||||
className="badge map-badge"
|
||||
@ -156,13 +160,14 @@ exports[`<Block expanded snapshot: block-expanded 1`] = `
|
||||
</span>
|
||||
<mockConstructor
|
||||
onClick={[Function]}
|
||||
to="/super-block-one/block-a/challenge-one"
|
||||
to="/super-block-two/block-a/challenge-one"
|
||||
>
|
||||
Challenge One
|
||||
</mockConstructor>
|
||||
</li>
|
||||
<li
|
||||
className="map-challenge-title map-challenge-title-completed"
|
||||
id="challenge-two"
|
||||
>
|
||||
<span
|
||||
className="badge map-badge"
|
||||
@ -179,11 +184,35 @@ exports[`<Block expanded snapshot: block-expanded 1`] = `
|
||||
</span>
|
||||
<mockConstructor
|
||||
onClick={[Function]}
|
||||
to="/super-block-one/block-a/challenge-two"
|
||||
to="/super-block-two/block-a/challenge-two"
|
||||
>
|
||||
Challenge Two
|
||||
</mockConstructor>
|
||||
</li>
|
||||
<li
|
||||
className="map-challenge-title"
|
||||
id="challenge-one"
|
||||
>
|
||||
<span
|
||||
className="badge map-badge"
|
||||
>
|
||||
<GreenNotCompleted
|
||||
style={
|
||||
Object {
|
||||
"height": "15px",
|
||||
"marginRight": "10px",
|
||||
"width": "15px",
|
||||
}
|
||||
}
|
||||
/>
|
||||
</span>
|
||||
<mockConstructor
|
||||
onClick={[Function]}
|
||||
to="/super-block-three/block-a/challenge-one"
|
||||
>
|
||||
Challenge One
|
||||
</mockConstructor>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
`;
|
||||
|
@ -3,6 +3,7 @@
|
||||
exports[`<SuperBlock /> expanded snapshot: superBlock-expanded 1`] = `
|
||||
<li
|
||||
className="superblock open"
|
||||
id="super-block-one"
|
||||
>
|
||||
<button
|
||||
aria-expanded={true}
|
||||
@ -141,6 +142,7 @@ exports[`<SuperBlock /> expanded snapshot: superBlock-expanded 1`] = `
|
||||
exports[`<SuperBlock /> not expanded snapshot: superBlock-not-expanded 1`] = `
|
||||
<li
|
||||
className="superblock "
|
||||
id="super-block-one"
|
||||
>
|
||||
<button
|
||||
aria-expanded={false}
|
||||
|
@ -5,6 +5,7 @@ import { bindActionCreators } from 'redux';
|
||||
import PropTypes from 'prop-types';
|
||||
import uniq from 'lodash/uniq';
|
||||
import { createSelector } from 'reselect';
|
||||
import { scroller } from 'react-scroll';
|
||||
|
||||
import SuperBlock from './components/SuperBlock';
|
||||
import Spacer from '../helpers/Spacer';
|
||||
@ -13,9 +14,11 @@ import './map.css';
|
||||
import { ChallengeNode } from '../../redux/propTypes';
|
||||
import { toggleSuperBlock, toggleBlock, resetExpansion } from './redux';
|
||||
import { currentChallengeIdSelector } from '../../redux';
|
||||
import { dasherize } from '../../../../utils/slugs';
|
||||
|
||||
const propTypes = {
|
||||
currentChallengeId: PropTypes.string,
|
||||
hash: PropTypes.string,
|
||||
introNodes: PropTypes.arrayOf(
|
||||
PropTypes.shape({
|
||||
fields: PropTypes.shape({ slug: PropTypes.string.isRequired }),
|
||||
@ -52,17 +55,56 @@ function mapDispatchToProps(dispatch) {
|
||||
}
|
||||
|
||||
export class Map extends Component {
|
||||
componentDidMount() {
|
||||
this.initializeExpandedState(this.props.currentChallengeId);
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = { idToScrollto: null };
|
||||
this.initializeExpandedState();
|
||||
}
|
||||
|
||||
initializeExpandedState(currentChallengeId) {
|
||||
this.props.resetExpansion();
|
||||
const { superBlock, block } = currentChallengeId
|
||||
? this.props.nodes.find(node => node.id === currentChallengeId)
|
||||
: this.props.nodes[0];
|
||||
this.props.toggleBlock(block);
|
||||
this.props.toggleSuperBlock(superBlock);
|
||||
componentDidMount() {
|
||||
if (this.state.idToScrollto) {
|
||||
window.scrollTo(0, 0);
|
||||
scroller.scrollTo(this.state.idToScrollto, {
|
||||
duration: 1500,
|
||||
smooth: 'easeInOutQuint',
|
||||
offset: -35
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// As this happens in the constructor, it's necessary to manipulate state
|
||||
// directly.
|
||||
initializeExpandedState() {
|
||||
const {
|
||||
currentChallengeId,
|
||||
hash,
|
||||
nodes,
|
||||
resetExpansion,
|
||||
toggleBlock,
|
||||
toggleSuperBlock
|
||||
} = this.props;
|
||||
resetExpansion();
|
||||
let node;
|
||||
|
||||
// find the challenge that has the same superblock with hash
|
||||
if (hash) {
|
||||
node = nodes.find(node => dasherize(node.superBlock) === hash);
|
||||
// eslint-disable-next-line react/no-direct-mutation-state
|
||||
if (node) this.state = { idToScrollto: dasherize(node.superBlock) };
|
||||
}
|
||||
|
||||
// if there is no hash or the hash did not match any challenge superblock
|
||||
// and there was a currentChallengeId
|
||||
if (!node && currentChallengeId) {
|
||||
node = nodes.find(node => node.id === currentChallengeId);
|
||||
// eslint-disable-next-line react/no-direct-mutation-state
|
||||
if (node) this.state = { idToScrollto: dasherize(node.title) };
|
||||
}
|
||||
|
||||
if (!node) node = nodes[0];
|
||||
|
||||
toggleBlock(node.block);
|
||||
toggleSuperBlock(node.superBlock);
|
||||
}
|
||||
|
||||
renderSuperBlocks(superBlocks) {
|
||||
|
@ -3,6 +3,7 @@ import React from 'react';
|
||||
import ShallowRenderer from 'react-test-renderer/shallow';
|
||||
|
||||
import { IndexPage } from '../../pages';
|
||||
import mockChallengeNodes from '../../__mocks__/challenge-nodes';
|
||||
|
||||
describe('<Landing />', () => {
|
||||
it('renders when visiting index page and logged out', () => {
|
||||
@ -14,6 +15,7 @@ describe('<Landing />', () => {
|
||||
});
|
||||
|
||||
const loggedOutProps = {
|
||||
data: { allChallengeNode: { edges: mockChallengeNodes } },
|
||||
fetchState: {
|
||||
complete: true,
|
||||
error: null,
|
||||
|
@ -1,28 +1,36 @@
|
||||
import React, { Fragment } from 'react';
|
||||
import { Grid, Row, Col, Image } from '@freecodecamp/react-bootstrap';
|
||||
import { Grid, Row, Col } from '@freecodecamp/react-bootstrap';
|
||||
import Helmet from 'react-helmet';
|
||||
|
||||
import Login from '../Header/components/Login';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Link } from 'gatsby';
|
||||
import { uniq } from 'lodash';
|
||||
import { Spacer } from '../helpers';
|
||||
import Login from '../Header/components/Login';
|
||||
|
||||
import './landing.css';
|
||||
import '../Map/map.css';
|
||||
|
||||
const propTypes = {
|
||||
edges: PropTypes.array
|
||||
};
|
||||
|
||||
const BigCallToAction = () => (
|
||||
<Row>
|
||||
<Col sm={10} smOffset={1} xs={12}>
|
||||
<Login block={true}>Sign in and get started.</Login>
|
||||
<Login block={true}>Sign in and get started (it's free)</Login>
|
||||
</Col>
|
||||
</Row>
|
||||
);
|
||||
|
||||
function Landing() {
|
||||
export const Landing = ({ edges }) => {
|
||||
const superBlocks = uniq(edges.map(element => element.node.superBlock));
|
||||
return (
|
||||
<Fragment>
|
||||
<Helmet>
|
||||
<title>Learn to code | freeCodeCamp.org</title>
|
||||
</Helmet>
|
||||
<main className='index-page'>
|
||||
<Spacer size={2} />
|
||||
<main className='landing-page'>
|
||||
<Spacer />
|
||||
<Grid>
|
||||
<Row>
|
||||
<Col sm={10} smOffset={1} xs={12}>
|
||||
@ -31,33 +39,36 @@ function Landing() {
|
||||
</h1>
|
||||
<Spacer />
|
||||
<h2 className='medium-heading'>Learn to code.</h2>
|
||||
<h2 className='medium-heading'>Build projects.</h2>
|
||||
<h2 className='medium-heading'>Earn certifications.</h2>
|
||||
<h2 className='medium-heading'>
|
||||
Build projects and earn certifications.
|
||||
</h2>
|
||||
<h2 className='medium-heading'>
|
||||
Grow your portfolio and get a developer job.
|
||||
</h2>
|
||||
<h2 className='medium-heading'>
|
||||
It's all 100% free thanks to our nonprofit's donors.
|
||||
Since 2014, more than 40,000 freeCodeCamp.org graduates have
|
||||
gotten jobs at tech companies including:
|
||||
</h2>
|
||||
<div className='logo-row'>
|
||||
<h2 className='medium-heading'>Apple</h2>
|
||||
<h2 className='medium-heading'>Google</h2>
|
||||
<h2 className='medium-heading'>Amazon</h2>
|
||||
<h2 className='medium-heading'>Microsoft</h2>
|
||||
<h2 className='medium-heading'>Spotify</h2>
|
||||
</div>
|
||||
</Col>
|
||||
</Row>
|
||||
<Spacer />
|
||||
<BigCallToAction />
|
||||
<Spacer size={2} />
|
||||
<Image
|
||||
alt='companies featuring freeCodeCamp.org'
|
||||
className='img-center'
|
||||
responsive={true}
|
||||
src='https://cdn-media-1.freecodecamp.org/learn/as-seen-on.png'
|
||||
/>
|
||||
<Spacer />
|
||||
<Row>
|
||||
<Col sm={10} smOffset={1} xs={12}>
|
||||
<h2 className='medium-heading'>
|
||||
Since 2014, more than 40,000 freeCodeCamp.org graduates have
|
||||
gotten jobs in tech.
|
||||
</h2>
|
||||
<h2 className='medium-heading'>Certifications:</h2>
|
||||
<ul>
|
||||
{superBlocks.map((superBlock, i) => (
|
||||
<li className={'superblock'} key={i}>
|
||||
<Link state={{ superBlock: superBlock }} to={`/learn`}>
|
||||
<h2 className='medium-heading'>{superBlock}</h2>
|
||||
</Link>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</Col>
|
||||
</Row>
|
||||
<Spacer />
|
||||
@ -65,8 +76,8 @@ function Landing() {
|
||||
</main>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
Landing.displayName = 'Landing';
|
||||
|
||||
Landing.propTypes = propTypes;
|
||||
export default Landing;
|
||||
|
@ -1,47 +1,7 @@
|
||||
.black-text {
|
||||
color: var(--secondary-color);
|
||||
font-weight: 400;
|
||||
font-size: 40px;
|
||||
}
|
||||
|
||||
.large-p {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.img-center {
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.landing-icon {
|
||||
height: 100px;
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
.landing-skill-icon {
|
||||
color: var(--secondary-color);
|
||||
margin-top: -15px;
|
||||
padding-bottom: 15px;
|
||||
height: 150px;
|
||||
margin-bottom: 1.45rem;
|
||||
}
|
||||
|
||||
.testimonial-image {
|
||||
border-radius: 5px;
|
||||
height: 200px;
|
||||
width: 200px;
|
||||
color: var(--secondary-color);
|
||||
}
|
||||
|
||||
.testimonial-copy {
|
||||
text-align: center;
|
||||
font-size: 18px !important;
|
||||
margin-left: 20px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
.underlined-link {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* Buttons with a lot of text can overflow and mess up formatting on small
|
||||
screens, this stops that unless the word itself is too large. */
|
||||
|
||||
@ -49,13 +9,20 @@
|
||||
white-space: pre-line;
|
||||
}
|
||||
|
||||
@media (min-width: 991px) and (max-width: 1199px) {
|
||||
.testimonial-copy {
|
||||
height: 150px;
|
||||
}
|
||||
.logo-row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-around;
|
||||
align-content: center;
|
||||
}
|
||||
@media (min-width: 1200px) {
|
||||
.testimonial-copy {
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
.logo-row h2 {
|
||||
height: 35px;
|
||||
padding: 0 10px 0 10px;
|
||||
}
|
||||
|
||||
.landing-page ul {
|
||||
list-style: none;
|
||||
padding-left: 0px;
|
||||
}
|
||||
|
@ -46,6 +46,7 @@ const loggedInProps = {
|
||||
user: {
|
||||
name: 'Development User'
|
||||
},
|
||||
location: { hash: '' },
|
||||
data: {
|
||||
challengeNode: {
|
||||
fields: {
|
||||
|
@ -2,6 +2,7 @@ import React from 'react';
|
||||
import { createSelector } from 'reselect';
|
||||
import { connect } from 'react-redux';
|
||||
import PropTypes from 'prop-types';
|
||||
import { graphql } from 'gatsby';
|
||||
|
||||
import { Loader } from '../components/helpers';
|
||||
import Landing from '../components/landing';
|
||||
@ -11,6 +12,7 @@ import {
|
||||
isSignedInSelector
|
||||
} from '../redux';
|
||||
import createRedirect from '../components/createRedirect';
|
||||
import { AllChallengeNode } from '../redux/propTypes';
|
||||
|
||||
const mapStateToProps = createSelector(
|
||||
userFetchStateSelector,
|
||||
@ -29,7 +31,10 @@ const RedirectLearn = createRedirect('/learn');
|
||||
export const IndexPage = ({
|
||||
fetchState: { pending, complete },
|
||||
isSignedIn,
|
||||
user: { acceptedPrivacyTerms }
|
||||
user: { acceptedPrivacyTerms },
|
||||
data: {
|
||||
allChallengeNode: { edges }
|
||||
}
|
||||
}) => {
|
||||
if (pending && !complete) {
|
||||
return <Loader fullScreen={true} />;
|
||||
@ -43,10 +48,13 @@ export const IndexPage = ({
|
||||
return <RedirectLearn />;
|
||||
}
|
||||
|
||||
return <Landing />;
|
||||
return <Landing edges={edges} />;
|
||||
};
|
||||
|
||||
const propTypes = {
|
||||
data: PropTypes.shape({
|
||||
allChallengeNode: AllChallengeNode
|
||||
}),
|
||||
fetchState: PropTypes.shape({
|
||||
pending: PropTypes.bool,
|
||||
complete: PropTypes.bool,
|
||||
@ -62,3 +70,23 @@ IndexPage.propTypes = propTypes;
|
||||
IndexPage.displayName = 'IndexPage';
|
||||
|
||||
export default connect(mapStateToProps)(IndexPage);
|
||||
|
||||
export const query = graphql`
|
||||
query challNodes {
|
||||
allChallengeNode(sort: { fields: [superOrder, order, challengeOrder] }) {
|
||||
edges {
|
||||
node {
|
||||
fields {
|
||||
slug
|
||||
blockName
|
||||
}
|
||||
id
|
||||
block
|
||||
title
|
||||
superBlock
|
||||
dashedName
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
@ -17,6 +17,7 @@ import Login from '../components/Header/components/Login';
|
||||
import { Link, Spacer, Loader } from '../components/helpers';
|
||||
import Map from '../components/Map';
|
||||
import Welcome from '../components/welcome';
|
||||
import { dasherize } from '../../../utils/slugs';
|
||||
|
||||
import {
|
||||
ChallengeNode,
|
||||
@ -46,7 +47,10 @@ const propTypes = {
|
||||
complete: PropTypes.bool,
|
||||
errored: PropTypes.bool
|
||||
}),
|
||||
hash: PropTypes.string,
|
||||
isSignedIn: PropTypes.bool,
|
||||
location: PropTypes.object,
|
||||
state: PropTypes.object,
|
||||
user: PropTypes.shape({
|
||||
name: PropTypes.string
|
||||
})
|
||||
@ -68,8 +72,16 @@ const BigCallToAction = isSignedIn => {
|
||||
return '';
|
||||
};
|
||||
|
||||
// choose between the state from landing page and hash from url.
|
||||
const hashValueSelector = (state, hash) => {
|
||||
if (state && state.superBlock) return dasherize(state.superBlock);
|
||||
else if (hash) return hash.substr(1);
|
||||
else return null;
|
||||
};
|
||||
|
||||
export const LearnPage = ({
|
||||
fetchState: { pending, complete },
|
||||
location: { hash = '', state = '' },
|
||||
isSignedIn,
|
||||
user: { name = '' },
|
||||
data: {
|
||||
@ -84,6 +96,8 @@ export const LearnPage = ({
|
||||
return <Loader fullScreen={true} />;
|
||||
}
|
||||
|
||||
const hashValue = hashValueSelector(state, hash);
|
||||
|
||||
return (
|
||||
<LearnLayout>
|
||||
<Helmet title='Learn | freeCodeCamp.org' />
|
||||
@ -100,6 +114,7 @@ export const LearnPage = ({
|
||||
</Col>
|
||||
</Row>
|
||||
<Map
|
||||
hash={hashValue}
|
||||
introNodes={mdEdges.map(({ node }) => node)}
|
||||
nodes={edges
|
||||
.map(({ node }) => node)
|
||||
|
Reference in New Issue
Block a user