diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..e95158ac --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,33 @@ +name: Code Quality + +on: + workflow_dispatch: + pull_request: + push: + branches: + - main + +env: + PUBLIC_SUPABASE_URL: ${{ vars.PUBLIC_SUPABASE_URL || 'https://your-supabase-url.supabase.co' }} + PUBLIC_SUPABASE_PUBLISHABLE_KEY: ${{ vars.PUBLIC_SUPABASE_PUBLISHABLE_KEY || 'your-supabase-publishable-key' }} + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + - name: Install pnpm + uses: pnpm/action-setup@v4 + - name: Install Node.js + uses: actions/setup-node@v5 + with: + cache: pnpm + cache-dependency-path: pnpm-lock.yaml + node-version: 24 + - name: Install Dependencies + run: pnpm install + - name: Check Formatters + run: pnpm fmt + - name: Run All Lints in Parallel + run: pnpm lint diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index d28bbe35..a828771c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -2,9 +2,9 @@ name: Deploy to GitHub Pages on: workflow_dispatch: - pull_request: push: - branches: main + branches: + - main permissions: contents: read @@ -15,6 +15,10 @@ concurrency: group: pages cancel-in-progress: false +env: + PUBLIC_SUPABASE_URL: ${{ vars.PUBLIC_SUPABASE_URL || 'https://your-supabase-url.supabase.co' }} + PUBLIC_SUPABASE_PUBLISHABLE_KEY: ${{ vars.PUBLIC_SUPABASE_PUBLISHABLE_KEY || 'your-supabase-publishable-key' }} + jobs: build: runs-on: ubuntu-latest @@ -31,10 +35,6 @@ jobs: node-version: 24 - name: Install Dependencies run: pnpm install - - name: Check Formatters - run: pnpm fmt - - name: Run All Lints in Parallel - run: pnpm lint - name: Build Website run: pnpm build - name: Setup Pages diff --git a/.gitignore b/.gitignore index 307132b5..6e6fc58b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,6 @@ .eslintcache node_modules build -*.sh \ No newline at end of file +*.sh +.env +.env.* \ No newline at end of file diff --git a/package.json b/package.json index edc76eb2..6546b3d5 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "@iconify/icons-heroicons": "^1.2.9", "@iconify/icons-simple-icons": "^1.2.74", "@iconify/svelte": "^5.0.2", + "@supabase/supabase-js": "^2.100.1", "@sveltejs/kit": "^2.47.3", "html-minifier": "^4.0.0", "svelte": "^5.41.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 33e8b53d..e7ff21ae 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -17,6 +17,9 @@ importers: '@iconify/svelte': specifier: ^5.0.2 version: 5.0.2(svelte@5.41.4) + '@supabase/supabase-js': + specifier: ^2.100.1 + version: 2.100.1 '@sveltejs/kit': specifier: ^2.47.3 version: 2.47.3(@sveltejs/vite-plugin-svelte@6.2.1(svelte@5.41.4)(vite@7.1.12(@types/node@24.9.1)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.36.0)))(svelte@5.41.4)(vite@7.1.12(@types/node@24.9.1)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.36.0)) @@ -649,6 +652,33 @@ packages: '@standard-schema/spec@1.0.0': resolution: {integrity: sha512-m2bOd0f2RT9k8QJx1JN85cZYyH1RqFBdlwtkSlf4tBDYLCiiZnv1fIIwacK6cqwXavOydf0NPToMQgpKq+dVlA==} + '@supabase/auth-js@2.100.1': + resolution: {integrity: sha512-c5FB4nrG7cs1mLSzFGuIVl2iR2YO5XkSJ96uF4zubYm8YDn71XOi2emE9sBm/avfGCj61jaRBLOvxEAVnpys0Q==} + engines: {node: '>=20.0.0'} + + '@supabase/functions-js@2.100.1': + resolution: {integrity: sha512-mo8QheoV4KR+wSubtyEWhZUxWnCM7YZ23TncccMAlbWAHb8YTDqRGRm9IalWCAswniKyud6buZCk9snRqI86KA==} + engines: {node: '>=20.0.0'} + + '@supabase/phoenix@0.4.0': + resolution: {integrity: sha512-RHSx8bHS02xwfHdAbX5Lpbo6PXbgyf7lTaXTlwtFDPwOIw64NnVRwFAXGojHhjtVYI+PEPNSWwkL90f4agN3bw==} + + '@supabase/postgrest-js@2.100.1': + resolution: {integrity: sha512-OIh4mOSo2LdqF2kox76OAPDtcSs+PwKABJOjc6plUV4/LXhFEsI2uwdEEIs7K7fd141qehWEVl/Y+Ts0fNvYsw==} + engines: {node: '>=20.0.0'} + + '@supabase/realtime-js@2.100.1': + resolution: {integrity: sha512-FHuRWPX4qZQ4x+0Q+ZrKaBZnOiVGiwsgiAUJM98pYRib1yeaE/fOM1lZ1ozd+4gA8Udw23OyaD8SxKS5mT5NYw==} + engines: {node: '>=20.0.0'} + + '@supabase/storage-js@2.100.1': + resolution: {integrity: sha512-x9xpEIoWM4xKiAlwfWTgHPSN6N4Y0aS4FVU4F6ZPbq7Gayw08SrtC6/YH/gOr8CjXQr0HxXYXDop2xGTSjubYA==} + engines: {node: '>=20.0.0'} + + '@supabase/supabase-js@2.100.1': + resolution: {integrity: sha512-CAeFm5sfX8sbTzxoxRafhohreIzl9a7R6qHTck3MrgTqm5M5g/u0IHfEKYzI9w/17r8NINl8UZrw2i08wrO7Iw==} + engines: {node: '>=20.0.0'} + '@sveltejs/acorn-typescript@1.0.6': resolution: {integrity: sha512-4awhxtMh4cx9blePWl10HRHj8Iivtqj+2QdDCSMDzxG+XKa9+VCNupQuCuvzEhYPzZSrX+0gC+0lHA/0fFKKQQ==} peerDependencies: @@ -818,6 +848,9 @@ packages: '@types/uglify-js@3.17.5': resolution: {integrity: sha512-TU+fZFBTBcXj/GpDpDaBmgWk/gn96kMZ+uocaFUlV2f8a6WdMzzI44QBCmGcCiYR0Y6ZlNRiyUyKKt5nl/lbzQ==} + '@types/ws@8.18.1': + resolution: {integrity: sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==} + '@typescript-eslint/eslint-plugin@8.46.2': resolution: {integrity: sha512-ZGBMToy857/NIPaaCucIUQgqueOiq7HeAKkhlvqVV4lm089zUFW6ikRySx2v+cAhKeUCPuWVHeimyk6Dw1iY3w==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -1160,6 +1193,10 @@ packages: engines: {node: '>=6'} hasBin: true + iceberg-js@0.8.1: + resolution: {integrity: sha512-1dhVQZXhcHje7798IVM+xoo/1ZdVfzOMIc8/rgVSijRK38EDqOJoGula9N/8ZI5RD8QTxNQtK/Gozpr+qUqRRA==} + engines: {node: '>=20.0.0'} + ignore@5.3.2: resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==} engines: {node: '>= 4'} @@ -1746,6 +1783,18 @@ packages: resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==} engines: {node: '>=0.10.0'} + ws@8.20.0: + resolution: {integrity: sha512-sAt8BhgNbzCtgGbt2OxmpuryO63ZoDk/sqaB/znQm94T4fCEsy/yV+7CdC1kJhOU9lboAEU7R3kquuycDoibVA==} + engines: {node: '>=10.0.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: '>=5.0.2' + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + yaml@1.10.2: resolution: {integrity: sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==} engines: {node: '>= 6'} @@ -2186,6 +2235,46 @@ snapshots: '@standard-schema/spec@1.0.0': {} + '@supabase/auth-js@2.100.1': + dependencies: + tslib: 2.8.1 + + '@supabase/functions-js@2.100.1': + dependencies: + tslib: 2.8.1 + + '@supabase/phoenix@0.4.0': {} + + '@supabase/postgrest-js@2.100.1': + dependencies: + tslib: 2.8.1 + + '@supabase/realtime-js@2.100.1': + dependencies: + '@supabase/phoenix': 0.4.0 + '@types/ws': 8.18.1 + tslib: 2.8.1 + ws: 8.20.0 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + + '@supabase/storage-js@2.100.1': + dependencies: + iceberg-js: 0.8.1 + tslib: 2.8.1 + + '@supabase/supabase-js@2.100.1': + dependencies: + '@supabase/auth-js': 2.100.1 + '@supabase/functions-js': 2.100.1 + '@supabase/postgrest-js': 2.100.1 + '@supabase/realtime-js': 2.100.1 + '@supabase/storage-js': 2.100.1 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + '@sveltejs/acorn-typescript@1.0.6(acorn@8.15.0)': dependencies: acorn: 8.15.0 @@ -2352,6 +2441,10 @@ snapshots: dependencies: source-map: 0.6.1 + '@types/ws@8.18.1': + dependencies: + '@types/node': 24.9.1 + '@typescript-eslint/eslint-plugin@8.46.2(@typescript-eslint/parser@8.46.2(eslint@9.38.0(jiti@2.6.1))(typescript@5.9.3))(eslint@9.38.0(jiti@2.6.1))(typescript@5.9.3)': dependencies: '@eslint-community/regexpp': 4.12.2 @@ -2751,6 +2844,8 @@ snapshots: relateurl: 0.2.7 uglify-js: 3.19.3 + iceberg-js@0.8.1: {} + ignore@5.3.2: {} ignore@7.0.5: {} @@ -3162,8 +3257,7 @@ snapshots: dependencies: typescript: 5.9.3 - tslib@2.8.1: - optional: true + tslib@2.8.1: {} type-check@0.4.0: dependencies: @@ -3231,6 +3325,8 @@ snapshots: word-wrap@1.2.5: {} + ws@8.20.0: {} + yaml@1.10.2: {} yocto-queue@0.1.0: {} diff --git a/src/lib/components/cards/MemberCard.svelte b/src/lib/components/cards/MemberCard.svelte index 30e44a23..0241583d 100644 --- a/src/lib/components/cards/MemberCard.svelte +++ b/src/lib/components/cards/MemberCard.svelte @@ -1,20 +1,25 @@ @@ -26,7 +31,7 @@ onmouseleave={() => (isOverlayVisible = false)} > - + {:else}
- +
diff --git a/src/lib/components/cards/MemberCardTag.svelte b/src/lib/components/cards/MemberCardTag.svelte index a7ece449..01cb562d 100644 --- a/src/lib/components/cards/MemberCardTag.svelte +++ b/src/lib/components/cards/MemberCardTag.svelte @@ -7,18 +7,18 @@ interface Props { name: string; - title?: Position[]; + titles?: Position[]; socials?: Record; } - const { name, title, socials }: Props = $props(); + const { name, titles, socials }: Props = $props();

{name}

- {#if title} + {#if titles}

- {title.join(', ')} + {titles.join(', ')}

{/if}
@@ -26,7 +26,7 @@ {#if socials} {#each Object.entries(socials) as [social, link] (social)} {@const { path, icon } = getSocialMedium(social)} - {@const href = path ? `${path}/${link}` : link} + {@const href = path === 'https://github.com' ? `${path}/${link}` : link} - import type { Board } from '$lib/types/board'; - import { getCommitteeInfo } from '$lib/types/committees'; import Card from '$lib/components/cards/MemberCard.svelte'; + import type { Executive } from '$lib/models/executive'; interface Props { - board: Board; + executives: Executive[]; } - const { board }: Props = $props(); - const { officers }: Board = $derived(board); + const { executives }: Props = $props(); const { color, foreground } = getCommitteeInfo('Executive');
- {#each officers as member (member.name)} - + {#each executives as { id, nickname, last_name, image_url, titles } (id)} + {/each}
diff --git a/src/lib/components/panels/TeamPanel.svelte b/src/lib/components/panels/TeamPanel.svelte index 716f4b06..d1d4d057 100644 --- a/src/lib/components/panels/TeamPanel.svelte +++ b/src/lib/components/panels/TeamPanel.svelte @@ -53,8 +53,8 @@ > {#if filteredTeam} {@const { color, foreground } = getCommitteeInfo(currentCommittee)} - {#each filteredTeam as member (member.name)} - + {#each filteredTeam as { id, nickname, last_name, image_url, socials } (id)} + {/each} {/if} diff --git a/src/lib/data/exec/index.ts b/src/lib/data/exec/index.ts index e4f2fa2a..29de72f9 100644 --- a/src/lib/data/exec/index.ts +++ b/src/lib/data/exec/index.ts @@ -1,76 +1,22 @@ -import type { EnhancedImgAttributes } from '@sveltejs/enhanced-img'; -import { parse } from 'valibot'; +import { array, parse } from 'valibot'; +import { supabase } from '$lib/supabaseClient'; -import { type Officer, Officer as OfficerSchema } from '$lib/models/officer'; -import { type Position, Position as PositionSchema } from '$lib/models/position'; -import type { Board } from '$lib/types/board'; -import type { BoardOfficer } from '$lib/types/board_officer'; +import { Board } from '$lib/models/board'; export const pres_term = '2526A'; -async function getOfficers() { - const imports = import.meta.glob('./json/*.json'); +export async function getExecBoards() { + // Queries view that groups executives by term + // View is already sorted in advance, so we can return it directly + const { data, error } = await supabase.from('execs_by_term').select(` + term, + executives + `); - const promises = Object.entries(imports).map(async ([_, asset]) => { - const officer = parse(OfficerSchema, await asset()); + if (error) throw new Error('exec data fetching error'); - const src: string = officer.img; + const execBoards = parse(array(Board), data); - const parsed_pos: Record = {}; - - officer.pos.forEach(raw_detail => { - const detail = raw_detail.split(':'); - const [term, raw_actual_pos] = detail; - const actual_pos: Position = parse(PositionSchema, raw_actual_pos); - - if (term) { - if (!parsed_pos[term]) parsed_pos[term] = []; - - parsed_pos[term].push(actual_pos); - } - }); - - const parsed_officer: Officer = { ...officer, parsed_pos, src }; - return parsed_officer; - }); - - return await Promise.all(promises); -} - -export async function getExec() { - const officers = await getOfficers(); - const boards: Record = {}; - - officers.forEach(({ name, src, parsed_pos }) => { - const { last_name, nickname } = name; - const officer_name = `${nickname} ${last_name}`; - - Object.keys(parsed_pos).forEach(term => { - const title = parsed_pos[term]; - if (title) { - const new_officer: BoardOfficer = { name: officer_name, src, title }; - - if (!boards[term]) { - const new_board: Board = { term, src: null, officers: [] }; - boards[term] = new_board; - } - - boards[term].officers.push(new_officer); - } - }); - }); - - Object.keys(boards).forEach(async term => { - // eslint-disable-next-line @typescript-eslint/init-declarations - let src: EnhancedImgAttributes['src'] | null; - try { - src = (await import(`$lib/assets/exec/${term}.webp?enhanced?url`)).default; - } catch { - src = null; - } - - if (boards[term]) boards[term].src = src; - }); - - return boards; + // View is already sorted in advance (for both boards and executives), so we can return it directly + return execBoards; } diff --git a/src/lib/data/exec/json/AndriCrisostomo.json b/src/lib/data/exec/json/AndriCrisostomo.json deleted file mode 100644 index 7e6c6d10..00000000 --- a/src/lib/data/exec/json/AndriCrisostomo.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": { "last_name": "Crisostomo", "nickname": "Andri" }, - "pos": ["2425A:President", "2425A:Vice President for Innovation"], - "img": "AndriCrisostomo" -} diff --git a/src/lib/data/exec/json/ArianRey.json b/src/lib/data/exec/json/ArianRey.json deleted file mode 100644 index b16431c1..00000000 --- a/src/lib/data/exec/json/ArianRey.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": { "last_name": "Rey", "nickname": "Arian" }, - "pos": ["2324:Director for Membership & Internals"], - "img": "ArianRey" -} diff --git a/src/lib/data/exec/json/BastiOrtiz.json b/src/lib/data/exec/json/BastiOrtiz.json deleted file mode 100644 index 2403606b..00000000 --- a/src/lib/data/exec/json/BastiOrtiz.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": { "last_name": "Ortiz", "nickname": "Basti" }, - "pos": ["2324:Director for Engineering"], - "img": "BastiOrtiz" -} diff --git a/src/lib/data/exec/json/BeaDiokno.json b/src/lib/data/exec/json/BeaDiokno.json deleted file mode 100644 index 7806b2b0..00000000 --- a/src/lib/data/exec/json/BeaDiokno.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": { "last_name": "Diokno", "nickname": "Bea" }, - "pos": ["2324:Director for External Relations"], - "img": "BeaDiokno" -} diff --git a/src/lib/data/exec/json/BenjLazaro.json b/src/lib/data/exec/json/BenjLazaro.json deleted file mode 100644 index 60f34b6e..00000000 --- a/src/lib/data/exec/json/BenjLazaro.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": { "last_name": "Lazaro", "nickname": "Benj" }, - "pos": ["2425B:Vice President for Innovation"], - "img": "BenjLazaro" -} diff --git a/src/lib/data/exec/json/BmaeAmurao.json b/src/lib/data/exec/json/BmaeAmurao.json deleted file mode 100644 index c3d3ecc6..00000000 --- a/src/lib/data/exec/json/BmaeAmurao.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": { "last_name": "Amurao", "nickname": "Bmae" }, - "pos": [ - "2425A:Director for Membership & Internals", - "2425B:Director for Membership & Internals" - ], - "img": "BmaeAmurao" -} diff --git a/src/lib/data/exec/json/BryanUy.json b/src/lib/data/exec/json/BryanUy.json deleted file mode 100644 index a5e08cbc..00000000 --- a/src/lib/data/exec/json/BryanUy.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": { "last_name": "Uy", "nickname": "Bryan" }, - "pos": ["2425B:Vice President for Service"], - "img": "BryanUy" -} diff --git a/src/lib/data/exec/json/CalebBunye.json b/src/lib/data/exec/json/CalebBunye.json deleted file mode 100644 index 84cb86b3..00000000 --- a/src/lib/data/exec/json/CalebBunye.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": { "last_name": "Bunye", "nickname": "Caleb" }, - "pos": ["2324:President"], - "img": "CalebBunye" -} diff --git a/src/lib/data/exec/json/DonSebastienChavez.json b/src/lib/data/exec/json/DonSebastienChavez.json deleted file mode 100644 index 62395f55..00000000 --- a/src/lib/data/exec/json/DonSebastienChavez.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": { "last_name": "Chavez", "nickname": "Don Sebastien" }, - "pos": ["2425B:Vice President for Service"], - "img": "DonSebastienChavez" -} diff --git a/src/lib/data/exec/json/EyronTanael.json b/src/lib/data/exec/json/EyronTanael.json deleted file mode 100644 index 029a606a..00000000 --- a/src/lib/data/exec/json/EyronTanael.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": { "last_name": "Tanael", "nickname": "Eyron" }, - "pos": ["2324:Vice President for Service"], - "img": "EyronTanael" -} diff --git a/src/lib/data/exec/json/HansLorico.json b/src/lib/data/exec/json/HansLorico.json deleted file mode 100644 index 5a83bf52..00000000 --- a/src/lib/data/exec/json/HansLorico.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": { "last_name": "Lorico", "nickname": "Hans" }, - "pos": ["2324:Vice President for Innovation"], - "img": "HansLorico" -} diff --git a/src/lib/data/exec/json/IsayBucu.json b/src/lib/data/exec/json/IsayBucu.json deleted file mode 100644 index 7e1c2cb4..00000000 --- a/src/lib/data/exec/json/IsayBucu.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": { "last_name": "Bucu", "nickname": "Isay" }, - "pos": ["2425A:Director for Branding & Creatives", "2425B:Director for Branding & Creatives"], - "img": "IsayBucu" -} diff --git a/src/lib/data/exec/json/JellyRaborar.json b/src/lib/data/exec/json/JellyRaborar.json deleted file mode 100644 index 0e94cd2f..00000000 --- a/src/lib/data/exec/json/JellyRaborar.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": { "last_name": "Raborar", "nickname": "Jelly" }, - "pos": ["2324:Director for Branding & Creatives"], - "img": "JellyRaborar" -} diff --git a/src/lib/data/exec/json/SeanKenjiTolentino.json b/src/lib/data/exec/json/SeanKenjiTolentino.json deleted file mode 100644 index a2914117..00000000 --- a/src/lib/data/exec/json/SeanKenjiTolentino.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": { "last_name": "Tolentino", "nickname": "Sean Kenji" }, - "pos": ["2425A:Director for External Relations", "2425B:Director for External Relations"], - "img": "SeanKenjiTolentino" -} diff --git a/src/lib/data/exec/json/VictorReyes.json b/src/lib/data/exec/json/VictorReyes.json deleted file mode 100644 index ee9ebdbe..00000000 --- a/src/lib/data/exec/json/VictorReyes.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": { "last_name": "Reyes", "nickname": "Victor" }, - "pos": ["2425A:Director for Engineering", "2425B:President", "2425B:Director for Engineering"], - "img": "VictorReyes" -} diff --git a/src/lib/data/team/index.ts b/src/lib/data/team/index.ts index 9a76ec7e..9e903c8f 100644 --- a/src/lib/data/team/index.ts +++ b/src/lib/data/team/index.ts @@ -1,15 +1,57 @@ -import { parse } from 'valibot'; - -import { type Member, Member as MemberSchema } from '$lib/models/member'; +import { supabase } from '$lib/supabaseClient'; +import { Member } from '$lib/models/member'; +import { array, parse } from 'valibot'; export async function getTeam() { - const imports = import.meta.glob('./json/*.json'); + const { data, error } = await supabase.from('people').select(` + id, + last_name, + nickname, + image_url, + committee, + is_exec, + github_handle, + linkedin_url, + instagram_url, + website_url + `); + + if (error) throw new Error('team data fetching error'); + + const members = parse(array(Member), data).map( + ({ + committee, + is_exec, + github_handle, + linkedin_url, + instagram_url, + website_url, + ...rest + }) => { + // a quirk of the DB setup, + // if the comm is set to Executive then thats the president, + // otherwise if the person is_exec then they have two comms, + // everone else has only one comm + const committees = [committee]; + if (is_exec && committee !== 'Executive') committees.push('Executive'); + + const socials: Record = {}; + + if (github_handle) socials.github = github_handle; + if (linkedin_url) socials.linkedin = linkedin_url; + if (instagram_url) socials.instagram = instagram_url; + if (website_url) socials.website = website_url; - const promises = Object.entries(imports).map(async ([_, asset]) => { - const member = parse(MemberSchema, await asset()); - const parsed_member: Member = { ...member, src: member.img }; - return parsed_member; - }); + return { + ...rest, + committees, + socials, + }; + }, + ); - return await Promise.all(promises); + // Sorts members by nickname (or last name if nickname is the same) + return members.sort( + (a, b) => a.nickname.localeCompare(b.nickname) || a.last_name.localeCompare(b.last_name), + ); } diff --git a/src/lib/data/team/json/AbeSahi.json b/src/lib/data/team/json/AbeSahi.json deleted file mode 100644 index 7b1ad447..00000000 --- a/src/lib/data/team/json/AbeSahi.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Abe Sahi", - "img": "AbeSahi", - "committee": ["Membership & Internals"], - "socials": { "github": "RhamzHam", "linkedin": "Abraham Sahi" } -} diff --git a/src/lib/data/team/json/AishaGo.json b/src/lib/data/team/json/AishaGo.json deleted file mode 100644 index 3130d2cf..00000000 --- a/src/lib/data/team/json/AishaGo.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "Aisha Go", - "img": "AishaGo", - "committee": ["Membership & Internals"], - "socials": { - "github": "aishago", - "linkedin": "aisha-abigail-go-065956304", - "instagram": "aby.mei" - } -} diff --git a/src/lib/data/team/json/AlecLopez.json b/src/lib/data/team/json/AlecLopez.json deleted file mode 100644 index 81efbb3c..00000000 --- a/src/lib/data/team/json/AlecLopez.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Alec Lopez", - "img": "AlecLopez", - "committee": ["Innovation"], - "socials": { "github": "alec-lopez", "linkedin": "Alec Lopez", "instagram": "aaaaleclopez" } -} diff --git "a/src/lib/data/team/json/AlyssaA\303\261onuevo.json" "b/src/lib/data/team/json/AlyssaA\303\261onuevo.json" deleted file mode 100644 index 6c3da033..00000000 --- "a/src/lib/data/team/json/AlyssaA\303\261onuevo.json" +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "Alyssa Añonuevo", - "img": "AlyssaAñonuevo", - "committee": ["External Relations"], - "socials": { - "github": "adanonuevo", - "linkedin": "alessandra-ysabelle-añonuevo-052663319", - "instagram": "alessandra.ysabelle" - } -} diff --git a/src/lib/data/team/json/AndriCrisostomo.json b/src/lib/data/team/json/AndriCrisostomo.json deleted file mode 100644 index b4b29d36..00000000 --- a/src/lib/data/team/json/AndriCrisostomo.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Andri Crisostomo", - "img": "AndriCrisostomo", - "committee": ["Service"], - "socials": { "github": "RpnAndri", "linkedin": "andri-crisostomo-5860282b1" } -} diff --git a/src/lib/data/team/json/AzulEusebio.json b/src/lib/data/team/json/AzulEusebio.json deleted file mode 100644 index de6a1c19..00000000 --- a/src/lib/data/team/json/AzulEusebio.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Azul Eusebio", - "img": "AzulEusebio", - "committee": ["Membership & Internals"], - "socials": { "github": "Alphxs" } -} diff --git a/src/lib/data/team/json/BenjLazaro.json b/src/lib/data/team/json/BenjLazaro.json deleted file mode 100644 index 954c27f6..00000000 --- a/src/lib/data/team/json/BenjLazaro.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Benj Lazaro", - "img": "BenjLazaro", - "committee": ["Executive"], - "socials": { "github": "Enoux", "instagram": "itsyaboikccc" } -} diff --git a/src/lib/data/team/json/BmaeAmurao.json b/src/lib/data/team/json/BmaeAmurao.json deleted file mode 100644 index c121ab95..00000000 --- a/src/lib/data/team/json/BmaeAmurao.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Bmae Amurao", - "img": "BmaeAmurao", - "committee": ["Membership & Internals"], - "socials": { "github": "Baamurao", "instagram": "bmae.jpg" } -} diff --git a/src/lib/data/team/json/BryanUy.json b/src/lib/data/team/json/BryanUy.json deleted file mode 100644 index ca24b9cc..00000000 --- a/src/lib/data/team/json/BryanUy.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Bryan Uy", - "img": "BryanUy", - "committee": ["Service", "Executive"], - "socials": { "github": "SpicySpareRibs" } -} diff --git a/src/lib/data/team/json/CJSalces.json b/src/lib/data/team/json/CJSalces.json deleted file mode 100644 index a4c45989..00000000 --- a/src/lib/data/team/json/CJSalces.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "CJ Salces", - "img": "CJSalces", - "committee": ["Innovation"], - "socials": { "github": "rue-22" } -} diff --git a/src/lib/data/team/json/CedricLegara.json b/src/lib/data/team/json/CedricLegara.json deleted file mode 100644 index 49421650..00000000 --- a/src/lib/data/team/json/CedricLegara.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Cedric Legara", - "img": "CedricLegara", - "committee": ["Engineering"], - "socials": { "github": "shankencedric", "linkedin": "sean-ken-cedric-legara-a83a02248" } -} diff --git a/src/lib/data/team/json/CessaGonzales.json b/src/lib/data/team/json/CessaGonzales.json deleted file mode 100644 index 55827d41..00000000 --- a/src/lib/data/team/json/CessaGonzales.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Cessa Gonzales", - "img": "CessaGonzales", - "committee": ["External Relations", "Executive"], - "socials": { "github": "princessagonzales" } -} diff --git a/src/lib/data/team/json/CharSim.json b/src/lib/data/team/json/CharSim.json deleted file mode 100644 index bafb4fd6..00000000 --- a/src/lib/data/team/json/CharSim.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Char Sim", - "img": "CharSim", - "committee": ["Branding & Creatives"], - "socials": { "github": "cassssy", "linkedin": "charlize-sim" } -} diff --git a/src/lib/data/team/json/DaleFlores.json b/src/lib/data/team/json/DaleFlores.json deleted file mode 100644 index ccb307cf..00000000 --- a/src/lib/data/team/json/DaleFlores.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Dale Flores", - "img": "DaleFlores", - "committee": ["Innovation"], - "socials": { "github": "exos7", "linkedin": "dale-sealtiel-flores-3734b3296" } -} diff --git "a/src/lib/data/team/json/DashCe\303\261ido.json" "b/src/lib/data/team/json/DashCe\303\261ido.json" deleted file mode 100644 index 74b6b6d9..00000000 --- "a/src/lib/data/team/json/DashCe\303\261ido.json" +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Dash Ceñido", - "img": "DashCeñido", - "committee": ["External Relations"], - "socials": { "github": "Dcenidoo", "linkedin": "Dcenidoo" } -} diff --git a/src/lib/data/team/json/DonSebastienChavez.json b/src/lib/data/team/json/DonSebastienChavez.json deleted file mode 100644 index c7f8e023..00000000 --- a/src/lib/data/team/json/DonSebastienChavez.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Don Sebastien Chavez", - "img": "DonSebastienChavez", - "committee": ["Service"], - "socials": { "github": "Jol0gs" } -} diff --git a/src/lib/data/team/json/EhrenCastillo.json b/src/lib/data/team/json/EhrenCastillo.json deleted file mode 100644 index d32b8ca5..00000000 --- a/src/lib/data/team/json/EhrenCastillo.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "Ehren Castillo", - "img": "EhrenCastillo", - "committee": ["Engineering", "Executive"], - "socials": { - "github": "ehrelevant", - "linkedin": "ehren-castillo-a8045a269", - "instagram": "ehrelevant_", - "website": "https://ehrelevant.github.io/" - } -} diff --git a/src/lib/data/team/json/EkoDelfin.json b/src/lib/data/team/json/EkoDelfin.json deleted file mode 100644 index 9da0f010..00000000 --- a/src/lib/data/team/json/EkoDelfin.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Eko Delfin", - "img": "EkoDelfin", - "committee": ["Branding & Creatives"], - "socials": { "github": "EkoChamber", "linkedin": "aneko-delfin" } -} diff --git a/src/lib/data/team/json/ElijahMejilla.json b/src/lib/data/team/json/ElijahMejilla.json deleted file mode 100644 index 1d6a5603..00000000 --- a/src/lib/data/team/json/ElijahMejilla.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Elijah Mejilla", - "img": "ElijahMejilla", - "committee": ["Engineering"], - "socials": { "github": "jgmejilla" } -} diff --git a/src/lib/data/team/json/EllieLim.json b/src/lib/data/team/json/EllieLim.json deleted file mode 100644 index 2cec0f2d..00000000 --- a/src/lib/data/team/json/EllieLim.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Ellie Lim", - "img": "EllieLim", - "committee": ["Innovation"], - "socials": { "github": "ElianaLim", "linkedin": "Eliana Mari Lim" } -} diff --git a/src/lib/data/team/json/EmmanAmante.json b/src/lib/data/team/json/EmmanAmante.json deleted file mode 100644 index a12e9d35..00000000 --- a/src/lib/data/team/json/EmmanAmante.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Emman Amante", - "img": "EmmanAmante", - "committee": ["Service"], - "socials": { "github": "Emzxxx" } -} diff --git a/src/lib/data/team/json/EthanFilio.json b/src/lib/data/team/json/EthanFilio.json deleted file mode 100644 index 2235438c..00000000 --- a/src/lib/data/team/json/EthanFilio.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Ethan Filio", - "img": "EthanFilio", - "committee": ["Service"], - "socials": { "github": "EthanFilio", "linkedin": "ethan-filio-608a0b200" } -} diff --git a/src/lib/data/team/json/FibiMoraca.json b/src/lib/data/team/json/FibiMoraca.json deleted file mode 100644 index 2b8920ab..00000000 --- a/src/lib/data/team/json/FibiMoraca.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Fibi Moraca", - "img": "FibiMoraca", - "committee": ["Branding & Creatives"], - "socials": { "github": "dinemunyu" } -} diff --git a/src/lib/data/team/json/GVVitug.json b/src/lib/data/team/json/GVVitug.json deleted file mode 100644 index 177664c9..00000000 --- a/src/lib/data/team/json/GVVitug.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "GV Vitug", - "img": "GVVitug", - "committee": ["External Relations"], - "socials": { "github": "good-vibe" } -} diff --git a/src/lib/data/team/json/GabbySacramento.json b/src/lib/data/team/json/GabbySacramento.json deleted file mode 100644 index 718a972c..00000000 --- a/src/lib/data/team/json/GabbySacramento.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Gabby Sacramento", - "img": "GabbySacramento", - "committee": ["Membership & Internals"], - "socials": { "github": "gabrielle-denise", "instagram": "gabricllc" } -} diff --git a/src/lib/data/team/json/HanzVicencio.json b/src/lib/data/team/json/HanzVicencio.json deleted file mode 100644 index 90a4f98a..00000000 --- a/src/lib/data/team/json/HanzVicencio.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Hanz Vicencio", - "img": "HanzVicencio", - "committee": ["Innovation"], - "socials": { "github": "s0mme" } -} diff --git a/src/lib/data/team/json/InigoDeGuzman.json b/src/lib/data/team/json/InigoDeGuzman.json deleted file mode 100644 index aa3d6b7d..00000000 --- a/src/lib/data/team/json/InigoDeGuzman.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Inigo De Guzman", - "img": "InigoDeGuzman", - "committee": ["External Relations"], - "socials": { "github": "Inigo-D120" } -} diff --git a/src/lib/data/team/json/IsayBucu.json b/src/lib/data/team/json/IsayBucu.json deleted file mode 100644 index 1c6af465..00000000 --- a/src/lib/data/team/json/IsayBucu.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "Isay Bucu", - "img": "IsayBucu", - "committee": ["Branding & Creatives"], - "socials": { - "github": "ClarisseCoconut", - "linkedin": "Clarisse Bianca Bucu", - "instagram": "clarissecoconut" - } -} diff --git a/src/lib/data/team/json/JackyAbucay.json b/src/lib/data/team/json/JackyAbucay.json deleted file mode 100644 index 4fb721d5..00000000 --- a/src/lib/data/team/json/JackyAbucay.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Jacky Abucay", - "img": "JackyAbucay", - "committee": ["Engineering"], - "socials": { "github": "up-jacky" } -} diff --git a/src/lib/data/team/json/JeromeEstrella.json b/src/lib/data/team/json/JeromeEstrella.json deleted file mode 100644 index 0733f108..00000000 --- a/src/lib/data/team/json/JeromeEstrella.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Jerome Estrella", - "img": "JeromeEstrella", - "committee": ["External Relations"], - "socials": { "github": "Nagimaeda", "instagram": "notjerome.e" } -} diff --git a/src/lib/data/team/json/JulianDolojan.json b/src/lib/data/team/json/JulianDolojan.json deleted file mode 100644 index 5070c3c7..00000000 --- a/src/lib/data/team/json/JulianDolojan.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Julian Dolojan", - "img": "JulianDolojan", - "committee": ["External Relations"], - "socials": { "github": "TrashHat" } -} diff --git a/src/lib/data/team/json/KCAbriol.json b/src/lib/data/team/json/KCAbriol.json deleted file mode 100644 index fda7eb77..00000000 --- a/src/lib/data/team/json/KCAbriol.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "KC Abriol", - "img": "KCAbriol", - "committee": ["Innovation"], - "socials": { "github": "kcthegreat18" } -} diff --git a/src/lib/data/team/json/KarinConsebido.json b/src/lib/data/team/json/KarinConsebido.json deleted file mode 100644 index 21fcd8af..00000000 --- a/src/lib/data/team/json/KarinConsebido.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Karin Consebido", - "img": "KarinConsebido", - "committee": ["Branding & Creatives", "Executive"], - "socials": { "github": "kalatkarin" } -} diff --git a/src/lib/data/team/json/KarloDomingo.json b/src/lib/data/team/json/KarloDomingo.json deleted file mode 100644 index fb93c22a..00000000 --- a/src/lib/data/team/json/KarloDomingo.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Karlo Domingo", - "img": "KarloDomingo", - "committee": ["Branding & Creatives"], - "socials": { "github": "krldomingo" } -} diff --git a/src/lib/data/team/json/KennethCo.json b/src/lib/data/team/json/KennethCo.json deleted file mode 100644 index d8f9cfe1..00000000 --- a/src/lib/data/team/json/KennethCo.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "Kenneth Co", - "img": "KennethCo", - "committee": ["Membership & Internals"], - "socials": { - "github": "Chraltsha", - "linkedin": "justin-co-701785315", - "instagram": "chraltsha" - } -} diff --git a/src/lib/data/team/json/KurtLanting.json b/src/lib/data/team/json/KurtLanting.json deleted file mode 100644 index 512df001..00000000 --- a/src/lib/data/team/json/KurtLanting.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Kurt Lanting", - "img": "KurtLanting", - "committee": ["Innovation"], - "socials": { "github": "LantingKurt", "linkedin": "Kurt Lanting" } -} diff --git a/src/lib/data/team/json/LeanneAustria.json b/src/lib/data/team/json/LeanneAustria.json deleted file mode 100644 index 1f9ef0f7..00000000 --- a/src/lib/data/team/json/LeanneAustria.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Leanne Austria", - "img": "LeanneAustria", - "committee": ["Service"], - "socials": { "github": "aiarre", "linkedin": "leanne-austria-6a4709256" } -} diff --git a/src/lib/data/team/json/LilyCelestino.json b/src/lib/data/team/json/LilyCelestino.json deleted file mode 100644 index 05dcdde0..00000000 --- a/src/lib/data/team/json/LilyCelestino.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Lily Celestino", - "img": "LilyCelestino", - "committee": ["Engineering"], - "socials": { "github": "Nodeil" } -} diff --git a/src/lib/data/team/json/LouieTorres.json b/src/lib/data/team/json/LouieTorres.json deleted file mode 100644 index cf96c703..00000000 --- a/src/lib/data/team/json/LouieTorres.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "Louie Torres", - "img": "LouieTorres", - "committee": ["Engineering"], - "socials": { - "github": "louie-github", - "linkedin": "aloysius-reve-torres-98829a295", - "instagram": "louie_art48", - "website": "https://blog.lowkeytowers.com" - } -} diff --git a/src/lib/data/team/json/LucasAgcaoili.json b/src/lib/data/team/json/LucasAgcaoili.json deleted file mode 100644 index d8a0976e..00000000 --- a/src/lib/data/team/json/LucasAgcaoili.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Lucas Agcaoili", - "img": "LucasAgcaoili", - "committee": ["Engineering"], - "socials": { "github": "roCatalyst" } -} diff --git a/src/lib/data/team/json/MarcusPascual.json b/src/lib/data/team/json/MarcusPascual.json deleted file mode 100644 index e061459f..00000000 --- a/src/lib/data/team/json/MarcusPascual.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Marcus Pascual", - "img": "MarcusPascual", - "committee": ["Engineering"], - "socials": { "github": "syncopascual", "instagram": "monosyphone" } -} diff --git a/src/lib/data/team/json/MariusBarcenas.json b/src/lib/data/team/json/MariusBarcenas.json deleted file mode 100644 index 6c394c0c..00000000 --- a/src/lib/data/team/json/MariusBarcenas.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Marius Barcenas", - "img": "MariusBarcenas", - "committee": ["Engineering"], - "socials": { "github": "ulyzses", "linkedin": "ulyzses" } -} diff --git a/src/lib/data/team/json/MichaelReal.json b/src/lib/data/team/json/MichaelReal.json deleted file mode 100644 index 5583c25d..00000000 --- a/src/lib/data/team/json/MichaelReal.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Michael Real", - "img": "MichaelReal", - "committee": ["Engineering"], - "socials": { "github": "AnonM00se", "instagram": "d_real_mj" } -} diff --git a/src/lib/data/team/json/MigzGuiang.json b/src/lib/data/team/json/MigzGuiang.json deleted file mode 100644 index 785560bb..00000000 --- a/src/lib/data/team/json/MigzGuiang.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Migz Guiang", - "img": "MigzGuiang", - "committee": ["Innovation"], - "socials": { "github": "SHIROKAMIQQ", "linkedin": "miguel-guiang-a03a0530a" } -} diff --git a/src/lib/data/team/json/MikelArcardo.json b/src/lib/data/team/json/MikelArcardo.json deleted file mode 100644 index 8138433d..00000000 --- a/src/lib/data/team/json/MikelArcardo.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "Mikel Arcardo", - "img": "MikelArcardo", - "committee": ["Innovation", "Executive"], - "socials": { - "github": "mikelReinanArcardo", - "linkedin": "mikel-reinan-arcardo-194680296", - "instagram": "mkl.rcrd" - } -} diff --git "a/src/lib/data/team/json/NateZu\303\261iga.json" "b/src/lib/data/team/json/NateZu\303\261iga.json" deleted file mode 100644 index cae0c812..00000000 --- "a/src/lib/data/team/json/NateZu\303\261iga.json" +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Nate Zuñiga", - "img": "NateZuñiga", - "committee": ["Membership & Internals", "Executive"], - "socials": { "github": "truenofalse" } -} diff --git a/src/lib/data/team/json/PaoloLapira.json b/src/lib/data/team/json/PaoloLapira.json deleted file mode 100644 index 0c16834d..00000000 --- a/src/lib/data/team/json/PaoloLapira.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Paolo Lapira", - "img": "PaoloLapira", - "committee": ["Membership & Internals"], - "socials": { "github": "siopaobunz" } -} diff --git a/src/lib/data/team/json/PaulaDomingo.json b/src/lib/data/team/json/PaulaDomingo.json deleted file mode 100644 index 6203fa82..00000000 --- a/src/lib/data/team/json/PaulaDomingo.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Paula Domingo", - "img": "PaulaDomingo", - "committee": ["Branding & Creatives"], - "socials": { "github": "Paula-Domingo" } -} diff --git a/src/lib/data/team/json/RafaJimenez.json b/src/lib/data/team/json/RafaJimenez.json deleted file mode 100644 index 28aff6c5..00000000 --- a/src/lib/data/team/json/RafaJimenez.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Rafa Jimenez", - "img": "RafaJimenez", - "committee": ["External Relations"], - "socials": { "github": "GRjimenez" } -} diff --git a/src/lib/data/team/json/SamSiy.json b/src/lib/data/team/json/SamSiy.json deleted file mode 100644 index 1f9119b4..00000000 --- a/src/lib/data/team/json/SamSiy.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Sam Siy", - "img": "SamSiy", - "committee": ["Service"], - "socials": { "github": "SamanthaSiy", "linkedin": "samantha-siy-ab8219302" } -} diff --git a/src/lib/data/team/json/SeanKenjiTolentino.json b/src/lib/data/team/json/SeanKenjiTolentino.json deleted file mode 100644 index 25dee592..00000000 --- a/src/lib/data/team/json/SeanKenjiTolentino.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Sean Kenji Tolentino", - "img": "SeanKenjiTolentino", - "committee": ["External Relations"], - "socials": { "github": "Tolenn", "linkedin": "Sean Kenji Tolentino" } -} diff --git a/src/lib/data/team/json/ShereenaVillafania.json b/src/lib/data/team/json/ShereenaVillafania.json deleted file mode 100644 index fb9e27ba..00000000 --- a/src/lib/data/team/json/ShereenaVillafania.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Shereena Villafania", - "img": "ShereenaVillafania", - "committee": ["Service"], - "socials": { "github": "Shereena-Work", "instagram": "shereena_haniwa" } -} diff --git a/src/lib/data/team/json/SheyManzala.json b/src/lib/data/team/json/SheyManzala.json deleted file mode 100644 index dcd949ac..00000000 --- a/src/lib/data/team/json/SheyManzala.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Shey Manzala", - "img": "SheyManzala", - "committee": ["Service"], - "socials": { "github": "dajemide", "instagram": "dajemide" } -} diff --git a/src/lib/data/team/json/SidneyFernando.json b/src/lib/data/team/json/SidneyFernando.json deleted file mode 100644 index 7a9bf89a..00000000 --- a/src/lib/data/team/json/SidneyFernando.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Sidney Fernando", - "img": "SidneyFernando", - "committee": ["Innovation", "Executive"], - "socials": { "github": "slcfernando", "linkedin": "slcfernando" } -} diff --git a/src/lib/data/team/json/TrishObzunar.json b/src/lib/data/team/json/TrishObzunar.json deleted file mode 100644 index e31a7a67..00000000 --- a/src/lib/data/team/json/TrishObzunar.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Trish Obzunar", - "img": "TrishObzunar", - "committee": ["Membership & Internals"], - "socials": { "github": "tmobzunar" } -} diff --git a/src/lib/data/team/json/YenyenGalinato.json b/src/lib/data/team/json/YenyenGalinato.json deleted file mode 100644 index e05016d8..00000000 --- a/src/lib/data/team/json/YenyenGalinato.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Yenyen Galinato", - "img": "YenyenGalinato", - "committee": ["Engineering"], - "socials": { "github": "galierie", "linkedin": "edgalinato" } -} diff --git a/src/lib/data/team/json/YsaacVillamil.json b/src/lib/data/team/json/YsaacVillamil.json deleted file mode 100644 index 3d0171ad..00000000 --- a/src/lib/data/team/json/YsaacVillamil.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Ysaac Villamil", - "img": "YsaacVillamil", - "committee": ["Innovation"], - "socials": { "github": "LigsQt", "linkedin": "jysv" } -} diff --git a/src/lib/data/team/json/YuwenSaavedra.json b/src/lib/data/team/json/YuwenSaavedra.json deleted file mode 100644 index 805f8fa6..00000000 --- a/src/lib/data/team/json/YuwenSaavedra.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Yuwen Saavedra", - "img": "YuwenSaavedra", - "committee": ["Branding & Creatives"], - "socials": { "github": "BluNuggets" } -} diff --git a/src/lib/env.ts b/src/lib/env.ts new file mode 100644 index 00000000..939b53d2 --- /dev/null +++ b/src/lib/env.ts @@ -0,0 +1,11 @@ +import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_PUBLISHABLE_KEY } from '$env/static/public'; +import { parse, string } from 'valibot'; + +export const SUPABASE_PUBLISHABLE_KEY = parse( + string('PUBLIC_SUPABASE_PUBLISHABLE_KEY not supplied or not a string'), + PUBLIC_SUPABASE_PUBLISHABLE_KEY, +); +export const SUPABASE_URL = parse( + string('PUBLIC_SUPABASE_URL not supplied or not a string'), + PUBLIC_SUPABASE_URL, +); diff --git a/src/lib/models/board.ts b/src/lib/models/board.ts new file mode 100644 index 00000000..63627a9b --- /dev/null +++ b/src/lib/models/board.ts @@ -0,0 +1,9 @@ +import { array, object, string, type InferOutput } from 'valibot'; +import { Executive } from '$lib/models/executive'; + +export const Board = object({ + term: string(), + executives: array(Executive), +}); + +export type Board = InferOutput; diff --git a/src/lib/models/executive.ts b/src/lib/models/executive.ts new file mode 100644 index 00000000..cddec16e --- /dev/null +++ b/src/lib/models/executive.ts @@ -0,0 +1,12 @@ +import { array, number, object, pipe, string, url, type InferOutput } from 'valibot'; +import { Position } from '$lib/models/position'; + +export const Executive = object({ + id: number(), + last_name: string(), + nickname: string(), + image_url: pipe(string(), url('Invalid image URL')), + titles: array(Position), +}); + +export type Executive = InferOutput; diff --git a/src/lib/models/member.ts b/src/lib/models/member.ts index 7089d445..e4aa594c 100644 --- a/src/lib/models/member.ts +++ b/src/lib/models/member.ts @@ -1,17 +1,32 @@ -import { type InferOutput, array, object, optional, picklist, record, string } from 'valibot'; +import { + type InferOutput, + boolean, + nullable, + number, + object, + picklist, + pipe, + string, + url, +} from 'valibot'; import { MemberCommittees } from '$lib/types/committees'; -import { MemberSocialMedia } from '$lib/types/social_media'; -import { POSITIONS } from '$lib/models/position'; export const Member = object({ - name: string(), - img: string(), - title: optional(array(picklist(POSITIONS))), - committee: array(picklist(Object.keys(MemberCommittees))), - socials: optional(record(picklist(Object.keys(MemberSocialMedia)), string())), + id: number(), + last_name: string(), + nickname: string(), + image_url: pipe(string(), url('Invalid image URL')), + committee: picklist(Object.keys(MemberCommittees)), + is_exec: boolean(), + github_handle: nullable(string()), + linkedin_url: nullable(pipe(string(), url('Invalid LinkedIn URL'))), + instagram_url: nullable(pipe(string(), url('Invalid Instagram URL'))), + website_url: nullable(pipe(string(), url('Invalid Website URL'))), }); -export interface Member extends InferOutput { - src: string; +export interface Member + extends Pick, 'id' | 'last_name' | 'nickname' | 'image_url'> { + committees: string[]; + socials: Record; } diff --git a/src/lib/models/officer.ts b/src/lib/models/officer.ts deleted file mode 100644 index 63bacce0..00000000 --- a/src/lib/models/officer.ts +++ /dev/null @@ -1,19 +0,0 @@ -import type { EnhancedImgAttributes } from '@sveltejs/enhanced-img'; - -import { type InferOutput, array, object, string } from 'valibot'; - -import type { Position } from '$lib/models/position'; - -export const Officer = object({ - name: object({ - last_name: string(), - nickname: string(), - }), - img: string(), - pos: array(string()), -}); - -export interface Officer extends InferOutput { - src: EnhancedImgAttributes['src']; - parsed_pos: Record; -} diff --git a/src/lib/supabaseClient.ts b/src/lib/supabaseClient.ts new file mode 100644 index 00000000..e9ff366b --- /dev/null +++ b/src/lib/supabaseClient.ts @@ -0,0 +1,4 @@ +import { createClient } from '@supabase/supabase-js'; +import { SUPABASE_PUBLISHABLE_KEY, SUPABASE_URL } from '$lib/env'; + +export const supabase = createClient(SUPABASE_URL, SUPABASE_PUBLISHABLE_KEY); diff --git a/src/lib/types/board.ts b/src/lib/types/board.ts deleted file mode 100644 index a20aeb22..00000000 --- a/src/lib/types/board.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type { EnhancedImgAttributes } from '@sveltejs/enhanced-img'; - -import type { BoardOfficer } from '$lib/types/board_officer'; - -export interface Board { - term: string; - src: EnhancedImgAttributes['src'] | null; - officers: BoardOfficer[]; -} diff --git a/src/lib/types/board_officer.ts b/src/lib/types/board_officer.ts deleted file mode 100644 index 2d12b8cd..00000000 --- a/src/lib/types/board_officer.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { EnhancedImgAttributes } from '@sveltejs/enhanced-img'; -import type { Position } from '$lib/models/position'; - -export interface BoardOfficer { - name: string; - src: EnhancedImgAttributes['src']; - title: Position[]; -} diff --git a/src/routes/people/+page.server.ts b/src/routes/people/+page.server.ts index b029a68d..cad9074a 100644 --- a/src/routes/people/+page.server.ts +++ b/src/routes/people/+page.server.ts @@ -1,7 +1,7 @@ import type { Member } from '$lib/models/member'; import { MemberCommittees } from '$lib/types/committees'; -import { getExec } from '$lib/data/exec'; +import { getExecBoards } from '$lib/data/exec'; import { getTeam } from '$lib/data/team'; export async function load() { @@ -9,14 +9,14 @@ export async function load() { const filteredTeams: Record = {}; Object.keys(MemberCommittees).forEach(filterComm => { - filteredTeams[filterComm] = team.filter(({ committee }) => { + filteredTeams[filterComm] = team.filter(({ committees }) => { let in_committee = false; - committee.forEach(comm => { + committees.forEach(comm => { in_committee ||= comm === filterComm; }); return in_committee; }); }); - return { team, filteredTeams, exec: await getExec() }; + return { team, filteredTeams, execBoards: await getExecBoards() }; } diff --git a/src/routes/people/+page.svelte b/src/routes/people/+page.svelte index 3b091327..ce4591fb 100644 --- a/src/routes/people/+page.svelte +++ b/src/routes/people/+page.svelte @@ -7,9 +7,7 @@ import TeamPanel from '$lib/components/panels/TeamPanel.svelte'; const { data } = $props(); - const { team, filteredTeams, exec } = $derived(data); - - const terms = $derived(Object.keys(exec).sort().reverse()); + const { team, filteredTeams, execBoards } = $derived(data);
@@ -21,14 +19,11 @@ Meet the previous executive boards - {#each terms as term (term)} + {#each execBoards as { term, executives } (term)} {#if term !== pres_term} - {@const board = exec[term]} - {#if board} - - - - {/if} + + + {/if} {/each}