Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix simple project type errors #6637

Merged
merged 1 commit into from
Oct 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions examples/simple/src/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { forwardRef, memo } from 'react';
import { Layout, AppBar, UserMenu, useLocale, useSetLocale } from 'react-admin';
import { MenuItem, ListItemIcon } from '@material-ui/core';
import { MenuItem, ListItemIcon, MenuItemProps } from '@material-ui/core';
import { makeStyles } from '@material-ui/core/styles';
import Language from '@material-ui/icons/Language';

Expand All @@ -12,17 +12,17 @@ const useStyles = makeStyles(theme => ({
icon: { minWidth: theme.spacing(5) },
}));

const SwitchLanguage = forwardRef((props, ref) => {
const SwitchLanguage = forwardRef((props: MenuItemProps, ref) => {
const locale = useLocale();
const setLocale = useSetLocale();
const classes = useStyles();
return (
<MenuItem
ref={ref}
className={classes.menuItem}
onClick={() => {
onClick={e => {
setLocale(locale === 'en' ? 'fr' : 'en');
props.onClick();
props.onClick(e);
}}
>
<ListItemIcon className={classes.icon}>
Expand Down
4 changes: 2 additions & 2 deletions examples/simple/src/authProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ export default {
);
return Promise.resolve();
}
localStorage.setItem('not_authenticated', true);
localStorage.setItem('not_authenticated', 'true');
return Promise.reject();
},
logout: () => {
localStorage.setItem('not_authenticated', true);
localStorage.setItem('not_authenticated', 'true');
localStorage.removeItem('role');
localStorage.removeItem('login');
localStorage.removeItem('user');
Expand Down
4 changes: 3 additions & 1 deletion examples/simple/src/comments/CommentEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ const CommentEdit = props => {
optionText={<OptionRenderer />}
inputText={inputText}
options={{
fullWidth: true,
InputProps: {
fullWidth: true,
},
}}
/>
</ReferenceInput>
Expand Down
9 changes: 5 additions & 4 deletions examples/simple/src/customRouteNoLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import * as React from 'react';
import { useEffect } from 'react';
import { useSelector, useDispatch } from 'react-redux';
import { crudGetList } from 'react-admin';
import { crudGetList, ReduxState } from 'react-admin';

const CustomRouteNoLayout = () => {
const dispatch = useDispatch();

const loaded = useSelector(
state =>
(state: ReduxState) =>
state.admin.resources.posts &&
state.admin.resources.posts.list.total > 0
);

const total = useSelector(state =>
const total = useSelector((state: ReduxState) =>
state.admin.resources.posts ? state.admin.resources.posts.list.total : 0
);

Expand All @@ -21,7 +21,8 @@ const CustomRouteNoLayout = () => {
crudGetList(
'posts',
{ page: 0, perPage: 10 },
{ field: 'id', order: 'ASC' }
{ field: 'id', order: 'ASC' },
{}
)
);
}, [dispatch]);
Expand Down
3 changes: 2 additions & 1 deletion examples/simple/src/users/UserEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
CloneButton,
DeleteWithConfirmButton,
Edit,
EditActionsProps,
FormTab,
required,
SaveButton,
Expand Down Expand Up @@ -42,7 +43,7 @@ const UserEditToolbar = props => {
);
};

const EditActions = ({ basePath, data, hasShow }) => (
const EditActions = ({ basePath, data, hasShow }: EditActionsProps) => (
<TopToolbar>
<CloneButton
className="button-clone"
Expand Down
4 changes: 2 additions & 2 deletions examples/simple/src/users/UserTitle.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* eslint react/jsx-key: off */
import * as React from 'react';
import { useTranslate } from 'react-admin';
import { Record, useTranslate } from 'react-admin';

const UserTitle = ({ record }) => {
const UserTitle = ({ record }: { record?: Record }) => {
const translate = useTranslate();
return (
<span>
Expand Down