diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index e3c23ff..f1de289 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,55 +1,55 @@ -# name: Deploy to GitHub Pages - -# on: -# workflow_dispatch: -# repository_dispatch: -# types: -# - webhook -# push: -# branches: 'main' - -# jobs: -# build_site: -# runs-on: ubuntu-latest -# steps: -# - name: Checkout -# uses: actions/checkout@v3 - -# - name: Install Node.js -# uses: actions/setup-node@v3 -# with: -# node-version: 18 -# cache: npm - -# - name: Install dependencies -# run: npm install - -# - name: build -# env: -# BASE_PATH: '/${{ github.event.repository.name }}' -# PUBLIC_API_URL: 'https://cms.jstet.net' -# run: | -# npm run build - -# - name: Upload Artifacts -# uses: actions/upload-pages-artifact@v2 -# with: -# # this should match the `pages` option in your adapter-static options -# path: 'build/' - -# deploy: -# needs: build_site -# runs-on: ubuntu-latest - -# permissions: -# pages: write -# id-token: write - -# environment: -# name: github-pages -# url: ${{ steps.deployment.outputs.page_url }} - -# steps: -# - name: Deploy -# id: deployment -# uses: actions/deploy-pages@v2 +name: Deploy to GitHub Pages + +on: + workflow_dispatch: + repository_dispatch: + types: + - webhook + push: + branches: 'main' + +jobs: + build_site: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install Node.js + uses: actions/setup-node@v3 + with: + node-version: 18 + cache: npm + + - name: Install dependencies + run: npm install + + - name: build + env: + BASE_PATH: '/${{ github.event.repository.name }}' + PUBLIC_API_URL: 'https://cms.jstet.net' + run: | + npm run build + + - name: Upload Artifacts + uses: actions/upload-pages-artifact@v2 + with: + # this should match the `pages` option in your adapter-static options + path: 'build/' + + deploy: + needs: build_site + runs-on: ubuntu-latest + + permissions: + pages: write + id-token: write + + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + steps: + - name: Deploy + id: deployment + uses: actions/deploy-pages@v2 diff --git a/src/lib/components/Filter.svelte b/src/lib/components/Filter.svelte new file mode 100644 index 0000000..964f63c --- /dev/null +++ b/src/lib/components/Filter.svelte @@ -0,0 +1,125 @@ + + +
+
+ +
+
+
+ Search +
+ +
+
+ {#each selects as select} +
+ {select.title} +
+ +
+
+ {/each} +
+
+ + diff --git a/src/lib/components/Pagination.svelte b/src/lib/components/Pagination.svelte new file mode 100644 index 0000000..70362c8 --- /dev/null +++ b/src/lib/components/Pagination.svelte @@ -0,0 +1,45 @@ + + +{#if totalItems && totalItems > perPage} + +{/if} diff --git a/src/lib/data/organizations/de/&effect.json b/src/lib/data/organizations/de/&effect.json index f15de80..a6f619f 100644 --- a/src/lib/data/organizations/de/&effect.json +++ b/src/lib/data/organizations/de/&effect.json @@ -1,6 +1,6 @@ { "name": "&effect", - "cause": [ + "sdgs": [ 16 ], "url": "https://www.and-effect.com/", diff --git a/src/lib/data/organizations/de/CorrelAid.json b/src/lib/data/organizations/de/correlaid.json similarity index 97% rename from src/lib/data/organizations/de/CorrelAid.json rename to src/lib/data/organizations/de/correlaid.json index c3af129..b683db8 100644 --- a/src/lib/data/organizations/de/CorrelAid.json +++ b/src/lib/data/organizations/de/correlaid.json @@ -1,6 +1,6 @@ { "name": "CorrelAid", - "cause": [4, 17], + "sdgs": [4, 17], "url": "https://www.correlaid.org/", "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.", "office_locations_country": [ diff --git a/src/lib/data/organizations/de/german_red_cross.json b/src/lib/data/organizations/de/german_red_cross.json index 1ae372f..bc877da 100644 --- a/src/lib/data/organizations/de/german_red_cross.json +++ b/src/lib/data/organizations/de/german_red_cross.json @@ -1,6 +1,6 @@ { "name": "German Red Cross", - "cause": [3, 10, 16], + "sdgs": [3, 10, 16], "url": "https://drk-wohlfahrt.de/", "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.", "office_locations_country": [ diff --git a/src/lib/data/organizations/de/giz_data_lab.json b/src/lib/data/organizations/de/giz_data_lab.json index 6c3937f..1e8ac5b 100644 --- a/src/lib/data/organizations/de/giz_data_lab.json +++ b/src/lib/data/organizations/de/giz_data_lab.json @@ -1,6 +1,6 @@ { "name": "GIZ Data Lab", - "cause": [17], + "sdgs": [17], "url": "https://www.giz.de/fachexpertise/html/61847.html", "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.", "office_locations_country": [ diff --git a/src/lib/data/organizations/de/welthungerhilfe.json b/src/lib/data/organizations/de/welthungerhilfe.json index a3a9ffa..f61e1da 100644 --- a/src/lib/data/organizations/de/welthungerhilfe.json +++ b/src/lib/data/organizations/de/welthungerhilfe.json @@ -1,6 +1,6 @@ { "name": "Welthungerhilfe", - "cause": [ + "sdgs": [ 2 ], "url": "https://www.welthungerhilfe.de/", diff --git a/src/lib/data/organizations/gb/open_data_institute.json b/src/lib/data/organizations/gb/open_data_institute.json index a1365f1..845c61e 100644 --- a/src/lib/data/organizations/gb/open_data_institute.json +++ b/src/lib/data/organizations/gb/open_data_institute.json @@ -1,6 +1,6 @@ { "name": "Open Data Institute", - "cause": [17], + "sdgs": [17], "url": "https://www.theodi.org/about-the-odi/", "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. ", "office_locations_country": [ diff --git a/src/lib/data/organizations/gb/our_world_in_data.json b/src/lib/data/organizations/gb/our_world_in_data.json index a6a9815..0af038f 100644 --- a/src/lib/data/organizations/gb/our_world_in_data.json +++ b/src/lib/data/organizations/gb/our_world_in_data.json @@ -1,8 +1,8 @@ { "name": "Our World in Data", - "cause": [17], + "sdgs": [17], "url": "https://ourworldindata.org/about", - "description": "Detailed description present", + "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.", "office_locations_country": [ "gb" ], diff --git a/src/lib/data/organizations/int/amnesty.json b/src/lib/data/organizations/int/amnesty.json index 9fa26ea..b7ff25c 100644 --- a/src/lib/data/organizations/int/amnesty.json +++ b/src/lib/data/organizations/int/amnesty.json @@ -1,15 +1,16 @@ { - "name": "Amnesty Tech", - "cause": [16], - "url": "https://www.amnesty.org/en/tech/", - "description": "At Amnesty Tech, we believe it's time technology puts people and human rights first. We're a movement of 10 million people, and we've plugged hackers, coders, data scientists and technologists into our team too." , - "office_locations_country": ">3", - "remote_possible": null, - "initiative_application_possible": null, - "type": { - "framework": "Non-Profit", - "emphasis": "Cause Focused" - }, - "working_languages": ">3" - } - \ No newline at end of file + "name": "Amnesty", + "sdgs": [ + 16 + ], + "url": "https://www.amnesty.org/en/tech/", + "description": "The Amnesty Tech movement believes it's time technology puts people and human rights first. It's a movement of 10 million people, and we've plugged hackers, coders, data scientists and technologists into our team too.", + "office_locations_country": ["int"], + "remote_possible": null, + "initiative_application_possible": null, + "type": { + "framework": "Non-Profit", + "emphasis": "Cause Focused" + }, + "working_languages": ["int"] +} \ No newline at end of file diff --git a/src/lib/data/organizations/int/data_pop_alliance.json b/src/lib/data/organizations/int/data_pop_alliance.json index 00cf7d0..9e17cf8 100644 --- a/src/lib/data/organizations/int/data_pop_alliance.json +++ b/src/lib/data/organizations/int/data_pop_alliance.json @@ -1,11 +1,12 @@ { "name": "Data-Pop Alliance", - "cause": [17], + "sdgs": [17], "url": "https://datapopalliance.org/", "description": "Since 2013, Data-Pop Alliance has worked to apply cutting edge data science to solve the world’s most pressing problems. As the 2030 deadline for the UN sustainable development goals approaches, we believe novel approaches are needed to enhance the efficacy of the global development sector and reach those most in need. ", "office_locations_country": [ "mx", - "us" + "us", + "sn" ], "working_languages": ["en"], "remote_possible": true, diff --git a/src/lib/data/organizations/int/development_data_lab.json b/src/lib/data/organizations/int/development_data_lab.json deleted file mode 100644 index 0365e6f..0000000 --- a/src/lib/data/organizations/int/development_data_lab.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "Development Data Lab", - "cause": [17], - "url": "https://www.devdatalab.org/", - "description": "Detailed description present", - "office_locations_country": [ - "us", - "in" - ], - "working_languages": ["en"], - "remote_possible": false, - "initiative_application_possible": null, - "type": { - "framework": "Non-Profit", - "emphasis": "Cause Focused" - } - } - \ No newline at end of file diff --git a/src/lib/data/organizations/int/immap.json b/src/lib/data/organizations/int/immap.json index 8a0d51d..e6a9e32 100644 --- a/src/lib/data/organizations/int/immap.json +++ b/src/lib/data/organizations/int/immap.json @@ -1,15 +1,15 @@ { "name": "iMMAP", - "cause": [17], + "sdgs": [17], "url": "https://immap.org/", - "description": "Detailed description present", - "office_locations_country": ">3", + "description": "iMMAP Inc. turns data into information and creates knowledge for decision makers operating in development contexts, situations of violence, post-disaster, and conflict recovery. Our mission is to harness the power of information to facilitate evidence-based decisions to improve people's lives.", + "office_locations_country": ["int"], "remote_possible": null, "initiative_application_possible": null, "type": { "framework": "Non-Profit", "emphasis": "Consulting" }, - "working_languages": ["en"] + "working_languages": ["int"] } \ No newline at end of file diff --git a/src/lib/data/organizations/mex/prosperia.json b/src/lib/data/organizations/mex/prosperia.json index cf3930f..60e8e65 100644 --- a/src/lib/data/organizations/mex/prosperia.json +++ b/src/lib/data/organizations/mex/prosperia.json @@ -1,10 +1,10 @@ { "name": "Prosperia Social", - "cause": [16], + "sdgs": [16], "url": "https://www.prosperia.ai/", "description": "Prosperia Social is a social enterprise revolutionizing the design, targeting and management of social policies, by leveraging data science, AI and interactive decision support towards positive social impact at a large scale. We empower governments, international organizations, and NGOs to implement more accurate, equitable, efficient and transparent policies.", "office_locations_country": [ - "mex" + "mx" ], "remote_possible": null, "initiative_application_possible": null, diff --git a/src/lib/data/organizations/us/data_friendly_space.json b/src/lib/data/organizations/us/data_friendly_space.json index ab53caa..d7a3455 100644 --- a/src/lib/data/organizations/us/data_friendly_space.json +++ b/src/lib/data/organizations/us/data_friendly_space.json @@ -1,6 +1,6 @@ { "name": "Data Friendly Space", - "cause": [17], + "sdgs": [17], "url": "https://datafriendlyspace.org/", "description": "Data Friendly Space is a U.S. based INGO working across six continents to make modern data systems and data science accessible to the humanitarian and development communities. Our mission is to render informed, effective, and targeted aid the norm - not the exception - by supporting the global aid community through responsible, resource-efficient innovation.", "office_locations_country": [ diff --git a/src/lib/data/organizations/us/development_data_lab.json b/src/lib/data/organizations/us/development_data_lab.json new file mode 100644 index 0000000..555f1e8 --- /dev/null +++ b/src/lib/data/organizations/us/development_data_lab.json @@ -0,0 +1,17 @@ +{ + "name": "Development Data Lab", + "sdgs": [17], + "url": "https://www.devdatalab.org/", + "description": "We collect many new kinds of data, including measures of well-being generated from satellite images, data exhaust from government programs, and archival administrative records not previously used for policy design. Our open data platform (the SHRUG) seamlessly stitches these data sources together, making it one of India’s first high-resolution geographic frameworks for socioeconomic analysis. Our research uses cutting edge econometric and machine learning tools to generate policy-relevant insights that would be difficult to arrive at using other data sources. We focus on understanding how people born into poverty can live fulfilling and productive lives—and which policies and programs can help them do so.", + "office_locations_country": [ + "us" + ], + "working_languages": ["en"], + "remote_possible": false, + "initiative_application_possible": null, + "type": { + "framework": "Non-Profit", + "emphasis": "Cause Focused" + } + } + \ No newline at end of file diff --git a/src/lib/data/parameters.js b/src/lib/data/parameters.js index 987f856..e21aa3b 100644 --- a/src/lib/data/parameters.js +++ b/src/lib/data/parameters.js @@ -1,6 +1,6 @@ import iso3311a2 from 'iso-3166-1-alpha-2'; -export const countries = iso3311a2.getCodes(); +export const countries = iso3311a2.getCodes() + ['int']; export const frameworks = [ 'For-Profit', diff --git a/src/lib/js/filter.js b/src/lib/js/filter.js new file mode 100644 index 0000000..548e4b4 --- /dev/null +++ b/src/lib/js/filter.js @@ -0,0 +1,172 @@ +import _ from 'lodash'; +/** + +Filters an array of objects by multiple values in a specified property. object[property] has to be an array. +@param {Array} data - The array of objects to filter. +@param {Array} filterValues - The values to filter by. +@param {string} property - The property of the objects to filter on. +@returns {Array} - The filtered array of objects. +*/ +export function filterByMultiple(data, filterValues, property) { + return data.filter((object) => { + if (object[property]) { + const objectsProperty = object[property]; + return filterValues.every((contentElement) => { + if (contentElement === 'global' && property === 'correlaidx') { + return objectsProperty.length === 0; + } else { + return objectsProperty + .map((entry) => entry.toLowerCase()) + .includes(contentElement.toLowerCase()); + } + }); + } + }); +} + +function filterDefinedBy(property, objects, value) { + return _.filter(objects, (object) => { + if (object[property]) { + return object && object[property].toLowerCase() === value.toLowerCase(); + } + }); +} + +export function filterStringSearch(searchTerm, searchOptions, objects) { + return _.filter(objects, (object) => { + for (const item of searchOptions) { + if (object[item.searchProperty]) { + if (item.multiple) { + for (const contentElement of object[item.searchProperty]) { + if ( + contentElement.toLowerCase().includes(searchTerm.toLowerCase()) + ) { + return true; + } + } + } else { + if ( + object && + object[item.searchProperty] + .toLowerCase() + .includes(searchTerm.toLowerCase()) + ) { + return true; + } + } + } + } + }); +} + +export function filter(data, selects, searchTerm, searchOptions) { + let data_ = structuredClone(data); + if (searchTerm) { + data_ = filterStringSearch(searchTerm, searchOptions, data_); + } + + for (const select of selects) { + if (select.value) { + if (select.multiple) { + const values = _.chain(select.value).flatMap('value').value(); + data_ = filterByMultiple(data_, values, select.param); + } else { + data_ = filterDefinedBy(select.param, data_, select.value.value); + } + } + } + return data_; +} + +export function setUrlParams(url, selects) { + const newUrl = new URL(url); + for (const select of selects) { + if (select.value) { + if (select.multiple) { + newUrl.searchParams?.set( + select.param, + _.chain(select.value).flatMap('value').value(), + ); + } else { + newUrl.searchParams?.set(select.param, select.value.value); + } + } else { + newUrl.searchParams?.delete(select.param); + } + } + // https://dev.to/mohamadharith/mutating-query-params-in-sveltekit-without-page-reloads-or-navigations-2i2b + return newUrl; +} + +function genValue(value, values, items) { + if (values.includes(value)) { + return { + value: value, + label: _.find(items, {value: value}).label, + index: values.indexOf(value), + }; + } +} + +export function applyUrlSearchParams(searchParams, values, selects) { + for (const key in values) { + if (values.hasOwnProperty(key)) { + if (searchParams.get(key)) { + const value_ = searchParams.get(key); + const items = _.find(selects, {param: key}).items; + const values_ = _.chain(items).flatMap('value').value(); + if (_.find(selects, {param: key}).multiple) { + const valueLst = value_.split(','); + const arr = []; + for (let i = 0; i < valueLst.length; i++) { + arr.push(genValue(valueLst[i], values_, items)); + } + values[key] = arr; + } else { + values[key] = genValue(value_, values_, items); + } + } + } + } +} + +/** +Transforms and organizes an array of data into a map of unique values using the specified parameter. +Given an array of data and a parameter, this function applies a series of operations to create a map of unique values with specific properties. +The steps involve flattening the array, removing falsy values, eliminating duplicates, and generating objects with properties for each unique value. +@param {Array} data - The array of data to be processed. +@param {string} param - The parameter used for mapping and transformation. +@returns {Array} - The packed map of data after applying transformations. +*/ +function packMap(data, param) { + return _.chain(data) + .flatMap(param) + .compact() + .uniq() + .value() + .map((value, i) => ({ + value: value.toLowerCase(), + index: i, + label: value.replace(/_/g, ' '), + })); +} + +export function genDropdownLists(origData, selects) { + for (let i = 0; i < selects.length; i++) { + let lst; + if (selects[i].param === 'language' || selects[i].param === 'langs') { + lst = [ + {value: 'en-US', label: 'en'}, + {value: 'de-DE', label: 'de'}, + ]; + } else { + lst = packMap(origData, selects[i].param); + if (selects[i].param === 'correlaidx') { + lst.push({value: 'global', label: 'Global'}); + } + } + selects[i].items = lst; + } + + return selects; +} diff --git a/src/lib/js/helpers.js b/src/lib/js/helpers.js index da412c4..18720f9 100644 --- a/src/lib/js/helpers.js +++ b/src/lib/js/helpers.js @@ -3,10 +3,7 @@ import fs from 'fs'; import path from 'path'; export function getFlagEmoji(countryName) { - if (countryName == 'Remote') { - return '🏠'; - } - if (countryName == 'Worldwide') { + if (countryName == 'int') { return '🌍'; } const flag = countryEmoji.flag(countryName); @@ -17,6 +14,10 @@ export function getFlagEmoji(countryName) { } } +// if (countryName == 'Remote') { +// return '🏠'; +// } + const sdgs = { 1: {name: 'No Poverty', hex: '#E5243B'}, 2: {name: 'Zero Hunger', hex: '#DDA63A'}, @@ -43,7 +44,7 @@ export function getSDGColor(goal) { export function getSDGName(goal, upper = true) { if (upper) { - return sdgs[goal].name.toUpperCase(); + return sdgs[goal].name; } return sdgs[goal].name; } diff --git a/src/lib/single_use/Footer.svelte b/src/lib/navigation/Footer.svelte similarity index 100% rename from src/lib/single_use/Footer.svelte rename to src/lib/navigation/Footer.svelte diff --git a/src/lib/single_use/Navbar.svelte b/src/lib/navigation/Navbar.svelte similarity index 100% rename from src/lib/single_use/Navbar.svelte rename to src/lib/navigation/Navbar.svelte diff --git a/src/lib/parsing/processing.js b/src/lib/parsing/processing.js index 1bb8450..6f72daf 100644 --- a/src/lib/parsing/processing.js +++ b/src/lib/parsing/processing.js @@ -1,12 +1,33 @@ import _ from 'lodash'; +import {getSDGName} from '../js/helpers'; +import iso3311a2 from 'iso-3166-1-alpha-2'; + export function processOrganizations(data) { const procOrganizations = _.map(data, (org) => ({ - ...org, - cause: _.take(org.cause, 3), - office_locations_country: _.map(org.office_locations_country, (c) => - c.trim(), + name: org.name, + url: org.url, + description: org.description, + remote_possible: org.remote_possible, + initiative_application_possible: org.initiative_application_possible, + working_languages: org.working_languages, + framework: org.type.framework, + emphasis: org.type.emphasis, + sdgs_number: _.map(org.sdgs, (sdgs) => sdgs.toString()), + sdgs_name: _.map(org.sdgs, (sdgs) => getSDGName(sdgs)), + office_locations_country_alpha2: _.map( + org.office_locations_country, + (country) => country.toLowerCase(), + ), + office_locations_country_name: _.map( + org.office_locations_country, + (country) => { + console.log(country.toUpperCase()); + return country === 'int' + ? 'International' + : iso3311a2.getCountry(country.toUpperCase()); + }, ), })); - + console.log(procOrganizations); return procOrganizations; } diff --git a/src/lib/parsing/validation.js b/src/lib/parsing/validation.js index 32bfff7..ee70d46 100644 --- a/src/lib/parsing/validation.js +++ b/src/lib/parsing/validation.js @@ -1,10 +1,10 @@ import * as yup from 'yup'; -const OrganizationSchema = yup.object().shape({ +export const OrganizationSchemaInput = yup.object().shape({ name: yup.string().required('Name is required'), - cause: yup.array().of(yup.number()), // Numbers only, customize validation if needed - url: yup.string().url('Invalid URL format'), - description: yup.string(), + sdgs: yup.array().of(yup.number()).required('SDGs are required'), // Numbers only, customize validation if needed + url: yup.string().url('Invalid URL format').required('URL is required'), + description: yup.string().required('Description is required'), office_locations_country: yup.array().of(yup.string()), remote_possible: yup.boolean().nullable(), initiative_application_possible: yup.boolean().nullable(), @@ -14,12 +14,32 @@ const OrganizationSchema = yup.object().shape({ }), }); -export async function validateOrganizations(organizations) { +export const OrganizationSchemaProc = yup.object().shape({ + name: yup.string().required('Name is required'), + sdgs_number: yup.array().of(yup.string()).required(), + sdgs_name: yup.array().of(yup.string()).required(), + url: yup.string().url('Invalid URL format').required(), + description: yup.string().required('Description is required').required(), + office_locations_country_alpha2: yup + .array() + .of(yup.string().required()) + .required('Country Apha2 code is required') + .min(1), + office_locations_country_name: yup + .array() + .of(yup.string().required()) + .required('Country Name is required') + .min(1), + remote_possible: yup.boolean().nullable(), + initiative_application_possible: yup.boolean().nullable(), + framework: yup.string().required('Organization framework required'), + emphasis: yup.string().required('Organization emphasis required'), +}); + +export async function validateSchema(organizations, schema) { // Use Promise.all to validate all organizations concurrently const validationResults = await Promise.all( - organizations.map((organization) => - OrganizationSchema.validate(organization), - ), + organizations.map((organization) => schema.validate(organization)), ); // Check for errors in any of the validations diff --git a/src/lib/svg/ArrowLeft.svelte b/src/lib/svg/ArrowLeft.svelte new file mode 100644 index 0000000..acc5f10 --- /dev/null +++ b/src/lib/svg/ArrowLeft.svelte @@ -0,0 +1,19 @@ + + + + + diff --git a/src/lib/svg/ArrowRight.svelte b/src/lib/svg/ArrowRight.svelte new file mode 100644 index 0000000..23ee071 --- /dev/null +++ b/src/lib/svg/ArrowRight.svelte @@ -0,0 +1,18 @@ + + + + + diff --git a/src/lib/svg/Dropdown.svelte b/src/lib/svg/Dropdown.svelte new file mode 100644 index 0000000..c8c70a4 --- /dev/null +++ b/src/lib/svg/Dropdown.svelte @@ -0,0 +1,20 @@ + + + + + diff --git a/src/routes/+layout.server.js b/src/routes/+layout.server.js index 6d17ed4..f7ad351 100644 --- a/src/routes/+layout.server.js +++ b/src/routes/+layout.server.js @@ -1,15 +1,18 @@ import {processOrganizations} from '$lib/parsing/processing.js'; -import {validateOrganizations} from '$lib/parsing/validation.js'; +import { + validateSchema, + OrganizationSchemaInput, + OrganizationSchemaProc, +} from '$lib/parsing/validation.js'; import {loadJsonFiles} from '$lib/js/helpers.js'; /** @type {import('./$types').PageServerLoad} */ export async function load({fetch}) { const data = await loadJsonFiles('src/lib/data/organizations/'); - console.log(data); - - const parsedOrganizations = await validateOrganizations( - processOrganizations(data), + const parsedOrganizations = await validateSchema( + processOrganizations(await validateSchema(data, OrganizationSchemaInput)), + OrganizationSchemaProc, ); return {organizations: parsedOrganizations}; diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 18025df..806a020 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -1,7 +1,7 @@ diff --git a/src/routes/organizations/+page.svelte b/src/routes/organizations/+page.svelte index 13d9c7a..9fb996a 100644 --- a/src/routes/organizations/+page.svelte +++ b/src/routes/organizations/+page.svelte @@ -1,36 +1,49 @@
@@ -52,42 +65,58 @@

-