Skip to content

Commit

Permalink
Merge pull request #64 from apsinghdev/feat/handle-vercel-case
Browse files Browse the repository at this point in the history
feat: handle vercel case
  • Loading branch information
apsinghdev authored Sep 4, 2024
2 parents de37930 + 013ce46 commit 73ee85a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions client/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,15 @@ function App() {
}
}, [showTextEditor, socket, hasCollaborationStarted]);

// Hook to display a message when someone opens the app through vercel's url
useEffect(() => {
const isVercel = window.location.hostname === "https://drawrtcbyajeet.vercel.app/"
if (isVercel) {
setMessageText("Collaborative features require local installation. For more information, please visit our GitHub repository (linked in the menu).");
setShowMenu(true);
}
}, []);

return (
<div id="container">
<Sidebar
Expand Down
6 changes: 6 additions & 0 deletions client/src/components/Menu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ function Menu(){
console.log("Disconnected from the collaboration room");
}

const openGithub = () => {
const gitLink = "https://github.com/apsinghdev/drawRTC?tab=readme-ov-file#note";
window.open(gitLink, "_blank");
}

return (
<div className="w-52 h-71 rounded-xl bg-gradient-to-r from-slate-900 to-slate-700 absolute left-52 top-8 rounded-lg shadow-xl">
{hasCollaborationStarted ? (
Expand All @@ -93,6 +98,7 @@ function Menu(){
<MenuItem feat="Save as pdf" clickHandler={saveAsPdf}></MenuItem>
<MenuItem feat="Save as png" clickHandler={saveAsPng}></MenuItem>
<MenuItem feat="Open text editor" clickHandler={openTextEditor}></MenuItem>
<MenuItem feat="Github" clickHandler={openGithub}></MenuItem>
<SponsorBtn></SponsorBtn>
<Socials></Socials>
</div>
Expand Down

0 comments on commit 73ee85a

Please sign in to comment.