-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
64 changed files
with
3,642 additions
and
733 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
import { setToLocalStorage } from '../api/Auth'; | ||
import { storageKeys } from '../config/CommonConstant'; | ||
import type { ICustomCheckboxProps, ISchemaData } from './interface'; | ||
|
||
const CustomCheckbox: React.FC<ICustomCheckboxProps> = ({ showCheckbox, isVerificationUsingEmail, onChange, schemaData }) => { | ||
const [checked, setChecked] = useState<boolean>(false); | ||
|
||
useEffect(() => { | ||
if (schemaData) { | ||
try { | ||
const selectedSchemas = JSON.parse(localStorage.getItem('selectedSchemas') ?? '[]'); | ||
const isChecked = selectedSchemas.some((schema: ISchemaData) => schema.schemaId === schemaData.schemaId); | ||
setChecked(isChecked); | ||
} catch (error) { | ||
console.error('Error parsing JSON from localStorage:', error); | ||
} | ||
} | ||
}, [schemaData]); | ||
|
||
const handleCheckboxChange = async () => { | ||
const newChecked = !checked; | ||
setChecked(newChecked); | ||
onChange(newChecked, schemaData); | ||
|
||
try { | ||
const selectedSchemas = JSON.parse(localStorage.getItem('selectedSchemas') ?? '[]'); | ||
|
||
if (newChecked) { | ||
selectedSchemas.push(schemaData); | ||
} else { | ||
const index = selectedSchemas.findIndex((schema: ISchemaData) => schema.schemaId === schemaData?.schemaId); | ||
if (index > -1) { | ||
selectedSchemas.splice(index, 1); | ||
} | ||
} | ||
await setToLocalStorage(storageKeys.SELECTED_SCHEMAS, JSON.stringify(selectedSchemas)); | ||
} catch (error) { | ||
console.error('Error updating localStorage:', error); | ||
} | ||
}; | ||
|
||
return ( | ||
<> | ||
{showCheckbox && ( | ||
<button | ||
className={`w-4 h-4 ${isVerificationUsingEmail ? 'flex items-center' : 'absolute bottom-8 right-4'}`} | ||
onClick={handleCheckboxChange} | ||
aria-label="Checkbox" | ||
> <input | ||
type="checkbox" | ||
checked={checked} | ||
onChange={handleCheckboxChange} | ||
className="hidden" | ||
/> | ||
<div | ||
className={`w-full h-full border-2 ${checked ? 'bg-primary-700' : ''}`} | ||
style={{ borderColor: 'rgb(31 78 173 / var(--tw-bg-opacity))', position: 'relative' }} | ||
> | ||
{checked && ( | ||
<svg | ||
className="absolute top-0 left-0 w-full h-full text-white" | ||
viewBox="0 0 24 24" | ||
fill="none" | ||
stroke="currentColor" | ||
strokeWidth="5" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
> | ||
<polyline points="20 6 9 17 4 12" /> | ||
</svg> | ||
)} | ||
</div> | ||
</button> | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
export default CustomCheckbox; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import React from 'react'; | ||
import { Card } from 'flowbite-react'; | ||
import BackButton from '../commonComponents/backbutton'; | ||
import BreadCrumbs from '../components/BreadCrumbs' | ||
|
||
const Dashboard = ({ title, options, backButtonPath }) => { | ||
return ( | ||
<div className="px-4 pt-2 h-full h-[700px]"> | ||
<div className="mt-1"> | ||
<BreadCrumbs /> | ||
</div> | ||
<div className="mb-2 flex justify-between items-center relative"> | ||
<h1 className="text-xl font-semibold text-gray-900 sm:text-2xl dark:text-white"> | ||
{title} | ||
</h1> | ||
<BackButton path={backButtonPath} /> | ||
</div> | ||
<div className="px-6 pt-6 bg-white border border-gray-200 rounded-lg shadow-sm 2xl:col-span-2 dark:border-gray-700 dark:bg-gray-800"> | ||
<p className="text-gray-900 text-xl text-start font-medium dark:text-white"> | ||
Select the appropriate action | ||
</p> | ||
<div className="grid grid-cols-1 lg:grid-cols-3 gap-8 pb-16 pt-12"> | ||
{options.map((option) => ( | ||
<Card | ||
key={option.heading} | ||
className={`${ | ||
option.path | ||
? 'custom-card group transform transition duration-500 ease-in-out overflow-hidden overflow-ellipsis border border-gray-200 shadow-md hover:scale-105 cursor-pointer dark:hover:bg-primary-700 hover:bg-primary-700' | ||
: 'cursor-not-allowed bg-gray-300 text-gray-500 dark:border-gray-600 dark:bg-gray-700' | ||
}`} | ||
style={{ | ||
maxHeight: '100%', | ||
overflow: 'auto', | ||
height: '168px', | ||
color: 'inherit', | ||
}} | ||
onClick={() => option.path && (window.location.href = option.path)} | ||
> | ||
<div | ||
className={`flex items-center min-[401px]:flex-nowrap flex-wrap ${ | ||
option.path ? 'group-hover:text-white' : '' | ||
}`} | ||
style={{ color: 'inherit' }} | ||
> | ||
<div className="ml-4"> | ||
<h5 | ||
className={`text-2xl font-semibold ${ | ||
option.path | ||
? 'text-primary-700 dark:text-white group-hover:text-white' | ||
: 'text-gray-500' | ||
} pb-2`} | ||
> | ||
{option.heading} | ||
</h5> | ||
<p | ||
className={`text-sm ${ | ||
option.path | ||
? 'text-gray-700 dark:text-white group-hover:text-white' | ||
: 'text-gray-500' | ||
}`} | ||
> | ||
{option.description} | ||
</p> | ||
</div> | ||
</div> | ||
</Card> | ||
))} | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Dashboard; |
Oops, something went wrong.