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
3 changes: 3 additions & 0 deletions .github/workflows/deploy-Dataspace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ jobs:
BACKEND_GRAPHQL_URL: ${{ vars.BACKEND_GRAPHQL_URL }}
NODE_ENV: production

- name: Lint
run: npm run lint

- name: Build
run: npm run build

Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/pre-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,9 @@ jobs:
run: npm run generate
env:
BACKEND_GRAPHQL_URL: ${{vars.BACKEND_GRAPHQL_URL}}

- name: Lint
run: npm run lint

- name: Build application
run: npm run build --if-present
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { useQuery } from '@tanstack/react-query';
import { Button, Card, Icon, SearchInput, Select, Text } from 'opub-ui';

import { GraphQLPublic } from '@/lib/api';
import { getCollaborativeDetailUrl } from '@/lib/collaborativesRouting';
import { cn, formatDate, generateJsonLd } from '@/lib/utils';
import BreadCrumbs from '@/components/BreadCrumbs';
import { Icons } from '@/components/icons';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export async function generateMetadata({
image: `${process.env.NEXT_PUBLIC_PLATFORM_URL}/og.png`,
},
});
} catch (error) {
} catch {
// Fallback to generic metadata if the API call fails
return generatePageMetadata({
title: `Collaborative Details | CivicDataSpace`,
Expand Down
2 changes: 1 addition & 1 deletion app/[locale]/(user)/collaboratives/components/Details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const PrimaryDetails = ({ data, isLoading }: { data: any; isLoading: any }) => {
<Button
kind="tertiary"
className="lg:hidden"
onClick={(e) => setOpen(true)}
onClick={() => setOpen(true)}
>
<div className="flex items-center gap-2 py-2">
<Icon source={Icons.info} size={24} color="default" />
Expand Down
3 changes: 1 addition & 2 deletions app/[locale]/(user)/components/ListingComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { fetchData } from '@/fetch';
import { useTourTrigger } from '@/hooks/use-tour-trigger';
import {
Button,
ButtonGroup,
Card,
Icon,
Pill,
Expand Down Expand Up @@ -237,7 +236,7 @@ const ListingComponent: React.FC<ListingProps> = ({
const [variables, setVariables] = useState('');
const [open, setOpen] = useState(false);
const [queryParams, setQueryParams] = useReducer(queryReducer, initialState);
const [view, setView] = useState<'collapsed' | 'expanded'>('collapsed');
const [view] = useState<'collapsed' | 'expanded'>('collapsed');

const count = facets?.total ?? 0;
const datasetDetails = facets?.results ?? [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const PrimaryData: React.FC<PrimaryDataProps> = ({ data, isLoading }) => {
<Button
kind="tertiary"
className="lg:hidden"
onClick={(e) => setOpen(true)}
onClick={() => setOpen(true)}
>
<div className="flex items-center gap-2 py-2">
<Icon source={Icons.info} size={24} color="default" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
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
2 changes: 1 addition & 1 deletion app/[locale]/(user)/publishers/PublishersListingClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useState } from 'react';
import Image from 'next/image';
import { graphql } from '@/gql';
import { useQuery } from '@tanstack/react-query';
import { Button, ButtonGroup, Spinner, Text } from 'opub-ui';
import { Button, ButtonGroup, Text } from 'opub-ui';

import { GraphQL } from '@/lib/api';
import { cn, generateJsonLd } from '@/lib/utils';
Expand Down
29 changes: 18 additions & 11 deletions app/[locale]/(user)/search/components/UnifiedListingComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
'use client';

import React, { useEffect, useReducer, useRef, useState } from 'react';
import React, { useEffect, useMemo, useReducer, useRef, useState } from 'react';
import Link from 'next/link';
import { useRouter } from 'next/navigation';
import GraphqlPagination from '@/app/[locale]/dashboard/components/GraphqlPagination/graphqlPagination';
import {
Button,
ButtonGroup,
Card,
Icon,
Pill,
SearchInput,
Select,
Expand Down Expand Up @@ -315,7 +313,7 @@ const UnifiedListingComponent: React.FC<UnifiedListingProps> = ({
const [variables, setVariables] = useState('');
const [open, setOpen] = useState(false);
const [queryParams, setQueryParams] = useReducer(queryReducer, initialState);
const [view, setView] = useState<'collapsed' | 'expanded'>('collapsed');
const [view] = useState<'collapsed' | 'expanded'>('collapsed');
const [persistedTypeCounts, setPersistedTypeCounts] = useState<
Record<string, number>
>({});
Expand Down Expand Up @@ -382,10 +380,6 @@ const UnifiedListingComponent: React.FC<UnifiedListingProps> = ({
setQueryParams({ type: 'SET_SORT', payload: sortOption });
};

const handleOrderChange = (sortOrder: string) => {
setQueryParams({ type: 'SET_ORDER', payload: sortOrder });
};

const handleTypeFilter = (types: string) => {
setQueryParams({ type: 'SET_TYPES', payload: types });
};
Expand Down Expand Up @@ -444,7 +438,10 @@ const UnifiedListingComponent: React.FC<UnifiedListingProps> = ({
);

// Get type counts from aggregations
const typeCounts = aggregations.types || {};
const typeCounts = useMemo(
() => aggregations.types || {},
[aggregations.types]
);
const liveTypeCounts = Object.entries(typeCounts).reduce(
(acc, [key, value]) => {
if (typeof value === 'number') {
Expand All @@ -457,13 +454,23 @@ const UnifiedListingComponent: React.FC<UnifiedListingProps> = ({
const displayTypeCounts = { ...persistedTypeCounts, ...liveTypeCounts };

useEffect(() => {
if (Object.keys(liveTypeCounts).length === 0) return;
const counts = Object.entries(typeCounts).reduce(
(acc, [key, value]) => {
if (typeof value === 'number') {
acc[key] = value;
}
return acc;
},
{} as Record<string, number>
);

if (Object.keys(counts).length === 0) return;

setPersistedTypeCounts((prev) => {
const next = { ...prev };
let changed = false;

Object.entries(liveTypeCounts).forEach(([key, value]) => {
Object.entries(counts).forEach(([key, value]) => {
if (next[key] !== value) {
next[key] = value;
changed = true;
Expand Down
2 changes: 1 addition & 1 deletion app/[locale]/(user)/sectors/SectorsListing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const SectorsListing = () => {

useEffect(() => {
refetch();
}, [searchText]);
}, [searchText, refetch]);

const handleSortChange = (e: string) => {
const [field, direction] = e.split('_');
Expand Down
2 changes: 1 addition & 1 deletion app/[locale]/(user)/usecases/components/Details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const PrimaryDetails = ({ data, isLoading }: { data: any; isLoading: any }) => {
<Button
kind="tertiary"
className="lg:hidden"
onClick={(e) => setOpen(true)}
onClick={() => setOpen(true)}
>
<div className="flex items-center gap-2 py-2">
<Icon source={Icons.info} size={24} color="default" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ const Admin = () => {
useEffect(() => {
usersList.refetch();
setRefetch(false);
}, [refetch]);
}, [refetch, usersList]);

return (
<div>
Expand Down
Loading
Loading