Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'visited link' indicator #174

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

bryophyta
Copy link
Contributor

@bryophyta bryophyta commented Feb 24, 2025

What does this change?

  • Store the ids of viewed items in state, and sync with localstorage
  • Differentiate between items that have been viewed and that haven't:
    • Bolder text on unviewed items
    • Remove colour from supplier badge when the item has been viewed
    • Add visually hidden text indicating status, for screen reader users
  • Other changes to balance out the new design:
    • Less blank space between the sections of the page (especially item view on desktop)
    • Adjust selection/hover styling for cards

nb. I looked at using the :visited pseudo-selector for this styling, to make use of the browser's built-in behaviour. However, this selector matches on the whole URL, including search params, which doesn't work for our purposes, because we don't want to treat /item/123?search=a as a separate page from /item/123?search=b. (The styling is meant ot indicate that you've viewed item 123.)

How to test

  • Look at screenshots
  • Deploy locally

How can we measure success?

Have we considered potential risks?

Images

Before After
Item selected image image
Item has been viewed image image
Page layout image image

Accessibility

@@ -51,7 +51,7 @@ export function urlToConfig(location: {
} else if (page.startsWith('item/') && page.split('/').length === 2) {
return { view: 'item', itemId: page.split('/')[1], query };
} else {
console.warn(`Page not found: "${page}", so using defaultConfig`);
console.log(`Page not found: "${page}", so using defaultConfig`);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Having this as a warn was making the logs quite noisy when running tests. Given that we're not storing client-side logs in production, there doesn't seem much benefit to keeping this as a warn, as opposed to a log.

@bryophyta bryophyta force-pushed the pf/visited-link-indicator branch from 5711e85 to c98d263 Compare February 24, 2025 12:29
@bryophyta bryophyta force-pushed the pf/visited-link-indicator branch from c98d263 to 6eb8d95 Compare February 24, 2025 12:41
@bryophyta bryophyta marked this pull request as ready for review February 24, 2025 12:45
@bryophyta bryophyta requested a review from a team as a code owner February 24, 2025 12:45
@bryophyta bryophyta changed the title Pf/visited link indicator Add 'visited link' indicator Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant