-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix various bugs and implement new features (#52)
* Jovells workflow auto sync after pr merge (#4) * Update main.yml * Update main.yml * removed dev admin collection * prevent protected route redirect whern `user` not ready * fixed post btn disabling when post type is changed after setting invalid question link * fixed showing own interaction notifications * implemented following & isNotFollowing * implmented posts following tab * increase size of posts to fetch at a time to 5 and enhance infitite scroll * Add react-share library for social media sharing * implemented share button
- Loading branch information
Showing
19 changed files
with
604 additions
and
429 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { useState } from 'react'; | ||
import {Button} from './button'; | ||
import {Popover} from './popover'; | ||
import {EmailShareButton, FacebookShareButton, TwitterShareButton, LinkedinShareButton, EmailIcon, FacebookIcon, LinkedinIcon, TwitterIcon, XIcon} from 'react-share' | ||
import { toast } from './use-toast'; | ||
import { HiOutlineShare } from 'react-icons/hi2'; | ||
import { PopoverContent, PopoverTrigger } from '@radix-ui/react-popover'; | ||
|
||
export default function ShareButton({title, path} : {title: string, path: string}) { | ||
const [isOpen, setIsOpen] = useState(false); | ||
|
||
const handleButtonClick = () => { | ||
setIsOpen(!isOpen); | ||
}; | ||
|
||
const handleCopyLink = () => { | ||
navigator.clipboard.writeText(url); | ||
toast({ | ||
title: 'Link copied to clipboard', | ||
variant: 'success', | ||
}) | ||
setIsOpen(false); | ||
}; | ||
const url = location.origin + path | ||
|
||
return ( | ||
<div> | ||
|
||
<Popover open={isOpen}> | ||
<PopoverTrigger asChild> | ||
<Button onClick={handleButtonClick} variant="ghost" aria-label='Share post' size="icon"> | ||
<HiOutlineShare className="h-5 w-5 text-foreground" /> | ||
</Button> | ||
</PopoverTrigger> | ||
<PopoverContent onInteractOutside={() => setIsOpen(false)} sideOffset={12} alignOffset={0} align="end" className=" shadow-lg p-2 rounded flex space-x-2 bg-accent-shade"> | ||
|
||
<LinkedinShareButton title={title} url={url} ><LinkedinIcon size={32} round/></LinkedinShareButton> | ||
<TwitterShareButton title={title} url={url} ><XIcon size={32} round/></TwitterShareButton> | ||
<EmailShareButton subject={title} url={url} ><EmailIcon size={32} round/></EmailShareButton> | ||
<FacebookShareButton title={title} url={url} ><FacebookIcon size={32} round/></FacebookShareButton> | ||
<Button variant={'outline'} size={'sm'} onClick={handleCopyLink}>Copy Link</Button> | ||
</PopoverContent> | ||
</Popover> | ||
|
||
</div> | ||
); | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.