From b3adf1a5fb21b3c8a398e6b52ee1ec06bf8ad7c4 Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Thu, 11 May 2023 13:58:56 -0400 Subject: [PATCH 1/6] Highlight interaction menu item when in interaction forms Fixes #3459 --- .../frontend/js_src/lib/components/Forms/ShowResource.tsx | 7 ++++--- .../frontend/js_src/lib/components/Interactions/config.ts | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/specifyweb/frontend/js_src/lib/components/Forms/ShowResource.tsx b/specifyweb/frontend/js_src/lib/components/Forms/ShowResource.tsx index fc198c77c2d..ae8dc0791fb 100644 --- a/specifyweb/frontend/js_src/lib/components/Forms/ShowResource.tsx +++ b/specifyweb/frontend/js_src/lib/components/Forms/ShowResource.tsx @@ -63,10 +63,11 @@ export function ShowResource({ useErrorContext('resource', resource); useMenuItem( - typeof recordSet === 'object' - ? 'recordSets' - : interactionTables.has(resource.specifyModel.name) + typeof recordSet === 'object' && + interactionTables.has(resource.specifyModel.name) ? 'interactions' + : typeof recordSet === 'object' + ? 'recordSets' : 'dataEntry' ); diff --git a/specifyweb/frontend/js_src/lib/components/Interactions/config.ts b/specifyweb/frontend/js_src/lib/components/Interactions/config.ts index 0761f0b863b..cfb7a98f672 100644 --- a/specifyweb/frontend/js_src/lib/components/Interactions/config.ts +++ b/specifyweb/frontend/js_src/lib/components/Interactions/config.ts @@ -37,4 +37,5 @@ export const interactionTables: ReadonlySet = new Set< 'LoanReturnPreparation', 'Permit', 'PermitAttachment', + 'RepositoryAgreement', ]); From 3b7db4e0d88872a0cb2e207e88c7ffce813ddcfb Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Thu, 11 May 2023 14:05:35 -0400 Subject: [PATCH 2/6] Fix failing test --- .../js_src/lib/components/Molecules/AutoComplete.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/specifyweb/frontend/js_src/lib/components/Molecules/AutoComplete.tsx b/specifyweb/frontend/js_src/lib/components/Molecules/AutoComplete.tsx index 3b7bb38455f..a36486d0e33 100644 --- a/specifyweb/frontend/js_src/lib/components/Molecules/AutoComplete.tsx +++ b/specifyweb/frontend/js_src/lib/components/Molecules/AutoComplete.tsx @@ -17,6 +17,8 @@ import type { TagProps } from '../Atoms/wrapper'; import { softFail } from '../Errors/Crash'; import { userPreferences } from '../Preferences/userPreferences'; import { Portal } from './Portal'; +import { Placement } from '@floating-ui/react'; +import { titlePosition } from './Tooltips'; const debounceRate = 300; @@ -102,7 +104,9 @@ export function AutoComplete({ | 'onKeyDown' | 'readOnly' | 'value' - >; + > & { + readonly [titlePosition]?: Placement; + }; readonly value: string; /* * For low-level access to the value in the input box before user finished From eb5ab196fe2cfb88c88f380e6536ea4d1610e565 Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Thu, 11 May 2023 18:10:17 +0000 Subject: [PATCH 3/6] Lint code with ESLint and Prettier Triggered by 3b7db4e0d88872a0cb2e207e88c7ffce813ddcfb on branch refs/heads/issue-3459 --- .../frontend/js_src/lib/components/Molecules/AutoComplete.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specifyweb/frontend/js_src/lib/components/Molecules/AutoComplete.tsx b/specifyweb/frontend/js_src/lib/components/Molecules/AutoComplete.tsx index a36486d0e33..d3051ea387e 100644 --- a/specifyweb/frontend/js_src/lib/components/Molecules/AutoComplete.tsx +++ b/specifyweb/frontend/js_src/lib/components/Molecules/AutoComplete.tsx @@ -1,3 +1,4 @@ +import type { Placement } from '@floating-ui/react'; import { Combobox } from '@headlessui/react'; import React from 'react'; import _ from 'underscore'; @@ -17,8 +18,7 @@ import type { TagProps } from '../Atoms/wrapper'; import { softFail } from '../Errors/Crash'; import { userPreferences } from '../Preferences/userPreferences'; import { Portal } from './Portal'; -import { Placement } from '@floating-ui/react'; -import { titlePosition } from './Tooltips'; +import type { titlePosition } from './Tooltips'; const debounceRate = 300; From 71b9edcb3ab37358e5e8fb27f61bfe017215cfe6 Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Fri, 12 May 2023 12:10:58 -0400 Subject: [PATCH 4/6] Highlight the wrtie menu items when in data entry forms --- .../frontend/js_src/lib/components/Forms/ShowResource.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specifyweb/frontend/js_src/lib/components/Forms/ShowResource.tsx b/specifyweb/frontend/js_src/lib/components/Forms/ShowResource.tsx index ae8dc0791fb..cee71216405 100644 --- a/specifyweb/frontend/js_src/lib/components/Forms/ShowResource.tsx +++ b/specifyweb/frontend/js_src/lib/components/Forms/ShowResource.tsx @@ -66,7 +66,7 @@ export function ShowResource({ typeof recordSet === 'object' && interactionTables.has(resource.specifyModel.name) ? 'interactions' - : typeof recordSet === 'object' + : typeof recordSet === 'object' && typeof recordSetId === 'number' ? 'recordSets' : 'dataEntry' ); From be225c7f338e1c48da285213b3eb8c60c53950a1 Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Fri, 12 May 2023 16:17:44 +0000 Subject: [PATCH 5/6] Lint code with ESLint and Prettier Triggered by 71b9edcb3ab37358e5e8fb27f61bfe017215cfe6 on branch refs/heads/issue-3459 --- .../frontend/js_src/lib/components/Forms/ShowResource.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specifyweb/frontend/js_src/lib/components/Forms/ShowResource.tsx b/specifyweb/frontend/js_src/lib/components/Forms/ShowResource.tsx index cee71216405..982bb838f54 100644 --- a/specifyweb/frontend/js_src/lib/components/Forms/ShowResource.tsx +++ b/specifyweb/frontend/js_src/lib/components/Forms/ShowResource.tsx @@ -15,11 +15,11 @@ import { getModel, schema } from '../DataModel/schema'; import type { RecordSet } from '../DataModel/types'; import { RecordSetWrapper } from '../FormSliders/RecordSet'; import { useMenuItem } from '../Header/useMenuItem'; +import { interactionTables } from '../Interactions/config'; import { ProtectedTable } from '../Permissions/PermissionDenied'; import { NotFoundView } from '../Router/NotFoundView'; import { locationToState, useStableLocation } from '../Router/RouterState'; import { CheckLoggedInCollection, ViewResourceByGuid } from './DataTask'; -import { interactionTables } from '../Interactions/config'; export function ShowResource({ resource, From ad9269426425529520a28834fc26a52357f35e6d Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Mon, 15 May 2023 10:08:42 -0700 Subject: [PATCH 6/6] Highlight proper item menu in the side bar --- .../frontend/js_src/lib/components/Forms/ShowResource.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/specifyweb/frontend/js_src/lib/components/Forms/ShowResource.tsx b/specifyweb/frontend/js_src/lib/components/Forms/ShowResource.tsx index 982bb838f54..550f63fccda 100644 --- a/specifyweb/frontend/js_src/lib/components/Forms/ShowResource.tsx +++ b/specifyweb/frontend/js_src/lib/components/Forms/ShowResource.tsx @@ -63,11 +63,10 @@ export function ShowResource({ useErrorContext('resource', resource); useMenuItem( - typeof recordSet === 'object' && - interactionTables.has(resource.specifyModel.name) - ? 'interactions' - : typeof recordSet === 'object' && typeof recordSetId === 'number' + typeof recordSetId === 'number' ? 'recordSets' + : interactionTables.has(resource.specifyModel.name) + ? 'interactions' : 'dataEntry' );