From 4229d673c9f8cbf91980d2a67a9423ea1e97cf20 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Thu, 18 Jan 2024 18:21:56 +0100 Subject: [PATCH 1/4] 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 +

+ +
+ +
+
+
+ + From c6f3a8b7c72af1c40b6622d147d1d2eb964524ac Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Thu, 18 Jan 2024 18:30:57 +0100 Subject: [PATCH 2/4] more text --- website/src/pages/oven.astro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/src/pages/oven.astro b/website/src/pages/oven.astro index b6961f60..4410e283 100644 --- a/website/src/pages/oven.astro +++ b/website/src/pages/oven.astro @@ -32,8 +32,8 @@ const posts = (await getCollection('blog')).sort((a, b) => compareDesc(a.data.da

Community Oven

- This page contains all the strudels baked by the community.
Add your own by clicking the "Share" button - in the REPL + This page contains all the strudel patterns baked by the community. Add your own by clicking the "Share" + button in the REPL. Have fun, and please share some of what you create with the community.

From 4f7415b0ec20c319bfc29f12eaa3cb067717d43e Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Thu, 18 Jan 2024 21:31:21 +0100 Subject: [PATCH 3/4] rename --- website/src/config.ts | 2 +- website/src/pages/oven.astro | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/website/src/config.ts b/website/src/config.ts index 3eab0a2a..a5cbcb62 100644 --- a/website/src/config.ts +++ b/website/src/config.ts @@ -58,7 +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' }, + { text: 'Community Bakery', link: 'oven' }, ], Workshop: [ // { text: 'Getting Started', link: 'workshop/getting-started' }, diff --git a/website/src/pages/oven.astro b/website/src/pages/oven.astro index 4410e283..40c1c54f 100644 --- a/website/src/pages/oven.astro +++ b/website/src/pages/oven.astro @@ -16,7 +16,7 @@ const posts = (await getCollection('blog')).sort((a, b) => compareDesc(a.data.da - 🌀 Strudel Community Oven + 🌀 Strudel Community Bakery @@ -30,7 +30,7 @@ const posts = (await getCollection('blog')).sort((a, b) => compareDesc(a.data.da -

Community Oven

+

Community Bakery

This page contains all the strudel patterns baked by the community. Add your own by clicking the "Share" button in the REPL. Have fun, and please share some of what you create with the community. From 6667738dc9c46d5dde0d837031a1df2ef726f158 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Thu, 18 Jan 2024 21:34:20 +0100 Subject: [PATCH 4/4] more rename --- website/src/config.ts | 2 +- website/src/pages/{oven.astro => bakery.astro} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename website/src/pages/{oven.astro => bakery.astro} (100%) diff --git a/website/src/config.ts b/website/src/config.ts index a5cbcb62..adbcc7f0 100644 --- a/website/src/config.ts +++ b/website/src/config.ts @@ -58,7 +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 Bakery', link: 'oven' }, + { text: 'Community Bakery', link: 'bakery' }, ], Workshop: [ // { text: 'Getting Started', link: 'workshop/getting-started' }, diff --git a/website/src/pages/oven.astro b/website/src/pages/bakery.astro similarity index 100% rename from website/src/pages/oven.astro rename to website/src/pages/bakery.astro