Skip to content

Commit 8854303

Browse files
authored
feat: added supporters page (#216)
* fix: conflicts with master branch * feat: dev and staging gh actions * feat: done supporters page
1 parent 0d9053f commit 8854303

File tree

11 files changed

+146
-1
lines changed

11 files changed

+146
-1
lines changed

.github/workflows/dev.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [develop]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: setup node js
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: 18.18.x
18+
19+
- run: npm install
20+
21+
- name: Create .env file
22+
run: |
23+
touch .env
24+
echo VITE_API_URL=${{ secrets.DEV_VITE_API_URL }} >> .env
25+
cat .env
26+
27+
- run: npm run build
28+
29+
- uses: aws-actions/configure-aws-credentials@v1
30+
with:
31+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
32+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
33+
aws-region: sa-east-1
34+
- run: aws s3 sync ./dist s3://dev.sos-rs.com

.github/workflows/staging.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [staging]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: setup node js
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: 18.18.x
18+
19+
- run: npm install
20+
21+
- name: Create .env file
22+
run: |
23+
touch .env
24+
echo VITE_API_URL=${{ secrets.STG_VITE_API_URL }} >> .env
25+
cat .env
26+
27+
- run: npm run build
28+
29+
- uses: aws-actions/configure-aws-credentials@v1
30+
with:
31+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
32+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
33+
aws-region: sa-east-1
34+
- run: aws s3 sync ./dist s3://stg.sos-rs.com

src/components/BurgerMenu/BurgerMenu.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
CircleHelp,
44
CirclePlus,
55
DoorOpen,
6+
HeartHandshake,
67
Info,
78
LinkIcon,
89
Menu,
@@ -65,6 +66,11 @@ const BurgerMenu = () => {
6566
link="/politica-de-privacidade"
6667
icon={<Info className="w-4 h-4" />}
6768
/>
69+
<BurguerMenuItem
70+
label="Apoiadores"
71+
link="/apoiadores"
72+
icon={<HeartHandshake className="w-4 h-4" />}
73+
/>
6874
<Separator />
6975
{partners.length > 0 && (
7076
<Fragment>

src/hooks/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { useViaCep } from './useViaCep';
1111
import { usePartners } from './usePartners';
1212
import { useGithubContributors } from './useGithubContributors';
1313
import { useAuthRoles } from './useAuthRoles';
14+
import { useSupporters } from './useSupporters';
1415

1516
export {
1617
useShelters,
@@ -26,4 +27,5 @@ export {
2627
usePartners,
2728
useGithubContributors,
2829
useAuthRoles,
30+
useSupporters,
2931
};

src/hooks/useSupporters/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { useSupporters } from './useSupporters';
2+
3+
export { useSupporters };

src/hooks/useSupporters/types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export interface ISupporter {
2+
id: string;
3+
name: string;
4+
imageUrl: string;
5+
link: string;
6+
createdAt: string;
7+
updatedAt?: string | null;
8+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { useFetch } from '../useFetch';
2+
import { ISupporter } from './types';
3+
4+
const useSupporters = () => {
5+
return useFetch<ISupporter[]>('/supporters', {
6+
initialValue: [],
7+
cache: true,
8+
});
9+
};
10+
11+
export { useSupporters };
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { BurgerMenu, Header, LoadingScreen } from '@/components';
2+
import WithTooltip from '@/components/ui/with-tooltip';
3+
import { useSupporters } from '@/hooks';
4+
import { Link } from 'react-router-dom';
5+
6+
const Supporters = () => {
7+
const { data: supporters, loading } = useSupporters();
8+
9+
if (loading) return <LoadingScreen />;
10+
11+
return (
12+
<div className="flex flex-col h-screen items-center bg-gray-50 overflow-auto">
13+
<Header title="SOS Rio Grande do Sul" startAdornment={<BurgerMenu />} />
14+
<div className="flex flex-col gap-4 p-4 max-w-5xl pb-8 w-full">
15+
<h2 className="text-4xl pt-4 font-semibold !text-zinc-900">
16+
Apoiadores do projeto
17+
</h2>
18+
<div className="grid grid-cols-2 md:grid-cols-4 w-full gap-4 md:gap-8 mt-8">
19+
{supporters
20+
.sort((a, b) => a.createdAt.localeCompare(b.createdAt))
21+
.map((supporter, idx) => (
22+
<Link key={idx} to={supporter.link}>
23+
<WithTooltip content={supporter.name}>
24+
<div className="bg-white flex flex-col gap-2 w-full aspect-square p-4 justify-between shadow-sm rounded-md hover:border-text hover:cursor-pointer">
25+
<div
26+
style={{
27+
backgroundImage: `url('${supporter.imageUrl}')`,
28+
}}
29+
className="flex-1 bg-center w-full bg-contain bg-no-repeat"
30+
/>
31+
</div>
32+
</WithTooltip>
33+
</Link>
34+
))}
35+
</div>
36+
</div>
37+
</div>
38+
);
39+
};
40+
41+
export { Supporters };

src/pages/Supporters/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { Supporters } from './Supporters';
2+
3+
export { Supporters };

src/pages/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { SignIn } from './SignIn';
2-
32
import { Home } from './Home';
43
import { Shelter } from './Shelter';
54
import { EditShelterSupply } from './EditShelterSupply';
@@ -8,6 +7,7 @@ import { CreateShelter } from './CreateShelter';
87
import { UpdateShelter } from './UpdateShelter';
98
import { PrivacyPolicy } from './PrivacyPolicy';
109
import { AboutUs } from './AboutUs';
10+
import { Supporters } from './Supporters';
1111

1212
export {
1313
SignIn,
@@ -19,4 +19,5 @@ export {
1919
UpdateShelter,
2020
PrivacyPolicy,
2121
AboutUs,
22+
Supporters,
2223
};

0 commit comments

Comments
 (0)