Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merging most recent dev changes onto production #80

Merged
merged 68 commits into from
Sep 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
9c67d90
Backend work for search complete
bgunnar5 Aug 10, 2021
6e6eb17
Skeleton work for frontend search is complete
bgunnar5 Aug 10, 2021
8cd897e
Searching for Posts now works
bgunnar5 Aug 17, 2021
c04f348
Fixed color on remove nickname button
bgunnar5 Aug 17, 2021
380c562
Merge pull request #70 from 5-Bits-in-a-Byte/search-integration
bgunnar5 Aug 17, 2021
5089e48
Begin work on course search
bgunnar5 Aug 18, 2021
1ff745e
Frontend functionality complete, just need styling
bgunnar5 Aug 18, 2021
01ab28f
Icon on course cards now takes user to drafting posts for that specif…
Sephta Aug 18, 2021
96f3bd0
Merge pull request #71 from 5-Bits-in-a-Byte/dev-course-card-create-p…
Sephta Aug 18, 2021
391111a
Course search now fully functional
bgunnar5 Aug 18, 2021
bba038b
Merge pull request #72 from 5-Bits-in-a-Byte/course-search-refactor
bgunnar5 Aug 18, 2021
d9b0d3e
Updated User Model to accommodate user profiles
bgunnar5 Aug 18, 2021
d1e649b
Backend work for updating/retrieving user profile data completed
bgunnar5 Aug 18, 2021
9544670
Added mini course cards in the UserProfile page
Sephta Aug 18, 2021
55fac77
About section can now be updated
bgunnar5 Aug 18, 2021
19b67bd
Color selector in user profile now works
bgunnar5 Aug 18, 2021
33ec438
Removed refactor folder from ./posts/
Sephta Aug 20, 2021
e5de51f
Restructured ./posts/
Sephta Aug 20, 2021
7a63702
Renamed Options.js to OptionsPanel.js
Sephta Aug 20, 2021
dbd8a7e
PostView now called PostFeed
Sephta Aug 20, 2021
4b25700
Various changes to ./posts/ structure
Sephta Aug 20, 2021
9dd3331
Merge pull request #73 from 5-Bits-in-a-Byte/dev-code-reorg-posts - S…
Sephta Aug 20, 2021
34f0470
Fixed edit profile so the color selector isn't displayed at all times
bgunnar5 Aug 20, 2021
519f94d
Changes made to user profiles so that viewing other people's profiles…
bgunnar5 Aug 20, 2021
3454267
Remove/comment out console logs
bgunnar5 Aug 20, 2021
ee7680b
Created backend resource for leaving a course
bgunnar5 Aug 21, 2021
862bb5f
Added modal to confirm leaving course and functionality now works
bgunnar5 Aug 21, 2021
6bcb426
WOW CUSOM TOOLTIP SYSTEM EZ PZ
Sephta Aug 22, 2021
777c9f7
Various style changes!!!
Sephta Aug 23, 2021
3b8e52b
minor changes
Sephta Aug 24, 2021
bffcb16
minor change
Sephta Aug 24, 2021
6cb0abe
Fixed name error when loading user profiles
bgunnar5 Aug 24, 2021
80cbe4a
Refactor the leave course modal popup
bgunnar5 Aug 24, 2021
9e12060
Merge pull request #74 from 5-Bits-in-a-Byte/dev-user-profiles
bgunnar5 Aug 24, 2021
d1d8fb1
Linked user profiles and added back button to user profiles
bgunnar5 Aug 24, 2021
eb24841
Merge pull request #75 from 5-Bits-in-a-Byte/dev-inquire-tooltip - SU…
Sephta Aug 24, 2021
d75aff4
removed logo font
Sephta Aug 24, 2021
0f6437e
removed tooltips on top bar of courses page
Sephta Aug 24, 2021
e43fb44
fixed bug with post editor
Sephta Aug 24, 2021
e2707b8
minor change
Sephta Aug 24, 2021
9fb4749
Options panel now does not display at all if the user does not have t…
Sephta Aug 25, 2021
6b2e35a
Started work on configuring CSS on PostFeed page to handle different …
Sephta Aug 25, 2021
435542a
added more CSS related stuff
Sephta Aug 25, 2021
39b4505
fixed bug where post data not be refetched when courseId in the url c…
Sephta Aug 25, 2021
3db51d6
removed unecessary console logs
Sephta Aug 25, 2021
2a3559e
Post-view, and Comment-view pages are now viewable on mobile devices …
Sephta Aug 26, 2021
fc13ce2
improved button styling for smaller screen sizes (Post feed)
Sephta Aug 26, 2021
177b8b5
fixed styling bug
Sephta Aug 26, 2021
1e32827
Added MaterialCheckbox common component and updated PostDraft to use …
bgunnar5 Aug 31, 2021
179a22c
Added new anonymous checkbox to comments and replies
bgunnar5 Aug 31, 2021
9d93e4a
Removed unnecessary console log statements
bgunnar5 Aug 31, 2021
cd058bb
Fix bug where you couldn't see private post you created
bgunnar5 Aug 31, 2021
5b732fa
Merge pull request #76 from 5-Bits-in-a-Byte/dev-anon-checkbox-style-fix
bgunnar5 Aug 31, 2021
d0d6026
Fixed reaction state management when sorting by oldest/newest posts
bgunnar5 Sep 1, 2021
964ebd7
Merge pull request #77 from 5-Bits-in-a-Byte/dev-reaction-sortby-fix
bgunnar5 Sep 1, 2021
53c07fd
Fixed how adding a new role got rid of dropdown/ban/remove options an…
bgunnar5 Sep 1, 2021
24fb7ef
Fixed small cursor styling issue
bgunnar5 Sep 1, 2021
bc975f0
Updated GenerateUserList function so that upon deleting a role, state…
bgunnar5 Sep 1, 2021
99c1604
Start work on displaying errors for config page
bgunnar5 Sep 1, 2021
d9875ce
Added changes for error messages to be added to config page
bgunnar5 Sep 2, 2021
c3e8327
Merge pull request #78 from 5-Bits-in-a-Byte/dev-assign-roles-section…
bgunnar5 Sep 2, 2021
3475406
disabled tooltips on left nav bar
Sephta Sep 10, 2021
09a9151
Fixed about state bug and add new role bug
bgunnar5 Sep 10, 2021
ebd4fa7
Moved attemptSignIn function to common method and added calls to it f…
bgunnar5 Sep 10, 2021
e84036c
Merge pull request #79 from 5-Bits-in-a-Byte/dev-fetch-user-common-co…
bgunnar5 Sep 10, 2021
9f43617
modified modal styling, and fixed some bugs when creating / joining a…
Sephta Sep 12, 2021
499e9f4
removed unecessary comment
Sephta Sep 12, 2021
060d195
testing out masking out cutoff content
Sephta Sep 14, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function App() {
<Route path="/login" exact>
<Login />
</Route>
<PrivateRoute path="/userProfile" exact>
<PrivateRoute path="/userProfile/:profileId" exact>
<NavigationWrapper>
<UserProfile />
</NavigationWrapper>
Expand Down
27 changes: 2 additions & 25 deletions client/src/PrivateRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,15 @@ import {
UserDispatchContext,
UserContext,
} from "./components/context/UserProvider";
// import {
// UserRoleDispatchContext,
// UserRoleContext,
// } from "./components/context/UserRoleProvider";
import LazyFetch from "./components/common/requests/LazyFetch";
import { fetchUser } from "./components/common/externalMethods/FetchUser";

const PrivateRoute = (props) => {
const setUser = useContext(UserDispatchContext);
const user = useContext(UserContext);

// const setUserRole = useContext(UserRoleDispatchContext);
// const userRole = useContext(UserRoleContext);

const attemptSignIn = (token) => {
LazyFetch({
type: "get",
endpoint: "/me",
onSuccess: (data) => {
if (data && data._id) {
setUser(data);
}
},
onFailure: (err) => {
console.log("Error completing sign in:", err);
setUser(false);
},
});
};

useEffect(() => {
if (!user) {
attemptSignIn();
fetchUser(setUser);
}
});

Expand Down
96 changes: 51 additions & 45 deletions client/src/components/comments/Comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,25 @@ import Icon from "../common/Icon";
import OptionDots from "../../imgs/option-dots.svg";
import { UserContext } from "../context/UserProvider";
import { UserRoleContext } from "../context/UserRoleProvider";
import EditorWrapper from "../posts/refactorComponents/EditorWrapper";
import EditorWrapper from "../posts/wrappers/EditorWrapper";
import { Editor } from "react-draft-wysiwyg";
import { convertFromRaw, convertToRaw, EditorState } from "draft-js";
import Checkbox from "../common/Checkbox";
import createPalette from "@material-ui/core/styles/createPalette";
import MaterialCheckbox from "../common/MaterialCheckbox";

const Comment = ({ comment, isDraft, callback }) => {
// console.log("comment:", comment);
// console.log("Comment Role Object: ", userRole);
const { courseId, postid } = useParams();
const user = useContext(UserContext);
const userRole = useContext(UserRoleContext);

const [newReplies, setNewReplies] = useState([]);
const [isReplying, toggleReply] = useState(false);
const [isAnonymous, toggleIsAnonymous] = useState(false);

const [content, setContent] = useState({
isAnonymous: false,
raw: EditorState.createEmpty(),
plainText: EditorState.createEmpty(),
});
Expand All @@ -37,32 +39,30 @@ const Comment = ({ comment, isDraft, callback }) => {

const endpoint = "/courses/" + courseId + "/posts/" + postid + "/comments";

useEffect(() => {
console.log("Comment Object: ", comment);
});
// useEffect(() => {
// console.log("Comment Object: ", comment);
// });

const handleContentChange = (e) => {
const plainText = e.getCurrentContent().getPlainText();
setContent({ raw: e, plainText: plainText });
};

const imageCallback = async (file) => {
return new Promise(
(resolve, reject) => {
const formData = new FormData();
formData.append("imageFile", file)

LazyFetch({
type: "post",
endpoint: "/images",
data: formData,
onSuccess: (data) => {
resolve({ data: { link: data.data.link } });
}
});
}
);
}
return new Promise((resolve, reject) => {
const formData = new FormData();
formData.append("imageFile", file);

LazyFetch({
type: "post",
endpoint: "/images",
data: formData,
onSuccess: (data) => {
resolve({ data: { link: data.data.link } });
},
});
});
};

const renderContent = () => {
if (isDraft) {
Expand All @@ -77,8 +77,20 @@ const Comment = ({ comment, isDraft, callback }) => {
}}
onEditorStateChange={handleContentChange}
toolbar={{
options: ["inline", "list", "link", "emoji", "history", "blockType", "image"],
image: { uploadCallback: imageCallback, uploadEnabled: true, previewImage: true }
options: [
"inline",
"list",
"link",
"emoji",
"history",
"blockType",
"image",
],
image: {
uploadCallback: imageCallback,
uploadEnabled: true,
previewImage: true,
},
}}
/>
);
Expand All @@ -93,7 +105,7 @@ const Comment = ({ comment, isDraft, callback }) => {
};

// Create or cancel the reply here (depends on if content is passed)
const submitReply = (content = null) => {
const submitReply = (isAnonymous, content = null) => {
if (!content) {
toggleReply(false);
} else {
Expand All @@ -104,7 +116,7 @@ const Comment = ({ comment, isDraft, callback }) => {
LazyFetch({
type: "post",
endpoint: endpoint + "/" + comment._id + "/replies",
data: { content: newContent, isAnonymous: newContent.isAnonymous },
data: { content: newContent, isAnonymous: isAnonymous },
onSuccess: (data) => {
console.log("data:", data);
toggleReply(false);
Expand All @@ -131,7 +143,6 @@ const Comment = ({ comment, isDraft, callback }) => {
// Collect replies from comment data and append any newly created replies (if applicable)
let replies = [];
if (comment.replies && comment.replies.length > 0) {
console.log("inside reply loader");
comment.replies.forEach((reply) => {
replies.push(
<CommentReply
Expand All @@ -149,7 +160,6 @@ const Comment = ({ comment, isDraft, callback }) => {

// If the user clicks reply, insert a drafted reply
if (isReplying) {
console.log("in isReplying section");
replies.unshift(
<CommentReply
isDraft
Expand Down Expand Up @@ -232,7 +242,7 @@ const Comment = ({ comment, isDraft, callback }) => {
) {
viewOptions = true;
}
console.log("content.isAnonymous:", content.isAnonymous);
// console.log("content.isAnonymous:", content.isAnonymous);

return (
<CommentWrapper>
Expand All @@ -251,13 +261,24 @@ const Comment = ({ comment, isDraft, callback }) => {
<PostMetaContentWrapper className="meta">
<UserDescription isInstructor={comment.isInstructor}>
by{" "}
{!content.isAnonymous
{!isAnonymous
? comment.postedBy.first + " " + comment.postedBy.last
: "Anonymous"}
</UserDescription>
<MetaIconWrapper>
{isDraft ? (
<>
{userRole && userRole.privacy.anonymous ? (
<MaterialCheckbox
label="Make Anonymous"
checkedState={{
checked: isAnonymous,
toggleChecked: toggleIsAnonymous,
}}
/>
) : (
<></>
)}
<Button
secondary
style={{ marginRight: 10 }}
Expand All @@ -267,25 +288,10 @@ const Comment = ({ comment, isDraft, callback }) => {
>
Cancel
</Button>
{userRole && userRole.privacy.anonymous ? (
<Checkbox
checkboxName="isAnonymous"
labelText={"Make Anonymous"}
onChange={() => {
setContent({
...content,
isAnonymous: !content.isAnonymous,
});
}}
checkStatus={content.isAnonymous}
/>
) : (
<></>
)}
<Button
primary
onClick={() => {
callback(content);
callback(content, isAnonymous);
}}
>
Submit
Expand Down
Loading