-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Usage/reports component and overall dashboard layout. (PP-1534) (#126)
- Loading branch information
Showing
8 changed files
with
333 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import React = require("react"); | ||
import { Button } from "library-simplified-reusable-components"; | ||
import StatsGroup from "./StatsGroup"; | ||
import { InventoryStatistics } from "../interfaces"; | ||
import InventoryReportRequestModal from "./InventoryReportRequestModal"; | ||
import { useState } from "react"; | ||
import { useAppContext } from "../context/appContext"; | ||
|
||
type Props = { | ||
heading?: string; | ||
description?: string; | ||
inventoryReportsEnabled: boolean; | ||
library?: string; | ||
usageDataHref?: string; | ||
usageDataLabel?: string; | ||
usageDataTarget?: string; | ||
}; | ||
|
||
const StatsUsageReportsGroup = ({ | ||
heading = "Usage and Reports", | ||
description = ` | ||
Access historical circulation and usage data of the Palace system | ||
and request inventory and holds reports to be sent via email. | ||
`, | ||
usageDataHref = "https://thepalaceproject.org", | ||
usageDataLabel = "View Usage", | ||
usageDataTarget = "_self", | ||
inventoryReportsEnabled, | ||
library = undefined, | ||
}: Props) => { | ||
const [showReportForm, setShowReportForm] = useState(false); | ||
|
||
return ( | ||
<> | ||
{inventoryReportsEnabled && library && ( | ||
<InventoryReportRequestModal | ||
show={showReportForm} | ||
onHide={() => setShowReportForm(false)} | ||
library={library} | ||
/> | ||
)} | ||
<ul className="stat-usage-reports"> | ||
<li> | ||
<StatsGroup heading={heading} description={description}> | ||
<> | ||
{inventoryReportsEnabled && library && ( | ||
<Button | ||
callback={(() => setShowReportForm(true)) as any} | ||
content={ | ||
<> | ||
Request Report | ||
<i className="fa fa-regular fa-envelope" /> | ||
</> | ||
} | ||
title="Request an inventory report." | ||
disabled={showReportForm} | ||
/> | ||
)} | ||
<div className="stat-group-description"> | ||
These reports provide up-to-date data on both inventory and | ||
holds for library at the time of the request. | ||
</div> | ||
</> | ||
</StatsGroup> | ||
</li> | ||
<li> | ||
<div className="stat-link"> | ||
<a | ||
href={usageDataHref} | ||
target={usageDataTarget} | ||
rel="noopener noreferrer" | ||
> | ||
{usageDataLabel} | ||
</a> | ||
| ||
<i className="fa fa-external-link" /> | ||
</div> | ||
</li> | ||
</ul> | ||
</> | ||
); | ||
}; | ||
|
||
export default StatsUsageReportsGroup; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.