| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| import React, { useEffect, useState } from 'react'; |
| import { getFooterHTML } from '../helpers'; |
|
|
| const FooterBar = () => { |
| const [footer, setFooter] = useState(getFooterHTML()); |
| const [poweredByText, setPoweredByText] = useState(''); |
| let remainCheckTimes = 5; |
|
|
| const poweredByTexts = [ |
| '由 Veloera 驱动', |
| '功能与速度由 Veloera 提供', |
| 'Made with ♥️ by Veloera', |
| 'Powered by Veloera', |
| 'Veloera 强力驱动', |
| '基于 Veloera 构建', |
| 'Built on Veloera', |
| 'Driven by Veloera', |
| 'Veloera Powered', |
| ]; |
|
|
| const loadFooter = () => { |
| let footer_html = localStorage.getItem('footer_html'); |
| if (footer_html) { |
| setFooter(footer_html); |
| } |
| }; |
|
|
| useEffect(() => { |
| |
| const randomIndex = Math.floor(Math.random() * poweredByTexts.length); |
| setPoweredByText(poweredByTexts[randomIndex]); |
|
|
| const timer = setInterval(() => { |
| if (remainCheckTimes <= 0) { |
| clearInterval(timer); |
| return; |
| } |
| remainCheckTimes--; |
| loadFooter(); |
| }, 200); |
| return () => clearTimeout(timer); |
| }, []); |
|
|
| const PoweredByLink = ( |
| <a |
| href={`https://the.veloera.org/landing?utm_source=${window.location.hostname}&utm_campaign=footer_badage`} |
| target='_blank' |
| rel='noreferrer' |
| style={{ |
| textDecoration: 'none', |
| color: 'inherit', |
| fontSize: '14px' |
| }} |
| onMouseEnter={(e) => e.target.style.textDecoration = 'underline'} |
| onMouseLeave={(e) => e.target.style.textDecoration = 'none'} |
| > |
| {poweredByText} |
| </a> |
| ); |
|
|
| let content; |
| if (footer) { |
| content = ( |
| <div style={{ |
| display: 'flex', |
| alignItems: 'center', |
| justifyContent: 'space-between', |
| gap: '20px', |
| maxWidth: '1200px', |
| margin: '0 auto', |
| padding: '0 20px' |
| }}> |
| <div className='custom-footer' dangerouslySetInnerHTML={{ __html: footer }}></div> |
| <div>{PoweredByLink}</div> |
| </div> |
| ); |
| } else { |
| content = ( |
| <div style={{ textAlign: 'right', padding: '0 20px' }}> |
| {PoweredByLink} |
| </div> |
| ); |
| } |
|
|
| return ( |
| <div style={{ paddingBottom: '28px', marginLeft: '10px', marginRight: '10px' }}> |
| {content} |
| </div> |
| ); |
| }; |
|
|
| export default FooterBar; |