mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-26 20:50:30 +08:00
parent
14075c6b9b
commit
b1e39ab4b3
@ -167,12 +167,10 @@ const OverrideItem: React.FC<Props> = (props) => {
|
||||
setOpenFileEditor(true)
|
||||
}}
|
||||
>
|
||||
<div ref={setNodeRef} {...attributes} {...listeners} className="h-full w-full">
|
||||
<CardBody>
|
||||
<div className="flex justify-between h-[32px]">
|
||||
<h3
|
||||
ref={setNodeRef}
|
||||
{...attributes}
|
||||
{...listeners}
|
||||
title={info?.name}
|
||||
className={`text-ellipsis whitespace-nowrap overflow-hidden text-md font-bold leading-[32px] text-foreground`}
|
||||
>
|
||||
@ -247,6 +245,7 @@ const OverrideItem: React.FC<Props> = (props) => {
|
||||
)}
|
||||
</div>
|
||||
</CardBody>
|
||||
</div>
|
||||
</Card>
|
||||
</div>
|
||||
)
|
||||
|
||||
@ -174,7 +174,7 @@ const ProfileItem: React.FC<Props> = (props) => {
|
||||
<Card
|
||||
fullWidth
|
||||
isPressable
|
||||
onClick={() => {
|
||||
onPress={() => {
|
||||
if (disableSelect) return
|
||||
setSelecting(true)
|
||||
onClick().finally(() => {
|
||||
@ -183,12 +183,10 @@ const ProfileItem: React.FC<Props> = (props) => {
|
||||
}}
|
||||
className={`${isCurrent ? 'bg-primary' : ''} ${selecting ? 'blur-sm' : ''}`}
|
||||
>
|
||||
<div ref={setNodeRef} {...attributes} {...listeners} className="w-full h-full">
|
||||
<CardBody className="pb-1">
|
||||
<div className="flex justify-between h-[32px]">
|
||||
<h3
|
||||
ref={setNodeRef}
|
||||
{...attributes}
|
||||
{...listeners}
|
||||
title={info?.name}
|
||||
className={`text-ellipsis whitespace-nowrap overflow-hidden text-md font-bold leading-[32px] ${isCurrent ? 'text-primary-foreground' : 'text-foreground'}`}
|
||||
>
|
||||
@ -247,23 +245,27 @@ const ProfileItem: React.FC<Props> = (props) => {
|
||||
>
|
||||
<small>{`${calcTraffic(usage)}/${calcTraffic(total)}`}</small>
|
||||
{profileDisplayDate === 'expire' ? (
|
||||
<small
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
patchAppConfig({ profileDisplayDate: 'update' })
|
||||
<Button
|
||||
size="sm"
|
||||
variant="light"
|
||||
className="h-[20px] p-1 m-0"
|
||||
onPress={async () => {
|
||||
await patchAppConfig({ profileDisplayDate: 'update' })
|
||||
}}
|
||||
>
|
||||
{extra.expire ? dayjs.unix(extra.expire).format('YYYY-MM-DD') : '长期有效'}
|
||||
</small>
|
||||
</Button>
|
||||
) : (
|
||||
<small
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
patchAppConfig({ profileDisplayDate: 'expire' })
|
||||
<Button
|
||||
size="sm"
|
||||
variant="light"
|
||||
className="h-[20px] p-1 m-0"
|
||||
onPress={async () => {
|
||||
await patchAppConfig({ profileDisplayDate: 'expire' })
|
||||
}}
|
||||
>
|
||||
{dayjs(info.updated).fromNow()}
|
||||
</small>
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
@ -306,6 +308,7 @@ const ProfileItem: React.FC<Props> = (props) => {
|
||||
/>
|
||||
)}
|
||||
</CardFooter>
|
||||
</div>
|
||||
</Card>
|
||||
</div>
|
||||
)
|
||||
|
||||
@ -18,7 +18,7 @@ dayjs.extend(relativeTime)
|
||||
dayjs.locale('zh-cn')
|
||||
|
||||
const ProfileCard: React.FC = () => {
|
||||
const { appConfig } = useAppConfig()
|
||||
const { appConfig, patchAppConfig } = useAppConfig()
|
||||
const { profileCardStatus = 'col-span-2', profileDisplayDate = 'expire' } = appConfig || {}
|
||||
const location = useLocation()
|
||||
const match = location.pathname.includes('/profiles')
|
||||
@ -122,11 +122,27 @@ const ProfileCard: React.FC = () => {
|
||||
>
|
||||
<small>{`${calcTraffic(usage)}/${calcTraffic(total)}`}</small>
|
||||
{profileDisplayDate === 'expire' ? (
|
||||
<small>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="light"
|
||||
className="h-[20px] p-1 m-0"
|
||||
onPress={async () => {
|
||||
await patchAppConfig({ profileDisplayDate: 'update' })
|
||||
}}
|
||||
>
|
||||
{extra.expire ? dayjs.unix(extra.expire).format('YYYY-MM-DD') : '长期有效'}
|
||||
</small>
|
||||
</Button>
|
||||
) : (
|
||||
<small>{dayjs(info.updated).fromNow()}</small>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="light"
|
||||
className="h-[20px] p-1 m-0"
|
||||
onPress={async () => {
|
||||
await patchAppConfig({ profileDisplayDate: 'expire' })
|
||||
}}
|
||||
>
|
||||
{dayjs(info.updated).fromNow()}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user