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
8 changes: 7 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"tsx": "never"
}
],
"react/jsx-filename-extension": [1, { "extensions": [".jsx", ".tsx"] }],
"comma-dangle": 0, // not sure why airbnb turned this on. gross!
"default-param-last": 0,
"no-else-return" :0,
Expand Down Expand Up @@ -126,7 +127,12 @@
{
"files": ["*.ts", "*.tsx"],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"]
"plugins": ["@typescript-eslint"],
"rules": {
"no-use-before-define": "off",
"import/no-extraneous-dependencies": "off",
"no-unused-vars": "off"
}
},
{
"files": ["*.stories.@(js|jsx|ts|tsx)"],
Expand Down
40 changes: 40 additions & 0 deletions client/components/SkipLink.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { render, screen, fireEvent } from '@testing-library/react';
import React from 'react';
import { useTranslation } from 'react-i18next';
import '@testing-library/jest-dom';
import SkipLink from './SkipLink';

jest.mock('react-i18next', () => ({
useTranslation: () => ({
t: (key: string) => key
})
}));

describe('SkipLink', () => {
const defaultProps = {
targetId: 'main-content',
text: 'goToMain'
};

test('renders with correct href and text', () => {
render(<SkipLink {...defaultProps} />);
const link = screen.getByRole('link');

expect(link).toBeInTheDocument();
expect(link).toHaveAttribute('href', '#main-content');
expect(link).toHaveTextContent('SkipLink.goToMain');
});

test('adds "focus" class on focus and removes it on blur', () => {
render(<SkipLink {...defaultProps} />);
const link = screen.getByRole('link');

expect(link.className).toBe('skip_link');

fireEvent.focus(link);
expect(link.className).toContain('focus');

fireEvent.blur(link);
expect(link.className).toBe('skip_link');
});
});
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import React, { useState } from 'react';
import classNames from 'classnames';
import PropTypes from 'prop-types';
import { useTranslation } from 'react-i18next';

const SkipLink = ({ targetId, text }) => {
type SkipLinkProps = {
targetId: string,
text: string
};

const SkipLink = ({ targetId, text }: SkipLinkProps) => {
const [focus, setFocus] = useState(false);
const { t } = useTranslation();
const handleFocus = () => {
Expand All @@ -27,9 +31,4 @@ const SkipLink = ({ targetId, text }) => {
);
};

SkipLink.propTypes = {
targetId: PropTypes.string.isRequired,
text: PropTypes.string.isRequired
};

export default SkipLink;
13 changes: 0 additions & 13 deletions client/modules/IDE/components/Header/MobileNav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,9 @@
const userIsOwner = user?.username === project.owner?.username;
const Logo = AsteriskIcon;

const showPrivacyToggle =
project?.owner && title === project.name && userIsOwner;
const showOwner = project?.owner && title === project.name && !userIsOwner;

const toggleVisibility = (e) => {

Check warning on line 254 in client/modules/IDE/components/Header/MobileNav.jsx

View workflow job for this annotation

GitHub Actions / Test and lint code base

'toggleVisibility' is assigned a value but never used
try {
const isChecked = e.target.checked;
dispatch(
Expand All @@ -274,17 +272,6 @@
</LogoContainer>
<Title>
<h1>{title === project?.name ? <ProjectName /> : title}</h1>
{showPrivacyToggle && (
<main className="toolbar__makeprivate">
<p>Private</p>
<input
className="toolbar__togglevisibility"
type="checkbox"
onChange={toggleVisibility}
defaultChecked={project.visibility === 'Private'}
/>
</main>
)}
{showOwner && <h5>by {project?.owner?.username}</h5>}
</Title>

Expand Down
1 change: 0 additions & 1 deletion client/modules/IDE/components/Header/Toolbar.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect, useCallback } from 'react';

Check warning on line 1 in client/modules/IDE/components/Header/Toolbar.jsx

View workflow job for this annotation

GitHub Actions / Test and lint code base

'useEffect' is defined but never used

Check warning on line 1 in client/modules/IDE/components/Header/Toolbar.jsx

View workflow job for this annotation

GitHub Actions / Test and lint code base

'useState' is defined but never used
import classNames from 'classnames';
import PropTypes from 'prop-types';
import { useTranslation } from 'react-i18next';
Expand Down Expand Up @@ -122,7 +122,6 @@
</div>
)}

{/* ✅ Still show owner if not you */}
{project?.owner && !userIsOwner && (
<p className="toolbar__project-owner">
{t('Toolbar.By')}{' '}
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 @@ -125,7 +125,7 @@ const SketchListRowBase = ({
<th scope="row">{name}</th>
<td>{formatDateCell(sketch.createdAt, mobile)}</td>
<td>{formatDateCell(sketch.updatedAt, mobile)}</td>
<td hidden={!userIsOwner}>
<td hidden={!userIsOwner || mobile}>
<VisibilityDropdown
sketch={sketch}
onVisibilityChange={handleVisibilityChange}
Expand Down
12 changes: 9 additions & 3 deletions client/styles/components/_visibility-dropdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

@include themify() {
border-bottom: 1px solid getThemifyVariable("modal-border-color");
background-color: white;
background-color: getThemifyVariable("modal-background-color");
}

&:last-child {
Expand All @@ -54,14 +54,20 @@

&:hover {
@include themify() {
background-color: getThemifyVariable("table-row-stripe-color") !important;
background-color: getThemifyVariable("file-selected-color") !important;
}
}

&.selected {
@include themify() {
background-color: getThemifyVariable("search-background-color");
background-color: getThemifyVariable("table-row-stripe-color");
}

// &:hover {
// @include themify() {
// background-color: getThemifyVariable("table-row-stripe-color") !important;
// }
// }
}
}

Expand Down
2 changes: 2 additions & 0 deletions common/p5Versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ export const currentP5Version = '1.11.8'; // Don't update to 2.x until 2026
// JSON.stringify([...document.querySelectorAll('._132722c7')].map(n => n.innerText), null, 2)
// TODO: use their API for this to grab these at build time?
export const p5Versions = [
'2.0.4',
'2.0.3',
'2.0.2',
'2.0.1',
'2.0.0',
'1.11.9',
'1.11.8',
'1.11.7',
'1.11.6',
Expand Down
1 change: 1 addition & 0 deletions contributor_docs/preparing_a_pull_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Pull-requests are easier when your code is up to date!
Before submitting a pull request, make sure that:

- Your work is related to an issue. **Pull requests that do not have an associated issue will not be accepted.**
- **The issue is not already assigned to another contributor.** We follow a "first assigned, first served" approach to avoid duplicated work. If you open a PR for an issue that someone else is already working on, your PR will be closed.
- Your work adheres to the style guidelines and fits in with the rest of the codebase.
- You ran the project locally and tested your changes. Pay special attention to any specific areas of the p5.js editor that may be affected by your changes. Does everything still work as before? Great!

Expand Down
Loading