Skip to content

Commit b673682

Browse files
Merge pull request #62 from topcoder-platform/dev
TCA-379 Follow-up & Misc Release 2022-09-01 -> prod
2 parents 5fd6c1b + fda41e2 commit b673682

File tree

41 files changed

+677
-309
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+677
-309
lines changed

Jenkinsfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ if (!branchfilter.contains(env.BRANCH_NAME)) {
1212
return
1313
}
1414

15-
// Define branch specific vars
15+
// Define dev-specific vars
1616
if (env.BRANCH_NAME == 'dev') {
1717
DEPLOY_ENV = 'DEV'
1818
LOGICAL_ENV = 'dev'
@@ -23,6 +23,7 @@ if (env.BRANCH_NAME == 'dev') {
2323
ENABLE_CACHE = false
2424
}
2525

26+
// Define prod-specific vars
2627
if (env.BRANCH_NAME == 'prod') {
2728
DEPLOY_ENV = 'PROD'
2829
LOGICAL_ENV = 'prod'

client/i18n/locales/english/intro.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
}
6868
},
6969
"2022/responsive-web-design": {
70-
"title": "(New) Responsive Web Design",
70+
"title": "Responsive Web Design",
7171
"intro": [
7272
"In this Responsive Web Design Certification, you'll learn the languages that developers use to build webpages: HTML (Hypertext Markup Language) for content, and CSS (Cascading Style Sheets) for design.",
7373
"First, you'll build a cat photo app to learn the basics of HTML and CSS. Later, you'll learn modern techniques like CSS variables by building a penguin, and best practices for accessibility by building a quiz site.",

client/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
"react": "16.14.0",
9797
"react-dom": "16.14.0",
9898
"react-final-form": "6.5.9",
99+
"react-gtm-module": "^2.0.11",
99100
"react-ga": "3.3.1",
100101
"react-helmet": "6.1.0",
101102
"react-hotkeys": "2.0.0",
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { FC } from 'react';
2+
import TagManager from 'react-gtm-module';
3+
4+
import {
5+
devTagManagerId,
6+
prodTagManagerId
7+
} from '../../../../config/analytics-settings';
8+
9+
import envData from '../../../../config/env.json';
10+
11+
/* eslint-disable @typescript-eslint/ban-types */
12+
const GoogleTagManager: FC<{}> = () => {
13+
// if we have an ID
14+
// then tags are supported in this environment,
15+
// so initialize them
16+
const segmentId =
17+
envData.deploymentEnv === 'staging' ? devTagManagerId : prodTagManagerId;
18+
if (segmentId) {
19+
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
20+
/* eslint-disable @typescript-eslint/no-unsafe-call */
21+
TagManager.initialize({
22+
gtmId: segmentId
23+
});
24+
}
25+
26+
return null;
27+
};
28+
29+
export default GoogleTagManager;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as GoogleTagManager } from './GoogleTagManager';
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { FC } from 'react';
2+
3+
import {
4+
devSegmentId,
5+
prodSegmentId
6+
} from '../../../../config/analytics-settings';
7+
import envData from '../../../../config/env.json';
8+
import segment from './segment-snippet';
9+
10+
interface SegmentModel {
11+
load: (id: string) => void;
12+
page: () => void;
13+
}
14+
15+
const segmentModel: SegmentModel = segment as unknown as SegmentModel;
16+
17+
/* eslint-disable @typescript-eslint/ban-types */
18+
const Segment: FC<{}> = () => {
19+
// if we have a key for this environment, load it
20+
const segmentId = (
21+
envData.deploymentEnv === 'staging' ? devSegmentId : prodSegmentId
22+
) as string;
23+
if (segmentId) {
24+
segmentModel.load(segmentId);
25+
segmentModel.page();
26+
}
27+
28+
return null;
29+
};
30+
31+
export default Segment;

client/src/analytics/segment/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as Segment } from './Segment';
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
function SegmentSnippet() {
2+
var analytics = [];
3+
4+
if (analytics.initialize) {
5+
return;
6+
}
7+
if (analytics.invoked) {
8+
window.console &&
9+
console.error &&
10+
console.error('Segment snippet included twice.');
11+
return;
12+
}
13+
analytics.invoked = !0;
14+
analytics.methods = [
15+
'trackSubmit',
16+
'trackClick',
17+
'trackLink',
18+
'trackForm',
19+
'pageview',
20+
'identify',
21+
'reset',
22+
'group',
23+
'track',
24+
'ready',
25+
'alias',
26+
'debug',
27+
'page',
28+
'once',
29+
'off',
30+
'on',
31+
'addSourceMiddleware',
32+
'addIntegrationMiddleware',
33+
'setAnonymousId',
34+
'addDestinationMiddleware'
35+
];
36+
analytics.factory = function (t) {
37+
return function () {
38+
var e = Array.prototype.slice.call(arguments);
39+
e.unshift(t);
40+
analytics.push(e);
41+
return analytics;
42+
};
43+
};
44+
for (var t = 0; t < analytics.methods.length; t++) {
45+
var e = analytics.methods[t];
46+
analytics[e] = analytics.factory(e);
47+
}
48+
analytics.load = function (t, e) {
49+
var n = document.createElement('script');
50+
n.type = 'text/javascript';
51+
n.async = !0;
52+
n.src =
53+
'https://cdn.segment.com/analytics.js/v1/' + t + '/analytics.min.js';
54+
var a = document.getElementsByTagName('script')[0];
55+
a.parentNode.insertBefore(n, a);
56+
analytics._loadOptions = e;
57+
};
58+
analytics.SNIPPET_VERSION = '4.1.0';
59+
// analytics.load("SEGMENT_ANALYTICS_KEY"); - don't load here and let the component decide to load or not
60+
// analytics.page(); - don't call the page, each app should call it when it loads a page by itself
61+
62+
return { ...analytics };
63+
}
64+
65+
export default SegmentSnippet();

client/src/components/OfflineWarning/offline-warning.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function OfflineWarning({
2929
t('misc.offline')
3030
) : (
3131
<Trans i18nKey='misc.server-offline'>
32-
<a href={'mailto:support@freecodecamp.org'}>placeholder</a>
32+
<a href={'mailto:support@topcoder.com'}>placeholder</a>
3333
</Trans>
3434
);
3535
timeout();

client/src/components/formHelpers/block-save-button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next';
55
function BlockSaveButton(props?: Record<string, unknown>): JSX.Element {
66
const { t } = useTranslation();
77
return (
8-
<Button block={true} bsStyle='primary' {...props} type='submit'>
8+
<Button bsStyle='primary' {...props} type='submit'>
99
{props?.children || t('buttons.save')}
1010
</Button>
1111
);

client/src/components/formHelpers/form-fields.tsx

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {
22
Alert,
3-
Col,
43
ControlLabel,
54
FormControl,
65
FormGroup,
@@ -72,7 +71,7 @@ function FormFields(props: FormFieldsProps): JSX.Element {
7271
) : null;
7372
};
7473
return (
75-
<div>
74+
<>
7675
{formFields
7776
.filter(formField => !ignored.includes(formField.name))
7877
.map(({ name, label }) => (
@@ -85,35 +84,33 @@ function FormFields(props: FormFieldsProps): JSX.Element {
8584
name in placeholders ? placeholders[name] : '';
8685
const isURL = types[name] === 'url';
8786
return (
88-
<Col key={key} xs={12}>
89-
<FormGroup>
90-
{type === 'hidden' ? null : (
91-
<ControlLabel htmlFor={key}>{label}</ControlLabel>
92-
)}
93-
<FormControl
94-
componentClass={type === 'textarea' ? type : 'input'}
95-
id={key}
96-
name={name}
97-
onChange={onChange}
98-
placeholder={placeholder}
99-
required={required.includes(name)}
100-
rows={4}
101-
type={type}
102-
value={value as string}
103-
/>
104-
{nullOrWarning(
105-
value as string,
106-
!pristine && error,
107-
isURL,
108-
name
109-
)}
110-
</FormGroup>
111-
</Col>
87+
<FormGroup key={key} className='embedded'>
88+
{type === 'hidden' ? null : (
89+
<ControlLabel htmlFor={key}>{label}</ControlLabel>
90+
)}
91+
<FormControl
92+
componentClass={type === 'textarea' ? type : 'input'}
93+
id={key}
94+
name={name}
95+
onChange={onChange}
96+
placeholder={placeholder}
97+
required={required.includes(name)}
98+
rows={4}
99+
type={type}
100+
value={value as string}
101+
/>
102+
{nullOrWarning(
103+
value as string,
104+
!pristine && error,
105+
isURL,
106+
name
107+
)}
108+
</FormGroup>
112109
);
113110
}}
114111
</Field>
115112
))}
116-
</div>
113+
</>
117114
);
118115
}
119116

client/src/components/formHelpers/form.tsx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
ValidatedValues,
77
FormFields,
88
BlockSaveButton,
9-
BlockSaveWrapper,
109
formatUrlValues
1110
} from '../formHelpers/index';
1211

@@ -54,15 +53,13 @@ function DynamicForm({
5453
style={{ width: '100%' }}
5554
>
5655
<FormFields formFields={formFields} options={options} />
57-
<BlockSaveWrapper>
58-
{hideButton ? null : (
59-
<BlockSaveButton
60-
disabled={(pristine && !enableSubmit) || (error as boolean)}
61-
>
62-
{buttonText ? buttonText : null}
63-
</BlockSaveButton>
64-
)}
65-
</BlockSaveWrapper>
56+
{!hideButton && (
57+
<BlockSaveButton
58+
disabled={(pristine && !enableSubmit) || (error as boolean)}
59+
>
60+
{buttonText ? buttonText : null}
61+
</BlockSaveButton>
62+
)}
6663
</form>
6764
)}
6865
</Form>

client/src/components/layouts/global.css

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,13 +491,43 @@ fieldset[disabled] .btn-primary.focus {
491491
}
492492
}
493493

494-
.button-group .btn:not(:last-child) {
494+
.button-group {
495+
margin-bottom: -10px;
496+
}
497+
.button-group .btn {
495498
margin-bottom: 10px;
496499
}
497500
strong {
498501
color: var(--secondary-color);
499502
}
500503

504+
.form-group.embedded {
505+
border: 1px solid var(--tc-black-40);
506+
padding: 8px 10px 2px;
507+
border-radius: 4px;
508+
position: relative;
509+
max-width: 320px;
510+
}
511+
512+
.form-group.embedded .control-label {
513+
display: block;
514+
font-size: 11px;
515+
font-family: 'Roboto';
516+
line-height: 10px;
517+
color: var(--tc-turq-160);
518+
margin-bottom: 4px;
519+
}
520+
521+
.form-group.embedded .form-control {
522+
border: 0 none;
523+
padding: 0;
524+
height: 22px;
525+
font-size: 14px;
526+
line-height: 22px;
527+
font-family: 'Roboto';
528+
color: var(--tc-black-100);
529+
}
530+
501531
.form-control {
502532
color: var(--primary-color);
503533
outline: none;

client/src/components/layouts/learn.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,7 @@
2424
#learn-app-wrapper .reflex-container.horizontal > .reflex-splitter {
2525
height: 5px;
2626
}
27+
28+
#learn-app-wrapper .reflex-container > .reflex-element:first-child:last-child {
29+
flex: 1 1 auto !important;
30+
}

client/src/components/layouts/prism-night.css

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
*/
77

88
.dark-palette code[class*='language-'],
9-
.dark-palette pre[class*='language-'] {
9+
.dark-palette code[class*='language-'],
10+
pre[class*='language-'].dark-palette {
1011
color: var(--secondary-color);
1112
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
1213
font-size: 1em;
@@ -28,11 +29,13 @@
2829
text-shadow: none;
2930
}
3031

32+
pre[class*='language-'].dark-palette code[class*='language-'],
3133
.dark-palette pre[class*='language-'] code[class*='language-'] {
3234
color: var(--quaternary-color);
3335
}
3436

3537
/* Code blocks */
38+
pre[class*='language-'].dark-palette,
3639
.dark-palette pre[class*='language-'] {
3740
padding: 1em;
3841
margin: 0.5em 0;
@@ -47,12 +50,15 @@ padding in night mode */
4750
}
4851

4952
.dark-palette :not(pre) > code[class*='language-'],
53+
pre[class*='language-'].dark-palette,
5054
.dark-palette pre[class*='language-'] {
5155
background: var(--primary-background);
5256
}
5357

5458
.dark-palette pre[class*='language-']::selection,
59+
pre[class*='language-'].dark-palette::selection,
5560
.dark-palette pre[class*='language-'] ::selection,
61+
pre[class*='language-'].dark-palette ::selection,
5662
.dark-palette code[class*='language-']::selection,
5763
.dark-palette code[class*='language-'] ::selection {
5864
background: var(--selection-color);

0 commit comments

Comments
 (0)