forked from attestate/kiwistand
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added correct link in the sidebar + added lists to onboarding
- Loading branch information
MacB
committed
Jan 12, 2024
1 parent
550c720
commit aa8fc13
Showing
5 changed files
with
123 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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` | ||
<tr> | ||
<td> | ||
<div | ||
style="justify-content: space-evenly; scroll-snap-type: x mandatory; border-radius: 5px; margin-bottom: -10px; padding: 20px 0; gap: 15px; display: flex; overflow-x: auto; width: 100%;" | ||
> | ||
${rowSheets.map( | ||
({ preview, name }) => html` | ||
<div style="flex: 0 0 30%; scroll-snap-align: center;"> | ||
<a href="/canons?name=${name}" target="_blank"> | ||
<img | ||
src="${preview}" | ||
style="width: 100%; height: auto;" | ||
/> | ||
</a> | ||
</div> | ||
`, | ||
)} | ||
</div> | ||
</td> | ||
</tr> | ||
`, | ||
); | ||
} | ||
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` | ||
<html lang="en" op="news"> | ||
<head> | ||
${Head} | ||
</head> | ||
<body> | ||
<div class="container"> | ||
${Sidebar(path)} | ||
<div id="hnmain"> | ||
<table border="0" cellpadding="0" cellspacing="0" bgcolor="#f6f6ef"> | ||
<tr> | ||
${await Header(theme, identity)} | ||
</tr> | ||
<tr> | ||
<td style="padding: 10px; font-size: 16px;"> | ||
<h2>Kiwi Lists</h2> | ||
<p> | ||
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. | ||
</p> | ||
</td> | ||
</tr> | ||
${sheets ? CanonRow(sheets) : ""} | ||
</table> | ||
</div> | ||
</div> | ||
${Footer(theme)} | ||
</body> | ||
</html> | ||
`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters