Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions app/[locale]/(user)/components/Datasets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
import { cn } from '@/lib/utils';
import { Icons } from '@/components/icons';
import Styles from './datasets.module.scss';
import { DatasetListingSkeleton } from '@/components/loading';

interface Bucket {
key: string;
Expand Down Expand Up @@ -81,9 +82,10 @@ const Datasets = () => {

<CarouselContent className="p-4">
{isLoading ? (
<div className="p-8">
<Spinner />
</div>
<DatasetListingSkeleton
cardCount={3}
cardsOnly={true}
/>
) : (
facets &&
facets.results.map((item: any) => (
Expand Down
12 changes: 10 additions & 2 deletions app/[locale]/(user)/components/ListingComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ const stripMarkdown = (markdown: string): string => {
.replace(/\s+/g, ' ')
.trim();
};
import {
DatasetListingSkeleton,
UseCaseListingSkeleton,
} from '@/components/loading';

// Interfaces
interface Bucket {
Expand Down Expand Up @@ -284,8 +288,12 @@ const ListingComponent: React.FC<ListingProps> = ({
useEffect(() => {
setHasMounted(true);
}, []);

if (!hasMounted) return <Loading />;
if (!hasMounted) {
if (type === 'usecase') {
return <UseCaseListingSkeleton cardCount={queryParams.pageSize} />;
}
return <DatasetListingSkeleton cardCount={queryParams.pageSize} />;
}

const handlePageChange = (newPage: number) => {
setQueryParams({ type: 'SET_CURRENT_PAGE', payload: newPage });
Expand Down
9 changes: 5 additions & 4 deletions app/[locale]/(user)/components/Sectors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { useQuery } from '@tanstack/react-query'; // ✅ Ensure this is correct
import { Button, Divider, Spinner, Text } from 'opub-ui';

import { GraphQL } from '@/lib/api';
import { SectorListingSkeleton } from '@/components/loading';

const sectorDetails = graphql(`
query SectorsList {
Expand Down Expand Up @@ -59,10 +60,10 @@ const Sectors = () => {
</Button>
</div>
</div>
{isLoading ? (
<div className="m-4 flex justify-center">
<Spinner />
</div>
{isLoading ? (
<SectorListingSkeleton
cardCount={9}
/>
) : (
<div className="mt-6 lg:mt-12 grid w-full grid-cols-1 gap-6 px-4 md:grid-cols-2 md:px-12 lg:grid-cols-3 lg:px-12">
{data?.activeSectors.map((sectors: any) => (
Expand Down
10 changes: 6 additions & 4 deletions app/[locale]/(user)/components/UseCases.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { GraphQL } from '@/lib/api';
import { cn, formatDate } from '@/lib/utils';
import { Icons } from '@/components/icons';
import Styles from './datasets.module.scss';
import { UseCaseListingSkeleton } from '@/components/loading';

const useCasesListDoc: any = graphql(`
query TopUseCases(
Expand Down Expand Up @@ -125,10 +126,11 @@ const UseCasesListingPage = () => {
<Carousel className="flex w-full justify-between">
<CarouselPrevious />

{getUseCasesList.isLoading ? (
<div className="p-8">
<Spinner />
</div>
{getUseCasesList.isLoading ? (
<UseCaseListingSkeleton
cardCount={3}
cardsOnly={true}
/>
) : (
<CarouselContent className="p-4 ">
{getUseCasesList &&
Expand Down
5 changes: 2 additions & 3 deletions app/[locale]/(user)/publishers/PublishersListingClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { cn, generateJsonLd } from '@/lib/utils';
import BreadCrumbs from '@/components/BreadCrumbs';
import JsonLd from '@/components/JsonLd';
import PublisherCard from './PublisherCard';
import { PublisherListingSkeleton } from '@/components/loading';

const getAllPublishers: any = graphql(`
query PublishersList {
Expand Down Expand Up @@ -171,9 +172,7 @@ const PublishersListingPage = () => {
</ButtonGroup>
</div>
{Details.isLoading ? (
<div className="m-4 flex justify-center">
<Spinner />
</div>
<PublisherListingSkeleton cardCount={9} />
) : (
Details.data &&
Details.data.getPublishers.length > 0 && (
Expand Down
5 changes: 2 additions & 3 deletions app/[locale]/(user)/sectors/SectorsListing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import BreadCrumbs from '@/components/BreadCrumbs';
import { ErrorPage } from '@/components/error';
import JsonLd from '@/components/JsonLd';
import Styles from '../datasets/dataset.module.scss';
import { SectorListingSkeleton } from '@/components/loading';

const sectorsListQueryDoc: any = graphql(`
query SectorsLists($order: SectorOrder, $filters: SectorFilter) {
Expand Down Expand Up @@ -191,9 +192,7 @@ const SectorsListing = () => {
</div>
</div>
{isLoading ? (
<div className="m-4 flex justify-center">
<Spinner />
</div>
<SectorListingSkeleton cardCount={9} />
) : data && data?.activeSectors?.length > 0 ? (
<>
<div className="grid w-full grid-cols-1 gap-10 md:grid-cols-2 lg:grid-cols-3">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
/* ============================================
FILE: components/loading/Skeleton/DatasetListingSkeleton/DatasetListingSkeleton.module.css
============================================ */

.container {
min-height: 100vh;
background-color: var(--base-pure-white, #ffffff);
}

/* Search Bar */
.searchBar {
height: 48px;
width: 100%;
background-color: #d1d5db;
border-radius: 8px;
}

/* Controls */
.buttonGroup {
height: 40px;
width: 80px;
background-color: #d1d5db;
border-radius: 4px;
}

.sortButton {
height: 40px;
width: 40px;
background-color: #d1d5db;
border-radius: 4px;
}

.dropdown {
height: 40px;
width: 128px;
background-color: #d1d5db;
border-radius: 4px;
}

.filterButton {
height: 40px;
width: 80px;
background-color: #d1d5db;
border-radius: 4px;
}

/* Filter Sidebar */
.filterSidebar {
display: flex;
width: 100%;
flex-direction: column;
padding: 1.5rem 1rem;
background-color: var(--surface-default, #ffffff);
border-radius: 16px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.filterHeader {
display: flex;
justify-content: space-between;
margin-bottom: 1.25rem;
}

.filterTitle {
height: 20px;
width: 64px;
background-color: #d1d5db;
border-radius: 4px;
}

.resetButton {
height: 20px;
width: 48px;
background-color: #d1d5db;
border-radius: 4px;
}

.filterList {
display: flex;
flex-direction: column;
gap: 1.25rem;
}

.filterItem {
display: flex;
width: 100%;
align-items: center;
gap: 0.5rem;
padding: 0.75rem;
background-color: #1f5f8d1a;
border-radius: 4px;
}

.filterLabel {
height: 20px;
width: 120px;
background-color: #d1d5db;
border-radius: 4px;
}

/* Card - Default Vertical Layout */
.card {
display: flex;
flex-direction: column;
gap: 1rem;
padding: 1.5rem;
background-color: var(--surface-default, #ffffff);
border-radius: 8px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Carousel Cards Container - NEW */
.carouselContainer {
display: flex;
gap: 1rem;
width: 100%;
}

/* Carousel Card - Horizontal Layout for Homepage */
.carouselCard {
display: flex;
flex-direction: column;
gap: 1.25rem;
padding: 2rem;
background-color: var(--surface-default, #ffffff);
border-radius: 8px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
min-width: 480px;
min-height: 320px;
flex: 1;
}

.cardTitle {
height: 24px;
width: 75%;
background-color: #d1d5db;
border-radius: 4px;
}

/* Metadata */
.metadataRow {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.75rem;
}

.metadataItem {
display: flex;
align-items: center;
gap: 0.5rem;
}

.metadataIcon {
height: 20px;
width: 20px;
background-color: #d1d5db;
border-radius: 50%;
}

.metadataText {
height: 16px;
width: 80px;
background-color: #d1d5db;
border-radius: 4px;
}

.metadataTextSmall {
height: 16px;
width: 32px;
background-color: #d1d5db;
border-radius: 4px;
}

.metadataTextMedium {
height: 16px;
width: 64px;
background-color: #d1d5db;
border-radius: 4px;
}

/* Description */
.descriptionLines {
display: flex;
flex-direction: column;
gap: 0.5rem;
}

.descriptionLine {
height: 16px;
width: 100%;
background-color: #d1d5db;
border-radius: 4px;
}

.descriptionLineShort {
height: 16px;
width: 80%;
background-color: #d1d5db;
border-radius: 4px;
}

/* Footer */
.cardFooter {
display: flex;
align-items: center;
gap: 0.75rem;
padding-top: 1rem;
margin-top: auto;
border-top: 1px solid var(--border-default, #e5e7eb);
}

.footerIcon {
height: 32px;
width: 32px;
background-color: #d1d5db;
border-radius: 50%;
}
Loading
Loading