File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
src/pages/dashboard/giveaway Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -477,6 +477,23 @@ const GiveawayPage: React.FC = () => {
477477 setActiveTab ( "giveaway" ) ;
478478 } , [ ] ) ;
479479
480+ // Dynamically load Kingsumo embed script for giveaway page
481+ useEffect ( ( ) => {
482+ // Create a new script element
483+ const script = document . createElement ( "script" ) ;
484+ script . src = "https://kingsumo.com/js/embed.js" ; // Script URL provided by Kingsumo
485+ script . async = true ; // Load asynchronously to avoid blocking page render
486+
487+ // Append the script to the document body
488+ document . body . appendChild ( script ) ;
489+
490+ // Cleanup: remove the script when component unmounts to prevent duplicates
491+ return ( ) => {
492+ document . body . removeChild ( script ) ;
493+ } ;
494+ } , [ ] ) ; // Empty dependency array ensures this runs only once when component mounts
495+
496+
480497 useEffect ( ( ) => {
481498 // Simulate fetching leaderboard data
482499 const fetchLeaderboard = async ( ) => {
@@ -790,6 +807,7 @@ const GiveawayPage: React.FC = () => {
790807 < p > Fetching leaderboard data...</ p >
791808 </ div >
792809 ) : (
810+ < >
793811 < div className = "giveaway-leaderboard-grid" >
794812 { leaderboard . map ( ( entry , index ) => (
795813 < motion . div
@@ -842,6 +860,8 @@ const GiveawayPage: React.FC = () => {
842860 </ motion . div >
843861 ) ) }
844862 </ div >
863+ < div id = "kingsumo-embed" > </ div >
864+ </ >
845865 ) }
846866 </ motion . section >
847867 </ div >
You can’t perform that action at this time.
0 commit comments