引入 husky,并全局重新格式化

This commit is contained in:
2025-06-07 11:49:57 +08:00
parent 05fce179c9
commit c7527177b0
89 changed files with 2140 additions and 1899 deletions

View File

@@ -22,7 +22,6 @@ export type PayProps = {
}
export default function Pay(props: PayProps) {
const profile = useProfileStore(store => store.profile)
const refreshProfile = useProfileStore(store => store.refreshProfile)
@@ -115,25 +114,31 @@ export default function Pay(props: PayProps) {
return (
<Dialog open={open} onOpenChange={setOpen}>
<DialogTrigger asChild>
<Button className={`mt-4 h-12`} onClick={onOpen}>
<Button className="mt-4 h-12" onClick={onOpen}>
</Button>
</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle className={`flex gap-2 items-center`}>
{props.method === 'alipay' && (<>
<Image src={alipay} alt={`支付宝`} width={20} height={20}/>
<span></span>
</>)}
{props.method === 'wechat' && (<>
<Image src={wechat} alt={`微信`} width={20} height={20}/>
<span></span>
</>)}
{props.method === 'balance' && (<>
<Image src={balance} alt={`余额`} width={20} height={20}/>
<span></span>
</>)}
<DialogTitle className="flex gap-2 items-center">
{props.method === 'alipay' && (
<>
<Image src={alipay} alt="支付宝" width={20} height={20}/>
<span></span>
</>
)}
{props.method === 'wechat' && (
<>
<Image src={wechat} alt="微信" width={20} height={20}/>
<span></span>
</>
)}
{props.method === 'balance' && (
<>
<Image src={balance} alt="余额" width={20} height={20}/>
<span></span>
</>
)}
</DialogTitle>
</DialogHeader>
@@ -143,17 +148,25 @@ export default function Pay(props: PayProps) {
<div className="flex flex-col gap-1">
<div className="flex justify-between items-center">
<span className="text-weak text-sm"></span>
<span className={`text-lg`}>{profile.balance}</span>
<span className="text-lg">
{profile.balance}
</span>
</div>
<div className="flex justify-between items-center">
<span className="text-weak text-sm"></span>
<span className="text-lg text-accent">- {props.amount}</span>
<span className="text-lg text-accent">
-
{props.amount}
</span>
</div>
<hr className="my-2"/>
<div className="flex justify-between items-center">
<span className="text-weak text-sm"></span>
<span className={`text-lg ${balanceEnough ? 'text-done' : `text-fail`}`}>
{(profile.balance - Number(props.amount)).toFixed(2)}
{(profile.balance - Number(props.amount)).toFixed(2)}
</span>
</div>
</div>
@@ -182,16 +195,27 @@ export default function Pay(props: PayProps) {
? <iframe src={payInfo.pay_url} className="w-full h-full"/>
: <canvas ref={canvas} className="w-full h-full"/>
) : (
<Loader size={40} className={`animate-spin text-weak`}/>
<Loader size={40} className="animate-spin text-weak"/>
)}
</div>
<p className="text-sm text-gray-600 text-center">
使{props.method === 'alipay' ? '支付宝' : '微信'}
使
{props.method === 'alipay' ? '支付宝' : '微信'}
</p>
</div>
<div className="text-center space-y-1">
<p className="font-medium">: <span className="text-accent">{props.amount}</span></p>
<p className="text-xs text-gray-500">: {payInfo?.trade_no || '创建订单中...'}</p>
<p className="font-medium">
:
<span className="text-accent">
{props.amount}
</span>
</p>
<p className="text-xs text-gray-500">
:
{payInfo?.trade_no || '创建订单中...'}
</p>
</div>
</div>
)}