Skip to content

Commit bf52cfe

Browse files
authored
feat: [BBND-1241] add getCouponAmountFor info in see coupon view (#723)
Signed-off-by: Luigi Navarro <luigi@io.builders> Signed-off-by: Mario Francia <mariofranciarius@gmail.com>
1 parent df876d0 commit bf52cfe

File tree

8 files changed

+510
-1045
lines changed

8 files changed

+510
-1045
lines changed

.changeset/afraid-views-post.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@hashgraph/asset-tokenization-dapp": minor
3+
---
4+
5+
Add getCouponAmountFor info (numerator, denominator, recordDateReached) to see coupon view

apps/ats/web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
3030
"@rollup/plugin-commonjs": "^28.0.6",
3131
"@testing-library/jest-dom": "^5.16.5",
32-
"@testing-library/react": "^14.0.0",
32+
"@testing-library/react": "^14.2.0",
3333
"@testing-library/user-event": "^14.4.3",
3434
"@types/format-util": "^1.0.2",
3535
"@types/jest": "^29.5.1",

apps/ats/web/src/hooks/queries/useCoupons.ts

Lines changed: 51 additions & 261 deletions
Large diffs are not rendered by default.

apps/ats/web/src/i18n/en/security/coupons.ts

Lines changed: 56 additions & 259 deletions
Large diffs are not rendered by default.

apps/ats/web/src/views/DigitalSecurityDetails/Components/Coupons/SeeCoupon.tsx

Lines changed: 105 additions & 275 deletions
Large diffs are not rendered by default.

apps/ats/web/src/views/DigitalSecurityDetails/Components/Coupons/__tests__/SeeCoupon.test.tsx

Lines changed: 259 additions & 211 deletions
Large diffs are not rendered by default.

apps/ats/web/src/views/DigitalSecurityDetails/Components/KYC/KYCModal.tsx

Lines changed: 32 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React from "react";
22
import {
33
HStack,
44
Modal,
@@ -10,33 +10,33 @@ import {
1010
ModalOverlay,
1111
ModalProps,
1212
VStack,
13-
} from '@chakra-ui/react';
14-
import { Button, InputController, PhosphorIcon, Text } from 'io-bricks-ui';
15-
import { useForm } from 'react-hook-form';
16-
import { useTranslation } from 'react-i18next';
17-
import { useGrantKYC } from '../../../../hooks/mutations/useKYC';
18-
import { GrantKycRequest } from '@hashgraph/asset-tokenization-sdk';
19-
import { useParams } from 'react-router-dom';
20-
import { FileArchive } from '@phosphor-icons/react';
21-
import { useRef, useState } from 'react';
22-
import { isValidHederaId, required } from '../../../../utils/rules';
13+
} from "@chakra-ui/react";
14+
import { Button, InputController, PhosphorIcon, Text } from "io-bricks-ui";
15+
import { useForm } from "react-hook-form";
16+
import { useTranslation } from "react-i18next";
17+
import { useGrantKYC } from "../../../../hooks/mutations/useKYC";
18+
import { GrantKycRequest } from "@hashgraph/asset-tokenization-sdk";
19+
import { useParams } from "react-router-dom";
20+
import { FileArchive } from "@phosphor-icons/react";
21+
import { useRef, useState } from "react";
22+
import { isValidHederaId, required } from "../../../../utils/rules";
2323

2424
interface FormValues {
2525
accountId: string;
2626
vcFile: string;
2727
}
2828

29-
interface KYCModalProps extends Omit<ModalProps, 'children'> {}
29+
interface KYCModalProps extends Omit<ModalProps, "children"> {}
3030

3131
export const KYCModal = ({ isOpen, onClose }: KYCModalProps) => {
3232
const fileInputRef = useRef<HTMLInputElement | null>(null);
33-
const [fileName, setFileName] = useState('');
33+
const [fileName, setFileName] = useState("");
3434
const [isLoading, setIsLoading] = useState(false);
3535

36-
const { id: securityId = '' } = useParams();
36+
const { id: securityId = "" } = useParams();
3737

38-
const { t: tCreate } = useTranslation('security', {
39-
keyPrefix: 'details.kyc.create',
38+
const { t: tCreate } = useTranslation("security", {
39+
keyPrefix: "details.kyc.create",
4040
});
4141

4242
const {
@@ -47,7 +47,7 @@ export const KYCModal = ({ isOpen, onClose }: KYCModalProps) => {
4747
reset,
4848
watch,
4949
} = useForm<FormValues>({
50-
mode: 'onChange',
50+
mode: "onChange",
5151
});
5252

5353
const { mutate } = useGrantKYC();
@@ -59,10 +59,10 @@ export const KYCModal = ({ isOpen, onClose }: KYCModalProps) => {
5959
const reader = new FileReader();
6060
reader.readAsDataURL(file);
6161
reader.onload = () => {
62-
if (typeof reader.result === 'string') {
63-
const base64Data = reader.result.split(',')[1];
62+
if (typeof reader.result === "string") {
63+
const base64Data = reader.result.split(",")[1];
6464
if (base64Data) {
65-
setValue('vcFile', base64Data, { shouldValidate: true });
65+
setValue("vcFile", base64Data, { shouldValidate: true });
6666
}
6767
}
6868
};
@@ -88,62 +88,57 @@ export const KYCModal = ({ isOpen, onClose }: KYCModalProps) => {
8888
});
8989
};
9090

91-
const isDisable = !isValid || !watch('vcFile');
91+
const isDisable = !isValid || !watch("vcFile");
9292

9393
return (
9494
<Modal
9595
isCentered
9696
isOpen={isOpen}
9797
onClose={() => {
98-
setFileName('');
98+
setFileName("");
9999
reset();
100100
onClose();
101101
}}
102102
>
103103
<ModalOverlay />
104-
<ModalContent bgColor={'white'}>
105-
<ModalHeader>{tCreate('title')}</ModalHeader>
104+
<ModalContent bgColor={"white"}>
105+
<ModalHeader>{tCreate("title")}</ModalHeader>
106106
<ModalCloseButton />
107107
<ModalBody>
108108
<VStack gap={4}>
109109
<InputController
110110
control={control}
111111
id="accountId"
112-
label={tCreate('form.account.label')}
113-
placeholder={tCreate('form.account.placeholder')}
112+
label={tCreate("form.account.label")}
113+
placeholder={tCreate("form.account.placeholder")}
114114
isRequired={true}
115115
rules={{
116116
required,
117117
validate: { isValidHederaId: isValidHederaId },
118118
}}
119119
/>
120-
<HStack w={'full'}>
120+
<HStack w={"full"}>
121121
<input
122122
ref={fileInputRef}
123123
type="file"
124124
name="vcFile"
125125
id="vcFile"
126-
style={{ display: 'none' }}
126+
style={{ display: "none" }}
127127
onChange={onFileChange}
128128
/>
129129
<Button
130130
onClick={() => fileInputRef.current?.click()}
131131
leftIcon={<PhosphorIcon as={FileArchive} />}
132-
variant={'secondary'}
132+
variant={"secondary"}
133133
>
134-
{tCreate('form.vc.placeholder')}
134+
{tCreate("form.vc.placeholder")}
135135
</Button>
136-
<Text>{fileName}</Text>
136+
<Text maxW={270}>{fileName}</Text>
137137
</HStack>
138138
</VStack>
139139
</ModalBody>
140140
<ModalFooter>
141-
<Button
142-
isDisabled={isDisable}
143-
isLoading={isLoading}
144-
type="submit"
145-
onClick={handleSubmit(onSubmit)}
146-
>
141+
<Button isDisabled={isDisable} isLoading={isLoading} type="submit" onClick={handleSubmit(onSubmit)}>
147142
Create
148143
</Button>
149144
</ModalFooter>

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)