mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-12 19:33:41 +08:00
feat: berry theme update & bug fix (#1282)
* ⚡️ improve: delete google fonts * ⚡️ improve: Optimized priority input handling in TableRow component. * 🔖 chore: channel batch add * ✨ feat: add dark mod * ✨ feat: support token limit ip range and models * ✨ feat: add MessagePusher * ✨ feat: add lark login
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
// material-ui
|
||||
import logo from 'assets/images/logo.svg';
|
||||
import logoLight from 'assets/images/logo.svg';
|
||||
import logoDark from 'assets/images/logo-white.svg';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { useTheme } from '@mui/material/styles';
|
||||
|
||||
/**
|
||||
* if you want to use image instead of <svg> uncomment following.
|
||||
@@ -14,6 +16,8 @@ import { useSelector } from 'react-redux';
|
||||
|
||||
const Logo = () => {
|
||||
const siteInfo = useSelector((state) => state.siteInfo);
|
||||
const theme = useTheme();
|
||||
const logo = theme.palette.mode === 'light' ? logoLight : logoDark;
|
||||
|
||||
return <img src={siteInfo.logo || logo} alt={siteInfo.system_name} height="50" />;
|
||||
};
|
||||
|
||||
50
web/berry/src/ui-component/ThemeButton.js
Normal file
50
web/berry/src/ui-component/ThemeButton.js
Normal file
@@ -0,0 +1,50 @@
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
import { SET_THEME } from 'store/actions';
|
||||
import { useTheme } from '@mui/material/styles';
|
||||
import { Avatar, Box, ButtonBase } from '@mui/material';
|
||||
import { IconSun, IconMoon } from '@tabler/icons-react';
|
||||
|
||||
export default function ThemeButton() {
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const defaultTheme = useSelector((state) => state.customization.theme);
|
||||
|
||||
const theme = useTheme();
|
||||
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
ml: 2,
|
||||
mr: 3,
|
||||
[theme.breakpoints.down('md')]: {
|
||||
mr: 2
|
||||
}
|
||||
}}
|
||||
>
|
||||
<ButtonBase sx={{ borderRadius: '12px' }}>
|
||||
<Avatar
|
||||
variant="rounded"
|
||||
sx={{
|
||||
...theme.typography.commonAvatar,
|
||||
...theme.typography.mediumAvatar,
|
||||
transition: 'all .2s ease-in-out',
|
||||
borderColor: theme.typography.menuChip.background,
|
||||
backgroundColor: theme.typography.menuChip.background,
|
||||
'&[aria-controls="menu-list-grow"],&:hover': {
|
||||
background: theme.palette.secondary.dark,
|
||||
color: theme.palette.secondary.light
|
||||
}
|
||||
}}
|
||||
onClick={() => {
|
||||
let theme = defaultTheme === 'light' ? 'dark' : 'light';
|
||||
dispatch({ type: SET_THEME, theme: theme });
|
||||
localStorage.setItem('theme', theme);
|
||||
}}
|
||||
color="inherit"
|
||||
>
|
||||
{defaultTheme === 'light' ? <IconSun stroke={1.5} size="1.3rem" /> : <IconMoon stroke={1.5} size="1.3rem" />}
|
||||
</Avatar>
|
||||
</ButtonBase>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
@@ -15,7 +15,7 @@ const headerSX = {
|
||||
const MainCard = forwardRef(
|
||||
(
|
||||
{
|
||||
border = true,
|
||||
border = false,
|
||||
boxShadow,
|
||||
children,
|
||||
content = true,
|
||||
|
||||
@@ -15,8 +15,7 @@ const SubCard = forwardRef(
|
||||
<Card
|
||||
ref={ref}
|
||||
sx={{
|
||||
border: '1px solid',
|
||||
borderColor: theme.palette.primary.light,
|
||||
border: theme.typography.SubCard.border,
|
||||
':hover': {
|
||||
boxShadow: '0 2px 14px 0 rgb(32 40 45 / 8%)'
|
||||
},
|
||||
@@ -36,8 +35,8 @@ const SubCard = forwardRef(
|
||||
{title && (
|
||||
<Divider
|
||||
sx={{
|
||||
opacity: 1,
|
||||
borderColor: theme.palette.primary.light
|
||||
opacity: 1
|
||||
// borderColor: theme.palette.primary.light
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
@@ -62,7 +61,8 @@ SubCard.propTypes = {
|
||||
secondary: PropTypes.oneOfType([PropTypes.node, PropTypes.string, PropTypes.object]),
|
||||
sx: PropTypes.object,
|
||||
contentSX: PropTypes.object,
|
||||
title: PropTypes.oneOfType([PropTypes.node, PropTypes.string, PropTypes.object])
|
||||
title: PropTypes.oneOfType([PropTypes.node, PropTypes.string, PropTypes.object]),
|
||||
subTitle: PropTypes.oneOfType([PropTypes.node, PropTypes.string, PropTypes.object])
|
||||
};
|
||||
|
||||
SubCard.defaultProps = {
|
||||
|
||||
Reference in New Issue
Block a user