-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add new page /datasets * add Datasets astro collection from external JSON source and add GITHUB TOKEN to get contents JSON out of a private repo * fix #62, remove legacy collection option to complete the migration to Astro 5 and use `id` instead of `slug` for astro contents * simplify list of authors to one single yaml * npm fix audit * add userPlan to Permanent store * add minor css classes * Create types.ts to contain all typescript types --------- Co-authored-by: Daniele Guido <[email protected]>
- Loading branch information
1 parent
e934fe0
commit a3d8eb0
Showing
38 changed files
with
716 additions
and
82 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 |
---|---|---|
|
@@ -34,3 +34,4 @@ src/styles/fonts.css | |
impresso-datalab.code-workspace | ||
.env.development | ||
.env.local | ||
*.local |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
export interface Author { | ||
slug: string | ||
id: string | ||
name: string | ||
fullName?: string | ||
} | ||
|
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,9 @@ | ||
export type CorpusAccessProps = { | ||
className?: string | ||
} | ||
|
||
const CorpusAccess: React.FC<CorpusAccessProps> = ({ className = "" }) => { | ||
return <div className={`CorpusAccess ${className}`}>test</div> | ||
} | ||
|
||
export default CorpusAccess |
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,98 @@ | ||
import type { FC } from "react" | ||
import type { Dataset } from "../types" | ||
import { Col, OverlayTrigger, Row, Tooltip } from "react-bootstrap" | ||
import { CheckCircleSolid, Xmark, XmarkCircleSolid } from "iconoir-react" | ||
import { | ||
PlanAvailabilityLabels, | ||
PlanEducational, | ||
PlanGuest, | ||
PlanImpressoUser, | ||
PlanNone, | ||
PlanResearcher, | ||
} from "../constants" | ||
|
||
export type DatasetCardProps = { | ||
dataset: Dataset | ||
userPlan?: string | ||
className?: string | ||
} | ||
|
||
const compareDatasetPlanWithUserPlan = ( | ||
userPlan: string, | ||
datasetPlan: string | ||
) => { | ||
if (userPlan === datasetPlan || datasetPlan === PlanGuest) { | ||
return <CheckCircleSolid color="green" /> | ||
} | ||
if ( | ||
[PlanGuest, PlanImpressoUser].includes(datasetPlan) && | ||
[PlanImpressoUser, PlanResearcher, PlanEducational].includes(userPlan) | ||
) { | ||
return <CheckCircleSolid color="green" /> | ||
} | ||
if (datasetPlan === PlanNone) { | ||
return ( | ||
<OverlayTrigger | ||
overlay={ | ||
<Tooltip id="button-tooltip-3"> | ||
<span> This feature is not yet avalable to any plan</span> | ||
</Tooltip> | ||
} | ||
> | ||
<XmarkCircleSolid /> | ||
</OverlayTrigger> | ||
) | ||
} | ||
|
||
return ( | ||
<OverlayTrigger | ||
overlay={ | ||
<Tooltip id="button-tooltip-3"> | ||
<span>{PlanAvailabilityLabels[datasetPlan] ?? datasetPlan}</span> | ||
</Tooltip> | ||
} | ||
> | ||
<Xmark /> | ||
</OverlayTrigger> | ||
) | ||
} | ||
|
||
const DatasetCard: FC<DatasetCardProps> = ({ | ||
dataset, | ||
userPlan = PlanGuest, | ||
className = "", | ||
}) => { | ||
// translate | ||
return ( | ||
<Row key={dataset.id} className={`DatasetCard ${className}`}> | ||
<Col sm={1}>{dataset.startYear}</Col> | ||
<Col sm={1}>{dataset.endYear}</Col> | ||
<Col sm={2}>{dataset.medium}</Col> | ||
<Col sm={5}> | ||
<h3 className="font-size-inherit mb-1"> | ||
{dataset.mediaTitle} — {dataset.associatedPartner} | ||
</h3> | ||
<div className="d-flex"> | ||
<div className="small-caps">{dataset.media}</div> | ||
</div> | ||
{dataset.permittedUse} | ||
</Col> | ||
|
||
{[ | ||
dataset.minimumUserPlanRequiredToExploreInWebapp, | ||
dataset.minimumUserPlanRequiredToExportTranscripts, | ||
dataset.minimumUserPlanRequiredToExportIllustration, | ||
].map((plan, i) => ( | ||
<Col key={i} sm={1}> | ||
{compareDatasetPlanWithUserPlan(userPlan, plan)} | ||
</Col> | ||
))} | ||
|
||
<Col sm={12}> | ||
<div className="pt-3 border-bottom h-1px"></div> | ||
</Col> | ||
</Row> | ||
) | ||
} | ||
|
||
export default DatasetCard |
Oops, something went wrong.