fix(TEAMMSBMOB-22402): UI исправления для ИО. Показываем description в виджете, а на странице в виде информера
This commit is contained in:
@@ -32,8 +32,7 @@ namespace List {
|
||||
const { records, isLoading, lastFailedError, loadNext, reload } = useListRecords(count, isStrictCount);
|
||||
const showMoreButton = records.length > 0 && !lastFailedError && loadNext;
|
||||
const showReloadButton = lastFailedError && records.length > 0;
|
||||
const allowInformer =
|
||||
(isInformerAllowed === undefined ? defaultAllowInformer : isInformerAllowed) && !lastFailedError && !isLoading;
|
||||
const allowInformer = (isInformerAllowed === undefined ? defaultAllowInformer : isInformerAllowed) && !lastFailedError && !isLoading;
|
||||
|
||||
useEffect(() => {
|
||||
if (!isLoading && loadedRecords) {
|
||||
@@ -50,6 +49,7 @@ namespace List {
|
||||
)}
|
||||
<ListContent.Element
|
||||
isLoading={isLoading}
|
||||
isSystemResponseDescriptionAllowed={!allowInformer}
|
||||
lastElementVisibleHandler={infiniteLoading && showMoreButton && !isLoading ? loadNext : null}
|
||||
lastFailedError={lastFailedError}
|
||||
records={records}
|
||||
|
||||
@@ -12,13 +12,22 @@ namespace ListContent {
|
||||
type LastElementVisibleHandler = () => Promise<any>;
|
||||
export interface Props {
|
||||
isLoading: boolean;
|
||||
isSystemResponseDescriptionAllowed?: boolean
|
||||
lastFailedError: LIST_RECORDS_ERROR | null;
|
||||
records: OperationHistoryModel.Model[];
|
||||
lastElementVisibleHandler: LastElementVisibleHandler | null;
|
||||
reload(): void;
|
||||
}
|
||||
|
||||
export const Element = ({ isLoading, lastFailedError, records, lastElementVisibleHandler }: Props): ReactElement => {
|
||||
const systemResponseDescriptionAllowed = false;
|
||||
|
||||
export const Element = ({
|
||||
isLoading,
|
||||
lastFailedError,
|
||||
records,
|
||||
lastElementVisibleHandler,
|
||||
isSystemResponseDescriptionAllowed,
|
||||
}: Props): ReactElement => {
|
||||
if (isLoading && records.length === 0) {
|
||||
return (
|
||||
<S.LoaderWrapper>
|
||||
@@ -53,10 +62,17 @@ namespace ListContent {
|
||||
);
|
||||
}
|
||||
|
||||
const isDescriptionAllowed = isSystemResponseDescriptionAllowed ?? systemResponseDescriptionAllowed;
|
||||
|
||||
if (records.length === 0) {
|
||||
return (
|
||||
<S.InfoWrapper>
|
||||
<SystemResponse size="S" statusIcon="empty" text={LOCALIZATION.EMPTY_RECORDS_TITLE} />
|
||||
<SystemResponse
|
||||
{...(isDescriptionAllowed && { description: LOCALIZATION.EMPTY_RECORDS_DESCRIPTION })}
|
||||
size="M"
|
||||
statusIcon="empty"
|
||||
text={LOCALIZATION.EMPTY_RECORDS_TITLE}
|
||||
/>
|
||||
</S.InfoWrapper>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user