Skip to content

Commit

Permalink
fix: edited name (#25)
Browse files Browse the repository at this point in the history
* fix: bugs

* fix: get bookmark call

* disabled search

* fix: edit profile

* feat: search functionality

* docs: update README and COMMENTS

* styles: text-overflow

* fix: edited name
  • Loading branch information
hsnice16 authored Jun 23, 2022
1 parent 9fa255a commit be00dda
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 6 deletions.
2 changes: 2 additions & 0 deletions COMMENTS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
### Merged PR #25 (fix: edited name)

### Merged PR #24 (feat: search functionality)

- **Join** tag line in Landing page
Expand Down
14 changes: 12 additions & 2 deletions src/components/broadcast-box/BroadcastBox.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import PropTypes from "prop-types";
import { Box } from "@mui/material";
import { useSelector } from "react-redux";
import styles from "./BroadcastBox.module.css";
import { EllipsisHorizontalIcon } from "assets";
import { useBroadcastDetails } from "custom-hooks";
Expand Down Expand Up @@ -31,6 +32,15 @@ export const BroadcastBox = ({ broadcastDetails }) => {

const navigate = useNavigate();

const {
profile: { status, data },
} = useSelector((state) => state.user);

const fullNameToShow =
status === "success" && data.username === username
? `${data.firstName} ${data.lastName}`
: `${firstName} ${lastName}`;

const {
anchorEl,
setAnchorEl,
Expand All @@ -55,9 +65,9 @@ export const BroadcastBox = ({ broadcastDetails }) => {
postContentText={content}
postUserProfilePic={profilePic}
openReplyDialog={openReplyDialog}
postUserFullname={fullNameToShow}
setOpenReplyDialog={setOpenReplyDialog}
postTimeDurationToShow={timeDurationToShow}
postUserFullname={`${firstName} ${lastName}`}
/>
)}

Expand All @@ -80,8 +90,8 @@ export const BroadcastBox = ({ broadcastDetails }) => {
>
<Box className={styles.container}>
<BroadcastBoxHeader
h2Text={fullNameToShow}
className={styles.header}
h2Text={`${firstName} ${lastName}`}
linkProps={{
component: Link,
to: `${ROUTE_PROFILE}/${username}`,
Expand Down
12 changes: 11 additions & 1 deletion src/components/comment-box/CommentBox.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import PropTypes from "prop-types";
import { Link } from "react-router-dom";
import { useSelector } from "react-redux";
import { useEffect, useState } from "react";
import styles from "./CommentBox.module.css";
import { Box, Typography } from "@mui/material";
Expand All @@ -10,6 +11,15 @@ export const CommentBox = ({ postUsername, comment }) => {
const { username, profilePic, lastName, firstName, text, createdAt } =
comment;

const {
profile: { status, data },
} = useSelector((state) => state.user);

const fullNameToShow =
status === "success" && data.username === username
? `${data.firstName} ${data.lastName}`
: `${firstName} ${lastName}`;

const [timeDurationToShow, setTimeDurationToShow] = useState(
getTimeDurationToShow(createdAt)
);
Expand All @@ -31,7 +41,7 @@ export const CommentBox = ({ postUsername, comment }) => {
>
<Box className={styles.container}>
<BroadcastBoxHeader
h2Text={`${firstName} ${lastName}`}
h2Text={fullNameToShow}
linkProps={{
component: Link,
to: `${ROUTE_PROFILE}/${username}`,
Expand Down
1 change: 1 addition & 0 deletions src/components/right-sidebar/RightSideBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export const RightSideBar = () => {
className={styles.inputField}
placeholder="Search ThinkLoud"
onChange={handleSearchInputChange}
onClick={(event) => event.stopPropagation()}
startAdornment={
<InputAdornment position="start">
<SearchIcon className={styles.searchIcon} />
Expand Down
14 changes: 12 additions & 2 deletions src/components/single-main-post/SingleMainPost.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import PropTypes from "prop-types";
import { ROUTE_PROFILE } from "utils";
import { Link } from "react-router-dom";
import { useSelector } from "react-redux";
import { EllipsisHorizontalIcon } from "assets";
import { Box, Typography } from "@mui/material";
import styles from "./SingleMainPost.module.css";
Expand Down Expand Up @@ -28,6 +29,15 @@ export const SingleMainPost = ({ details }) => {
likes: { likeCount, likedBy },
} = details;

const {
profile: { status, data },
} = useSelector((state) => state.user);

const fullNameToShow =
status === "success" && data.username === username
? `${data.firstName} ${data.lastName}`
: `${firstName} ${lastName}`;

const {
anchorEl,
setAnchorEl,
Expand Down Expand Up @@ -57,9 +67,9 @@ export const SingleMainPost = ({ details }) => {
postContentText={content}
postUserProfilePic={profilePic}
openReplyDialog={openReplyDialog}
postUserFullname={fullNameToShow}
setOpenReplyDialog={setOpenReplyDialog}
postTimeDurationToShow={timeDurationToShow}
postUserFullname={`${firstName} ${lastName}`}
/>
)}

Expand All @@ -85,7 +95,7 @@ export const SingleMainPost = ({ details }) => {

<Box className={styles.name}>
<Typography component={Link} to={`${ROUTE_PROFILE}/${username}`}>
{`${firstName} ${lastName}`}
{fullNameToShow}
</Typography>
<Typography component="p">{`@${username}${timeDurationToShow}`}</Typography>
</Box>
Expand Down
5 changes: 5 additions & 0 deletions src/components/single-main-post/SingleMainPost.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@ button.btnMenu_icon svg path {
display: flex;
flex-direction: column;
margin-left: 2rem;
max-width: 75%;
}

.name a {
color: var(--COLOR-TEXT);
font-size: 1.6rem;
font-weight: bold;
max-width: 100%;
overflow: hidden;
text-decoration: none;
text-overflow: ellipsis;
white-space: nowrap;
}

.name a:hover {
Expand Down
9 changes: 8 additions & 1 deletion src/pages/single-post/SinglePost.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import {

export const SinglePost = () => {
const { postId } = useParams();
const {
profile: { data: profileData },
} = useSelector((state) => state.user);
const { api, propertyToGet } = API_TO_GET_SINGLE_POST;
const { data: postsData } = useSelector((state) => state.posts);

Expand All @@ -28,7 +31,11 @@ export const SinglePost = () => {

useScrollToTop();
useDocumentTitle(
status === "success" ? `${data.firstName} ${data.lastName} thinks` : "Post"
status === "success"
? profileData.username === data.username
? `${profileData.firstName} ${profileData.lastName} thinks`
: `${data.firstName} ${data.lastName} thinks`
: "Post"
);

useEffect(() => {
Expand Down

1 comment on commit be00dda

@vercel
Copy link

@vercel vercel bot commented on be00dda Jun 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

think-loud – ./

thinkloud.vercel.app
think-loud-hsnice16.vercel.app
think-loud-git-development-hsnice16.vercel.app

Please sign in to comment.