Skip to content

Commit

Permalink
chore: Update to 23.2 (#53)
Browse files Browse the repository at this point in the history
* apply case-only name changes

* commit the new 23.2 version

* package name

* restore readme and metadata

* restore app name and remove NewPage
  • Loading branch information
VasilyStrelyaev authored Dec 21, 2023
1 parent 4528996 commit 371119c
Show file tree
Hide file tree
Showing 44 changed files with 22,609 additions and 24,299 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ For more information about the DevExtreme React Template and how to customize it
**DevExtreme React Template is released as a MIT-licensed (free and open-source) add-on to DevExtreme.**

- [DevExtreme License](https://js.devexpress.com/Licensing/)
- [Free trial](http://js.devexpress.com/Buy/)
- [Free trial](http://js.devexpress.com/Buy/)
26,546 changes: 16,181 additions & 10,365 deletions package-lock.json

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.12.0",
"@testing-library/react": "^11.2.7",
"@testing-library/user-event": "^12.8.3",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "^5.0.0",
"web-vitals": "^1.1.2",
"node-sass": "^7.0.3",
"react-router-dom": "^5.0.0",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4",
"sass": "^1.34.1",
"react-router-dom": "^6.3.0",
"react-app-polyfill": "^1.0.0",
"devextreme": "^22.2.3",
"devextreme-react": "^22.2.3"
"devextreme": "23.2.3",
"devextreme-react": "23.2.3"
},
"scripts": {
"start": "react-scripts start",
Expand Down Expand Up @@ -43,7 +43,7 @@
]
},
"devDependencies": {
"devextreme-cli": "^1.2.24",
"devextreme-themebuilder": "^21.2.3"
"devextreme-cli": "1.6.3",
"devextreme-themebuilder": "23.2.3"
}
}
}
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>Devextreme App</title>
<title>DevExtreme App</title>
</head>
<body class="dx-viewport">
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
2 changes: 1 addition & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function App() {
return <UnauthenticatedContent />;
}

export default function () {
export default function Root() {
const screenSizeClass = useScreenSizeClass();

return (
Expand Down
14 changes: 9 additions & 5 deletions src/App.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import './matchMediaMock';
import { render, screen } from '@testing-library/react';
import App from './App';
import { act } from 'react-dom/test-utils';

test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});
describe("App", () => {
test('renders learn react link', async () => {
await act( async () => { render(<App/>) });
const linkElement = screen.getByText(/create react app/i);
expect(linkElement).toBeInTheDocument();
});
})
20 changes: 11 additions & 9 deletions src/Content.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
import React from 'react';
import { Switch, Route, Redirect } from 'react-router-dom';
import { Routes, Route, Navigate } from 'react-router-dom';
import appInfo from './app-info';
import routes from './app-routes';
import { SideNavOuterToolbar as SideNavBarLayout } from './layouts';
import { Footer } from './components';

export default function() {
export default function Content() {
return (
<SideNavBarLayout title={appInfo.title}>
<Switch>
{routes.map(({ path, component }) => (
<Routes>
{routes.map(({ path, element }) => (
<Route
exact
key={path}
path={path}
component={component}
element={element}
/>
))}
<Redirect to={'/home'} />
</Switch>
<Route
path='*'
element={<Navigate to='/home' />}
/>
</Routes>
<Footer>
Copyright © 2011-{new Date().getFullYear()} {appInfo.title} Inc.
<br />
Expand All @@ -28,3 +29,4 @@ export default function() {
</SideNavBarLayout>
);
}

69 changes: 40 additions & 29 deletions src/UnauthenticatedContent.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,46 @@
import React from 'react';
import { Switch, Route, Redirect } from 'react-router-dom';
import { Routes, Route, Navigate } from 'react-router-dom';
import { SingleCard } from './layouts';
import { LoginForm, ResetPasswordForm, ChangePasswordForm, CreateAccountForm } from './components';

export default function () {
export default function UnauthenticatedContent() {
return (
<Switch>
<Route exact path='/login' >
<SingleCard title="Sign In">
<LoginForm />
</SingleCard>
</Route>
<Route exact path='/create-account' >
<SingleCard title="Sign Up">
<CreateAccountForm />
</SingleCard>
</Route>
<Route exact path='/reset-password' >
<SingleCard
title="Reset Password"
description="Please enter the email address that you used to register, and we will send you a link to reset your password via Email."
>
<ResetPasswordForm />
</SingleCard>
</Route>
<Route exact path='/change-password/:recoveryCode' >
<SingleCard title="Change Password">
<ChangePasswordForm />
</SingleCard>
</Route>
<Redirect to={'/login'} />
</Switch>
<Routes>
<Route
path='/login'
element={
<SingleCard title="Sign In">
<LoginForm />
</SingleCard>
}
/>
<Route
path='/create-account'
element={
<SingleCard title="Sign Up">
<CreateAccountForm />
</SingleCard>
}
/>
<Route
path='/reset-password'
element={
<SingleCard
title="Reset Password"
description="Please enter the email address that you used to register, and we will send you a link to reset your password via Email."
>
<ResetPasswordForm />
</SingleCard>
}
/>
<Route
path='/change-password/:recoveryCode'
element={
<SingleCard title="Change Password">
<ChangePasswordForm />
</SingleCard>
}
/>
<Route path='*' element={<Navigate to={'/login'} />}></Route>
</Routes>
);
}
6 changes: 4 additions & 2 deletions src/app-info.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export default {
title: 'DevExtreme App'
const appInfo = {
title: 'DevExtreme App'
};
export default appInfo;

34 changes: 17 additions & 17 deletions src/app-routes.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import { withNavigationWatcher } from './contexts/navigation';
import { HomePage, TasksPage, ProfilePage } from './pages';
import { withNavigationWatcher } from './contexts/navigation';

const routes = [
{
path: '/tasks',
component: TasksPage
},
{
path: '/profile',
component: ProfilePage
},
{
path: '/home',
component: HomePage
}
{
path: '/tasks',
element: TasksPage
},
{
path: '/profile',
element: ProfilePage
},
{
path: '/home',
element: HomePage
}
];

export default routes.map(route => {
return {
...route,
component: withNavigationWatcher(route.component)
};
return {
...route,
element: withNavigationWatcher(route.element, route.path)
};
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState, useRef, useCallback } from 'react';
import { useHistory, useParams } from 'react-router-dom';
import { useNavigate, useParams } from 'react-router-dom';
import Form, {
Item,
Label,
Expand All @@ -10,12 +10,13 @@ import Form, {
} from 'devextreme-react/form';
import LoadIndicator from 'devextreme-react/load-indicator';
import notify from 'devextreme/ui/notify';

import { changePassword } from '../../api/auth';

export default function (props) {
const history = useHistory();
export default function ChangePasswordForm() {
const navigate = useNavigate();
const [loading, setLoading] = useState(false);
const formData = useRef({});
const formData = useRef({ password: '' });
const { recoveryCode } = useParams();

const onSubmit = useCallback(async (e) => {
Expand All @@ -27,11 +28,11 @@ export default function (props) {
setLoading(false);

if (result.isOk) {
history.push('/login');
navigate('/login');
} else {
notify(result.message, 'error', 2000);
}
}, [history, recoveryCode]);
}, [navigate, recoveryCode]);

const confirmPassword = useCallback(
({ value }) => value === formData.current.password,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState, useRef, useCallback } from 'react';
import { Link, useHistory } from 'react-router-dom';
import { Link, useNavigate } from 'react-router-dom';
import Form, {
Item,
Label,
Expand All @@ -12,12 +12,13 @@ import Form, {
import notify from 'devextreme/ui/notify';
import LoadIndicator from 'devextreme-react/load-indicator';
import { createAccount } from '../../api/auth';
import './create-account-form.scss';

export default function (props) {
const history = useHistory();
import './CreateAccountForm.scss';

export default function CreateAccountForm() {
const navigate = useNavigate();
const [loading, setLoading] = useState(false);
const formData = useRef({});
const formData = useRef({ email: '', password: '' });

const onSubmit = useCallback(async (e) => {
e.preventDefault();
Expand All @@ -28,11 +29,11 @@ export default function (props) {
setLoading(false);

if (result.isOk) {
history.push('/login');
navigate('/login');
} else {
notify(result.message, 'error', 2000);
}
}, [history]);
}, [navigate]);

const confirmPassword = useCallback(
({ value }) => value === formData.current.password,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import './footer.scss';
import './Footer.scss';

export default ({ ...rest }) => {
export default function Footer({ ...rest }) {
return <footer className={'footer'} {...rest} />;
};
}
File renamed without changes.
46 changes: 46 additions & 0 deletions src/components/header/Header.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import React from 'react';
import Toolbar, { Item } from 'devextreme-react/toolbar';
import Button from 'devextreme-react/button';
import UserPanel from '../user-panel/UserPanel';
import './Header.scss';
import { Template } from 'devextreme-react/core/template';


export default function Header({ menuToggleEnabled, title, toggleMenu }) {
return (
<header className={'header-component'}>
<Toolbar className={'header-toolbar'}>
<Item
visible={menuToggleEnabled}
location={'before'}
widget={'dxButton'}
cssClass={'menu-button'}
>
<Button icon="menu" stylingMode="text" onClick={toggleMenu} />
</Item>
<Item
location={'before'}
cssClass={'header-title'}
text={title}
visible={!!title}
/>
<Item
location={'after'}
locateInMenu={'auto'}
menuItemTemplate={'userPanelTemplate'}
>
<Button
className={'user-button authorization'}
width={210}
height={'100%'}
stylingMode={'text'}
>
<UserPanel menuMode={'context'} />
</Button>
</Item>
<Template name={'userPanelTemplate'}>
<UserPanel menuMode={'list'} />
</Template>
</Toolbar>
</header>
)}
File renamed without changes.
Loading

0 comments on commit 371119c

Please sign in to comment.