Skip to content

Commit dd433f6

Browse files
committed
Adds permissionator, removes lazy loading readme, adds readme to error page
1 parent 16c2231 commit dd433f6

File tree

5 files changed

+37
-20
lines changed

5 files changed

+37
-20
lines changed

src/components/LangBadge.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
'c#': { name: 'C#', color: '239120', icon: 'csharp' },
2929
coffeescript: { name: 'CoffeeScript', color: '2F2625', icon: 'coffeescript' },
3030
crystal: { name: 'crystal', color: '000000', icon: 'crystal' },
31-
css: { name: 'CSS', color: '563D7C', icon: 'css3' },
31+
css: { name: 'CSS', color: '563D7C', icon: 'css' },
3232
config: { name: 'Config', color: 'EF1970', icon: 'haveibeenpwned' },
3333
d3: { name: 'D3.js', color: 'F9A03C', icon: 'd3dotjs' },
3434
dart: { name: 'Dart', color: '0175C2', icon: 'dart' },
@@ -53,6 +53,7 @@
5353
nim: { name: 'Nim', color: 'FFE953', icon: 'nim' },
5454
markdown: { name: 'Markdown', color: '000000', icon: 'markdown' },
5555
makefile: { name: 'Makefile', color: '006600', icon: 'cmake' },
56+
marko: { name: 'Marko', color: '2596BE', icon: 'marko' },
5657
ocaml: { name: ' OCaml', color: 'EC6813', icon: ' ocaml' },
5758
perl: { name: 'Perl', color: '39457E', icon: 'perl' },
5859
php: { name: 'PHP', color: '777BB4', icon: 'php' },

src/components/Nav.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
66
if (typeof window !== 'undefined') {
77
const hostname = window.location.hostname;
8-
if (hostname.endsWith('aliciasykes.com')) {
8+
if (hostname.includes('aliciasykes.com')) {
99
siteName = 'Alicia Sykes';
1010
}
11-
else if (hostname.endsWith('lissy93.github.io')) {
11+
else if (hostname.includes('lissy93.github.io')) {
1212
siteName = 'Lissy93';
1313
}
1414
}

src/config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,16 @@ export default {
7575
screenshot: 'https://storage.googleapis.com/as93-screenshots/project-screenshots/ansibles.gif',
7676
color: '#d95de8',
7777
},
78+
{
79+
name: 'permissionator',
80+
title: 'Permissionator',
81+
description: 'A Linux chmod calculator, for generating safe file permissions',
82+
icon: 'https://github.com/Lissy93/permissionator/blob/main/public/logo.png?raw=true',
83+
screenshot: 'https://github.com/Lissy93/permissionator/blob/main/public/screenshot.png?raw=true',
84+
homepage: 'https://permissionator.as93.net/',
85+
mirror: 'https://codeberg.org/alicia/permissionator',
86+
color: '#05df72',
87+
},
7888
{
7989
name: 'portainer-templates',
8090
title: 'Portainer Template',

src/routes/+error.svelte

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
import { page } from '$app/stores';
33
import { onMount } from 'svelte';
44
import config from '../config';
5-
import { fetchRepoDetails, findRepoMeta } from '../helpers/fetchRepo';
5+
import { fetchReadme, fetchRepoDetails, findRepoMeta } from '../helpers/fetchRepo';
66
import type { Project } from '../types/Project';
77
import ProjectHero from '../components/ProjectHero.svelte';
8+
import ProjectReadme from '../components/ProjectReadme.svelte';
89
910
let gitHubPagesUrl = '';
1011
@@ -35,6 +36,12 @@
3536
console.error('Error fetching repo details', err);
3637
});
3738
}
39+
const readme = await fetchReadme(config.githubUser, repo, fetch)
40+
.catch((error) => {
41+
console.error(`Error fetching README: ${error.message}`);
42+
return '';
43+
});
44+
data.readme = readme || '';
3845
3946
});
4047
</script>
@@ -54,11 +61,17 @@
5461
<ProjectHero project={data.repoDetails} meta={data.meta} />
5562
{/if}
5663

57-
<p>Oops, something's gone a bit wrong here</p>
58-
<h1>{$page.status}</h1>
59-
<p class="emoji">😢</p>
60-
{#if $page?.error?.message}
61-
<p>{$page.error.message}</p>
64+
{#if data.repoDetails && data.repoDetails.id && data.readme}
65+
<ProjectReadme project={data.repoDetails} readme={data.readme} />
66+
{/if}
67+
68+
{#if !data || !data.repoDetails || !data.repoDetails.id}
69+
<p>Oops, something's gone a bit wrong here</p>
70+
<h1>{$page.status}</h1>
71+
<p class="emoji">😢</p>
72+
{#if $page?.error?.message}
73+
<p>{$page.error.message}</p>
74+
{/if}
6275
{/if}
6376

6477
<style lang="scss">
@@ -80,11 +93,9 @@ p {
8093
}
8194
8295
.has-github-pages {
83-
position: fixed;
84-
top: 0;
85-
left: 0;
86-
right: 0;
87-
width: 100%;
96+
position: relative;
97+
display: flex;
98+
justify-content: center;
8899
background-color: var(--primary);
89100
padding: 0.25rem;
90101
text-align: center;

src/routes/[repo]/+page.svelte

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232
3333
let notFound = false;
3434
35-
let readmeComponent: Promise<typeof import('../../components/ProjectReadme.svelte')>;
36-
3735
onMount(() => {
3836
// Check if project is found, if not, set notFound to true to show 404
3937
if (
@@ -44,7 +42,6 @@
4442
}
4543
4644
// Import readme
47-
readmeComponent = import('../../components/ProjectReadme.svelte')
4845
4946
// Fetch (or attempt to) the most-up-to-date repo details
5047
fetchRepoDetails(config.githubUser, $page.params.repo, fetch)
@@ -66,9 +63,7 @@
6663
{:else}
6764
<ProjectHero project={data.repoDetails} meta={data.meta} />
6865
{#if data.readme}
69-
{#await readmeComponent then resolvedComponent}
70-
<svelte:component this={resolvedComponent?.default} project={data.repoDetails} readme={data.readme} />
71-
{/await}
66+
<ProjectReadme project={data.repoDetails} readme={data.readme} />
7267
{/if}
7368
{/if}
7469

0 commit comments

Comments
 (0)