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

Date ordering preference for recipes #1704

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

Conversation

fredex42
Copy link
Contributor

@fredex42 fredex42 commented Oct 21, 2024

What's changed?

  • Compatibility with https://github.com/guardian/recipe-search-backend/pull/48, which adds the ability to prefer most recent recipes in the search results
  • Fix long-standing bug where the search results disappear when recipes are loaded in from the clipboard or a container
  • Adds the option to completely override the feed item body in FeedItem
  • Optionally shows the modified and last published times for recipes in the Feed

date_priority_search

Implementation notes

See the recipe-search-backend PR for an explanation of what "prefer" actually means

Checklist

General

  • 🤖 Relevant tests added - None of the touched code currently has tests
  • ✅ CI checks / tests run locally
  • 🔍 Checked on CODE

Client

  • 🚫 No obvious console errors on the client (i.e. React dev mode errors)
  • 🎛️ No regressions with existing user interactions (i.e. all existing buttons, inputs etc. work)
  • 📷 Screenshots / GIFs of relevant UI changes included

@fredex42 fredex42 requested a review from a team as a code owner October 21, 2024 13:58
Copy link
Contributor

@emdash-ie emdash-ie left a comment

Choose a reason for hiding this comment

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

A couple of questions, but happy for you to merge!

@@ -45,6 +45,7 @@ interface WrapperProps {
toolTipAlign: 'left' | 'center' | 'right';
urlPath: string | undefined;
renderButtons: (renderProps: ButtonProps) => JSX.Element;
noPinboard?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

Calling this noPinboard feels like a bit of a double negative: noPinboard={true} takes me a second to think about. Could we make it showPinboard or enablePinboard?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I know what you mean.... the reason I did it like this is because the pinboard changes are nothing to do with me so it felt better to keep the "default" behaviour to show pinboard (as I don't know what else that may affect) and set the override to hide it rather than vice-versa

Copy link
Contributor

Choose a reason for hiding this comment

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

You could have the prop default to true if not specified, no?

Comment on lines +112 to +113
case 'default':
return undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

To be more explicit about how unknown values are handled, could we add a default case here?

Suggested change
case 'default':
return undefined;
case 'default':
default:
return undefined;

);
}}
>
<option value={'Relevance'}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Using an uppercase R here feels inconsistent. I suppose it’s signalling that this option isn’t a field name? I think I’d still prefer lowercase.

@Divs-B
Copy link
Contributor

Divs-B commented Oct 22, 2024

I tested on Most recent published with search word Salad but result is not changing for me the one I got earlier is the same I am getting on selecting recent published too and it seems they are not in expected order for published?:

image

Network payload for search endpioint can be seen as : {queryText: "Salad", uprateByDate: "publishedDate", noStats: true}
and with response as:
image

Let me know if I have missed anything. thanks.
Note: this is I checked locally so pointing to CODE recipe.

@Divs-B
Copy link
Contributor

Divs-B commented Oct 22, 2024

When always show date is ON, few recipes are not showing dates under their titles.
One recipe where date is not mentioned it is not available also when clicked to view(we need to check this if recipe is not available then how we can show that recipe in the feed it shud be under Recipe not found i think, but can check in detail).
Here recipe: Grilled nectarine & burrata salad with pickled onions, tomato and mint which is not available when click to view.
image


And this one: this has no dates as well but this recipe is available when click to view.
image

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.

3 participants