Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Login improvements #1210

Merged
merged 25 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
49407e6
style: Profile table adjustments
bprusinowski Oct 11, 2023
e4ba16e
feat: Add published date to profile table
bprusinowski Oct 11, 2023
4fe1150
feat: Add profile table Actions tooltip
bprusinowski Oct 11, 2023
0f6f811
feat: Add link to dataset title in profile table
bprusinowski Oct 11, 2023
40d9a1c
style: Update style of user name
bprusinowski Oct 11, 2023
2d079e3
refactor: Share componentIris at a higher level
bprusinowski Oct 11, 2023
7c4c9e9
refactor: Copy instead of from
bprusinowski Oct 11, 2023
9ae320d
feat: Add a chart copy option to profile table
bprusinowski Oct 11, 2023
062403f
feat: Sort user configs by default
bprusinowski Oct 11, 2023
3f7c162
feat: Add preview mode to visualizations table
bprusinowski Oct 11, 2023
1539764
refactor: Abstract profile Actions
bprusinowski Oct 11, 2023
d82ee4c
fix: Import
bprusinowski Oct 11, 2023
3dca617
refactor: Abstract ProfileTable
bprusinowski Oct 11, 2023
8d1c2c1
feat: Add logic to remove configs from database
bprusinowski Oct 11, 2023
80338db
fix: Keep locale when using browse button (user profile)
bprusinowski Oct 11, 2023
80103fd
chore: Remove console.logs
bprusinowski Oct 12, 2023
a89a62c
style: Use flex layout
bprusinowski Oct 12, 2023
9d3962f
chore: Remove favorite visualizations tab
bprusinowski Oct 12, 2023
990513a
refactor: Keep user configs in state to enable re-rendering when they…
bprusinowski Oct 12, 2023
e1c652a
feat: Add chart removal button
bprusinowski Oct 12, 2023
3b0865c
chore: Add translations
bprusinowski Oct 12, 2023
9ebb3ad
docs: Update CHANGELOG
bprusinowski Oct 12, 2023
ec2b57a
chore: Translate browse all datasets button
bprusinowski Oct 12, 2023
32d593e
chore: Remove unused
bprusinowski Oct 12, 2023
828ac06
refactor: Separate confirmation title and text
bprusinowski Oct 12, 2023
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
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
Loading