Reorder automation card actions buttons. Put Delete action last

This commit is contained in:
Debanjum Singh Solanky
2024-08-04 18:34:41 +05:30
parent c7b67a978e
commit c627527a6f

View File

@@ -291,17 +291,6 @@ function AutomationsCard(props: AutomationsCardProps) {
<Button className='bg-background' variant={'ghost'}><DotsThreeVertical className='h-4 w-4' /></Button> <Button className='bg-background' variant={'ghost'}><DotsThreeVertical className='h-4 w-4' /></Button>
</PopoverTrigger> </PopoverTrigger>
<PopoverContent className='w-auto grid gap-2 text-left bg-secondary'> <PopoverContent className='w-auto grid gap-2 text-left bg-secondary'>
<Button variant={'destructive'}
className='justify-start'
onClick={() => {
if (props.suggestedCard) {
setIsDeleted(true);
return;
}
deleteAutomation(automation.id.toString(), setIsDeleted);
}}>
<Trash className='h-4 w-4 mr-2' />Delete
</Button>
{ {
(!props.suggestedCard && props.locationData) && ( (!props.suggestedCard && props.locationData) && (
<AutomationComponentWrapper <AutomationComponentWrapper
@@ -316,6 +305,18 @@ function AutomationsCard(props: AutomationsCardProps) {
ipLocationData={props.locationData} /> ipLocationData={props.locationData} />
) )
} }
<ShareLink
buttonTitle="Share"
includeIcon={true}
buttonClassName='justify-start px-4 py-2 h-10'
buttonVariant={'outline' as keyof typeof buttonVariants}
title="Share Automation"
description="Copy the link below and share it with your coworkers or friends."
url={createShareLink(automation)}
onShare={() => {
navigator.clipboard.writeText(createShareLink(automation));
}}
/>
{ {
!props.suggestedCard && ( !props.suggestedCard && (
<Button variant={'outline'} <Button variant={'outline'}
@@ -327,17 +328,17 @@ function AutomationsCard(props: AutomationsCardProps) {
</Button> </Button>
) )
} }
<ShareLink <Button variant={'destructive'}
buttonTitle="Share" className='justify-start'
includeIcon={true} onClick={() => {
buttonClassName='justify-start px-4 py-2 h-10' if (props.suggestedCard) {
buttonVariant={'outline' as keyof typeof buttonVariants} setIsDeleted(true);
title="Share Automation" return;
description="Copy the link below and share it with your coworkers or friends." }
url={createShareLink(automation)} deleteAutomation(automation.id.toString(), setIsDeleted);
onShare={() => { }}>
navigator.clipboard.writeText(createShareLink(automation)); <Trash className='h-4 w-4 mr-2' />Delete
}} /> </Button>
</PopoverContent> </PopoverContent>
</Popover> </Popover>
</CardTitle> </CardTitle>