From 647c3acbbf796cc048785afdf3211b115ccc9cb6 Mon Sep 17 00:00:00 2001 From: karan Date: Mon, 16 Oct 2023 18:02:00 +0530 Subject: [PATCH] refactor: back button Signed-off-by: karan --- src/commonComponents/backbutton/index.tsx | 34 +++++++++++++++++++ .../EcoSystemReceivedInvitations.tsx | 19 ++--------- src/components/Issuance/Connections.tsx | 20 ++--------- src/components/Issuance/CredDefSelection.tsx | 20 ++--------- src/components/Issuance/Issuance.tsx | 21 ++---------- .../Resources/Schema/ViewSchema.tsx | 22 ++---------- src/components/Verification/Connections.tsx | 16 ++------- .../Verification/CredDefSelection.tsx | 17 ++-------- src/components/Verification/Verification.tsx | 16 ++------- 9 files changed, 52 insertions(+), 133 deletions(-) create mode 100644 src/commonComponents/backbutton/index.tsx diff --git a/src/commonComponents/backbutton/index.tsx b/src/commonComponents/backbutton/index.tsx new file mode 100644 index 000000000..9620bc229 --- /dev/null +++ b/src/commonComponents/backbutton/index.tsx @@ -0,0 +1,34 @@ +import { Button } from 'flowbite-react'; + +const index = ({ path }: { path: string }) => { + return ( +
+ +
+ ); +}; + +export default index; diff --git a/src/components/EcosystemInvite/EcoSystemReceivedInvitations.tsx b/src/components/EcosystemInvite/EcoSystemReceivedInvitations.tsx index 0369dcec3..6a4d54ab5 100644 --- a/src/components/EcosystemInvite/EcoSystemReceivedInvitations.tsx +++ b/src/components/EcosystemInvite/EcoSystemReceivedInvitations.tsx @@ -17,6 +17,7 @@ import { getFromLocalStorage } from '../../api/Auth'; import { getOrganizations } from '../../api/organization'; import EcoInvitationList from './EcoInvitationList'; import { getOrgDetails } from '../../config/ecosystem'; +import BackButton from '../../commonComponents/backbutton' const initialPageState = { pageNumber: 1, @@ -207,23 +208,7 @@ const ReceivedInvitations = () => {
- +

Received Ecosystem Invitations diff --git a/src/components/Issuance/Connections.tsx b/src/components/Issuance/Connections.tsx index 7268b5ed0..d7c3e316c 100644 --- a/src/components/Issuance/Connections.tsx +++ b/src/components/Issuance/Connections.tsx @@ -10,6 +10,8 @@ import { pathRoutes } from "../../config/pathRoutes"; import BreadCrumbs from "../BreadCrumbs"; import ConnectionList from "./ConnectionList"; import EmailList from "./EmailList"; +import BackButton from '../../commonComponents/backbutton' + const Connections = () => { const [selectedConnectionList, setSelectedConnectionList] = useState([]) @@ -36,23 +38,7 @@ const Connections = () => {
- +
diff --git a/src/components/Issuance/CredDefSelection.tsx b/src/components/Issuance/CredDefSelection.tsx index 240d23fc2..1e835f1a9 100644 --- a/src/components/Issuance/CredDefSelection.tsx +++ b/src/components/Issuance/CredDefSelection.tsx @@ -17,6 +17,8 @@ import { dateConversion } from "../../utils/DateConversion"; import { getCredentialDefinitions } from "../../api/issuance"; import { pathRoutes } from "../../config/pathRoutes"; import DateTooltip from "../Tooltip"; +import BackButton from '../../commonComponents/backbutton' + const CredDefSelection = () => { const [schemaState, setSchemaState] = useState({ schemaName: '', version: '' }) @@ -64,7 +66,6 @@ const CredDefSelection = () => { { columnName: ' ' } ] - //Fetch credential definitions against schemaId const getCredDefs = async (schemaId: string) => { setLoading(true) const response = await getCredentialDefinitions(schemaId); @@ -109,20 +110,7 @@ const CredDefSelection = () => {
- +

@@ -145,7 +133,6 @@ const CredDefSelection = () => {

Credential definitions

- {/*
*/} - {/*
*/}
{
- +

Issuance diff --git a/src/components/Resources/Schema/ViewSchema.tsx b/src/components/Resources/Schema/ViewSchema.tsx index 13ec579ae..faf0f9d63 100644 --- a/src/components/Resources/Schema/ViewSchema.tsx +++ b/src/components/Resources/Schema/ViewSchema.tsx @@ -6,7 +6,7 @@ import { apiStatusCodes, storageKeys } from '../../../config/CommonConstant'; import { createCredentialDefinition, getCredDeffById, getSchemaById } from '../../../api/Schema'; import { getFromLocalStorage, setToLocalStorage } from '../../../api/Auth'; import { useEffect, useState } from 'react'; - +import BackButton from '../../../commonComponents/backbutton' import type { AxiosResponse } from 'axios'; import BreadCrumbs from '../../BreadCrumbs'; import CredDeffCard from '../../../commonComponents/CredentialDefinitionCard'; @@ -206,26 +206,8 @@ const ViewSchemas = () => {

Schemas

- +
-

{ const [selectedConnectionList, setSelectedConnectionList] = useState([]) @@ -35,20 +36,7 @@ const Connections = () => {
- +
diff --git a/src/components/Verification/CredDefSelection.tsx b/src/components/Verification/CredDefSelection.tsx index b2d1c4cb5..c70005aff 100644 --- a/src/components/Verification/CredDefSelection.tsx +++ b/src/components/Verification/CredDefSelection.tsx @@ -14,6 +14,7 @@ import type { TableData } from "../../commonComponents/datatable/interface"; import DataTable from "../../commonComponents/datatable"; import { getCredentialDefinitionsForVerification } from "../../api/verification"; import CustomSpinner from "../CustomSpinner"; +import BackButton from '../../commonComponents/backbutton' const CredDefSelection = () => { const [schemaState, setSchemaState] = useState({ schemaName: '', version: '' }) @@ -63,7 +64,6 @@ const CredDefSelection = () => { { columnName: 'check' } ] - //Fetch credential definitions against schemaId const getCredDefs = async (schemaId: string) => { setLoading(true) const response = await getCredentialDefinitionsForVerification(schemaId,31); @@ -125,20 +125,7 @@ const CredDefSelection = () => {
- +

Schema diff --git a/src/components/Verification/Verification.tsx b/src/components/Verification/Verification.tsx index 3cf1cb4d6..9a0f0981c 100644 --- a/src/components/Verification/Verification.tsx +++ b/src/components/Verification/Verification.tsx @@ -11,6 +11,7 @@ import type { TableData } from "../../commonComponents/datatable/interface"; import { verifyCredential } from "../../api/verification"; import { pathRoutes } from "../../config/pathRoutes"; import CustomSpinner from "../CustomSpinner"; +import BackButton from '../../commonComponents/backbutton' interface SchemaDetails { schemaName: string, @@ -198,20 +199,7 @@ const VerificationCred = () => {
- +

Verification