Skip to content

Commit

Permalink
fix(portal): Push activity log UI issues
Browse files Browse the repository at this point in the history
  • Loading branch information
KsiBart committed Dec 9, 2024
1 parent 8f6ed4b commit 001f61c
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DatePicker, Flex, Form, Modal, Radio, Spin } from "antd";
import styles from "./index.module.scss";
import { useCallback } from "react";
import { useCallback, useMemo } from "react";
import { capitalize } from 'lodash';
import dayjs from 'dayjs';
import { useGetProductEnvActivitiesMutation } from '@/hooks/product';
Expand Down Expand Up @@ -76,14 +76,22 @@ const PushHistoryModal = ({
[]
);

const isFormValid = useMemo(() => {
const { envId, requestTime } = form.getFieldsValue();
return !!(responseData && responseData.data.total > 0 && envId && requestTime)
}, [responseData, form])

return (
<Modal
open={isOpen}
onCancel={onClose}
onOk={handleOK}
title="Push log"
className={styles.modal}
okButtonProps={{ disabled: !isSuccess, "data-testid": "pushLog-btn" }}
okButtonProps={{
disabled: !isFormValid,
"data-testid": "pushLog-btn"
}}
>
<Form
form={form}
Expand All @@ -108,12 +116,12 @@ const PushHistoryModal = ({
required
className={styles.rangePicker}
>
<RangePicker placeholder={["Select time", "Select time"]} disabledDate={disabled7DaysDate} />
<RangePicker placeholder={["Select time", "Select time"]} disabledDate={disabled7DaysDate} maxDate={dayjs().endOf('day')} />
</Form.Item>

<Flex justify={isPending ? "center" : "start"}>
<Spin spinning={isPending}>
{responseData?.data?.total && <Flex vertical className={styles.numberContainer} gap={5}>
{responseData?.data && <Flex vertical className={styles.numberContainer} gap={5}>
<div>
Number of activity logs filtered
</div>
Expand All @@ -124,8 +132,6 @@ const PushHistoryModal = ({
}
</Spin>
</Flex>


</Form>
</Modal>
);
Expand Down

0 comments on commit 001f61c

Please sign in to comment.