diff --git a/src/components/sn-likebtn/LikeButton.jsx b/src/components/sn-likebtn/LikeButton.jsx new file mode 100644 index 00000000000..42c4e5b3a92 --- /dev/null +++ b/src/components/sn-likebtn/LikeButton.jsx @@ -0,0 +1,18 @@ +import React, { useEffect } from 'react'; + +const LikeButton = () => { + useEffect(() => { + if (document.getElementById("likebtn_wjs")) return; + const script = document.createElement("script"); + script.async = true; + script.id = "likebtn_wjs"; + script.src = "//w.likebtn.com/js/w/widget.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }, []); + + return ( + + ); +}; + +export default LikeButton; diff --git a/src/playground/render-interface.jsx b/src/playground/render-interface.jsx index f2c8787b298..deca7f7e3dc 100644 --- a/src/playground/render-interface.jsx +++ b/src/playground/render-interface.jsx @@ -37,6 +37,7 @@ import VoteFrame from './vote-frame.jsx'; import MenuBar from '../components/menu-bar/menu-bar.jsx'; import ProjectInput from '../components/tw-project-input/project-input.jsx'; import FeaturedProjects from '../components/tw-featured-projects/featured-projects.jsx'; +import LikeButton from '../components/sn-likebtn/LikeButton.jsx'; import Description from '../components/tw-description/description.jsx'; import WebGlModal from '../containers/webgl-modal.jsx'; import BrowserModal from '../components/browser-modal/browser-modal.jsx'; @@ -382,43 +383,46 @@ class Interface extends React.Component {

{projectId && projectId !== '0' && ( -
-
- - ! - {'Report'} - -
-
- { - const projectDetails = getProjectDetailsById(window.LastFetchedProject.remix); - if (projectDetails && projectDetails.author) { - const username = projectDetails.author.username; - const profileUrl = `https://www.snail-ide.com/profile?user=${username}`; - window.open(profileUrl); - } else { - console.error("Author details not available."); - // Optionally, you can handle this case by setting a default author name or showing a message to the user - } - }} - > - {'View Profile'} - -
+
+
+ + ! + {'Report'} +
+
+ { + const projectDetails = getProjectDetailsById(window.LastFetchedProject.remix); + if (projectDetails && projectDetails.author) { + const username = projectDetails.author.username; + const profileUrl = `https://www.snail-ide.com/profile?user=${username}`; + window.open(profileUrl); + } else { + console.error("Author details not available."); + // Optionally, you can handle this case by setting a default author name or showing a message to the user + } + }} + > + {'View Profile'} + +
+
+ +
+
)}