mirror of
https://github.com/pterodactyl/panel.git
synced 2026-11-30 11:25:52 -05:00
Co-authored-by: Anthony <anthony@infraly.co> Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
13 lines
507 B
TypeScript
13 lines
507 B
TypeScript
import type { AdminLanguages } from '@/api/admin/languages/queries';
|
|
import type { SelectOption } from '@/components/ui/Select';
|
|
|
|
export const languageOptions = (languages: AdminLanguages | undefined, current?: string): SelectOption[] => {
|
|
const options = Object.entries(languages ?? {}).map(([value, label]) => ({ value, label }));
|
|
|
|
if (current && !options.some((option) => option.value === current)) {
|
|
return [{ value: current, label: current }, ...options];
|
|
}
|
|
|
|
return options;
|
|
};
|