Skip to content

Commit f82ebcd

Browse files
Add a new page for fundable projects.
1 parent c2c5314 commit f82ebcd

21 files changed

+10683
-0
lines changed

docusaurus.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,13 @@ const config: Config = {
9898
className: "custom_navbar_item",
9999
label: "Blog",
100100
position: "left",
101+
},
102+
{
103+
to: "/fundable/",
104+
className: "custom_navbar_item",
105+
label: "Fundable projects",
106+
position: "right",
107+
className:"fundable_projects"
101108
},
102109
{
103110
to: "/contact/",

src/components/footer/Footer.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,16 @@ export default function Footer() {
6565
</li>
6666
</ul>
6767
</div>
68+
<div className="col flex-horizontally-centered">
69+
<ul>
70+
<li>
71+
<Link href={"/fundable"}>Fundable projects</Link>
72+
</li>
73+
<li>
74+
<Link href={"/contact"}>Contact us</Link>
75+
</li>
76+
</ul>
77+
</div>
6878
</div>
6979
</div>
7080
</div>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import styles from "./styles.module.css";
2+
import React from "react";
3+
4+
export default function LargeProjectCard({ project }) {
5+
return (
6+
<div className={styles.large_project_card}>
7+
<div className={"container"}>
8+
<div className={"row padding-none"}>
9+
<div className="col col--12 col--offset-1">
10+
<div className={styles.large_card_project_category}>
11+
{project.category}
12+
</div>
13+
<div className={styles.large_card_project_title}>{project.title}</div>
14+
</div>
15+
</div>
16+
<div className="row">
17+
<div className="col col--10 col--offset-1">
18+
<div className={styles.large_project_card_text_container}></div>
19+
<div className={styles.large_project_card_section_title}>Overview</div>
20+
<div className={styles.large_project_card_text}>
21+
<project.description />
22+
</div>
23+
</div>
24+
</div>
25+
26+
</div>
27+
</div>
28+
);
29+
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
import { useHistory, useLocation } from "@docusaurus/router";
2+
import { useEffect } from "react";
3+
import styles from "./styles.module.css";
4+
import LargeProjectCard from "./LargeProjectCard";
5+
import { getCategoryFromProjectTitle } from ".";
6+
import FundableProjects from ".";
7+
import Layout from "@theme/Layout";
8+
import { Route } from 'react-router-dom';
9+
10+
11+
export default function LargeProjectCardPage() {
12+
const location = useLocation();
13+
const history = useHistory();
14+
15+
useEffect(() => {
16+
if (location.state?.fromFundable) {
17+
window.scrollTo({ top: location.state.scrollY ?? 0, behavior: 'auto' });
18+
}
19+
}, []);
20+
21+
const handleOverlayClick = () => {
22+
const scrollY = location.state?.scrollY;
23+
setTimeout(() => {
24+
if (scrollY !== undefined) {
25+
window.scrollTo({ top: scrollY, behavior: 'auto' });
26+
}
27+
}, 0);
28+
history.replace('/fundable');
29+
};
30+
31+
const handleClose = () => {
32+
const scrollY = location.state?.scrollY;
33+
if (location.state?.fromFundable) {
34+
history.replace('/fundable');
35+
36+
setTimeout(() => {
37+
if (scrollY !== undefined) {
38+
window.scrollTo({ top: scrollY, behavior: 'auto' });
39+
}
40+
}, 0);
41+
} else {
42+
history.goBack();
43+
}
44+
}
45+
return (
46+
<Layout>
47+
<FundableProjects />
48+
<Route
49+
path="/fundable/:shortTitle"
50+
render={({ match }) => {
51+
const { shortTitle } = match.params; /* extract the dynamic part from the url i.e. the shortTitle*/
52+
const projectsByCategory = getCategoryFromProjectTitle(shortTitle);
53+
console.log('projectsByCategory:', projectsByCategory);
54+
const project = projectsByCategory.find((project) => project.shortTitle.replace(/\s+/g, '') === shortTitle);
55+
if (!project) return null;
56+
57+
return (
58+
<div className={styles.modal_overlay} onClick={handleOverlayClick}>
59+
<div
60+
className={styles.modal_content}
61+
onClick={(e) => e.stopPropagation()}
62+
>
63+
<button
64+
className="close-button"
65+
style={{
66+
position: "absolute",
67+
top: "10px",
68+
right: "10px",
69+
}}
70+
onClick={handleClose}
71+
/>
72+
<LargeProjectCard project={project} />
73+
</div>
74+
</div>
75+
);
76+
}}
77+
/>
78+
</Layout>
79+
)
80+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// src/components/CustomSidebar.js
2+
import React from 'react';
3+
import { useLocation } from '@docusaurus/router';
4+
5+
6+
const menuItems = [
7+
{ label: 'Overview', path: '/fundable' },
8+
{ label: 'Eligibility', path: '/fundable/eligibility' },
9+
{ label: 'Apply', path: '/fundable/apply' },
10+
];
11+
12+
export default function MenuSidebar() {
13+
const location = useLocation();
14+
15+
return (
16+
<nav className="custom-sidebar">
17+
<ul>
18+
{menuItems.map(item => (
19+
<li key={item.path} className={location.pathname === item.path ? 'active' : ''}>
20+
<Link to={item.path}>{item.label}</Link>
21+
</li>
22+
))}
23+
</ul>
24+
</nav>
25+
);
26+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import React from "react";
2+
3+
export default function ProgressBar({ value = 0, color = '#4caf50' }) {
4+
return (
5+
6+
<div style={{
7+
background: '#eee',
8+
borderRadius: '4px',
9+
border: 'solid 0.5px',
10+
height: '10px',
11+
width: '100px',
12+
margin: '10px 0'
13+
}}>
14+
15+
<div style={{
16+
width: `${value}%`,
17+
background: color,
18+
border: 'solid 0.5px',
19+
height: '100%',
20+
borderRadius: '4px',
21+
transition: 'width 0.3s ease-in-out',
22+
}} />
23+
</div>
24+
);
25+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import styles from "./styles.module.css";
2+
import { SmallProjectCard } from "./SmallProjectCard";
3+
4+
5+
export default function ProjectCategory({ projectCategoryName, projectCategory }) {
6+
return (
7+
<div className={styles.project_category_container}>
8+
<h2 className={styles.category_header}> {projectCategoryName}</h2>
9+
<div className={"container"}>
10+
<ul className="row padding-none row-with-margin-top">
11+
{projectCategory.map((project) => (
12+
<li className="cards-list" key={project.category}>
13+
<div className="col" style={{justifyContent: "left"}}>
14+
<SmallProjectCard project={project} />
15+
</div>
16+
</li>
17+
))}
18+
</ul>
19+
</div>
20+
</div>
21+
);
22+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import styles from "./styles.module.css";
2+
import ProgressBar from "./ProgressBar";
3+
import { useHistory } from "@docusaurus/router";
4+
5+
export function SmallProjectCard({ project }) {
6+
const history = useHistory();
7+
8+
function openDialog() {
9+
const shortTitle = project.shortTitle.replace(/\s+/g, '');
10+
11+
history.push({
12+
pathname: `/fundable/${shortTitle}`,
13+
state: { fromFundable: true, scrollY: window.scrollY, },
14+
});
15+
}
16+
17+
18+
return (
19+
<div onClick={openDialog}>
20+
<div className={"card" + " " + styles.fundable_project_card}>
21+
<div className="card__header">
22+
<div
23+
className={styles.project_title
24+
}
25+
>
26+
{project.title}
27+
</div>
28+
</div>
29+
<div className="card__body">
30+
<div style={{display: "flex"}}>
31+
<div>
32+
<div
33+
className={styles.project_catch_up_phrase}
34+
>
35+
{project.catchUpPhrase}
36+
37+
</div>
38+
<div style={{ fontSize: "14px" }}>
39+
Indicative Price: {project.price}
40+
</div>
41+
42+
<div style={{ fontSize: "14px" }}>
43+
Shareable between {project.maxNbOfFunders} funders.
44+
</div>
45+
<div style={{ fontSize: "14px" }}>
46+
Currently this project is supported by {project.currentNbOfFunders} funders.
47+
</div>
48+
<div style={{ fontSize: "14px" }}>
49+
Financed at {project.currentFundingPercentage} %
50+
</div>
51+
<div>
52+
<ProgressBar value={project.currentFundingPercentage} color={'var(--ifm-color-primary-p1'}/>
53+
</div>
54+
</div>
55+
</div>
56+
</div>
57+
</div>
58+
59+
</div>
60+
)
61+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
To be writen.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Conversion of Jupyter notebooks to PDF currently relies on nbconvert in the backend, which in turns uses a headless browser for producing the PDF. We propose to directly perform the PDF conversion in the user's browser, which will simplify the architecture and make it function with JupyterLite.
2+
3+
Nbconvert heavily relies on Jinja2 templates for conversion to different formats.
4+
5+
We will utilize a JavaScript implementation of Jinja2 covering the required features of Jinja to produce a frontend version of nbconvert that does not require Python but still provides a good coverage of the nbconvert features, including the use of custom templates.

0 commit comments

Comments
 (0)