Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ const CollaborativesListingClient = () => {
title={collaborative.title || ''}
variation="collapsed"
iconColor="warning"
imageUrl={`${process.env.NEXT_PUBLIC_BACKEND_URL}/${collaborative.logo?.path.replace('/code/files/', '')}`}
metadataContent={[
{
icon: Icons.calendar as any,
Expand Down Expand Up @@ -343,7 +344,7 @@ const CollaborativesListingClient = () => {
label: 'Published by',
},
]}
description={`rest ${stripMarkdown(collaborative.summary || '')}`}
description={stripMarkdown(collaborative.summary || '')}
/>
)
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import BreadCrumbs from '@/components/BreadCrumbs';
import { Icons } from '@/components/icons';
import JsonLd from '@/components/JsonLd';
import { Loading } from '@/components/loading';
import { stripMarkdown } from '../../search/components/UnifiedListingComponent';
import PrimaryDetails from '../components/Details';
import Metadata from '../components/Metadata';

Expand Down Expand Up @@ -476,7 +477,7 @@ const CollaborativeDetailClient = () => {

const commonProps = {
title: useCase.title || '',
description: useCase.summary || '',
description: stripMarkdown(useCase.summary || ''),
metadataContent: MetadataContent,
tag: useCase.tags?.map((t: any) => t.value) || [],
footerContent: FooterContent,
Expand Down Expand Up @@ -558,7 +559,7 @@ const CollaborativeDetailClient = () => {
label: 'Published by',
},
]}
description={dataset.description || ''}
description={stripMarkdown(dataset.description || '')}
/>
))}
</div>
Expand Down
31 changes: 19 additions & 12 deletions app/[locale]/(user)/components/Content.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
'use client';

import { graphql } from '@/gql';
import { useQuery } from '@tanstack/react-query';
import Image from 'next/image';
import Link from 'next/link';
import { useRouter } from 'next/navigation';
import { graphql } from '@/gql';
import { useTourTrigger } from '@/hooks/use-tour-trigger';
import { useQuery } from '@tanstack/react-query';
import { SearchInput, Spinner, Text } from 'opub-ui';

import { useTourTrigger } from '@/hooks/use-tour-trigger';
import { GraphQL } from '@/lib/api';
import { cn } from '@/lib/utils';
import Styles from '../page.module.scss';
Expand All @@ -24,13 +24,12 @@ const statsInfo: any = graphql(`
}
`);


export const Content = () => {
const router = useRouter();

// Enable tour for first-time users
useTourTrigger(true, 1500);

const Stats: { data: any; isLoading: any } = useQuery([`statsDetails`], () =>
GraphQL(statsInfo, {}, [])
);
Expand Down Expand Up @@ -64,17 +63,25 @@ export const Content = () => {
},
];


return (
<main className="container py-10 md:px-8 lg:py-20">
<div className="flex justify-around gap-8 px-4 md:px-12 lg:px-12">
<div className="flex flex-col gap-11 lg:w-[60%]">
<div className="flex flex-col gap-2">
<Text variant="heading3xl" color="onBgDefault" className='text-textOnBGDefault1'>
<Text
variant="heading3xl"
color="onBgDefault"
className="text-textOnBGDefault1"
>
An Open-Source Platform for Collaborative Data-Driven Change
</Text>
<Text variant="headingLg" color="onBgDefault" className='text-textOnBGDefault2'>
Share datasets, knowledge resources, and AI use-cases for data changemakers.
<Text
variant="headingLg"
color="onBgDefault"
className="text-textOnBGDefault2"
>
Share datasets, knowledge resources, and AI use-cases for data
changemakers.
</Text>
</div>
<div className="w-full" data-tour="search-bar">
Expand Down Expand Up @@ -115,7 +122,7 @@ export const Content = () => {
<Text
color="onBgDefault"
fontWeight="semibold"
className="uppercase text-xs text-textSurfaceStats"
className="text-xs uppercase text-textSurfaceStats"
>
{item.label}
</Text>
Expand All @@ -124,7 +131,7 @@ export const Content = () => {
))}
</div>
)}

{/* <div className="flex flex-wrap gap-4">
{Sectors.map((item, index) => (
<div key={index}>
Expand Down
41 changes: 1 addition & 40 deletions app/[locale]/(user)/components/ListingComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,46 +28,7 @@ import {
} from '@/components/loading';
import Filter from '../datasets/components/FIlter/Filter';
import Styles from '../datasets/dataset.module.scss';

// Helper function to strip markdown and HTML tags for card preview
const stripMarkdown = (markdown: string): string => {
if (!markdown) return '';
return (
markdown
// Remove code blocks first (before other replacements)
.replace(/```[\s\S]*?```/g, '')
// Remove inline code
.replace(/`([^`]+)`/g, '$1')
// Remove images
.replace(/!\[([^\]]*)\]\([^)]+\)/g, '$1')
// Remove links
.replace(/\[([^\]]+)\]\([^)]+\)/g, '$1')
// Remove headers
.replace(/^#{1,6}\s+/gm, '')
// Remove bold
.replace(/\*\*([^*]+)\*\*/g, '$1')
.replace(/__([^_]+)__/g, '$1')
// Remove italic
.replace(/\*([^*]+)\*/g, '$1')
.replace(/_([^_]+)_/g, '$1')
// Remove strikethrough
.replace(/~~([^~]+)~~/g, '$1')
// Remove blockquotes
.replace(/^\s*>\s+/gm, '')
// Remove horizontal rules
.replace(/^(-{3,}|_{3,}|\*{3,})$/gm, '')
// Remove list markers
.replace(/^\s*[-*+]\s+/gm, '')
.replace(/^\s*\d+\.\s+/gm, '')
// Remove HTML tags
.replace(/<[^>]*>/g, '')
// Remove extra whitespace and newlines
.replace(/\n\s*\n/g, '\n')
.replace(/\n/g, ' ')
.replace(/\s+/g, ' ')
.trim()
);
};
import { stripMarkdown } from '../search/components/UnifiedListingComponent';

// Interfaces
interface Bucket {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useParams } from 'next/navigation';
import { stripMarkdown } from '@/app/[locale]/(user)/search/components/UnifiedListingComponent';
import { graphql } from '@/gql';
import { useQuery } from '@tanstack/react-query';
import {
Expand Down Expand Up @@ -123,7 +124,7 @@ const SimilarDatasets: React.FC = () => {
{' '}
<Card
title={item.title}
description={item.description}
description={stripMarkdown(item.description || '')}
metadataContent={[
{
icon: Icons.calendar as any,
Expand Down
3 changes: 2 additions & 1 deletion app/[locale]/(user)/publishers/components/Datasets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Card, Icon, Spinner, Text } from 'opub-ui';
import { GraphQL } from '@/lib/api';
import { cn } from '@/lib/utils';
import { Icons } from '@/components/icons';
import { stripMarkdown } from '../../search/components/UnifiedListingComponent';

const userPublishedDatasetsDoc: any = graphql(`
query userPublishedDatasetsList($userId: ID!) {
Expand Down Expand Up @@ -152,7 +153,7 @@ const Datasets = ({ type }: { type: 'organization' | 'Publisher' }) => {
]}
key={index}
title={item.title}
description={item.description}
description={stripMarkdown(item.description || '')}
metadataContent={[
{
icon: Icons.calendar as any,
Expand Down
3 changes: 2 additions & 1 deletion app/[locale]/(user)/publishers/components/UseCases.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Card, Icon, Spinner, Text } from 'opub-ui';
import { GraphQL } from '@/lib/api';
import { cn, formatDate } from '@/lib/utils';
import { Icons } from '@/components/icons';
import { stripMarkdown } from '../../search/components/UnifiedListingComponent';

const userPublishedUseCasesDoc: any = graphql(`
query userPublishedUseCasesList($userId: ID!) {
Expand Down Expand Up @@ -180,7 +181,7 @@ const UseCases = ({ type }: { type: 'organization' | 'Publisher' }) => {
label: 'Published by',
},
]}
description={item.summary}
description={stripMarkdown(item.summary || '')}
iconColor="warning"
variation={'collapsed'}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import BreadCrumbs from '@/components/BreadCrumbs';
import { Icons } from '@/components/icons';
import JsonLd from '@/components/JsonLd';
import { Loading } from '@/components/loading';
import { stripMarkdown } from '../../search/components/UnifiedListingComponent';
import PrimaryDetails from '../components/Details';
import Metadata from '../components/Metadata';
import Dashboards from './Dashboards';
Expand Down Expand Up @@ -334,7 +335,7 @@ const UseCaseDetailClient = () => {
label: 'Published by',
},
]}
description={dataset.description || ''}
description={stripMarkdown(dataset.description || '')}
/>
))}
</div>
Expand Down