Skip to content

Commit ba4eaf3

Browse files
committed
Add discussion page + finalise frontend codebase
1 parent 6f3051f commit ba4eaf3

Some content is hidden

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

45 files changed

+1770
-563
lines changed

.env

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
REACT_APP_GRAPHQL_API_ENDPOINT = "http://127.0.0.1:8000/graphql"
1+
REACT_APP_CODEUINO_HOMEPAGE = "https://www.codeuino.org/"
2+
REACT_APP_BACKEND_URL = "http://127.0.0.1:8000/"
3+
REACT_APP_GRAPHQL_API_ENDPOINT = "http://127.0.0.1:8000/graphql"

src/assets/stylesheets/App.scss

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ body {
4646
}
4747
}
4848

49-
@media (max-width: 767px) and (min-width: 575px) {
49+
@media (max-width: 767px) and (min-width: 576px) {
5050
html {
5151
font-size: 16px;
5252
}
@@ -56,7 +56,7 @@ body {
5656
}
5757
}
5858

59-
@media (max-width: 576px) {
59+
@media (max-width: 575px) {
6060
html {
6161
font-size: 14px;
6262
}
@@ -277,7 +277,8 @@ body {
277277
}
278278

279279
@media (min-width: 768px) {
280-
.modal-wide .modal-dialog {
280+
.modal-wide
281+
.modal-dialog {
281282
max-width: 700px;
282283
margin: 1.75rem auto;
283284
}
@@ -290,6 +291,7 @@ body {
290291
margin: 0.4rem 0.2rem;
291292
padding: 0.4rem 0.8rem;
292293
transition: all .3s ease-in;
294+
293295
a {
294296
color: $white;
295297
text-decoration: none;

src/assets/stylesheets/index.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99
@import "../../pages/user/user.scss";
1010
@import "../../pages/tag/tag.scss";
1111
@import "../../pages/admin/admin.scss";
12+
@import "../../pages/discussion/discussion.scss";
1213
@import "../../components/common/common.scss";
1314
@import "../../components/navbar/navbar.scss";
1415
@import "../../components/topic/topic.scss";
1516
@import "../../components/user/user.scss";
1617
@import "../../components/admin/admin.scss";
18+
@import "../../components/discussion/discussion.scss";

src/commonFunctions/handleModal.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const handleModal = (modalName, action) => {
2-
let showValue = action == "open";
2+
let showValue = action === "open";
33
switch (modalName) {
44
case "login": {
55
return {
@@ -52,10 +52,19 @@ export const handleModal = (modalName, action) => {
5252
showUpdateTopicModal: showValue,
5353
};
5454
}
55+
case "announcements": {
56+
return {
57+
showAnnouncementsModal: showValue,
58+
};
59+
}
5560
case "delete": {
5661
return {
5762
showDeleteModal: showValue,
5863
};
5964
}
65+
default: {
66+
console.log(`Modal actions not defined for: ${modalName}`);
67+
return;
68+
}
6069
}
6170
};

src/commonFunctions/validateFormField.js

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,22 @@ export const fieldNames = {
1313
ORGANIZATION_LONG_DESCRIPTION: "organizationLongDescription",
1414
DESIGNATION: "designation",
1515
TWITTER: "twitter",
16+
MESSAGE_DESCRIPTION: "messageDescription",
1617
};
1718
Object.freeze(fieldNames);
1819

1920
export const checkFieldValidation = (fieldName, fieldValue, repeatFieldValue=null) => {
2021
switch (fieldName) {
2122
case fieldNames.FIRSTNAME: {
22-
if (fieldValue.trim().length == 0) {
23+
if (fieldValue.trim().length === 0) {
2324
return {
2425
firstNameError: "Enter first name",
2526
};
2627
}
2728
return { firstNameError: null };
2829
}
2930
case fieldNames.LASTNAME: {
30-
if (fieldValue.trim().length == 0) {
31+
if (fieldValue.trim().length === 0) {
3132
return {
3233
lastNameError: "Enter last name",
3334
};
@@ -54,23 +55,23 @@ export const checkFieldValidation = (fieldName, fieldValue, repeatFieldValue=nul
5455
return { passwordError: null };
5556
}
5657
case fieldNames.VERIFY_PASSWORD: {
57-
if (fieldValue != repeatFieldValue) {
58+
if (fieldValue !== repeatFieldValue) {
5859
return {
5960
verifyPasswordError: "Passwords don't match",
6061
};
6162
}
6263
return { verifyPasswordError: null };
6364
}
6465
case fieldNames.PHONE: {
65-
if (fieldValue.trim().length != 10) {
66+
if (fieldValue.trim().length !== 10) {
6667
return {
6768
phoneError: "Enter a valid phone number",
6869
};
6970
}
7071
return { phoneError: null };
7172
}
7273
case fieldNames.USER_SHORT_DESCRIPTION: {
73-
if (fieldValue.trim().length == 0) {
74+
if (fieldValue.trim().length === 0) {
7475
return {
7576
userShortDescriptionError: "Enter short description",
7677
};
@@ -95,7 +96,7 @@ export const checkFieldValidation = (fieldName, fieldValue, repeatFieldValue=nul
9596
}
9697
case fieldNames.WEBSITE: {
9798
if (
98-
//regex to be added
99+
//TBD: Regex
99100
fieldValue.match()
100101
) {
101102
return {
@@ -126,7 +127,7 @@ export const checkFieldValidation = (fieldName, fieldValue, repeatFieldValue=nul
126127
return { organizationLongDescriptionError: null };
127128
}
128129
case fieldNames.DESIGNATION: {
129-
if (fieldValue.trim().length < 2 && fieldValue.trim().length != 0) {
130+
if (fieldValue.trim().length < 2 && fieldValue.trim().length !== 0) {
130131
return {
131132
designationError: "Use 2 characters or more for designation",
132133
};
@@ -136,8 +137,9 @@ export const checkFieldValidation = (fieldName, fieldValue, repeatFieldValue=nul
136137
case fieldNames.TWITTER: {
137138
if (
138139
fieldValue.match(
139-
`http(?:s)?:\/\/(?:www\.)?twitter\.com\/([a-zA-Z0-9_]{1,15}$)`
140-
) ||fieldValue.length == 0
140+
`http(?:s)?://(?:www.)?twitter.com/([a-zA-Z0-9_]{1,15}$)`
141+
) ||
142+
fieldValue.length === 0
141143
) {
142144
return {
143145
twitterError: null,
@@ -148,5 +150,17 @@ export const checkFieldValidation = (fieldName, fieldValue, repeatFieldValue=nul
148150
};
149151
}
150152
}
153+
case fieldNames.MESSAGE_DESCRIPTION: {
154+
if (fieldValue.trim().length === 0) {
155+
return {
156+
messageDescriptionError: "Enter message",
157+
};
158+
}
159+
return { messageDescriptionError: null };
160+
}
161+
default: {
162+
console.log(`Validation not defined for: ${fieldName}`);
163+
return;
164+
}
151165
}
152166
};

src/components/addTask/addTask.js

Whitespace-only changes.

src/components/addTask/addTask.scss

Whitespace-only changes.

src/components/admin/admin.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
.admin-user-icon {
1414
color: $subheading-black;
15-
font-size: 4rem;
15+
font-size: 3.2rem;
1616
}
1717

1818
.col-3,
@@ -129,12 +129,12 @@
129129
@media (max-width: 850px) {
130130
.admin-user-card-container {
131131
.admin-user-icon {
132-
font-size: 2.5rem;
132+
font-size: 2.8rem;
133133
}
134134
}
135135
}
136136

137-
@media (max-width: 400px) {
137+
@media (max-width: 575px) {
138138
.admin-user-card-container {
139139
min-width: 100%;
140140
}

src/components/admin/insightsSection.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function InsightsSection(props) {
1010
const dispatch = useDispatch();
1111
useEffect(() => {
1212
if (
13-
Object.keys(organizationData).length == 0
13+
Object.keys(organizationData).length === 0
1414
) {
1515
dispatch(getOrganizationData());
1616
}

src/components/admin/membersCard.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function MembersCard(props) {
4141
props.handleOpenBlock();
4242
}}
4343
>
44-
{memberType == "blocked" ? "Unblock User" : "Block User"}
44+
{memberType === "blocked" ? "Unblock User" : "Block User"}
4545
</Dropdown.Item>
4646
<Dropdown.Item
4747
href=""
@@ -52,8 +52,8 @@ function MembersCard(props) {
5252
>
5353
Remove Account
5454
</Dropdown.Item>
55-
{memberType != "blocked" &&
56-
(memberType == "moderator" || memberType == "user") && (
55+
{memberType !== "blocked" &&
56+
(memberType === "moderator" || memberType === "user") && (
5757
<Dropdown.Item
5858
href=""
5959
onClick={() => {
@@ -63,8 +63,8 @@ function MembersCard(props) {
6363
Make Admin
6464
</Dropdown.Item>
6565
)}
66-
{memberType != "blocked" &&
67-
(memberType == "admin" || memberType == "user") && (
66+
{memberType !== "blocked" &&
67+
(memberType === "admin" || memberType === "user") && (
6868
<Dropdown.Item
6969
href=""
7070
onClick={() => {
@@ -74,7 +74,7 @@ function MembersCard(props) {
7474
Make Moderator
7575
</Dropdown.Item>
7676
)}
77-
{memberType != "blocked" && memberType == "admin" && (
77+
{memberType !== "blocked" && memberType === "admin" && (
7878
<Dropdown.Item
7979
href=""
8080
onClick={() => {
@@ -84,7 +84,7 @@ function MembersCard(props) {
8484
Remove Admin
8585
</Dropdown.Item>
8686
)}
87-
{memberType != "blocked" && memberType == "moderator" && (
87+
{memberType !== "blocked" && memberType === "moderator" && (
8888
<Dropdown.Item
8989
href=""
9090
onClick={() => {

0 commit comments

Comments
 (0)