---

import { compareDesc, format } from 'date-fns'
import { toZonedTime } from 'date-fns-tz'

import BaseLayout from '../layouts/BaseLayout.astro';

import HR from "../components/HR.astro";
import MDXCallout from '../components/mdx/MDXCallout.astro';

import sfjson from "../data/sharefeed.json";
import type { ShareFeedEntry } from "../lib/utils";

const entries = sfjson.sharefeed
    .sort((a:ShareFeedEntry,b:ShareFeedEntry) => compareDesc(new Date(a.date), new Date(b.date)))
    .filter((entry: ShareFeedEntry) => !(entry.draft))

---

<BaseLayout title="sharefeed">
	<h1 class="font-serif text-3xl my-2">Sharefeed</h2>
	<p class="mb-2">Sometimes, I come across other people&apos;s blog posts, articles, or other resources that I find interesting. This is my space to share those resources with you.</p>
	<p class="mb-2">Every link includes a brief note or summary that I wrote up describing that specific entry and why I find it interesting or noteworthy.</p>
	<MDXCallout>&quot;interesting&quot; does not necessarily mean &quot;good&quot;, &quot;factual&quot;, or even &quot;ethical&quot;. Sometimes, I may link something here because I <b>don&apos;t</b> like it and want to debunk it later. In these cases, I will make sure to specify that fact. Be sure to keep an eye on my journal or blog when I post one of those.</MDXCallout>
	<p class="mb-2">If you want to subscribe to this feed on your RSS reader, click the <a href="/feeds" class="text-subtitle text-sm font-serif">rss</a> button.</p>

	<HR/>

  	<ul class="space-y-2">
    	{entries.map((entry: ShareFeedEntry) => (
    		<li class="mb-2">
                <a href={entry.url} class="font-serif text-lg text-crusta-400 dark:text-night-300 hover:underline">
                    {entry.author ? `${entry.author}: ` : ''}
                    {entry.title}
                </a>
                <p class="text-sm text-subtitle">
                    <span class="italic">&lt; {entry.url} &gt;</span><br/>
                    {entry.pubDate ? `originally published on ${format(entry.pubDate, "LLLL d, yyyy")} - ` : ''}
                    retrieved {format(entry.date, "LLLL d, yyyy")}
                </p>
                <p>{entry.note}</p>
            </li>
      	))}
  </ul>
</BaseLayout>
