Files
new-api/web/src/components/Footer.js

62 lines
1.5 KiB
JavaScript
Raw Normal View History

2023-06-17 11:03:01 +08:00
import React, { useEffect, useState } from 'react';
2023-04-22 20:39:27 +08:00
import { Container, Segment } from 'semantic-ui-react';
import { getFooterHTML, getSystemName } from '../helpers';
2023-04-22 20:39:27 +08:00
const Footer = () => {
const systemName = getSystemName();
2023-06-17 11:03:01 +08:00
const [footer, setFooter] = useState(getFooterHTML());
let remainCheckTimes = 5;
const loadFooter = () => {
let footer_html = localStorage.getItem('footer_html');
if (footer_html) {
setFooter(footer_html);
}
};
useEffect(() => {
const timer = setInterval(() => {
if (remainCheckTimes <= 0) {
clearInterval(timer);
return;
}
remainCheckTimes--;
loadFooter();
}, 200);
return () => clearTimeout(timer);
}, []);
2023-04-22 20:39:27 +08:00
return (
<Segment vertical>
<Container textAlign='center'>
{footer ? (
<div
className='custom-footer'
dangerouslySetInnerHTML={{ __html: footer }}
></div>
) : (
<div className='custom-footer'>
2023-04-22 20:39:27 +08:00
<a
2023-09-12 03:17:26 +08:00
href='https://github.com/Calcium-Ion/one-api'
target='_blank'
2023-04-22 20:39:27 +08:00
>
{systemName} {process.env.REACT_APP_VERSION}{' '}
2023-04-22 20:39:27 +08:00
</a>
{' '}
2023-10-31 00:03:22 +08:00
<a href='https://github.com/Calcium-Ion' target='_blank'>
Calcium-Ion
2023-04-22 20:39:27 +08:00
</a>{' '}
构建源代码遵循{' '}
<a href='https://opensource.org/licenses/mit-license.php'>
2023-04-22 20:39:27 +08:00
MIT 协议
</a>
</div>
)}
</Container>
</Segment>
);
};
export default Footer;