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