forked from akai/readest
298d4872a0
The translate.toil.cc relay that backs the yandex provider is currently unavailable. Introduce a `disabled` flag on TranslationProvider and filter disabled providers out of both `getTranslators()` and `getTranslator()` so the settings panel, translator popup, and the fallback logic in `useTranslator` all agree the provider doesn't exist — no per-callsite changes needed. Flip the flag back (or delete the line) on `yandexProvider` to re-enable once the upstream is healthy. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
48 lines
1.0 KiB
TypeScript
48 lines
1.0 KiB
TypeScript
import clsx from 'clsx';
|
|
import React from 'react';
|
|
|
|
type Option = {
|
|
value: string;
|
|
label: string;
|
|
disabled?: boolean;
|
|
};
|
|
|
|
type SelectProps = {
|
|
value: string;
|
|
onChange: (e: React.ChangeEvent<HTMLSelectElement>) => void;
|
|
options: Option[];
|
|
disabled?: boolean;
|
|
className?: string;
|
|
};
|
|
|
|
export default function Select({
|
|
value,
|
|
onChange,
|
|
options,
|
|
className,
|
|
disabled = false,
|
|
}: SelectProps) {
|
|
return (
|
|
<select
|
|
value={value}
|
|
onChange={onChange}
|
|
onKeyDown={(e) => e.stopPropagation()}
|
|
className={clsx(
|
|
'select bg-base-200 h-8 min-h-8 max-w-[60%] truncate rounded-md border-none text-sm',
|
|
'focus:outline-none focus:ring-0 focus-visible:outline-none',
|
|
className,
|
|
)}
|
|
disabled={disabled}
|
|
style={{
|
|
textAlignLast: 'end',
|
|
}}
|
|
>
|
|
{options.map(({ value, label, disabled: optionDisabled }) => (
|
|
<option key={value} value={value} disabled={optionDisabled}>
|
|
{label}
|
|
</option>
|
|
))}
|
|
</select>
|
|
);
|
|
}
|