Skip to content

Commit 5efa236

Browse files
author
marcoDmc
committed
fix: trying to resolve merge conflict issue
1 parent 1750563 commit 5efa236

File tree

6 files changed

+64
-55
lines changed

6 files changed

+64
-55
lines changed

src/components/CardAboutShelter/CardAboutShelter.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,13 @@ const CardAboutShelter = (props: ICardAboutShelter) => {
6565
value={
6666
check(shelter.contact) ? `${shelter.contact}` : 'Não informado'
6767
}
68+
clipboardButton={check(shelter.contact)}
6869
/>
6970
<InfoRow
7071
icon={<Landmark />}
7172
label="Chave Pix:"
7273
value={check(shelter.pix) ? `${shelter.pix}` : 'Não informado'}
74+
clipboardButton={check(shelter.pix)}
7375
/>
7476
</div>
7577
</Card>

src/components/CardAboutShelter/components/InfoRow/InfoRow.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { IInfoRowProps } from './types';
44

55
const InfoRow = React.forwardRef<HTMLDivElement, IInfoRowProps>(
66
(props, ref) => {
7-
const { icon, label, value, className = '', ...rest } = props;
7+
const { icon, label, value, clipboardButton = false, className = '', ...rest } = props;
88
const isLink = value?.startsWith('http');
99
const ValueComp = !value ? (
1010
<Fragment />
@@ -35,7 +35,18 @@ const InfoRow = React.forwardRef<HTMLDivElement, IInfoRowProps>(
3535
<span className={cn('font-normal', value ? 'text-nowrap' : '')}>
3636
{label}
3737
</span>
38-
<span className="md:flex">{ValueComp}</span>
38+
<span className="md:flex">
39+
{ValueComp}
40+
{clipboardButton && (
41+
<div
42+
className="text-blue-600 mx-2 hover:cursor-pointer active:text-blue-800"
43+
onClick={() => navigator.clipboard.writeText(value)}
44+
>
45+
copiar
46+
</div>
47+
)}
48+
</span>
49+
3950
</div>
4051
</div>
4152
);

src/components/CardAboutShelter/components/InfoRow/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ export interface IInfoRowProps extends React.ComponentPropsWithoutRef<'div'> {
22
label: React.ReactNode;
33
value?: string;
44
icon: React.ReactNode;
5+
clipboardButton?: boolean;
56
}

src/pages/EditShelterSupply/EditShelterSupply.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ const EditShelterSupply = () => {
3030
if (v) {
3131
setFilteredSupplies(
3232
supplies.filter((s) =>
33-
s.name.toLowerCase().includes(v.toLowerCase())
33+
s.name.toLowerCase().normalize('NFD').replace(/[\u0300-\u036f]/g, '')
34+
.includes(v.toLowerCase().normalize('NFD').replace(/[\u0300-\u036f]/g, ''))
3435
)
3536
);
3637
} else setFilteredSupplies(supplies);

src/pages/Home/components/ShelterListItem/ShelterListItem.tsx

Lines changed: 46 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useCallback, useMemo } from 'react';
22
import { format } from 'date-fns';
3-
import { useNavigate } from 'react-router-dom';
3+
import { Link } from 'react-router-dom';
44
import { ChevronRight } from 'lucide-react';
55

66
import {
@@ -20,9 +20,8 @@ import { IUseSheltersDataSupplyData } from '@/hooks/useShelters/types';
2020
import { ShelterSupplyCategoryRow } from '../ShelterSupplyCategoryRow';
2121

2222
const ShelterListItem = (props: IShelterListItemProps) => {
23-
const { data, onClick } = props;
23+
const { data } = props;
2424
const { capacity, shelteredPeople } = data;
25-
const navigate = useNavigate();
2625
const { availability, className: availabilityClassName } =
2726
useMemo<IShelterAvailabilityProps>(
2827
() => getAvailabilityProps(capacity, shelteredPeople),
@@ -42,53 +41,52 @@ const ShelterListItem = (props: IShelterListItemProps) => {
4241
}, []);
4342

4443
return (
45-
<div className="flex flex-col p-4 w-full border-2 border-border rounded-md gap-1 relative">
46-
<Button size="sm" variant="ghost" className="absolute top-4 right-4">
47-
<ChevronRight
48-
className="h-5 w-5"
49-
onClick={() => navigate(`/abrigo/${data.id}`)}
50-
/>
51-
</Button>
52-
<div
53-
className="flex items-center gap-1"
54-
onClick={() => navigate(`/abrigo/${data.id}`)}
55-
>
56-
<h3
57-
className="font-semibold text-lg hover:cursor-pointer hover:text-slate-500"
58-
onClick={onClick}
44+
<Link to={`/abrigo/${data.id}`} target="_blank">
45+
<div className="flex flex-col p-4 w-full border-2 border-border rounded-md gap-1 relative hover:bg-accent">
46+
<Button size="sm" variant="ghost" className="absolute top-4 right-4">
47+
<ChevronRight
48+
className="h-5 w-5"
49+
/>
50+
</Button>
51+
<div
52+
className="flex items-center gap-1"
5953
>
60-
{data.name}
61-
</h3>
62-
{data.verified && <VerifiedBadge />}
54+
<h3
55+
className="font-semibold text-lg hover:cursor-pointer hover:text-slate-500"
56+
>
57+
{data.name}
58+
</h3>
59+
{data.verified && <VerifiedBadge />}
60+
</div>
61+
<h6 className={cn('font-semibold text-md', availabilityClassName)}>
62+
{availability}
63+
</h6>
64+
<h6 className="text-muted-foreground text-sm md:text-lg font-medium">
65+
{data.address}
66+
</h6>
67+
{data.shelterSupplies.length > 0 && (
68+
<>
69+
<ShelterSupplyCategoryRow
70+
title="Necessita voluntários:"
71+
tags={tags.NeedVolunteers.map(getChipProps)}
72+
/>
73+
<ShelterSupplyCategoryRow
74+
title="Necessita urgente doações de:"
75+
tags={tags.NeedDonations.map(getChipProps)}
76+
/>
77+
<ShelterSupplyCategoryRow
78+
title="Sobrando para doações:"
79+
tags={tags.RemainingSupplies.map(getChipProps)}
80+
/>
81+
</>
82+
)}
83+
{data.updatedAt && (
84+
<small className="text-sm md:text-md font-light text-muted-foreground mt-2">
85+
Atualizado em {format(data.updatedAt, 'dd/MM/yyyy HH:mm')}
86+
</small>
87+
)}
6388
</div>
64-
<h6 className={cn('font-semibold text-md', availabilityClassName)}>
65-
{availability}
66-
</h6>
67-
<h6 className="text-muted-foreground text-sm md:text-lg font-medium">
68-
{data.address}
69-
</h6>
70-
{data.shelterSupplies.length > 0 && (
71-
<>
72-
<ShelterSupplyCategoryRow
73-
title="Necessita voluntários:"
74-
tags={tags.NeedVolunteers.map(getChipProps)}
75-
/>
76-
<ShelterSupplyCategoryRow
77-
title="Necessita urgente doações de:"
78-
tags={tags.NeedDonations.map(getChipProps)}
79-
/>
80-
<ShelterSupplyCategoryRow
81-
title="Sobrando para doações:"
82-
tags={tags.RemainingSupplies.map(getChipProps)}
83-
/>
84-
</>
85-
)}
86-
{data.updatedAt && (
87-
<small className="text-sm md:text-md font-light text-muted-foreground mt-2">
88-
Atualizado em {format(data.updatedAt, 'dd/MM/yyyy HH:mm')}
89-
</small>
90-
)}
91-
</div>
89+
</Link>
9290
);
9391
};
9492

src/pages/Home/components/ShelterListView/ShelterListView.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ const ShelterListView = React.forwardRef<HTMLDivElement, IShelterListViewProps>(
2222
hasMoreItems = false,
2323
onSearchValueChange,
2424
onFetchMoreData,
25-
onSelectShelter,
2625
className = '',
2726
onOpenModal,
2827
onClearSearch,
@@ -83,9 +82,6 @@ const ShelterListView = React.forwardRef<HTMLDivElement, IShelterListViewProps>(
8382
<ShelterListItem
8483
key={idx}
8584
data={s}
86-
onClick={() =>
87-
onSelectShelter ? onSelectShelter(s) : undefined
88-
}
8985
/>
9086
))}
9187
{hasMoreItems ? (

0 commit comments

Comments
 (0)