Skip to content

Commit

Permalink
likebtn
Browse files Browse the repository at this point in the history
  • Loading branch information
nmsderp authored Mar 5, 2024
1 parent 9c57413 commit 2bb8e61
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 36 deletions.
18 changes: 18 additions & 0 deletions src/components/sn-likebtn/LikeButton.jsx
Original file line number Diff line number Diff line change
@@ -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 (
<span className="likebtn-wrapper" data-theme="custom" data-vert="true" data-show_like_label="false"></span>
);
};

export default LikeButton;
76 changes: 40 additions & 36 deletions src/playground/render-interface.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -382,43 +383,46 @@ class Interface extends React.Component {
</p>
</div>
{projectId && projectId !== '0' && (
<div>
<div className={styles.centerSector}>
<a
target="_blank"
rel="noreferrer"
href={`https://snail-ide.com/report?type=project&id=${projectId}`}
className={styles.reportLink}
>
<img
src="https://studio.penguinmod.com/report_flag.png"
alt="!"
/>
{'Report'}
</a>
</div>
<div className={styles.centerSector}>
<a
target="_blank"
rel="noreferrer"
href="#"
className={styles.profilelink}
onClick={() => {
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'}
</a>
</div>
<div>
<div className={styles.centerSector}>
<a
target="_blank"
rel="noreferrer"
href={`https://snail-ide.com/report?type=project&id=${projectId}`}
className={styles.reportLink}
>
<img
src="https://studio.penguinmod.com/report_flag.png"
alt="!"
/>
{'Report'}
</a>
</div>
<div className={styles.centerSector}>
<a
target="_blank"
rel="noreferrer"
href="#"
className={styles.profilelink}
onClick={() => {
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'}
</a>
</div>
<div className={styles.centerSector}>
<LikeButton />
</div>
</div>
)}

<div className={styles.section}>
Expand Down

0 comments on commit 2bb8e61

Please sign in to comment.