-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
views: improve approval dialogue rendering #241
Changes from all commits
ac920a0
0a8034a
3715a16
06b5630
96270e0
81e3ea4
7c22192
a450d91
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,9 +14,12 @@ export const OutputViewComponent = ({ value }: { value: OutputView }) => { | |
<ViewBox | ||
label='Output' | ||
visibleContent={ | ||
<ValueWithAddress addressView={address} label='to'> | ||
<div className='flex items-center justify-between gap-3'> | ||
<ValueViewComponent view={note.value} /> | ||
</ValueWithAddress> | ||
<ValueWithAddress addressView={address} label='to'> | ||
<></> | ||
</ValueWithAddress> | ||
</div> | ||
Comment on lines
+17
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
/> | ||
); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import { SpendView } from '@penumbra-zone/protobuf/penumbra/core/component/shielded_pool/v1/shielded_pool_pb'; | ||
import { ViewBox } from '../viewbox'; | ||
import { ValueViewComponent } from '../../value'; | ||
import { ValueWithAddress } from './value-with-address'; | ||
import { getNote } from '@penumbra-zone/getters/spend-view'; | ||
import { getAddress } from '@penumbra-zone/getters/note-view'; | ||
import { ValueViewComponent } from '../../value'; | ||
|
||
export const SpendViewComponent = ({ value }: { value: SpendView }) => { | ||
if (value.spendView.case === 'visible') { | ||
|
@@ -14,9 +14,12 @@ export const SpendViewComponent = ({ value }: { value: SpendView }) => { | |
<ViewBox | ||
label='Spend' | ||
visibleContent={ | ||
<ValueWithAddress addressView={address} label='from'> | ||
<div className='flex items-center justify-between gap-3'> | ||
<ValueViewComponent view={note.value} /> | ||
</ValueWithAddress> | ||
<ValueWithAddress addressView={address} label='from'> | ||
<></> | ||
</ValueWithAddress> | ||
Comment on lines
+19
to
+21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question: This is the same as <ValueWithAddress addressView={address} label='from' /> But is that intended? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
</div> | ||
} | ||
/> | ||
); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import { ValueViewComponent } from '../../../value'; | ||
import { ArrowRight } from 'lucide-react'; | ||
import { ValueView } from '@penumbra-zone/protobuf/penumbra/core/asset/v1/asset_pb'; | ||
import { getAmount } from '@penumbra-zone/getters/value-view'; | ||
|
||
|
@@ -13,12 +12,15 @@ export const OneWaySwap = ({ input, output }: { input: ValueView; output: ValueV | |
const outputAmount = getAmount.optional(output); | ||
|
||
return ( | ||
<div className='flex items-center gap-2'> | ||
<div className='flex items-center justify-between'> | ||
<ValueViewComponent view={input} /> | ||
|
||
<ArrowRight /> | ||
|
||
<ValueViewComponent view={output} showValue={!!outputAmount} /> | ||
<div className='relative mx-2 flex items-center justify-center'> | ||
<div className='flex h-0.5 w-3.5 items-center bg-white' /> | ||
<div className='ml-[2px] size-0 border-y-4 border-l-[6px] border-y-transparent border-l-white' /> | ||
</div> | ||
<div className='flex items-center justify-end'> | ||
<ValueViewComponent view={output} showValue={!!outputAmount} /> | ||
</div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. modified to |
||
</div> | ||
); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,44 +11,43 @@ export interface ViewBoxProps { | |
isOpaque?: boolean; | ||
} | ||
|
||
const Label = ({ label }: { label: string }) => <span className='text-lg'>{label}</span>; | ||
const Label = ({ label }: { label: string }) => ( | ||
<span className='text-lg font-bold text-gray-300'>{label}</span> | ||
); | ||
|
||
export const ViewBox = ({ label, visibleContent, isOpaque }: ViewBoxProps) => { | ||
// if isOpaque is undefined, set it to !visibleContent | ||
isOpaque = isOpaque ?? !visibleContent; | ||
isOpaque = isOpaque ?? !visibleContent?.props; | ||
|
||
return ( | ||
<Box overflow='hidden'> | ||
<div | ||
className={cn( | ||
'flex flex-col gap-1 break-all overflow-hidden', | ||
isOpaque ? 'cursor-not-allowed' : '', | ||
)} | ||
> | ||
<div className='flex items-center gap-2 self-start'> | ||
<span className={cn('text-base font-bold', isOpaque ? 'text-gray-600' : '')}> | ||
{!isOpaque && <Label label={label} />} | ||
{isOpaque && ( | ||
<div className='flex gap-2'> | ||
<div className={cn('flex flex-col gap-2', isOpaque ? 'cursor-not-allowed' : '')}> | ||
<div className='flex items-center gap-2'> | ||
<span className={cn('text-base', isOpaque ? 'text-gray-600' : '')}> | ||
{isOpaque ? ( | ||
<div className='flex items-center gap-2'> | ||
<IncognitoIcon fill='#4b5563' /> | ||
<Label label={label} /> | ||
</div> | ||
) : ( | ||
<Label label={label} /> | ||
)} | ||
</span> | ||
</div> | ||
{visibleContent} | ||
{visibleContent && <div className='border-t border-gray-700 pt-2'>{visibleContent}</div>} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: personally, I think you can get rid of the horizontal line border There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
</div> | ||
</Box> | ||
); | ||
}; | ||
|
||
export interface ViewSectionProps { | ||
heading: string; | ||
heading: React.ReactNode; | ||
children?: React.ReactNode; | ||
} | ||
|
||
export const ViewSection = ({ heading, children }: ViewSectionProps) => { | ||
return ( | ||
<div className='grid gap-4'> | ||
<div className='grid gap-2'> | ||
<div className='text-xl font-bold'>{heading}</div> | ||
{children} | ||
</div> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blending the colors of the layer containing the approve and deny buttons
before
after