Skip to content

Commit 82a6921

Browse files
authored
Merge pull request #352 from LIT-Protocol/dashboard/minor-ui-improvements
chore(dashboard): user, developer dashboard ui improvements
2 parents 3fc8bde + c028a8a commit 82a6921

28 files changed

+861
-302
lines changed

packages/apps/app-dashboard/src/components/developer-dashboard/DashboardContent.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ export function DashboardContent({
7474
<Button
7575
size="sm"
7676
className="bg-orange-600 hover:bg-orange-700 text-white"
77-
onClick={() =>
78-
window.open('https://docs.heyvincent.ai/documents/Getting_Started.html', '_blank')
79-
}
77+
onClick={() => window.open('https://docs.heyvincent.ai', '_blank')}
8078
>
8179
View Docs
8280
</Button>

packages/apps/app-dashboard/src/components/developer-dashboard/ability/forms/DeleteAbilityForm.tsx

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@ import { useForm } from 'react-hook-form';
33
import { zodResolver } from '@hookform/resolvers/zod';
44
import { Form } from '@/components/shared/ui/form';
55
import { Button } from '@/components/shared/ui/button';
6-
import {
7-
Card,
8-
CardContent,
9-
CardDescription,
10-
CardHeader,
11-
CardTitle,
12-
} from '@/components/shared/ui/card';
6+
import { Card, CardContent } from '@/components/shared/ui/card';
137
import { TextField } from '../../form-fields';
148

159
function buildConfirmationString(title: string): string {
@@ -59,19 +53,13 @@ export function DeleteAbilityForm({
5953

6054
return (
6155
<Card className="w-full max-w-2xl mx-auto dark:bg-neutral-800 dark:border-white/10">
62-
<CardHeader>
63-
<CardTitle className="text-red-600 dark:text-red-400">Delete Ability</CardTitle>
64-
<CardDescription className="text-gray-600 dark:text-white/60">
65-
Please make sure you're absolutely certain you want to delete this ability.
66-
</CardDescription>
67-
</CardHeader>
6856
<CardContent>
6957
<Form {...form}>
7058
<form onSubmit={handleSubmit(onSubmit)} className="space-y-6">
59+
<p className="text-sm text-gray-700 dark:text-gray-300 mb-2">
60+
To confirm deletion, please type the following exactly:
61+
</p>
7162
<div className="bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-500/30 rounded-lg p-4">
72-
<p className="text-sm text-red-800 dark:text-red-200 mb-2">
73-
To confirm deletion, please type the following exactly:
74-
</p>
7563
<code className="bg-red-100 dark:bg-red-800/20 px-2 py-1 rounded text-sm font-mono text-red-900 dark:text-red-200">
7664
{expectedConfirmation}
7765
</code>

packages/apps/app-dashboard/src/components/developer-dashboard/ability/forms/DeleteAbilityVersionForm.tsx

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@ import { useForm } from 'react-hook-form';
33
import { zodResolver } from '@hookform/resolvers/zod';
44
import { Form } from '@/components/shared/ui/form';
55
import { Button } from '@/components/shared/ui/button';
6-
import {
7-
Card,
8-
CardContent,
9-
CardDescription,
10-
CardHeader,
11-
CardTitle,
12-
} from '@/components/shared/ui/card';
6+
import { Card, CardContent } from '@/components/shared/ui/card';
137
import { SelectField, TextField } from '../../form-fields';
148
import { Ability, AbilityVersion } from '@/types/developer-dashboard/appTypes';
159

@@ -94,19 +88,13 @@ export function DeleteAbilityVersionForm({
9488

9589
return (
9690
<Card className="w-full max-w-2xl mx-auto dark:bg-neutral-800 dark:border-white/10">
97-
<CardHeader>
98-
<CardTitle className="text-red-600 dark:text-red-400">Delete Ability Version</CardTitle>
99-
<CardDescription className="text-gray-600 dark:text-white/60">
100-
Please make sure you're absolutely certain you want to delete this ability version.
101-
</CardDescription>
102-
</CardHeader>
10391
<CardContent>
10492
<Form {...form}>
10593
<form onSubmit={handleSubmit(onSubmit)} className="space-y-6">
94+
<p className="text-sm text-gray-700 dark:text-gray-300 mb-2">
95+
To confirm deletion, please type the following exactly:
96+
</p>
10697
<div className="bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-500/30 rounded-lg p-4">
107-
<p className="text-sm text-red-800 dark:text-red-200 mb-2">
108-
To confirm deletion, please type the following exactly:
109-
</p>
11098
<code className="bg-red-100 dark:bg-red-800/20 px-2 py-1 rounded text-sm font-mono text-red-900 dark:text-red-200">
11199
{expectedConfirmation}
112100
</code>

packages/apps/app-dashboard/src/components/developer-dashboard/ability/wrappers/DeleteAbilityWrapper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export function DeleteAbilityWrapper() {
6161
<div className="flex-1">
6262
<h1 className="text-3xl font-bold text-neutral-800 dark:text-white">Delete Ability</h1>
6363
<p className="text-gray-600 dark:text-white/60 mt-2">
64-
Delete "{ability.title}" and all its data.
64+
Delete "{ability.title}"?
6565
</p>
6666
</div>
6767
</div>

packages/apps/app-dashboard/src/components/developer-dashboard/app/forms/DeleteAppForm.tsx

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@ import { useForm } from 'react-hook-form';
33
import { zodResolver } from '@hookform/resolvers/zod';
44
import { Form } from '@/components/shared/ui/form';
55
import { Button } from '@/components/shared/ui/button';
6-
import {
7-
Card,
8-
CardContent,
9-
CardDescription,
10-
CardHeader,
11-
CardTitle,
12-
} from '@/components/shared/ui/card';
6+
import { Card, CardContent } from '@/components/shared/ui/card';
137
import { TextField } from '../../form-fields';
148

159
function buildConfirmationString(appName: string): string {
@@ -55,19 +49,13 @@ export function DeleteAppForm({ appName, onSubmit, isSubmitting = false }: Delet
5549

5650
return (
5751
<Card className="w-full max-w-2xl mx-auto dark:bg-neutral-800 dark:border-white/10">
58-
<CardHeader>
59-
<CardTitle className="text-red-600 dark:text-red-400">Delete App</CardTitle>
60-
<CardDescription>
61-
Please make sure you're absolutely certain you want to delete this app.
62-
</CardDescription>
63-
</CardHeader>
6452
<CardContent>
6553
<Form {...form}>
6654
<form onSubmit={handleSubmit(onSubmit)} className="space-y-6">
55+
<p className="text-sm text-gray-700 dark:text-gray-300 mb-2">
56+
To confirm deletion, please type the following exactly:
57+
</p>
6758
<div className="bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-500/30 rounded-lg p-4">
68-
<p className="text-sm text-red-800 dark:text-red-200 mb-2">
69-
To confirm deletion, please type the following exactly:
70-
</p>
7159
<code className="bg-red-100 dark:bg-red-900/30 px-2 py-1 rounded text-sm font-mono text-red-900 dark:text-red-200">
7260
{expectedConfirmation}
7361
</code>

packages/apps/app-dashboard/src/components/developer-dashboard/app/forms/DeleteAppVersionForm.tsx

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@ import { useForm } from 'react-hook-form';
33
import { zodResolver } from '@hookform/resolvers/zod';
44
import { Form } from '@/components/shared/ui/form';
55
import { Button } from '@/components/shared/ui/button';
6-
import {
7-
Card,
8-
CardContent,
9-
CardDescription,
10-
CardHeader,
11-
CardTitle,
12-
} from '@/components/shared/ui/card';
6+
import { Card, CardContent } from '@/components/shared/ui/card';
137
import { NumberSelectField, TextField } from '../../form-fields';
148
import { App, AppVersion } from '@/types/developer-dashboard/appTypes';
159

@@ -90,19 +84,13 @@ export function DeleteAppVersionForm({
9084

9185
return (
9286
<Card className="w-full max-w-2xl mx-auto dark:bg-neutral-800 dark:border-white/10">
93-
<CardHeader>
94-
<CardTitle className="text-red-600 dark:text-red-400">Delete App Version</CardTitle>
95-
<CardDescription>
96-
Please make sure you're absolutely certain you want to delete this app version.
97-
</CardDescription>
98-
</CardHeader>
9987
<CardContent>
10088
<Form {...form}>
10189
<form onSubmit={handleSubmit(onSubmit)} className="space-y-6">
90+
<p className="text-sm text-gray-700 dark:text-gray-300 mb-2">
91+
To confirm deletion, please type the following exactly:
92+
</p>
10293
<div className="bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-500/30 rounded-lg p-4">
103-
<p className="text-sm text-red-800 dark:text-red-200 mb-2">
104-
To confirm deletion, please type the following exactly:
105-
</p>
10694
<code className="bg-red-100 dark:bg-red-900/30 px-2 py-1 rounded text-sm font-mono text-red-900 dark:text-red-200">
10795
{expectedConfirmation}
10896
</code>

packages/apps/app-dashboard/src/components/developer-dashboard/app/wrappers/DeleteAppWrapper.tsx

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,31 @@
1-
import { useEffect } from 'react';
1+
import { useEffect, useState } from 'react';
22
import { useNavigate, useParams } from 'react-router-dom';
3+
import { reactClient as vincentApiClient } from '@lit-protocol/vincent-registry-sdk';
4+
import { getClient } from '@lit-protocol/vincent-contracts-sdk';
35
import { DeleteAppForm } from '../forms/DeleteAppForm';
46
import { StatusMessage } from '@/components/shared/ui/statusMessage';
57
import { getErrorMessage } from '@/utils/developer-dashboard/app-forms';
68
import Loading from '@/components/shared/ui/Loading';
7-
import { reactClient as vincentApiClient } from '@lit-protocol/vincent-registry-sdk';
9+
import { initPkpSigner } from '@/utils/developer-dashboard/initPkpSigner';
10+
import useReadAuthInfo from '@/hooks/user-dashboard/useAuthInfo';
11+
import { useBlockchainAppData } from '@/hooks/useBlockchainAppData';
812

913
export function DeleteAppWrapper() {
1014
const { appId } = useParams<{ appId: string }>();
15+
const { authInfo, sessionSigs } = useReadAuthInfo();
16+
const [isProcessing, setIsProcessing] = useState(false);
1117

12-
// Fetching
18+
// Fetching app data
1319
const {
1420
data: app,
1521
isLoading: appLoading,
1622
isError: appError,
1723
} = vincentApiClient.useGetAppQuery({ appId: Number(appId) });
1824

25+
// Fetching blockchain data to determine if app is published
26+
const { blockchainAppData, blockchainAppLoading } = useBlockchainAppData(Number(appId));
27+
const isPublished = blockchainAppData !== null;
28+
1929
// Mutation
2030
const [deleteApp, { isLoading, isSuccess, isError, data, error }] =
2131
vincentApiClient.useDeleteAppMutation();
@@ -31,7 +41,7 @@ export function DeleteAppWrapper() {
3141
}, [isSuccess, data, navigate]);
3242

3343
// Loading states
34-
if (appLoading) return <Loading />;
44+
if (appLoading || blockchainAppLoading) return <Loading />;
3545

3646
// Error states
3747
if (appError) return <StatusMessage message="Failed to load app" type="error" />;
@@ -52,22 +62,39 @@ export function DeleteAppWrapper() {
5262
}
5363

5464
const handleSubmit = async () => {
55-
await deleteApp({ appId: app.appId });
65+
setIsProcessing(true);
66+
try {
67+
// Step 1: Always delete in registry
68+
await deleteApp({ appId: app.appId });
69+
70+
// Step 2: If published, also delete on-chain
71+
if (isPublished) {
72+
const pkpSigner = await initPkpSigner({ authInfo, sessionSigs });
73+
const client = getClient({ signer: pkpSigner });
74+
await client.deleteApp({
75+
appId: Number(app.appId),
76+
});
77+
}
78+
} finally {
79+
setIsProcessing(false);
80+
}
5681
};
5782
return (
5883
<div className="space-y-6">
5984
<div className="w-full max-w-2xl mx-auto">
6085
<div className="flex items-start justify-between">
6186
<div className="flex-1">
6287
<h1 className="text-3xl font-bold text-neutral-800 dark:text-white">Delete App</h1>
63-
<p className="text-gray-600 dark:text-white/60 mt-2">
64-
Delete "{app.name}" and all its data.
65-
</p>
88+
<p className="text-gray-600 dark:text-white/60 mt-2">Delete "{app.name}"?</p>
6689
</div>
6790
</div>
6891
</div>
6992

70-
<DeleteAppForm appName={app.name} onSubmit={handleSubmit} isSubmitting={isLoading} />
93+
<DeleteAppForm
94+
appName={app.name}
95+
onSubmit={handleSubmit}
96+
isSubmitting={isLoading || isProcessing}
97+
/>
7198
</div>
7299
);
73100
}

0 commit comments

Comments
 (0)