From 4229d673c9f8cbf91980d2a67a9423ea1e97cf20 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Thu, 18 Jan 2024 18:21:56 +0100 Subject: [PATCH] basic community oven --- website/src/components/Oven/Oven.jsx | 47 ++++++++++++++++++++++ website/src/config.ts | 1 + website/src/pages/oven.astro | 60 ++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+) create mode 100644 website/src/components/Oven/Oven.jsx create mode 100644 website/src/pages/oven.astro diff --git a/website/src/components/Oven/Oven.jsx b/website/src/components/Oven/Oven.jsx new file mode 100644 index 00000000..7cb2e7a7 --- /dev/null +++ b/website/src/components/Oven/Oven.jsx @@ -0,0 +1,47 @@ +import { useState, useEffect } from 'react'; +import { loadFeaturedPatterns, loadPublicPatterns } from '@src/repl/util.mjs'; +import { MiniRepl } from '@src/docs/MiniRepl'; +import { PatternLabel } from '@src/repl/panel/PatternsTab'; + +function PatternList({ patterns }) { + return ( +
+ {patterns.map((pat) => ( +
+
+

+ + + +

+
+ {/* */} + {/*
{JSON.stringify(pat)}
*/} +
+ ))} +
+ ); +} + +export function Oven() { + const [featuredPatterns, setFeaturedPatterns] = useState([]); + const [publicPatterns, setPublicPatterns] = useState([]); + useEffect(() => { + loadPublicPatterns().then(({ data: pats }) => { + console.log('pats', pats); + setPublicPatterns(pats); + }); + loadFeaturedPatterns().then(({ data: pats }) => { + console.log('pats', pats); + setFeaturedPatterns(pats); + }); + }, []); + return ( +
+ + +

Last Creations

+ +
+ ); +} diff --git a/website/src/config.ts b/website/src/config.ts index effc593c..3eab0a2a 100644 --- a/website/src/config.ts +++ b/website/src/config.ts @@ -58,6 +58,7 @@ export const SIDEBAR: Sidebar = { { text: 'What is Strudel?', link: 'workshop/getting-started' }, { text: 'Showcase', link: 'intro/showcase' }, { text: 'Blog', link: 'blog' }, + { text: 'Community Oven', link: 'oven' }, ], Workshop: [ // { text: 'Getting Started', link: 'workshop/getting-started' }, diff --git a/website/src/pages/oven.astro b/website/src/pages/oven.astro new file mode 100644 index 00000000..b6961f60 --- /dev/null +++ b/website/src/pages/oven.astro @@ -0,0 +1,60 @@ +--- +import HeadCommon from '../components/HeadCommon.astro'; +import Header from '../components/Header/Header.astro'; +import LeftSidebar from '../components/LeftSidebar/LeftSidebar.astro'; +import PageContent from '../components/PageContent/PageContent.astro'; +import { getCollection } from 'astro:content'; +import { compareDesc } from 'date-fns'; +import { Oven as CommunityOven } from '../components/Oven/Oven.jsx'; +import RightSidebar from '../components/RightSidebar/RightSidebar.astro'; + +const currentPage = Astro.url.pathname; + +const posts = (await getCollection('blog')).sort((a, b) => compareDesc(a.data.date, b.data.date)); +--- + + + + + 🌀 Strudel Community Oven + + + +
+
+
+
+
+
+ + +

Community Oven

+

+ This page contains all the strudels baked by the community.
Add your own by clicking the "Share" button + in the REPL +

+ +
+ +
+
+
+ +