Skip to content

Commit 76f2546

Browse files
committed
Enhance Datasets and UseCases components with no-data states and improved UI elements
1 parent 57b4f78 commit 76f2546

File tree

3 files changed

+39
-7
lines changed

3 files changed

+39
-7
lines changed

app/[locale]/(user)/publishers/components/Datasets.tsx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useParams } from 'next/navigation';
22
import { graphql } from '@/gql';
33
import { useQuery } from '@tanstack/react-query';
4-
import { Card, Spinner } from 'opub-ui';
4+
import { Card, Icon, Spinner, Text } from 'opub-ui';
55

66
import { GraphQL } from '@/lib/api';
77
import { cn } from '@/lib/utils';
@@ -140,8 +140,7 @@ const Datasets = ({ type }: { type: 'organization' | 'Publisher' }) => {
140140
<div className=" flex w-fit justify-center rounded-2 bg-surfaceDefault p-4">
141141
<Spinner />
142142
</div>
143-
) : (
144-
DatasetData?.length > 0 &&
143+
) : DatasetData?.length > 0 ? (
145144
DatasetData?.map((item: any, index: any) => (
146145
<Card
147146
type={[
@@ -194,6 +193,23 @@ const Datasets = ({ type }: { type: 'organization' | 'Publisher' }) => {
194193
href={`/datasets/${item.id}`}
195194
/>
196195
))
196+
) : (
197+
<>
198+
<div className="flex h-full w-full grow flex-col items-center justify-center rounded-2 bg-white p-10">
199+
<div className={'h-100 flex flex-col items-center gap-4'}>
200+
<Icon
201+
source={Icons.addDataset}
202+
color="interactive"
203+
stroke={1}
204+
size={80}
205+
/>
206+
207+
<Text variant="headingSm" color="subdued">
208+
No datasets published yet
209+
</Text>
210+
</div>
211+
</div>
212+
</>
197213
)}
198214
</div>
199215
</div>

app/[locale]/(user)/publishers/components/UseCases.tsx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import { useParams } from 'next/navigation';
33
import { graphql } from '@/gql';
44
import { useQuery } from '@tanstack/react-query';
5-
import { Card, Spinner } from 'opub-ui';
5+
import { Card, Icon, Spinner, Text } from 'opub-ui';
66

77
import { GraphQL } from '@/lib/api';
88
import { cn, formatDate } from '@/lib/utils';
@@ -124,8 +124,7 @@ const UseCases = ({ type }: { type: 'organization' | 'Publisher' }) => {
124124
<div className=" flex w-fit justify-center rounded-2 bg-surfaceDefault p-4">
125125
<Spinner />
126126
</div>
127-
) : (
128-
UseCaseData?.length > 0 &&
127+
) : UseCaseData?.length > 0 ? (
129128
UseCaseData?.map((item: any, index: any) => (
130129
<Card
131130
type={[
@@ -173,6 +172,23 @@ const UseCases = ({ type }: { type: 'organization' | 'Publisher' }) => {
173172
variation={'collapsed'}
174173
/>
175174
))
175+
) : (
176+
<>
177+
<div className="flex h-full w-full grow flex-col items-center justify-center rounded-2 bg-white p-10">
178+
<div className={'h-100 flex flex-col items-center gap-4'}>
179+
<Icon
180+
source={Icons.light}
181+
color="interactive"
182+
stroke={1}
183+
size={80}
184+
/>
185+
186+
<Text variant="headingSm" color="subdued">
187+
No use cases published yet
188+
</Text>
189+
</div>
190+
</div>
191+
</>
176192
)}
177193
</div>
178194
</div>

app/[locale]/dashboard/[entityType]/[entitySlug]/usecases/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ export default function DatasetPage({
283283
className={twMerge('h-100 flex flex-col items-center gap-4')}
284284
>
285285
<Icon
286-
source={Icons.addDataset}
286+
source={Icons.light}
287287
color="interactive"
288288
stroke={1}
289289
size={80}

0 commit comments

Comments
 (0)