mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-29 22:06:38 +08:00
eslint
This commit is contained in:
@@ -13,20 +13,16 @@ import {
|
||||
import { Badge } from "@/components/ui/badge"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Progress } from "@/components/ui/progress"
|
||||
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
|
||||
import { Tabs, TabsList, TabsTrigger, TabsContent } from "@/components/ui/tabs"
|
||||
import {
|
||||
Coins,
|
||||
Gift,
|
||||
Inbox,
|
||||
Layers,
|
||||
Shield,
|
||||
Info,
|
||||
ArrowRight,
|
||||
Terminal,
|
||||
Activity,
|
||||
User,
|
||||
ExternalLink,
|
||||
Code2,
|
||||
Copy,
|
||||
Check
|
||||
|
||||
@@ -138,7 +138,11 @@ export function FilesMain() {
|
||||
const toggleSelect = (id: string) => {
|
||||
setSelectedIds((prev) => {
|
||||
const next = new Set(prev)
|
||||
next.has(id) ? next.delete(id) : next.add(id)
|
||||
if (next.has(id)) {
|
||||
next.delete(id)
|
||||
} else {
|
||||
next.add(id)
|
||||
}
|
||||
return next
|
||||
})
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ export const apiSections: PolicySection[] = [
|
||||
<DocsTableRow>
|
||||
<DocsTableCell className="font-mono text-xs">error_msg</DocsTableCell>
|
||||
<DocsTableCell>string</DocsTableCell>
|
||||
<DocsTableCell>错误信息。请求成功时为空字符串 `""`,失败时包含错误详情描述。</DocsTableCell>
|
||||
<DocsTableCell>错误信息。请求成功时为空字符串 `""`,失败时包含错误详情描述。</DocsTableCell>
|
||||
</DocsTableRow>
|
||||
<DocsTableRow>
|
||||
<DocsTableCell className="font-mono text-xs">data</DocsTableCell>
|
||||
|
||||
@@ -38,8 +38,8 @@ export function InfoTab({ systemConfigsLength, authSourcesLength }: InfoTabProps
|
||||
<InfoRow label="应用名称" value={packageJson.name} />
|
||||
<InfoRow label="版本号" value={packageJson.version} />
|
||||
<InfoRow label="构建时间" value={packageJson.buildDate} />
|
||||
<InfoRow label="Next.js" value={(packageJson as any).dependencies.next} />
|
||||
<InfoRow label="React" value={(packageJson as any).dependencies.react} />
|
||||
<InfoRow label="Next.js" value={(packageJson as { dependencies?: Record<string, string> }).dependencies?.next} />
|
||||
<InfoRow label="React" value={(packageJson as { dependencies?: Record<string, string> }).dependencies?.react} />
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
|
||||
@@ -53,10 +53,9 @@ const MENU_GROUPS = [
|
||||
|
||||
interface OtherTabProps {
|
||||
configs: Record<string, SystemConfig>
|
||||
systemConfigsQuery: any
|
||||
}
|
||||
|
||||
export function OtherTab({ configs, systemConfigsQuery }: OtherTabProps) {
|
||||
export function OtherTab({ configs }: OtherTabProps) {
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
const menuDisplayConfig = useMemo(() => {
|
||||
|
||||
@@ -92,7 +92,7 @@ export function ProfileMain() {
|
||||
}, [user, isEditDialogOpen])
|
||||
|
||||
const changePasswordMutation = useMutation({
|
||||
mutationFn: (req: any) => AuthService.changePassword(req),
|
||||
mutationFn: AuthService.changePassword,
|
||||
onSuccess: () => {
|
||||
toast.success("密码修改成功")
|
||||
setOldPassword("")
|
||||
@@ -122,7 +122,7 @@ export function ProfileMain() {
|
||||
}
|
||||
|
||||
const updateProfileMutation = useMutation({
|
||||
mutationFn: (req: any) => AuthService.updateProfile(req),
|
||||
mutationFn: AuthService.updateProfile,
|
||||
onSuccess: () => {
|
||||
toast.success("个人信息修改成功")
|
||||
setIsEditDialogOpen(false)
|
||||
@@ -197,8 +197,8 @@ export function ProfileMain() {
|
||||
setIsCropDialogOpen(false)
|
||||
setCropFile(null)
|
||||
toast.success("头像上传成功,点击保存以生效")
|
||||
} catch (err: any) {
|
||||
toast.error(err.message || "上传头像失败")
|
||||
} catch (err) {
|
||||
toast.error((err as Error).message || "上传头像失败")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import {useEffect, useState} from "react"
|
||||
import {useMutation, useQuery, useQueryClient} from "@tanstack/react-query"
|
||||
import {useMutation, useQuery, useQueryClient, type UseQueryResult} from "@tanstack/react-query"
|
||||
import {Fingerprint, Globe, Loader2, Lock, Mail, Pencil, Plus, Settings, Shield, Trash2, UserPlus} from "lucide-react"
|
||||
|
||||
import {Button} from "@/components/ui/button"
|
||||
@@ -55,7 +55,7 @@ const SECURITY_KEYS = [
|
||||
|
||||
interface SecurityTabProps {
|
||||
configs: Record<string, SystemConfig>
|
||||
systemConfigsQuery: any
|
||||
systemConfigsQuery: UseQueryResult<SystemConfig[], Error>
|
||||
}
|
||||
|
||||
export function SecurityTab({ configs, systemConfigsQuery }: SecurityTabProps) {
|
||||
|
||||
@@ -102,7 +102,7 @@ export function SystemSettingsMain() {
|
||||
<SystemStatusManager />
|
||||
</TabsContent>
|
||||
<TabsContent value="other" className="pt-4">
|
||||
<OtherTab configs={configs} systemConfigsQuery={systemConfigsQuery} />
|
||||
<OtherTab configs={configs} />
|
||||
</TabsContent>
|
||||
<TabsContent value="info" className="pt-4">
|
||||
<InfoTab
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import {useEffect, useState} from "react"
|
||||
import {useMutation, useQueryClient} from "@tanstack/react-query"
|
||||
import {useMutation, useQueryClient, type UseQueryResult} from "@tanstack/react-query"
|
||||
import {Loader2, Mail, Server} from "lucide-react"
|
||||
|
||||
import {Button} from "@/components/ui/button"
|
||||
@@ -15,7 +15,7 @@ import {toast} from "sonner"
|
||||
|
||||
interface SystemTabProps {
|
||||
configs: Record<string, SystemConfig>
|
||||
systemConfigsQuery: any
|
||||
systemConfigsQuery: UseQueryResult<SystemConfig[], Error>
|
||||
}
|
||||
|
||||
export function SystemTab({ configs, systemConfigsQuery }: SystemTabProps) {
|
||||
|
||||
@@ -3,7 +3,7 @@ import Link from "next/link";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { motion } from "motion/react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Book, Check, Copy, Key, Terminal } from "lucide-react";
|
||||
import { Book, Check, Copy, Terminal } from "lucide-react";
|
||||
|
||||
export interface DeveloperSectionProps {
|
||||
className?: string;
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import * as React from "react";
|
||||
import Link from "next/link";
|
||||
import { motion } from "motion/react";
|
||||
import { ArrowRight, Zap, Shield, Globe, CreditCard, Wallet } from "lucide-react";
|
||||
import { ArrowRight, Zap, Shield, Globe, CreditCard } from "lucide-react";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { CountingNumber } from "@/components/animate-ui/primitives/texts/counting-number";
|
||||
|
||||
export interface HeroSectionProps {
|
||||
className?: string;
|
||||
@@ -14,17 +13,6 @@ export interface HeroSectionProps {
|
||||
* Hero Section - 首页 Hero 展示
|
||||
*/
|
||||
export const HeroSection = React.memo(function HeroSection({ className }: HeroSectionProps) {
|
||||
const [balance, setBalance] = React.useState(12450.0);
|
||||
const [income, setIncome] = React.useState(240.0);
|
||||
|
||||
React.useEffect(() => {
|
||||
const interval = setInterval(() => {
|
||||
setBalance(Math.random() * (65123.45 - (-65)) + (-65));
|
||||
setIncome(Math.random() * (656.56 - (-65.65)) + (-65.65));
|
||||
}, 6565);
|
||||
|
||||
return () => clearInterval(interval);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<section className={cn("w-full", className)}>
|
||||
|
||||
@@ -228,6 +228,7 @@ export const ImageCropContent = ({ style, className }: ImageCropContentProps) =>
|
||||
{...reactCropProps}
|
||||
>
|
||||
{imgSrc && (
|
||||
// eslint-disable-next-line @next/next/no-img-element
|
||||
<img
|
||||
alt="crop"
|
||||
className="size-full"
|
||||
@@ -261,14 +262,14 @@ export const ImageCropApply = ({
|
||||
|
||||
if (asChild) {
|
||||
return (
|
||||
<Slot onClick={handleClick} {...(props as any)}>
|
||||
<Slot onClick={handleClick} {...(props as ComponentProps<"button">)}>
|
||||
{children}
|
||||
</Slot>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<Button onClick={handleClick} size="icon" variant="ghost" {...(props as any)}>
|
||||
<Button onClick={handleClick} size="icon" variant="ghost" {...(props as ComponentProps<"button">)}>
|
||||
{children ?? <CropIcon className="size-4" />}
|
||||
</Button>
|
||||
)
|
||||
@@ -293,14 +294,14 @@ export const ImageCropReset = ({
|
||||
|
||||
if (asChild) {
|
||||
return (
|
||||
<Slot onClick={handleClick} {...(props as any)}>
|
||||
<Slot onClick={handleClick} {...(props as ComponentProps<"button">)}>
|
||||
{children}
|
||||
</Slot>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<Button onClick={handleClick} size="icon" variant="ghost" {...(props as any)}>
|
||||
<Button onClick={handleClick} size="icon" variant="ghost" {...(props as ComponentProps<"button">)}>
|
||||
{children ?? <RotateCcwIcon className="size-4" />}
|
||||
</Button>
|
||||
)
|
||||
@@ -330,7 +331,7 @@ export const Cropper = ({
|
||||
onChange={onChange}
|
||||
onComplete={onComplete}
|
||||
onCrop={onCrop}
|
||||
{...(props as any)}
|
||||
{...(props as Omit<ReactCropProps, "onChange" | "onComplete" | "children">)}
|
||||
>
|
||||
<ImageCropContent className={className} style={style} />
|
||||
</ImageCrop>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { InternalAxiosRequestConfig } from 'axios';
|
||||
import {BaseService} from '../core/base.service';
|
||||
import type {
|
||||
AuthSource,
|
||||
@@ -105,7 +106,7 @@ export class AuthService extends BaseService {
|
||||
}
|
||||
|
||||
static async login(request: LoginRequest, headers?: Record<string, string>): Promise<User> {
|
||||
return this.post<User>('/user/login', request, headers ? { headers } as any : undefined);
|
||||
return this.post<User>('/user/login', request, headers ? ({ headers } as unknown as InternalAxiosRequestConfig) : undefined);
|
||||
}
|
||||
|
||||
static async register(request: RegisterRequest): Promise<User> {
|
||||
|
||||
@@ -102,7 +102,7 @@ apiClient.interceptors.response.use(
|
||||
cancelTokens.delete(requestKey);
|
||||
pendingRequests.delete(requestKey);
|
||||
|
||||
const resData = response.data as any;
|
||||
const resData = response.data as ApiError & ApiResponse;
|
||||
if (resData && resData.error_msg) {
|
||||
return Promise.reject(new ApiErrorBase(resData.error_msg));
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user