This commit is contained in:
tree🌴 2024-02-12 12:57:08 +01:00
parent 4e550b869f
commit 612d7d0e77
6 changed files with 49 additions and 9 deletions

View file

@ -8,7 +8,7 @@ const SRC_DIR = "./data";
const DEST_DIR = "./dist"; const DEST_DIR = "./dist";
async function build() { async function build() {
const issues = []; let issues = [];
for await (const dirEntry of Deno.readDir(SRC_DIR)) { for await (const dirEntry of Deno.readDir(SRC_DIR)) {
if (!dirEntry.isDirectory || !dirEntry.name.match(/^\d{4}$/)) { if (!dirEntry.isDirectory || !dirEntry.name.match(/^\d{4}$/)) {
continue; continue;

View file

@ -1,6 +1,7 @@
--- ---
import { setWeek, nextMonday, format, addDays } from 'date-fns'; import { setWeek, nextMonday, format, addDays } from 'date-fns';
const { issue } = Astro.props; const { issue, isFull } = Astro.props;
import config from '../config.yaml';
const [ year, week ] = issue.week.split('-'); const [ year, week ] = issue.week.split('-');
const current = false; const current = false;
@ -10,16 +11,16 @@ const current = false;
<div class=`mb-8 border border-white/20`> <div class=`mb-8 border border-white/20`>
<div class=`flex w-full p-4 sm:p-6 bg-white/10`> <div class=`sm:flex w-full p-4 sm:p-6 bg-white/10`>
<div class="grid gap-2 sm:gap-6 sm:flex items-center"> <div class="grid gap-2 sm:gap-6 sm:flex items-center">
<h1 class="text-2xl"><a href=`/issue/${issue.week}`>Week {issue.week.split('-').join('/')}</a></h1> <h1 class="text-2xl"><a href=`/issue/${issue.week}`>Week {issue.week.split('-').reverse().join('/')}</a></h1>
<div class=`text-xl ${current ? "text-white/50" : ""}`>{format(issue.period[0], "MMM d")} - {format(issue.period[1], "MMM d, yyyy")}</div> <div class=`text-xl ${current ? "text-white/50" : ""}`>{format(issue.period[0], "MMM d")} - {format(issue.period[1], "MMM d, yyyy")}</div>
{!issue.published && {!issue.published &&
<div class="text-white">🚧 Future edition</div> <div class="text-white">🚧 Future edition</div>
} }
</div> </div>
<div class="grow"></div> <div class="grow"></div>
<div class="flex gap-4 items-center"> <div class="mt-2 sm:mt-0 flex gap-4 items-center">
{issue.published && {issue.published &&
<a href={issue.published}>Paragraph</a> <a href={issue.published}>Paragraph</a>
} }
@ -30,4 +31,27 @@ const current = false;
<div class="p-4 sm:p-6"> <div class="p-4 sm:p-6">
<div class="news-content" set:html={issue.newsHtml}></div> <div class="news-content" set:html={issue.newsHtml}></div>
</div> </div>
{!issue.published && isFull &&
<div class="w-full bg-white/10">
<div class="p-4">
<div class="text-xl">Release helper</div>
<table class="release-helper">
<tr>
<th>Title</th>
<td><textarea rows="1" cols="65">{config.name} - {issue.week.split('-').reverse().join('/')}</textarea></td>
</tr>
<tr>
<th>Slug</th>
<td><textarea rows="1" cols="65">{issue.week}</textarea></td>
</tr>
<tr>
<th>Post preview</th>
<td><textarea rows="3" cols="65">{config.template.preview.trim()} This edition covers period {format(issue.period[0], "MMM d")} - {format(issue.period[1], "MMM d, yyyy")}.</textarea></td>
</tr>
</table>
</div>
</div>
}
</div> </div>

View file

@ -1,5 +1,9 @@
name: Week in the Privacy News
cats: cats:
events: events:
title: Events title: Events
gov: gov:
title: Government title: Government
template:
preview: |
Weekly newsletter with round-up of the most important news happening around privacy in Web3.

View file

@ -1,5 +1,6 @@
--- ---
import '../styles/base.css'; import '../styles/base.css';
import config from '../config.yaml';
--- ---
<html lang="en"> <html lang="en">
@ -8,14 +9,14 @@ import '../styles/base.css';
<link rel="icon" type="image/svg+xml" href="/favicon.svg" /> <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width" /> <meta name="viewport" content="width=device-width" />
<meta name="generator" content={Astro.generator} /> <meta name="generator" content={Astro.generator} />
<title>Week in the Privacy News | Web3Privacy Now</title> <title>{config.name} | Web3Privacy Now</title>
</head> </head>
<body> <body>
<div class="m-4 sm:m-8"> <div class="m-4 sm:m-8">
<div class="md:flex w-full"> <div class="md:flex w-full">
<div class="flex gap-6"> <div class="flex gap-6">
<a href="https://web3privacy.info"><div class="w3pn-logo h-6 sm:h-8 md:h-10"></div></a> <a href="https://web3privacy.info"><div class="w3pn-logo h-6 sm:h-8 md:h-10"></div></a>
<h1 class="text-lg sm:text-2xl md:text-3xl lg:text-4xl font-bold">Week in the Privacy News</h1> <h1 class="text-lg sm:text-2xl md:text-3xl lg:text-4xl font-bold">{config.name}</h1>
</div> </div>
<div class="grow"></div> <div class="grow"></div>
<div class="flex gap-3 mt-4 md:mt-0 items-center"> <div class="flex gap-3 mt-4 md:mt-0 items-center">

View file

@ -20,5 +20,5 @@ const issue = issues.find(item => item.week === week);
<div class="mb-8"> <div class="mb-8">
<a href="/">← Show latest edition</a> <a href="/">← Show latest edition</a>
</div> </div>
<WeekNews {issue} /> <WeekNews {issue} isFull={true} />
</BaseLayout> </BaseLayout>

View file

@ -37,6 +37,17 @@
.news-content li { .news-content li {
@apply ml-6 mb-2; @apply ml-6 mb-2;
} }
.release-helper {
@apply m-4;
}
.release-helper th {
@apply pr-4 text-right;
}
.release-helper textarea {
@apply text-white bg-black p-2;
}
} }
.w3pn-logo { .w3pn-logo {