From 4455e2ee3651579dc0a07743a61628836d531cb7 Mon Sep 17 00:00:00 2001 From: wotnak Date: Sun, 19 Feb 2023 20:11:07 +0100 Subject: [PATCH 1/5] community projects page --- src/pages/community/projects/index.js | 84 +++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 src/pages/community/projects/index.js diff --git a/src/pages/community/projects/index.js b/src/pages/community/projects/index.js new file mode 100644 index 0000000..8a533bd --- /dev/null +++ b/src/pages/community/projects/index.js @@ -0,0 +1,84 @@ +import * as React from "react" +import { useEffect, useState } from "react"; +import { Helmet } from "react-helmet"; +import { Link } from 'gatsby-material-ui-components'; +import { makeStyles } from '@material-ui/core/styles'; +import { Box, Typography } from '@material-ui/core'; +import theme from '../../../theme'; + +const useStyles = makeStyles({ + main: { + '& h1': { + color: theme.palette.text.secondary, + fontWeight: 300, + fontSize: '2rem', + lineHeight: 1.3, + letterSpacing: '-.01em', + margin: '0 0 1.25rem', + }, + '& h2': { + margin: '1.6rem 0 0.64rem', + fontSize: '1.5625rem', + fontWeight: 300, + lineHeight: 1.4, + letterSpacing: '-.01em', + } + }, +}); + +const ProjectsPage = () => { + const classes = useStyles(); + const [contribModules, setContribModules] = useState([]); + const [customModules, setCustomModules] = useState([]); + const [otherProjects, setOtherProjects] = useState([]); + useEffect(() => { + async function fetchData() { + const response = await fetch(`https://raw.githubusercontent.com/wotnak/farmos-community-projects/main/projects.json`) + const data = await response.json(); + setContribModules(data.filter(value => value.type === 'contrib-module')) + setCustomModules(data.filter(value => value.type === 'custom-module')) + setOtherProjects(data.filter(value => value.type === 'project')) + } + fetchData(); + }, []); + return ( + <> + + + Community Projects + {contribModules.length > 0 && + <> + Contrib modules + + + } + {customModules.length > 0 && + <> + Custom modules + + + } + {otherProjects.length > 0 && + <> + Other projects + + + } + + + ); +}; + +export default ProjectsPage; From c5382ce764932d05958131c70014bd4a26e27523 Mon Sep 17 00:00:00 2001 From: wotnak Date: Sun, 19 Feb 2023 20:20:10 +0100 Subject: [PATCH 2/5] add community projects page to the site navigation --- src/content/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/content/config.yml b/src/content/config.yml index 2a86a0e..c66e6e3 100644 --- a/src/content/config.yml +++ b/src/content/config.yml @@ -11,3 +11,4 @@ nav: - Press: community/press.md - Trademark: community/trademark.md - Donate: donate.md + - Projects: community/projects From 496e5dffff24c86d9f600454423ee48482fa4500 Mon Sep 17 00:00:00 2001 From: wotnak Date: Mon, 20 Feb 2023 06:47:44 +0100 Subject: [PATCH 3/5] fix variable name --- src/pages/community/projects/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/community/projects/index.js b/src/pages/community/projects/index.js index 8a533bd..ade6ffc 100644 --- a/src/pages/community/projects/index.js +++ b/src/pages/community/projects/index.js @@ -70,8 +70,8 @@ const ProjectsPage = () => { <> Other projects
    - {otherProjects.map(module => { - return (
  • {module.name} - {module.desc}
  • ) + {otherProjects.map(project => { + return (
  • {project.name} - {project.desc}
  • ) })}
From 9cf4e39d288c4047029bfdaef990b4dfb09b0e81 Mon Sep 17 00:00:00 2001 From: wotnak Date: Wed, 22 Feb 2023 16:51:01 +0100 Subject: [PATCH 4/5] adjust to changes in projects list schema, new look for contrib modules list --- src/components/contrib-module.js | 70 +++++++++++++++++++++++++++ src/pages/community/projects/index.js | 51 ++++++------------- 2 files changed, 84 insertions(+), 37 deletions(-) create mode 100644 src/components/contrib-module.js diff --git a/src/components/contrib-module.js b/src/components/contrib-module.js new file mode 100644 index 0000000..e5dfd27 --- /dev/null +++ b/src/components/contrib-module.js @@ -0,0 +1,70 @@ +import { makeStyles } from '@material-ui/core/styles'; +import React from 'react'; +import Typography from '@material-ui/core/Typography'; +import { Link } from 'gatsby-material-ui-components'; +import Card from '@material-ui/core/Card'; +import CardActions from '@material-ui/core/CardActions'; +import CardContent from '@material-ui/core/CardContent'; +import Button from '@material-ui/core/Button'; +import WarningIcon from '@material-ui/icons/Warning'; +import InfoIcon from '@material-ui/icons/Info'; +import Paper from '@material-ui/core/Paper'; +import theme from '../theme'; + +const useStyles = makeStyles({ + root: { + height: '100%', + display: 'flex', + flexDirection: 'column', + justifyContent: 'space-between', + }, + title: { + fontSize: '1.3rem !important', + marginTop: '0 !important', + }, + pos: { + marginBottom: 12, + }, + consideration: { + background: theme.palette.primary.light, + display: 'flex', + alignItems: 'center', + padding: '5px', + fontSize: '.8rem', + lineHeight: '1.2', + marginTop: '.5rem', + color: 'white', + }, + 'consideration--warning': { + background: '#ffc107' + }, + icon: { + marginRight: '5px', + fontSize: '1.3rem' + } +}); + +export default function ContribModule({module}) { + const classes = useStyles(); + + return ( + + + {module.name} + {module.description} + {module.considerations && module.considerations.map(info => { + return ( + + { info.type === 'info' && ()} + { info.type === 'warning' && ()} + {info.value} + + ) + })} + + + + + + ); +} diff --git a/src/pages/community/projects/index.js b/src/pages/community/projects/index.js index ade6ffc..31bbb46 100644 --- a/src/pages/community/projects/index.js +++ b/src/pages/community/projects/index.js @@ -1,10 +1,11 @@ import * as React from "react" import { useEffect, useState } from "react"; import { Helmet } from "react-helmet"; -import { Link } from 'gatsby-material-ui-components'; import { makeStyles } from '@material-ui/core/styles'; import { Box, Typography } from '@material-ui/core'; import theme from '../../../theme'; +import ContribModule from '../../../components/contrib-module'; +import Grid from '@material-ui/core/Grid'; const useStyles = makeStyles({ main: { @@ -24,20 +25,21 @@ const useStyles = makeStyles({ letterSpacing: '-.01em', } }, + modules: { + flexGrow: 1, + } }); const ProjectsPage = () => { const classes = useStyles(); const [contribModules, setContribModules] = useState([]); - const [customModules, setCustomModules] = useState([]); - const [otherProjects, setOtherProjects] = useState([]); useEffect(() => { async function fetchData() { const response = await fetch(`https://raw.githubusercontent.com/wotnak/farmos-community-projects/main/projects.json`) const data = await response.json(); - setContribModules(data.filter(value => value.type === 'contrib-module')) - setCustomModules(data.filter(value => value.type === 'custom-module')) - setOtherProjects(data.filter(value => value.type === 'project')) + if (data.projects) { + setContribModules(data.projects) + } } fetchData(); }, []); @@ -45,37 +47,12 @@ const ProjectsPage = () => { <> - Community Projects - {contribModules.length > 0 && - <> - Contrib modules -
    - {contribModules.map(module => { - return (
  • {module.name} - {module.desc}
  • ) - })} -
- - } - {customModules.length > 0 && - <> - Custom modules -
    - {customModules.map(module => { - return (
  • {module.name} - {module.desc}
  • ) - })} -
- - } - {otherProjects.length > 0 && - <> - Other projects -
    - {otherProjects.map(project => { - return (
  • {project.name} - {project.desc}
  • ) - })} -
- - } + Contrib modules + + {contribModules.length > 0 && contribModules.map(module => { + return () + })} +
); From b47455d367bef02d909ba2368e4e37e442568b44 Mon Sep 17 00:00:00 2001 From: wotnak Date: Wed, 22 Feb 2023 16:55:00 +0100 Subject: [PATCH 5/5] rename projects list page to 'Contrib modules' --- src/content/config.yml | 2 +- src/pages/community/{projects => modules}/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename src/pages/community/{projects => modules}/index.js (97%) diff --git a/src/content/config.yml b/src/content/config.yml index c66e6e3..7478f26 100644 --- a/src/content/config.yml +++ b/src/content/config.yml @@ -11,4 +11,4 @@ nav: - Press: community/press.md - Trademark: community/trademark.md - Donate: donate.md - - Projects: community/projects + - Contrib modules: community/modules diff --git a/src/pages/community/projects/index.js b/src/pages/community/modules/index.js similarity index 97% rename from src/pages/community/projects/index.js rename to src/pages/community/modules/index.js index 31bbb46..e102d9c 100644 --- a/src/pages/community/projects/index.js +++ b/src/pages/community/modules/index.js @@ -45,7 +45,7 @@ const ProjectsPage = () => { }, []); return ( <> - + Contrib modules