1- 'use client'
1+ 'use client' ;
22
3- import GraphqlPagination from '@/app/[locale]/dashboard/components/GraphqlPagination/graphqlPagination ' ;
3+ import React , { useEffect , useReducer , useRef , useState } from 'react ' ;
44import Image from 'next/image' ;
55import { useRouter } from 'next/navigation' ;
6+ import GraphqlPagination from '@/app/[locale]/dashboard/components/GraphqlPagination/graphqlPagination' ;
7+ import { fetchData } from '@/fetch' ;
68import {
79 Button ,
810 ButtonGroup ,
@@ -14,52 +16,52 @@ import {
1416 Text ,
1517 Tray ,
1618} from 'opub-ui' ;
17- import React , { useEffect , useReducer , useRef , useState } from 'react' ;
1819
20+ import { cn , formatDate } from '@/lib/utils' ;
1921import BreadCrumbs from '@/components/BreadCrumbs' ;
2022import { Icons } from '@/components/icons' ;
2123import { Loading } from '@/components/loading' ;
22- import { fetchData } from '@/fetch' ;
23- import { cn , formatDate } from '@/lib/utils' ;
2424import Filter from '../datasets/components/FIlter/Filter' ;
2525import Styles from '../datasets/dataset.module.scss' ;
2626
2727// Helper function to strip markdown and HTML tags for card preview
2828const stripMarkdown = ( markdown : string ) : string => {
2929 if ( ! markdown ) return '' ;
30- return markdown
31- // Remove code blocks first (before other replacements)
32- . replace ( / ` ` ` [ \s \S ] * ?` ` ` / g, '' )
33- // Remove inline code
34- . replace ( / ` ( [ ^ ` ] + ) ` / g, '$1' )
35- // Remove images
36- . replace ( / ! \[ ( [ ^ \] ] * ) \] \( [ ^ ) ] + \) / g, '$1' )
37- // Remove links
38- . replace ( / \[ ( [ ^ \] ] + ) \] \( [ ^ ) ] + \) / g, '$1' )
39- // Remove headers
40- . replace ( / ^ # { 1 , 6 } \s + / gm, '' )
41- // Remove bold
42- . replace ( / \* \* ( [ ^ * ] + ) \* \* / g, '$1' )
43- . replace ( / _ _ ( [ ^ _ ] + ) _ _ / g, '$1' )
44- // Remove italic
45- . replace ( / \* ( [ ^ * ] + ) \* / g, '$1' )
46- . replace ( / _ ( [ ^ _ ] + ) _ / g, '$1' )
47- // Remove strikethrough
48- . replace ( / ~ ~ ( [ ^ ~ ] + ) ~ ~ / g, '$1' )
49- // Remove blockquotes
50- . replace ( / ^ \s * > \s + / gm, '' )
51- // Remove horizontal rules
52- . replace ( / ^ ( - { 3 , } | _ { 3 , } | \* { 3 , } ) $ / gm, '' )
53- // Remove list markers
54- . replace ( / ^ \s * [ - * + ] \s + / gm, '' )
55- . replace ( / ^ \s * \d + \. \s + / gm, '' )
56- // Remove HTML tags
57- . replace ( / < [ ^ > ] * > / g, '' )
58- // Remove extra whitespace and newlines
59- . replace ( / \n \s * \n / g, '\n' )
60- . replace ( / \n / g, ' ' )
61- . replace ( / \s + / g, ' ' )
62- . trim ( ) ;
30+ return (
31+ markdown
32+ // Remove code blocks first (before other replacements)
33+ . replace ( / ` ` ` [ \s \S ] * ?` ` ` / g, '' )
34+ // Remove inline code
35+ . replace ( / ` ( [ ^ ` ] + ) ` / g, '$1' )
36+ // Remove images
37+ . replace ( / ! \[ ( [ ^ \] ] * ) \] \( [ ^ ) ] + \) / g, '$1' )
38+ // Remove links
39+ . replace ( / \[ ( [ ^ \] ] + ) \] \( [ ^ ) ] + \) / g, '$1' )
40+ // Remove headers
41+ . replace ( / ^ # { 1 , 6 } \s + / gm, '' )
42+ // Remove bold
43+ . replace ( / \* \* ( [ ^ * ] + ) \* \* / g, '$1' )
44+ . replace ( / _ _ ( [ ^ _ ] + ) _ _ / g, '$1' )
45+ // Remove italic
46+ . replace ( / \* ( [ ^ * ] + ) \* / g, '$1' )
47+ . replace ( / _ ( [ ^ _ ] + ) _ / g, '$1' )
48+ // Remove strikethrough
49+ . replace ( / ~ ~ ( [ ^ ~ ] + ) ~ ~ / g, '$1' )
50+ // Remove blockquotes
51+ . replace ( / ^ \s * > \s + / gm, '' )
52+ // Remove horizontal rules
53+ . replace ( / ^ ( - { 3 , } | _ { 3 , } | \* { 3 , } ) $ / gm, '' )
54+ // Remove list markers
55+ . replace ( / ^ \s * [ - * + ] \s + / gm, '' )
56+ . replace ( / ^ \s * \d + \. \s + / gm, '' )
57+ // Remove HTML tags
58+ . replace ( / < [ ^ > ] * > / g, '' )
59+ // Remove extra whitespace and newlines
60+ . replace ( / \n \s * \n / g, '\n' )
61+ . replace ( / \n / g, ' ' )
62+ . replace ( / \s + / g, ' ' )
63+ . trim ( )
64+ ) ;
6365} ;
6466
6567// Interfaces
@@ -266,7 +268,7 @@ const ListingComponent: React.FC<ListingProps> = ({
266268 if ( variables ) {
267269 const currentFetchId = ++ latestFetchId . current ;
268270
269- fetchData ( type , variables )
271+ fetchData ( type , variables )
270272 . then ( ( res ) => {
271273 // Only set if this is the latest call
272274 if ( currentFetchId === latestFetchId . current ) {
@@ -325,7 +327,7 @@ const ListingComponent: React.FC<ListingProps> = ({
325327 label : bucket . key ,
326328 value : bucket . key ,
327329 } ) ) ;
328- }
330+ }
329331 // Handle key-value object format (current backend format)
330332 else if ( value && typeof value === 'object' && ! Array . isArray ( value ) ) {
331333 acc [ key ] = Object . entries ( value ) . map ( ( [ label , count ] ) => ( {
@@ -528,14 +530,14 @@ const ListingComponent: React.FC<ListingProps> = ({
528530 : item ?. organization ?. logo
529531 ? `${ process . env . NEXT_PUBLIC_BACKEND_URL } /${ item . organization . logo } `
530532 : '/org.png' ;
531-
532- const geographies = item . geographies && item . geographies . length > 0
533- ? item . geographies
534- : null ;
535533
536- const sdgs = item . sdgs && item . sdgs . length > 0
537- ? item . sdgs
538- : null ;
534+ const geographies =
535+ item . geographies && item . geographies . length > 0
536+ ? item . geographies
537+ : null ;
538+
539+ const sdgs =
540+ item . sdgs && item . sdgs . length > 0 ? item . sdgs : null ;
539541
540542 const MetadataContent = [
541543 {
@@ -569,7 +571,9 @@ const ListingComponent: React.FC<ListingProps> = ({
569571
570572 if ( sdgs && sdgs . length > 0 ) {
571573 // Format SDGs for display
572- const sdgDisplay = sdgs . map ( ( sdg : any ) => `${ sdg . code } - ${ sdg . name } ` ) . join ( ', ' ) ;
574+ const sdgDisplay = sdgs
575+ . map ( ( sdg : any ) => `${ sdg . code } - ${ sdg . name } ` )
576+ . join ( ', ' ) ;
573577
574578 MetadataContent . push ( {
575579 icon : Icons . target ,
0 commit comments