Skip to content

Commit

Permalink
Add ability to add entries from recommendations
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaKhatri committed Dec 4, 2023
1 parent 33d1cff commit 72cb094
Show file tree
Hide file tree
Showing 5 changed files with 202 additions and 63 deletions.
14 changes: 9 additions & 5 deletions app/views/EntryEdit/LeftPane/AssistItem/AssistPopup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ import {

import styles from './styles.css';

interface Props {
interface Props<NAME extends string | number | undefined> {
className?: string;
entryInputClassName?: string;
frameworkDetails: Framework;
leadId: string;
value: PartialEntryType;
onChange: (val: SetValueArg<PartialEntryType>, name: undefined) => void;
onChange: (val: SetValueArg<PartialEntryType>, name: NAME) => void;
error: Error<PartialEntryType> | undefined;
onEntryCreateButtonClick: () => void;
variant?: 'normal' | 'compact' | 'nlp';
Expand All @@ -45,16 +46,19 @@ interface Props {
hints: WidgetHint[] | undefined;
recommendations: PartialAttributeType[] | undefined;
predictionsErrored: boolean;
name: NAME;
messageText: string | undefined;
}

function AssistPopup(props: Props) {
function AssistPopup<NAME extends string | number | undefined>(props: Props<NAME>) {
const {
className,
entryInputClassName,
variant = 'nlp',
leadId,
value,
onChange,
name,
error,
frameworkDetails,
onEntryCreateButtonClick,
Expand Down Expand Up @@ -138,9 +142,9 @@ function AssistPopup(props: Props) {
/>
) : (
<EntryInput
className={styles.entryInput}
className={_cs(styles.entryInput, entryInputClassName)}
leadId={leadId}
name={undefined}
name={name}
error={error}
value={value}
onChange={onChange}
Expand Down
1 change: 1 addition & 0 deletions app/views/EntryEdit/LeftPane/AssistItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,7 @@ function AssistItem(props: Props) {
frameworkDetails={frameworkDetails}
value={value}
onChange={setValue}
name={undefined}
error={error}
leadId={leadId}
hints={allHints}
Expand Down
Loading

0 comments on commit 72cb094

Please sign in to comment.