Skip to content

Commit 06e1fbc

Browse files
authored
Merge pull request #45 from TryShape/Add-a-Landing-Page-#10
feat: Now the edit and delete action is not limited to the private sh…
2 parents 0af375d + d0b183b commit 06e1fbc

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

components/utils/Header.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ const Header = ({
241241
};
242242

243243
const tweet = () => {
244-
const link = `https://twitter.com/intent/tweet?text=Check%20this%20amazing%20app%20http://unshape.vercel.app/,%20created%20by%20@tapasadhikary%20and%20friends%0A%0A%23DEVCommunity%20%23100DaysOfCode%20%23unshape`;
244+
const link = `https://twitter.com/intent/tweet?text=Check%20this%20amazing%20app%20https://tryshape.vercel.app/,%20created%20by%20@tapasadhikary%20and%20friends%0A%0A%23DEVCommunity%20%23100DaysOfCode%20%23tryshape`;
245245
if(typeof window !== 'undefined') {
246246
window.open(
247247
link,

components/utils/ShapeList.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,10 @@ const ShapeList = (
411411
}
412412
};
413413

414+
const canEditOrDelete = shape => {
415+
return user.email === shape.createdBy;
416+
}
417+
414418

415419

416420
return (
@@ -500,13 +504,13 @@ const ShapeList = (
500504
</Button>
501505
</ShapeActionsPrimary>
502506
<ShapeActionsSecondary>
503-
{shape.private ?
507+
{canEditOrDelete(shape) ?
504508
<Button title="Edit Shape" size='sm' variant="outline-secondary" onClick={() => {performEdit(shape); console.log(shape)}}>
505509
<FiEdit2 />
506510
Edit
507511
</Button> : null
508512
}
509-
{shape.private ?
513+
{canEditOrDelete(shape) ?
510514
<Button title="Delete Shape" size='sm' variant="outline-secondary" onClick={() => {performDelete(shape); console.log(shape)}}>
511515
<FiTrash2 />
512516
Delete

0 commit comments

Comments
 (0)