Skip to content

Conversation

@MasterIceZ
Copy link
Member

No description provided.

dhanavadh and others added 30 commits July 13, 2025 22:27
-added staff scan qr page
added staff-qr page
- Fixed Staff-qr handling error
- Fix error type assertions in staff/event/index.astro
- Remove unused imports and variables
- Added auth functions getAuthToken() and getAuthHeaders() in api.ts
- Fixed body stream error when scan qr code
- Added handle error when user is not exist and when user scan wrong qr
- fix ButtonFd not send data
- Fixed no events active layout
* feat: added staff scan qr page

-added staff scan qr page

* fix: firstdate staff bg

* feat: add @yudiel/react-qr-scanner

* Feat: added staff-qr page

added staff-qr page

* chore: fix middleware doesn't work

* feat: Implement qr scan with api

* fix: staff-qr code

- Fixed Staff-qr handling error
- Fix error type assertions in staff/event/index.astro
- Remove unused imports and variables

* fix: qr scan error, body stream err, cannot send cookie to backend err

- Added auth functions getAuthToken() and getAuthHeaders() in api.ts
- Fixed body stream error when scan qr code
- Added handle error when user is not exist and when user scan wrong qr

* Fix: alternative form handle error

- fix ButtonFd not send data

* fix: no event active layout

- Fixed no events active layout

* fix: qrcode

---------

Co-authored-by: neennera <[email protected]>
Co-authored-by: Thukdanai Thaothawin <[email protected]>
Co-authored-by: Borworntat Dendumrongkul <[email protected]>
Copilot AI review requested due to automatic review settings July 18, 2025 09:40
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 pull request implements several improvements and fixes across the application, including new group management features, code refactoring, and UI updates. The changes primarily focus on group functionality, profile management, and code organization.

Key changes include:

  • Added comprehensive group management API functions (join, leave, fetch by invite code)
  • Refactored profile components to share common types and avatar mappings
  • Updated UI components with dynamic group member counts and improved error handling

Reviewed Changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/lib/groupAPI.ts Added new API functions for group operations (join, leave, fetch by invite code)
src/lib/eventAPI.ts Simplified error condition checking in event status
src/components/rpkm/rubpuen/UserProfile.tsx Refactored to use shared profile types and improved null safety
src/components/rpkm/rubpuen/GroupProfile.tsx Refactored to use shared avatar mapping and profile types
src/components/rpkm/data/profile.ts New shared module for profile types and avatar mappings
src/components/rpkm/components/house-picker.astro Updated import path for house data
src/components/rpkm/components/group-picker.astro Enhanced with dynamic group functionality and error handling
src/components/firstdate/Footer.astro Removed Instagram contact section and improved layout
src/components/common/profile/EditProfile.tsx Fixed prefix values and improved form data handling
src/components/common/Footer.astro Removed Instagram contact section

if (!token) {
return {
success: false,
error: "กรุณาเข้าสู่ระบบก่อนลงทะเบียน",
Copy link

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

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

The error message 'กรุณาเข้าสู่ระบบก่อนลงทะเบียน' (Please log in before registering) is misleading for a function that fetches group data by invite code. It should indicate authentication is required for accessing group information.

Suggested change
error: "กรุณาเข้าสู่ระบบก่อนลงทะเบียน",
error: "กรุณาเข้าสู่ระบบเพื่อเข้าถึงข้อมูลกลุ่ม",

Copilot uses AI. Check for mistakes.
if (!token) {
return {
success: false,
error: "กรุณาเข้าสู่ระบบก่อนลงทะเบียน",
Copy link

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

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

The error message 'กรุณาเข้าสู่ระบบก่อนลงทะเบียน' is inappropriate for a group joining function. It should specifically mention group joining rather than registration.

Suggested change
error: "กรุณาเข้าสู่ระบบก่อนลงทะเบียน",
error: "กรุณาเข้าสู่ระบบก่อนเข้าร่วมกลุ่ม",

Copilot uses AI. Check for mistakes.
if (!token) {
return {
success: false,
error: "กรุณาเข้าสู่ระบบก่อนลงทะเบียน",
Copy link

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

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

The error message 'กรุณาเข้าสู่ระบบก่อนลงทะเบียน' is misleading for a group leaving function. It should indicate authentication is required for leaving a group.

Suggested change
error: "กรุณาเข้าสู่ระบบก่อนลงทะเบียน",
error: "กรุณาเข้าสู่ระบบก่อนออกจากกลุ่ม", // "Please log in before leaving the group"

Copilot uses AI. Check for mistakes.
export async function joinGroup(
inviteCode: string,
authToken?: string
): Promise<ApiResponse<unknown>> {
Copy link

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

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

The return type 'unknown' is too vague. Based on line 80, the API returns '{ message: string }', so the return type should be 'Promise<ApiResponse<{ message: string }>>' for better type safety.

Suggested change
): Promise<ApiResponse<unknown>> {
): Promise<ApiResponse<{ message: string }>> {

Copilot uses AI. Check for mistakes.
groupDefaultView?.classList.add("hidden");
groupMemberView?.classList.remove("hidden");
} else {
console.error("Failed to leave group before:", response.error);
Copy link

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

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

The error message 'Failed to leave group before:' is confusing and doesn't match the context. This appears to be logging an error for a failed join group operation, not a leave operation.

Suggested change
console.error("Failed to leave group before:", response.error);
console.error("Failed to join group:", response.error);

Copilot uses AI. Check for mistakes.
Authorization: `Bearer ${getAuthToken()}`,
},
});
const raw_data = reponse.data as EditProfileFormData;
Copy link

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

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

Variable name 'reponse' is misspelled. It should be 'response'.

Copilot uses AI. Check for mistakes.
illness: data.user.hasChronicDiseases ? data.user.illness : "",
};

const reponse = await api.patch("/user/update", formData, {
Copy link

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

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

Variable name 'reponse' is misspelled. It should be 'response'.

Copilot uses AI. Check for mistakes.
@RawSalmon69 RawSalmon69 merged commit 0c6ab70 into main Jul 18, 2025
10 checks passed
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.

7 participants