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";
async function build() {
const issues = [];
let issues = [];
for await (const dirEntry of Deno.readDir(SRC_DIR)) {
if (!dirEntry.isDirectory || !dirEntry.name.match(/^\d{4}$/)) {
continue;

View File

@ -1,6 +1,7 @@
---
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 current = false;
@ -10,16 +11,16 @@ const current = false;
<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">
<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>
{!issue.published &&
<div class="text-white">🚧 Future edition</div>
}
</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 &&
<a href={issue.published}>Paragraph</a>
}
@ -30,4 +31,27 @@ const current = false;
<div class="p-4 sm:p-6">
<div class="news-content" set:html={issue.newsHtml}></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>

View File

@ -1,5 +1,9 @@
name: Week in the Privacy News
cats:
events:
title: Events
gov:
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 config from '../config.yaml';
---
<html lang="en">
@ -8,14 +9,14 @@ import '../styles/base.css';
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width" />
<meta name="generator" content={Astro.generator} />
<title>Week in the Privacy News | Web3Privacy Now</title>
<title>{config.name} | Web3Privacy Now</title>
</head>
<body>
<div class="m-4 sm:m-8">
<div class="md:flex w-full">
<div class="flex gap-6">
<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 class="grow"></div>
<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">
<a href="/">← Show latest edition</a>
</div>
<WeekNews {issue} />
<WeekNews {issue} isFull={true} />
</BaseLayout>

View File

@ -37,6 +37,17 @@
.news-content li {
@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 {