Skip to content

Commit a8326e6

Browse files
committed
chore: resolve audit issue and update README.md
1 parent 6ccb31a commit a8326e6

File tree

13 files changed

+4280
-4126
lines changed

13 files changed

+4280
-4126
lines changed

README.md

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,38 @@
1-
<div align="center">
1+
<p align="center">
22
<img src="./app/assets/images/logo/short-logo.svg" alt="Truthy Logo">
3-
</div><br>
3+
</p>
44
<h1 align="center">
55
Truthy CMS (ReactJS Starter)
66
</h1>
77

8-
<div align="center"> This repository is frontend part of Truthy CMS written in ReactJS & Redux-Saga. For Backend API please visit https://github.com/gobeam/truthy. Ant design (https://ant.design/) is used as an UI library. This project includes User Management, Role Management, Permission Management, Email Module, Account Settings, OTP, RBAC support, Localization, and many more. Hope you like it.<br>
9-
If you love it don't forget to share your experience. If you want to contribute to the Truthy CMS in any way like API, Frontend, Design, Logo you're more than welcome to do so. Our plan is to make this no. 1 CMS maintained by opensource community.
10-
</div>
11-
12-
<br>
13-
<div align="center">
8+
<p align="center"> This repository is frontend part of Truthy CMS written in ReactJS & Redux-Saga. For Backend API please visit https://github.com/gobeam/truthy. Ant design (https://ant.design/) is used as an UI library. This project includes User Management, Role Management, Permission Management, Email Module, Account Settings, OTP, RBAC support, Localization, and many more. Hope you like it.<br>
9+
If you love it don't forget to share your experience. If you want to contribute to the Truthy CMS in any way like API, Frontend, Design, Logo you're more than welcome to do so. Our plan is to make this no. 1 CMS maintained by open-source community.
10+
</p>
11+
12+
<p align="center">
13+
<img alt="truthy-react-frontend package.json version" src="https://img.shields.io/github/package-json/v/gobeam/truthy-react-frontend">
14+
<img alt="ruthy-react-frontend" src="https://img.shields.io/github/license/gobeam/truthy-react-frontend">
15+
<img alt="Lines of code" src="https://img.shields.io/tokei/lines/github/gobeam/truthy-react-frontend">
16+
<img src='https://www.codetriage.com/gobeam/truthy-react-frontend/badges/users.svg' alt='Open Source Helpers' />
17+
</p>
18+
<p align="center">
19+
<a href="https://www.buymeacoffee.com/gobeam" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-green.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
20+
</p>
21+
22+
<p align="center">
1423
<sub>Created by <a href="https://www.linkedin.com/in/roshan-ranabhat/">Roshan Ranabhat (gobeam)</a> and maintained with ❤️ by an amazing <a href="https://github.com/gobeam/truthy-contributors">team of awesome developers</a>.</sub>
15-
</div>
24+
</p>
25+
26+
<p align="center">
27+
<sub>Check Live code deployed here:
28+
Frontend: <a href="https://truthy-cms.herokuapp.com">Truthy CMS</a>
29+
Backend API Docs: <a href="https://truthy-backend.herokuapp.com/api-docs/">Swagger Docs</a>
30+
</sub>
31+
</p>
32+
33+
<p align="center">
34+
<img src="https://gobeam.github.io/truthy-contributors/truthy.gif" alt="Truthy CMS" >
35+
</p>
1636

1737
## Table of Contents
1838

app/assets/sass/pages/_home.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import url('https://fonts.googleapis.com/css2?family=Public+Sans:wght@100;300;400;500;60;7000&display=swap');
1+
// @import url('https://fonts.googleapis.com/css2?family=Public+Sans:wght@100;300;400;500;60;7000&display=swap');
22
.home-wrapper {
33
@include d-x-center;
44
flex-direction: column;

app/components/Header/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const stateSelector = createStructuredSelector({
3535
isLoading: makeIsLoadingSelector(),
3636
});
3737

38-
const HeaderComponent = () => {
38+
function HeaderComponent() {
3939
const dispatch = useDispatch();
4040
const navigate = useNavigate();
4141

@@ -117,7 +117,7 @@ const HeaderComponent = () => {
117117
<Dropdown overlay={menu} trigger={['click']}>
118118
<span className="user-action">
119119
{user.avatar ? (
120-
<Avatar src={`${BASE_URL}/assets/profile/${user.avatar}`} />
120+
<Avatar src={`${BASE_URL}/profile/${user.avatar}`} />
121121
) : (
122122
<Avatar
123123
style={{ color: '#f56a00', backgroundColor: '#fde3cf' }}
@@ -145,6 +145,6 @@ const HeaderComponent = () => {
145145
</div>
146146
</Header>
147147
);
148-
};
148+
}
149149

150150
export default HeaderComponent;

app/containers/App/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99

1010
import React, { useEffect } from 'react';
1111
import { useDispatch } from 'react-redux';
12-
import { BrowserRouter, Route } from 'react-router-dom';
12+
import { BrowserRouter } from 'react-router-dom';
1313
import { Helmet } from 'react-helmet';
14-
import NotFoundPage from 'containers/NotFoundPage/Loadable';
1514
import RenderRouter from 'routes';
1615
import { getProfileAction } from 'containers/App/actions';
1716
import { useInjectReducer } from 'utils/injectReducer';
@@ -43,7 +42,6 @@ export default function App() {
4342
<Layout>
4443
<BrowserRouter>
4544
<RenderRouter />
46-
<Route path="*" component={NotFoundPage} />
4745
</BrowserRouter>
4846
</Layout>
4947
</>

app/containers/LoginPage/saga.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { call, put, select, takeLatest } from 'redux-saga/effects';
22
import ApiEndpoint from 'utils/api';
33
import request from 'utils/request';
4-
import messages from 'containers/LoginPage/messages';
4+
// import messages from 'containers/LoginPage/messages';
55
import { makeFormValuesSelector } from 'containers/LoginPage/selectors';
66
import { LOGIN_PROCESS } from 'containers/LoginPage/constants';
77
import { getProfileAction } from 'containers/App/actions';
@@ -10,7 +10,7 @@ import {
1010
asyncStartAction,
1111
enterValidationErrorAction,
1212
} from 'containers/LoginPage/actions';
13-
import { showAlert, showFormattedAlert } from 'common/saga';
13+
import { showAlert } from 'common/saga';
1414
import { POST } from 'utils/constants';
1515
import { clearSnackMessageAction } from 'containers/SnackMessage/actions';
1616

@@ -27,8 +27,8 @@ export function* attemptLogin() {
2727
yield call(request, requestPayload);
2828
yield put(asyncEndAction());
2929
yield put(clearSnackMessageAction());
30-
yield put(getProfileAction());
31-
return yield showFormattedAlert('success', messages.loginSuccess);
30+
return yield put(getProfileAction());
31+
// return yield showFormattedAlert('success', messages.loginSuccess);
3232
} catch (error) {
3333
yield put(asyncEndAction());
3434
if (error.data && error.data.statusCode === 422) {

app/containers/PrivateRoute/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import PermissionDeniedPage from 'containers/PermissionDeniedPage';
1515
import PropTypes from 'prop-types';
1616
import React, { useEffect, useState } from 'react';
1717
import { useSelector } from 'react-redux';
18-
import { Navigate, Route } from 'react-router-dom';
18+
import { Navigate } from 'react-router-dom';
1919
import { createStructuredSelector } from 'reselect';
2020
import { checkPermissionForComponent } from 'utils/permission';
2121

@@ -26,8 +26,7 @@ const stateSelector = createStructuredSelector({
2626
otpVerified: makeOtpVerificationSelector(),
2727
});
2828

29-
const PrivateRoute = (props) => {
30-
const { path, resource, method, defaultPermission } = props;
29+
function PrivateRoute({ children, path, resource, method, defaultPermission }) {
3130
const { isLogged, user, otpVerified } = useSelector(stateSelector);
3231
const [permitted, setPermitted] = useState(true);
3332

@@ -51,14 +50,15 @@ const PrivateRoute = (props) => {
5150
if (!permitted && otpVerified) {
5251
return <PermissionDeniedPage />;
5352
}
54-
return isLogged ? <Route {...props} /> : <Navigate to="/login" />;
55-
};
53+
return isLogged ? children : <Navigate to="/login" />;
54+
}
5655

5756
PrivateRoute.propTypes = {
5857
defaultPermission: PropTypes.bool,
5958
path: PropTypes.string,
6059
resource: PropTypes.string.isRequired,
6160
method: PropTypes.string.isRequired,
61+
children: PropTypes.node,
6262
};
6363

6464
export default PrivateRoute;

app/containers/Profile/index.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const stateSelector = createStructuredSelector({
2020
user: makeLoggedInUserSelector(),
2121
});
2222

23-
const Profile = () => {
23+
function Profile() {
2424
const { user } = useSelector(stateSelector);
2525
const navigate = useNavigate();
2626
return (
@@ -36,9 +36,7 @@ const Profile = () => {
3636
<PageHeaderWrapper
3737
title={messages.pageHeader}
3838
avatar={
39-
user.avatar
40-
? { src: `${BASE_URL}/assets/profile/${user.avatar}` }
41-
: null
39+
user.avatar ? { src: `${BASE_URL}/profile/${user.avatar}` } : null
4240
}
4341
extra={[
4442
<Button key="3" onClick={() => navigate('/account-setting')}>
@@ -65,6 +63,6 @@ const Profile = () => {
6563
</div>
6664
</>
6765
);
68-
};
66+
}
6967

7068
export default Profile;

app/containers/PublicRoute/index.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,19 @@
66

77
import React, { useEffect } from 'react';
88
import { useSelector } from 'react-redux';
9-
import { Route, useNavigate } from 'react-router-dom';
9+
import { useNavigate } from 'react-router-dom';
1010
import { createStructuredSelector } from 'reselect';
1111
import { makeIsLoggedSelector } from 'containers/App/selectors';
1212
import LoadingIndicator from 'components/LoadingIndicator';
1313
import Common from 'utils/common';
1414
import { SUCCESS_REDIRECT } from 'containers/LoginPage/constants';
15+
import PropTypes from 'prop-types';
1516

1617
const stateSelector = createStructuredSelector({
1718
isLogged: makeIsLoggedSelector(),
1819
});
1920

20-
const PublicRoute = ({ ...props }) => {
21+
function PublicRoute({ children }) {
2122
const navigate = useNavigate();
2223
const { isLogged } = useSelector(stateSelector);
2324

@@ -31,11 +32,11 @@ const PublicRoute = ({ ...props }) => {
3132
if (isLogged === null) {
3233
return <LoadingIndicator />;
3334
}
34-
return (
35-
<>
36-
<Route {...props} />
37-
</>
38-
);
35+
return children;
36+
}
37+
38+
PublicRoute.propTypes = {
39+
children: PropTypes.node,
3940
};
4041

4142
export default PublicRoute;

app/containers/UserAccount/profileForm.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,7 @@ export default function ProfileForm() {
151151
</Title>
152152
<div className="user-image">
153153
{user.avatar ? (
154-
<img
155-
src={`${BASE_URL}/assets/profile/${user.avatar}`}
156-
alt="avatar"
157-
/>
154+
<img src={`${BASE_URL}/profile/${user.avatar}`} alt="avatar" />
158155
) : null}
159156
</div>
160157
<Upload showUploadList={false} {...uploadProps}>

0 commit comments

Comments
 (0)