React 18 and Vite (#4510)

This commit is contained in:
Matthew Penner 2022-11-25 13:25:03 -07:00 committed by GitHub
parent 1bb1b13f6d
commit 21613fa602
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
244 changed files with 4547 additions and 8933 deletions

View file

@ -1,7 +1,6 @@
import styled from 'styled-components/macro';
import styled from 'styled-components';
import tw from 'twin.macro';
import Checkbox from '@/components/elements/Checkbox';
import React from 'react';
import { useStoreState } from 'easy-peasy';
import Label from '@/components/elements/Label';
@ -36,8 +35,8 @@ interface Props {
}
const PermissionRow = ({ permission, disabled }: Props) => {
const [key, pkey] = permission.split('.', 2);
const permissions = useStoreState((state) => state.permissions.data);
const [key = '', pkey = ''] = permission.split('.', 2);
const permissions = useStoreState(state => state.permissions.data);
return (
<Container htmlFor={`permission_${permission}`} className={disabled ? 'disabled' : undefined}>
@ -54,8 +53,8 @@ const PermissionRow = ({ permission, disabled }: Props) => {
<Label as={'p'} css={tw`font-medium`}>
{pkey}
</Label>
{permissions[key].keys[pkey].length > 0 && (
<p css={tw`text-xs text-neutral-400 mt-1`}>{permissions[key].keys[pkey]}</p>
{(permissions[key]?.keys?.[pkey]?.length ?? 0) > 0 && (
<p css={tw`text-xs text-neutral-400 mt-1`}>{permissions[key]?.keys?.[pkey] ?? ''}</p>
)}
</div>
</Container>