Skip to content

Commit

Permalink
Merge pull request #2354 from Plant-for-the-Planet-org/develop
Browse files Browse the repository at this point in the history
Release small fixes
  • Loading branch information
mariahosfeld authored Jan 9, 2025
2 parents b57cf06 + 6ca92a0 commit 9a3412c
Show file tree
Hide file tree
Showing 109 changed files with 1,138 additions and 991 deletions.
22 changes: 12 additions & 10 deletions pages/sites/[slug]/[locale]/[p].tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type {
GetStaticPaths,
GetStaticProps,
GetStaticPropsContext,
GetStaticPropsResult,
Expand Down Expand Up @@ -60,18 +61,19 @@ ProjectDetailsPage.getLayout = function getLayout(

export default ProjectDetailsPage;

export const getStaticPaths = async () => {
export const getStaticPaths: GetStaticPaths = async () => {
const subDomainPaths = await constructPathsForTenantSlug();

const paths = subDomainPaths?.map((path) => {
return {
params: {
slug: path.params.slug,
p: v4(),
locale: 'en',
},
};
});
const paths =
subDomainPaths?.map((path) => {
return {
params: {
slug: path.params.slug,
p: v4(),
locale: 'en',
},
};
}) ?? [];

return {
paths,
Expand Down
44 changes: 23 additions & 21 deletions pages/sites/[slug]/[locale]/all.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type {
} from '../../../../src/features/common/types/leaderboard';
import type { Tenant } from '@planet-sdk/common/build/types/tenant';
import type {
GetStaticPaths,
GetStaticProps,
GetStaticPropsContext,
GetStaticPropsResult,
Expand Down Expand Up @@ -49,10 +50,10 @@ export default function Home({ pageProps }: Props) {
React.useEffect(() => {
async function loadLeaderboard() {
try {
const newLeaderboard = await getRequest<LeaderBoardList>(
pageProps.tenantConfig.id,
`/app/leaderboard/${pageProps.tenantConfig.id}`
);
const newLeaderboard = await getRequest<LeaderBoardList>({
tenant: pageProps.tenantConfig.id,
url: `/app/leaderboard/${pageProps.tenantConfig.id}`,
});
setLeaderboard(newLeaderboard);
} catch (err) {
setErrors(handleError(err as APIError));
Expand All @@ -68,10 +69,10 @@ export default function Home({ pageProps }: Props) {
React.useEffect(() => {
async function loadTenantScore() {
try {
const newTenantScore = await getRequest<TenantScore>(
pageProps.tenantConfig.id,
`/app/tenantScore/${pageProps.tenantConfig.id}`
);
const newTenantScore = await getRequest<TenantScore>({
tenant: pageProps.tenantConfig.id,
url: `/app/tenantScore/${pageProps.tenantConfig.id}`,
});
setTenantScore(newTenantScore);
} catch (err) {
setErrors(handleError(err as APIError));
Expand All @@ -87,10 +88,10 @@ export default function Home({ pageProps }: Props) {
React.useEffect(() => {
async function loadTreesDonated() {
try {
const newTreesDonated = await getRequest<TreesDonated>(
pageProps.tenantConfig.id,
`${process.env.WEBHOOK_URL}/platform/total-tree-count`
);
const newTreesDonated = await getRequest<TreesDonated>({
tenant: pageProps.tenantConfig.id,
url: `${process.env.WEBHOOK_URL}/platform/total-tree-count`,
});
setTreesDonated(newTreesDonated);
} catch (err) {
setErrors(handleError(err as APIError));
Expand Down Expand Up @@ -136,17 +137,18 @@ export default function Home({ pageProps }: Props) {
);
}

export const getStaticPaths = async () => {
export const getStaticPaths: GetStaticPaths = async () => {
const subDomainPaths = await constructPathsForTenantSlug();

const paths = subDomainPaths.map((path) => {
return {
params: {
slug: path.params.slug,
locale: 'en',
},
};
});
const paths =
subDomainPaths?.map((path) => {
return {
params: {
slug: path.params.slug,
locale: 'en',
},
};
}) ?? [];

return {
paths,
Expand Down
36 changes: 19 additions & 17 deletions pages/sites/[slug]/[locale]/claim/[type]/[code].tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { ReactElement } from 'react';
import type {
GetStaticPaths,
GetStaticProps,
GetStaticPropsContext,
GetStaticPropsResult,
Expand Down Expand Up @@ -83,13 +84,13 @@ function ClaimDonation({ pageProps }: Props): ReactElement {
};
if (contextLoaded && user) {
try {
const res = await postAuthenticatedRequest<RedeemedCodeData>(
pageProps.tenantConfig.id,
`/app/redeem`,
submitData,
const res = await postAuthenticatedRequest<RedeemedCodeData>({
tenant: pageProps.tenantConfig.id,
url: `/app/redeem`,
data: submitData,
token,
logoutUser
);
logoutUser,
});
setRedeemedCodeData(res);
} catch (err) {
const serializedErrors = handleError(err as APIError);
Expand Down Expand Up @@ -185,19 +186,20 @@ function ClaimDonation({ pageProps }: Props): ReactElement {
);
}

export const getStaticPaths = async () => {
export const getStaticPaths: GetStaticPaths = async () => {
const subDomainPaths = await constructPathsForTenantSlug();

const paths = subDomainPaths?.map((path) => {
return {
params: {
slug: path.params.slug,
type: v4(),
code: v4(),
locale: 'en',
},
};
});
const paths =
subDomainPaths?.map((path) => {
return {
params: {
slug: path.params.slug,
type: v4(),
code: v4(),
locale: 'en',
},
};
}) ?? [];

return {
paths: paths,
Expand Down
20 changes: 11 additions & 9 deletions pages/sites/[slug]/[locale]/complete-signup.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Tenant } from '@planet-sdk/common/build/types/tenant';
import type {
GetStaticPaths,
GetStaticProps,
GetStaticPropsContext,
GetStaticPropsResult,
Expand Down Expand Up @@ -44,17 +45,18 @@ export default function UserProfile({ pageProps }: Props) {
);
}

export const getStaticPaths = async () => {
export const getStaticPaths: GetStaticPaths = async () => {
const subDomainPaths = await constructPathsForTenantSlug();

const paths = subDomainPaths.map((path) => {
return {
params: {
slug: path.params.slug,
locale: 'en',
},
};
});
const paths =
subDomainPaths?.map((path) => {
return {
params: {
slug: path.params.slug,
locale: 'en',
},
};
}) ?? [];

return {
paths,
Expand Down
36 changes: 19 additions & 17 deletions pages/sites/[slug]/[locale]/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type {
} from '../../../../src/features/common/types/leaderboard';
import type { Tenant } from '@planet-sdk/common/build/types/tenant';
import type {
GetStaticPaths,
GetStaticProps,
GetStaticPropsContext,
GetStaticPropsResult,
Expand Down Expand Up @@ -54,10 +55,10 @@ export default function Home({ pageProps }: Props) {
React.useEffect(() => {
async function loadTenantScore() {
try {
const newTenantScore = await getRequest<TenantScore>(
pageProps.tenantConfig.id,
`/app/tenantScore`
);
const newTenantScore = await getRequest<TenantScore>({
tenant: pageProps.tenantConfig.id,
url: `/app/tenantScore`,
});
setTenantScore(newTenantScore);
} catch (err) {
setErrors(handleError(err as APIError));
Expand All @@ -69,10 +70,10 @@ export default function Home({ pageProps }: Props) {
React.useEffect(() => {
async function loadLeaderboard() {
try {
const newLeaderBoard = await getRequest<LeaderBoardList>(
pageProps.tenantConfig.id,
`/app/leaderboard`
);
const newLeaderBoard = await getRequest<LeaderBoardList>({
tenant: pageProps.tenantConfig.id,
url: `/app/leaderboard`,
});
setLeaderboard(newLeaderBoard);
} catch (err) {
setErrors(handleError(err as APIError));
Expand Down Expand Up @@ -131,17 +132,18 @@ export default function Home({ pageProps }: Props) {
);
}

export const getStaticPaths = async () => {
export const getStaticPaths: GetStaticPaths = async () => {
const subDomainPaths = await constructPathsForTenantSlug();

const paths = subDomainPaths.map((path) => {
return {
params: {
slug: path.params.slug,
locale: 'en',
},
};
});
const paths =
subDomainPaths?.map((path) => {
return {
params: {
slug: path.params.slug,
locale: 'en',
},
};
}) ?? [];

return {
paths,
Expand Down
20 changes: 11 additions & 9 deletions pages/sites/[slug]/[locale]/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type {
GetStaticPaths,
GetStaticProps,
GetStaticPropsContext,
GetStaticPropsResult,
Expand Down Expand Up @@ -56,17 +57,18 @@ ProjectListPage.getLayout = function getLayout(

export default ProjectListPage;

export const getStaticPaths = async () => {
export const getStaticPaths: GetStaticPaths = async () => {
const subDomainPaths = await constructPathsForTenantSlug();

const paths = subDomainPaths?.map((path) => {
return {
params: {
slug: path.params.slug,
locale: 'en',
},
};
});
const paths =
subDomainPaths?.map((path) => {
return {
params: {
slug: path.params.slug,
locale: 'en',
},
};
}) ?? [];

return {
paths,
Expand Down
20 changes: 11 additions & 9 deletions pages/sites/[slug]/[locale]/login.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { ReactElement } from 'react';
import type { Tenant } from '@planet-sdk/common/build/types/tenant';
import type {
GetStaticPaths,
GetStaticProps,
GetStaticPropsContext,
GetStaticPropsResult,
Expand Down Expand Up @@ -85,17 +86,18 @@ export default function Login({ pageProps }: Props): ReactElement {
);
}

export const getStaticPaths = async () => {
export const getStaticPaths: GetStaticPaths = async () => {
const subDomainPaths = await constructPathsForTenantSlug();

const paths = subDomainPaths?.map((path) => {
return {
params: {
slug: path.params.slug,
locale: 'en',
},
};
});
const paths =
subDomainPaths?.map((path) => {
return {
params: {
slug: path.params.slug,
locale: 'en',
},
};
}) ?? [];

return {
paths,
Expand Down
3 changes: 2 additions & 1 deletion pages/sites/[slug]/[locale]/mangrove-challenge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type {
import type { AbstractIntlMessages } from 'next-intl';
import type { Tenant } from '@planet-sdk/common';
import type {
GetStaticPaths,
GetStaticProps,
GetStaticPropsContext,
GetStaticPropsResult,
Expand Down Expand Up @@ -99,7 +100,7 @@ export default function MangroveChallenge({
);
}

export const getStaticPaths = async () => {
export const getStaticPaths: GetStaticPaths = async () => {
return {
paths: [{ params: { slug: 'salesforce', locale: 'en' } }],
fallback: 'blocking',
Expand Down
5 changes: 3 additions & 2 deletions pages/sites/[slug]/[locale]/mangroves.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import type { AbstractIntlMessages } from 'next-intl';
import type { Tenant } from '@planet-sdk/common';
import type {
GetStaticPaths,
GetStaticProps,
GetStaticPropsContext,
GetStaticPropsResult,
} from 'next';

import React, { useEffect } from 'react';
import Mangroves from '../../../../src/tenants/salesforce/Mangroves';
import GetHomeMeta from '../../../../src/utils/getMetaTags/GetHomeMeta';
import Mangroves from '../../../../src/tenants/salesforce/Mangroves';
import { getTenantConfig } from '../../../../src/utils/multiTenancy/helpers';
import { defaultTenant } from '../../../../tenant.config';
import getMessagesForPage from '../../../../src/utils/language/getMessagesForPage';
Expand Down Expand Up @@ -51,7 +52,7 @@ export default function MangrovesLandingPage({
);
}

export const getStaticPaths = async () => {
export const getStaticPaths: GetStaticPaths = async () => {
return {
paths: [{ params: { slug: 'salesforce', locale: 'en' } }],
fallback: 'blocking',
Expand Down
Loading

0 comments on commit 9a3412c

Please sign in to comment.