Build an interface to visualize a list of URLs as a tree, enable filtering and selection, and trigger a GraphQL mutation with selected nodes.
- React
- Redux
- PrimeReact
- Apollo Client (GraphQL)
- JavaScript (no TypeScript)
You will be querying a mock GraphQL endpoint to retrieve a list of URLs. Each URL will follow this format:
https://application/client/template/site-edition
The query is already defined in the file:
📄 src/graphql/operations.js
query GetUrls {
urls
}This returns a hardcoded list of sample URLs via a mocked Apollo Link — no backend setup is needed.
Hint: Use the useQuery hook from Apollo Client to fetch the URLs.
-
Parse the list of URLs into a hierarchical tree structure with 5 levels:
- Application
- Client
- Template
- Site Edition
- Full URL (leaf node)
-
Use PrimeReact's Tree component to display the tree.
-
Enable multi-selection with checkboxes.
-
Selecting any parent node (e.g., a Client or Template) should automatically select all descendant leaf nodes (full URLs).
-
Store only the leaf-level full URLs in Redux state — not the entire tree.
-
Show a list of selected URLs on screen. This list should update dynamically as the user selects or deselects tree nodes.
ApplicationA
├── ClientA
│ ├── Template1
│ │ ├── Edition1
│ │ │ └── https://ApplicationA/ClientA/Template1/Edition1
│ │ └── Edition2
│ │ └── https://ApplicationA/ClientA/Template1/Edition2
│ └── Template2
│ └── Edition1
│ └── https://ApplicationA/ClientA/Template2/Edition1
└── ClientB
└── Template3
└── Edition1
└── https://ApplicationA/ClientB/Template3/Edition1
dashboard
├── acme
│ ├── blog
│ │ ├── dev
│ │ │ └── https://dashboard/acme/blog/dev
│ │ └── prod
│ │ └── https://dashboard/acme/blog/prod
│ └── news
│ └── v1
│ └── https://dashboard/acme/news/v1
└── globex
└── landing
└── v2
└── https://dashboard/globex/landing/v2
-
✅ Should automatically select both of these leaf URLs:
https://dashboard/acme/blog/devhttps://dashboard/acme/blog/prod
-
🔁 Deselecting
blogwill remove both from selection.
This behavior should apply recursively for all upper-level nodes (application → client → template → site edition).
- Add multiselect dropdowns using PrimeReact to filter:
- Applications
- Clients
- Templates
- Site Editions
- These filters should dynamically update the tree content.
Suggestion: Give it some thought before starting. Maybe there is an optimal way to do it.
When the user clicks a Submit button, trigger a GraphQL mutation with the selected URLs.
The mutation is defined in:
📄 src/graphql/operations.js
mutation SubmitUrls($urls: [String!]!) {
submitUrls(urls: $urls) {
success
message
}
}- This mutation is mocked using a custom Apollo Link.
- It logs the submitted URLs to the browser console and returns a mock success response.
- You do not need to build a backend.
Hint: Use the useMutation hook from Apollo Client to trigger the mutation.
- Do not worry about styling – making the app visually attractive is not a priority.
- You are encouraged to use AI tools, the internet, or any form of external help.
- There are no restrictions – you may create any files, folders, or install any npm packages you feel are helpful.
- Just be prepared to discuss and defend your implementation decisions in a follow-up conversation.
To run the project locally:
# Install dependencies
npm install
# Start the development server
npm start- Fork this repository.
- Implement your solution.
- Open a pull request with your changes.