Skip to content
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
0cd54e0
fix(server): handle unhandledRejection and catch sync SSR errors to a…
ichim-david Oct 16, 2025
dcb6bfe
fix(UniversalLink): return null for array hrefs and guard external check
ichim-david Oct 16, 2025
6aaab04
fix(server): remove global unhandledRejection and use request-scoped …
ichim-david Oct 16, 2025
db402f5
fix(UniversalLink): guard url before checking for @@display-file to a…
ichim-david Oct 16, 2025
7af4a93
fix(UniversalLink): guard url when checking isInternalURL to avoid er…
ichim-david Oct 17, 2025
a56d7d4
feat(docs): add AGENTS.md with repository guidelines (project overvie…
ichim-david Oct 17, 2025
974ca27
docs(AGENTS): specify Volto 17.20.0+ and Plone 6; expand File Structu…
ichim-david Oct 17, 2025
c6ae82e
fix(print): loading of plotly charts by scrolling to the bottom of th…
ichim-david Oct 20, 2025
c35da3e
fix(print): await all content before printing and use pageDocument sc…
ichim-david Oct 22, 2025
df9d465
update jest addon with improvements made in volto-listing-block
ichim-david Oct 22, 2025
ecff183
test(print): expand setupPrintView tests to cover iframes, images, pl…
ichim-david Oct 22, 2025
cb23dc8
test(user-select-widget): add helpers and expand unit tests
ichim-david Oct 22, 2025
c59da27
move ignoredErrors outside of function to avoid recreation
ichim-david Oct 23, 2025
cddfd3f
refactor: reset PDF printing improvements to develop branch, moving t…
ichim-david Oct 23, 2025
c976d8a
Merge branch 'develop' into contents_crash
avoinea Nov 4, 2025
a51032c
Apply suggestions from code review
ichim-david Nov 17, 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
83 changes: 83 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Repository Guidelines

## Project Overview

This repository contains the `volto-eea-website-theme`, a Volto addon that provides the website theme for the European Environment Agency (EEA). It includes custom components, styles, and functionality to align with the EEA's branding and requirements. The primary technologies are React (via Volto 17.20.0+), LESS for styling, and Plone 6 as the backend CMS.

## Project Structure & Modules

- `src/`: add-on source (entry: `src/index.js`, config in `src/config.js`).
- `src/components/`, `src/hooks/`, `src/helpers/`, `src/actions/`, `src/reducers/`, `src/icons/`, `src/customizations/`: feature modules.
- `theme/`: LESS/CSS overrides and assets.
- `locales/`: i18n messages.
- `cypress/`: E2E tests; config in `cypress.config.js`.
- Root tooling: `Makefile`, `jest-addon.config.js`, `razzle.extend.js`, `Dockerfile`, `docker-compose.yml`.

## File Structure

```
src/
├── components/
│ ├── theme/ # Theme-specific components
│ │ ├── Homepage/ # Homepage layouts
│ │ ├── Widgets/ # Custom widgets
│ │ ├── CustomCSS/ # Custom CSS injection
│ │ ├── DraftBackground/ # Draft mode background
│ │ ├── NotFound/ # 404 page
│ │ └── PrintLoader/ # Print functionality
│ └── manage/ # Management components
│ └── Blocks/ # Custom blocks
├── customizations/ # Volto component overrides
│ ├── volto/ # Core Volto customizations
│ └── @root/ # Root-level customizations
├── middleware/ # Express middleware
├── helpers/ # Utility functions
├── reducers/ # Redux reducers
├── slate.js # Slate editor configuration
├── config.js # Theme configuration
└── index.js # Addon configuration
```

## Dependencies

- **@eeacms/volto-anchors**: Anchor link functionality
- **@eeacms/volto-block-style**: Block styling integration
- **@eeacms/volto-block-toc**: Table of contents functionality
- **@eeacms/volto-eea-design-system**: EEA design system components
- **@eeacms/volto-group-block**: Group block functionality
- **volto-subsites**: Subsite management

## Build, Test, and Development

- `make`: build Docker images for backend/frontend.
- `make start`: start Plone backend (:8080) and Volto (:3000).
- `make test` / `make test-update`: run Jest / update snapshots.
- `make cypress-open` / `make cypress-run`: open/run Cypress E2E.
- Lint/format: `make lint`, `make lint-fix`, `make stylelint[-fix]`, `make prettier[-fix]`.
- Git hooks: `yarn prepare` (runs Husky setup).

## Coding Style & Naming

- Language: JS/JSX; 2-space indent; single quotes; Prettier defaults.
- Linting: ESLint extends Volto; Stylelint for `*.css|*.less`.
- Aliases: prefer `@package`, `@plone/volto`, and `~` over deep relative paths.
- Naming: components `PascalCase.jsx`; hooks `useXxx.js`; helpers `camelCase.js`.
- Before push: `make lint-fix && make prettier-fix && make stylelint-fix`.

## Testing Guidelines

- Unit tests: Jest; place near code under `src/`; name `*.test.js[x]`.
- Coverage: thresholds defined in `jest-addon.config.js` (baseline 5%); raise when adding features.
- E2E: Cypress base URL `http://localhost:3000`; ensure stack is running (`make start`).

## Commit & Pull Request Guidelines

- Messages: imperative, concise; use types like `feat:`, `fix:`, `change(scope):`, `chore:`; reference issues (`refs #123`, `closes #123`).
- PRs: include summary, linked issues, UI screenshots for visual changes, and notes on testing. Keep scope focused.
- Ensure CI passes: lint, unit tests, and (when relevant) Cypress run.

## Security & Configuration Tips

- Backend URL via `.env` or Make variables (e.g., `RAZZLE_DEV_PROXY_API_PATH`, default `http://localhost:8080/Plone`).
- CSP/nonces support is present; review `src/config.js` if adjusting headers.
- Never commit secrets; `.env` is ignored. Use environment variables in CI.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ const UniversalLink = ({
}) => {
const token = useSelector((state) => state.userSession?.token);

if (Array.isArray(href)) {
// eslint-disable-next-line no-console
console.error(
'Invalid href passed to UniversalLink, received an array as href instead of a string',
href,
);
return null;
}
let url = href;

if (!href && item) {
Expand Down Expand Up @@ -71,12 +79,12 @@ const UniversalLink = ({
url = url.includes('/@@download/file') ? url : `${url}/@@download/file`;
}

const isExternal = !isInternalURL(url);
const isExternal = url ? !isInternalURL(url) : false;
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good defensive programming to check if url is truthy before calling isInternalURL(url). However, consider what should happen when url is falsy. Currently isExternal will be false, which means the code will attempt to render a Link component with a falsy URL. This could lead to unexpected behavior. Consider adding an early return or additional validation when url is null/undefined/empty.

Copilot uses AI. Check for mistakes.
const isDownload =
(!isExternal && url && url.includes('@@download')) || download;

const isDisplayFile =
(!isExternal && url.includes('@@display-file')) || false;
(!isExternal && url && url.includes('@@display-file')) || false;
const checkedURL = URLUtils.checkAndNormalizeUrl(url);

// we can receive an item with a linkWithHash property set from ObjectBrowserWidget
Expand Down
Loading
Loading