Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
5983eb0
client/common/icons: update to ts, no-verify
clairep94 Oct 26, 2025
26e0a32
client/common/icons: add types & update snapshot test
clairep94 Oct 26, 2025
75ee3de
client/modules/User/reducers: update to ts, no-verify
clairep94 Oct 26, 2025
dc25b3c
client/modules/Users/reducers: update to named export and add types, …
clairep94 Oct 26, 2025
54ca600
server/types/apiKey: add token? to apiKey
clairep94 Oct 26, 2025
8a176bf
server/PublicUser: update apiKeys to be sanitised api keys
clairep94 Oct 26, 2025
e5091f1
update UserState in root redux to include User
clairep94 Oct 26, 2025
d14a722
resolve remaining type-errors from PublicUser vs User apiKey differences
clairep94 Oct 26, 2025
d0f8393
client/modules/User/actions: update to ts, no-verify
clairep94 Oct 26, 2025
dcc2ebe
client/modules/User/actions: add types from server user request/respo…
clairep94 Oct 26, 2025
dabae24
client/modules/About/About.styles: update to ts, no-verify
clairep94 Oct 26, 2025
bce4118
client/modules/About/statics/aboutData: update to ts, no-verify
clairep94 Oct 26, 2025
7779388
client/modules/About/statics/aboutData: define types
clairep94 Oct 26, 2025
944a510
client/modules/About/pages/About: update to ts, no-verify
clairep94 Oct 26, 2025
16ef842
client/modules/About/pages/About: add types
clairep94 Oct 26, 2025
42ec63e
server/types/apiKey: update to add comment about token property on la…
clairep94 Oct 26, 2025
66e0ca2
server/types/apiKey: update toJson method return type to IApiKey
clairep94 Oct 26, 2025
0244387
server/types/PublicUser: update with accurate PublicUser apiKeys, sho…
clairep94 Oct 26, 2025
e49e9bb
PolicyContainer: update to ts, no-verify
clairep94 Oct 26, 2025
e538d24
PolicyContainer: add types & named export
clairep94 Oct 26, 2025
1a6bbe1
client/modules/Legal/pages/CodeOfConduct: update to ts, no-verify
clairep94 Oct 26, 2025
1bbd133
client/modules/Legal/pages/CodeOfConduct: update to named export, no …
clairep94 Oct 26, 2025
cce9c15
client/modules/Legal/pages/Legal: update to ts, no-verify
clairep94 Oct 26, 2025
34bf9d0
client/modules/Legal/pages/Legal: add types & update to named export
clairep94 Oct 26, 2025
4f16e92
client/modules/Legal/pages/PrivacyPolicy: update to ts, no-verify
clairep94 Oct 26, 2025
af2c351
client/modules/Legal/pages/PrivacyPolicy: update to named export, no …
clairep94 Oct 26, 2025
cbfc27a
client/modules/Legal/pages/TermsOfUse: update to ts, no-verify
clairep94 Oct 26, 2025
f00cc28
client/modules/Legal/pages/TermsOfUse: update to named export, no typ…
clairep94 Oct 26, 2025
2924f76
client/modules/User/pages/EmailVerificationView: update to ts, no-verify
clairep94 Oct 26, 2025
1c693cf
client/modules/User/reducers: update root state of state.user to add …
clairep94 Oct 26, 2025
077a7a1
client/modules/User/pages/EmailVerificationView: add types for emailV…
clairep94 Oct 26, 2025
1b54a09
client/modules/User/pages/EmailVerificationView: update to named export
clairep94 Oct 26, 2025
5bf7264
client/modules/User/pages/CollectionView: update to ts, no-verify
clairep94 Oct 26, 2025
a8522af
client/modules/User/pages/CollectionView: add tests and update to nam…
clairep94 Oct 26, 2025
7c55b22
client/modules/User/pages/LoginView: update to ts, no-verify
clairep94 Oct 26, 2025
3e6989b
client/modules/User/pages/LoginView: update to named export
clairep94 Oct 26, 2025
9553375
client/modules/User/components/SocialAuthButton: update to ts, no-verify
clairep94 Oct 26, 2025
7bdec17
client/modules/User/components/SocialAuthButton: update to named expo…
clairep94 Oct 26, 2025
1433557
client/modules/User/components/SocialAuthButton: add types & add Soci…
clairep94 Oct 26, 2025
49ba368
client/modules/User/components/LoginForm: update to ts, no-verfy
clairep94 Oct 26, 2025
797eaae
client/modules/User/components/LoginForm: update to named export, no-…
clairep94 Oct 26, 2025
4fd42cf
client/modules/User/components/LoginForm: update with types & update …
clairep94 Oct 26, 2025
648c28c
client/modules/User/components/Notification: delete unused file
clairep94 Oct 26, 2025
18c0089
client/modules/User/pages/NewPasswordView: update to ts, no-verify
clairep94 Oct 26, 2025
d429c10
client/modules/User/pages/NewPasswordView: add types and update to na…
clairep94 Oct 26, 2025
dd243d9
client/modules/User/components/ResponseiveForm: delete unused file
clairep94 Oct 26, 2025
f646ab9
client/modules/User/pages/ResetPasswordView: update to ts, no-verify
clairep94 Oct 26, 2025
3b97607
client/modules/User/pages/ResetPasswordView: add types & update to na…
clairep94 Oct 26, 2025
f37b3a5
client/modules/User/components/NewPasswordForm: update to ts, no-verify
clairep94 Oct 26, 2025
4cae210
client/modules/User/components/NewPasswordForm: add types & update to…
clairep94 Oct 26, 2025
c1997aa
client/modules/User/pages/SignupView: update to ts, no-verify
clairep94 Oct 26, 2025
e5b0e14
client/modules/User/pages/SignupView: update to named export
clairep94 Oct 26, 2025
06b322b
client/modules/User/components/ResetPasswordForm: update to ts, no-ve…
clairep94 Oct 26, 2025
6df77e3
client/modules/User/components/ResetPasswordForm: update named export…
clairep94 Oct 26, 2025
53e920c
client/modules/User/components/SignupForm: update to ts, no-verify
clairep94 Oct 26, 2025
7c160fd
client/modules/User/components/SignupForm: add types and update to na…
clairep94 Oct 26, 2025
ca29c5f
client/modules/User/components/CookieConsent: update to ts, no-verify
clairep94 Oct 27, 2025
d7d60ec
client/modules/User/components/CookieConsent: add type dependencies, …
clairep94 Oct 27, 2025
3580301
client/modules/User/components/VisibilityDropdown: update to ts, no-v…
clairep94 Oct 27, 2025
6f14656
client/modules/User/components/VisibilityDropdown: update to named ex…
clairep94 Oct 27, 2025
7900ded
client/modules/About & client/modules/Legal: clean up Proptypes
clairep94 Oct 27, 2025
cc0f456
client/modules/User/components/DashboardTabSwitcher: update to ts, no…
clairep94 Oct 27, 2025
0a28f3b
client/modules/User/components/DashboardTabSwitcher: update to named …
clairep94 Oct 27, 2025
411d338
CollectionShareButton: update to ts, no-verify
clairep94 Oct 27, 2025
8ae732c
CollectionShareButton: update to named export, add ref type
clairep94 Oct 27, 2025
526d2b8
clean up stray leftover PropTypes
clairep94 Oct 27, 2025
4d9e1a4
client/modules/User/pages/AccountView: update to ts, no-verify
clairep94 Oct 27, 2025
8c40b78
client/modules/User/pages/AccountView: update to named export, resolv…
clairep94 Oct 27, 2025
2617c71
client/modules/User/components/AccountForm: update to ts, no-verify
clairep94 Oct 27, 2025
436396b
client/modules/User/components/AccountForm: add types & update to nam…
clairep94 Oct 27, 2025
cd780fa
client/modules/User/components/APIKeyForm: update to ts, no-verify
clairep94 Oct 27, 2025
38a714c
client/modules/User/components/APIKeyForm: add types & update to name…
clairep94 Oct 27, 2025
ecad537
client/modules/User/components/APIKeyList: update to ts,no-verify
clairep94 Oct 27, 2025
ab36ac3
client/modules/User/components/APIKeyList: add types, remove extra Pr…
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
1 change: 1 addition & 0 deletions client/common/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export interface ButtonProps extends React.HTMLAttributes<HTMLElement> {
* but React will automatically convert a boolean prop to the correct string value.
*/
focusable?: boolean;
label?: string;
}

interface StyledButtonProps extends ButtonProps {
Expand Down
40 changes: 26 additions & 14 deletions client/common/icons.jsx → client/common/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,25 @@ import Filter from '../images/filter.svg';
import Cross from '../images/cross.svg';
import Copy from '../images/copy.svg';

export interface IconColors {
default?: string;
hover?: string;
}

export interface IconProps extends React.SVGProps<SVGSVGElement> {
'aria-label'?: string;
Icon?: IconColors;
}

// HOC that adds the right web accessibility props
// https://www.scottohara.me/blog/2019/05/22/contextual-images-svgs-and-a11y.html

// could also give these a default size, color, etc. based on the theme
// Need to add size to these - like small icon, medium icon, large icon. etc.
function withLabel(SvgComponent) {
const StyledIcon = styled(SvgComponent)`
function withLabel(
SvgComponent: React.ComponentType<React.SVGProps<SVGSVGElement>>
) {
const StyledIcon = styled(SvgComponent)<IconProps>`
&&& {
color: ${(props) => props.Icon?.default};
& g,
Expand All @@ -53,27 +65,27 @@ function withLabel(SvgComponent) {
}
`;

const Icon = (props) => {
const { 'aria-label': ariaLabel } = props;
// Necessary because styled components inject a different type for the ref prop
type StyledIconProps = Omit<
React.ComponentProps<typeof StyledIcon>,
'ref'
> & {
ref?: React.Ref<SVGSVGElement>;
};

const Icon = (props: StyledIconProps) => {
const { 'aria-label': ariaLabel, ...rest } = props;
if (ariaLabel) {
return (
<StyledIcon
{...props}
{...rest}
aria-label={ariaLabel}
role="img"
focusable="false"
/>
);
}
return <StyledIcon {...props} aria-hidden focusable="false" />;
};

Icon.propTypes = {
'aria-label': PropTypes.string
};

Icon.defaultProps = {
'aria-label': null
return <StyledIcon {...rest} aria-hidden focusable="false" />;
};

return Icon;
Expand Down
24 changes: 13 additions & 11 deletions client/common/useSyncFormTranslations.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
import { useEffect, MutableRefObject } from 'react';
import type { FormApi } from 'final-form';

export interface FormLike {
getState(): { values: Record<string, unknown> };
reset(): void;
change(field: string, value: unknown): void;
}
// Generic FormLike that mirrors FormApi for any form value type
export type FormLike<FormValues = Record<string, unknown>> = Pick<
FormApi<FormValues>,
'getState' | 'reset' | 'change'
>;

/**
* This hook ensures that form values are preserved when the language changes.
* @param formRef
* @param language
*/
export const useSyncFormTranslations = (
formRef: MutableRefObject<FormLike>,
export const useSyncFormTranslations = <FormValues extends Record<string, any>>(
formRef: MutableRefObject<FormLike<FormValues> | null>,
language: string
) => {
useEffect(() => {
const form = formRef.current;
const form = formRef?.current;
if (!form) return;

const { values } = form.getState();
form.reset();

Object.keys(values).forEach((field) => {
if (values[field]) {
form.change(field, values[field]);
(Object.keys(values) as (keyof FormValues)[]).forEach((field) => {
const value = values[field];
if (value !== undefined && value !== null && value !== '') {
form.change(field, value);
}
});
}, [language]);
Expand Down
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
2 changes: 1 addition & 1 deletion client/modules/App/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { showReduxDevTools } from '../../store';
import DevTools from './components/DevTools';
import { setPreviousPath } from '../IDE/actions/ide';
import { setLanguage } from '../IDE/actions/preferences';
import CookieConsent from '../User/components/CookieConsent';
import { CookieConsent } from '../User/components/CookieConsent';

function hideCookieConsent(pathname) {
if (pathname.includes('/full/') || pathname.includes('/embed/')) {
Expand Down
2 changes: 1 addition & 1 deletion client/modules/IDE/components/Header/Toolbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import StopIcon from '../../../../images/stop.svg';
import PreferencesIcon from '../../../../images/preferences.svg';
import ProjectName from './ProjectName';
import VersionIndicator from '../VersionIndicator';
import VisibilityDropdown from '../../../User/components/VisibilityDropdown';
import { VisibilityDropdown } from '../../../User/components/VisibilityDropdown';
import { changeVisibility } from '../../actions/project';

const Toolbar = (props) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ exports[`Nav renders dashboard version for mobile 1`] = `
>
<test-file-stub
aria-hidden="true"
classname="icons__StyledIcon-sc-xmer15-0 kjSZIe"
classname="icons__StyledIcon-sc-1rmv3zl-0 bKwKVB"
focusable="false"
/>
</button>
Expand All @@ -367,7 +367,7 @@ exports[`Nav renders dashboard version for mobile 1`] = `
>
<test-file-stub
aria-hidden="true"
classname="icons__StyledIcon-sc-xmer15-0 kjSZIe"
classname="icons__StyledIcon-sc-1rmv3zl-0 bKwKVB"
focusable="false"
/>
</button>
Expand Down Expand Up @@ -971,7 +971,7 @@ exports[`Nav renders editor version for mobile 1`] = `
>
<test-file-stub
aria-hidden="true"
classname="icons__StyledIcon-sc-xmer15-0 kjSZIe"
classname="icons__StyledIcon-sc-1rmv3zl-0 bKwKVB"
focusable="false"
/>
</button>
Expand All @@ -987,7 +987,7 @@ exports[`Nav renders editor version for mobile 1`] = `
>
<test-file-stub
aria-hidden="true"
classname="icons__StyledIcon-sc-xmer15-0 kjSZIe"
classname="icons__StyledIcon-sc-1rmv3zl-0 bKwKVB"
focusable="false"
/>
</button>
Expand Down
2 changes: 1 addition & 1 deletion client/modules/IDE/components/SketchListRowBase.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { TableDropdown } from '../../../components/Dropdown/TableDropdown';
import { MenuItem } from '../../../components/Dropdown/MenuItem';
import { formatDateToString } from '../../../utils/formatDate';
import { getConfig } from '../../../utils/getConfig';
import VisibilityDropdown from '../../User/components/VisibilityDropdown';
import { VisibilityDropdown } from '../../User/components/VisibilityDropdown';

const ROOT_URL = getConfig('API_URL');

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;
Loading
Loading