feat: 增加设置页面和支持自定义强调色

This commit is contained in:
qier222 2022-04-17 12:46:06 +08:00
parent 7e892997bd
commit bc696ca59f
No known key found for this signature in database
GPG key ID: 9C85007ED905F14D
14 changed files with 499 additions and 41 deletions

View file

@ -1,7 +1,6 @@
import SvgIcon from '@/renderer/components/SvgIcon'
import useScroll from '@/renderer/hooks/useScroll'
import useUser from '@/renderer/hooks/useUser'
import { resizeImage } from '@/renderer/utils/common'
import Avatar from './Avatar'
const NavigationButtons = () => {
const navigate = useNavigate()
@ -67,9 +66,10 @@ const SearchBox = () => {
}
const Settings = () => {
const navigate = useNavigate()
return (
<div
onClick={() => toast('施工中...')}
onClick={() => navigate('/settings')}
className='app-region-no-drag btn-hover-animation rounded-lg p-2.5 text-gray-500 transition duration-300 after:rounded-full after:bg-black/[.06] hover:text-gray-900 dark:text-gray-300 dark:after:bg-white/10 dark:hover:text-gray-200'
>
<SvgIcon className='h-[1.125rem] w-[1.125rem]' name='settings' />
@ -77,34 +77,6 @@ const Settings = () => {
)
}
const Avatar = () => {
const navigate = useNavigate()
const { data: user } = useUser()
const avatarUrl = user?.profile?.avatarUrl
? resizeImage(user?.profile?.avatarUrl ?? '', 'sm')
: ''
return (
<>
{avatarUrl ? (
<img
src={avatarUrl}
onClick={() => navigate('/login')}
className='app-region-no-drag h-9 w-9 rounded-full bg-gray-100 dark:bg-gray-700'
/>
) : (
<div onClick={() => navigate('/login')}>
<SvgIcon
name='user'
className='h-9 w-9 rounded-full bg-black/[.06] p-1 text-gray-500'
/>
</div>
)}
</>
)
}
const Topbar = () => {
/**
* Show topbar background when scroll down