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

Added YAUS frontend developed in C4GT"22 #56

Closed

Conversation

Nazi-pikachu
Copy link
Collaborator

@Nazi-pikachu Nazi-pikachu commented May 19, 2023

Description
PR to add the code developed as part of C4GT" 22

Changes
Added the code developed as part of C4GT" 22

To DO

  • Add the frontend code
  • Add the backend code
  • Add the SDK

How to test

  1. Setup the codebase locally
  2. yarn test api

Ref : #52

@gitguardian
Copy link

gitguardian bot commented May 19, 2023

⚠️ GitGuardian has uncovered 5 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id Secret Commit Filename
- Generic High Entropy Secret 0b25c5c yaus_c4gt_frontend/src/pages/SignIn.js View secret
- Generic High Entropy Secret 0b25c5c yaus_c4gt_frontend/src/pages/SignUp.js View secret
- Generic High Entropy Secret 423e24d yaus_c4gt_frontend/src/pages/SignIn.js View secret
- Generic High Entropy Secret 423e24d yaus_c4gt_frontend/src/pages/SignUp.js View secret
- Generic High Entropy Secret d5ccf56 yaus_c4gt_sdk/sdk-generation/index.ts View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Our GitHub checks need improvements? Share your feedbacks!

@Nazi-pikachu
Copy link
Collaborator Author

Nazi-pikachu commented May 19, 2023

Hi @ChakshuGautam
Can you provide some feedback on this draft PR.

@Nazi-pikachu Nazi-pikachu marked this pull request as ready for review May 22, 2023 16:21

const { Title } = Typography;
const { Header, Footer, Content } = Layout;
const template = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create the separate assets/icons files for the svg variables

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved in f619445

async function action() {
let item = {
registration: {
applicationId: "650c50b5-eae9-442e-88de-fc36be10a21b",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make it a .env variable

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved in 0740edb

},
};

let result = await fetch(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can all API calls be shift into the api/index.js and then functions can be imported

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved in 6333059

<div className="header-col header-nav">
<Menu mode="horizontal" defaultSelectedKeys={["1"]}>
<Menu.Item key="1">
<Link to="/dashboard">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shift all the routes to the constants file

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved in 0740edb

Input,
Switch,
} from "antd";
import signinbg from "../assets/images/img-signin.jpg";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make it the relative paths instead of ../assets/images/img-signin.jpg, it should be directly assets/images/img-signin.jpg

}
const { Title } = Typography;
const { Header, Footer, Content } = Layout;
const template = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is reduntant from the SignUp page

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved in b0702c3

Comment on lines 128 to 139
async function login() {
let item = {
loginId: email,
password: password,
applicationId: "650c50b5-eae9-442e-88de-fc36be10a21b",
};

let result = await fetch("https://fa.chakshu-rd.samagra.io/api/login", {
method: "POST",
credentials: "omit",
headers: {
Authorization: `${process.env.REACT_APP_AUTH_TOKEN}`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the above code is reduntatnt please make the single page for this and do the conditional rendering baed on the state variable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved in 6333059

</>
)

const columns = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These columns should serve from either constants or mockdata folder

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved in 20af263

Copy link
Member

@Shruti3004 Shruti3004 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make the suggested changes!

Comment on lines 271 to 278








Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please apply linting and prettier globally

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved in 20af263

@@ -0,0 +1,230 @@
import { Table, Button } from 'antd';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Link_Manager file and Recent_Activities file are redundant.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we remove anyone of these file or we need both of them?

Comment on lines 44 to 66
const dollor = [
<svg
width="22"
height="22"
viewBox="0 0 20 20"
fill="none"
xmlns="http://www.w3.org/2000/svg"
key={0}
>
<path
d="M8.43338 7.41784C8.58818 7.31464 8.77939 7.2224 9 7.15101L9.00001 8.84899C8.77939 8.7776 8.58818 8.68536 8.43338 8.58216C8.06927 8.33942 8 8.1139 8 8C8 7.8861 8.06927 7.66058 8.43338 7.41784Z"
fill="#fff"
></path>
<path
d="M11 12.849L11 11.151C11.2206 11.2224 11.4118 11.3146 11.5666 11.4178C11.9308 11.6606 12 11.8861 12 12C12 12.1139 11.9308 12.3394 11.5666 12.5822C11.4118 12.6854 11.2206 12.7776 11 12.849Z"
fill="#fff"
></path>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M10 18C14.4183 18 18 14.4183 18 10C18 5.58172 14.4183 2 10 2C5.58172 2 2 5.58172 2 10C2 14.4183 5.58172 18 10 18ZM11 5C11 4.44772 10.5523 4 10 4C9.44772 4 9 4.44772 9 5V5.09199C8.3784 5.20873 7.80348 5.43407 7.32398 5.75374C6.6023 6.23485 6 7.00933 6 8C6 8.99067 6.6023 9.76515 7.32398 10.2463C7.80348 10.5659 8.37841 10.7913 9.00001 10.908L9.00002 12.8492C8.60902 12.7223 8.31917 12.5319 8.15667 12.3446C7.79471 11.9275 7.16313 11.8827 6.74599 12.2447C6.32885 12.6067 6.28411 13.2382 6.64607 13.6554C7.20855 14.3036 8.05956 14.7308 9 14.9076L9 15C8.99999 15.5523 9.44769 16 9.99998 16C10.5523 16 11 15.5523 11 15L11 14.908C11.6216 14.7913 12.1965 14.5659 12.676 14.2463C13.3977 13.7651 14 12.9907 14 12C14 11.0093 13.3977 10.2348 12.676 9.75373C12.1965 9.43407 11.6216 9.20873 11 9.09199L11 7.15075C11.391 7.27771 11.6808 7.4681 11.8434 7.65538C12.2053 8.07252 12.8369 8.11726 13.254 7.7553C13.6712 7.39335 13.7159 6.76176 13.354 6.34462C12.7915 5.69637 11.9405 5.26915 11 5.09236V5Z"
fill="#fff"
></path>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove all the constant variables from this file

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved in 20af263

<div className="number">
<Row align="middle" gutter={[24, 0]}>
<Col xs={18}>
<span>{c.today}</span>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add question mark in object properties

c?.today

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved in 20af263

Comment on lines +555 to +560
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either add margin or padding not a ideal way to give a space.

};

const [state, setState] = useState({
userID: '0fe6ff38-fc46-11ec-b939-0242ac120001',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make userID and project the env variable

Comment on lines +114 to +115
console.log(userData);
axios.post(`${baseUrl}/register`, userData, { headers: headers }).then((response) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some places we are using axios and at some places fetch is used, be consistent with the method

});


const columns = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shift it to constant file.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved in 80396e9

const { pathname } = useLocation();
const page = pathname.replace("/", "");

const dashboard = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the svgs from here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved in 80396e9

@MUCCHU
Copy link

MUCCHU commented Jun 1, 2023

Hey @Shruti3004 is there anything that I can help with in this pull request. This PR was mentioned by @ChakshuGautam in Issue 52.

@Nazi-pikachu Nazi-pikachu marked this pull request as draft July 1, 2023 12:15
@Nazi-pikachu
Copy link
Collaborator Author

Marking this a draft since it would be a very big PR to review directly
It would be better to discuss the problems in the frontend here that needs to fixed before merging it in the main codebase.
Will be opening another PR to start the frontend migration work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants