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