Skip to content

Commit 8da5230

Browse files
committed
close #1, close #35, close #17
1 parent 9cb9321 commit 8da5230

31 files changed

+662
-221
lines changed

.github/workflows/deploy.yml

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
1-
# name: Deploy to GitHub Pages
2-
3-
# on:
4-
# workflow_dispatch:
5-
# repository_dispatch:
6-
# types:
7-
# - webhook
8-
# push:
9-
# branches: 'main'
10-
11-
# jobs:
12-
# build_site:
13-
# runs-on: ubuntu-latest
14-
# steps:
15-
# - name: Checkout
16-
# uses: actions/checkout@v3
17-
18-
# - name: Install Node.js
19-
# uses: actions/setup-node@v3
20-
# with:
21-
# node-version: 18
22-
# cache: npm
23-
24-
# - name: Install dependencies
25-
# run: npm install
26-
27-
# - name: build
28-
# env:
29-
# BASE_PATH: '/${{ github.event.repository.name }}'
30-
# PUBLIC_API_URL: 'https://cms.jstet.net'
31-
# run: |
32-
# npm run build
33-
34-
# - name: Upload Artifacts
35-
# uses: actions/upload-pages-artifact@v2
36-
# with:
37-
# # this should match the `pages` option in your adapter-static options
38-
# path: 'build/'
39-
40-
# deploy:
41-
# needs: build_site
42-
# runs-on: ubuntu-latest
43-
44-
# permissions:
45-
# pages: write
46-
# id-token: write
47-
48-
# environment:
49-
# name: github-pages
50-
# url: ${{ steps.deployment.outputs.page_url }}
51-
52-
# steps:
53-
# - name: Deploy
54-
# id: deployment
55-
# uses: actions/deploy-pages@v2
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
workflow_dispatch:
5+
repository_dispatch:
6+
types:
7+
- webhook
8+
push:
9+
branches: 'main'
10+
11+
jobs:
12+
build_site:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v3
17+
18+
- name: Install Node.js
19+
uses: actions/setup-node@v3
20+
with:
21+
node-version: 18
22+
cache: npm
23+
24+
- name: Install dependencies
25+
run: npm install
26+
27+
- name: build
28+
env:
29+
BASE_PATH: '/${{ github.event.repository.name }}'
30+
PUBLIC_API_URL: 'https://cms.jstet.net'
31+
run: |
32+
npm run build
33+
34+
- name: Upload Artifacts
35+
uses: actions/upload-pages-artifact@v2
36+
with:
37+
# this should match the `pages` option in your adapter-static options
38+
path: 'build/'
39+
40+
deploy:
41+
needs: build_site
42+
runs-on: ubuntu-latest
43+
44+
permissions:
45+
pages: write
46+
id-token: write
47+
48+
environment:
49+
name: github-pages
50+
url: ${{ steps.deployment.outputs.page_url }}
51+
52+
steps:
53+
- name: Deploy
54+
id: deployment
55+
uses: actions/deploy-pages@v2

src/lib/components/Filter.svelte

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
<script>
2+
import {
3+
filter,
4+
genDropdownLists,
5+
setUrlParams,
6+
applyUrlSearchParams,
7+
} from '$lib/js/filter.js';
8+
import DropdownIcon from '$lib/svg/Dropdown.svelte';
9+
import _ from 'lodash';
10+
import Select from 'svelte-select';
11+
import {onMount} from 'svelte';
12+
import {page} from '$app/stores';
13+
14+
export let origData;
15+
export let filteredData;
16+
export let expanded = false;
17+
18+
export let selects;
19+
export let searchOptions;
20+
21+
let hidden = 'hidden';
22+
let ariaExpanded = false;
23+
let searchTerm;
24+
25+
const values = {};
26+
27+
onMount(async () => {
28+
// when searchParams is set, set them in filter
29+
applyUrlSearchParams($page.url.searchParams, values, selects);
30+
// if value is set dont hide filter (if someone goes to page with defined url param)
31+
if (expanded === false) {
32+
if (Object.values(values).some((value) => value !== null)) {
33+
hidden = 'visible';
34+
ariaExpanded = true;
35+
}
36+
} else {
37+
hidden = 'visible';
38+
}
39+
});
40+
$: selects = genDropdownLists(origData, selects);
41+
42+
function handleHidden() {
43+
hidden = hidden === 'hidden' ? 'visible' : 'hidden';
44+
ariaExpanded = ariaExpanded ? false : true;
45+
}
46+
47+
function changeVal(values_) {
48+
for (const key in values_) {
49+
if (values_.hasOwnProperty(key)) {
50+
_.find(selects, {param: key}).value = values_[key];
51+
}
52+
}
53+
}
54+
$: changeVal(values);
55+
56+
$: filteredData = filter(
57+
origData,
58+
selects,
59+
searchTerm,
60+
searchOptions,
61+
values,
62+
);
63+
64+
$: history.replaceState(
65+
history.state,
66+
'',
67+
setUrlParams($page.url, selects, values),
68+
);
69+
</script>
70+
71+
<div class="">
72+
<div class="border-neutral-25 border-b">
73+
<button
74+
class="inline-flex items-center justify-center pb-1 text-xl font-semibold transition hover:text-secondary"
75+
aria-expanded={ariaExpanded}
76+
aria-controls="filter"
77+
on:click={handleHidden}
78+
>
79+
Filter
80+
<DropdownIcon height={27} width={27} />
81+
</button>
82+
</div>
83+
<div
84+
class="text_width grid items-center gap-y-4 md:gap-x-6 {hidden}"
85+
id="filter"
86+
>
87+
<div class="">
88+
<span class="mt-4 block pb-1 text-lg font-semibold">Search</span>
89+
<div class="flex">
90+
<input
91+
bind:value={searchTerm}
92+
placeholder="Search..."
93+
class="border-neutral-25 h-full w-full rounded-md border p-2 pl-4"
94+
data-testid="filter-search"
95+
/>
96+
</div>
97+
</div>
98+
{#each selects as select}
99+
<div>
100+
<span class="mt-2 block pb-1 text-lg font-semibold">{select.title}</span
101+
>
102+
<div
103+
class={select.param !== 'language' && select.param !== 'langs'
104+
? 'capitalize'
105+
: ''}
106+
>
107+
<Select
108+
showChevron
109+
placeholder="Select"
110+
items={select.items}
111+
searchable={select.searchable}
112+
multiple={select.multiple}
113+
bind:value={values[select.param]}
114+
--list-z-index="30"
115+
>
116+
<div slot="empty" /></Select
117+
>
118+
</div>
119+
</div>
120+
{/each}
121+
</div>
122+
</div>
123+
124+
<style>
125+
</style>

src/lib/components/Pagination.svelte

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<script>
2+
import ArrowLeft from '../svg/ArrowLeft.svelte';
3+
import ArrowRight from '../svg/ArrowRight.svelte';
4+
5+
export let items;
6+
export let perPage;
7+
export let trimmedItems;
8+
9+
$: totalItems = items.length;
10+
$: currentPage = 0;
11+
$: totalPages = Math.ceil(totalItems / perPage);
12+
$: start = currentPage * perPage;
13+
$: end =
14+
currentPage === totalPages - 1 ? totalItems - 1 : start + perPage - 1;
15+
16+
$: trimmedItems = items.slice(start, end + 1);
17+
18+
$: totalItems, (currentPage = 0);
19+
$: currentPage, start, end;
20+
</script>
21+
22+
{#if totalItems && totalItems > perPage}
23+
<div
24+
class="pagination pointer-events-auto flex items-center justify-center"
25+
role="navigation"
26+
aria-label="Pagination"
27+
>
28+
<button
29+
on:click={() => (currentPage -= 1)}
30+
disabled={currentPage === 0 ? true : false}
31+
aria-label="previous"
32+
>
33+
<ArrowLeft width={30} height={30} />
34+
</button>
35+
<p class="m-0 mx-2">{start + 1} - {end + 1} of {totalItems}</p>
36+
<button
37+
class="flex"
38+
on:click={() => (currentPage += 1)}
39+
disabled={currentPage === totalPages - 1 ? true : false}
40+
aria-label="next"
41+
>
42+
<ArrowRight width={30} height={30} />
43+
</button>
44+
</div>
45+
{/if}

src/lib/data/organizations/de/&effect.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "&effect",
3-
"cause": [
3+
"sdgs": [
44
16
55
],
66
"url": "https://www.and-effect.com/",

src/lib/data/organizations/de/CorrelAid.json renamed to src/lib/data/organizations/de/correlaid.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "CorrelAid",
3-
"cause": [4, 17],
3+
"sdgs": [4, 17],
44
"url": "https://www.correlaid.org/",
55
"description": "CorrelAid is a non-profit organization dedicated to harnessing the power of data for social good. They bridge the gap between data scientists and organizations with a positive impact by offering their services to NGOs, non-profits, and charitable organizations. CorrelAid provides consulting services and educational resources to empower these non-profit entities to make data-driven decisions. Their mission is to leverage data for the betterment of society and empower civil society to utilize data in decision-making processes.",
66
"office_locations_country": [

src/lib/data/organizations/de/german_red_cross.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "German Red Cross",
3-
"cause": [3, 10, 16],
3+
"sdgs": [3, 10, 16],
44
"url": "https://drk-wohlfahrt.de/",
55
"description": "The GRC saves people, helps in emergencies, offers people a community, stands by the poor and needy and oversees international humanitarian law. Their Data Science Hub tests the use of data science methods for social services.",
66
"office_locations_country": [

src/lib/data/organizations/de/giz_data_lab.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "GIZ Data Lab",
3-
"cause": [17],
3+
"sdgs": [17],
44
"url": "https://www.giz.de/fachexpertise/html/61847.html",
55
"description": "Unkonventionell, innovativ und experimentell - das GIZ Data Lab versteht sich als eine Plattform, die Denker und Praktiker zusammenbringt um die effektive, faire und verantwortungsvolle Nutzung digitaler Daten in der nachhaltigen Entwicklungszusammenarbeit zu fördern. Seit seiner Gründung im Januar 2019 arbeitet das Team agil und chancenorientiert, erforscht neue Trends und entwickelt zukunftsorientierte Lösungen in den Partnerländern der GIZ. Das GIZ Data Lab-Team führt eine Vielzahl an Experimenten im Data4Development-Bereich durch, die in ihrem zeitlichen und thematischen Umfang begrenzt sind und auf konkreten Arbeitshypothesen basieren.",
66
"office_locations_country": [

src/lib/data/organizations/de/welthungerhilfe.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Welthungerhilfe",
3-
"cause": [
3+
"sdgs": [
44
2
55
],
66
"url": "https://www.welthungerhilfe.de/",

src/lib/data/organizations/gb/open_data_institute.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Open Data Institute",
3-
"cause": [17],
3+
"sdgs": [17],
44
"url": "https://www.theodi.org/about-the-odi/",
55
"description": "The ODI is a non-profit company committed to advancing trust in data across the spectrum - from closed to shared to open data. We work to advance trust in data by providing training, consultancy services, tools and guides - all designed to enable organisations to become more confident and capable in their stewardship and use of data. ",
66
"office_locations_country": [

src/lib/data/organizations/gb/our_world_in_data.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "Our World in Data",
3-
"cause": [17],
3+
"sdgs": [17],
44
"url": "https://ourworldindata.org/about",
5-
"description": "Detailed description present",
5+
"description": "Our World in Data (OWID) is a scientific online publication that focuses on large global problems such as poverty, disease, hunger, climate change, war, existential risks, and inequality. Thanks to the work of thousands of researchers around the world who dedicate their lives to it, we often have a good understanding of how it is possible to make progress against the large problems we are facing. The world has the resources to do much better and reduce the suffering in the world. We believe that a key reason why we fail to achieve the progress we are capable of is that we do not make enough use of this existing research and data: the important knowledge is often stored in inaccessible databases, locked away behind paywalls and buried under jargon in academic papers.",
66
"office_locations_country": [
77
"gb"
88
],

0 commit comments

Comments
 (0)