add tooltip

This commit is contained in:
pompurin404 2024-09-26 15:50:49 +08:00
parent 037b01e08c
commit d9f6aad7d4
No known key found for this signature in database
2 changed files with 39 additions and 36 deletions

View File

@ -8,7 +8,8 @@ import {
DropdownItem, DropdownItem,
DropdownMenu, DropdownMenu,
DropdownTrigger, DropdownTrigger,
Progress Progress,
Tooltip
} from '@nextui-org/react' } from '@nextui-org/react'
import { calcPercent, calcTraffic } from '@renderer/utils/calc' import { calcPercent, calcTraffic } from '@renderer/utils/calc'
import { IoMdMore, IoMdRefresh } from 'react-icons/io' import { IoMdMore, IoMdRefresh } from 'react-icons/io'
@ -192,12 +193,12 @@ const ProfileItem: React.FC<Props> = (props) => {
</h3> </h3>
<div className="flex"> <div className="flex">
{info.type === 'remote' && ( {info.type === 'remote' && (
<Tooltip placement="left" content={dayjs(info.updated).fromNow()}>
<Button <Button
isIconOnly isIconOnly
size="sm" size="sm"
variant="light" variant="light"
color="default" color="default"
title={dayjs(info.updated).fromNow()}
disabled={updating} disabled={updating}
onPress={async () => { onPress={async () => {
setUpdating(true) setUpdating(true)
@ -210,6 +211,7 @@ const ProfileItem: React.FC<Props> = (props) => {
className={`${isCurrent ? 'text-white' : 'text-foreground'} text-[24px] ${updating ? 'animate-spin' : ''}`} className={`${isCurrent ? 'text-white' : 'text-foreground'} text-[24px] ${updating ? 'animate-spin' : ''}`}
/> />
</Button> </Button>
</Tooltip>
)} )}
<Dropdown> <Dropdown>

View File

@ -1,4 +1,4 @@
import { Button, Card, CardBody, CardFooter, Chip, Progress } from '@nextui-org/react' import { Button, Card, CardBody, CardFooter, Chip, Progress, Tooltip } from '@nextui-org/react'
import { useProfileConfig } from '@renderer/hooks/use-profile-config' import { useProfileConfig } from '@renderer/hooks/use-profile-config'
import { useLocation } from 'react-router-dom' import { useLocation } from 'react-router-dom'
import { calcTraffic, calcPercent } from '@renderer/utils/calc' import { calcTraffic, calcPercent } from '@renderer/utils/calc'
@ -95,10 +95,10 @@ const ProfileCard: React.FC = () => {
/> />
</Button> </Button>
{info.type === 'remote' && ( {info.type === 'remote' && (
<Tooltip placement="left" content={dayjs(info.updated).fromNow()}>
<Button <Button
isIconOnly isIconOnly
size="sm" size="sm"
title={dayjs(info.updated).fromNow()}
disabled={updating} disabled={updating}
variant="light" variant="light"
color="default" color="default"
@ -112,6 +112,7 @@ const ProfileCard: React.FC = () => {
className={`text-[24px] ${match ? 'text-white' : 'text-foreground'} ${updating ? 'animate-spin' : ''}`} className={`text-[24px] ${match ? 'text-white' : 'text-foreground'} ${updating ? 'animate-spin' : ''}`}
/> />
</Button> </Button>
</Tooltip>
)} )}
</div> </div>
</div> </div>