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

Highlight interaction menu item when in interaction forms #3481

Merged
merged 6 commits into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -63,7 +63,7 @@ export function ShowResource({
useErrorContext('resource', resource);

useMenuItem(
typeof recordSet === 'object'
typeof recordSetId === 'number'
? 'recordSets'
: interactionTables.has(resource.specifyModel.name)
? 'interactions'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ export const interactionTables: ReadonlySet<keyof Tables> = new Set<
'LoanReturnPreparation',
'Permit',
'PermitAttachment',
'RepositoryAgreement',
]);
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { Placement } from '@floating-ui/react';
import { Combobox } from '@headlessui/react';
import React from 'react';
import _ from 'underscore';
Expand All @@ -17,6 +18,7 @@ import type { TagProps } from '../Atoms/wrapper';
import { softFail } from '../Errors/Crash';
import { userPreferences } from '../Preferences/userPreferences';
import { Portal } from './Portal';
import type { titlePosition } from './Tooltips';

const debounceRate = 300;

Expand Down Expand Up @@ -102,7 +104,9 @@ export function AutoComplete<T>({
| 'onKeyDown'
| 'readOnly'
| 'value'
>;
> & {
readonly [titlePosition]?: Placement;
};
readonly value: string;
/*
* For low-level access to the value in the input box before user finished
Expand Down