Refactor components to enhance code clarity and maintainability by updating prop types to use Readonly for better immutability. Adjust Result class methods for consistency, and streamline query functions in ChannelDetail and other components to improve performance and readability.
This commit is contained in:
@@ -44,7 +44,7 @@ function addButtonLabel(
|
||||
return `${t('admin.shows.addSelected')} (${count})`
|
||||
}
|
||||
|
||||
export function ShowDetail({ showId }: { showId: string }) {
|
||||
export function ShowDetail({ showId }: Readonly<{ showId: string }>) {
|
||||
const { t } = useTranslation()
|
||||
const queryClient = useQueryClient()
|
||||
const [filter, setFilter] = useState('')
|
||||
|
||||
@@ -15,7 +15,10 @@ import { setShowGenres } from './api'
|
||||
* Жанры шоу: бейджи в шапке карточки + диалог правки. Основной жанр отмечается отдельно —
|
||||
* он показывается в списке шоу и участвует в отборе контента наравне с остальными.
|
||||
*/
|
||||
export function ShowGenresField({ show, onChanged }: { show: ShowDto; onChanged: () => void }) {
|
||||
export function ShowGenresField({
|
||||
show,
|
||||
onChanged,
|
||||
}: Readonly<{ show: ShowDto; onChanged: () => void }>) {
|
||||
const { t } = useTranslation()
|
||||
const [open, setOpen] = useState(false)
|
||||
const [selected, setSelected] = useState<string[]>([])
|
||||
|
||||
@@ -28,7 +28,10 @@ import {
|
||||
updateMetadata,
|
||||
} from './api'
|
||||
|
||||
export function ShowMetadataCard({ show, onChanged }: { show: ShowDto; onChanged: () => void }) {
|
||||
export function ShowMetadataCard({
|
||||
show,
|
||||
onChanged,
|
||||
}: Readonly<{ show: ShowDto; onChanged: () => void }>) {
|
||||
const { t } = useTranslation()
|
||||
const [galleryOpen, setGalleryOpen] = useState(false)
|
||||
const [provider, setProvider] = useState('')
|
||||
@@ -359,7 +362,7 @@ export function ShowMetadataCard({ show, onChanged }: { show: ShowDto; onChanged
|
||||
}
|
||||
|
||||
/** Итог по сезону: чего не хватает — или что полный состав сезона неизвестен. */
|
||||
function SeasonGapNote({ gap }: { gap: MissingEpisodesReport['seasons'][number] }) {
|
||||
function SeasonGapNote({ gap }: Readonly<{ gap: MissingEpisodesReport['seasons'][number] }>) {
|
||||
const { t } = useTranslation()
|
||||
|
||||
if (gap.expected == null)
|
||||
|
||||
Reference in New Issue
Block a user