Skip to content

Commit

Permalink
fix id bug (#2074)
Browse files Browse the repository at this point in the history
  • Loading branch information
pranshugupta54 authored Jul 6, 2024
1 parent 0254bb0 commit 45efc65
Show file tree
Hide file tree
Showing 15 changed files with 379 additions and 182 deletions.
497 changes: 337 additions & 160 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,6 @@
"noFiltersApplied": "No filters applied",
"manage": "Manage",
"searchResultsFor": "Search results for {{text}}",
"none": "None"
"none": "None",
"Donate": "Donate"
}
5 changes: 4 additions & 1 deletion public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,10 @@
},
"postCard": {
"likes": "Likes",
"comments": "Comments"
"comments": "Comments",
"viewPost": "View Post",
"editPost": "Edit Post",
"postedOn": "Posted on {{date}}"
},
"home": {
"posts": "Posts",
Expand Down
3 changes: 2 additions & 1 deletion public/locales/fr/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,6 @@
"noFiltersApplied": "Aucun filtre appliqué",
"manage": "Gérer",
"searchResultsFor": "Résultats de recherche pour {{text}}",
"none": "Aucun"
"none": "Aucun",
"Donate": "Faire un don"
}
5 changes: 4 additions & 1 deletion public/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,10 @@
},
"postCard": {
"likes": "Aime",
"comments": "commentaires"
"comments": "commentaires",
"viewPost": "Voir le message",
"editPost": "Modifier le message",
"postedOn": "Publié le {{date}}"
},
"home": {
"posts": "Des postes",
Expand Down
3 changes: 2 additions & 1 deletion public/locales/hi/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,6 @@
"noFiltersApplied": "कोई फ़िल्टर लागू नहीं हैं",
"manage": "प्रबंधित करें",
"searchResultsFor": "{{text}} के लिए खोज परिणाम",
"none": "कोई नहीं"
"none": "कोई नहीं",
"Donate": "दान करें"
}
5 changes: 4 additions & 1 deletion public/locales/hi/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,10 @@
},
"postCard": {
"likes": "पसंद है",
"comments": "टिप्पणियाँ"
"comments": "टिप्पणियाँ",
"viewPost": "पोस्ट देखें",
"editPost": "पोस्ट संपादित करें",
"postedOn": "{{date}} को पोस्ट किया गया"
},
"home": {
"posts": "पदों",
Expand Down
3 changes: 2 additions & 1 deletion public/locales/sp/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,6 @@
"noFiltersApplied": "No se aplicaron filtros",
"manage": "Administrar",
"searchResultsFor": "Resultados de búsqueda para {{text}}",
"none": "Ninguno"
"none": "Ninguno",
"Donate": "Donar"
}
5 changes: 4 additions & 1 deletion public/locales/sp/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,10 @@
},
"postCard": {
"likes": "Gustos",
"comments": "Comentarios"
"comments": "Comentarios",
"viewPost": "Ver publicación",
"editPost": "Editar publicación",
"postedOn": "Publicado el {{date}}"
},
"home": {
"feed": "Alimentar",
Expand Down
3 changes: 2 additions & 1 deletion public/locales/zh/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,6 @@
"noFiltersApplied": "未应用筛选器",
"manage": "管理",
"searchResultsFor": "搜索结果:{{text}}",
"none": "没有"
"none": "没有",
"Donate": "捐赠"
}
5 changes: 4 additions & 1 deletion public/locales/zh/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,10 @@
},
"postCard": {
"likes": "喜欢",
"comments": "评论"
"comments": "评论",
"viewPost": "查看帖子",
"editPost": "编辑帖子",
"postedOn": "发布于 {{date}}"
},
"home": {
"posts": "帖子",
Expand Down
4 changes: 2 additions & 2 deletions src/components/UserPortal/PostCard/PostCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ describe('Testing PostCard Component [User Portal]', () => {
{
id: '64eb13beca85de60ebe0ed0e',
creator: {
_id: '63d6064458fce20ee25c3bf7',
id: '63d6064458fce20ee25c3bf7',
firstName: 'Noble',
lastName: 'Mittal',
email: 'test@gmail.com',
Expand All @@ -199,7 +199,7 @@ describe('Testing PostCard Component [User Portal]', () => {
{
id: '64eb13beca85de60ebe0ed0b',
creator: {
_id: '63d6064458fce20ee25c3bf8',
id: '63d6064458fce20ee25c3bf8',
firstName: 'Priyanshu',
lastName: 'Bartwal',
email: 'test1@gmail.com',
Expand Down
16 changes: 8 additions & 8 deletions src/components/UserPortal/PostCard/PostCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,10 @@ export default function postCard(props: InterfacePostCard): JSX.Element {
setCommentInput('');
setNumComments((numComments) => numComments + 1);

const newComment: any = {
id: createEventData.createComment._id,
const newComment: InterfaceCommentCardProps = {
id: createEventData.createComment.id,
creator: {
id: createEventData.createComment.creator.id,
id: createEventData.createComment.creator._id,
firstName: createEventData.createComment.creator.firstName,
lastName: createEventData.createComment.creator.lastName,
email: createEventData.createComment.creator.email,
Expand Down Expand Up @@ -287,7 +287,7 @@ export default function postCard(props: InterfacePostCard): JSX.Element {
{props.title}
</Card.Title>
<Card.Subtitle style={{ color: '#808080' }}>
Posted On: {props.postedAt}
{t('postedOn', { date: props.postedAt })}
</Card.Subtitle>
<Card.Text className={`${styles.cardText} mt-4`}>
{props.text}
Expand All @@ -302,7 +302,7 @@ export default function postCard(props: InterfacePostCard): JSX.Element {
data-testid={'viewPostBtn'}
onClick={toggleViewPost}
>
View Post
{t('viewPost')}
</Button>
</div>
</Card.Footer>
Expand Down Expand Up @@ -339,7 +339,7 @@ export default function postCard(props: InterfacePostCard): JSX.Element {
<h4>Comments</h4>
<div className={styles.commentContainer}>
{numComments ? (
comments.map((comment: any, index: any) => {
comments.map((comment, index: number) => {
const cardProps: InterfaceCommentCardProps = {
id: comment.id,
creator: {
Expand Down Expand Up @@ -415,7 +415,7 @@ export default function postCard(props: InterfacePostCard): JSX.Element {
<Modal show={showEditPost} onHide={toggleEditPost} size="lg" centered>
<Modal.Header closeButton className="py-2 ">
<p className="fs-3" data-testid={'editPostModalTitle'}>
Edit Post
{t('editPost')}
</p>
</Modal.Header>
<Modal.Body>
Expand All @@ -439,7 +439,7 @@ export default function postCard(props: InterfacePostCard): JSX.Element {
data-testid={'editPostBtn'}
onClick={handleEditPost}
>
Edit Post
{t('editPost')}
</Button>
</ModalFooter>
</Modal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ const UserSidebarOrg = ({
}
/>
</div>
{name}
{tCommon(name)}
</Button>
)}
</NavLink>
Expand Down
2 changes: 1 addition & 1 deletion src/utils/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ export interface InterfacePostCard {
comments: {
id: string;
creator: {
_id: string;
id: string;
firstName: string;
lastName: string;
email: string;
Expand Down

0 comments on commit 45efc65

Please sign in to comment.