remove unused Footer

+ fix AvatarList (still unused)
This commit is contained in:
Felix Roos 2023-02-17 21:48:34 +01:00
parent 18d3a7e23a
commit 540bd938f2
4 changed files with 123 additions and 144 deletions

View file

@ -4,9 +4,9 @@ type Props = {
path: string; path: string;
}; };
const { path } = Astro.props as Props; const { path } = Astro.props as Props;
const resolvedPath = `examples/docs/${path}`; const resolvedPath = `website/src/pages${path}.mdx`;
const url = `https://api.github.com/repos/withastro/astro/commits?path=${resolvedPath}`; const url = `https://api.github.com/repos/tidalcycles/strudel/commits?path=${resolvedPath}`;
const commitsURL = `https://github.com/withastro/astro/commits/main/${resolvedPath}`; const commitsURL = `https://github.com/tidalcycles/strudel/commits/main/${resolvedPath}`;
type Commit = { type Commit = {
author: { author: {
@ -19,9 +19,7 @@ async function getCommits(url: string) {
try { try {
const token = import.meta.env.SNOWPACK_PUBLIC_GITHUB_TOKEN ?? 'hello'; const token = import.meta.env.SNOWPACK_PUBLIC_GITHUB_TOKEN ?? 'hello';
if (!token) { if (!token) {
throw new Error( throw new Error('Cannot find "SNOWPACK_PUBLIC_GITHUB_TOKEN" used for escaping rate-limiting.');
'Cannot find "SNOWPACK_PUBLIC_GITHUB_TOKEN" used for escaping rate-limiting.'
);
} }
const auth = `Basic ${Buffer.from(token, 'binary').toString('base64')}`; const auth = `Basic ${Buffer.from(token, 'binary').toString('base64')}`;
@ -39,7 +37,7 @@ async function getCommits(url: string) {
if (!res.ok) { if (!res.ok) {
throw new Error( throw new Error(
`Request to fetch commits failed. Reason: ${res.statusText} `Request to fetch commits failed. Reason: ${res.statusText}
Message: ${data.message}` Message: ${data.message}`,
); );
} }
@ -53,11 +51,11 @@ async function getCommits(url: string) {
function removeDups(arr: Commit[]) { function removeDups(arr: Commit[]) {
const map = new Map<string, Commit['author']>(); const map = new Map<string, Commit['author']>();
for (let item of arr) { for (let item of arr) {
const author = item.author; const author = item.author;
// Deduplicate based on author.id // Deduplicate based on author.id
map.set(author.id, { login: author.login, id: author.id }); //map.set(author.id, { login: author.login, id: author.id });
author && map.set(author.id, { login: author.login, id: author.id });
} }
return [...map.values()]; return [...map.values()];
@ -70,7 +68,7 @@ const additionalContributors = unique.length - recentContributors.length; // lis
--- ---
<!-- Thanks to @5t3ph for https://smolcss.dev/#smol-avatar-list! --> <!-- Thanks to @5t3ph for https://smolcss.dev/#smol-avatar-list! -->
<div class="contributors"> <div class="contributors px-4 mb-8">
<ul class="avatar-list" style={`--avatar-count: ${recentContributors.length}`}> <ul class="avatar-list" style={`--avatar-count: ${recentContributors.length}`}>
{ {
recentContributors.map((item) => ( recentContributors.map((item) => (

View file

@ -1,19 +0,0 @@
---
import AvatarList from './AvatarList.astro';
type Props = {
path: string;
};
const { path } = Astro.props as Props;
---
<footer>
<AvatarList path={path} />
</footer>
<style>
footer {
margin-top: auto;
padding: 2rem;
border-top: 3px solid var(--theme-divider);
}
</style>

View file

@ -2,6 +2,7 @@
import TableOfContents from './TableOfContents'; import TableOfContents from './TableOfContents';
import MoreMenu from './MoreMenu.astro'; import MoreMenu from './MoreMenu.astro';
import type { MarkdownHeading } from 'astro'; import type { MarkdownHeading } from 'astro';
import AvatarList from '../Footer/AvatarList.astro';
type Props = { type Props = {
headings: MarkdownHeading[]; headings: MarkdownHeading[];
@ -17,4 +18,5 @@ currentPage = currentPage.endsWith('/') ? currentPage.slice(0, -1) : currentPage
<nav aria-labelledby="grid-right" class="w-64 text-foreground"> <nav aria-labelledby="grid-right" class="w-64 text-foreground">
<TableOfContents client:media="(min-width: 50em)" headings={headings} currentPage={currentPage} /> <TableOfContents client:media="(min-width: 50em)" headings={headings} currentPage={currentPage} />
<MoreMenu editHref={githubEditUrl} /> <MoreMenu editHref={githubEditUrl} />
<!-- <AvatarList path={currentPage} /> -->
</nav> </nav>

View file

@ -7,7 +7,6 @@ import LeftSidebar from '../components/LeftSidebar/LeftSidebar.astro';
import RightSidebar from '../components/RightSidebar/RightSidebar.astro'; import RightSidebar from '../components/RightSidebar/RightSidebar.astro';
import * as CONFIG from '../config'; import * as CONFIG from '../config';
import type { MarkdownHeading } from 'astro'; import type { MarkdownHeading } from 'astro';
import Footer from '../components/Footer/Footer.astro';
import '../docs/docs.css'; import '../docs/docs.css';
type Props = { type Props = {
@ -49,7 +48,6 @@ const githubEditUrl = `${CONFIG.GITHUB_EDIT_URL}/${currentFile}`;
</aside> </aside>
</div> </div>
</main> </main>
<!-- <Footer path={currentFile} /> -->
</div> </div>
</body> </body>
</html> </html>