Skip to content

Commit

Permalink
Merge pull request #6637 from WiXSL/fix-simple-type
Browse files Browse the repository at this point in the history
Fix `simple` project type errors
  • Loading branch information
djhi authored Oct 5, 2021
2 parents e6e8a0c + a600e46 commit d7c71e2
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 14 deletions.
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

0 comments on commit d7c71e2

Please sign in to comment.