Переглянути джерело

♻️ refactor(ui): 清理未使用的导入和变量

- 从 avatar-upload 组件中移除未使用的 Text 和 Button 导入
- 移除 avatar-upload 组件中未使用的 iconSize 变量
- 更新 form 组件中的 Controller 类型定义以匹配最新版本
- 将 form 组件中的 Controller 包装在函数组件中以解决类型问题
- 将 label 组件中的 ref 参数重命名为 _ref 以表明其未被使用
yourname 1 місяць тому
батько
коміт
56a6d74358

+ 1 - 3
mini/src/components/ui/avatar-upload.tsx

@@ -1,8 +1,7 @@
 import { useState } from 'react'
-import { View, Text, Image } from '@tarojs/components'
+import { View, Image } from '@tarojs/components'
 import Taro from '@tarojs/taro'
 import { cn } from '@/utils/cn'
-import { Button } from '@/components/ui/button'
 import { uploadFromSelect, type UploadResult } from '@/utils/minio'
 
 interface AvatarUploadProps {
@@ -74,7 +73,6 @@ export function AvatarUpload({
   }
 
   const avatarSize = size
-  const iconSize = Math.floor(size / 4)
 
   return (
     <View 

+ 6 - 2
mini/src/components/ui/form.tsx

@@ -32,10 +32,14 @@ const FormField = <
   TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
 >({
   ...props
-}: ControllerProps<TFieldValues, TName>) => {
+}: ControllerProps<TFieldValues, TName, TFieldValues>) => {
+  const ControllerWrapper = (props: any) => (
+    // @ts-ignore
+    <Controller {...props} />
+  )
   return (
     <FormFieldContext.Provider value={{ name: props.name }}>
-      <Controller {...props} />
+      <ControllerWrapper {...props} />
     </FormFieldContext.Provider>
   )
 }

+ 1 - 1
mini/src/components/ui/label.tsx

@@ -35,7 +35,7 @@ export interface LabelProps {
 }
 
 const Label = forwardRef<HTMLLabelElement, LabelProps>(
-  ({ className, variant, size, children, required, htmlFor, ...props }, ref) => {
+  ({ className, variant, size, children, required, htmlFor, ...props }, _ref) => {
     return (
       <View className="mb-2">
         <Text