-
Notifications
You must be signed in to change notification settings - Fork 26
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
[PRD-610] feat: Allow click on searched file's path #2246
Conversation
In the search, we display the folder path for files results. It is not possible to click on it, to directly open the folder rather than the file itself.
BundleMonFiles updated (1)
Unchanged files (12)
Total files change +150B 0% Final result: ✅ View report in BundleMon website ➡️ |
primaryText={result.primary} | ||
secondaryText={result.secondary} | ||
secondaryUrl={result.secondaryUrl} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
est-ce qu'on a besoin de rajouter ces 2 props qui ne sont au final utilisé que par SuggestionItemTextSecondary ? 🤔 Est-ce qu'on peut pas plutôt générer le lien en amont et transmettre un composant via secondaryText
? Car au final ici on ne fait qu'afficher autre chose en secondaryText selon certaines conditions...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l'API de search ne peut pas transmettre un composant, ça va passer par le dataproxy et de la sérialisation. Et ça me semble bien qu'elle n'ait aucune responsabilité UI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
j'ai pas compris le rapport avec l'API. Ici je parle des composants front qu'on a construit dans l'app. Ce qu'on fait ici c'est que dans un certain cas (quand y'a une url) on veut afficher un lien plutôt qu'un texte, et ce au final dans un ListItemText en prop "secondary". Au lieu de passer result.secondaryUrl je me demandais si on ne pouvait pas rester avec la prop secondaryText, sauf qu'on ne lui passerait pas result.secondary mais un composant (celui nécessaire pour construire le lien)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah je pensais que tu parlais côté dataproxy. Pas d'avis particulier, si ce n'est que ça marche comme ça et n'apporte pas de désavantage particulier 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on peut squash les 2 commits je pense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
J'ai voulu laisser la contribution de @Ldoppea 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding is that this PR and cozy/cozy-libs#2615 are both retro-compatible as we only add new attributes and in cozy-home we fallback to previous behaviour when url
is not set. Is that correct? If yes feel free to merge it.
return <SuggestionItemTextHighlighted text={text} query={query} /> | ||
} | ||
|
||
const app = { slug } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: For now it is not a problem, but <AppLink>
may need other props like app.mobile
to correctly handle some links. This prop is used only by the flagship app and to open cozy-pass links, so we are safe for now.
const SuggestionItemTextSecondary = ({ text, query, url, slug }) => { | ||
const { isMobile } = useBreakpoints() | ||
|
||
if (isMobile || !url) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we secure this by checking also the value of slug
in addition to url
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so, because I tested with an undefined
slug, and it still works 🤷
This does not look mandatory, but AppLinker complains if it is missing, so I kept it
Your understanding is correct 👍 |
See also cozy/cozy-libs#2615