Skip to content

Commit ae145c0

Browse files
fix: organization dashboard issue (#1030)
* fix: organization breadcrumb issue Signed-off-by: pranalidhanavade <pranali.dhanavade@ayanworks.com> * dedicated agent ledger icons Signed-off-by: pranalidhanavade <pranali.dhanavade@ayanworks.com> * resolve: sonarlint issues Signed-off-by: pranalidhanavade <pranali.dhanavade@ayanworks.com> * resolve: sonarcloud issues Signed-off-by: pranalidhanavade <pranali.dhanavade@ayanworks.com> * refactor: common validation function for ledger config validations Signed-off-by: pranalidhanavade <pranali.dhanavade@ayanworks.com> * fix: passkey in profile section Signed-off-by: pranalidhanavade <pranali.dhanavade@ayanworks.com> * fix: ellipse comments Signed-off-by: pranalidhanavade <pranali.dhanavade@ayanworks.com> --------- Signed-off-by: pranalidhanavade <pranali.dhanavade@ayanworks.com>
1 parent 2ffd442 commit ae145c0

File tree

15 files changed

+146
-134
lines changed

15 files changed

+146
-134
lines changed
File renamed without changes.

nextjs/src/features/auth/components/user-auth-form.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,7 @@
22

33
import * as z from 'zod'
44

5-
import {
6-
Eye,
7-
EyeOff,
8-
KeyRound,
9-
Loader2,
10-
LockKeyhole,
11-
Mail,
12-
} from 'lucide-react'
5+
import { Eye, EyeOff, KeyRound, Loader2, LockKeyhole, Mail } from 'lucide-react'
136
import {
147
Form,
158
FormControl,

nextjs/src/features/dashboard/components/OrganizationCardList.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,7 @@ const OrganizationCardList = (): React.JSX.Element => {
146146
>
147147
<button
148148
className="flex min-w-0 items-center gap-3 hover:cursor-pointer"
149-
onClick={() =>
150-
route.push(`/organizations/dashboard/${org.id}`)
151-
}
149+
onClick={() => route.push(`/organizations/${org.id}`)}
152150
>
153151
<div className="flex-shrink-0">
154152
{org.logoUrl ? (
@@ -254,9 +252,7 @@ const OrganizationCardList = (): React.JSX.Element => {
254252
}
255253
hasWallet
256254
? route.push('/organizations/schemas/create')
257-
: route.push(
258-
`/organizations/dashboard/${org.id}`,
259-
)
255+
: route.push(`/organizations/${org.id}`)
260256
}}
261257
disabled={!isAdmin}
262258
className="rounded-md p-1"
@@ -282,7 +278,7 @@ const OrganizationCardList = (): React.JSX.Element => {
282278
if (hasWallet) {
283279
route.push('/organizations/schemas')
284280
} else {
285-
route.push(`/organizations/dashboard/${org.id}`)
281+
route.push(`/organizations/${org.id}`)
286282
}
287283
}}
288284
className="rounded-md p-1"
@@ -305,7 +301,7 @@ const OrganizationCardList = (): React.JSX.Element => {
305301
if (hasWallet) {
306302
route.push('/organizations/credentials')
307303
} else {
308-
route.push(`/organizations/dashboard/${org.id}`)
304+
route.push(`/organizations/${org.id}`)
309305
}
310306
}}
311307
>
@@ -326,7 +322,7 @@ const OrganizationCardList = (): React.JSX.Element => {
326322
if (hasWallet) {
327323
route.push('/organizations/verification')
328324
} else {
329-
route.push(`/organizations/dashboard/${org.id}`)
325+
route.push(`/organizations/${org.id}`)
330326
}
331327
}}
332328
>

nextjs/src/features/organization/components/DeleteOrganizationCard.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import {
88

99
import { Badge } from '@/components/ui/badge'
1010
import { Button } from '@/components/ui/button'
11+
import { DeleteIcon } from '@/config/svgs/DeleteIcon'
1112
import React from 'react'
12-
// components/organization/delete-organization-card.tsx
13-
import { Trash2 } from 'lucide-react'
1413

14+
// components/organization/delete-organization-card.tsx
1515
interface DeleteOrganizationCardProps {
1616
title?: string
1717
description?: string
@@ -47,9 +47,13 @@ export function DeleteOrganizationCard({
4747
size="icon"
4848
onClick={onDeleteClick}
4949
disabled={isButtonDisabled}
50-
className={isButtonDisabled ? 'cursor-not-allowed opacity-50' : ''}
50+
className={
51+
isButtonDisabled
52+
? 'cursor-not-allowed bg-transparent opacity-50 hover:bg-transparent'
53+
: 'bg-transparent hover:bg-transparent'
54+
}
5155
>
52-
<Trash2 className="h-5 w-5" />
56+
<DeleteIcon />
5357
</Button>
5458
</div>
5559
</CardHeader>

nextjs/src/features/organization/components/OrganizationList.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export const OrganizationList = (): React.JSX.Element => {
111111
)
112112
}
113113

114-
router.push(`/organizations/dashboard/${orgId}`)
114+
router.push(`/organizations/${orgId}`)
115115
}
116116
const handleCreateOrg = (): void => {
117117
router.push('organizations/create-organization')
@@ -145,7 +145,7 @@ export const OrganizationList = (): React.JSX.Element => {
145145

146146
<div className="mx-8 grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3">
147147
{loading ? (
148-
<div className="mb-4 col-span-full grid place-items-center min-h-[50vh] w-full">
148+
<div className="col-span-full mb-4 grid min-h-[50vh] w-full place-items-center">
149149
<Loader />
150150
</div>
151151
) : organizationsList.length > 0 ? (

nextjs/src/features/passkey/AddPasskey.tsx

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,34 @@ import {
1515
verifyRegistration,
1616
} from '@/app/api/Fido'
1717

18+
import { AlertComponent } from '@/components/AlertComponent'
1819
import { Button } from '@/components/ui/button'
1920
import DeviceDetails from './DeviceDetails'
2021
import { Devices } from '../auth/components/UserInfoForm'
2122
import PasskeyAddDevice from './PassKeyAddDevice'
2223
import PasskeyAlert from './PasskeyAlert'
23-
import { RootState } from '@/lib/store'
2424
import { apiStatusCodes } from '@/config/CommonConstant'
2525
import { startRegistration } from '@simplewebauthn/browser'
26-
import { useSelector } from 'react-redux'
2726

2827
interface RegistrationOptionInterface {
2928
userName: string | null
3029
deviceFlag: boolean
3130
}
3231

32+
interface AddPasskeyProps {
33+
email?: string
34+
}
35+
3336
interface AlertResponseType {
3437
type: 'success' | 'error'
3538
message: string
3639
}
3740

38-
const AddPasskey = (): React.JSX.Element => {
41+
const AddPasskey = ({
42+
email: userEmail,
43+
}: AddPasskeyProps = {}): React.JSX.Element => {
3944
const [error, setError] = useState('')
40-
const [loader, setLoader] = useState(true)
45+
const [loader, setLoader] = useState(false)
4146
const [OrgUserEmail, setOrgUserEmail] = useState<string>('')
4247
const [deviceList, setDeviceListData] = useState<IDeviceData[]>([])
4348
const [addSuccess, setAddSuccess] = useState<string | null>(null)
@@ -49,8 +54,6 @@ const AddPasskey = (): React.JSX.Element => {
4954
const [openModel, setOpenModel] = useState<boolean>(false)
5055
const [, setErrMsg] = useState<string | null>(null)
5156

52-
const userEmail = useSelector((state: RootState) => state.profile.email)
53-
5457
const showFidoError = (error: unknown): void => {
5558
const err = error as AxiosError
5659
if (
@@ -240,6 +243,32 @@ const AddPasskey = (): React.JSX.Element => {
240243
<div className="h-full">
241244
{(addSuccess || addFailure || error) && (
242245
<div className="p-2">
246+
{addSuccess && (
247+
<div className="w-full" role="alert">
248+
<AlertComponent
249+
message={addSuccess}
250+
type={'success'}
251+
onAlertClose={() => {
252+
if (addSuccess) {
253+
setAddSuccess(null)
254+
}
255+
}}
256+
/>
257+
</div>
258+
)}
259+
{addFailure && (
260+
<div className="w-full" role="alert">
261+
<AlertComponent
262+
message={addFailure}
263+
type={'failure'}
264+
onAlertClose={() => {
265+
if (addFailure) {
266+
setAddFailure(null)
267+
}
268+
}}
269+
/>
270+
</div>
271+
)}
243272
<Alert variant={addSuccess ? 'default' : 'destructive'}>
244273
<AlertDescription>
245274
{addSuccess || addFailure || error}

nextjs/src/features/passkey/DeleteModal.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import {
99
DialogHeader,
1010
DialogTitle,
1111
} from '@/components/ui/dialog'
12-
import { Trash2, X } from 'lucide-react'
1312

1413
import { Button } from '@/components/ui/button'
14+
import { X } from 'lucide-react'
1515

1616
interface DeleteModalProps {
1717
openModal: boolean
@@ -55,10 +55,6 @@ const DeleteModal = ({
5555
</div>
5656
</DialogHeader>
5757

58-
<div className="flex justify-center">
59-
<Trash2 className="h-12 w-12 text-gray-400 dark:text-gray-500" />
60-
</div>
61-
6258
<DialogFooter className="mt-4 flex justify-center gap-4">
6359
<Button variant="outline" onClick={() => closeModal(false)}>
6460
No, cancel

nextjs/src/features/passkey/EditModal.tsx

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
import { Field, Form, Formik } from 'formik'
1212

1313
import { Button } from '@/components/ui/button'
14+
import { CheckCircle } from 'lucide-react'
1415
import { Input } from '@/components/ui/input'
1516
import { Label } from '@/components/ui/label'
1617
import { useRef } from 'react'
@@ -85,23 +86,7 @@ const EditModal = (props: {
8586
No, cancel
8687
</Button>
8788
<Button type="submit">
88-
<svg
89-
xmlns="http://www.w3.org/2000/svg"
90-
width="20"
91-
height="20"
92-
fill="none"
93-
viewBox="0 0 25 25"
94-
className="mr-2"
95-
>
96-
<path
97-
fill="#fff"
98-
d="M22.758 5.366a.833.833 0 0 0-1.366.95 10.826 10.826 0 0 1-5.647 16.518 10.838 10.838 0 0 1-12.909-5.438 10.825 10.825 0 0 1-1.17-4.89 10.893 10.893 0 0 1 7.742-10.38.835.835 0 1 0-.475-1.6 12.5 12.5 0 0 0-8.74 9.792 12.49 12.49 0 0 0 4.834 12.2A12.502 12.502 0 0 0 25 12.505a12.417 12.417 0 0 0-2.242-7.139Z"
99-
/>
100-
<path
101-
fill="#fff"
102-
d="M15.59 2.13a10.786 10.786 0 0 1 3.575 1.875.834.834 0 0 0 1.033-1.308A12.419 12.419 0 0 0 16.032.531a.835.835 0 0 0-.476 1.6h.034Zm-3.684-.69a.958.958 0 0 0 .275.174.784.784 0 0 0 .634 0 .966.966 0 0 0 .275-.175.83.83 0 0 0 .242-.591.875.875 0 0 0-.242-.592.833.833 0 0 0-.758-.241.542.542 0 0 0-.15.05.617.617 0 0 0-.15.075l-.126.1a.833.833 0 0 0-.175.275.833.833 0 0 0 0 .65c.043.1.102.193.175.274Zm-6.75 9.92a.95.95 0 0 0 0 1.35l4.767 4.798a.95.95 0 0 0 1.35 0l8.567-8.605a.969.969 0 1 0-1.35-1.391l-7.9 7.897-4.083-4.049a.959.959 0 0 0-1.35 0Z"
103-
/>
104-
</svg>
89+
<CheckCircle className="h-16 w-16" />
10590
Submit
10691
</Button>
10792
</div>

nextjs/src/features/profile/components/EditUserProfile.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ export default function EditUserProfile({
223223
value={formik.values.firstName}
224224
onChange={formik.handleChange}
225225
onBlur={formik.handleBlur}
226-
className="w-full rounded-md p-2"
226+
className="w-3xl rounded-md p-2"
227227
/>
228228
{formik.errors.firstName && formik.touched.firstName && (
229229
<div className="mt-1 text-sm">
@@ -243,7 +243,7 @@ export default function EditUserProfile({
243243
value={formik.values.lastName}
244244
onChange={formik.handleChange}
245245
onBlur={formik.handleBlur}
246-
className="w-full rounded-md p-2"
246+
className="w-3xl rounded-md p-2"
247247
/>
248248
{formik.errors.lastName && formik.touched.lastName && (
249249
<div className="mt-1 text-sm">
@@ -270,4 +270,4 @@ export default function EditUserProfile({
270270
</div>
271271
</Card>
272272
)
273-
}
273+
}

nextjs/src/features/profile/components/UserProfile.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export default function UserProfile(): React.JSX.Element {
1515
const token = useAppSelector((state) => state.auth.token)
1616

1717
const [isEditProfileOpen, setIsEditProfileOpen] = useState(false)
18+
const [userEmail, setUserEmail] = useState('')
1819
const [prePopulatedUserProfile, setPrePopulatedUserProfile] =
1920
useState<IUserProfile | null>(null)
2021
const [activeTab, setActiveTab] = useState<'profile' | 'passkey'>('profile')
@@ -31,6 +32,7 @@ export default function UserProfile(): React.JSX.Element {
3132
response?.data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS
3233
) {
3334
setPrePopulatedUserProfile(response.data.data)
35+
setUserEmail(response.data.data.email)
3436
}
3537
} catch (error) {
3638
// eslint-disable-next-line no-console
@@ -91,7 +93,7 @@ export default function UserProfile(): React.JSX.Element {
9193
)}
9294
</>
9395
) : (
94-
<AddPasskey />
96+
<AddPasskey email={userEmail} />
9597
)}
9698
</div>
9799
</div>

0 commit comments

Comments
 (0)