From e076639b752ad4c0b60ff86673874c22985ca8b7 Mon Sep 17 00:00:00 2001 From: Nick Hellemans Date: Wed, 18 Dec 2024 11:36:37 +0100 Subject: [PATCH] fix(): miscl fixes and ui updates --- .../RemoteSingleSelectAction.tsx | 104 +++++++++++------- .../remoteSingleSelectAction.module.css | 29 +---- 2 files changed, 68 insertions(+), 65 deletions(-) diff --git a/src/components/Extension/CollectDataExtension/actions/RemoteSingleSelectAction/RemoteSingleSelectAction.tsx b/src/components/Extension/CollectDataExtension/actions/RemoteSingleSelectAction/RemoteSingleSelectAction.tsx index 563bf938..4417e018 100644 --- a/src/components/Extension/CollectDataExtension/actions/RemoteSingleSelectAction/RemoteSingleSelectAction.tsx +++ b/src/components/Extension/CollectDataExtension/actions/RemoteSingleSelectAction/RemoteSingleSelectAction.tsx @@ -1,11 +1,16 @@ import React, { FC, useCallback, useEffect, useMemo, useState } from 'react' import { mapActionFieldsToObject } from '../../../utils' +import activityClasses from '../../../../../../styles/ActivityLayout.module.css' import classes from './remoteSingleSelectAction.module.css' - import type { RemoteSingleSelectActionFields } from '../../types' import type { ExtensionActivityRecord } from '../../../types' import { useRemoteSingleSelectAction } from './hooks/useRemoteSingleSelectAction' -import { Button, Option, Select } from '@awell-health/ui-library' +import { + Button, + HostedPageFooter, + Option, + Select, +} from '@awell-health/ui-library' import { useTranslation } from 'next-i18next' import { isNil, debounce } from 'lodash' import { OptionSchema, type SelectOption } from './types' @@ -158,48 +163,69 @@ export const RemoteSingleSelectAction: FC = ({ [options] ) + const uiSelectOptions = useMemo(() => { + return options.map((o) => ({ + id: o.id, + label: o.label, + value: o.value, + value_string: o.value_string, + })) + }, [options]) + useEffect(() => { fetchOptionsDebounced() }, [searchText]) return ( -
-
- { + setSearchText(value) + }} + type="single" + value={selectedOption?.value ?? ''} + onChange={handleOptionChange} + mandatory={mandatory === 'true'} + filtering + /> + {!isNil(error) && ( +
{String(error) as string}
+ )} +
+
+ + +
+ +
+
+ ) } diff --git a/src/components/Extension/CollectDataExtension/actions/RemoteSingleSelectAction/remoteSingleSelectAction.module.css b/src/components/Extension/CollectDataExtension/actions/RemoteSingleSelectAction/remoteSingleSelectAction.module.css index d0237ba4..c23fd133 100644 --- a/src/components/Extension/CollectDataExtension/actions/RemoteSingleSelectAction/remoteSingleSelectAction.module.css +++ b/src/components/Extension/CollectDataExtension/actions/RemoteSingleSelectAction/remoteSingleSelectAction.module.css @@ -1,34 +1,11 @@ .container { - display: flex; - flex-direction: column; - align-items: center; - justify-content: space-between; - height: 100vh; - width: 70%; + width: 65ch; margin: 0 auto; - @media (max-width: 768px) { - padding: 0 20px; - width: 100%; - } -} - -.selectContainer { - margin-top: 40px; - width: 100%; -} - -.buttonContainer { - display: flex; - flex-direction: row; - align-items: center; - align-self: flex-end; - justify-content: center; - margin-bottom: 20px; - background-color: #f5f5f5; + padding: 0 var(--awell-spacing-4); } .error { color: red; font-size: 12px; margin-top: 10px; -} +} \ No newline at end of file