Skip to content

Commit

Permalink
Merge branch 'ramps-416-variable-marketplace' into ramps-100-variable…
Browse files Browse the repository at this point in the history
…-marketplace
  • Loading branch information
yomatters committed Jan 10, 2025
2 parents e98c793 + 93cb833 commit 7a0845a
Show file tree
Hide file tree
Showing 27 changed files with 384 additions and 157 deletions.
10 changes: 4 additions & 6 deletions src/main.jsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import ReactDOM from "react-dom/client";
import { configureStore } from "@reduxjs/toolkit";
import { Provider } from "react-redux";
import { addRoutes } from "./shared/helpers/utils";

import AllocationsMap from "./allocations-map/AllocationsMap";

import Projects from "./projects/Projects";
import apiSlice from "./projects/helpers/apiSlice";
import projectsConfig from "./projects/helpers/config";

import ProjectsBrowser from "./projects-browser/ProjectsBrowser";
import browserSlice from "./projects-browser/helpers/browserSlice";
import { initialState as projectsBrowserInitialState } from "./projects-browser/helpers/initialState";

import Publications from "./publications/Publications";
import PublicationsSelect from "./publications/PublicationsSelect";
import publicationsConfig from "./publications/helpers/config";
import { publications_store } from "./publications/helpers/reducers";

import OnRampsResourceCatalog from "./onramps-resource-catalog/ResourceCatalog";
Expand Down Expand Up @@ -67,8 +66,7 @@ export function allocationsMap({ target }) {
}

export function projects({ target, username, routes }) {
// Override the default routes with the ones from Rails.
if (routes) projectsConfig.routes = routes;
addRoutes(routes);
const projectsStore = configureStore({
reducer: {
api: apiSlice,
Expand Down Expand Up @@ -109,7 +107,7 @@ function publicationsStore() {
}

export function publications({ target, routes }) {
if (routes) publicationsConfig.routes = routes;
addRoutes(routes);
ReactDOM.createRoot(target).render(
<Provider store={publicationsStore()}>
<Publications />
Expand All @@ -118,7 +116,7 @@ export function publications({ target, routes }) {
}

export function publicationsSelect({ target, routes }) {
if (routes) publicationsConfig.routes = routes;
addRoutes(routes);
ReactDOM.createRoot(target).render(
<Provider store={publicationsStore()}>
<PublicationsSelect
Expand Down
4 changes: 2 additions & 2 deletions src/projects/ActionTitle.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { formatDate } from "./helpers/utils";
import config from "./helpers/config";
import { formatDate } from "../shared/helpers/utils";
import config from "../shared/helpers/config";

import InlineButton from "../shared/InlineButton";

Expand Down
2 changes: 1 addition & 1 deletion src/projects/ActionsModal.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import { useProject, useRequest } from "./helpers/hooks";
import config from "./helpers/config";
import config from "../shared/helpers/config";

import Dropdown from "react-bootstrap/Dropdown";
import Modal from "react-bootstrap/Modal";
Expand Down
2 changes: 1 addition & 1 deletion src/projects/ConfirmModal.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useProject, useRequest } from "./helpers/hooks";
import { getResourceUsagePercent } from "./helpers/utils";
import { getResourceUsagePercent } from "../shared/helpers/utils";

import Modal from "react-bootstrap/Modal";

Expand Down
2 changes: 1 addition & 1 deletion src/projects/DeleteModal.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { statuses } from "./helpers/apiSlice";
import { useRequest } from "./helpers/hooks";
import { formatDate, formatRequestName } from "./helpers/utils";
import { formatDate, formatRequestName } from "../shared/helpers/utils";

import Alert from "../shared/Alert";
import Modal from "react-bootstrap/Modal";
Expand Down
2 changes: 1 addition & 1 deletion src/projects/FinalReportButton.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useRequest } from "./helpers/hooks";
import config from "./helpers/config";
import config from "../shared/helpers/config";

export default function FinalReportButton({ requestId, grantNumber }) {
const { request } = useRequest(requestId, grantNumber);
Expand Down
9 changes: 5 additions & 4 deletions src/projects/History.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { useProject, useRequest } from "./helpers/hooks";
import {
formatBoolean,
formatRequestName,
formatResource,
sortResources,
} from "./helpers/utils";
} from "../shared/helpers/utils";

import ActionTitle from "./ActionTitle";
import Grid from "../shared/Grid";
import ResourceName from "../shared/ResourceName";
import StatusBadge from "../shared/StatusBadge";

const formatNumber = (value) => (
Expand Down Expand Up @@ -85,8 +85,9 @@ export default function History({ requestId, grantNumber }) {
format: res.isBoolean
? (value) => (value ? formatBoolean(value) : null)
: formatNumber,
formatHeader: (name, column) =>
formatResource(column, { userGuide: false }),
formatHeader: (name, column) => (
<ResourceName resource={column} userGuide={false} />
),
})),
];

Expand Down
8 changes: 4 additions & 4 deletions src/projects/OverviewResources.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { useProject, useRequest } from "./helpers/hooks";
import config from "./helpers/config";
import config from "../shared/helpers/config";
import {
icon,
formatBoolean,
formatDate,
formatManagers,
formatNumber,
formatResource,
resourceColors,
} from "./helpers/utils";
} from "../shared/helpers/utils";

import Grid from "../shared/Grid";
import ResourceName from "../shared/ResourceName";
import StatusBadge from "../shared/StatusBadge";
import { OverlayTrigger, Tooltip } from "react-bootstrap";

Expand Down Expand Up @@ -55,7 +55,7 @@ export default function OverviewResources({ requestId, grantNumber }) {
{
key: "name",
name: "Resource",
format: (value, row) => formatResource(row),
format: (value, row) => <ResourceName resource={row} />,
},
{
key: "isActive",
Expand Down
4 changes: 2 additions & 2 deletions src/projects/OverviewUsers.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useProject } from "./helpers/hooks";
import config from "./helpers/config";
import { icon, formatNumber, roles } from "./helpers/utils";
import config from "../shared/helpers/config";
import { icon, formatNumber, roles } from "../shared/helpers/utils";

import Grid from "../shared/Grid";

Expand Down
2 changes: 1 addition & 1 deletion src/projects/Project.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useState } from "react";
import { useProject } from "./helpers/hooks";
import { formatRequestName } from "./helpers/utils";
import { formatRequestName } from "../shared/helpers/utils";
import style from "./Project.module.scss";

import Alert from "../shared/Alert";
Expand Down
2 changes: 1 addition & 1 deletion src/projects/Projects.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useProjectsList } from "./helpers/hooks";
import config from "./helpers/config";
import config from "../shared/helpers/config";

import Alert from "../shared/Alert";
import Project from "./Project";
Expand Down
18 changes: 12 additions & 6 deletions src/projects/Request.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useRequest, useProject } from "./helpers/hooks";
import config from "./helpers/config";
import config from "../shared/helpers/config";
import style from "./Request.module.scss";

import Tab from "react-bootstrap/Tab";
Expand Down Expand Up @@ -38,17 +38,23 @@ export default function Request({ requestId, grantNumber }) {

return (
<div className="request">
{request.returnedForCorrections ?
{request.returnedForCorrections ? (
<Alert color="warning">
<p>
Your request has been returned for corrections. These are the notes from the Allocations Team
Your request has been returned for corrections. These are the notes
from the Allocations Team
</p>
<div className={style.returnedForCorrectionsNotes}>{request.returnedForCorrectionsNotes}</div>
<div className={style.returnedForCorrectionsNotes}>
{request.returnedForCorrectionsNotes}
</div>
<p className="mt-3">
Please address these issues by clicking the Edit button to edit your request.
Please address these issues by clicking the Edit button to edit your
request.
</p>
</Alert>
: ""}
) : (
""
)}
{request.timeStatus != "current" && !request.returnedForCorrections ? (
<Alert color="warning">
You are viewing {"aeiou".includes(displayStatus[0]) ? "an" : "a"}{" "}
Expand Down
2 changes: 1 addition & 1 deletion src/projects/RequestActionButtons.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useRequest } from "./helpers/hooks";
import config from "./helpers/config";
import config from "../shared/helpers/config";

export default function RequestActionButtons({ requestId, grantNumber }) {
const { request, toggleActionsModal, toggleDeleteModal } = useRequest(
Expand Down
Loading

0 comments on commit 7a0845a

Please sign in to comment.