Skip to content

Commit

Permalink
close #679
Browse files Browse the repository at this point in the history
  • Loading branch information
jstet committed Mar 6, 2024
1 parent c45ac20 commit ca90b28
Show file tree
Hide file tree
Showing 79 changed files with 1,193 additions and 1,728 deletions.
4 changes: 3 additions & 1 deletion dl_external_imgs.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ async function findUrls(fileContent, filePath) {
const timeoutPromise = new Promise((resolve, reject) => {
setTimeout(() => {
reject(new Error(`Request for ${url} timed out`));
}, 15000);
}, 25000);
});

try {
Expand All @@ -144,6 +144,7 @@ async function findUrls(fileContent, filePath) {
// Retry the request only if it is a timeout error and the maximum number of retries has not been reached
if (
error.message === `Request for ${url} timed out` ||
error.code === 'UND_ERR_CONNECT_TIMEOUT' ||
error.message === `API may be under pressure`
) {
if (retryCount < maxRetries) {
Expand All @@ -155,6 +156,7 @@ async function findUrls(fileContent, filePath) {
throw error;
}
} else {
console.log('here');
throw error;
}
}
Expand Down
18 changes: 13 additions & 5 deletions src/lib/components/Avatar.svelte
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
<script>
import PersonPlaceholder from '../svg/PersonPlaceholder.svelte';
export let src = void 0;
export let alt;
export let imageSrc = void 0;
export let imageAlt;
export let imageDesc = void 0;
export let w = 56;
</script>

<div class="relative">
<div class="offset relative w-{w} mx-auto mt-3 md:mx-4">
{#if src}
<img class="h-56 w-56 rounded border-4 border-neutral" {src} {alt} />
{#if imageSrc}
<img
class="h-56 w-56 rounded border-4 border-neutral"
src={imageSrc}
alt={imageAlt}
/>
{:else}
<div class="rounded border-4 border-neutral">
<div
class="rounded border-4 border-neutral"
aria-label="Person placeholder image"
role="img"
>
<PersonPlaceholder width={200} height={200} />
</div>
{/if}
Expand Down
16 changes: 8 additions & 8 deletions src/lib/components/Awards.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script>
export let year;
export let image;
export let alt;
export let imageSrc;
export let imageAlt;
export let title;
export let imageDesc;
export let imageOnRightSide = false;
Expand All @@ -14,11 +14,11 @@
: 'md:visible'} col-span-full mx-4 flex-col justify-center md:col-span-4"
>
<div class="offset relative mx-auto w-full" style="padding-bottom: 56.25%;">
{#if image}
{#if imageSrc}
<img
class="absolute left-0 top-0 z-0 h-full w-full rounded border-4 border-neutral"
src={image}
{alt}
src={imageSrc}
alt={imageAlt}
/>
{/if}
</div>
Expand All @@ -42,11 +42,11 @@
: 'md:hidden'} col-span-full mx-4 hidden flex-col justify-center md:col-span-4"
>
<div class="offset relative mx-auto w-full" style="padding-bottom: 56.25%;">
{#if image}
{#if imageSrc}
<img
class="absolute left-0 top-0 z-0 h-full w-full rounded border-4 border-neutral"
src={image}
{alt}
src={imageSrc}
alt={imageAlt}
/>
{/if}
</div>
Expand Down
31 changes: 1 addition & 30 deletions src/lib/components/BlogCard.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,11 @@ describe('Blog Cards', () => {
langs: ['de-DE'],
title: 'Test blog post',
teaser: 'This eases the testing blog post',
pubdate: '2023-04-28T00:20:00',
pubDate: '2023-04-28T00:20:00',
contentCreators: [],
href: 'https://fakeurl.com',
imageAlt: 'Not image for testing',
};
const blogPropsSlug = {
langs: ['de-DE'],
title: 'Test blog post',
teaser: 'This eases the testing blog post',
pubdate: '2023-04-28T00:20:00',
contentCreators: [],
slug: 'blog-post-slug',
imageAlt: 'Not image for testing',
};

test('Can be initialized with href', () => {
locale.set('de');
Expand All @@ -31,24 +22,4 @@ describe('Blog Cards', () => {
'https://fakeurl.com',
);
});

test('Can be initialized with slug locale de', () => {
locale.set('de');
render(BlogCard, {props: blogPropsSlug});

expect(screen.getByText('Test blog post').closest('a')).toHaveAttribute(
'href',
'/blog/blog-post-slug',
);
});

test('Can be initialized with slug locale en', () => {
locale.set('en');
render(BlogCard, {props: blogPropsSlug});

expect(screen.getByText('Test blog post').closest('a')).toHaveAttribute(
'href',
'/en/blog/blog-post-slug',
);
});
});
11 changes: 6 additions & 5 deletions src/lib/components/BlogCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// export let tags;
export let contentCreators;
export let pubDate;
export let imageUrl = void 0;
export let imageSrc = void 0;
export let href;
export let external = false;
export let imageDesc = void 0;
Expand All @@ -21,15 +21,16 @@
<span
class="absolute inset-x-0 bottom-0 z-10 h-2 rounded-b bg-gradient-to-r from-primary to-secondary opacity-75"
/>
<Langs {langs} />

<div class="absolute right-0 top-0 z-20 p-2">
<Langs {langs} />
</div>
<div class="flex">
<a class="relative mx-auto w-full" {href} style="padding-bottom: 56.25%;">
{#if typeof imageUrl !== 'undefined'}
{#if typeof imageSrc !== 'undefined'}
<img
class="absolute left-0 top-0 z-0 h-full w-full rounded-tl"
alt={imageAlt}
src={imageUrl}
src={imageSrc}
title={imageDesc}
/>
{:else}
Expand Down
16 changes: 8 additions & 8 deletions src/lib/components/EventsCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@
export let href;
export let title;
export let type;
import {page} from '$app/stores';
import {genLcHref} from '$lib/js/helpers';
export let teaser;
export let procDate;
export let endDate = void null;
export let tags;
export let language;
export let localChapters = [];
export let procLocalChapters = [];
import Langs from '$lib/components/Langs.svelte';
</script>

Expand All @@ -32,7 +30,9 @@
{title}
</a>
</div>
<Langs langs={[language]} />
<div class="absolute right-0 top-0 z-20 p-2">
<Langs langs={[language]} />
</div>
<div class="mb-4">
<span
class="mr-2 line-clamp-1 inline-block whitespace-nowrap rounded bg-primary px-3 py-1 text-xs font-bold text-white"
Expand All @@ -51,14 +51,14 @@
{teaser}
</p>

{#if localChapters.length !== 0}
{#each localChapters as lc, i}
{#if procLocalChapters.length !== 0}
{#each procLocalChapters as lc, i}
<a
class="text-medium font-semibold text-base-content transition hover:text-primary"
href={genLcHref($page.params, lc.shortId)}
href={lc.href}
>
CorrelAidX {lc.city}</a
>{#if i < localChapters.length - 1}{', '} {/if}
>{#if i < procLocalChapters.length - 1}{', '} {/if}
{/each}
{/if}
</div>
Expand Down
8 changes: 4 additions & 4 deletions src/lib/components/Hero.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ describe('Hero', () => {
props: {
height: 'full',
text: 'Hello World',
gradient_only: true,
image_alt: 'No image for testing',
gradientOnly: true,
imageAlt: 'No image for testing',
},
});

Expand All @@ -22,8 +22,8 @@ describe('Hero', () => {
height: 'full',
text: 'Hello World',
correlaidx: true,
gradient_only: true,
image_alt: 'No image for testing',
gradientOnly: true,
imageAlt: 'No image for testing',
},
});

Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/Hero.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
export let text;
export let buttons = [];
export let correlaidx = false;
export let image = void 0;
export let imageSrc = void 0;
export let imageAlt = void 0;
export let imageDesc = void 0;
Expand All @@ -33,7 +33,7 @@
{#if gradientOnly === false}
<span
class="absolute top-0 h-full w-screen bg-cover bg-center bg-no-repeat"
style={`background-image: url(${image})`}
style={`background-image: url(${imageSrc})`}
aria-label={imageAlt}
role="img"
/>
Expand Down
22 changes: 6 additions & 16 deletions src/lib/components/JobCard.svelte
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<script>
import {t, locale} from '$lib/stores/i18n';
import {toLocalDateString, convertContractType} from '$lib/js/helpers';
import {t} from '$lib/stores/i18n';
export let title;
export let slug;
export let href;
export let summary;
export let fte;
export let type;
export let jobType;
export let language;
export let deadline;
export let procDeadline;
export let location;
export let salary;
export let tags = [];
Expand All @@ -16,18 +15,13 @@
import Time from '$lib/svg/Time.svelte';
import Location from '$lib/svg/Location.svelte';
import Salary from '$lib/svg/Salary.svelte';
export let href = '';
const iconSize = 22;
const listStyle = 'min-w-min mr-4 mb-2';
let cardDetails = {};
$: if (typeof slug !== 'undefined') {
href = $t('navbar.jobs').url + '/' + slug;
}
$: {
cardDetails = {};
cardDetails['workload'] = fte;
Expand All @@ -53,7 +47,7 @@
<div class="mb-2">
<span
class="mr-2 line-clamp-1 inline-block whitespace-nowrap rounded bg-primary px-3 py-1 text-xs font-bold text-white"
>{convertContractType(type, $locale)}</span
>{jobType}</span
>
{#each tags as tag}
<span
Expand Down Expand Up @@ -119,11 +113,7 @@
{summary}
</p>
<p class="text-semibold">
<strong>{$t('access.deadline').text}: </strong>{toLocalDateString(
deadline,
$locale,
true,
)}
<strong>{$t('access.deadline').text}: </strong>{procDeadline}
</p>
</div>
</div>
Expand Down
60 changes: 29 additions & 31 deletions src/lib/components/Langs.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,32 @@
const iconSize = 22;
</script>

<div class="absolute right-0 top-0 z-20 p-2">
{#if langs.length !== 2}
{#each langs as lang}
{#if lang == 'de-DE'}
<span
class="inline-block rounded-full bg-white p-1 shadow-none md:p-0"
aria-hidden="true"
>
<De height={iconSize} width={iconSize} />
</span>
<span class="sr-only">{$t(`access.language_`).text} {lang}</span>
{:else}
<span
class="inline-block rounded-full bg-white p-1 shadow-none md:p-0"
aria-hidden="true"
>
<En height={iconSize} width={iconSize} />
</span>
<span class="sr-only">{$t(`access.language_`).text} {lang}</span>
{/if}
{/each}
{:else}
<span
class="inline-block rounded-full bg-white p-1 shadow-none md:p-0"
aria-hidden="true"
>
<International height={iconSize} width={iconSize} />
</span>
<span class="sr-only">Bilingual</span>
{/if}
</div>
{#if langs.length !== 2}
{#each langs as lang}
{#if lang == 'de-DE'}
<span
class="inline-block rounded-full bg-white p-1 shadow-none md:p-0"
aria-hidden="true"
>
<De height={iconSize} width={iconSize} />
</span>
<span class="sr-only">{$t(`access.language_`).text} {lang}</span>
{:else}
<span
class="inline-block rounded-full bg-white p-1 shadow-none md:p-0"
aria-hidden="true"
>
<En height={iconSize} width={iconSize} />
</span>
<span class="sr-only">{$t(`access.language_`).text} {lang}</span>
{/if}
{/each}
{:else}
<span
class="inline-block rounded-full bg-white p-1 shadow-none md:p-0"
aria-hidden="true"
>
<International height={iconSize} width={iconSize} />
</span>
<span class="sr-only">Bilingual</span>
{/if}
Loading

0 comments on commit ca90b28

Please sign in to comment.