Skip to content

Commit 813e018

Browse files
authored
Merge pull request #4095 from IntersectMBO/issue_4072v3
Fix/Issue 4094 - Problem with cuting of DrepCard
2 parents de2573e + 8281505 commit 813e018

File tree

1 file changed

+82
-78
lines changed

1 file changed

+82
-78
lines changed

govtool/frontend/src/pages/DRepDirectoryContent.tsx

Lines changed: 82 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,20 @@ export const DRepDirectoryContent: FC<DRepDirectoryContentProps> = ({
150150
currentDelegation?.dRepView ===
151151
AutomatedVotingOptionCurrentDelegation.drep_always_no_confidence);
152152

153+
const scaleWrapSx = {
154+
width: "100%",
155+
transform: { xs: "scale(0.90)", sm: "scale(0.90)", md: "none" },
156+
transformOrigin: { xs: "top left", sm: "top left", md: "initial" },
157+
ml: { xs: 0.25, sm: 0.25, md: 0 },
158+
} as const;
159+
153160
return (
154161
<Box
155162
display="flex"
156163
flex={1}
157164
flexDirection="column"
158165
gap={4}
159-
sx={{ width: "100%", maxWidth: "100vw", overflowX: "hidden" }}
166+
sx={{ width: "100%", maxWidth: "100vw" }}
160167
>
161168
{myDrep &&
162169
!inProgressDelegation &&
@@ -166,26 +173,31 @@ export const DRepDirectoryContent: FC<DRepDirectoryContentProps> = ({
166173
<Typography variant="title2" sx={{ mb: 2 }}>
167174
<Trans i18nKey="dRepDirectory.myDelegation" values={{ ada }} />
168175
</Typography>
169-
<Box sx={{ width: "100%" }}>
170-
<DRepCard
171-
dRep={myDrep}
172-
isConnected={!!isConnected}
173-
isInProgress={isSameDRep(myDrep, inProgressDelegation)}
174-
isMe={isSameDRep(myDrep, myDRepId)}
175-
/>
176+
<Box>
177+
<Box sx={scaleWrapSx}>
178+
<DRepCard
179+
dRep={myDrep}
180+
isConnected={!!isConnected}
181+
isInProgress={isSameDRep(myDrep, inProgressDelegation)}
182+
isMe={isSameDRep(myDrep, myDRepId)}
183+
/>
184+
</Box>
176185
</Box>
177186
</div>
178187
)}
188+
179189
{inProgressDelegation &&
180190
inProgressDelegation !== myDRepId &&
181191
inProgressDelegationDRepData && (
182-
<Box sx={{ width: "100%" }}>
183-
<DRepCard
184-
dRep={inProgressDelegationDRepData}
185-
isConnected={!!isConnected}
186-
isMe={isSameDRep(inProgressDelegationDRepData, myDRepId)}
187-
isInProgress
188-
/>
192+
<Box>
193+
<Box sx={scaleWrapSx}>
194+
<DRepCard
195+
dRep={inProgressDelegationDRepData}
196+
isConnected={!!isConnected}
197+
isMe={isSameDRep(inProgressDelegationDRepData, myDRepId)}
198+
isInProgress
199+
/>
200+
</Box>
189201
</Box>
190202
)}
191203

@@ -194,34 +206,32 @@ export const DRepDirectoryContent: FC<DRepDirectoryContentProps> = ({
194206
<Typography variant="title2" sx={{ mb: 2 }}>
195207
{t("dRepDirectory.delegationOptions")}
196208
</Typography>
197-
<Box sx={{ width: "100%" }}>
198-
<AutomatedVotingOptions
199-
currentDelegation={
200-
!pendingTransaction.delegate && isAnAutomatedVotingOptionChosen
201-
? currentDelegation?.dRepView
202-
: undefined
203-
}
204-
delegate={delegate}
205-
delegationInProgress={
206-
inProgressDelegation &&
207-
(inProgressDelegation ===
208-
AutomatedVotingOptionDelegationId.abstain ||
209-
inProgressDelegation ===
210-
AutomatedVotingOptionDelegationId.no_confidence)
211-
? inProgressDelegation
212-
: undefined
213-
}
214-
isConnected={!!isConnected}
215-
isDelegationLoading={isDelegating}
216-
votingPower={ada.toString()}
217-
pendingTransaction={pendingTransaction}
218-
txHash={
219-
!pendingTransaction.delegate && isAnAutomatedVotingOptionChosen
220-
? currentDelegation?.txHash
221-
: undefined
222-
}
223-
/>
224-
</Box>
209+
<AutomatedVotingOptions
210+
currentDelegation={
211+
!pendingTransaction.delegate && isAnAutomatedVotingOptionChosen
212+
? currentDelegation?.dRepView
213+
: undefined
214+
}
215+
delegate={delegate}
216+
delegationInProgress={
217+
inProgressDelegation &&
218+
(inProgressDelegation ===
219+
AutomatedVotingOptionDelegationId.abstain ||
220+
inProgressDelegation ===
221+
AutomatedVotingOptionDelegationId.no_confidence)
222+
? inProgressDelegation
223+
: undefined
224+
}
225+
isConnected={!!isConnected}
226+
isDelegationLoading={isDelegating}
227+
votingPower={ada.toString()}
228+
pendingTransaction={pendingTransaction}
229+
txHash={
230+
!pendingTransaction.delegate && isAnAutomatedVotingOptionChosen
231+
? currentDelegation?.txHash
232+
: undefined
233+
}
234+
/>
225235
</div>
226236
)}
227237

@@ -271,52 +281,46 @@ export const DRepDirectoryContent: FC<DRepDirectoryContentProps> = ({
271281
mt={showSearchSummary ? 0 : 4}
272282
p={0}
273283
sx={{
274-
opacity: isPrev ? 0.5 : 1,
275-
transition: "opacity 0.2s",
276284
flex: 1,
277285
width: "100%",
278286
maxWidth: "100%",
279-
overflowX: "hidden",
280287
}}
281288
>
282289
{filteredDoNotListDReps?.length === 0 && <EmptyStateDrepDirectory />}
283290
{filteredDoNotListDReps?.map((dRep) => (
284-
<Box
285-
key={dRep.view}
286-
component="li"
287-
sx={{
288-
listStyle: "none",
289-
width: "100%",
290-
maxWidth: "100%",
291-
"& .MuiCard-root, & .MuiPaper-root": {
292-
width: "100% !important",
293-
maxWidth: "100% !important",
294-
marginLeft: "0 !important",
295-
marginRight: "0 !important",
296-
},
297-
"& .MuiCardContent-root, & .MuiCardActions-root": {
298-
minWidth: 0,
299-
},
300-
}}
301-
>
302-
<DRepCard
303-
dRep={dRep}
304-
isConnected={!!isConnected}
305-
isDelegationLoading={
306-
isDelegating === dRep.view || isDelegating === dRep.drepId
307-
}
308-
isMe={isSameDRep(dRep, myDRepId)}
309-
isMyDrep={isSameDRep(dRep, currentDelegation?.dRepView)}
310-
onDelegate={() => {
311-
setInProgressDelegationDRepData(dRep);
312-
delegate(dRep.drepId);
313-
}}
314-
/>
291+
<Box key={dRep.view} component="li" sx={{ listStyle: "none" }}>
292+
<Box>
293+
<Box sx={scaleWrapSx}>
294+
<DRepCard
295+
dRep={dRep}
296+
isConnected={!!isConnected}
297+
isDelegationLoading={
298+
isDelegating === dRep.view || isDelegating === dRep.drepId
299+
}
300+
isMe={isSameDRep(dRep, myDRepId)}
301+
isMyDrep={isSameDRep(dRep, currentDelegation?.dRepView)}
302+
onDelegate={() => {
303+
setInProgressDelegationDRepData(dRep);
304+
delegate(dRep.drepId);
305+
}}
306+
/>
307+
</Box>
308+
</Box>
315309
</Box>
316310
))}
317311
</Box>
318312

319-
<Box sx={{ width: "100%", maxWidth: "100%", overflowX: "hidden" }}>
313+
<Box
314+
sx={{
315+
width: "100%",
316+
transform: { xs: "scale(0.90)", sm: "scale(0.90)", md: "none" },
317+
transformOrigin: {
318+
xs: "top right",
319+
sm: "top right",
320+
md: "initial",
321+
},
322+
}}
323+
>
320324
<PaginationFooter
321325
page={page}
322326
total={total || 0}

0 commit comments

Comments
 (0)