Skip to content

Commit

Permalink
G2P-2386: Added New tag to recently added programs
Browse files Browse the repository at this point in the history
  • Loading branch information
shivamg9 committed Jun 19, 2024
1 parent 8c6f3b4 commit 6b2944b
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"Benefits": "Benefits",
"Tap to view your Benefits": "Tap to view your Benefits",
"View all": "View All",
"NEW": "NEW",

"This is the about page": "This is the about page",

Expand Down
1 change: 1 addition & 0 deletions messages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"Benefits": "Beneficios",
"Tap to view your Benefits": "Toque para ver sus beneficios",
"View all": "Ver todo",
"NEW": "NUEVO",

"This is the about page": "Esta es la página Acerca de",

Expand Down
1 change: 1 addition & 0 deletions messages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"Benefits": "Avantages",
"Tap to view your Benefits": "Appuyez pour voir vos avantages",
"View all": "Voir tout",
"NEW": "NOUVEAU",

"This is the about page": "Ceci est la page À propos",

Expand Down
1 change: 1 addition & 0 deletions messages/tl.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"Benefits": "Mga Benepisyo",
"Tap to view your Benefits": "Pindutin para tingnan ang iyong mga benepisyo",
"View all": "Tingnan lahat",
"NEW": "BAGO",

"This is the about page": "Ito ang tungkol sa pahina",

Expand Down
17 changes: 17 additions & 0 deletions src/app/[locale]/programs/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,15 @@ export default function ProgrmPage({
}
};

// Function to check if a program is new (created within the last 21 days)
const isNewProgram = (createDate: string): boolean => {
const today = new Date();
const twentyOneDaysAgo = new Date();
twentyOneDaysAgo.setDate(today.getDate() - 21);
const programCreateDate = new Date(createDate);
return programCreateDate > twentyOneDaysAgo;
};

return (
<div className=" rounded-lg border-gray-200 p-4 mx-4 lg:px-4 m-0">
<div
Expand Down Expand Up @@ -582,6 +591,14 @@ export default function ProgrmPage({
onMouseEnter={(e) => showTooltip(e, program.name)}
onMouseLeave={() => hideTooltip()} // Hide tooltip on mouse leave
>
{isNewProgram(program.create_date) && (
<span
className="bg-blue-500 text-white px-2 py-1 rounded-md text-xs font-semibold animate-pulse mr-2"
style={{fontSize: "9px"}}
>
{t("NEW")}
</span>
)}
{program.name}
</td>

Expand Down
1 change: 1 addition & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface Program {
is_portal_form_mapped: string;
is_multiple_form_submission: number;
last_application_status: number;
create_date: string;
}
export interface ProgramDetails {
program_name: string;
Expand Down

0 comments on commit 6b2944b

Please sign in to comment.