feat: add new theme berry (#860)

* feat: add theme berry

* docs: add development notes

* fix: fix blank page

* chore: update implementation

* fix: fix package.json

* chore: update ui copy

---------

Co-authored-by: JustSong <songquanpeng@foxmail.com>
This commit is contained in:
Buer
2024-01-07 14:20:07 +08:00
committed by GitHub
parent 6227eee5bc
commit 48989d4a0b
157 changed files with 13979 additions and 5 deletions

View File

@@ -0,0 +1,80 @@
import { Stack, Typography, Container, Box, OutlinedInput, InputAdornment, Button } from '@mui/material';
import { useTheme } from '@mui/material/styles';
import SubCard from 'ui-component/cards/SubCard';
import inviteImage from 'assets/images/invite/cwok_casual_19.webp';
import { useState } from 'react';
import { API } from 'utils/api';
import { showError, showSuccess } from 'utils/common';
const InviteCard = () => {
const theme = useTheme();
const [inviteUl, setInviteUrl] = useState('');
const handleInviteUrl = async () => {
if (inviteUl) {
navigator.clipboard.writeText(inviteUl);
showSuccess(`邀请链接已复制到剪切板`);
return;
}
const res = await API.get('/api/user/aff');
const { success, message, data } = res.data;
if (success) {
let link = `${window.location.origin}/register?aff=${data}`;
setInviteUrl(link);
navigator.clipboard.writeText(link);
showSuccess(`邀请链接已复制到剪切板`);
} else {
showError(message);
}
};
return (
<Box component="div">
<SubCard
sx={{
background: theme.palette.primary.dark
}}
>
<Stack justifyContent="center" alignItems={'flex-start'} padding={'40px 24px 0px'} spacing={3}>
<Container sx={{ display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
<img src={inviteImage} alt="invite" width={'250px'} />
</Container>
</Stack>
</SubCard>
<SubCard
sx={{
marginTop: '-20px'
}}
>
<Stack justifyContent="center" alignItems={'center'} spacing={3}>
<Typography variant="h3" sx={{ color: theme.palette.primary.dark }}>
邀请奖励
</Typography>
<Typography variant="body" sx={{ color: theme.palette.primary.dark }}>
分享您的邀请链接邀请好友注册即可获得奖励
</Typography>
<OutlinedInput
id="invite-url"
label="邀请链接"
type="text"
value={inviteUl}
name="invite-url"
placeholder="点击生成邀请链接"
endAdornment={
<InputAdornment position="end">
<Button variant="contained" onClick={handleInviteUrl}>
{inviteUl ? '复制' : '生成'}
</Button>
</InputAdornment>
}
aria-describedby="helper-text-channel-quota-label"
disabled={true}
/>
</Stack>
</SubCard>
</Box>
);
};
export default InviteCard;