From b8941b3b4ad65f8ca69801a82ec25b489d20c398 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anne=20L=27H=C3=B4te?= Date: Wed, 8 Jan 2025 11:37:50 +0100 Subject: [PATCH] fieat(openalex): Simpify UX --- .../components/send-feedback-button.jsx | 5 +++++ .../src/pages/openalex-affiliations/results/index.jsx | 11 ++++++++--- client/src/pages/openalex-affiliations/search.jsx | 1 + 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/client/src/pages/openalex-affiliations/components/send-feedback-button.jsx b/client/src/pages/openalex-affiliations/components/send-feedback-button.jsx index 64537f2..8353a35 100644 --- a/client/src/pages/openalex-affiliations/components/send-feedback-button.jsx +++ b/client/src/pages/openalex-affiliations/components/send-feedback-button.jsx @@ -93,6 +93,11 @@ export default function SendFeedbackButton({ className, corrections, resetCorrec setUserEmail(e.target.value)} + onKeyDown={(e) => { + if (e.key === 'Enter' && corrections.length > 0 && validEmail) { + sendFeedback(); + } + }} required type="email" /> diff --git a/client/src/pages/openalex-affiliations/results/index.jsx b/client/src/pages/openalex-affiliations/results/index.jsx index 9f6a244..a35179b 100644 --- a/client/src/pages/openalex-affiliations/results/index.jsx +++ b/client/src/pages/openalex-affiliations/results/index.jsx @@ -612,12 +612,17 @@ export default function Affiliations() { setRor(e.target.value)} + onKeyDown={(e) => { + if (e.key === 'Enter' && ror.length > 0) { + getCleanRor(); + } + }} value={ror} - label="ROR" - hint='Enter a valid ROR id and "check" it with ROR API' /> diff --git a/client/src/pages/openalex-affiliations/search.jsx b/client/src/pages/openalex-affiliations/search.jsx index 0c2d8cf..2515104 100644 --- a/client/src/pages/openalex-affiliations/search.jsx +++ b/client/src/pages/openalex-affiliations/search.jsx @@ -26,6 +26,7 @@ const { VITE_APP_TAG_LIMIT } = import.meta.env; const START_YEAR = 2010; // Generate an array of objects with all years from START_YEAR const years = [...Array(new Date().getFullYear() - START_YEAR + 1).keys()] + .sort((a, b) => b - a) .map((year) => (year + START_YEAR).toString()) .map((year) => ({ label: year, value: year }));