diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 5c988649e..9bc2de464 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -16,6 +16,8 @@ module.exports = { indent: ['error', 2, { SwitchCase: 1 }], 'func-style': ['error', 'declaration', { allowArrowFunctions: false }], 'prefer-arrow-callback': 'error', + 'comma-dangle': 'off', + '@typescript-eslint/comma-dangle': ['error', 'only-multiline'], '@typescript-eslint/no-unused-vars': 'error', '@typescript-eslint/consistent-type-definitions': ['error', 'interface'], }, diff --git a/.github/workflows/check_website.yaml b/.github/workflows/check_website.yaml index 0f6c84920..35591e6ff 100644 --- a/.github/workflows/check_website.yaml +++ b/.github/workflows/check_website.yaml @@ -46,6 +46,9 @@ jobs: - name: Check run: npm run check + - name: npx playwright install + run: npx playwright install + - name: Test run: npm run test diff --git a/.github/workflows/update_officer.yaml b/.github/workflows/update_officer.yaml index 0d3d27804..dd6ec1fda 100644 --- a/.github/workflows/update_officer.yaml +++ b/.github/workflows/update_officer.yaml @@ -44,7 +44,7 @@ jobs: - name: Create Pull Request id: pull_request - uses: peter-evans/create-pull-request@v3 + uses: peter-evans/create-pull-request@v4.1.1 with: commit-message: Updated officer data title: 'Add/Update officer ${{ steps.officer-name.outputs.result }}' diff --git a/package.json b/package.json index c4163e1fa..4974b8cdd 100644 --- a/package.json +++ b/package.json @@ -11,19 +11,20 @@ "url": "https://github.com/EthanThatOneKid/acmcsuf.com.git/" }, "scripts": { + "start": "npm run dev", "dev": "vite dev", "build": "vite build", "preview": "vite preview", - "test": "vitest --run", + "test": "vitest --run && npm run test:browser", "test:watch": "vitest", "test:size": "npm i && size-limit", "test:coverage": "vitest run --coverage", - "test:browser": "playwright test", + "test:browser": "playwright test /tests", "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --compiler-warnings \"css-unused-selector:ignore,unused-export-let:error\"", - "lint": "prettier --check . && eslint .", + "lint": "eslint . --fix", "format": "prettier --write .", "host": "npm run all && npm run preview", - "all": "npm run format && npm run lint && npm run check && npm t && npm run build" + "all": "npm run lint && npm run format && npm run check && npm run build && npm t" }, "devDependencies": { "@playwright/test": "^1.25.0", diff --git a/src/lib/components/block/block.svelte b/src/lib/components/block/block.svelte new file mode 100644 index 000000000..9e9cf3e49 --- /dev/null +++ b/src/lib/components/block/block.svelte @@ -0,0 +1,35 @@ + + +
+
+ + +
+
+ + diff --git a/src/lib/components/nav/bar.svelte b/src/lib/components/nav/bar.svelte index 31acf6ca1..0e462d6a2 100644 --- a/src/lib/components/nav/bar.svelte +++ b/src/lib/components/nav/bar.svelte @@ -4,7 +4,7 @@ import Toggle from '$lib/components/toggle/toggle.svelte'; import ThemeLight from '$lib/components/svg/theme-light.svelte'; import ThemeDark from '$lib/components/svg/theme-dark.svelte'; - import { AcmTheme, theme } from '$lib/legacy/theme'; + import { AcmTheme, theme } from '$lib/public/legacy/theme'; let jsEnabled = false; onMount(() => (jsEnabled = true)); diff --git a/src/lib/components/toaster/toasts.ts b/src/lib/components/toaster/toasts.ts index 4af6acceb..69493c662 100644 --- a/src/lib/components/toaster/toasts.ts +++ b/src/lib/components/toaster/toasts.ts @@ -1,4 +1,4 @@ -import { acmGeneral } from '$lib/legacy/acm-paths'; +import { acmGeneral } from '$lib/public/legacy/acm-paths'; import { writable } from 'svelte/store'; const MAX_TOASTS = 4; diff --git a/src/lib/public/board/data/index.ts b/src/lib/public/board/data/index.ts new file mode 100644 index 000000000..77cca5cc6 --- /dev/null +++ b/src/lib/public/board/data/index.ts @@ -0,0 +1,10 @@ +import type { Officer } from '$lib/public/board/types'; +import { Term } from '$lib/public/board/types'; +import OFFICERS_JSON from './officers.json'; +import TIERS_JSON from './tiers.json'; + +export const VISIBLE_TERMS = [Term.Fall22, Term.Spring22, Term.Fall21, Term.Spring21]; + +export const OFFICERS: Officer[] = [...OFFICERS_JSON]; + +export const TIERS: string[] = [...TIERS_JSON]; diff --git a/src/routes/about/officers.json b/src/lib/public/board/data/officers.json similarity index 100% rename from src/routes/about/officers.json rename to src/lib/public/board/data/officers.json diff --git a/src/routes/about/tiers.json b/src/lib/public/board/data/tiers.json similarity index 100% rename from src/routes/about/tiers.json rename to src/lib/public/board/data/tiers.json diff --git a/src/lib/public/board/types.ts b/src/lib/public/board/types.ts new file mode 100644 index 000000000..007b2d904 --- /dev/null +++ b/src/lib/public/board/types.ts @@ -0,0 +1,20 @@ +export enum Term { + Spring21 = 'S21', + Fall21 = 'F21', + Spring22 = 'S22', + Fall22 = 'F22', + Spring23 = 'S23', +} + +export interface Officer { + fullName: string; + picture: string; + displayName?: string; + + positions: { + [t in Term]?: { + title: string; + tier: number; + }; + }; +} diff --git a/src/lib/public/board/utils.ts b/src/lib/public/board/utils.ts new file mode 100644 index 000000000..785e6e8d5 --- /dev/null +++ b/src/lib/public/board/utils.ts @@ -0,0 +1,17 @@ +import type { Officer, Term } from './types'; +import { TIERS, VISIBLE_TERMS } from './data'; +import { writable } from 'svelte/store'; + +export const termIndex = writable(0); + +export function getPositionByTermIndex( + officer: Officer, + termIndex: number +): Officer['positions'][Term] | undefined { + return officer.positions[VISIBLE_TERMS[termIndex]]; +} + +export function getOfficerTierByTermIndex(officer: Officer, termIndex: number): string | undefined { + const position = getPositionByTermIndex(officer, termIndex); + return position ? TIERS[position.tier] : undefined; +} diff --git a/src/lib/legacy/README.md b/src/lib/public/legacy/README.md similarity index 100% rename from src/lib/legacy/README.md rename to src/lib/public/legacy/README.md diff --git a/src/lib/legacy/acm-paths.test.ts b/src/lib/public/legacy/acm-paths.test.ts similarity index 100% rename from src/lib/legacy/acm-paths.test.ts rename to src/lib/public/legacy/acm-paths.test.ts diff --git a/src/lib/legacy/acm-paths.ts b/src/lib/public/legacy/acm-paths.ts similarity index 100% rename from src/lib/legacy/acm-paths.ts rename to src/lib/public/legacy/acm-paths.ts diff --git a/src/lib/legacy/spacing.svelte b/src/lib/public/legacy/spacing.svelte similarity index 100% rename from src/lib/legacy/spacing.svelte rename to src/lib/public/legacy/spacing.svelte diff --git a/src/lib/legacy/theme.ts b/src/lib/public/legacy/theme.ts similarity index 100% rename from src/lib/legacy/theme.ts rename to src/lib/public/legacy/theme.ts diff --git a/src/lib/public/text-alignment/text-alignment.ts b/src/lib/public/text-alignment/text-alignment.ts new file mode 100644 index 000000000..e2364031b --- /dev/null +++ b/src/lib/public/text-alignment/text-alignment.ts @@ -0,0 +1,5 @@ +export enum TextAlignment { + LEFT = 'left', + RIGHT = 'right', + CENTER = 'center', +} diff --git a/src/routes/+error.svelte b/src/routes/+error.svelte new file mode 100644 index 000000000..fea9d12ea --- /dev/null +++ b/src/routes/+error.svelte @@ -0,0 +1,48 @@ + + + + ACM at CSUF / {$page.status || 404} + + +
+ 404 +

Frank can't find where you're going!

+ 404 - Page Not Found +
+ + diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 5b559830f..30fefc776 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -2,7 +2,7 @@ import Navbar from '$lib/components/nav/bar.svelte'; import Footer from '$lib/components/footer/footer.svelte'; import AcmToaster from '$lib/components/toaster/toaster.svelte'; - import { AcmTheme, theme } from '$lib/legacy/theme'; + import { AcmTheme, theme } from '$lib/public/legacy/theme'; import { onMount } from 'svelte'; function changeTheme(event: MediaQueryListEvent) { diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index e95c97580..89c9732d7 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,5 +1,5 @@
diff --git a/src/routes/ready-up.svelte b/src/routes/ready-up.svelte index 1b02044f7..b9e589f65 100644 --- a/src/routes/ready-up.svelte +++ b/src/routes/ready-up.svelte @@ -15,7 +15,7 @@

- Our chapter of 800+ members is forever free and open for anyone to join, regardless of + Our chapter of 1000+ members is forever free and open for anyone to join, regardless of major or technical ability.

diff --git a/src/routes/teams/+page.svelte b/src/routes/teams/+page.svelte new file mode 100644 index 000000000..b5969424a --- /dev/null +++ b/src/routes/teams/+page.svelte @@ -0,0 +1,65 @@ + + + + Teams | ACM at CSUF + + + + + +

Meet the Teams

+

+ Teams are committees that specialize in specific fields in the tech industry. We’ve designed the + teams to be gateways for students to explore new fields, develop new interests, and learn new + skills that will benefit them in the industry. +

+
+ + + + +

+ This team is dedicated to providing accessible information about artificial intelligence and + machine learning to all. AI focuses on fun projects geared + towards beginners in the field. +

+
+ + + + +

+ This team is dedicated to building programming fundamentals within students. + Algo focuses on mastering data structures and algorithms, + enhancing problem solving abilities, and exploration of competitive programming. +

+
+ + + + +

+ This team is dedicated to emphasizing the importance of product design and product management in + the tech industry. Design focuses on educating students + about design principles, design tools, and the intricacies of conceptualization, development, and + management of a product. +

+
+ + + + +

+ This team is dedicated to giving students the opportunity to explore tech via hands-on projects + and activities. Dev focuses on introducing students to + software development, and the various tech stacks used in the industry. +

+
+ + diff --git a/src/routes/teams/path-section.svelte b/src/routes/teams/path-section.svelte new file mode 100644 index 000000000..74fa1b991 --- /dev/null +++ b/src/routes/teams/path-section.svelte @@ -0,0 +1,91 @@ + + +
+ {#if info !== undefined} +
+ {`acm${info.title} +
+

+ + + {info.title} + + Team + +

+ +
+
+ {/if} +
+ + diff --git a/static/assets/authors/ethan-davidson.webp b/static/assets/authors/ethan-davidson.webp index 27949d372..2232ed0aa 100644 Binary files a/static/assets/authors/ethan-davidson.webp and b/static/assets/authors/ethan-davidson.webp differ diff --git a/tests/test.ts b/tests/test.ts index 4fa2b8be6..736ac0051 100644 --- a/tests/test.ts +++ b/tests/test.ts @@ -2,7 +2,20 @@ import { expect, test } from '@playwright/test'; test('index page has expected h1', async ({ page }) => { await page.goto('/'); - expect(await page.textContent('h1')).toBe( - 'We are the largest computer science community at CSUF' - ); + expect(await page.textContent('h1')).toContain('We are the largest computer science community'); +}); + +test('about page has expected h1', async ({ page }) => { + await page.goto('/about'); + expect(await page.textContent('h1')).toBe('About us'); +}); + +test('error page has expected em', async ({ page }) => { + await page.goto('/this-page/does-not/exist'); + expect(await page.textContent('em')).toBe('404'); +}); + +test('teams page has expected h1', async ({ page }) => { + await page.goto('/teams'); + expect(await page.textContent('h1')).toBe('Meet the Teams'); });