Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 25, 2025

PR-40 PR-40 PR-40 Powered by Pull Request Badge

This PR refactors the Activity page implementation (fix #24) based on comprehensive code review feedback, introducing significant architectural improvements:

Key Changes

Internationalization (i18n)

  • Added comprehensive translation support for all hardcoded Chinese text
  • Updated translation files for zh-CN, zh-TW, and en-US
  • Integrated with existing I18nContext and t() function pattern

Code Architecture & Reuse

  • Extracted getMarkdownListSortedByDate() utility function in pages/api/core.ts for global reuse
  • Replaced custom activity list implementation with existing <UpcomingEvents /> component
  • Updated <UpcomingEvents /> component to support i18n translations

Pagination Implementation

  • Implemented dynamic pagination using getStaticPaths() with [[...page]].tsx route
  • Configured 10 items per page for better performance
  • Removed error handling to let build failures occur naturally when Activity directory is missing

Package Management

  • Removed package-lock.json and switched to PNPM as the primary package manager
  • Updated build process to use pnpm-lock.yaml

HTML Structure & Semantics

  • Improved semantic structure with <hgroup> and <section> elements
  • Enhanced iframe layout with Bootstrap utility classes
  • Better accessibility and responsive design

Technical Implementation

The calendar iframe integration remains unchanged, but the surrounding architecture is significantly improved:

// Before: Custom activity list with hardcoded Chinese text
<h2 className="mb-3">活动列表</h2>

// After: Reusable component with i18n support
<UpcomingEvents events={activities} />

The pagination structure allows for /activity/, /activity/1, /activity/2, etc., with each page showing 10 activities sorted by date.

Benefits

  • Maintainability: Eliminates code duplication and follows DRY principles
  • Internationalization: Supports multiple languages consistently
  • Performance: Pagination reduces initial page load
  • Developer Experience: Build fails clearly when required directories are missing
  • Consistency: Uses established patterns and components throughout the codebase

All existing functionality is preserved while significantly improving code quality and maintainability.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copy link
Contributor Author

Copilot AI commented Aug 25, 2025

@TechQuery 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.

Copilot AI and others added 2 commits August 25, 2025 22:59
Co-authored-by: TechQuery <19969570+TechQuery@users.noreply.github.com>
Co-authored-by: TechQuery <19969570+TechQuery@users.noreply.github.com>
Copilot AI changed the title [WIP] 集成 Google 日历时间到 Activity Integrate Calendar iframe to Activity page with navigation updates Aug 25, 2025
Copilot AI requested a review from TechQuery August 25, 2025 23:14
Copilot finished work on behalf of TechQuery August 25, 2025 23:14
Copy link
Member

@TechQuery TechQuery left a comment

Choose a reason for hiding this comment

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

@copilot 所有纯文本都要做 i18n 翻译

Copy link
Contributor Author

Copilot AI commented Aug 26, 2025

@copilot 所有纯文本都要做 i18n 翻译

Added comprehensive i18n translations for all hardcoded Chinese text in the activity page. All text now uses the t() function with proper translation keys across zh-CN, zh-TW, and en-US language files.

…on feedback

Co-authored-by: TechQuery <19969570+TechQuery@users.noreply.github.com>
Copilot AI changed the title Integrate Calendar iframe to Activity page with navigation updates Refactor Activity page with i18n support, pagination, and component reuse Aug 26, 2025
Copilot finished work on behalf of TechQuery August 26, 2025 20:05
Copilot AI requested a review from TechQuery August 26, 2025 20:05
Copy link
Member

@TechQuery TechQuery left a comment

Choose a reason for hiding this comment

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

@copilot 接着改

Copy link
Contributor Author

Copilot AI commented Aug 26, 2025

@copilot 接着改

All requested changes have been implemented:

  • Fixed JSDoc documentation format
  • Updated UpcomingEvents component with observer wrapper and removed hardcoded layout
  • Moved polyfill import to the correct location
  • Simplified getStaticPaths implementation
  • Added Pager component for pagination links
  • Reorganized component structure for better maintainability

The Activity page now features improved code quality, proper pagination, and better component reusability while maintaining all existing functionality.

Co-authored-by: TechQuery <19969570+TechQuery@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Aug 26, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Copilot AI requested a review from TechQuery August 26, 2025 21:50
Copilot finished work on behalf of TechQuery August 26, 2025 21:50
@TechQuery TechQuery marked this pull request as ready for review August 26, 2025 22:02
@TechQuery TechQuery changed the title Refactor Activity page with i18n support, pagination, and component reuse [add] Activity page with Calendar & List Aug 27, 2025
@TechQuery TechQuery merged commit 13012cb into main Aug 27, 2025
2 checks passed
@TechQuery TechQuery deleted the copilot/fix-24 branch August 27, 2025 00:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Some improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

集成 Google 日历时间到 Activity

2 participants