/* * 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 { useTranslation } from 'react-i18next'; import { ReactNode, useMemo } from 'react'; import Button from '@mui/material/Button'; import { CustomTooltip } from '@/features/core/components/CustomTooltip.tsx'; import { MultiValueButtonProps } from '@/features/core/Core.types.ts'; import { getNextRotationValue } from '@/features/core/utils/ValueRotationButton.utils.ts'; import { Superscript } from '@/features/core/components/texts/Superscript.tsx'; export const ValueRotationButton = ({ tooltip, value, defaultValue, values, setValue, valueToDisplayData, isDefaultable, onDefault, defaultIcon, }: MultiValueButtonProps & { defaultIcon?: ReactNode }) => { const { t } = useTranslation(); const isDefault = value === undefined; const indexOfValue = useMemo(() => { if (isDefault) { return -1; } return values.indexOf(value); }, [value, values]); return ( {isDefault ? ( ) : ( )} ); };