Files
Homarr/src/components/Dashboard/Modals/SelectElement/Components/WidgetsTab/AvailableWidgetsTab.tsx

36 lines
1.2 KiB
TypeScript
Raw Normal View History

2022-12-18 23:22:45 +01:00
import { Grid, Text } from '@mantine/core';
import { useTranslation } from 'next-i18next';
import { useConfigContext } from '../../../../../../config/provider';
2022-12-18 23:22:45 +01:00
import widgets from '../../../../../../widgets';
import { SelectorBackArrow } from '../Shared/SelectorBackArrow';
import { WidgetElementType } from './WidgetElementType';
interface AvailableIntegrationElementsProps {
onClickBack: () => void;
}
export const AvailableIntegrationElements = ({
onClickBack,
}: AvailableIntegrationElementsProps) => {
const { t } = useTranslation('layout/element-selector/selector');
const activeWidgets = useConfigContext().config?.widgets ?? [];
2022-12-18 23:22:45 +01:00
return (
<>
<SelectorBackArrow onClickBack={onClickBack} />
<Text mb="md" color="dimmed">
Widgets interact with your apps, to provide you with more control over your applications.
They usually require a few configurations before use.
</Text>
<Grid>
{Object.entries(widgets)
.filter(([widgetId]) => !activeWidgets.some((aw) => aw.id === widgetId))
.map(([k, v]) => (
<WidgetElementType key={k} id={k} image={v.icon} widget={v} />
))}
2022-12-18 23:22:45 +01:00
</Grid>
</>
);
};