Skip to content

Commit

Permalink
Merge pull request #1210 from visualize-admin/feat/login-continuation
Browse files Browse the repository at this point in the history
feat: Login improvements
  • Loading branch information
bprusinowski authored Oct 12, 2023
2 parents f4547b4 + 828ac06 commit d7243c9
Show file tree
Hide file tree
Showing 34 changed files with 998 additions and 159 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ You can also check the [release page](https://github.com/visualize-admin/visuali

- Features
- Added a new group of charts – Combo charts – that includes multi-measure line, dual-axis line and column-line charts
- Added a way to edit and remove charts for logged in users
- Improved user profile page

# [3.22.9] - 2023-10-06

Expand Down
4 changes: 2 additions & 2 deletions app/browse/datatable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { ascending, descending } from "d3";
import { useMemo, useRef, useState } from "react";

import {
extractComponentIris,
extractChartConfigComponentIris,
useQueryFilters,
} from "@/charts/shared/chart-helpers";
import { Loading } from "@/components/hint";
Expand Down Expand Up @@ -246,7 +246,7 @@ export const DataSetTable = ({
sx?: SxProps<Theme>;
}) => {
const locale = useLocale();
const componentIris = extractComponentIris(chartConfig);
const componentIris = extractChartConfigComponentIris(chartConfig);
const filters = useQueryFilters({ chartConfig });
const commonQueryVariables = {
iri: dataSetIri,
Expand Down
2 changes: 1 addition & 1 deletion app/browser/dataset-browse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ const NavSection = ({
color="inherit"
onClick={open}
>
Show all
<Trans id="show.all">Show all</Trans>
</Button>
)}
</Box>
Expand Down
8 changes: 2 additions & 6 deletions app/charts/area/chart-area.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { ChartLoadingWrapper } from "@/charts/chart-loading-wrapper";
import { AxisHeightLinear } from "@/charts/shared/axis-height-linear";
import { AxisTime, AxisTimeDomain } from "@/charts/shared/axis-width-time";
import { BrushTime } from "@/charts/shared/brush";
import { extractComponentIris } from "@/charts/shared/chart-helpers";
import {
ChartContainer,
ChartControlsContainer,
Expand All @@ -31,18 +30,15 @@ export const ChartAreasVisualization = ({
dataSource,
chartConfig,
queryFilters,
published,
componentIris,
}: {
dataSetIri: string;
dataSource: DataSource;
chartConfig: AreaConfig;
queryFilters: QueryFilters;
published: boolean;
componentIris: string[] | undefined;
}) => {
const locale = useLocale();
const componentIris = published
? extractComponentIris(chartConfig)
: undefined;
const commonQueryVariables = {
iri: dataSetIri,
sourceType: dataSource.type,
Expand Down
8 changes: 2 additions & 6 deletions app/charts/column/chart-column.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
AxisWidthBandDomain,
} from "@/charts/shared/axis-width-band";
import { BrushTime } from "@/charts/shared/brush";
import { extractComponentIris } from "@/charts/shared/chart-helpers";
import {
ChartContainer,
ChartControlsContainer,
Expand All @@ -39,20 +38,17 @@ import { ChartProps } from "../shared/ChartProps";
export const ChartColumnsVisualization = ({
dataSetIri,
dataSource,
componentIris,
chartConfig,
queryFilters,
published,
}: {
dataSetIri: string;
dataSource: DataSource;
componentIris: string[] | undefined;
chartConfig: ColumnConfig;
queryFilters: QueryFilters;
published: boolean;
}) => {
const locale = useLocale();
const componentIris = published
? extractComponentIris(chartConfig)
: undefined;
const commonQueryVariables = {
iri: dataSetIri,
sourceType: dataSource.type,
Expand Down
8 changes: 2 additions & 6 deletions app/charts/combo/chart-combo-line-column.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { ComboLineColumn } from "@/charts/combo/combo-line-column";
import { ComboLineColumnChart } from "@/charts/combo/combo-line-column-state";
import { AxisWidthBand } from "@/charts/shared/axis-width-band";
import { BrushTime } from "@/charts/shared/brush";
import { extractComponentIris } from "@/charts/shared/chart-helpers";
import { ChartContainer, ChartSvg } from "@/charts/shared/containers";
import { HoverDotMultiple } from "@/charts/shared/interaction/hover-dots-multiple";
import { Ruler } from "@/charts/shared/interaction/ruler";
Expand All @@ -29,20 +28,17 @@ import { ChartProps } from "../shared/ChartProps";
type ChartComboLineColumnVisualizationProps = {
dataSetIri: string;
dataSource: DataSource;
componentIris: string[] | undefined;
chartConfig: ComboLineColumnConfig;
queryFilters: QueryFilters;
published: boolean;
};

export const ChartComboLineColumnVisualization = (
props: ChartComboLineColumnVisualizationProps
) => {
const { dataSetIri, dataSource, chartConfig, queryFilters, published } =
const { dataSetIri, dataSource, componentIris, chartConfig, queryFilters } =
props;
const locale = useLocale();
const componentIris = published
? extractComponentIris(chartConfig)
: undefined;
const commonQueryVariables = {
iri: dataSetIri,
sourceType: dataSource.type,
Expand Down
8 changes: 2 additions & 6 deletions app/charts/combo/chart-combo-line-dual.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { ComboLineDual } from "@/charts/combo/combo-line-dual";
import { ComboLineDualChart } from "@/charts/combo/combo-line-dual-state";
import { AxisTime, AxisTimeDomain } from "@/charts/shared/axis-width-time";
import { BrushTime } from "@/charts/shared/brush";
import { extractComponentIris } from "@/charts/shared/chart-helpers";
import { ChartContainer, ChartSvg } from "@/charts/shared/containers";
import { HoverDotMultiple } from "@/charts/shared/interaction/hover-dots-multiple";
import { Ruler } from "@/charts/shared/interaction/ruler";
Expand All @@ -25,20 +24,17 @@ import { ChartProps } from "../shared/ChartProps";
type ChartComboLineDualVisualizationProps = {
dataSetIri: string;
dataSource: DataSource;
componentIris: string[] | undefined;
chartConfig: ComboLineDualConfig;
queryFilters: QueryFilters;
published: boolean;
};

export const ChartComboLineDualVisualization = (
props: ChartComboLineDualVisualizationProps
) => {
const { dataSetIri, dataSource, chartConfig, queryFilters, published } =
const { dataSetIri, dataSource, componentIris, chartConfig, queryFilters } =
props;
const locale = useLocale();
const componentIris = published
? extractComponentIris(chartConfig)
: undefined;
const commonQueryVariables = {
iri: dataSetIri,
sourceType: dataSource.type,
Expand Down
8 changes: 2 additions & 6 deletions app/charts/combo/chart-combo-line-single.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { ComboLineSingleChart } from "@/charts/combo/combo-line-single-state";
import { AxisHeightLinear } from "@/charts/shared/axis-height-linear";
import { AxisTime, AxisTimeDomain } from "@/charts/shared/axis-width-time";
import { BrushTime } from "@/charts/shared/brush";
import { extractComponentIris } from "@/charts/shared/chart-helpers";
import {
ChartContainer,
ChartControlsContainer,
Expand Down Expand Up @@ -34,20 +33,17 @@ import { ChartProps } from "../shared/ChartProps";
type ChartComboLineSingleVisualizationProps = {
dataSetIri: string;
dataSource: DataSource;
componentIris: string[] | undefined;
chartConfig: ComboLineSingleConfig;
queryFilters: QueryFilters;
published: boolean;
};

export const ChartComboLineSingleVisualization = (
props: ChartComboLineSingleVisualizationProps
) => {
const { dataSetIri, dataSource, chartConfig, queryFilters, published } =
const { dataSetIri, dataSource, componentIris, chartConfig, queryFilters } =
props;
const locale = useLocale();
const componentIris = published
? extractComponentIris(chartConfig)
: undefined;
const commonQueryVariables = {
iri: dataSetIri,
sourceType: dataSource.type,
Expand Down
8 changes: 2 additions & 6 deletions app/charts/line/chart-lines.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { LineChart } from "@/charts/line/lines-state";
import { AxisHeightLinear } from "@/charts/shared/axis-height-linear";
import { AxisTime, AxisTimeDomain } from "@/charts/shared/axis-width-time";
import { BrushTime } from "@/charts/shared/brush";
import { extractComponentIris } from "@/charts/shared/chart-helpers";
import {
ChartContainer,
ChartControlsContainer,
Expand All @@ -30,20 +29,17 @@ import { ChartProps } from "../shared/ChartProps";
export const ChartLinesVisualization = ({
dataSetIri,
dataSource,
componentIris,
chartConfig,
queryFilters,
published,
}: {
dataSetIri: string;
dataSource: DataSource;
componentIris: string[] | undefined;
chartConfig: LineConfig;
queryFilters: QueryFilters;
published: boolean;
}) => {
const locale = useLocale();
const componentIris = published
? extractComponentIris(chartConfig)
: undefined;
const commonQueryVariables = {
iri: dataSetIri,
sourceType: dataSource.type,
Expand Down
8 changes: 2 additions & 6 deletions app/charts/map/chart-map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { MapComponent } from "@/charts/map/map";
import { MapLegend } from "@/charts/map/map-legend";
import { MapChart } from "@/charts/map/map-state";
import { MapTooltip } from "@/charts/map/map-tooltip";
import { extractComponentIris } from "@/charts/shared/chart-helpers";
import {
ChartContainer,
ChartControlsContainer,
Expand All @@ -29,15 +28,15 @@ import { ChartProps } from "../shared/ChartProps";
export const ChartMapVisualization = ({
dataSetIri,
dataSource,
componentIris,
chartConfig,
queryFilters,
published,
}: {
dataSetIri: string;
dataSource: DataSource;
componentIris: string[] | undefined;
chartConfig: MapConfig;
queryFilters: QueryFilters;
published: boolean;
}) => {
const locale = useLocale();
const areaDimensionIri = chartConfig.fields.areaLayer?.componentIri || "";
Expand All @@ -48,9 +47,6 @@ export const ChartMapVisualization = ({
sourceUrl: dataSource.url,
locale,
};
const componentIris = published
? extractComponentIris(chartConfig)
: undefined;
const [metadataQuery] = useDataCubeMetadataQuery({
variables: commonQueryVariables,
});
Expand Down
11 changes: 2 additions & 9 deletions app/charts/pie/chart-pie.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { memo } from "react";
import { ChartLoadingWrapper } from "@/charts/chart-loading-wrapper";
import { Pie } from "@/charts/pie/pie";
import { PieChart } from "@/charts/pie/pie-state";
import { extractComponentIris } from "@/charts/shared/chart-helpers";
import {
ChartContainer,
ChartControlsContainer,
Expand All @@ -26,20 +25,17 @@ import { ChartProps } from "../shared/ChartProps";
export const ChartPieVisualization = ({
dataSetIri,
dataSource,
componentIris,
chartConfig,
queryFilters,
published,
}: {
dataSetIri: string;
dataSource: DataSource;
componentIris: string[] | undefined;
chartConfig: PieConfig;
queryFilters: QueryFilters;
published: boolean;
}) => {
const locale = useLocale();
const componentIris = published
? extractComponentIris(chartConfig)
: undefined;
const commonQueryVariables = {
iri: dataSetIri,
sourceType: dataSource.type,
Expand Down Expand Up @@ -70,9 +66,6 @@ export const ChartPieVisualization = ({
observationsQuery={observationsQuery}
chartConfig={chartConfig}
Component={ChartPie}
ComponentProps={{
published,
}}
/>
);
};
Expand Down
11 changes: 2 additions & 9 deletions app/charts/scatterplot/chart-scatterplot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
AxisWidthLinear,
AxisWidthLinearDomain,
} from "@/charts/shared/axis-width-linear";
import { extractComponentIris } from "@/charts/shared/chart-helpers";
import {
ChartContainer,
ChartControlsContainer,
Expand All @@ -34,20 +33,17 @@ import { ChartProps } from "../shared/ChartProps";
export const ChartScatterplotVisualization = ({
dataSetIri,
dataSource,
componentIris,
chartConfig,
queryFilters,
published,
}: {
dataSetIri: string;
dataSource: DataSource;
componentIris: string[] | undefined;
chartConfig: ScatterPlotConfig;
queryFilters: QueryFilters;
published: boolean;
}) => {
const locale = useLocale();
const componentIris = published
? extractComponentIris(chartConfig)
: undefined;
const commonQueryVariables = {
iri: dataSetIri,
sourceType: dataSource.type,
Expand Down Expand Up @@ -77,9 +73,6 @@ export const ChartScatterplotVisualization = ({
componentsQuery={componentsQuery}
observationsQuery={observationsQuery}
Component={ChartScatterplot}
ComponentProps={{
published,
}}
chartConfig={chartConfig}
/>
);
Expand Down
6 changes: 3 additions & 3 deletions app/charts/shared/chart-helpers.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { InternMap } from "d3";
import merge from "lodash/merge";

import {
extractComponentIris,
extractChartConfigComponentIris,
getWideData,
prepareQueryFilters,
} from "@/charts/shared/chart-helpers";
Expand Down Expand Up @@ -156,7 +156,7 @@ describe("getChartConfigComponentIris", () => {
const mapConfig = map1Fixture.data.chartConfig as unknown as MapConfig;

it("should return correct componentIris for line chart", () => {
const componentsIris = extractComponentIris(lineConfig);
const componentsIris = extractChartConfigComponentIris(lineConfig);
expect(componentsIris).toEqual([
"http://environment.ld.admin.ch/foen/px/0703010000_105/dimension/0",
"http://environment.ld.admin.ch/foen/px/0703010000_105/measure/0",
Expand All @@ -168,7 +168,7 @@ describe("getChartConfigComponentIris", () => {
});

it("should return correct componentIris for map chart", () => {
const componentsIris = extractComponentIris(mapConfig);
const componentsIris = extractChartConfigComponentIris(mapConfig);
expect(componentsIris).toEqual([
"https://environment.ld.admin.ch/foen/nfi/unitOfReference",
"https://environment.ld.admin.ch/foen/nfi/Topic/3r",
Expand Down
Loading

1 comment on commit d7243c9

@vercel
Copy link

@vercel vercel bot commented on d7243c9 Oct 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

visualization-tool – ./

visualization-tool-alpha.vercel.app
visualization-tool-git-main-ixt1.vercel.app
visualization-tool-ixt1.vercel.app

Please sign in to comment.