Skip to content

Commit 7bf0630

Browse files
committed
feat: add wallet connection prompt in TaskRawData component
1 parent 839a774 commit 7bf0630

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

src/modules/tasks/task/TaskRawData.tsx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { TABLE_REFETCH_INTERVAL } from '@/config';
22
import { useQuery } from '@tanstack/react-query';
3+
import { Button } from '@/components/ui/button';
34
import { getIExec } from '@/externals/iexecSdkClient';
5+
import { useLoginLogout } from '@/hooks/useLoginLogout';
46
import { ErrorAlert } from '@/modules/ErrorAlert';
57
import JsonBlock from '@/modules/JsonBlock';
68
import useUserStore from '@/stores/useUser.store';
@@ -59,6 +61,8 @@ export function TaskRawData({
5961
hasPastError,
6062
isLoading,
6163
} = useTaskRawData({ taskWorkerpoolId, taskId });
64+
const { address: userAddress } = useUserStore();
65+
const { login } = useLoginLogout();
6266

6367
return hasPastError && (!tasks || !tasks.length) ? (
6468
<ErrorAlert
@@ -67,11 +71,23 @@ export function TaskRawData({
6771
}
6872
/>
6973
) : (
70-
<div className="dark:bg-tooltip min-h-40 rounded-3xl border bg-[#fafaff] p-6">
71-
{isLoading ? (
74+
<div className="dark:bg-tooltip flex max-h-none min-h-60 rounded-3xl border bg-[#fafaff] p-6">
75+
{!userAddress ? (
76+
<div className="flex flex-1 flex-col items-center justify-center gap-6 text-center">
77+
<h1 className="text-2xl font-bold">You are not connected</h1>
78+
<p className="text-muted-foreground max-w-sm">
79+
To access task raw data please connect your wallet.
80+
</p>
81+
<div className="flex gap-4">
82+
<Button onClick={login}>Connect wallet</Button>
83+
</div>
84+
</div>
85+
) : isLoading ? (
7286
<p>Loading...</p>
7387
) : (
74-
<JsonBlock collapsed={5}>{tasks}</JsonBlock>
88+
<JsonBlock className="w-full" collapsed={5}>
89+
{tasks}
90+
</JsonBlock>
7591
)}
7692
</div>
7793
);

0 commit comments

Comments
 (0)