refactor(web): mark Props of app/annotation components as read-only (#25219) (#37299)

This commit is contained in:
Rohit Gahlawat 2026-06-11 05:49:51 +05:30 committed by GitHub
parent 86ffa119ff
commit 08f1bf20ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 22 additions and 22 deletions

View File

@ -9,11 +9,11 @@ export enum EditItemType {
Query = 'query',
Answer = 'answer',
}
type Props = {
type Props = Readonly<{
type: EditItemType
content: string
onChange: (content: string) => void
}
}>
const EditItem: FC<Props> = ({
type,

View File

@ -21,11 +21,11 @@ import AnnotationFull from '@/app/components/billing/annotation-full'
import { useProviderContext } from '@/context/provider-context'
import EditItem, { EditItemType } from './edit-item'
type Props = {
type Props = Readonly<{
isShow: boolean
onHide: () => void
onAdd: (payload: AnnotationItemBasic) => void
}
}>
const AddAnnotationModal: FC<Props> = ({
isShow,

View File

@ -9,10 +9,10 @@ import { useEffect, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { Csv as CSVIcon } from '@/app/components/base/icons/src/public/files'
export type Props = {
export type Props = Readonly<{
file: File | undefined
updateFile: (file?: File) => void
}
}>
const CSVUploader: FC<Props> = ({
file,

View File

@ -12,11 +12,11 @@ import {
import * as React from 'react'
import { useTranslation } from 'react-i18next'
type Props = {
type Props = Readonly<{
isShow: boolean
onHide: () => void
onConfirm: () => void
}
}>
const ClearAllAnnotationsConfirmModal: FC<Props> = ({
isShow,

View File

@ -13,12 +13,12 @@ export enum EditItemType {
Query = 'query',
Answer = 'answer',
}
type Props = {
type Props = Readonly<{
type: EditItemType
content: string
readonly?: boolean
onSave: (content: string) => Promise<void>
}
}>
export const EditTitle: FC<{ className?: string, title: string }> = ({ className, title }) => (
<div className={cn(className, 'flex h-[18px] items-center system-xs-medium text-text-tertiary')}>

View File

@ -29,7 +29,7 @@ import useTimestamp from '@/hooks/use-timestamp'
import { addAnnotation, editAnnotation } from '@/service/annotation'
import EditItem, { EditItemType } from './edit-item'
type Props = {
type Props = Readonly<{
isShow: boolean
onHide: () => void
appId: string
@ -42,7 +42,7 @@ type Props = {
createdAt?: number
onRemove: () => void
onlyEditResponse?: boolean
}
}>
const EditAnnotationModal: FC<Props> = ({
isShow,

View File

@ -29,12 +29,12 @@ import ClearAllAnnotationsConfirmModal from '../clear-all-annotations-confirm-mo
const CSV_HEADER_QA_EN = ['Question', 'Answer']
const CSV_HEADER_QA_CN = ['问题', '答案']
type Props = {
type Props = Readonly<{
appId: string
onAdd: (payload: AnnotationItemBasic) => void
onAdded: () => void
controlUpdateList: number
}
}>
type OperationsMenuProps = {
list: AnnotationItemBasic[]

View File

@ -30,9 +30,9 @@ import { List } from './list'
import { AnnotationEnableStatus, JobStatus } from './type'
import ViewAnnotationModal from './view-annotation-modal'
type Props = {
type Props = Readonly<{
appDetail: App
}
}>
const Annotation: FC<Props> = (props) => {
const { appDetail } = props

View File

@ -9,14 +9,14 @@ import useTimestamp from '@/hooks/use-timestamp'
import BatchAction from './batch-action'
import RemoveAnnotationConfirmModal from './remove-annotation-confirm-modal'
type Props = {
type Props = Readonly<{
list: AnnotationItem[]
onView: (item: AnnotationItem) => void
onRemove: (id: string) => void
selectedIds: string[]
onSelectedIdsChange: (selectedIds: string[]) => void
onBatchDelete: () => Promise<void>
}
}>
type AnnotationTableRowProps = {
item: AnnotationItem

View File

@ -11,11 +11,11 @@ import {
import * as React from 'react'
import { useTranslation } from 'react-i18next'
type Props = {
type Props = Readonly<{
isShow: boolean
onHide: () => void
onRemove: () => void
}
}>
const RemoveAnnotationConfirmModal: FC<Props> = ({
isShow,

View File

@ -33,14 +33,14 @@ import { fetchHitHistoryList } from '@/service/annotation'
import EditItem, { EditItemType } from '../edit-annotation-modal/edit-item'
import HitHistoryNoData from './hit-history-no-data'
type Props = {
type Props = Readonly<{
appId: string
isShow: boolean
onHide: () => void
item: AnnotationItem
onSave: (editedQuery: string, editedAnswer: string) => Promise<void>
onRemove: () => void
}
}>
enum TabType {
annotation = 'annotation',