Skip to content

Conversation

@pan93412
Copy link
Contributor

@pan93412 pan93412 commented Apr 22, 2025

Port the script at https://github.com/COSCUP/2024/blob/eff079441b85a3007a357c071ff1df243bf80738/scripts/pre-build/generateSession.ts as a VitePress data loader. Ensure proper typing according to the Pretalx API documentation and reorganize the code structure.

Usage:

import { data } from '#loaders/session.data'

Please note that we fetch the sessions from COSCUP 2024, as the sessions for 2025 have not been released yet.

You can optionally pass a PRETALX_TOKEN to access restricted resources, although the sessions for COSCUP 2024 are open.

You can check the generated result in #34.

Squashed from commit 4312f65


TODOs:

@pan93412 pan93412 self-assigned this Apr 22, 2025
@netlify
Copy link

netlify bot commented Apr 22, 2025

Deploy Preview for velvety-pony-8aa5d9 ready!

Name Link
🔨 Latest commit 2e7c059
🔍 Latest deploy log https://app.netlify.com/sites/velvety-pony-8aa5d9/deploys/6818a1722485890008f1e1bc
😎 Deploy Preview https://deploy-preview-35--velvety-pony-8aa5d9.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@pan93412 pan93412 requested a review from Copilot April 22, 2025 01:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR ports the COSCUP 2024 session data loader to VitePress by implementing utility functions, type definitions, and processing logic to transform Pretalx API responses into the required sessions format.

  • Implements utility functions for filtering characters and generating MD5 hashes.
  • Adds comprehensive type definitions and constants for sessions, speakers, rooms, and tags.
  • Processes API responses to generate structured session data and integrates collaborative writing mappings.

Reviewed Changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
loaders/sessions/utils.ts Adds helper functions for text filtering and MD5 hash generation.
loaders/sessions/types.ts Introduces type definitions for session-related data.
loaders/sessions/processors.ts Implements the logic to process Pretalx API responses into session data.
loaders/sessions/pretalx.ts Defines interfaces for Pretalx API responses.
loaders/sessions/hackmd.ts Provides interface for HackMD URL mappings.
loaders/sessions/constants.ts Sets constant values used for mapping questions and tags.
loaders/session.data.ts Defines the data loader that fetches and processes session data using VitePress.
Files not reviewed (1)
  • .env.example: Language not supported

@pan93412 pan93412 requested a review from Copilot April 22, 2025 01:58
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a VitePress data loader that fetches and processes session data from Pretalx and integrates additional information such as HackMD URL mappings.

  • Introduces utility functions for string filtering and MD5 hash generation.
  • Adds comprehensive TypeScript types for sessions, speakers, and related entities.
  • Implements processors to transform Pretalx API responses into the session format used by the application, and integrates the loader in VitePress.

Reviewed Changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
loaders/sessions/utils.ts Utility functions for string processing and hash generation.
loaders/sessions/types.ts Type definitions for sessions, speakers, rooms, tags, and related entities.
loaders/sessions/processors.ts Functions for processing Pretalx responses into the session data format.
loaders/sessions/pretalx.ts Type definitions for the Pretalx API responses.
loaders/sessions/hackmd.ts Interface for HackMD URL mapping.
loaders/sessions/constants.ts Constants for question IDs and language mappings.
loaders/session.data.ts Loader implementation fetching external data and generating session results.
Files not reviewed (1)
  • .env.example: Language not supported

@pan93412 pan93412 requested a review from rileychh April 22, 2025 02:05
@@ -1 +1 @@
VITE_YEAR=""
PRETALX_TOKEN=
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我記得 dataloader 不會主動讀 .env。你可以驗證一下他會不會把你指定的 PRETALX_TOKEN 讀進去。

@pan93412 pan93412 marked this pull request as draft April 22, 2025 06:47
@pan93412 pan93412 force-pushed the sessions-dataloader branch from d432968 to ef767d6 Compare April 22, 2025 07:45
@pan93412 pan93412 force-pushed the sessions-dataloader branch from ef767d6 to 2e7c059 Compare May 5, 2025 11:30
@pan93412 pan93412 closed this May 5, 2025
@pan93412 pan93412 mentioned this pull request May 5, 2025
4 tasks
@pan93412 pan93412 deleted the sessions-dataloader branch July 30, 2025 06:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants