Files
pterodactyl-panel/resources/scripts/components/server/features/Features.tsx
T
6c0413e39b Start 2.0 development
Co-authored-by: Anthony <anthony@infraly.co>
Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
2026-10-05 18:10:18 -04:00

21 lines
663 B
TypeScript

import React from 'react';
import features from './index';
import { getObjectKeys } from '@/lib/objects';
type ListItems = [string, React.ComponentType][];
export default function Features({ enabled }: { enabled: string[] }) {
const enabledFeatures = new Set(enabled.map((value) => value.toLowerCase()));
const mapped = getObjectKeys(features).flatMap(
(key): ListItems => (enabledFeatures.has(key.toLowerCase()) ? [[key, features[key]]] : [])
);
return (
<React.Suspense fallback={null}>
{mapped.map(([key, Component]) => (
<Component key={key} />
))}
</React.Suspense>
);
}