Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
client/.cache/**
client/static/**
client/.cache/**
client/public/**
api-server/src/public/**
api-server/lib/**
Expand All @@ -10,3 +10,4 @@ config/donation-settings.js
config/superblocks.js
web/**
docs/**/*.md
tools/ui-components/dist/**
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ web/.next
curriculum-server/data/curriculum.json
docs/**/*.md
client/src/components/Donation/types.js
tools/ui-components/dist
6 changes: 4 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
"author": "freeCodeCamp <[email protected]>",
"main": "none",
"scripts": {
"prebuild": "pnpm -w run create:config && pnpm run build:workers --env production",
"prebuild": "pnpm -w run create:config && pnpm run build:workers --env production && pnpm run build:components-library",
"build": "cross-env NODE_OPTIONS=\"--max-old-space-size=7168\" gatsby build --prefix-paths",
"build:workers": "cross-env NODE_OPTIONS=\"--max-old-space-size=7168\" webpack --config ./webpack-workers.js",
"clean": "gatsby clean",
"predevelop": "pnpm run build:workers --env development",
"predevelop": "pnpm -w run create:config && pnpm run build:workers --env development && pnpm run build:components-library",
"build:components-library": "pnpm run -F=@freecodecamp/ui build",
"develop": "cross-env NODE_OPTIONS=\"--max-old-space-size=5000\" gatsby develop --inspect=9230",
"lint": "ts-node ./i18n/schema-validation.ts",
"serve": "gatsby serve -p 8000",
Expand All @@ -49,6 +50,7 @@
"@freecodecamp/react-bootstrap": "0.32.3",
"@freecodecamp/react-calendar-heatmap": "1.1.0",
"@freecodecamp/strip-comments": "3.0.1",
"@freecodecamp/ui": "workspace:*",
"@growthbook/growthbook-react": "0.16.0",
"@loadable/component": "5.15.3",
"@reach/router": "1.3.4",
Expand Down
16 changes: 0 additions & 16 deletions client/src/components/profile/components/time-line.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,6 @@ describe('<TimeLine />', () => {
);
});

it('Render button when both githubLink and solution is present', () => {
// @ts-expect-error
render(<TimeLine {...propsForOnlySolution} />, store);

const menuItems = screen.getAllByRole('menuitem');
expect(menuItems).toHaveLength(2);
expect(menuItems[0]).toHaveAttribute(
'href',
'https://github.com/freeCodeCamp/freeCodeCamp1'
);
expect(menuItems[1]).toHaveAttribute(
'href',
'https://github.com/freeCodeCamp/freeCodeCamp2'
);
});

it('rendering the correct button when files is present', () => {
// @ts-expect-error
render(<TimeLine {...propsForOnlySolution} />, store);
Expand Down
51 changes: 0 additions & 51 deletions client/src/components/settings/certification.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,37 +72,6 @@ describe('<certification />', () => {
})
).toHaveAttribute('href', 'https://github.com/freeCodeCamp/freeCodeCamp');
});

it('Render button when both githubLink and solution is present', () => {
renderWithRedux(<CertificationSettings {...propsForOnlySolution} />);

const links = screen.getAllByRole('menuitem');
expect(links[0]).toHaveAttribute(
'href',
'https://github.com/freeCodeCamp/freeCodeCamp1'
);

expect(links[1]).toHaveAttribute(
'href',
'https://github.com/freeCodeCamp/freeCodeCamp2'
);
});

it('rendering the correct button when files is present', () => {
renderWithRedux(<CertificationSettings {...propsForMultifileProject} />);

expect(
screen.getByRole('menuitem', {
name: 'buttons.view-code'
})
).toBeInTheDocument();

expect(
screen.getByRole('menuitem', {
name: 'buttons.view-project'
})
).toBeInTheDocument();
});
});

const defaultTestProps = {
Expand Down Expand Up @@ -351,23 +320,3 @@ const propsForOnlySolution = {
}
]
};

const propsForMultifileProject = {
...defaultTestProps,
completedChallenges: [
{
id: '587d78af367417b2b2512b03',
completedDate: 123456789,
challengeFiles: [
{
contents,
ext,
fileKey,
name,
path
}
],
challengeType: 14
}
]
};
4 changes: 3 additions & 1 deletion client/src/components/solution-display-widget/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { faExternalLinkAlt } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Button, Dropdown, MenuItem } from '@freecodecamp/react-bootstrap';
import { Button } from '@freecodecamp/react-bootstrap';
import { Dropdown, MenuItem } from '@freecodecamp/ui';
import React from 'react';
import { useTranslation } from 'react-i18next';
import { CompletedChallenge } from '../../redux/prop-types';
import { getSolutionDisplayType } from '../../utils/solution-display-type';
import './solution-display-widget.css';
import '@freecodecamp/ui/dist/base.css';
Comment thread
Sembauke marked this conversation as resolved.
Resolved
interface Props {
completedChallenge: CompletedChallenge;
dataCy?: string;
Expand Down
11 changes: 5 additions & 6 deletions client/src/templates/Challenges/components/tool-panel.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
.tool-panel-group-mobile > .dropdown > .btn-block {
margin: 0 2px 0 0;
padding: 5px 0;
height: 37px;
}

.tool-panel-group .btn-group {
Expand All @@ -37,7 +36,11 @@
}

.tool-panel-group-mobile .btn {
margin-bottom: 0 !important;
margin: 0 !important;
}

.tool-panel-group-mobile *:focus-visible {
outline-offset: -3px;
}

.tool-panel-group .dropdown-menu {
Expand All @@ -52,7 +55,3 @@
.tool-panel-group .dropdown-menu a {
padding: 0.5rem;
}

#get-help-dropdown > .caret {
transform: rotate(180deg);
}
63 changes: 25 additions & 38 deletions client/src/templates/Challenges/components/tool-panel.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import {
Button,
DropdownButton,
MenuItem
} from '@freecodecamp/react-bootstrap';
import { Button } from '@freecodecamp/react-bootstrap';
import { Dropdown, MenuItem } from '@freecodecamp/ui';
Comment thread
ahmaxed marked this conversation as resolved.
Resolved
import { faExternalLinkAlt } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import React from 'react';
import { useTranslation } from 'react-i18next';
import { connect } from 'react-redux';
Expand Down Expand Up @@ -104,40 +103,28 @@ function ToolPanel({
{isMobile ? t('buttons.reset') : t('buttons.reset-lesson')}
</Button>
)}
<DropdownButton
block={true}
bsStyle='primary'
className='btn-invert'
id='get-help-dropdown'
title={isMobile ? t('buttons.help') : t('buttons.get-help')}
>
{guideUrl ? (
<MenuItem
bsStyle='primary'
className='btn-invert'
href={guideUrl}
target='_blank'
>
{t('buttons.get-hint')}
</MenuItem>
) : null}
{videoUrl ? (
<MenuItem
bsStyle='primary'
className='btn-invert'
onClick={openVideoModal}
>
{t('buttons.watch-video')}
<Dropdown dropup>
<Dropdown.Toggle dropup id={'get-help-dropdown'}>
{isMobile ? t('buttons.help') : t('buttons.get-help')}
</Dropdown.Toggle>
<Dropdown.Menu dropup>
{guideUrl ? (
<MenuItem href={guideUrl} target='_blank'>
{t('buttons.get-hint')}{' '}
<FontAwesomeIcon icon={faExternalLinkAlt} />
<span className='sr-only'>, {t('aria.opens-new-window')}</span>
</MenuItem>
) : null}
{videoUrl ? (
<MenuItem onClick={openVideoModal}>
{t('buttons.watch-video')}
</MenuItem>
) : null}
<MenuItem onClick={openHelpModal}>
{t('buttons.ask-for-help')}
</MenuItem>
) : null}
<MenuItem
bsStyle='primary'
className='btn-invert'
onClick={openHelpModal}
>
{t('buttons.ask-for-help')}
</MenuItem>
</DropdownButton>
</Dropdown.Menu>
</Dropdown>
</div>
);
}
Expand Down
1 change: 1 addition & 0 deletions client/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* Don't delete! The empty config is needed when building the client */
24 changes: 14 additions & 10 deletions cypress/e2e/default/learn/common-components/help-button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@ describe('Help Button', () => {

it('should toggle the dropdown menu', () => {
cy.get('#get-help-dropdown').scrollIntoView().click();
cy.get('.tool-panel-group ul[role="menu"]')
cy.get('.tool-panel-group [role="menu"]')
.scrollIntoView()
.should('be.visible');
});

it('should render three links when video is available', () => {
cy.get('.tool-panel-group ul[role="menu"]').within(() => {
cy.get('a').should('have.length', 3);
cy.get('a').eq(0).contains('Get a Hint');
cy.get('a').eq(1).contains('Watch a Video');
cy.get('a').eq(2).contains('Ask for Help');
cy.get('.tool-panel-group [role="menu"]')
.children()
.should('have.length', 3);
cy.get('.tool-panel-group [role="menu"]').within(() => {
cy.get('a').contains('Get a Hint');
cy.get('button').contains('Watch a Video');
cy.get('button').contains('Ask for Help');
});
});

Expand All @@ -27,10 +29,12 @@ describe('Help Button', () => {
'/learn/front-end-development-libraries/bootstrap/apply-the-default-bootstrap-button-style'
);
cy.get('#get-help-dropdown').scrollIntoView().click();
cy.get('.tool-panel-group ul[role="menu"]').within(() => {
cy.get('a').should('have.length', 2);
cy.get('a').eq(0).contains('Get a Hint');
cy.get('a').eq(1).contains('Ask for Help');
cy.get('.tool-panel-group [role="menu"]')
.children()
.should('have.length', 2);
cy.get('.tool-panel-group [role="menu"]').within(() => {
cy.get('a').contains('Get a Hint');
cy.get('button').contains('Ask for Help');
});
});
});
Loading