🐛 fix(deps): Update clipboard
This commit is contained in:
parent
a3b45b455d
commit
55727103b8
@ -11,6 +11,7 @@ import { toast } from '@shadcn/ui/lib/sonner';
|
|||||||
import { Copy } from 'lucide-react';
|
import { Copy } from 'lucide-react';
|
||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from 'next-intl';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
|
import { CopyToClipboard } from 'react-copy-to-clipboard';
|
||||||
|
|
||||||
export default function Page() {
|
export default function Page() {
|
||||||
const t = useTranslations('affiliate');
|
const t = useTranslations('affiliate');
|
||||||
@ -44,18 +45,19 @@ export default function Page() {
|
|||||||
<code className='bg-muted rounded px-2 py-1 text-2xl font-bold'>
|
<code className='bg-muted rounded px-2 py-1 text-2xl font-bold'>
|
||||||
{user?.refer_code}
|
{user?.refer_code}
|
||||||
</code>
|
</code>
|
||||||
<Button
|
<CopyToClipboard
|
||||||
variant='secondary'
|
text={`${location.origin}/auth?invite=${user?.refer_code}`}
|
||||||
size='sm'
|
onCopy={(text, result) => {
|
||||||
className='gap-2'
|
if (result) {
|
||||||
onClick={() => {
|
toast.success(t('copySuccess'));
|
||||||
navigator.clipboard.writeText(`${location.origin}/auth?invite=${user?.refer_code}`);
|
}
|
||||||
toast.success(t('copySuccess'));
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Copy className='h-4 w-4' />
|
<Button variant='secondary' size='sm' className='gap-2'>
|
||||||
{t('copyInviteLink')}
|
<Copy className='h-4 w-4' />
|
||||||
</Button>
|
{t('copyInviteLink')}
|
||||||
|
</Button>
|
||||||
|
</CopyToClipboard>
|
||||||
</div>
|
</div>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
@ -32,6 +32,7 @@ import { useState } from 'react';
|
|||||||
|
|
||||||
import useGlobalStore from '@/config/use-global';
|
import useGlobalStore from '@/config/use-global';
|
||||||
import { getStat } from '@/services/common/common';
|
import { getStat } from '@/services/common/common';
|
||||||
|
import CopyToClipboard from 'react-copy-to-clipboard';
|
||||||
import Renewal from '../order/renewal';
|
import Renewal from '../order/renewal';
|
||||||
import ResetTraffic from '../order/reset-traffic';
|
import ResetTraffic from '../order/reset-traffic';
|
||||||
import Subscribe from '../subscribe/page';
|
import Subscribe from '../subscribe/page';
|
||||||
@ -198,16 +199,24 @@ export default function Page() {
|
|||||||
<CardTitle className='text-sm font-medium'>
|
<CardTitle className='text-sm font-medium'>
|
||||||
{t('subscriptionUrl')} {index + 1}
|
{t('subscriptionUrl')} {index + 1}
|
||||||
</CardTitle>
|
</CardTitle>
|
||||||
<span
|
<CopyToClipboard
|
||||||
className='text-primary hover:bg-accent mr-4 flex cursor-pointer rounded p-2 text-sm'
|
text={url}
|
||||||
onClick={(e) => {
|
onCopy={(text, result) => {
|
||||||
e.stopPropagation();
|
if (result) {
|
||||||
handleCopy(url);
|
toast.success(t('copySuccess'));
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Icon icon='uil:copy' className='mr-2 size-5' />
|
<span
|
||||||
{t('copy')}
|
className='text-primary hover:bg-accent mr-4 flex cursor-pointer rounded p-2 text-sm'
|
||||||
</span>
|
onClick={(e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Icon icon='uil:copy' className='mr-2 size-5' />
|
||||||
|
{t('copy')}
|
||||||
|
</span>
|
||||||
|
</CopyToClipboard>
|
||||||
</div>
|
</div>
|
||||||
</AccordionTrigger>
|
</AccordionTrigger>
|
||||||
<AccordionContent>
|
<AccordionContent>
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import { toast } from '@shadcn/ui/lib/sonner';
|
|||||||
import { Sidebar, SidebarContent } from '@shadcn/ui/sidebar';
|
import { Sidebar, SidebarContent } from '@shadcn/ui/sidebar';
|
||||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@shadcn/ui/tooltip';
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@shadcn/ui/tooltip';
|
||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from 'next-intl';
|
||||||
|
import CopyToClipboard from 'react-copy-to-clipboard';
|
||||||
import Recharge from './order/recharge';
|
import Recharge from './order/recharge';
|
||||||
|
|
||||||
export function SidebarRight({ ...props }: React.ComponentProps<typeof Sidebar>) {
|
export function SidebarRight({ ...props }: React.ComponentProps<typeof Sidebar>) {
|
||||||
@ -31,18 +32,18 @@ export function SidebarRight({ ...props }: React.ComponentProps<typeof Sidebar>)
|
|||||||
<TooltipProvider>
|
<TooltipProvider>
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
<TooltipTrigger asChild>
|
<TooltipTrigger asChild>
|
||||||
<Button
|
<CopyToClipboard
|
||||||
variant='ghost'
|
text={`${location.origin}/auth?invite=${user?.refer_code}`}
|
||||||
className='size-5 p-0'
|
onCopy={(text, result) => {
|
||||||
onClick={() => {
|
if (result) {
|
||||||
navigator.clipboard.writeText(
|
toast.success(t('copySuccess'));
|
||||||
`${location.origin}/auth?invite=${user?.refer_code}`,
|
}
|
||||||
);
|
|
||||||
toast.success(t('copySuccess'));
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Icon icon='mdi:content-copy' className='text-primary text-2xl' />
|
<Button variant='ghost' className='size-5 p-0'>
|
||||||
</Button>
|
<Icon icon='mdi:content-copy' className='text-primary text-2xl' />
|
||||||
|
</Button>
|
||||||
|
</CopyToClipboard>
|
||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
<TooltipContent>{t('copyInviteLink')}</TooltipContent>
|
<TooltipContent>{t('copyInviteLink')}</TooltipContent>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
|||||||
@ -64,7 +64,6 @@ export default async function RootLayout({ children }: { children: React.ReactNo
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
config = await getGlobalConfig({ skipErrorHandler: true }).then((res) => res.data.data);
|
config = await getGlobalConfig({ skipErrorHandler: true }).then((res) => res.data.data);
|
||||||
console.log(config);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
/* empty */
|
/* empty */
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,6 +31,7 @@
|
|||||||
"qrcode.react": "^4.1.0",
|
"qrcode.react": "^4.1.0",
|
||||||
"radash": "^12.1.0",
|
"radash": "^12.1.0",
|
||||||
"react": "rc",
|
"react": "rc",
|
||||||
|
"react-copy-to-clipboard": "^5.1.0",
|
||||||
"react-dom": "rc",
|
"react-dom": "rc",
|
||||||
"react-turnstile": "^1.1.4",
|
"react-turnstile": "^1.1.4",
|
||||||
"universal-cookie": "^7.2.2",
|
"universal-cookie": "^7.2.2",
|
||||||
@ -41,6 +42,7 @@
|
|||||||
"@repo/typescript-config": "workspace:*",
|
"@repo/typescript-config": "workspace:*",
|
||||||
"@types/node": "^22.10.0",
|
"@types/node": "^22.10.0",
|
||||||
"@types/react": "^18.3.12",
|
"@types/react": "^18.3.12",
|
||||||
|
"@types/react-copy-to-clipboard": "^5.0.7",
|
||||||
"@types/react-dom": "^18.3.1",
|
"@types/react-dom": "^18.3.1",
|
||||||
"typescript": "^5.7.2"
|
"typescript": "^5.7.2"
|
||||||
}
|
}
|
||||||
|
|||||||
10617
pnpm-lock.yaml
generated
10617
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user