Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
3631609
feat: added staff scan qr page
dhanavadh Jul 13, 2025
fe86339
Merge branch 'dev' into feat/firstdate/staff-qr
dhanavadh Jul 13, 2025
076210b
fix: firstdate staff bg
dhanavadh Jul 13, 2025
a25dc69
Merge branch 'dev' into feat/firstdate/staff-qr
dhanavadh Jul 14, 2025
2eb62c2
feat: add @yudiel/react-qr-scanner
dhanavadh Jul 14, 2025
4cbcbd3
Merge branch 'dev' into feat/firstdate/staff-qr
dhanavadh Jul 14, 2025
a70b642
Merge branch 'dev' into feat/firstdate/staff-qr
dhanavadh Jul 14, 2025
2fa23d2
Merge branch 'dev' into feat/firstdate/staff-qr
dhanavadh Jul 14, 2025
560d6a0
Feat: added staff-qr page
dhanavadh Jul 14, 2025
382c2c8
Merge branch 'dev' into feat/firstdate/staff-qr
neennera Jul 15, 2025
a5e278f
chore: fix middleware doesn't work
Dpyde Jul 16, 2025
9846fda
feat: Implement qr scan with api
Dpyde Jul 16, 2025
6b9742a
Merge branch 'dev' into feat/firstdate/staff-qr
dhanavadh Jul 16, 2025
9447040
fix: staff-qr code
dhanavadh Jul 16, 2025
d3ac27c
Merge branch 'feat/firstdate/staff-qr' of https://github.com/isd-sgcu…
neennera Jul 16, 2025
cd6e983
Merge branch 'dev' into feat/firstdate/staff-qr
neennera Jul 17, 2025
e53584f
fix: conflicts
MasterIceZ Jul 17, 2025
707f4a7
fix: qr scan error, body stream err, cannot send cookie to backend err
dhanavadh Jul 17, 2025
8395fc4
Fix: alternative form handle error
dhanavadh Jul 17, 2025
919a945
fix: no event active layout
dhanavadh Jul 17, 2025
9523a05
Merge branch 'dev' into feat/firstdate/staff-qr
dhanavadh Jul 17, 2025
7878eff
Merge branch 'feat/firstdate/staff-qr' of https://github.com/isd-sgcu…
neennera Jul 17, 2025
4104be7
[Fix] Staff-QR (#71)
dhanavadh Jul 17, 2025
80569df
feat: getGroupByInviteCode
BadLuckZ Jul 17, 2025
0b94782
fix: fest content
neennera Jul 17, 2025
e0c6a73
fix: qrcode in /events go to /firstdate/qrcode
neennera Jul 17, 2025
f6e264a
add : checkin not found & remove freshmennight
neennera Jul 17, 2025
d0acd9f
feat: joinGroup and leaveGroup
BadLuckZ Jul 17, 2025
09d2d67
add: fix event period
neennera Jul 17, 2025
1c252d1
fix: staff with navbar
neennera Jul 17, 2025
0bd0a31
Update Routes.ts
BadLuckZ Jul 17, 2025
82d9fc3
feat: add nonStartedRoutes time constraint whitelist
Taihenc Jul 17, 2025
c3c7d6a
fix : home & map unclickable
neennera Jul 17, 2025
8448136
fix: new Date()
neennera Jul 17, 2025
05e7123
Merge pull request #80 from isd-sgcu/fix/qr-code-not-scan
neennera Jul 17, 2025
375308a
fix: qr load
Taihenc Jul 17, 2025
be3ec12
Merge branch 'main' into dev
Taihenc Jul 17, 2025
366cf26
fix: check in not found event
neennera Jul 18, 2025
c56c4d6
fix: qa profile , firstdate register
neennera Jul 18, 2025
2b8d55e
Merge branch 'main' into dev
neennera Jul 18, 2025
b8cf671
Merge pull request #79 from isd-sgcu/feat/rpkm/groupAPI
RawSalmon69 Jul 18, 2025
86c9d78
fix: edit profile
MasterIceZ Jul 18, 2025
3f2f88b
chore: remove ig
MasterIceZ Jul 18, 2025
aa7423e
Merge branch 'main' into dev
MasterIceZ Jul 18, 2025
3637bed
fix: quest-3-x banner path
BadLuckZ Jul 18, 2025
1a0cd73
[Feat][RPKM] Houses (#84)
BadLuckZ Jul 18, 2025
8d6e30c
Merge branch 'main' into dev
RawSalmon69 Jul 18, 2025
96e5daf
fix: qrcode
neennera Jul 19, 2025
6a6f02d
Merge branch 'dev' into feat/firstdate/staff-qr
neennera Jul 19, 2025
ac39a95
Merge branch 'feat/firstdate/staff-qr' into fix/qr-code-not-scan
neennera Jul 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added public/images/rpkm/loading-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/rpkm/profile/robot-02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
419 changes: 261 additions & 158 deletions src/components/rpkm/components/house-picker.astro

Large diffs are not rendered by default.

435 changes: 156 additions & 279 deletions src/components/rpkm/data/house.ts

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions src/components/rpkm/data/sizeColors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const colorMap = [
{ sizeLetter: "S", bgColor: "#0FF", textColor: "#000" },
{ sizeLetter: "M", bgColor: "#FF1493", textColor: "#fff" },
{ sizeLetter: "L", bgColor: "#FFB6C1", textColor: "#000" },
{ sizeLetter: "XL", bgColor: "#D38DD8", textColor: "#000" },
{ sizeLetter: "XXL", bgColor: "#2B2D42", textColor: "#fff" },
];
29 changes: 27 additions & 2 deletions src/components/rpkm/elements/house-confirm-popup.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,14 @@ declare global {
interface Window {
showHouseConfirmPopup?: () => void;
confirmHouseSubmission?: () => void;
showSuccessPopup?: () => void;
}
}

const token = Astro.cookies.get("token")?.value;
if (!token) {
Astro.redirect("/login");
}
---

<!-- House Confirm Popup Overlay -->
Expand Down Expand Up @@ -92,7 +98,7 @@ declare global {
</button>
</div>

<script>
<script define:vars={{ token: token || "" }}>
document.addEventListener("DOMContentLoaded", () => {
const confirmPopup = document.getElementById("view-house-confirm-popup");
const successPopup = document.getElementById("view-house-success-popup");
Expand All @@ -117,6 +123,7 @@ declare global {
successPopup?.classList.remove("hidden");
successPopup?.classList.add("flex");
}
window.showSuccessPopup = showSuccessPopup;

// Hide success popup function
function hideSuccessPopup() {
Expand All @@ -130,14 +137,32 @@ declare global {
});

// Confirm button - hide confirm popup and show success popup
btnConfirm?.addEventListener("click", () => {
btnConfirm?.addEventListener("click", async () => {
hideConfirmPopup();
showSuccessPopup();

// Trigger the actual submission in the parent component
if (window.confirmHouseSubmission) {
window.confirmHouseSubmission();
}

// Submit houses
try {
const response = await fetch("/api/group/confirm", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
body: JSON.stringify({}),
});
const result = await response.json();
if (!result.success) {
console.error("Failed to submit houses:", result.error);
}
} catch (err) {
console.error("Network error submitting houses:", err);
}
});

// Close button - hide success popup
Expand Down
29 changes: 12 additions & 17 deletions src/components/rpkm/elements/house-detail-card.astro
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
---
const { houseData = {} } = Astro.props;
const { thName, image, size, amount, capacity } = houseData;
import { colorMap } from "@rpkm/data/sizeColors";

const colors = [
{ size: "S", bgColor: "#0FF", textColor: "#000" },
{ size: "M", bgColor: "#FF1493", textColor: "#fff" },
{ size: "L", bgColor: "#FFB6C1", textColor: "#000" },
{ size: "XL", bgColor: "#D38DD8", textColor: "#000" },
{ size: "XXL", bgColor: "#2B2D42", textColor: "#fff" },
];
const { houseData = {} } = Astro.props;
const { nameThai, image, sizeLetter, chosenCount, capacity } = houseData;

let colorData = colors.find((color) => color.size == size);
let colorData = colorMap.find((color) => color.sizeLetter == sizeLetter);
if (!colorData) {
colorData = { size: "", bgColor: "#000", textColor: "#fff" };
colorData = { sizeLetter: "", bgColor: "#000", textColor: "#fff" };
}
---

<div
class="relative h-[120px] w-[80px] cursor-pointer bg-white p-1"
data-name={thName}
id={`house-card-${thName}`}
data-name={nameThai}
id={`house-card-${nameThai}`}
>
<img
src={image
Expand All @@ -32,23 +26,24 @@ if (!colorData) {
<p
class="w-auto overflow-hidden text-xs font-semibold text-ellipsis whitespace-nowrap text-[#2B2D42]"
>
{thName}
{nameThai}
</p>

<p
class="flex aspect-square w-[18px] items-center justify-center rounded-full px-[3px] py-[1px] text-[8px] font-semibold"
style={`background-color: ${colorData.bgColor}; color: ${colorData.textColor};`}
>
{size}
{sizeLetter}
</p>
</div>

<!-- Lower Content -->
<div class="flex items-center justify-between">
<div class="flex items-center gap-[1px] text-[8px]">
<p class="text-[#313131E5]">
<span style={`color: ${amount == capacity ? "#FF1493" : "#68A987"};`}
>{amount}</span
<span
style={`color: ${chosenCount == capacity ? "#FF1493" : "#68A987"};`}
>{chosenCount}</span
>/{capacity}
</p>
<img src="/images/rpkm/person-icon.svg" width="12" height="12" />
Expand Down
12 changes: 3 additions & 9 deletions src/components/rpkm/elements/house-info-popup.astro
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
---
import Frame from "@/components/common/Frame.astro";
import { colorMap } from "@rpkm/data/sizeColors";

const colors = [
{ size: "S", bgColor: "#0FF", textColor: "#000" },
{ size: "M", bgColor: "#FF1493", textColor: "#fff" },
{ size: "L", bgColor: "#FFB6C1", textColor: "#000" },
{ size: "XL", bgColor: "#D38DD8", textColor: "#000" },
{ size: "XXL", bgColor: "#2B2D42", textColor: "#fff" },
];
import Frame from "@/components/common/Frame.astro";

// Default color
const defaultColor = colors[0];
const defaultColor = colorMap[0];
---

<!-- House Popup Overlay -->
Expand Down
14 changes: 12 additions & 2 deletions src/components/rpkm/elements/house-picking-card.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,18 @@
const { house = {} } = Astro.props;
const { name, imageURL, rank } = house;

const rankWidth = rank === "sub" ? "55" : rank == 1 || rank == 2 ? "30" : "24";
const rankHeight = rank === "sub" ? "55" : rank == 1 || rank == 2 ? "30" : "24";
const rankWidth =
rank === "houseRankSub"
? "55"
: rank == "houseRank1" || rank == "houseRank2"
? "30"
: "24";
const rankHeight =
rank === "houseRankSub"
? "55"
: rank == "houseRank1" || rank == "houseRank2"
? "30"
: "24";
---

{
Expand Down
111 changes: 111 additions & 0 deletions src/lib/houseAPI.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
import { type ApiResponse, api } from "@/lib/api";
import { getAuthHeaders, getAuthToken } from "@/lib/auth";

export interface SetHousePreferencesRequest {
houseRank1: string;
houseRank2: string;
houseRank3: string;
houseRank4: string;
houseRank5: string;
houseRankSub?: string;
}

export interface GetHousePreferencesRequest {
houseRank1: HouseResponse;
houseRank2: HouseResponse;
houseRank3: HouseResponse;
houseRank4: HouseResponse;
houseRank5: HouseResponse;
houseRankSub?: HouseResponse;
}

export type HouseResponse = {
id: string;
nameThai: string;
nameEnglish: string;
descriptionThai: string;
descriptionEnglish: string;
sizeLetter: string;
chosenCount: number;
capacity: number;
instagram: string;
facebook: string;
tiktok: string;
};

export async function setHousePreferences(
preferences: SetHousePreferencesRequest,
authToken?: string
): Promise<
ApiResponse<{
groupId: string;
updatedPreferences: SetHousePreferencesRequest;
message: string;
}>
> {
const token = authToken || getAuthToken();
if (!token) {
return {
success: false,
error: "กรุณาเข้าสู่ระบบก่อนลงทะเบียน",
};
}

const response = await api.post<{
groupId: string;
updatedPreferences: SetHousePreferencesRequest;
message: string;
}>("/group/house-preferences", preferences, {
headers: getAuthHeaders(token),
});

if (!response.success) {
console.error("Failed to set house preferences:", response.error);
}
return response;
}

export async function getHousePreferences(
authToken?: string
): Promise<ApiResponse<{ data: GetHousePreferencesRequest }>> {
const token = authToken || getAuthToken();
if (!token) {
return {
success: false,
error: "กรุณาเข้าสู่ระบบก่อนลงทะเบียน",
};
}

const response = await api.get<{ data: GetHousePreferencesRequest }>(
"/group/house-preferences",
{
headers: getAuthHeaders(token),
}
);

if (!response.success) {
console.error("Failed to fetch house preferences:", response.error);
}
return response;
}

export async function getAllHouses(
authToken?: string
): Promise<ApiResponse<{ data: HouseResponse[] }>> {
const token = authToken || getAuthToken();
if (!token) {
return {
success: false,
error: "กรุณาเข้าสู่ระบบก่อนลงทะเบียน",
};
}

const response = await api.get<{ data: HouseResponse[] }>("/houses", {
headers: getAuthHeaders(token),
});

if (!response.success && !response.data) {
console.error("Failed to fetch house data:", response.error);
}
return response;
}
2 changes: 1 addition & 1 deletion src/pages/fest/quest-3-1.astro
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import Layout from "@/layouts/fest/FestWithNavbar.astro";
</div>
<div class="pt-4">
<img
src="/public/images/fest/quest-3-1-banner.webp"
src="/images/fest/quest-3-1-banner.webp"
alt="Quest 3-1 Banner"
class="mb-4 h-auto w-full shadow-md"
/>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/fest/quest-3-2.astro
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import Layout from "@/layouts/fest/FestWithNavbar.astro";
</div>
<div class="pt-4">
<img
src="/public/images/fest/quest-3-2-banner.webp"
src="/images/fest/quest-3-2-banner.webp"
alt="Quest 3-2 Banner"
class="mb-4 h-auto w-full shadow-md"
/>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/fest/quest-3-3.astro
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import Layout from "@/layouts/fest/FestWithNavbar.astro";
</div>
<div class="pt-4">
<img
src="/public/images/fest/quest-3-3-banner.webp"
src="/images/fest/quest-3-3-banner.webp"
alt="Quest 3-3 Banner"
class="mb-4 h-auto w-full shadow-md"
/>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/fest/quest-3-4.astro
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import Layout from "@/layouts/fest/FestWithNavbar.astro";
</div>
<div class="pt-4">
<img
src="/public/images/fest/quest-3-4-banner.webp"
src="/images/fest/quest-3-4-banner.webp"
alt="Quest 3-4 Banner"
class="mb-4 h-auto w-full shadow-md"
/>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/fest/quest-3-5.astro
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import Layout from "@/layouts/fest/FestWithNavbar.astro";
</div>
<div class="pt-4">
<img
src="/public/images/fest/quest-3-5-banner.webp"
src="/images/fest/quest-3-5-banner.webp"
alt="Quest 3-5 Banner"
class="mb-4 h-auto w-full shadow-md"
/>
Expand Down
2 changes: 1 addition & 1 deletion src/types/common.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export interface User {
export interface Group {
id: string;
ownerId: string;
isconfirmed: boolean;
isConfirmed: boolean;
inviteCode: string;
memberCount: number;
houseRank1: House | null;
Expand Down
Loading