Skip to content

Commit 48847d4

Browse files
committed
feat: add justification field to gator permission details
1 parent dcecb08 commit 48847d4

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

ui/components/multichain/pages/gator-permissions/components/review-gator-permission-item.test.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,15 @@ describe('Permission List Item', () => {
162162
// Verify network name is rendered
163163
const networkName = getByTestId('review-gator-permission-network-name');
164164
expect(networkName).toHaveTextContent(mockNetworkName);
165+
166+
// Verify justification is rendered
167+
const justification = getByTestId(
168+
'review-gator-permission-justification',
169+
);
170+
expect(justification).toBeInTheDocument();
171+
expect(justification).toHaveTextContent(
172+
'This is a very important request for streaming allowance for some very important thing',
173+
);
165174
});
166175

167176
it('renders native token periodic permission correctly', () => {
@@ -209,6 +218,15 @@ describe('Permission List Item', () => {
209218
// Verify network name is rendered
210219
const networkName = getByTestId('review-gator-permission-network-name');
211220
expect(networkName).toHaveTextContent(mockNetworkName);
221+
222+
// Verify justification is rendered
223+
const justification = getByTestId(
224+
'review-gator-permission-justification',
225+
);
226+
expect(justification).toBeInTheDocument();
227+
expect(justification).toHaveTextContent(
228+
'This is a very important request for periodic allowance',
229+
);
212230
});
213231
});
214232

ui/components/multichain/pages/gator-permissions/components/review-gator-permission-item.tsx

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ export const ReviewGatorPermissionItem = ({
109109
const permissionType = permissionResponse.permission.type;
110110
const permissionContext = permissionResponse.context;
111111
const permissionAccount = permissionResponse.address || '0x';
112+
const justification = permissionResponse.permission.data.justification as
113+
| string
114+
| undefined;
112115
const tokenAddress = permissionResponse.permission.data.tokenAddress as
113116
| Hex
114117
| undefined;
@@ -519,6 +522,40 @@ export const ReviewGatorPermissionItem = ({
519522

520523
{isExpanded && (
521524
<>
525+
{/* Justification row */}
526+
{justification && (
527+
<Box
528+
flexDirection={BoxFlexDirection.Row}
529+
justifyContent={BoxJustifyContent.Between}
530+
style={{ flex: '1', alignSelf: 'center' }}
531+
gap={4}
532+
marginTop={2}
533+
>
534+
<Text
535+
textAlign={TextAlign.Left}
536+
color={TextColor.TextAlternative}
537+
variant={TextVariant.BodyMd}
538+
>
539+
Justification
540+
</Text>
541+
<Box
542+
flexDirection={BoxFlexDirection.Row}
543+
justifyContent={BoxJustifyContent.End}
544+
style={{ flex: '1', alignSelf: 'center' }}
545+
gap={2}
546+
>
547+
<Text
548+
variant={TextVariant.BodyMd}
549+
color={TextColor.TextAlternative}
550+
textAlign={TextAlign.Right}
551+
data-testid="review-gator-permission-justification"
552+
>
553+
{justification}
554+
</Text>
555+
</Box>
556+
</Box>
557+
)}
558+
522559
{/* Network name row */}
523560
<Box
524561
flexDirection={BoxFlexDirection.Row}

0 commit comments

Comments
 (0)