-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #445 from TAMUSHPE/dev
Dev
- Loading branch information
Showing
11 changed files
with
738 additions
and
441 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
'use client' | ||
import { useState } from "react"; | ||
import { RequestWithDoc } from "@/types/membership"; | ||
|
||
|
||
interface MemberCardProps{ | ||
request: RequestWithDoc, | ||
onApprove: (member: RequestWithDoc) => void, | ||
onDeny: (member: RequestWithDoc) => void, | ||
} | ||
|
||
const MemberCard : React.FC<MemberCardProps> = ({request, onApprove, onDeny}) => { | ||
|
||
|
||
return( | ||
// flex text-gray-400 justify-evenly text-2xl | ||
<tr className="bg-gray-300"> | ||
<td className="bg-gray-500 px-4 py-2">{request.name}</td> | ||
<td className="px-4 py-2"><a href={request.chapterURL}>Chapter</a></td> | ||
<td className="px-4 py-2"><a href={request.nationalURL}>National</a></td> | ||
<td className="bg-green-400 px-4 py-2"><button onClick={() => {onApprove(request); }}>Approve</button></td> | ||
<td className="bg-red-400 px-4 py-2"><button onClick={() => {onDeny(request); }}>Deny</button></td> | ||
</tr> | ||
) | ||
//} | ||
|
||
} | ||
export default MemberCard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { Timestamp } from "firebase/firestore"; | ||
|
||
export interface RequestWithDoc { | ||
name: string, | ||
uid: string, | ||
chapterURL: string; | ||
nationalURL: string; | ||
chapterExpiration: Timestamp; | ||
nationalExpiration: Timestamp; | ||
shirtSize: string; | ||
} | ||
/** =================================================================================== | ||
* The content below must only be changed to match MobileApp/src/types/membership.ts | ||
* | ||
* You may manually add any imports above at the top of this file if needed | ||
* =================================================================================== | ||
* */ | ||
export const isMemberVerified = (nationalExpiration: Timestamp | { seconds: number; nanoseconds: number; } | undefined, chapterExpiration: Timestamp | { seconds: number; nanoseconds: number; } | undefined) => { | ||
if (!nationalExpiration || !chapterExpiration) return false; | ||
|
||
const nationalExpirationDate = nationalExpiration instanceof Timestamp ? nationalExpiration.toDate() : nationalExpiration ? new Date(nationalExpiration.seconds * 1000) : undefined; | ||
const chapterExpirationDate = chapterExpiration instanceof Timestamp ? chapterExpiration.toDate() : chapterExpiration ? new Date(chapterExpiration.seconds * 1000) : undefined; | ||
|
||
const currentDate = new Date(); | ||
let isNationalValid = true; | ||
let isChapterValid = true; | ||
|
||
if (nationalExpirationDate) { | ||
isNationalValid = currentDate <= nationalExpirationDate; | ||
} | ||
|
||
if (chapterExpirationDate) { | ||
isChapterValid = currentDate <= chapterExpirationDate; | ||
} | ||
|
||
return isNationalValid && isChapterValid | ||
}; | ||
|
||
export const getBadgeColor = (isOfficer: boolean, isVerified: boolean) => { | ||
if (isOfficer) return '#FCE300'; | ||
if (isVerified) return '#500000'; | ||
return ''; | ||
}; | ||
|
||
|
||
export const formatExpirationDate = (expiration: Timestamp | { seconds: number; nanoseconds: number; } | undefined): string => { | ||
if (!expiration) return ''; // Handle undefined cases | ||
const options: Intl.DateTimeFormatOptions = { | ||
year: 'numeric', | ||
month: 'long', | ||
day: 'numeric' | ||
}; | ||
|
||
const expirationDate = expiration instanceof Timestamp ? expiration.toDate() : new Date(expiration.seconds * 1000); | ||
|
||
return new Intl.DateTimeFormat('en-US', options).format(expirationDate); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.