Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
c3cfe6a
client/modules/About/About.styles: update to ts, no-verify
clairep94 Oct 26, 2025
2db568d
client/modules/About/statics/aboutData: update to ts, no-verify
clairep94 Oct 26, 2025
607d9ca
client/modules/About/statics/aboutData: define types
clairep94 Oct 26, 2025
9a63407
client/modules/About/pages/About: update to ts, no-verify
clairep94 Oct 26, 2025
66c04ae
client/modules/About/pages/About: add types
clairep94 Oct 26, 2025
303541b
PolicyContainer: update to ts, no-verify
clairep94 Oct 26, 2025
6dcaec2
PolicyContainer: add types & named export
clairep94 Oct 26, 2025
b514e13
client/modules/Legal/pages/CodeOfConduct: update to ts, no-verify
clairep94 Oct 26, 2025
a6fc06b
client/modules/Legal/pages/CodeOfConduct: update to named export, no …
clairep94 Oct 26, 2025
e10a24e
client/modules/Legal/pages/Legal: update to ts, no-verify
clairep94 Oct 26, 2025
99e53cf
client/modules/Legal/pages/Legal: add types & update to named export
clairep94 Oct 26, 2025
b0d404e
client/modules/Legal/pages/PrivacyPolicy: update to ts, no-verify
clairep94 Oct 26, 2025
3fe0dd3
client/modules/Legal/pages/PrivacyPolicy: update to named export, no …
clairep94 Oct 26, 2025
702a57e
client/modules/Legal/pages/TermsOfUse: update to ts, no-verify
clairep94 Oct 26, 2025
e409355
client/modules/Legal/pages/TermsOfUse: update to named export, no typ…
clairep94 Oct 26, 2025
8072ef6
client/modules/About & client/modules/Legal: clean up Proptypes
clairep94 Oct 27, 2025
6722bf6
package.json: add react-helmet types
clairep94 Oct 27, 2025
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
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
import PropTypes from 'prop-types';
import { useSelector } from 'react-redux';
import { Helmet } from 'react-helmet';
import { useTranslation } from 'react-i18next';
import { Link } from 'react-router-dom';

import type { TFunction } from 'react-i18next';
import {
AboutPageContent,
Intro,
Expand All @@ -27,8 +27,34 @@ import packageData from '../../../../package.json';
import HeartIcon from '../../../images/heart.svg';
import AsteriskIcon from '../../../images/p5-asterisk.svg';
import LogoIcon from '../../../images/p5js-square-logo.svg';
import { RootState } from '../../../reducers';

const AboutSection = ({ section, t }) => (
export interface AboutSectionInfoItem {
url: string;
title: string;
description: string;
}
export interface AboutSectionInfoSection {
header: string;
items: AboutSectionInfoItem[];
}
export interface ContactSectionLink {
label: string;
href: string;
}

export interface AboutSectionProps {
section: AboutSectionInfoSection;
t: TFunction<'translation'>;
}

const AboutSection = ({
section,
t
}: {
section: AboutSectionInfoSection;
t: TFunction<'translation'>;
}) => (
<Section>
<h2>{t(section.header)}</h2>
<SectionContainer>
Expand All @@ -47,11 +73,15 @@ const AboutSection = ({ section, t }) => (
</Section>
);

const About = () => {
export const About = () => {
const { t } = useTranslation();

const p5version = useSelector((state) => {
const index = state.files.find((file) => file.name === 'index.html');
const p5version = useSelector((state: RootState) => {
const index = state.files.find(
(file: {
name: string /** TODO: update once files types are defined in server */;
}) => file.name === 'index.html'
);
return index?.content.match(/\/p5@([\d.]+)\//)?.[1];
});

Expand Down Expand Up @@ -91,7 +121,11 @@ const About = () => {
</Intro>

{AboutSectionInfo.map((section) => (
<AboutSection key={t(section.header)} section={section} t={t} />
<AboutSection
key={t(section.header) as string}
section={section}
t={t}
/>
))}

<Contact>
Expand Down Expand Up @@ -152,19 +186,3 @@ const About = () => {
</RootPage>
);
};

AboutSection.propTypes = {
section: PropTypes.shape({
header: PropTypes.string.isRequired,
items: PropTypes.arrayOf(
PropTypes.shape({
url: PropTypes.string.isRequired,
title: PropTypes.string.isRequired,
description: PropTypes.string.isRequired
})
).isRequired
}).isRequired,
t: PropTypes.func.isRequired
};

export default About;
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
export const ContactSectionLinks = [
import type {
ContactSectionLink,
AboutSectionInfoSection
} from '../pages/About';

export const ContactSectionLinks: ContactSectionLink[] = [
{
label: 'About.Github',
href: 'https://github.com/processing/p5.js-web-editor'
Expand All @@ -22,7 +27,7 @@ export const ContactSectionLinks = [
}
];

export const AboutSectionInfo = [
export const AboutSectionInfo: AboutSectionInfoSection[] = [
{
header: 'About.NewP5',
items: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from 'react';
import styled from 'styled-components';
import ReactMarkdown from 'react-markdown';
import remarkSlug from 'remark-slug';
import PropTypes from 'prop-types';
import { remSize, prop } from '../../../theme';

const PolicyContainerMain = styled.main`
Expand Down Expand Up @@ -48,16 +47,13 @@ const PolicyContainerMain = styled.main`
}
`;

function PolicyContainer({ policy }) {
export interface PolicyContainerProps {
policy: string;
}
export function PolicyContainer({ policy }: PolicyContainerProps) {
return (
<PolicyContainerMain>
<ReactMarkdown remarkPlugins={[remarkSlug]}>{policy}</ReactMarkdown>
</PolicyContainerMain>
);
}

PolicyContainer.propTypes = {
policy: PropTypes.string.isRequired
};

export default PolicyContainer;
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import Legal from './Legal';
import { Legal } from './Legal';

function CodeOfConduct() {
export function CodeOfConduct() {
const { t } = useTranslation();

return (
<Legal policyFile="code-of-conduct.md" title={t('Legal.CodeOfConduct')} />
);
}

export default CodeOfConduct;
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import axios from 'axios';
import PropTypes from 'prop-types';
import React, { useEffect, useState } from 'react';
import Helmet from 'react-helmet';
import { useTranslation } from 'react-i18next';
Expand All @@ -9,7 +8,7 @@ import { RootPage } from '../../../components/RootPage';
import { remSize } from '../../../theme';
import Loader from '../../App/components/loader';
import Nav from '../../IDE/components/Header/Nav';
import PolicyContainer from '../components/PolicyContainer';
import { PolicyContainer } from '../components/PolicyContainer';

const StyledTabList = styled.nav`
display: flex;
Expand All @@ -21,8 +20,18 @@ const StyledTabList = styled.nav`
gap: ${remSize(19)};
}
`;

function Legal({ policyFile, title }) {
export interface LegalProps {
/**
* Path of the markdown '.md' file, relative to the /public directory.
*/
policyFile: string;
/**
* Used in the HTML <title> tag.
* TODO: pass this to the Nav to use as the mobile title.
*/
title: string;
}
export function Legal({ policyFile, title }: LegalProps) {
const { t } = useTranslation();
const [isLoading, setIsLoading] = useState(true);
const [policy, setPolicy] = useState('');
Expand Down Expand Up @@ -55,17 +64,3 @@ function Legal({ policyFile, title }) {
</RootPage>
);
}

Legal.propTypes = {
/**
* Used in the HTML <title> tag.
* TODO: pass this to the Nav to use as the mobile title.
*/
title: PropTypes.string.isRequired,
/**
* Path of the markdown '.md' file, relative to the /public directory.
*/
policyFile: PropTypes.string.isRequired
};

export default Legal;
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import Legal from './Legal';
import { Legal } from './Legal';

function PrivacyPolicy() {
export function PrivacyPolicy() {
const { t } = useTranslation();

return (
<Legal policyFile="privacy-policy.md" title={t('Legal.PrivacyPolicy')} />
);
}

export default PrivacyPolicy;
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import Legal from './Legal';
import { Legal } from './Legal';

function TermsOfUse() {
export function TermsOfUse() {
const { t } = useTranslation();

return <Legal policyFile="terms-of-use.md" title={t('Legal.TermsOfUse')} />;
}

export default TermsOfUse;
8 changes: 4 additions & 4 deletions client/routes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import { Route as RouterRoute, Switch } from 'react-router-dom';
import App from './modules/App/App';
import IDEView from './modules/IDE/pages/IDEView';
import FullView from './modules/IDE/pages/FullView';
import About from './modules/About/pages/About';
import CodeOfConduct from './modules/Legal/pages/CodeOfConduct';
import PrivacyPolicy from './modules/Legal/pages/PrivacyPolicy';
import TermsOfUse from './modules/Legal/pages/TermsOfUse';
import { About } from './modules/About/pages/About';
import { CodeOfConduct } from './modules/Legal/pages/CodeOfConduct';
import { PrivacyPolicy } from './modules/Legal/pages/PrivacyPolicy';
import { TermsOfUse } from './modules/Legal/pages/TermsOfUse';
import LoginView from './modules/User/pages/LoginView';
import SignupView from './modules/User/pages/SignupView';
import ResetPasswordView from './modules/User/pages/ResetPasswordView';
Expand Down
20 changes: 20 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@
"@types/nodemailer": "^7.0.1",
"@types/nodemailer-mailgun-transport": "^1.4.6",
"@types/passport": "^1.0.17",
"@types/passport": "^1.0.17",
"@types/react": "^16.14.0",
"@types/react-dom": "^16.9.25",
"@types/react-helmet": "^6.1.11",
"@types/react-router-dom": "^5.3.3",
"@types/sinon": "^17.0.4",
"@types/styled-components": "^5.1.34",
Expand Down
Loading