Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6940a10
APIKeyForm & APIKeyList: migrate to ts, no-verify
clairep94 Oct 25, 2025
f670c2b
APIKeyForm & APIKeyList: add types, ammend SanitisedApiKey type to ha…
clairep94 Oct 25, 2025
c1f8e12
NewPasswordForm: update to ts, no-verify
clairep94 Oct 25, 2025
3b40eaf
NewPasswordForm: update with types and to default export
clairep94 Oct 25, 2025
174ba64
client/modules/Legal/components/PolicyContainer: update to ts, no-verify
clairep94 Oct 25, 2025
73d735e
client/modules/Legal/components/PolicyContainer: add types and update…
clairep94 Oct 25, 2025
53d2693
clean up
clairep94 Oct 25, 2025
fded673
client/modules/Legal/pages/TermsOfUse: update to ts, no-verify
clairep94 Oct 25, 2025
9a7be10
client/modules/Legal/pages/TermsOfUse: update to named export
clairep94 Oct 25, 2025
3b9a4f4
client/modules/Legal/pages/PrivacyPolicy: update to ts, no-verify
clairep94 Oct 25, 2025
ace6854
client/modules/Legal/pages/PrivacyPolicy: update to named export
clairep94 Oct 25, 2025
4635280
client/modules/Legal/pages/CodeOfConduct: update to ts, no verify
clairep94 Oct 25, 2025
c650e38
client/modules/Legal/pages/CodeOfConduct: update to named export
clairep94 Oct 25, 2025
7385823
client/modules/Legal/pages/Legal: update to ts, no-verify
clairep94 Oct 25, 2025
813f614
client/modules/Legal/pages/Legal: add types, update to default export…
clairep94 Oct 25, 2025
438725d
client/modules/About: update files to ts, no-verify
clairep94 Oct 25, 2025
c07f92f
client/modules/About: add types and update to named exports
clairep94 Oct 25, 2025
5453102
client/modules/User/components/LoginForm: update to ts, no-verify
clairep94 Oct 25, 2025
443eb54
useSyncFormTranslations: update to check for null formRef
clairep94 Oct 25, 2025
2587859
client/modules/User/components/LoginForm: add types and update to nam…
clairep94 Oct 25, 2025
48fab82
AccountForm: update to ts, no-verify
clairep94 Oct 25, 2025
a571a11
AccountForm: update with types and to named export
clairep94 Oct 25, 2025
70d996b
client/modules/User/components/DashboardTabSwitcher: update to ts, no…
clairep94 Oct 25, 2025
49b2f6b
client/modules/User/components/DashboardTabSwitcher: add types and up…
clairep94 Oct 25, 2025
9a7a6b6
temporary update to common/icons
clairep94 Oct 25, 2025
d21b4e8
WIP migrate user reducers/actions, wip
clairep94 Oct 26, 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
2 changes: 1 addition & 1 deletion client/common/icons.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function withLabel(SvgComponent) {
};

Icon.defaultProps = {
'aria-label': null
'aria-label': undefined
};

return Icon;
Expand Down
4 changes: 2 additions & 2 deletions client/common/useSyncFormTranslations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ export interface FormLike {
* @param language
*/
export const useSyncFormTranslations = (
formRef: MutableRefObject<FormLike>,
formRef: MutableRefObject<FormLike | null>,
language: string
) => {
useEffect(() => {
const form = formRef.current;
const form = formRef?.current;
if (!form) return;

const { values } = form.getState();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
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 { TFunction, useTranslation } from 'react-i18next';
import { Link } from 'react-router-dom';

import {
Expand All @@ -27,8 +26,15 @@ 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';
import { AboutSectionInfoSection } from '../statics/aboutData';

const AboutSection = ({ section, t }) => (
interface AboutSectionProps {
section: AboutSectionInfoSection;
t: TFunction<'translation'>;
}

const AboutSection = ({ section, t }: AboutSectionProps) => (
<Section>
<h2>{t(section.header)}</h2>
<SectionContainer>
Expand All @@ -47,11 +53,13 @@ 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 }) => file.name === 'index.html'
);
return index?.content.match(/\/p5@([\d.]+)\//)?.[1];
});

Expand Down Expand Up @@ -91,7 +99,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 +164,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 = [
export interface ContactSectionLink {
label: string;
href: string;
}

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

export const AboutSectionInfo = [
export interface AboutSectionInfoItem {
url: string;
title: string;
description: string;
}

export interface AboutSectionInfoSection {
header: string;
items: AboutSectionInfoItem[];
}

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,14 @@ 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 @@ -22,7 +21,19 @@ const StyledTabList = styled.nav`
}
`;

function Legal({ policyFile, title }) {
export interface LegalProps {
/**
* Used in the HTML <title> tag.
* TODO: pass this to the Nav to use as the mobile title.
*/
title: string;
/**
* Path of the markdown '.md' file, relative to the /public directory.
*/
policyFile: 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 +66,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;
Loading