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.
ci / build-backend (push) Successful in 1m41s
ci / build-frontend (push) Successful in 47s
ci / tests (push) Successful in 2m40s
ci / sonar (push) Successful in 5m35s

This commit is contained in:
Leonid Pershin
2026-07-27 01:14:53 +03:00
parent ecb5417170
commit 5449c05b5b
56 changed files with 132 additions and 124 deletions
@@ -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)