RSS feed merged to main branch #1
11
package-lock.json
generated
11
package-lock.json
generated
@ -8,7 +8,8 @@
|
|||||||
"name": "my-portfolio",
|
"name": "my-portfolio",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sveltejs/adapter-vercel": "^5.3.0"
|
"@sveltejs/adapter-vercel": "^5.3.0",
|
||||||
|
"moment": "^2.30.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@sveltejs/adapter-auto": "^3.0.0",
|
"@sveltejs/adapter-auto": "^3.0.0",
|
||||||
@ -2596,6 +2597,14 @@
|
|||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/moment": {
|
||||||
|
"version": "2.30.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz",
|
||||||
|
"integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==",
|
||||||
|
"engines": {
|
||||||
|
"node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/mri": {
|
"node_modules/mri": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz",
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
},
|
},
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sveltejs/adapter-vercel": "^5.3.0"
|
"@sveltejs/adapter-vercel": "^5.3.0",
|
||||||
|
"moment": "^2.30.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
22
src/lib/Commit.svelte
Normal file
22
src/lib/Commit.svelte
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<script>
|
||||||
|
import moment from 'moment';
|
||||||
|
export let link;
|
||||||
|
export let title;
|
||||||
|
export let description;
|
||||||
|
export let published;
|
||||||
|
export let author;
|
||||||
|
const pubAgo = moment(published).fromNow();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="block p-6 bg-white border border-gray-200 rounded-lg shadow hover:bg-gray-100 dark:bg-gray-800 dark:border-gray-700 dark:hover:bg-gray-700"
|
||||||
|
>
|
||||||
|
<div class="mb-2 text-2xl font-semibold tracking-tight text-gray-900 dark:text-white">
|
||||||
|
{@html title}
|
||||||
|
</div>
|
||||||
|
<div class="font-normal hover:text-slate-400">
|
||||||
|
{@html description}
|
||||||
|
</div>
|
||||||
|
<div>commited {pubAgo} by {@html author}</div>
|
||||||
|
<a class="hover:text-slate-400 underline" href={link}>view commit</a>
|
||||||
|
</div>
|
@ -1,7 +1,9 @@
|
|||||||
<script>
|
<script>
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
|
import Spinner from './Spinner.svelte';
|
||||||
|
import Commit from './Commit.svelte';
|
||||||
|
|
||||||
const url = 'https://gitea.rannes.dev/rannes.dev/my-portfolio.rss';
|
export let url;
|
||||||
|
|
||||||
let feed = null;
|
let feed = null;
|
||||||
let error = null;
|
let error = null;
|
||||||
@ -33,18 +35,16 @@
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if error}
|
<div class="my-4">
|
||||||
|
{#if error}
|
||||||
<p>Error: {error}</p>
|
<p>Error: {error}</p>
|
||||||
{:else if !feed}
|
{:else if !feed}
|
||||||
<p>Loading...</p>
|
<Spinner />
|
||||||
{:else}
|
{:else}
|
||||||
<div>
|
<div class="flex flex-col gap-2">
|
||||||
{#each feed.slice(0, 5) as item}
|
{#each feed.slice(0, 5) as commit}
|
||||||
<div>
|
<Commit {...commit} />
|
||||||
<h3>{@html item.title}</h3>
|
|
||||||
<p>{@html item.description}</p>
|
|
||||||
<a href={item.link} target="_blank">Read more</a>
|
|
||||||
</div>
|
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
</div>
|
||||||
|
19
src/lib/Spinner.svelte
Normal file
19
src/lib/Spinner.svelte
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<div role="status">
|
||||||
|
<svg
|
||||||
|
aria-hidden="true"
|
||||||
|
class="inline w-8 h-8 text-gray-200 animate-spin dark:text-gray-600 fill-gray-600 dark:fill-gray-300"
|
||||||
|
viewBox="0 0 100 101"
|
||||||
|
fill="none"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
|
||||||
|
fill="currentColor"
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
|
||||||
|
fill="currentFill"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
<span class="sr-only">Loading...</span>
|
||||||
|
</div>
|
@ -79,5 +79,5 @@
|
|||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
<footer class="mt-12">
|
<footer class="mt-12">
|
||||||
<p class="text-sm text-gray-400">built and hosted by christian rannes 2024</p>
|
<p class="text-sm text-gray-400">built by christian rannes 2024</p>
|
||||||
</footer>
|
</footer>
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
<script>
|
<script>
|
||||||
import { fade } from 'svelte/transition';
|
import { fade } from 'svelte/transition';
|
||||||
import RssFeed from '../../lib/RssFeed.svelte';
|
import RssFeed from '../../lib/RssFeed.svelte';
|
||||||
|
|
||||||
|
const projectRssUrl = 'https://gitea.rannes.dev/rannes.dev/my-portfolio.rss';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div in:fade>
|
<div in:fade>
|
||||||
@ -19,5 +21,6 @@
|
|||||||
>Read more about that here.</a
|
>Read more about that here.</a
|
||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
<RssFeed />
|
<h2 class="text-xl mt-4">Most recent commits</h2>
|
||||||
|
<RssFeed url={projectRssUrl} />
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user