mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-04-17 23:07:26 +00:00
- Added internationalization (i18n) support across various components, enabling dynamic language switching and improved user experience. - Updated multiple components to utilize translation functions for labels, buttons, and messages, ensuring consistent language display. - Enhanced the user interface by refining text elements in the ChannelsTable, LogsTable, and various settings pages, improving clarity and accessibility. - Adjusted CSS styles for better responsiveness and layout consistency across different screen sizes.
74 lines
1.7 KiB
JavaScript
74 lines
1.7 KiB
JavaScript
import React, { useEffect, useState } from 'react';
|
|
import { useTranslation } from 'react-i18next';
|
|
import { getFooterHTML, getSystemName } from '../helpers';
|
|
import { Layout, Tooltip } from '@douyinfe/semi-ui';
|
|
|
|
const FooterBar = () => {
|
|
const { t } = useTranslation();
|
|
const systemName = getSystemName();
|
|
const [footer, setFooter] = useState(getFooterHTML());
|
|
let remainCheckTimes = 5;
|
|
|
|
const loadFooter = () => {
|
|
let footer_html = localStorage.getItem('footer_html');
|
|
if (footer_html) {
|
|
setFooter(footer_html);
|
|
}
|
|
};
|
|
|
|
const defaultFooter = (
|
|
<div className='custom-footer'>
|
|
<a
|
|
href='https://github.com/Calcium-Ion/new-api'
|
|
target='_blank'
|
|
rel='noreferrer'
|
|
>
|
|
New API {import.meta.env.VITE_REACT_APP_VERSION}{' '}
|
|
</a>
|
|
{t('由')}{' '}
|
|
<a
|
|
href='https://github.com/Calcium-Ion'
|
|
target='_blank'
|
|
rel='noreferrer'
|
|
>
|
|
Calcium-Ion
|
|
</a>{' '}
|
|
{t('开发,基于')}{' '}
|
|
<a
|
|
href='https://github.com/songquanpeng/one-api'
|
|
target='_blank'
|
|
rel='noreferrer'
|
|
>
|
|
One API
|
|
</a>
|
|
</div>
|
|
);
|
|
|
|
useEffect(() => {
|
|
const timer = setInterval(() => {
|
|
if (remainCheckTimes <= 0) {
|
|
clearInterval(timer);
|
|
return;
|
|
}
|
|
remainCheckTimes--;
|
|
loadFooter();
|
|
}, 200);
|
|
return () => clearTimeout(timer);
|
|
}, []);
|
|
|
|
return (
|
|
<div style={{ textAlign: 'center' }}>
|
|
{footer ? (
|
|
<div
|
|
className='custom-footer'
|
|
dangerouslySetInnerHTML={{ __html: footer }}
|
|
></div>
|
|
) : (
|
|
defaultFooter
|
|
)}
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default FooterBar;
|