Skip to content

Commit 40f579f

Browse files
committed
Merge branch 'main' into dev
2 parents 95f03d7 + be3cfa0 commit 40f579f

File tree

8 files changed

+1046
-533
lines changed

8 files changed

+1046
-533
lines changed

backend/api/views/download.py

Lines changed: 216 additions & 300 deletions
Large diffs are not rendered by default.

backend/api/views/main.py

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@ def get_accounts(account_type):
156156
"email": hub_user.email,
157157
"image": hub_user.image,
158158
}
159+
160+
# Check if we should include Hub accounts in Partners view
161+
include_hubs = request.args.get("include_hubs", "false").lower() == "true"
162+
159163
if "restricted" in request.args:
160164
if request.args["restricted"] == "true":
161165
if "hub_user_id" in request.args:
@@ -164,33 +168,61 @@ def get_accounts(account_type):
164168
restricted=True, hub_id=request.args["hub_user_id"]
165169
)
166170
else:
167-
accounts = PartnerProfile.objects(restricted=True)
171+
# Filter by include_hubs parameter
172+
if include_hubs:
173+
accounts = PartnerProfile.objects(restricted=True)
174+
else:
175+
accounts = PartnerProfile.objects.filter(
176+
restricted=True, hub_id=None
177+
)
168178
else:
169-
accounts = PartnerProfile.objects.filter(
170-
restricted=True, hub_id=None
171-
)
179+
# Filter by include_hubs parameter
180+
if include_hubs:
181+
accounts = PartnerProfile.objects(restricted=True)
182+
else:
183+
accounts = PartnerProfile.objects.filter(
184+
restricted=True, hub_id=None
185+
)
172186
else:
173187
if "hub_user_id" in request.args:
174188
if request.args["hub_user_id"] != "":
175189
accounts = PartnerProfile.objects.filter(
176190
restricted__ne=True, hub_id=request.args["hub_user_id"]
177191
)
178192
else:
179-
accounts = PartnerProfile.objects.filter(restricted__ne=True)
193+
# Filter by include_hubs parameter
194+
if include_hubs:
195+
accounts = PartnerProfile.objects.filter(restricted__ne=True)
196+
else:
197+
accounts = PartnerProfile.objects.filter(
198+
restricted__ne=True, hub_id=None
199+
)
180200
else:
181-
accounts = PartnerProfile.objects.filter(
182-
restricted__ne=True, hub_id=None
183-
)
201+
# Filter by include_hubs parameter
202+
if include_hubs:
203+
accounts = PartnerProfile.objects.filter(restricted__ne=True)
204+
else:
205+
accounts = PartnerProfile.objects.filter(
206+
restricted__ne=True, hub_id=None
207+
)
184208
else:
185209
if "hub_user_id" in request.args:
186210
if request.args["hub_user_id"] != "":
187211
accounts = PartnerProfile.objects(
188212
hub_id=request.args["hub_user_id"]
189213
)
190214
else:
191-
accounts = PartnerProfile.objects()
215+
# Filter by include_hubs parameter
216+
if include_hubs:
217+
accounts = PartnerProfile.objects()
218+
else:
219+
accounts = PartnerProfile.objects(hub_id=None)
192220
else:
193-
accounts = PartnerProfile.objects(hub_id=None)
221+
# Filter by include_hubs parameter
222+
if include_hubs:
223+
accounts = PartnerProfile.objects()
224+
else:
225+
accounts = PartnerProfile.objects(hub_id=None)
194226
temp = []
195227
for account in accounts:
196228
if account.hub_id is not None:
@@ -1125,7 +1157,7 @@ def submit_bug_report():
11251157
return create_response(status=500, message="Failed to save bug report")
11261158

11271159
# Recipients list - currently just one, but structured for multiple in the future
1128-
recipients = ["juan@menteeglobal.org"]
1160+
recipients = ["juan@menteeglobal.org", "letitia@menteeglobal.org"]
11291161

11301162
# Build HTML email content with attachment links
11311163
attachments_html = ""

frontend/src/components/AdminDropdowns.js

Lines changed: 45 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import React, { useState, useEffect } from "react";
2-
import { Menu, Dropdown } from "antd";
3-
import { DownOutlined } from "@ant-design/icons";
2+
import { Menu, Dropdown, Button } from "antd";
3+
import { DownOutlined, SortAscendingOutlined } from "@ant-design/icons";
44
import { getDisplaySpecializations } from "utils/api";
55

66
export function SortByApptDropdown(props) {
77
const options = {
88
ASCENDING: {
99
key: 0,
10-
text: "Greatest to least",
10+
text: "Most appointments",
1111
},
1212
DESCENDING: {
1313
key: 1,
14-
text: "Least to greatest",
14+
text: "Least appointments",
1515
},
1616
};
1717

@@ -28,20 +28,22 @@ export function SortByApptDropdown(props) {
2828

2929
const overlay = (
3030
<Menu>
31-
<Menu.Item>
32-
<a onClick={() => handleClick(options.ASCENDING)}>Greatest to least</a>
31+
<Menu.Item onClick={() => handleClick(options.ASCENDING)}>
32+
<span style={{ fontWeight: 500 }}>Most appointments</span>
3333
</Menu.Item>
34-
<Menu.Item>
35-
<a onClick={() => handleClick(options.DESCENDING)}>Least to greatest</a>
34+
<Menu.Item onClick={() => handleClick(options.DESCENDING)}>
35+
<span style={{ fontWeight: 500 }}>Least appointments</span>
3636
</Menu.Item>
3737
</Menu>
3838
);
3939

4040
return (
4141
<Dropdown overlay={overlay} className={props.className} trigger={["click"]}>
42-
<a>
43-
{option ? option.text : "Sort Order"} <DownOutlined />
44-
</a>
42+
<Button style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
43+
<SortAscendingOutlined />
44+
<span style={{ fontWeight: 500 }}>{option ? option.text : "Sort by"}</span>
45+
<DownOutlined style={{ fontSize: 12 }} />
46+
</Button>
4547
</Dropdown>
4648
);
4749
}
@@ -91,34 +93,32 @@ export function MenteeMentorDropdown(props) {
9193

9294
const overlay = (
9395
<Menu>
94-
<Menu.Item>
95-
<a onClick={() => handleClick(options.MENTORS)}>Mentors</a>
96+
<Menu.Item onClick={() => handleClick(options.MENTORS)}>
97+
<span style={{ fontWeight: 500 }}>Mentors</span>
9698
</Menu.Item>
97-
<Menu.Item>
98-
<a onClick={() => handleClick(options.MENTEES)}>Mentees</a>
99+
<Menu.Item onClick={() => handleClick(options.MENTEES)}>
100+
<span style={{ fontWeight: 500 }}>Mentees</span>
99101
</Menu.Item>
100-
<Menu.Item>
101-
<a onClick={() => handleClick(options.PARTNERS)}>Partners</a>
102+
<Menu.Item onClick={() => handleClick(options.PARTNERS)}>
103+
<span style={{ fontWeight: 500 }}>Partners</span>
102104
</Menu.Item>
103-
<Menu.Item>
104-
<a onClick={() => handleClick(options.GUESTS)}>Guests</a>
105+
<Menu.Item onClick={() => handleClick(options.GUESTS)}>
106+
<span style={{ fontWeight: 500 }}>Guests</span>
105107
</Menu.Item>
106-
<Menu.Item>
107-
<a onClick={() => handleClick(options.SUPPORT)}>Supporters</a>
108+
<Menu.Item onClick={() => handleClick(options.SUPPORT)}>
109+
<span style={{ fontWeight: 500 }}>Supporters</span>
108110
</Menu.Item>
109-
<Menu.Item>
110-
<a onClick={() => handleClick(options.MODERATOR)}>Moderators</a>
111+
<Menu.Item onClick={() => handleClick(options.MODERATOR)}>
112+
<span style={{ fontWeight: 500 }}>Moderators</span>
111113
</Menu.Item>
112-
{/* <Menu.Item>
113-
<a onClick={() => handleClick(options.ALL)}>All</a>
114-
</Menu.Item> */}
115114
</Menu>
116115
);
117116
return (
118117
<Dropdown overlay={overlay} className={props.className} trigger={["click"]}>
119-
<a>
120-
{option.text} <DownOutlined />
121-
</a>
118+
<Button style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
119+
<span style={{ fontWeight: 500 }}>{option.text}</span>
120+
<DownOutlined style={{ fontSize: 12 }} />
121+
</Button>
122122
</Dropdown>
123123
);
124124
}
@@ -226,11 +226,11 @@ export function SortByDateDropdown(props) {
226226
}
227227

228228
export function HubsDropdown(props) {
229-
const [option, setOption] = useState("Filter by");
229+
const [option, setOption] = useState("All Hubs");
230230
const [selected, setSelected] = useState([]);
231231

232232
useEffect(() => {
233-
setOption("Filter by");
233+
setOption("All Hubs");
234234
}, [props.onReset]);
235235

236236
const handleClick = (newOption, text) => {
@@ -243,16 +243,19 @@ export function HubsDropdown(props) {
243243

244244
const overlay = (
245245
<Menu>
246+
<Menu.Item onClick={() => handleClick(null, "All Hubs")}>
247+
<span style={{ fontWeight: 500 }}>All Hubs</span>
248+
</Menu.Item>
246249
{props.options &&
247250
props.options.map((element, i) => {
248251
return (
249-
<Menu.Item>
250-
<a
251-
onClick={() => handleClick(element.value, element.label)}
252-
style={{ color: selected.includes(i) ? "red" : "black" }}
253-
>
252+
<Menu.Item
253+
key={element.value}
254+
onClick={() => handleClick(element.value, element.label)}
255+
>
256+
<span style={{ fontWeight: selected.includes(i) ? 600 : 400 }}>
254257
{element.label}
255-
</a>
258+
</span>
256259
</Menu.Item>
257260
);
258261
})}
@@ -264,11 +267,12 @@ export function HubsDropdown(props) {
264267
overlay={overlay}
265268
className={props.className}
266269
trigger={["click"]}
267-
overlayStyle={{ overflowY: "auto", height: "auto" }}
270+
overlayStyle={{ overflowY: "auto", maxHeight: 300 }}
268271
>
269-
<a>
270-
{option} <DownOutlined />
271-
</a>
272+
<Button style={{ display: 'flex', alignItems: 'center', gap: 8, minWidth: 140 }}>
273+
<span style={{ fontWeight: 500 }}>{option}</span>
274+
<DownOutlined style={{ fontSize: 12 }} />
275+
</Button>
272276
</Dropdown>
273277
);
274278
}

frontend/src/components/PartnerProfileForm.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ function PartnerProfileForm({
141141
<Input />
142142
</Form.Item>
143143
)}
144-
{(!hub_user || !hub_user.url.includes("AUAF")) && (
144+
{(!hub_user || !hub_user.url?.includes("AUAF")) && (
145145
<Form.Item
146146
label={t("partnerProfile.organizationName")}
147147
name="organization"
@@ -195,7 +195,7 @@ function PartnerProfileForm({
195195
</Form.Item>
196196
</div>
197197
) : null}
198-
{hub_user && hub_user.url.includes("AUAF") && (
198+
{hub_user && hub_user.url?.includes("AUAF") && (
199199
<Form.Item
200200
label={t("partnerProfile.title")}
201201
name="title"
@@ -210,7 +210,7 @@ function PartnerProfileForm({
210210
<Input />
211211
</Form.Item>
212212
)}
213-
{(!hub_user || !hub_user.url.includes("AUAF")) && (
213+
{(!hub_user || !hub_user.url?.includes("AUAF")) && (
214214
<Form.Item
215215
label={t("partnerProfile.location")}
216216
name="location"
@@ -227,7 +227,7 @@ function PartnerProfileForm({
227227
)}
228228
<Form.Item
229229
label={
230-
hub_user && hub_user.url.includes("AUAF")
230+
hub_user && hub_user.url?.includes("AUAF")
231231
? t("partnerProfile.AUAFcontactFullName")
232232
: t("partnerProfile.contactFullName")
233233
}
@@ -241,7 +241,7 @@ function PartnerProfileForm({
241241
>
242242
<Input />
243243
</Form.Item>
244-
{(!hub_user || !hub_user.url.includes("AUAF")) && (
244+
{(!hub_user || !hub_user.url?.includes("AUAF")) && (
245245
<Form.Item
246246
label={t("partnerProfile.regionsWork")}
247247
name="regions"
@@ -257,7 +257,7 @@ function PartnerProfileForm({
257257
)}
258258
<Form.Item
259259
label={
260-
hub_user && hub_user.url.includes("AUAF")
260+
hub_user && hub_user.url?.includes("AUAF")
261261
? t("partnerProfile.AUAFbriefIntro")
262262
: t("partnerProfile.briefIntro")
263263
}
@@ -271,7 +271,7 @@ function PartnerProfileForm({
271271
>
272272
<Input.TextArea rows={3} />
273273
</Form.Item>
274-
{!hub_user || !hub_user.url.includes("AUAF") ? (
274+
{!hub_user || !hub_user.url?.includes("AUAF") ? (
275275
<div className={styles.formGroup}>
276276
<Form.Item
277277
className={styles.formGroupItem}
@@ -340,10 +340,10 @@ function PartnerProfileForm({
340340
>
341341
<Select mode="multiple" options={getSDGs(t)} />
342342
</Form.Item>
343-
{(!hub_user || !hub_user.url.includes("AUAF")) && (
343+
{(!hub_user || !hub_user.url?.includes("AUAF")) && (
344344
<Form.Item
345345
label={
346-
hub_user && hub_user.url === "GSRFoundation"
346+
hub_user && hub_user.url?.includes("GSRFoundation")
347347
? t("partnerProfile.projectNames_GSR")
348348
: t("partnerProfile.projectNames")
349349
}
@@ -353,12 +353,12 @@ function PartnerProfileForm({
353353
</Form.Item>
354354
)}
355355

356-
{hub_user && hub_user.url === "GSRFoundation" && (
356+
{hub_user && hub_user.url?.includes("GSRFoundation") && (
357357
<Form.Item label={t("partnerProfile.success_GSR")} name="success">
358358
<Input.TextArea rows={3} />
359359
</Form.Item>
360360
)}
361-
{(!hub_user || !hub_user.url.includes("AUAF")) && (
361+
{(!hub_user || !hub_user.url?.includes("AUAF")) && (
362362
<div className={styles.formGroup}>
363363
<Form.Item
364364
label={t("partnerProfile.collaborationGrants")}

0 commit comments

Comments
 (0)