Skip to content

Commit a876f91

Browse files
feat: refactoring legacy code (#997)
* feat: refactoring UI + Google auth (#994) * feat: new UI and google auth * feat: new UI for the clubs page * fix: mobile responsive * fix: mobile responsive changes * fix: adding beat indicator * fix: refactoring ui changes for mobiles * chore(refactor): files and folder structures * chore(refactor): new folder changes * Create Hello.txt * fix: changing up names * fix: rename fetcher.js to Fetcher.js * fix: rename filter.js to Filter.js * fix: rename clickAwayListener.jsx to ClickAwayListener.jsx * fix: rename validation.js to Validation.js * fix: renaming folders * chore(refactor): changing folder names to legacy * fix: changes to tests * fix: renaming workflow for beta * fix: configuring cookie for google auth * fix: taking down google authentication * feat: changes to workflows * fix: changing workflow to beta * fix: added correct link on the footer section (#1003) Co-authored-by: Tamal Das <tamalcodes@gmail.com> --------- Co-authored-by: Subham Bhattacharjee <94003231+SubhamB2003@users.noreply.github.com>
1 parent 22011eb commit a876f91

File tree

101 files changed

+2160
-4033
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+2160
-4033
lines changed

.github/workflows/prodtestbeta.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: E2E Tests + Production deploy (BETA)
2+
3+
env:
4+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
5+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_BETA }}
6+
7+
on:
8+
push:
9+
branches:
10+
- beta
11+
12+
jobs:
13+
cypress-run:
14+
runs-on: ubuntu-latest
15+
16+
container: cypress/browsers:node18.12.0-chrome107
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v3
21+
22+
- name: set environment variables
23+
uses: allenevans/set-env@v2.0.0
24+
with:
25+
HUSKY: 0
26+
27+
- name: "Cypress Tests - Chrome"
28+
uses: cypress-io/github-action@v4.2.0
29+
with:
30+
install: true
31+
build: npm run build
32+
start: npm run dev
33+
wait-on: "http://localhost:3000"
34+
wait-on-timeout: 120
35+
browser: chrome
36+
spec: cypress/e2e/*
37+
env:
38+
CI: "false"
39+
40+
Deploy-Production:
41+
needs: cypress-run
42+
if: success()
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/checkout@v3
46+
- name: Install Vercel CLI
47+
run: npm install --global vercel@canary
48+
- name: Pull Vercel Environment Information
49+
run:
50+
vercel pull --yes --environment=production --token=${{
51+
secrets.VERCEL_TOKEN }}
52+
- name: Build Project Artifacts
53+
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
54+
- name: Deploy Project Artifacts to Vercel
55+
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}

.github/workflows/prtestbeta.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: E2E Tests + Preview deploy (BETA)
2+
3+
env:
4+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5+
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
6+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
7+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_BETA }}
8+
DEPLOY_PR_FROM_FORK: true
9+
10+
on:
11+
pull_request_target:
12+
types: [opened, synchronize, reopened]
13+
branches:
14+
- beta
15+
16+
jobs:
17+
cypress-run:
18+
runs-on: ubuntu-latest
19+
# use docker container to run tests
20+
container: cypress/browsers:node18.12.0-chrome107
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v3
24+
25+
- name: Install npm
26+
run: npm install -g husky
27+
28+
- name: set environment variables
29+
uses: allenevans/set-env@v2.0.0
30+
with:
31+
HUSKY: 0
32+
33+
- name: "Cypress Tests - Chrome"
34+
uses: cypress-io/github-action@v4.2.0
35+
with:
36+
install: true
37+
build: npm run build
38+
start: npm run dev
39+
wait-on: "http://localhost:3000"
40+
wait-on-timeout: 120
41+
browser: chrome
42+
spec: cypress/e2e/*
43+
env:
44+
CI: "false"
45+
46+
Deploy-Preview:
47+
needs: cypress-run
48+
if: success()
49+
runs-on: ubuntu-latest
50+
51+
steps:
52+
- id: script
53+
uses: actions/github-script@v3
54+
with:
55+
script: |
56+
const isPr = [ 'pull_request', 'pull_request_target' ].includes(context.eventName)
57+
core.setOutput('ref', isPr ? context.payload.pull_request.head.ref : context.ref)
58+
core.setOutput('repo', isPr ? context.payload.pull_request.head.repo.full_name : context.repo.full_name)
59+
60+
- name: Checkout
61+
uses: actions/checkout@v2
62+
with:
63+
ref: ${{ github.event.pull_request.head.ref }}
64+
repository: ${{ steps.script.outputs.repo }}
65+
66+
- name: Create Branch
67+
uses: peterjgrainger/action-create-branch@v2.2.0
68+
env:
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
with:
71+
branch: "${{ github.event.pull_request.head.ref }}"
72+
sha: "${{ github.event.pull_request.head.sha }}"
73+
74+
- name: Deploy to Vercel Action
75+
uses: BetaHuhn/deploy-to-vercel-action@latest
76+
with:
77+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
79+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
80+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_BETA }}
81+
DEPLOY_PR_FROM_FORK: true
82+
DELETE_EXISTING_COMMENT: true

.github/workflows/prtests.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ env:
1010
on:
1111
pull_request_target:
1212
types: [opened, synchronize, reopened]
13+
branches:
14+
- main
1315

1416
jobs:
1517
cypress-run:
@@ -78,12 +80,3 @@ jobs:
7880
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
7981
DEPLOY_PR_FROM_FORK: true
8082
DELETE_EXISTING_COMMENT: true
81-
82-
- name: Delete branch
83-
if:
84-
${{github.event.pull_request.head.ref !='main' && github.event.action
85-
== 'closed' && github.event.pull_request.merged == true }}
86-
uses: dawidd6/action-delete-branch@v3
87-
with:
88-
github_token: ${{ secrets.GITHUB_TOKEN }}
89-
branches: ${{ github.event.pull_request.head.ref }}

index.html

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,35 +14,34 @@
1414
<meta name="msapplication-navbutton-color" content="#E26959" />
1515
<meta name="msapplication-TileColor" content="#E26959">
1616
<meta name="apple-mobile-web-app-capable" content="yes" />
17-
<meta name="apple-mobile-web-app-status-bar-style" content="#E26959" />
18-
17+
<meta name="apple-mobile-web-app-status-bar-style" content="#E26959" />
18+
1919
<!-- Primary Meta Tags -->
2020
<meta name="title" content="Milan" />
2121
<meta name="language" content="en">
2222
<meta name="author" content="Tamal Das">
2323
<meta name="robots" content="index, follow">
2424
<meta name="revisit-after" content="7 days">
25-
<meta name="keywords" content="Milan, hub, connect, user collaboration, charities, NGO, support, social impact,community">
25+
<meta name="keywords"
26+
content="Milan, hub, connect, user collaboration, charities, NGO, support, social impact,community">
2627

27-
<!-- Open Graph / Facebook -->
28+
<!-- Open Graph / Facebook -->
2829
<meta property="og:type" content="website" />
2930
<meta property="og:url" content="https://milaan.vercel.app/" />
3031
<meta property="og:title" content="Milan" />
31-
<meta
32-
property="og:description"
33-
content="Welcome to Milan, a hub for users to collaborate with NGOs, Charities and more."
34-
/>
35-
<meta property="og:image" content="https://user-images.githubusercontent.com/72851613/207783151-1d2f19cf-afa4-477b-8823-dcabb86adbf5.png" />
32+
<meta property="og:description"
33+
content="Welcome to Milan, a hub for users to collaborate with NGOs, Charities and more." />
34+
<meta property="og:image"
35+
content="https://user-images.githubusercontent.com/72851613/207783151-1d2f19cf-afa4-477b-8823-dcabb86adbf5.png" />
3636

3737
<!-- Twitter -->
3838
<meta name="twitter:card" content="summary_large_image" />
3939
<meta property="twitter:url" content="https://milaan.vercel.app/" />
4040
<meta property="twitter:title" content="Milan" />
41-
<meta
42-
property="twitter:description"
43-
content="Welcome to Milan, a hub for users to collaborate with NGOs, Charities and more."
44-
/>
45-
<meta property="twitter:image" content="https://user-images.githubusercontent.com/72851613/207783151-1d2f19cf-afa4-477b-8823-dcabb86adbf5.png" />
41+
<meta property="twitter:description"
42+
content="Welcome to Milan, a hub for users to collaborate with NGOs, Charities and more." />
43+
<meta property="twitter:image"
44+
content="https://user-images.githubusercontent.com/72851613/207783151-1d2f19cf-afa4-477b-8823-dcabb86adbf5.png" />
4645

4746
<link rel="apple-touch-icon" href="/logo192.png" />
4847

@@ -82,6 +81,7 @@
8281
<link href="https://fonts.googleapis.com/css2?family=Sarabun&display=swap" rel="stylesheet">
8382
<link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">
8483
<link href="https://fonts.googleapis.com/css2?family=Exo+2:ital@1&display=swap" rel="stylesheet">
84+
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@800&display=swap" rel="stylesheet">
8585

8686
<title>Milan</title>
8787
</head>
@@ -98,4 +98,4 @@
9898
</body>
9999

100100

101-
</html>
101+
</html>

lol.txt

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
<div className="mib_main_parent">
2+
<div className="mib_subparent1">
3+
<div
4+
className="mib_imgdiv"
5+
{...(window.innerWidth > 800
6+
? { "data-aos": "fade-right", "data-aos-duration": "500" }
7+
: {})}
8+
>
9+
<img
10+
src={MilanLanding1}
11+
alt="a group of people in different poses"
12+
width={430}
13+
height={430}
14+
/>
15+
</div>
16+
17+
<div
18+
className="mib_textdiv"
19+
{...(window.innerWidth > 800
20+
? { "data-aos": "fade-left", "data-aos-duration": "500" }
21+
: {})}
22+
>
23+
<p className="mib_header1">How we do it ?</p>
24+
25+
<div>
26+
{window.innerWidth < 800 ? (
27+
<p className="mib_header2">
28+
Users can sign up as a charity, NGO, or individual to create a
29+
collaboration hub for connecting and helping each other. They
30+
can join events, clubs, donate, and raise funds for NGOs.
31+
</p>
32+
) : (
33+
<p className="mib_header2">
34+
Our users can signup as a charity, NGO, or an individual. We
35+
have a simple goal which is to make a collaboration hub where
36+
people can connect and help each other. You as can join
37+
events, clubs, donate. And if you are an NGO, you can raise
38+
funds, promote events, and much more.
39+
</p>
40+
)}
41+
</div>
42+
</div>
43+
</div>
44+
<div className="mib_subparent2">
45+
<div
46+
className="mib_textdiv"
47+
{...(window.innerWidth > 800
48+
? { "data-aos": "fade-right", "data-aos-duration": "500" }
49+
: {})}
50+
>
51+
<p className="mib_header1">You help people survive.</p>
52+
53+
<div>
54+
<p className="mib_header2">
55+
You donate directly to the charity or NGO, be it money or any
56+
other resources. We do not take any cut from the donations.
57+
Additionaly we allow verified orgs to raise funds, promote
58+
charity events, and much more. Remember, every penny/resource
59+
counts.
60+
</p>
61+
</div>
62+
</div>
63+
64+
<div
65+
className="mib_imgdiv"
66+
{...(window.innerWidth > 800
67+
? { "data-aos": "fade-left", "data-aos-duration": "500" }
68+
: {})}
69+
>
70+
<img
71+
src={MilanLanding2}
72+
alt="group of people holding boxes"
73+
width={430}
74+
height={430}
75+
/>
76+
</div>
77+
</div>
78+
</div>
79+
80+
<div className="mib_main_parent2">
81+
<div className="mib_subparent3">
82+
<div className="mib_imgdiv">
83+
<img
84+
src={LandingMobile}
85+
alt="collage of images of people shaking hands"
86+
width={324}
87+
height={324}
88+
/>
89+
</div>
90+
91+
<div className="mib_textdiv">
92+
<p className="mib_header1">Got something to sell ?</p>
93+
<div>
94+
<p className="mib_header2">
95+
We now have a shop where clubs, chairities and other Non profit
96+
organizations can sell thei handmade products. We do not take
97+
any cut from the sales. We are just a platform to connect the
98+
sellers and buyers.
99+
</p>
100+
</div>
101+
<div className="banner_signup_btndiv">
102+
<Button
103+
className="mib_explore_btn"
104+
onClick={() => {
105+
nav("/shop");
106+
window.scrollTo(0, 0);
107+
}}
108+
>
109+
Explore the shop
110+
</Button>
111+
</div>
112+
</div>
113+
</div>
114+
</div>

server/index.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,19 @@ const app = express();
1515
dotenv.config();
1616
connectToMongo();
1717

18-
app.use(cors({ origin: process.env.ORIGIN_URL, credentials: true }));
18+
app.use(
19+
cors({
20+
origin: (origin, callback) => {
21+
if (process.env.IGNORE_ORIGINS) {
22+
callback(null, true);
23+
} else {
24+
callback(null, process.env.ORIGIN_URL);
25+
}
26+
},
27+
credentials: true,
28+
allowedHeaders: ["Set-Cookie", "Content-Type"],
29+
}),
30+
);
1931

2032
app.use(express.json());
2133
app.use(express.urlencoded({ extended: false }));
@@ -28,7 +40,7 @@ app.use(
2840
saveUninitialized: false,
2941
resave: false,
3042
cookie: {
31-
maxAge: 1000 * 60 * 100,
43+
maxAge: 1000 * 60 * 60 * 24 * 30,
3244
},
3345
}),
3446
);

server/routes/club/Club.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,17 @@ router.post("/login", async (req, res) => {
5757
}
5858

5959
const payload = { Club: { id: existingUser.email } };
60-
61-
jwt.sign(payload, process.env.JWT_SECRET, (err, token) => {
62-
if (err) throw new Error("Something Went Wrong!!");
63-
res.status(201).json({ token, isuser: false, message: "Logged you in!" });
64-
});
60+
const token = jwt.sign(payload, process.env.JWT_SECRET);
61+
62+
res
63+
.status(201)
64+
.cookie("Token", token, {
65+
sameSite: "none",
66+
httpOnly: true,
67+
expires: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000),
68+
secure: true,
69+
})
70+
.json({ token, isuser: false, message: "Logged you in !" });
6571
} catch (e) {
6672
res.status(500).json({ success: false });
6773
}

0 commit comments

Comments
 (0)