added location total to UI

This commit is contained in:
2024-01-09 10:51:05 +01:00
parent c0b108bc65
commit c76a69df5b
3 changed files with 38 additions and 24 deletions

View File

@@ -5,18 +5,12 @@ import { AddLocationButton } from './ui/AddLocationButton';
import { PageFooter } from './ui/PageFooter';
import { isAuthErrorMessage } from '@/app/lib/auth';
import { fetchAllLocations } from './lib/locationActions';
import { formatCurrency } from './lib/formatStrings';
const getNextYearMonth = (yearMonth:number) => {
return(yearMonth % 100 === 12 ? yearMonth + 89 : yearMonth + 1);
}
const formatCurrency = (amount:number) => {
// format number wirh 2 decimal places and a thousand separator
const formattedAmount = amount.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
return(formattedAmount);
}
export const Page = async () => {
const locations = await fetchAllLocations();