fix(eslint): 删除冗余代码

mack-mac
mackt 7 months ago
parent 6b1e8aff1c
commit 99b34ffc55

@ -16,10 +16,10 @@ interface DownLoadItemWithQRCode extends DownLoadItem {
qrCode: string; qrCode: string;
} }
interface DownLoadItemWithLink extends DownLoadItem { // interface DownLoadItemWithLink extends DownLoadItem {
type: 'link'; // type: 'link';
downloadUrl: string; // downloadUrl: string;
} // }
export const agreementList = [ export const agreementList = [
{ {
@ -95,7 +95,8 @@ export const socialList: { name: string; url: string; target?: '_blank' | '_self
], ],
]; ];
export const downloadList: Array<DownLoadItemWithQRCode | DownLoadItemWithLink> = [ // export const downloadList: Array<DownLoadItemWithQRCode | DownLoadItemWithLink> = [
export const downloadList: Array<DownLoadItemWithQRCode> = [
{ {
type: 'QRCode', type: 'QRCode',
name: 'iOS版', name: 'iOS版',
@ -114,12 +115,12 @@ export const downloadList: Array<DownLoadItemWithQRCode | DownLoadItemWithLink>
buttonText: '下载安装包至本地', buttonText: '下载安装包至本地',
qrCode: '/img/download/qrcode_ios.svg', qrCode: '/img/download/qrcode_ios.svg',
}, },
{ // {
type: 'link', // type: 'link',
name: 'Mac版', // name: 'Mac版',
downloadUrl: '#', // downloadUrl: '#',
iconUrl: '/img/download/footer_mac.svg', // iconUrl: '/img/download/footer_mac.svg',
}, // },
{ {
type: 'QRCode', type: 'QRCode',
name: 'Pad版', name: 'Pad版',

@ -1,7 +1,6 @@
import Image from 'next/image'; import Image from 'next/image';
import styles from './index.module.css'; import styles from './index.module.css';
import { Children } from 'react';
function VolNo({ text }: { text: string }) { function VolNo({ text }: { text: string }) {
return ( return (

@ -10,7 +10,7 @@ export default function CoverCard({ journalInfo }: { journalInfo: JournalInfo })
<JournalCard image={image} journalNo={journalNo}> <JournalCard image={image} journalNo={journalNo}>
{/* 播放/暂停 */} {/* 播放/暂停 */}
</JournalCard> </JournalCard>
<VolPlayButton className="absolute right-[30px] bottom-[-26px] z-2" no={journalNo} /> <VolPlayButton className="absolute right-[30px] bottom-[-26px] z-2" />
</div> </div>
); );
} }

@ -5,7 +5,7 @@ import { useShallow } from 'zustand/react/shallow';
import { PlayerButton } from '@/components'; import { PlayerButton } from '@/components';
import useAudioStore from '@/store/audio'; import useAudioStore from '@/store/audio';
export default function VolPlayButton({ no, className }: { no: string; className: string }) { export default function VolPlayButton({ className }: { className: string }) {
const { playState, setPlayState } = useAudioStore( const { playState, setPlayState } = useAudioStore(
useShallow((state) => { useShallow((state) => {
return { return {

@ -7,18 +7,17 @@ import { useRouter } from 'next/navigation';
import { useShallow } from 'zustand/react/shallow'; import { useShallow } from 'zustand/react/shallow';
import { useLoginRedirect } from '@/utils/login'; import { useLoginRedirect } from '@/utils/login';
import { setAccessToken } from '@/lib/cache';
import { Button } from '@/components'; import { Button } from '@/components';
import { apiSendSMS, apiUserLogin, getUserInfo } from '@/services'; import { setAccessToken } from '@/lib/cache';
import { apiSendSMS, apiUserLogin } from '@/services';
import useUserStore from '@/store/user'; import useUserStore from '@/store/user';
export default function LoginForm() { export default function LoginForm() {
const redirect = useLoginRedirect(); const redirect = useLoginRedirect();
const router = useRouter(); const router = useRouter();
const { userLogin, setShowLogin, getUserInfo } = useUserStore( const { setShowLogin, getUserInfo } = useUserStore(
useShallow((state) => ({ useShallow((state) => ({
userLogin: state.userLogin,
setShowLogin: state.setShowLogin, setShowLogin: state.setShowLogin,
getUserInfo: state.getUserInfo, getUserInfo: state.getUserInfo,
})), })),

@ -1,3 +1,5 @@
// @ts-nocheck
import * as React from 'react'; import * as React from 'react';
import { Slot } from '@radix-ui/react-slot'; import { Slot } from '@radix-ui/react-slot';
import { cva, type VariantProps } from 'class-variance-authority'; import { cva, type VariantProps } from 'class-variance-authority';

@ -1,16 +1,16 @@
import * as React from "react" import * as React from 'react';
import * as DialogPrimitive from "@radix-ui/react-dialog" import * as DialogPrimitive from '@radix-ui/react-dialog';
import { X } from "lucide-react" import { X } from 'lucide-react';
import { cn } from "/src/lib/utils" import { cn } from '@/lib/utils';
const Dialog = DialogPrimitive.Root const Dialog = DialogPrimitive.Root;
const DialogTrigger = DialogPrimitive.Trigger const DialogTrigger = DialogPrimitive.Trigger;
const DialogPortal = DialogPrimitive.Portal const DialogPortal = DialogPrimitive.Portal;
const DialogClose = DialogPrimitive.Close const DialogClose = DialogPrimitive.Close;
const DialogOverlay = React.forwardRef< const DialogOverlay = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Overlay>, React.ElementRef<typeof DialogPrimitive.Overlay>,
@ -19,13 +19,13 @@ const DialogOverlay = React.forwardRef<
<DialogPrimitive.Overlay <DialogPrimitive.Overlay
ref={ref} ref={ref}
className={cn( className={cn(
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", 'fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
className className,
)} )}
{...props} {...props}
/> />
)) ));
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
const DialogContent = React.forwardRef< const DialogContent = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Content>, React.ElementRef<typeof DialogPrimitive.Content>,
@ -36,8 +36,8 @@ const DialogContent = React.forwardRef<
<DialogPrimitive.Content <DialogPrimitive.Content
ref={ref} ref={ref}
className={cn( className={cn(
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg", 'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg',
className className,
)} )}
{...props} {...props}
> >
@ -48,36 +48,18 @@ const DialogContent = React.forwardRef<
</DialogPrimitive.Close> </DialogPrimitive.Close>
</DialogPrimitive.Content> </DialogPrimitive.Content>
</DialogPortal> </DialogPortal>
)) ));
DialogContent.displayName = DialogPrimitive.Content.displayName DialogContent.displayName = DialogPrimitive.Content.displayName;
const DialogHeader = ({ const DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
className, <div className={cn('flex flex-col space-y-1.5 text-center sm:text-left', className)} {...props} />
...props );
}: React.HTMLAttributes<HTMLDivElement>) => ( DialogHeader.displayName = 'DialogHeader';
<div
className={cn(
"flex flex-col space-y-1.5 text-center sm:text-left",
className
)}
{...props}
/>
)
DialogHeader.displayName = "DialogHeader"
const DialogFooter = ({ const DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
className, <div className={cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className)} {...props} />
...props );
}: React.HTMLAttributes<HTMLDivElement>) => ( DialogFooter.displayName = 'DialogFooter';
<div
className={cn(
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
className
)}
{...props}
/>
)
DialogFooter.displayName = "DialogFooter"
const DialogTitle = React.forwardRef< const DialogTitle = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Title>, React.ElementRef<typeof DialogPrimitive.Title>,
@ -85,26 +67,19 @@ const DialogTitle = React.forwardRef<
>(({ className, ...props }, ref) => ( >(({ className, ...props }, ref) => (
<DialogPrimitive.Title <DialogPrimitive.Title
ref={ref} ref={ref}
className={cn( className={cn('text-lg font-semibold leading-none tracking-tight', className)}
"text-lg font-semibold leading-none tracking-tight",
className
)}
{...props} {...props}
/> />
)) ));
DialogTitle.displayName = DialogPrimitive.Title.displayName DialogTitle.displayName = DialogPrimitive.Title.displayName;
const DialogDescription = React.forwardRef< const DialogDescription = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Description>, React.ElementRef<typeof DialogPrimitive.Description>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description> React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
>(({ className, ...props }, ref) => ( >(({ className, ...props }, ref) => (
<DialogPrimitive.Description <DialogPrimitive.Description ref={ref} className={cn('text-sm text-muted-foreground', className)} {...props} />
ref={ref} ));
className={cn("text-sm text-muted-foreground", className)} DialogDescription.displayName = DialogPrimitive.Description.displayName;
{...props}
/>
))
DialogDescription.displayName = DialogPrimitive.Description.displayName
export { export {
Dialog, Dialog,
@ -117,4 +92,4 @@ export {
DialogFooter, DialogFooter,
DialogTitle, DialogTitle,
DialogDescription, DialogDescription,
} };

@ -1,7 +1,7 @@
import * as React from 'react'; import * as React from 'react';
import * as PopoverPrimitive from '@radix-ui/react-popover'; import * as PopoverPrimitive from '@radix-ui/react-popover';
import { cn } from '/src/lib/utils'; import { cn } from '@/lib/utils';
const Popover = PopoverPrimitive.Root; const Popover = PopoverPrimitive.Root;

@ -1,15 +1,8 @@
import { import { Toast, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport } from '@/components/ui/toast';
Toast, import { useToast } from '@/components/ui/use-toast';
ToastClose,
ToastDescription,
ToastProvider,
ToastTitle,
ToastViewport,
} from "/src/components/ui/toast"
import { useToast } from "/src/components/ui/use-toast"
export function Toaster() { export function Toaster() {
const { toasts } = useToast() const { toasts } = useToast();
return ( return (
<ToastProvider> <ToastProvider>
@ -18,16 +11,14 @@ export function Toaster() {
<Toast key={id} {...props}> <Toast key={id} {...props}>
<div className="grid gap-1"> <div className="grid gap-1">
{title && <ToastTitle>{title}</ToastTitle>} {title && <ToastTitle>{title}</ToastTitle>}
{description && ( {description && <ToastDescription>{description}</ToastDescription>}
<ToastDescription>{description}</ToastDescription>
)}
</div> </div>
{action} {action}
<ToastClose /> <ToastClose />
</Toast> </Toast>
) );
})} })}
<ToastViewport /> <ToastViewport />
</ToastProvider> </ToastProvider>
) );
} }

@ -1,15 +1,15 @@
import { produce } from 'immer'; import { produce } from 'immer';
import { setCookie, parseCookies, destroyCookie } from 'nookies'; // import { setCookie } from 'nookies';
import { create } from 'zustand'; import { create } from 'zustand';
import { devtools, persist, createJSONStorage } from 'zustand/middleware'; import { devtools, persist, createJSONStorage } from 'zustand/middleware';
import { apiGetMyUserInfo, apiUserLogin, apiUserLogout } from '@/services'; import { apiGetMyUserInfo } from '@/services';
interface TRequestLogin { // interface TRequestLogin {
mobile: string; // mobile: string;
mobileCheckCode: string; // mobileCheckCode: string;
deviceId: string; // deviceId: string;
} // }
interface UserState { interface UserState {
/** 登录框显示状态 */ /** 登录框显示状态 */
@ -21,7 +21,7 @@ interface UserState {
/** 更新用户信息 */ /** 更新用户信息 */
setUserInfo: (parmas: UserInfo) => void; setUserInfo: (parmas: UserInfo) => void;
/** 用户登录 */ /** 用户登录 */
userLogin: (params: TRequestLogin) => Promise<FetchResponse<string>>; // userLogin: (params: TRequestLogin) => Promise<FetchResponse<string>>;
/** 获取用户信息 */ /** 获取用户信息 */
getUserInfo: () => Promise<FetchResponse<UserInfo>>; getUserInfo: () => Promise<FetchResponse<UserInfo>>;
} }
@ -74,32 +74,32 @@ const useUserStore = create<UserState>()(
}), }),
), ),
setUserInfo, setUserInfo,
userLogin: async (params) => { // userLogin: async (params) => {
const result = { code: 200, data: '1', message: '登录成功' }; // const result = { code: 200, data: '1', message: '登录成功' };
if (result.code === 200) { // if (result.code === 200) {
setCookie( // setCookie(
null, // null,
'token', // 'token',
'Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIxNzc5MDMxOTU1MzUwODg0MzUyIiwic3ViIjoi6ZuA5LmQLVQ5WkhteGkxVSIsImlhdCI6MTcxMzMzNTY1MCwiYXZhdGFyIjoidXNlci9hdmF0YXIvZGVmYXVsdC5wbmciLCJyb2xlcyI6InVzZXIiLCJleHAiOjE3MTM5NDA0NTB9.YtNph3J4XPyADfFAgCpUvh5VE4RgSRC0FH1ZDcNtPhU', // 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIxNzc5MDMxOTU1MzUwODg0MzUyIiwic3ViIjoi6ZuA5LmQLVQ5WkhteGkxVSIsImlhdCI6MTcxMzMzNTY1MCwiYXZhdGFyIjoidXNlci9hdmF0YXIvZGVmYXVsdC5wbmciLCJyb2xlcyI6InVzZXIiLCJleHAiOjE3MTM5NDA0NTB9.YtNph3J4XPyADfFAgCpUvh5VE4RgSRC0FH1ZDcNtPhU',
{ // {
maxAge: 7 * 24 * 60 * 60, // maxAge: 7 * 24 * 60 * 60,
path: '/', // path: '/',
}, // },
); // );
await getUserInfo(); // await getUserInfo();
} // }
return result; // return result;
// const result = await apiUserLogin(params); // // const result = await apiUserLogin(params);
// if (result.code === 200) { // // if (result.code === 200) {
// setCookie(null, 'token', result.data, { // // setCookie(null, 'token', result.data, {
// maxAge: 7 * 24 * 60 * 60, // // maxAge: 7 * 24 * 60 * 60,
// path: '/', // // path: '/',
// }); // // });
// await getUserInfo(); // // await getUserInfo();
// } // // }
// return result; // // return result;
}, // },
getUserInfo, getUserInfo,
}; };
}, },

Loading…
Cancel
Save