diff --git a/src/http.mjs b/src/http.mjs index a851e6bb..babc6c8a 100644 --- a/src/http.mjs +++ b/src/http.mjs @@ -29,6 +29,7 @@ import memecoin from "./views/memecoin.mjs"; import onboardingReader from "./views/onboarding-reader.mjs"; import onboardingCurator from "./views/onboarding-curator.mjs"; import onboardingSubmitter from "./views/onboarding-submitter.mjs"; +import lists from "./views/lists.mjs"; import shortcut from "./views/shortcut.mjs"; import nfts from "./views/nfts.mjs"; import subscribe from "./views/subscribe.mjs"; @@ -527,6 +528,11 @@ export async function launch(trie, libp2p) { ); }); + app.get("/lists", async (request, reply) => { + const content = await lists(trie, reply.locals.theme); + return reply.status(200).type("text/html").send(content); + }); + app.get("/welcome", async (request, reply) => { reply.header("Cache-Control", "public, max-age=3600, must-revalidate"); return reply diff --git a/src/public/Kiwi_lists.png b/src/public/Kiwi_lists.png new file mode 100644 index 00000000..60c5815a Binary files /dev/null and b/src/public/Kiwi_lists.png differ diff --git a/src/views/components/sidebar.mjs b/src/views/components/sidebar.mjs index 0f5ff3da..6338be02 100644 --- a/src/views/components/sidebar.mjs +++ b/src/views/components/sidebar.mjs @@ -376,12 +376,12 @@ const sidebar = (path) => html`
- ${path === "/onboarding" ? onboardingfull : onboarding} + ${path === "/onboarding-reader" ? onboardingfull : onboarding}
Explore
diff --git a/src/views/lists.mjs b/src/views/lists.mjs new file mode 100644 index 00000000..a03c971c --- /dev/null +++ b/src/views/lists.mjs @@ -0,0 +1,88 @@ +import htm from "htm"; +import vhtml from "vhtml"; +import * as curation from "./curation.mjs"; +import * as moderation from "./moderation.mjs"; +import Header from "./components/header.mjs"; +import Sidebar from "./components/sidebar.mjs"; +import Footer from "./components/footer.mjs"; +import Head from "./components/head.mjs"; + +const html = htm.bind(vhtml); + +function CanonRow(sheets) { + sheets = sheets.sort((a, b) => 0.5 - Math.random()).slice(0, 9); // Get 9 sheets + const rows = []; + for (let i = 0; i < sheets.length; i += 3) { + const rowSheets = sheets.slice(i, i + 3); + rows.push( + html` + + +
+ ${rowSheets.map( + ({ preview, name }) => html` +
+ + + +
+ `, + )} +
+ + + `, + ); + } + return rows; +} + +export default async function displayCanonRow(theme, identity) { + const path = "/canonrow"; + let sheets; + try { + const activeSheets = await moderation.getActiveCanons(); + sheets = await curation.getSheets(activeSheets); + } catch (err) { + console.error(err); + return; + } + + return html` + + + ${Head} + + +
+ ${Sidebar(path)} +
+ + + ${await Header(theme, identity)} + + + + + ${sheets ? CanonRow(sheets) : ""} +
+

Kiwi Lists

+

+ Lists let you dive into specific subjects. Kiwi curators - + like Spotify DJs - collect the top content from one genre + and lead you into an educational journey. Click one of the + lists below to check what we prepared for you. +

+
+
+
+ ${Footer(theme)} + + + `; +} diff --git a/src/views/onboarding-reader.mjs b/src/views/onboarding-reader.mjs index 417f0173..f0b68ddb 100644 --- a/src/views/onboarding-reader.mjs +++ b/src/views/onboarding-reader.mjs @@ -139,7 +139,7 @@ export default async function (theme, identity) { Share and discuss content with fellow crypto builders

- Discuss the project, content and anything you’d like to + Discuss the content, project and anything you’d like to chat about on our Telegram Channel. Join us and say gm!

@@ -198,6 +198,32 @@ export default async function (theme, identity) {


+

+
+ +
+
+

Dive deeper into one subject

+

+ If you want to learn more about a specific subject, Kiwi + Canons are here to help. Kiwi curators - like Spotify + DJs - collect the top materials about one subject and + compose them into a list. +

+ + + + +
+
+
+
+

Ready to explore Kiwi Level II?