-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bold link, nav-start for status and settings Fix build page margins Rimuovi prestito dall'inglese Underline CSUnibo homepage link Stop showing badges for disabled teachings Stop showing badges for disabled teachings 2 build/page.ts Fix Comment out refactor getActiveTeachings chore: create and use filterAsync
- Loading branch information
Showing
9 changed files
with
116 additions
and
106 deletions.
There are no files selected for viewing
Submodule config
updated
from 09691a to 175aea
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* Filters an array asynchronously using a predicate function. | ||
* @param arr The array to filter | ||
* @param predicate The predicate function to use | ||
* @returns The filtered array | ||
*/ | ||
export async function filterAsync<T>( | ||
arr: T[], | ||
predicate: (t: T) => Promise<boolean> | ||
): Promise<T[]> { | ||
const result = Array<T>(arr.length); | ||
for (const item of arr) { | ||
if (await predicate(item)) { | ||
result.push(item); | ||
} | ||
} | ||
return result; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,84 +1,60 @@ | ||
<script lang="ts"> | ||
import type { PageData } from './$types'; | ||
import { onMount } from 'svelte'; | ||
import type { Teaching } from '$lib/teachings'; | ||
import TEACHINGS from '$lib/teachings'; | ||
const WORKFLOW_NAMES = ['filenames', 'build-and-deploy']; | ||
const PROJECTS = [ | ||
{ | ||
title: 'Bot', | ||
projects: [{ name: 'Informabot', url: 'informabot', workflows: ['codeql'] }] | ||
}, | ||
{ | ||
title: 'Web scrapers', | ||
projects: [{ name: 'Raccoglitesi', url: 'raccoglitesi', workflows: ['pages'] }] | ||
}, | ||
{ | ||
title: 'Modelli di tesi', | ||
projects: [ | ||
{ name: 'Asciidoc', url: 'asciidoc-thesis', workflows: ['asciidoc'] }, | ||
{ name: 'LaTeX', url: 'latex-thesis', workflows: ['tex'] } | ||
] | ||
}, | ||
{ | ||
title: 'Altro', | ||
projects: [ | ||
{ name: 'csurename', url: 'csurename', workflows: ['rust'] }, | ||
{ name: 'Diario tirocinio', url: 'diario-tirocinio', workflows: ['pages'] }, | ||
{ name: 'Laboratori', url: 'lab', workflows: ['check', 'build-and-deploy'] } | ||
] | ||
} | ||
]; | ||
const WORKFLOW_NAMES = ['filenames', 'build-and-deploy']; | ||
const WORKFLOW_URL = (project: string, workflow: string) => | ||
`https://github.com/csunibo/${project}/actions/workflows/${workflow}.yml`; | ||
</script> | ||
<div class="m-8"> | ||
{#each TEACHINGS as course, i} | ||
{#if i > 0} | ||
<hr class="my-8 border-primary" /> | ||
{/if} | ||
<h2 class="text-center text-2xl">{course.name}</h2> | ||
{#each course.years as years} | ||
<h3 class="text-center text-xl font-bold my-4">{years.year}</h3> | ||
<div class="grid grid-cols-4 gap-4"> | ||
{#each years.teachings as teaching} | ||
<div> | ||
<h4 class="font-bold">{teaching.name}</h4> | ||
<div class="flex gap-2"> | ||
{#each WORKFLOW_NAMES as workflow} | ||
{@const href = WORKFLOW_URL(teaching.url, workflow)} | ||
{@const src = `${href}/badge.svg`} | ||
<a {href}> | ||
<img {src} alt="Not found" /> | ||
</a> | ||
{/each} | ||
</div> | ||
</div> | ||
{/each} | ||
</div> | ||
{/each} | ||
{/each} | ||
export let data: PageData; | ||
let activeYears: Teaching[][] = []; | ||
<hr class="my-12 border-primary" /> | ||
<h2 class="text-center text-2xl">Progetti</h2> | ||
onMount(async () => { | ||
activeYears = (await data.streaming?.activeCourses) ?? []; | ||
console.log(data); | ||
}); | ||
</script> | ||
|
||
{#each PROJECTS as category} | ||
<h3 class="text-center text-xl font-bold my-4">{category.title}</h3> | ||
<div class="grid grid-cols-4 gap-4"> | ||
{#each category.projects as proj} | ||
<div> | ||
<h4 class="font-bold">{proj.name}</h4> | ||
<div class="flex gap-2"> | ||
{#each proj.workflows as workflow} | ||
{@const href = WORKFLOW_URL(proj.url, workflow)} | ||
{@const src = `${href}/badge.svg`} | ||
<a {href}> | ||
<img {src} alt="Not found" /> | ||
</a> | ||
{/each} | ||
</div> | ||
<main class="md:container md:m-auto p-4"> | ||
<nav class="navbar flex bg-base-200 text-neutral-content rounded-box shadow-sm px-5 mb-5"> | ||
<div class="navbar-start"> | ||
<h1 class="text-xl font-semibold text-base-content">Stato delle raccolte</h1> | ||
</div> | ||
<div class="navbar-end"> | ||
<a class="btn btn-square btn-ghost" title="Indietro" href="/"> ⬆️ </a> | ||
</div> | ||
</nav> | ||
<div class="m-8"> | ||
{#each TEACHINGS as course, i} | ||
{#if i > 0} | ||
<hr class="my-8 border-primary" /> | ||
{/if} | ||
<h2 class="text-center text-2xl">{course.name}</h2> | ||
<!-- {@const activeTeachings = activeYears[i]} --> | ||
{#each course.years as years} | ||
<h3 class="text-center text-xl font-bold my-4">{years.year}</h3> | ||
<div class="grid grid-cols-4 gap-4"> | ||
{#each years.teachings as teaching} | ||
<!-- {@const enabled = activeTeachings.includes(teaching)} --> | ||
<div> | ||
<h4 class="font-bold">{teaching.name}</h4> | ||
<!-- {#if enabled} --> | ||
<div class="flex gap-2"> | ||
{#each WORKFLOW_NAMES as workflow} | ||
{@const href = WORKFLOW_URL(teaching.url, workflow)} | ||
{@const src = `${href}/badge.svg`} | ||
<a {href}> | ||
<img {src} alt="Not found" /> | ||
</a> | ||
{/each} | ||
</div> | ||
<!-- {/if} --> | ||
</div> | ||
{/each} | ||
</div> | ||
{/each} | ||
</div> | ||
{/each} | ||
</div> | ||
{/each} | ||
</div> | ||
</main> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import type { PageLoad } from './$types'; | ||
import { getActiveTeachings } from '$lib/teachings'; | ||
import TEACHINGS from '$lib/teachings'; | ||
|
||
export const load: PageLoad = async ({ fetch }) => { | ||
const activeTeachings = TEACHINGS.map((c) => getActiveTeachings(fetch, c)); | ||
|
||
return { | ||
activeTeachings: Promise.all(activeTeachings) | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters