/* * Copyright (C) Contributors to the Suwayomi project * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; import Button from '@mui/material/Button'; import Collapse from '@mui/material/Collapse'; import { useLingui } from '@lingui/react/macro'; import type { Maybe } from '@/lib/graphql/generated/graphql-base.types.ts'; import { addStableIdToKeyValueItems, isDuplicateKeyValueItem } from '@/features/settings/ImageProcessing.utils.ts'; import { KeyValueItem } from '@/features/settings/components/images/KeyValueItem.tsx'; import type { TSettingsDownloadConversionKeyValueItem } from '@/features/settings/Settings.types.ts'; export const KeyValueItems = ({ title, open, items, onChange, }: { title: string; open: boolean; items: Maybe; onChange: (items: Maybe) => void; }) => { const { t } = useLingui(); return ( {title} {items?.map((header, index) => ( { const isDeletion = updatedHeader == null; if (isDeletion) { onChange(items?.toSpliced(index, 1)); return; } onChange((items ?? []).toSpliced(index, 1, updatedHeader)); }} /> ))} ); };