fix(eslint): 删除冗余代码

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

@ -16,10 +16,10 @@ interface DownLoadItemWithQRCode extends DownLoadItem {
qrCode: string;
}
interface DownLoadItemWithLink extends DownLoadItem {
type: 'link';
downloadUrl: string;
}
// interface DownLoadItemWithLink extends DownLoadItem {
// type: 'link';
// downloadUrl: string;
// }
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',
name: 'iOS版',
@ -114,12 +115,12 @@ export const downloadList: Array<DownLoadItemWithQRCode | DownLoadItemWithLink>
buttonText: '下载安装包至本地',
qrCode: '/img/download/qrcode_ios.svg',
},
{
type: 'link',
name: 'Mac版',
downloadUrl: '#',
iconUrl: '/img/download/footer_mac.svg',
},
// {
// type: 'link',
// name: 'Mac版',
// downloadUrl: '#',
// iconUrl: '/img/download/footer_mac.svg',
// },
{
type: 'QRCode',
name: 'Pad版',

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

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

@ -5,7 +5,7 @@ import { useShallow } from 'zustand/react/shallow';
import { PlayerButton } from '@/components';
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(
useShallow((state) => {
return {

@ -7,18 +7,17 @@ import { useRouter } from 'next/navigation';
import { useShallow } from 'zustand/react/shallow';
import { useLoginRedirect } from '@/utils/login';
import { setAccessToken } from '@/lib/cache';
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';
export default function LoginForm() {
const redirect = useLoginRedirect();
const router = useRouter();
const { userLogin, setShowLogin, getUserInfo } = useUserStore(
const { setShowLogin, getUserInfo } = useUserStore(
useShallow((state) => ({
userLogin: state.userLogin,
setShowLogin: state.setShowLogin,
getUserInfo: state.getUserInfo,
})),

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

@ -1,16 +1,16 @@
import * as React from "react"
import * as DialogPrimitive from "@radix-ui/react-dialog"
import { X } from "lucide-react"
import * as React from 'react';
import * as DialogPrimitive from '@radix-ui/react-dialog';
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<
React.ElementRef<typeof DialogPrimitive.Overlay>,
@ -19,13 +19,13 @@ const DialogOverlay = React.forwardRef<
<DialogPrimitive.Overlay
ref={ref}
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",
className
'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,
)}
{...props}
/>
))
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
));
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
const DialogContent = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Content>,
@ -36,8 +36,8 @@ const DialogContent = React.forwardRef<
<DialogPrimitive.Content
ref={ref}
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",
className
'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,
)}
{...props}
>
@ -48,36 +48,18 @@ const DialogContent = React.forwardRef<
</DialogPrimitive.Close>
</DialogPrimitive.Content>
</DialogPortal>
))
DialogContent.displayName = DialogPrimitive.Content.displayName
));
DialogContent.displayName = DialogPrimitive.Content.displayName;
const DialogHeader = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
"flex flex-col space-y-1.5 text-center sm:text-left",
className
)}
{...props}
/>
)
DialogHeader.displayName = "DialogHeader"
const DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
<div className={cn('flex flex-col space-y-1.5 text-center sm:text-left', className)} {...props} />
);
DialogHeader.displayName = 'DialogHeader';
const DialogFooter = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
className
)}
{...props}
/>
)
DialogFooter.displayName = "DialogFooter"
const DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
<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<
React.ElementRef<typeof DialogPrimitive.Title>,
@ -85,26 +67,19 @@ const DialogTitle = React.forwardRef<
>(({ className, ...props }, ref) => (
<DialogPrimitive.Title
ref={ref}
className={cn(
"text-lg font-semibold leading-none tracking-tight",
className
)}
className={cn('text-lg font-semibold leading-none tracking-tight', className)}
{...props}
/>
))
DialogTitle.displayName = DialogPrimitive.Title.displayName
));
DialogTitle.displayName = DialogPrimitive.Title.displayName;
const DialogDescription = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Description>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
>(({ className, ...props }, ref) => (
<DialogPrimitive.Description
ref={ref}
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
))
DialogDescription.displayName = DialogPrimitive.Description.displayName
<DialogPrimitive.Description ref={ref} className={cn('text-sm text-muted-foreground', className)} {...props} />
));
DialogDescription.displayName = DialogPrimitive.Description.displayName;
export {
Dialog,
@ -117,4 +92,4 @@ export {
DialogFooter,
DialogTitle,
DialogDescription,
}
};

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

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

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

Loading…
Cancel
Save