Skip to content

Commit

Permalink
Merge pull request #299 from wri/release/jovial-jacaranda
Browse files Browse the repository at this point in the history
[RELEASE] Jovial Jacaranda
  • Loading branch information
roguenet committed Jul 9, 2024
2 parents 9a865fe + 91488a1 commit e7fb8bf
Show file tree
Hide file tree
Showing 540 changed files with 34,383 additions and 5,993 deletions.
5 changes: 4 additions & 1 deletion .env.local.sample
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ SENTRY_AUTH_TOKEN =
SENTRY_PROJECT =
SENTRY_ORG =



NEXT_PUBLIC_GEOSERVER_URL =
NEXT_PUBLIC_GEOSERVER_WORKSPACE =

2 changes: 1 addition & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const nextConfig = {
publicRuntimeConfig: {
TxNativePublicToken: process.env.TRANSIFEX_TOKEN
},
images: { domains: process.env.IMAGE_DOMAINS?.split(',') ?? ["s3-eu-west-1.amazonaws.com"] },
images: { domains: process.env.IMAGE_DOMAINS?.split(",") ?? ["s3-eu-west-1.amazonaws.com"] },
// webpack5: true,
webpack(config) {
config.module.rules.push({
Expand Down
26 changes: 26 additions & 0 deletions public/icons/ic-bg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/no-image-available.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/admin/apiProvider/dataProviders/formDataProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const handleOptionFilesUpload = async (response: NormalizedFormObject, payload:
upload(payloadOption.image.rawFile, {
collection: "image",
model: "form-question-option",
uuid: option.uuid
uuid: option.id
})
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/admin/apiProvider/utils/entryFormat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const isDateType = (value: any) => {
return isValid(parseISO(value));
};

const convertDateFormat = (value: any) => {
export const convertDateFormat = (value: any) => {
if (typeof value === "string") {
const dateObject = new Date(value);
const formattedDay = dateObject.getUTCDate().toString().padStart(2, "0");
Expand Down
4 changes: 2 additions & 2 deletions src/admin/components/Actions/ListActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ interface ListActionsProps {

const ListActions = (props: ListActionsProps) => (
<TopToolbar>
<FilterButton />
<FilterButton className="filter-button-page-admin" />
<When condition={!!props.onExport}>
<Button label="Export" startIcon={<DownloadIcon />} onClick={props.onExport} />
<Button className="button-page-admin" label="Export" startIcon={<DownloadIcon />} onClick={props.onExport} />
</When>
</TopToolbar>
);
Expand Down
18 changes: 18 additions & 0 deletions src/admin/components/Actions/ListActionsCreate.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import DownloadIcon from "@mui/icons-material/GetApp";
import { Button, CreateButton, TopToolbar } from "react-admin";
import { When } from "react-if";

interface ListActionsCreateProps {
onExport?: () => void;
}

const ListActionsCreate = ({ onExport }: ListActionsCreateProps) => (
<TopToolbar>
<CreateButton className="filter-button-page-admin" />
<When condition={!!onExport}>
<Button className="button-page-admin" label="Export" startIcon={<DownloadIcon />} onClick={onExport} />
</When>
</TopToolbar>
);

export default ListActionsCreate;
24 changes: 21 additions & 3 deletions src/admin/components/Actions/ShowActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ import {
DeleteWithConfirmButton,
DeleteWithConfirmButtonProps,
EditButton,
Link,
RaRecord,
TopToolbar,
useRecordContext
useRecordContext,
useResourceContext
} from "react-admin";
import { When } from "react-if";

import Icon, { IconNames } from "@/components/extensive/Icon/Icon";

import ShowTitle from "../ShowTitle";

interface IProps {
Expand All @@ -32,6 +36,7 @@ const ShowActions = ({
deleteProps = {}
}: IProps) => {
const record = useRecordContext<any>();
const resource = useResourceContext();

const title = titleSource ? get(record, titleSource) : "";

Expand All @@ -42,17 +47,30 @@ const ShowActions = ({

return (
<Box sx={{ display: "flex", alignItems: "center" }}>
<When condition={resource === "siteReport" || resource === "nurseryReport"}>
<Link to={`/${resource}`}>
<Icon name={IconNames.CHEVRON_LEFT_PA} className="mr-2 h-10 w-9" />
</Link>
</When>
<When condition={!!(title || getTitle)}>
<Typography variant="h4" component="h2" sx={{ flexGrow: 1 }}>
<ShowTitle moduleName={moduleName} getTitle={getTitle ? getTitle : () => title} />
</Typography>
</When>
<TopToolbar sx={{ marginBottom: 2, marginLeft: "auto" }}>
<When condition={record && hasDelete}>
<DeleteWithConfirmButton {...deleteProps} mutationMode="undoable" />
<DeleteWithConfirmButton
{...deleteProps}
mutationMode="undoable"
className="!text-sm !font-semibold !capitalize lg:!text-base wide:!text-md"
icon={<Icon className="h-5 w-5" name={IconNames.TRASH_PA} />}
/>
</When>
<When condition={record && hasEdit}>
<EditButton />
<EditButton
className="!text-sm !font-semibold !capitalize !text-blueCustom-900 lg:!text-base wide:!text-md"
icon={<Icon className="h-6 w-6" name={IconNames.EDIT} />}
/>
</When>
</TopToolbar>
</Box>
Expand Down
250 changes: 123 additions & 127 deletions src/admin/components/App.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
import { WatchLater } from "@mui/icons-material";
import ArticleIcon from "@mui/icons-material/Article";
import AttachMoneyIcon from "@mui/icons-material/AttachMoney";
import BusinessIcon from "@mui/icons-material/Business";
import ForestIcon from "@mui/icons-material/Forest";
import FullscreenIcon from "@mui/icons-material/Fullscreen";
import UserIcon from "@mui/icons-material/Group";
import LanguageIcon from "@mui/icons-material/Language";
import LibraryBooksIcon from "@mui/icons-material/LibraryBooks";
import SummarizeIcon from "@mui/icons-material/Summarize";
import { useEffect, useState } from "react";
import { Admin, Resource } from "react-admin";
Expand All @@ -15,6 +6,8 @@ import { authProvider } from "@/admin/apiProvider/authProvider";
import { dataProvider } from "@/admin/apiProvider/dataProviders";
import { AppLayout } from "@/admin/components/AppLayout";
import { theme } from "@/admin/components/theme";
import Icon, { IconNames } from "@/components/extensive/Icon/Icon";
import { LoadingProvider } from "@/context/loaderAdmin.provider";

import modules from "../modules";
import AdminLoginPage from "../pages/AdminLoginPage";
Expand All @@ -38,124 +31,127 @@ const App = () => {
}, [identity]);

return (
<Admin
theme={theme}
authProvider={authProvider}
dataProvider={dataProvider}
layout={AppLayout}
loginPage={AdminLoginPage}
>
<Resource
name={modules.user.ResourceName}
list={modules.user.List}
show={modules.user.Show}
edit={modules.user.Edit}
icon={UserIcon}
/>
<Resource
name={modules.organisation.ResourceName}
list={modules.organisation.List}
show={modules.organisation.Show}
edit={modules.organisation.Edit}
icon={BusinessIcon}
/>
<Resource
name={modules.pitch.ResourceName}
list={modules.pitch.List}
show={modules.pitch.Show}
edit={modules.pitch.Edit}
icon={ForestIcon}
/>
<Resource
name={modules.fundingProgramme.ResourceName}
list={modules.fundingProgramme.List}
edit={modules.fundingProgramme.Edit}
show={modules.fundingProgramme.Show}
create={modules.fundingProgramme.Create}
icon={AttachMoneyIcon}
options={{ label: "Funding Programmes" }}
/>
<Resource
name={modules.reportingFramework.ResourceName}
list={modules.reportingFramework.List}
show={modules.reportingFramework.Show}
edit={modules.reportingFramework.Edit}
{...(canCreate ? { create: modules.reportingFramework.Create } : null)}
icon={WatchLater}
options={{ label: "Reporting Frameworks" }}
/>
<Resource
name={modules.application.ResourceName}
list={modules.application.List}
show={modules.application.Show}
icon={LibraryBooksIcon}
/>
<Resource
name={modules.stage.ResourceName}
show={modules.stage.Show}
edit={modules.stage.Edit}
create={modules.stage.Create}
/>
<Resource
name={modules.form.ResourceName}
list={modules.form.List}
edit={modules.form.Edit}
create={modules.form.Create}
/>
<Resource
name={modules.project.ResourceName}
list={modules.project.List}
show={modules.project.Show}
edit={modules.project.Edit}
icon={ArticleIcon}
/>
<Resource
name={modules.site.ResourceName}
list={modules.site.List}
show={modules.site.Show}
edit={modules.site.Edit}
icon={LanguageIcon}
/>
<Resource
name={modules.nursery.ResourceName}
list={modules.nursery.List}
show={modules.nursery.Show}
edit={modules.nursery.Edit}
icon={FullscreenIcon}
/>
<Resource
name={modules.task.ResourceName}
list={modules.task.List}
show={modules.task.Show}
icon={SummarizeIcon}
options={{ label: "Tasks" }}
/>
<Resource
name={modules.projectReport.ResourceName}
list={modules.projectReport.List}
show={modules.projectReport.Show}
edit={modules.projectReport.Edit}
icon={SummarizeIcon}
options={{ label: "Project Reports" }}
/>
<Resource
name={modules.siteReport.ResourceName}
list={modules.siteReport.List}
show={modules.siteReport.Show}
edit={modules.siteReport.Edit}
icon={SummarizeIcon}
options={{ label: "Site Reports" }}
/>
<Resource
name={modules.nurseryReport.ResourceName}
list={modules.nurseryReport.List}
show={modules.nurseryReport.Show}
edit={modules.nurseryReport.Edit}
icon={SummarizeIcon}
options={{ label: "Nursery Reports" }}
/>
<Resource name={modules.audit.ResourceName} />
</Admin>
<LoadingProvider>
<Admin
theme={theme}
authProvider={authProvider}
dataProvider={dataProvider}
layout={AppLayout}
loginPage={AdminLoginPage}
>
<Resource
name={modules.user.ResourceName}
list={modules.user.List}
show={modules.user.Show}
edit={modules.user.Edit}
icon={() => <Icon className="h-8 w-8" name={IconNames.USERS} />}
/>
<Resource
name={modules.organisation.ResourceName}
list={modules.organisation.List}
show={modules.organisation.Show}
edit={modules.organisation.Edit}
icon={() => <Icon className="h-8 w-8" name={IconNames.ORGANISATIONS} />}
/>
<Resource
name={modules.pitch.ResourceName}
list={modules.pitch.List}
show={modules.pitch.Show}
edit={modules.pitch.Edit}
icon={() => <Icon className="h-8 w-8" name={IconNames.PITCHES} />}
/>
<Resource
name={modules.fundingProgramme.ResourceName}
list={modules.fundingProgramme.List}
edit={modules.fundingProgramme.Edit}
show={modules.fundingProgramme.Show}
create={modules.fundingProgramme.Create}
icon={() => <Icon className="h-8 w-8" name={IconNames.FUNDING_PROGRAMMES} />}
options={{ label: "Funding Programmes" }}
/>
<Resource
name={modules.reportingFramework.ResourceName}
list={modules.reportingFramework.List}
show={modules.reportingFramework.Show}
edit={modules.reportingFramework.Edit}
{...(canCreate ? { create: modules.reportingFramework.Create } : null)}
icon={() => <Icon className="h-8 w-8" name={IconNames.REPORTING_FRAMEWORKS} />}
options={{ label: "Reporting Frameworks" }}
/>
<Resource
name={modules.application.ResourceName}
list={modules.application.List}
show={modules.application.Show}
icon={() => <Icon className="h-8 w-8" name={IconNames.APPLICATIONS} />}
/>
<Resource
name={modules.stage.ResourceName}
show={modules.stage.Show}
edit={modules.stage.Edit}
create={modules.stage.Create}
/>
<Resource
name={modules.form.ResourceName}
list={modules.form.List}
edit={modules.form.Edit}
icon={() => <Icon className="h-8 w-8" name={IconNames.FORMS} />}
create={modules.form.Create}
/>
<Resource
name={modules.project.ResourceName}
list={modules.project.List}
show={modules.project.Show}
edit={modules.project.Edit}
icon={() => <Icon className="h-8 w-8" name={IconNames.PROJECTS} />}
/>
<Resource
name={modules.site.ResourceName}
list={modules.site.List}
show={modules.site.Show}
edit={modules.site.Edit}
icon={() => <Icon className="h-8 w-8" name={IconNames.SITES} />}
/>
<Resource
name={modules.nursery.ResourceName}
list={modules.nursery.List}
show={modules.nursery.Show}
edit={modules.nursery.Edit}
icon={() => <Icon className="h-8 w-8" name={IconNames.NURSERIES} />}
/>
<Resource
name={modules.task.ResourceName}
list={modules.task.List}
show={modules.task.Show}
icon={SummarizeIcon}
options={{ label: "Tasks" }}
/>
<Resource
name={modules.projectReport.ResourceName}
list={modules.projectReport.List}
show={modules.projectReport.Show}
edit={modules.projectReport.Edit}
icon={() => <Icon className="h-8 w-8" name={IconNames.REPORTS} />}
options={{ label: "Project Reports" }}
/>
<Resource
name={modules.siteReport.ResourceName}
list={modules.siteReport.List}
show={modules.siteReport.Show}
edit={modules.siteReport.Edit}
icon={() => <Icon className="h-8 w-8" name={IconNames.REPORTS} />}
options={{ label: "Site Reports" }}
/>
<Resource
name={modules.nurseryReport.ResourceName}
list={modules.nurseryReport.List}
show={modules.nurseryReport.Show}
edit={modules.nurseryReport.Edit}
icon={() => <Icon className="h-8 w-8" name={IconNames.REPORTS} />}
options={{ label: "Nursery Reports" }}
/>
<Resource name={modules.audit.ResourceName} />
</Admin>
</LoadingProvider>
);
};

Expand Down
Loading

0 comments on commit e7fb8bf

Please sign in to comment.