Skip to content

Commit 1d138ef

Browse files
fagundesjgluccas-spechtMatheusDubingiggiofelipee-monteiro
authored andcommitted
merge: develop -> master (SOS-RS#91)
* refact: created shelter list view component in home page * Fix: mobile UI has broken for mobile devices (SOS-RS#22) *Fix: mobile UI has broken for mobile devices * fix: remove chip as fixed as no wrap property * chore: add shelter card clickable * chore: remove Fragment component * build: add set sm as max mobile dimension sm: 425px * style: add responsive layout * refactor: filter page * fix: priority * fix: filter parameters * fix: fixed volunteer supply that had been fulfilled displaying on shelter page * fix: improve readability * feat: hidden filter button if filter is empty * feat: cache in axios request * fix: cache search params * feat: cache clean on searchs * fix: donation tags * fix: clean search params * fix: donation tags / componentized the urgent supplies section * fix: removed empty shelter tags empty row * feat: full edit shelter and improved interface of pet friendly in shelter page * Fix/develop bugs (SOS-RS#90) * fix: cache bug (invalite cache on create/update operation) * feat: added update many shelter supplies and admin rule * Add license (SOS-RS#81) Closes SOS-RS#65. * fix: app port (SOS-RS#80) --------- Co-authored-by: Luccas Specht <[email protected]> Co-authored-by: MatheusDubin <[email protected]> Co-authored-by: Giovanni Bassi <[email protected]> Co-authored-by: Felipe Monteiro <[email protected]>
1 parent 1fcf8b5 commit 1d138ef

File tree

23 files changed

+370
-20
lines changed

23 files changed

+370
-20
lines changed

package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
"formik": "^2.4.6",
2929
"lucide-react": "^0.378.0",
3030
"qs": "^6.12.1",
31+
<<<<<<< HEAD
32+
=======
33+
"react": "^18.2.0",
34+
>>>>>>> 3d3f437 (merge: develop -> master (#91))
3135
"react-dom": "^18.2.0",
3236
"react-hook-form": "^7.51.4",
3337
"react-input-mask": "^2.0.4",
@@ -41,6 +45,10 @@
4145
"devDependencies": {
4246
"@types/node": "^20.12.8",
4347
"@types/qs": "^6.9.15",
48+
<<<<<<< HEAD
49+
=======
50+
"@types/react": "^18.2.66",
51+
>>>>>>> 3d3f437 (merge: develop -> master (#91))
4452
"@types/react-dom": "^18.2.22",
4553
"@types/react-input-mask": "^3.0.5",
4654
"@types/react": "^18.2.66",

src/components/Authenticated/Authenticated.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<<<<<<< HEAD
12
import { Fragment } from 'react';
23

34
import { IAuthenticatedProps } from './types';
@@ -7,6 +8,26 @@ const Authenticated = ({ children, role = 'User' }: IAuthenticatedProps) => {
78
const isAuthenticated = useAuthRoles(role);
89

910
if (!isAuthenticated) return <Fragment />;
11+
=======
12+
import { Fragment, useContext } from 'react';
13+
14+
import { SessionContext } from '@/contexts';
15+
import { IAuthenticatedProps } from './types';
16+
import { AccessLevel } from '@/service/sessions/types';
17+
18+
const MappedRoles: Record<AccessLevel, AccessLevel[]> = {
19+
Admin: ['Admin'],
20+
DistributionCenter: ['Admin', 'DistributionCenter'],
21+
Staff: ['Admin', 'Staff'],
22+
User: ['Admin', 'Staff', 'DistributionCenter', 'User'],
23+
};
24+
25+
const Authenticated = ({ children, role = 'User' }: IAuthenticatedProps) => {
26+
const { session } = useContext(SessionContext);
27+
28+
if (!session || !MappedRoles[role].includes(session.accessLevel))
29+
return <Fragment />;
30+
>>>>>>> 3d3f437 (merge: develop -> master (#91))
1031

1132
return <div className="contents">{children}</div>;
1233
};

src/components/Footer/Footer.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ const Footer = React.forwardRef<
1717
className
1818
)}
1919
>
20+
<<<<<<< HEAD
2021
<p className="text-white max-sm:grid max-sm:place-items-center transition-all">
22+
=======
23+
<p className="text-white">
24+
>>>>>>> 3d3f437 (merge: develop -> master (#91))
2125
Para cadastrar novos abrigos clique{' '}
2226
<a
2327
href="https://forms.gle/2S7L2gR529Dc8P3T9"
@@ -28,7 +32,11 @@ const Footer = React.forwardRef<
2832
</a>
2933
</p>
3034
<span className="text-white hidden md:block"></span>
35+
<<<<<<< HEAD
3136
<span className="text-white flex flex-nowrap gap-2 items-center max-sm:grid max-sm:place-items-center transition-all">
37+
=======
38+
<span className="text-white flex flex-nowrap gap-2 items-center">
39+
>>>>>>> 3d3f437 (merge: develop -> master (#91))
3240
Projeto Open Source disponível em{' '}
3341
<a
3442
className="underline hover:text-gray-300 flex"

src/components/Header/Header.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react';
2+
23
import { IHeader } from './types';
34
import { cn } from '@/lib/utils';
45
import { Link } from 'react-router-dom';
@@ -17,11 +18,7 @@ const Header = React.forwardRef<HTMLDivElement, IHeader>((props, ref) => {
1718
<header
1819
ref={ref}
1920
className={cn(
20-
<<<<<<< HEAD
2121
'bg-red-600 fixed transition-all w-full flex items-center justify-between p-2 h-auto max-[300px]:flex-col max-[300px]:gap-2',
22-
=======
23-
'bg-red-600 flex h-[56px] justify-between items-center text-white p-3 gap-2 w-full z-[60]',
24-
>>>>>>> dfc7f9c (Added burger menu to home page (#149))
2522
className
2623
)}
2724
{...rest}
@@ -32,9 +29,7 @@ const Header = React.forwardRef<HTMLDivElement, IHeader>((props, ref) => {
3229
{title}
3330
</Link>
3431
</div>
35-
<div className="flex w-auto items-center justify-between">
3632
<div className="cursor-pointer">{endAdornment}</div>
37-
</div>
3833
</header>
3934
);
4035
});

src/components/SearchInput/SearchInput.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,27 @@ import { cn } from '@/lib/utils';
77

88
const SearchInput = React.forwardRef<HTMLDivElement, ISearchInputProps>(
99
(props, ref) => {
10+
<<<<<<< HEAD
1011
const {
1112
value,
1213
onChange,
1314
className,
1415
placeholder = 'Buscar por abrigo ou endereço',
1516
...rest
1617
} = props;
18+
=======
19+
const { value, onChange, className, ...rest } = props;
20+
>>>>>>> 3d3f437 (merge: develop -> master (#91))
1721

1822
return (
1923
<div ref={ref} className={cn(className, 'relative')} {...rest}>
2024
<Input
2125
value={value}
26+
<<<<<<< HEAD
2227
placeholder={placeholder}
28+
=======
29+
placeholder="Buscar por abrigo ou endereço"
30+
>>>>>>> 3d3f437 (merge: develop -> master (#91))
2331
className="h-12 text-md font-medium text-zinc-600 pl-10 pr-4"
2432
onChange={onChange}
2533
/>

src/components/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ import { SearchInput } from './SearchInput';
1313
import { VerifiedBadge } from './VerifiedBadge';
1414
import { SelectField } from './SelectField';
1515
import { Authenticated } from './Authenticated';
16+
<<<<<<< HEAD
1617
import { BurgerMenu } from './BurgerMenu';
18+
=======
19+
>>>>>>> 3d3f437 (merge: develop -> master (#91))
1720

1821
export {
1922
LoadingScreen,
@@ -31,5 +34,8 @@ export {
3134
SearchInput,
3235
SelectField,
3336
Authenticated,
37+
<<<<<<< HEAD
3438
BurgerMenu,
39+
=======
40+
>>>>>>> 3d3f437 (merge: develop -> master (#91))
3541
};

src/hooks/useFetch/useFetch.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ import { api } from '@/api';
55
import { IServerResponse } from '@/types';
66
import { IUseFetchOptions } from './types';
77

8+
<<<<<<< HEAD
89
function useFetch<T = any>(path?: string, options: IUseFetchOptions<T> = {}) {
10+
=======
11+
function useFetch<T = any>(path: string, options: IUseFetchOptions<T> = {}) {
12+
>>>>>>> 3d3f437 (merge: develop -> master (#91))
913
const { cache, initialValue } = options;
1014
const [loading, setLoading] = useState<boolean>(true);
1115
const [data, setData] = useState<T>(initialValue || ({} as T));
@@ -15,6 +19,7 @@ function useFetch<T = any>(path?: string, options: IUseFetchOptions<T> = {}) {
1519
const headers = config?.headers ?? {};
1620
if (cache) headers['x-app-cache'] = 'true';
1721
setLoading(true);
22+
<<<<<<< HEAD
1823

1924
if (path) {
2025
api
@@ -24,6 +29,12 @@ function useFetch<T = any>(path?: string, options: IUseFetchOptions<T> = {}) {
2429
} else {
2530
setLoading(false);
2631
}
32+
=======
33+
api
34+
.get<IServerResponse<T>>(path, { ...config, headers })
35+
.then(({ data }) => setData(data.data))
36+
.finally(() => setLoading(false));
37+
>>>>>>> 3d3f437 (merge: develop -> master (#91))
2738
},
2839
[cache, path]
2940
);

src/hooks/useShelters/types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ export interface IUseSheltersDataSupplyData {
3030
};
3131
priority: number;
3232
tags: ShelterTagType[];
33+
<<<<<<< HEAD
3334
quantity?: number | null;
35+
=======
36+
>>>>>>> 3d3f437 (merge: develop -> master (#91))
3437
}
3538

3639
export interface IUseShelterOptions {

src/hooks/useShelters/useShelters.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ const useShelters = (options: IUseShelterOptions = {}) => {
2727
...config,
2828
headers,
2929
params: {
30+
<<<<<<< HEAD
3031
orderBy: 'updatedAt',
32+
=======
33+
orderBy: 'prioritySum',
34+
>>>>>>> 3d3f437 (merge: develop -> master (#91))
3135
order: 'desc',
3236
search:
3337
search ?? new URLSearchParams(window.location.search).toString(),

src/hooks/useSupplies/useSupplies.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ import { PaginatedQueryPath } from '../usePaginatedQuery/paths';
33
import { IUseSuppliesData } from './types';
44

55
const useSupplies = () => {
6+
<<<<<<< HEAD
67
return useFetch<IUseSuppliesData[]>(PaginatedQueryPath.Supplies, {
8+
=======
9+
return useFetch<ISupply[]>(PaginatedQueryPath.Supplies, {
10+
>>>>>>> 3d3f437 (merge: develop -> master (#91))
711
initialValue: [],
812
cache: true,
913
});

0 commit comments

Comments
 (0)