UNPKG

@state-less/leap-frontend

Version:

A collection of open source fullstack services powered by React Server

12 lines (11 loc) 1.24 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { Alert, Card, CardContent, List, ListItem, ListItemText, Typography, Checkbox, } from '@mui/material'; import { authContext, useComponent } from '@state-less/react-client'; import { useContext } from 'react'; export const Admin = () => { const [features, { error, loading: featuresLoading }] = useComponent('features'); const { session } = useContext(authContext); if (!session?.id) return _jsx(Alert, { severity: "error", children: "Not logged in." }); return (_jsxs(Card, { children: [error && _jsx(Alert, { severity: "error", children: error.message }), _jsxs(CardContent, { children: [_jsx(Typography, { variant: "h5", children: "Admin" }), _jsxs(List, { children: [_jsxs(ListItem, { children: [_jsx(ListItemText, { primary: "Wilson", secondary: "Use Wilson score to sort comments" }), _jsx(Checkbox, { checked: !!features?.props?.wilson, onClick: () => features?.props?.toggleWilson() })] }), _jsxs(ListItem, { children: [_jsx(ListItemText, { primary: "Animation", secondary: "Display animation on page" }), _jsx(Checkbox, { checked: !!features?.props?.animated, onClick: () => features?.props?.toggleAnimated() })] })] })] })] })); };