mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-10-25 05:02:07 +08:00
37 lines
746 B
TypeScript
37 lines
746 B
TypeScript
import { Button } from '@mui/material'
|
|
import { useRef } from 'react'
|
|
|
|
import { DialogRef } from '@/components/base'
|
|
import { useUpdate } from '@/hooks/use-update'
|
|
|
|
import { UpdateViewer } from '../setting/mods/update-viewer'
|
|
|
|
interface Props {
|
|
className?: string
|
|
}
|
|
|
|
export const UpdateButton = (props: Props) => {
|
|
const { className } = props
|
|
const viewerRef = useRef<DialogRef>(null)
|
|
|
|
const { updateInfo } = useUpdate()
|
|
|
|
if (!updateInfo?.available) return null
|
|
|
|
return (
|
|
<>
|
|
<UpdateViewer ref={viewerRef} />
|
|
|
|
<Button
|
|
color="error"
|
|
variant="contained"
|
|
size="small"
|
|
className={className}
|
|
onClick={() => viewerRef.current?.open()}
|
|
>
|
|
New
|
|
</Button>
|
|
</>
|
|
)
|
|
}
|