Skip to content
Draft
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ You can also check the
- Use AGENTS.md instead of CLAUDE.md and adjust context according to recent
findings of studies about the impact of context files for coding AIs
- Remove LINDASOld endpoint configurations
- Dependency updates
- Documentation
- added publiccode.yml for discoverability

Expand Down
9 changes: 5 additions & 4 deletions app/browse/lib/create-use-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import {
} from "@/browse/lib/filters";
import { BrowseParams } from "@/browse/lib/params";
import { useUrlSyncState } from "@/browse/lib/use-url-sync-state";
import { SearchCubeResultOrder } from "@/graphql/query-hooks";
import type * as Hooks from "@/graphql/query-hooks";
import { SearchCubeResultOrder } from "@/graphql/resolver-types";
import { useEvent } from "@/utils/use-event";

/**
Expand Down Expand Up @@ -35,7 +36,7 @@ export const createUseBrowseState = ({
includeDrafts,
dataset: paramDataset,
} = browseParams;
const previousOrderRef = useRef(SearchCubeResultOrder.Score);
const previousOrderRef = useRef(SearchCubeResultOrder.Score as Hooks.SearchCubeResultOrder);

// Support /browse?dataset=<iri> and legacy /browse/dataset/<iri>
const dataset = type === "dataset" ? iri : paramDataset;
Expand All @@ -47,7 +48,7 @@ export const createUseBrowseState = ({
const setIncludeDrafts = useEvent((v: boolean) =>
setParams((prev) => ({ ...prev, includeDrafts: v }))
);
const setOrder = useEvent((v: SearchCubeResultOrder) =>
const setOrder = useEvent((v: Hooks.SearchCubeResultOrder) =>
setParams((prev) => ({ ...prev, order: v }))
);
const setDataset = useEvent((v: string) =>
Expand Down Expand Up @@ -78,7 +79,7 @@ export const createUseBrowseState = ({
},
search,
order,
onSetOrder: (order: SearchCubeResultOrder) => {
onSetOrder: (order: Hooks.SearchCubeResultOrder) => {
previousOrderRef.current = order;
setOrder(order);
},
Expand Down
13 changes: 3 additions & 10 deletions app/browse/lib/filters.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { BrowseParams } from "@/browse/lib/params";
import {
DataCubeOrganization,
DataCubeTermset,
DataCubeTheme,
SearchCubeFilterType,
} from "@/graphql/query-hooks";
import { DataCubeOrganization, DataCubeTermset, DataCubeTheme, SearchCubeFilterType, } from "@/graphql/resolver-types";

export type DataCubeAbout = {
__typename: "DataCubeAbout";
Expand Down Expand Up @@ -95,8 +90,7 @@ export const getParamsFromFilters = (filters: BrowseFilter[]) => {
params[iriAttr] = filter.iri;
break;
default:
const _exhaustiveCheck: never = filter;
return _exhaustiveCheck;
return filter as never;
}

i++;
Expand All @@ -117,8 +111,7 @@ export const encodeFilter = ({ __typename, iri }: BrowseFilter) => {
case "DataCubeTermset":
return "termset";
default:
const _exhaustiveCheck: never = __typename;
return _exhaustiveCheck;
return __typename as never;
}
})();

Expand Down
2 changes: 1 addition & 1 deletion app/browse/ui/dataset-result.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { MaybeTooltip } from "@/components/maybe-tooltip";
import { MotionCard, smoothPresenceProps } from "@/components/presence";
import { Tag } from "@/components/tag";
import { PartialSearchCube } from "@/domain/data";
import { DataCubePublicationStatus } from "@/graphql/query-hooks";
import { DataCubePublicationStatus } from "@/graphql/resolver-types";
import { useEvent } from "@/utils/use-event";

export type DatasetResultProps = ComponentProps<typeof DatasetResult>;
Expand Down
2 changes: 1 addition & 1 deletion app/browse/ui/dataset-results.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { CombinedError } from "urql";
import { DatasetResult, DatasetResultProps } from "@/browse/ui/dataset-result";
import { Loading, LoadingDataError } from "@/components/hint";
import { SearchCube } from "@/domain/data";
import { SearchCubeResult } from "@/graphql/query-hooks";
import { SearchCubeResult } from "@/graphql/resolver-types";

export type DatasetResultsProps = ComponentProps<typeof DatasetResults>;

Expand Down
2 changes: 1 addition & 1 deletion app/browse/ui/navigation-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
DataCubeOrganization,
DataCubeTermset,
DataCubeTheme,
} from "@/graphql/query-hooks";
} from "@/graphql/resolver-types";
import { Icon } from "@/icons";

export const NavigationSection = ({
Expand Down
4 changes: 2 additions & 2 deletions app/browse/ui/search-dataset-controls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { SearchDatasetDraftsControl } from "@/browse/ui/search-dataset-drafts-co
import { SearchDatasetResultsCount } from "@/browse/ui/search-dataset-results-count";
import { SearchDatasetSortControl } from "@/browse/ui/search-dataset-sort-control";
import { Flex } from "@/components/flex";
import { SearchCubeResult, SearchCubeResultOrder } from "@/graphql/query-hooks";
import { SearchCubeResult, SearchCubeResultOrder } from "@/graphql/resolver-types";
import { sleep } from "@/utils/sleep";
import { useEvent } from "@/utils/use-event";

Expand All @@ -16,7 +16,7 @@ export const SearchDatasetControls = ({
onSubmitSearch,
includeDrafts,
setIncludeDrafts,
order = SearchCubeResultOrder.CreatedDesc,
order = SearchCubeResultOrder.CreatedDesc as SearchCubeResultOrder,
onSetOrder,
},
cubes,
Expand Down
2 changes: 1 addition & 1 deletion app/browse/ui/search-dataset-results-count.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Plural } from "@lingui/macro";
import { Typography } from "@mui/material";

import { SearchCubeResult } from "@/graphql/query-hooks";
import { SearchCubeResult } from "@/graphql/resolver-types";

export const SearchDatasetResultsCount = ({
cubes,
Expand Down
11 changes: 7 additions & 4 deletions app/browse/ui/search-dataset-sort-control.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useMemo } from "react";
import { Flex } from "@/components/flex";
import { Select } from "@/components/form";
import { SearchCubeResultOrder } from "@/graphql/query-hooks";
import * as ResolverTypes from "@/graphql/resolver-types";

export const SearchDatasetSortControl = ({
value,
Expand All @@ -18,21 +19,23 @@ export const SearchDatasetSortControl = ({
const options = useMemo(() => {
const options = [
{
value: SearchCubeResultOrder.Score,
value: ResolverTypes.SearchCubeResultOrder.Score,
label: t({ id: "dataset.order.relevance", message: "Relevance" }),
},
{
value: SearchCubeResultOrder.TitleAsc,
value: ResolverTypes.SearchCubeResultOrder.TitleAsc,
label: t({ id: "dataset.order.title", message: "Title" }),
},
{
value: SearchCubeResultOrder.CreatedDesc,
value: ResolverTypes.SearchCubeResultOrder.CreatedDesc,
label: t({ id: "dataset.order.newest", message: "Newest" }),
},
];

if (disableScore) {
return options.filter((o) => o.value !== SearchCubeResultOrder.Score);
return options.filter(
(o) => o.value !== ResolverTypes.SearchCubeResultOrder.Score
);
}

return options;
Expand Down
18 changes: 7 additions & 11 deletions app/browse/ui/search-filters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import { AnimatePresence } from "framer-motion";
import keyBy from "lodash/keyBy";
import sortBy from "lodash/sortBy";
import uniqBy from "lodash/uniqBy";
import { ReactNode, useMemo } from "react";
import { useMemo } from "react";

import { BrowseFilter } from "@/browse/lib/filters";
import { useBrowseContext } from "@/browse/model/context";
import { NavigationSection } from "@/browse/ui/navigation-section";
import { SubthemeFilters } from "@/browse/ui/subtheme-filters";
Expand All @@ -17,16 +16,16 @@ import {
DataCubeOrganization,
DataCubeTermset,
DataCubeTheme,
} from "@/graphql/query-hooks";
import { SearchCubeResult } from "@/graphql/resolver-types";
SearchCubeResult
} from "@/graphql/resolver-types";

const navigationOrder: Record<BrowseFilter["__typename"], number> = {
const navigationOrder = {
DataCubeTheme: 1,
DataCubeOrganization: 2,
DataCubeTermset: 3,
// Not used in the navigation
DataCubeAbout: 4,
};
} as const;

export const SearchFilters = ({
cubes,
Expand Down Expand Up @@ -207,14 +206,11 @@ export const SearchFilters = ({
/>
) : null;

const baseNavigations: {
element: ReactNode;
__typename: BrowseFilter["__typename"];
}[] = [
const baseNavigations = [
{ element: themeNavigation, __typename: "DataCubeTheme" },
{ element: organizationNavigation, __typename: "DataCubeOrganization" },
{ element: termsetNavigation, __typename: "DataCubeTermset" },
];
] as const;

const navigations = sortBy(baseNavigations, (nav) => {
const i = filters.findIndex((f) => f.__typename === nav.__typename);
Expand Down
12 changes: 7 additions & 5 deletions app/browse/ui/select-dataset-step.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,16 @@ import {
import { sourceToKey } from "@/domain/data-source";
import { truthy } from "@/domain/types";
import { ContentWrapper } from "@/federal-ci/components/content-wrapper";
import {
useDataCubeMetadataQuery,
useSearchCubesQuery,
} from "@/graphql/query-hooks";
import {
DataCubeOrganization,
DataCubeTermset,
DataCubeTheme,
SearchCubeFilterType,
useDataCubeMetadataQuery,
useSearchCubesQuery,
} from "@/graphql/query-hooks";
} from "@/graphql/resolver-types";
import { Icon } from "@/icons";
import { useConfiguratorState, useLocale } from "@/src";
import { softJSONParse } from "@/utils/soft-json-parse";
Expand Down Expand Up @@ -138,7 +140,7 @@ const SelectDatasetStepInner = ({
d.__typename !== SearchCubeFilterType.DataCubeAbout
)
.map((d) => {
const type = SearchCubeFilterType[d.__typename];
const type = SearchCubeFilterType[d.__typename!];
return {
type,
label: d.label,
Expand Down Expand Up @@ -246,7 +248,7 @@ const SelectDatasetStepInner = ({
case SearchCubeFilterType.TemporalDimension:
return [];
default:
const _exhaustiveCheck: never = queryFilter.type;
const _exhaustiveCheck = queryFilter.type;
return _exhaustiveCheck;
}
})();
Expand Down
2 changes: 1 addition & 1 deletion app/charts/shared/chart-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ import {
} from "@/domain/data";
import { Has } from "@/domain/types";
import { useTimeFormatUnit } from "@/formatters";
import { RelatedDimensionType } from "@/graphql/query-hooks";
import { RelatedDimensionType } from "@/graphql/resolver-types";
import { ScaleType, TimeUnit } from "@/graphql/resolver-types";
import { Limit } from "@/rdf/limits";
import {
Expand Down
2 changes: 1 addition & 1 deletion app/charts/shared/use-combined-temporal-dimension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
import { useTimeFormatLocale } from "@/formatters";
import { useConfigsCubeComponents } from "@/graphql/hooks";
import { stringifyComponentId } from "@/graphql/make-component-id";
import { TimeUnit } from "@/graphql/query-hooks";
import { TimeUnit } from "@/graphql/resolver-types";
import { useLocale } from "@/locales/use-locale";
import { timeUnitFormats, timeUnitOrder } from "@/rdf/mappings";
import { useDashboardInteractiveFilters } from "@/stores/interactive-filters";
Expand Down
2 changes: 1 addition & 1 deletion app/components/dashboard-interactive-filters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import { isTemporalDimension } from "@/domain/data";
import { truthy } from "@/domain/types";
import { useDataCubesComponentsQuery } from "@/graphql/hooks";
import { getResolvedJoinById, isJoinById } from "@/graphql/join";
import { TimeUnit } from "@/graphql/query-hooks";
import { TimeUnit } from "@/graphql/resolver-types";
import { useLocale } from "@/locales/use-locale";
import {
setDataFilter,
Expand Down
2 changes: 1 addition & 1 deletion app/components/debug-search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import { KeyboardEventHandler, useEffect, useRef, useState } from "react";

import {
SearchCubeFilter,
SearchCubeFilterType,
useSearchCubesQuery,
} from "@/graphql/query-hooks";
import { RequestQueryMeta } from "@/graphql/query-meta";
import { SearchCubeFilterType } from "@/graphql/resolver-types";

const territoryTheme = {
name: "Territory theme",
Expand Down
2 changes: 1 addition & 1 deletion app/components/graphql-search.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import { ComponentTermsets } from "@/domain/data";
import { truthy } from "@/domain/types";
import {
DataCubeComponentTermsetsQueryVariables,
SearchCubeFilterType,
useDataCubeComponentTermsetsQuery,
useSearchCubesQuery,
} from "@/graphql/query-hooks";
import { SearchCubeFilterType } from "@/graphql/resolver-types";

const options = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,13 @@ import {
} from "@/graphql/hooks";
import { ComponentId, parseComponentId } from "@/graphql/make-component-id";
import {
SearchCubeFilterType,
SearchCubeResultOrder,
SearchCubeResultOrder as TSearchCubeResultOrder,
useSearchCubesQuery,
} from "@/graphql/query-hooks";
import {
SearchCubeFilterType,
SearchCubeResultOrder,
} from "@/graphql/resolver-types";
import { Icon } from "@/icons";
import SvgIcClose from "@/icons/components/IcClose";
import SvgIcInfoCircle from "@/icons/components/IcInfoCircle";
Expand Down Expand Up @@ -235,7 +238,7 @@ export const AddDatasetDrawer = ({
const classes = useStyles();

const [query, setQuery] = useState("");
const [order, setOrder] = useState<SearchCubeResultOrder>(
const [order, setOrder] = useState<TSearchCubeResultOrder>(
SearchCubeResultOrder.Score
);
const [includeDrafts, setIncludeDrafts] = useState(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from "@/configurator/components/add-dataset-drawer/infer-join-by";
import { SearchOptions } from "@/configurator/components/add-dataset-drawer/types";
import { ComponentId, stringifyComponentId } from "@/graphql/make-component-id";
import { DataCubePublicationStatus, TimeUnit } from "@/graphql/query-hooks";
import { DataCubePublicationStatus, TimeUnit } from "@/graphql/resolver-types";

const selectedSearchDimensions: SearchOptions[] = [
{
Expand Down
2 changes: 1 addition & 1 deletion app/configurator/components/add-dataset-drawer/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Termset } from "@/domain/data";
import { ComponentId } from "@/graphql/make-component-id";
import { TimeUnit } from "@/graphql/query-hooks";
import { TimeUnit } from "@/graphql/resolver-types";

type OriginalId = {
/** Versioned cube IRI */
Expand Down
2 changes: 1 addition & 1 deletion app/configurator/components/ui-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
TemporalDimension,
TemporalEntityDimension,
} from "@/domain/data";
import { RelatedDimensionType, TimeUnit } from "@/graphql/query-hooks";
import { RelatedDimensionType, TimeUnit } from "@/graphql/resolver-types";
import { IconName } from "@/icons";
import { getTimeInterval } from "@/intervals";
import { getPalette } from "@/palettes";
Expand Down
9 changes: 6 additions & 3 deletions app/configurator/configurator-state/reducer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ import {
getOriginalIds,
isJoinByCube,
} from "@/graphql/join";
import { PossibleFilterValue } from "@/graphql/query-hooks";
import { PossibleFilterValue } from "@/graphql/resolver-types";
import { DEFAULT_CATEGORICAL_PALETTE_ID } from "@/palettes";
import { findInHierarchy } from "@/rdf/tree-utils";
import { theme } from "@/themes/theme";
Expand Down Expand Up @@ -203,7 +203,8 @@ export const applyTableDimensionToFilters = (props: {
type: "single",
// TODO, possibly in case of join by dimensions, we could get a value that is not part
// of the full range of values
value: possibleFilter?.value ?? dimension.values[0].value,
value:
(possibleFilter?.value as string | number) ?? dimension.values[0].value,
};
}
};
Expand Down Expand Up @@ -269,7 +270,9 @@ export const applyNonTableDimensionToFilters = (props: {
: undefined;
const filterValue = hierarchyTopMost
? hierarchyTopMost.value
: (possibleFilter?.value ?? dimension.values[0]?.value);
: ((possibleFilter?.value ?? dimension.values[0]?.value) as
| string
| number);

if (filterValue) {
filters[dimension.id] = {
Expand Down
2 changes: 1 addition & 1 deletion app/configurator/interactive-filters/editor-brush.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useCallback, useEffect, useRef } from "react";

import { Flex } from "@/components/flex";
import { useTimeFormatUnit } from "@/formatters";
import { TimeUnit } from "@/graphql/query-hooks";
import { TimeUnit } from "@/graphql/resolver-types";
import { useTheme } from "@/themes";
import { useResizeObserver } from "@/utils/use-resize-observer";

Expand Down
Loading
Loading