Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Production deployment #38

Merged
merged 5 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,10 @@ export default function Home() {
try {
if (userDbId !== null) {
await fetchUserSessions();
setIsLoading(false);
}
} catch (error) {
console.log("Error:", error);
} finally {
setIsLoading(false);
}
};
Expand Down
3 changes: 2 additions & 1 deletion app/reports/reports_list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { getReports } from "@/api/reporting/reports";
import { ReportsListProps } from "../types";
import { MixpanelTracking } from "@/services/mixpanel";
import { MIXPANEL_EVENT } from "@/constants/config";
import { formatDate } from "@/utils/dateUtils";

export default function ReportsList({ userId }: ReportsListProps) {
const [responseData, setResponseData] = useState<{ reports: Report[] } | null>(null);
Expand Down Expand Up @@ -37,7 +38,7 @@ export default function ReportsList({ userId }: ReportsListProps) {
<div className={`${index % 2 === 0 ? 'bg-orange-200' : 'bg-red-200'} h-full w-2 absolute left-0 top-0 rounded-s-md`}></div>
<div className="text-left mx-6 md:mx-8">
<p className="text-sm md:text-base font-semibold">{report.test_name}</p>
<p className="text-gray-700 text-sm md:text-base mt-2">Rank: {report.rank}</p>
<p className="text-gray-700 text-sm md:text-base mt-2">Date attempted: {formatDate(report.start_date) ?? "Date not available"}</p>
</div>
</Link>
))}
Expand Down
1 change: 1 addition & 0 deletions app/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export interface Report {
test_name: string;
rank: string;
report_link: string;
start_date: string;
};

export interface PrimaryButton {
Expand Down
6 changes: 6 additions & 0 deletions utils/dateUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,9 @@ export function isSessionActive(endTime: string): boolean {
const currentTimeObj = new Date(`2000-01-01T${currentTimeStr}`);
return sessionEndTime.getTime() > currentTimeObj.getTime();
}

export function formatDate(dateStr: string): string {
const [year, month, day] = dateStr.split('-');
return `${day}-${month}-${year}`;
}

Loading