Skip to content

Commit 51c1b19

Browse files
authored
Merge pull request #206 from Vizzuality/feat/project-status
project status and dependecies updates
2 parents d123137 + f3f1924 commit 51c1b19

31 files changed

Lines changed: 1006 additions & 308 deletions

File tree

client/next.config.mjs

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,25 @@ const nextConfig = {
55
images: {
66
unoptimized: true,
77
remotePatterns: [
8-
{
9-
protocol: "https",
10-
hostname: "api.mapbox.com",
11-
},
12-
{
13-
protocol: "http",
14-
hostname: "0.0.0.0",
15-
},
16-
{
17-
protocol: "https",
18-
hostname: "staging.ccsa.dev-vizzuality.com",
19-
},
20-
{
21-
protocol: "https",
22-
hostname: "map.caribbeanaccelerator.org",
23-
},
8+
{ protocol: "https", hostname: "api.mapbox.com" },
9+
{ protocol: "http", hostname: "0.0.0.0" },
10+
{ protocol: "https", hostname: "staging.ccsa.dev-vizzuality.com" },
11+
{ protocol: "https", hostname: "map.caribbeanaccelerator.org" },
2412
],
2513
},
14+
15+
// Turbopack config (replaces webpack rules when using --turbopack)
16+
turbopack: {
17+
rules: {
18+
"*.svg": {
19+
loaders: ["@svgr/webpack"],
20+
as: "*.js",
21+
},
22+
},
23+
},
24+
25+
// Keep webpack config for non-turbopack builds (next build / dev w/o turbopack)
2626
webpack: (config) => {
27-
// Fixes warning Critical dependency: the request of a dependency is an expression
2827
config.module = {
2928
...config.module,
3029
exprContextCritical: false,

client/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,21 @@
4949
"@uiw/react-md-editor": "^4.0.4",
5050
"@vinhpd/react-simple-captcha": "^9.0.1",
5151
"autoprefixer": "10.4.16",
52-
"axios": "^1.5.1",
52+
"axios": "1.13.5",
5353
"class-variance-authority": "0.7.0",
5454
"clsx": "2.0.0",
5555
"cmdk": "^0.2.0",
5656
"deck.gl": "^8.9.31",
5757
"eslint-plugin-import": "2.29.1",
5858
"export-to-csv": "1.2.1",
59-
"express": "4.18.2",
59+
"express": "4.20.0",
6060
"glslify": "^7.1.1",
6161
"jotai": "^2.5.0",
6262
"jwt-decode": "4.0.0",
63-
"lodash-es": "^4.17.21",
63+
"lodash-es": "4.17.23",
6464
"mapbox-gl": "2.15.0",
65-
"next": "^14.0.3",
66-
"next-auth": "4.24.7",
65+
"next": "16.1.6",
66+
"next-auth": "4.24.12",
6767
"next-usequerystate": "^1.9.1",
6868
"pino": "8.15.1",
6969
"pino-http": "8.5.0",

client/src/app/(app)/layout.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { PropsWithChildren } from "react";
22

3-
import dynamic from "next/dynamic";
43
import { headers } from "next/headers";
54

65
import { Hydrate, dehydrate } from "@tanstack/react-query";
@@ -31,10 +30,10 @@ import Sidebar from "@/containers/sidebar";
3130
import LayoutProviders from "./layout-providers";
3231
import { getGetWelcomeMessageQueryOptions } from "@/types/generated/welcome-message";
3332

34-
const WelcomeMessage = dynamic(() => import("@/containers/welcome-message"), { ssr: false });
33+
import WelcomeMessageWrapper from "@/containers/welcome-message/wrapper";
3534

3635
export default async function AppLayout({ children }: PropsWithChildren) {
37-
const url = new URL(headers().get("x-url")!);
36+
const url = new URL((await headers()).get("x-url")!);
3837
const searchParams = url.searchParams;
3938

4039
const queryClient = getQueryClient();
@@ -81,9 +80,11 @@ export default async function AppLayout({ children }: PropsWithChildren) {
8180
// Prefetch collaborators
8281
await queryClient.prefetchQuery(getGetCollaboratorsQueryOptions());
8382

84-
await queryClient.prefetchQuery(getGetWelcomeMessageQueryOptions({
85-
populate: ["video", "image"],
86-
}));
83+
await queryClient.prefetchQuery(
84+
getGetWelcomeMessageQueryOptions({
85+
populate: ["video", "image"],
86+
}),
87+
);
8788

8889
const dehydratedState = dehydrate(queryClient);
8990

@@ -96,7 +97,7 @@ export default async function AppLayout({ children }: PropsWithChildren) {
9697
<Map />
9798
</main>
9899

99-
<WelcomeMessage />
100+
<WelcomeMessageWrapper />
100101
</Hydrate>
101102
</LayoutProviders>
102103
);

client/src/app/(dashboard)/dashboard/datasets/changes-to-approve/[id]/page.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ export const viewport: Viewport = {
3535
initialScale: 1,
3636
};
3737

38-
export default async function ChangesToApprovePage({ params }: { params: { id: number } }) {
39-
const { id } = params;
38+
export default async function ChangesToApprovePage(props: { params: Promise<{ id: string }> }) {
39+
const params = await props.params;
40+
const id = parseInt(params.id);
4041
const queryClient = getQueryClient();
4142

4243
await queryClient.prefetchQuery(

client/src/app/(dashboard)/dashboard/datasets/edit/[id]/page.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ export const viewport: Viewport = {
3030
initialScale: 1,
3131
};
3232

33-
export default async function EditDatasetPage({ params }: { params: { id: number } }) {
34-
const { id } = params;
33+
export default async function EditDatasetPage({ params }: { params: Promise<{ id: string }> }) {
34+
const { id: idString } = await params;
35+
const id = parseInt(idString, 10);
3536
const queryClient = getQueryClient();
3637

3738
await queryClient.prefetchQuery(

client/src/app/(embed)/embed/layout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ import Map from "@/containers/map";
2828
import LayoutProviders from "./layout-providers";
2929

3030
export default async function EmbedLayout({ children }: PropsWithChildren) {
31-
const url = new URL(headers().get("x-url")!);
31+
const headersList = await headers();
32+
const url = new URL(headersList.get("x-url")!);
3233
const searchParams = url.searchParams;
3334

3435
const queryClient = getQueryClient();

client/src/app/parsers.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ export const projectParser = parseAsInteger;
2727
export const pillarsParser = parseAsArrayOf(parseAsInteger).withDefault([]);
2828
export const availableForFundingParser = parseAsBoolean.withDefault(false);
2929
export const projectStatusParser = parseAsArrayOf(parseAsInteger).withDefault([]);
30-
export const projectStatusOrderParser = parseAsString.withDefault("asc");
3130
export const countriesParser = parseAsArrayOf(parseAsString).withDefault([]);
3231
export const publicationStateParser = parseAsString.withDefault("live");
3332
export const datasetStepParser = parseAsInteger.withDefault(1);

client/src/app/store.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import {
1616
projectParser,
1717
projectStatusParser,
1818
datasetStepParser,
19-
projectStatusOrderParser,
2019
} from "@/app/parsers";
2120

2221
import { Data, DatasetValuesCSV } from "@/components/forms/dataset/types";

client/src/components/forms/dataset/colors.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,9 @@ export default function DatasetColorsForm({
269269
};
270270

271271
const handleDelete = useCallback(() => {
272-
mutateDeleteDatasetsId({ id: +datasetId });
272+
if (!!datasetId) {
273+
mutateDeleteDatasetsId({ id: +datasetId });
274+
}
273275
}, [mutateDeleteDatasetsId, datasetId]);
274276

275277
const handleSubmit = useCallback(

client/src/components/forms/dataset/data.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ export default function DatasetDataForm({
103103
const URLParams = useSyncSearchParams();
104104
const params = useParams();
105105
const { id: datasetId } = params;
106-
const editedSuggestionData = useGetDatasetEditSuggestionsId(+datasetId);
106+
107+
const datasetIdNumber = Number(datasetId);
108+
const editedSuggestionData = useGetDatasetEditSuggestionsId(datasetIdNumber);
107109

108110
const { data: session } = useSession();
109111
const user = session?.user;
@@ -117,7 +119,7 @@ export default function DatasetDataForm({
117119
const { data: datasetValuesData } = useGetDatasetValues(
118120
{
119121
filters: {
120-
dataset: datasetId,
122+
dataset: datasetIdNumber,
121123
},
122124
"pagination[pageSize]": 300,
123125
populate: {
@@ -322,8 +324,8 @@ export default function DatasetDataForm({
322324
);
323325

324326
const handleDelete = useCallback(() => {
325-
mutateDeleteDatasetsId({ id: +datasetId });
326-
}, [mutateDeleteDatasetsId, datasetId]);
327+
mutateDeleteDatasetsId({ id: datasetIdNumber });
328+
}, [mutateDeleteDatasetsId, datasetIdNumber]);
327329

328330
const checkChanges = useCallback(
329331
(field: Field, index: number, param: ParamType) => {

0 commit comments

Comments
 (0)