Merge pull request #172 from Hestia-Homes/new-reporting

New reporting
This commit is contained in:
KhalimCK 2026-01-28 18:49:36 +00:00 committed by GitHub
commit 7caada25ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 25 additions and 13 deletions

View file

@ -35,7 +35,6 @@ const PresignedUrlBodySchema = z
export async function POST(request: NextRequest) {
// For the moment, this api specifically handles uploads of csvs
console.log("Triggering plan build");
const body = await request.json();
let validatedBody;
@ -78,7 +77,7 @@ export async function POST(request: NextRequest) {
JSON.stringify({ msg: "Error triggering plan" }),
{
status: 500,
}
},
);
}

View file

@ -29,6 +29,7 @@ const TitleMap = {
loft_insulation: "Loft Insulation",
room_roof_insulation: "Room Roof Insulation",
flat_roof_insulation: "Flat Roof Insulation",
sloping_ceiling_insulation: "Sloping Ceiling Insulation",
// Floor
solid_floor_insulation: "Solid Floor Insulation",
suspended_floor_insulation: "Suspended Floor Insulation",
@ -104,12 +105,12 @@ export default function RecommendationCard({
setTotalKwhSavings,
}: RecommendationCardProps) {
const defaultComponent = recommendationData.find(
(rec: Recommendation) => rec.default
(rec: Recommendation) => rec.default,
) as Recommendation;
// A recommendation type could have no default recommendation, so we need to check if it exists
const alreadyInstalled = recommendationData.some(
(rec) => rec.alreadyInstalled
(rec) => rec.alreadyInstalled,
);
const [cardComponent, setCardComponent] =

View file

@ -106,7 +106,7 @@ const updateSettings = async ({
userId: userId.toString(),
action: "update",
}),
}
},
);
const permissionsData = await permissionsReponse.json();
@ -181,7 +181,7 @@ async function deletePortfolio({
userId: userId.toString(),
action: "delete",
}),
}
},
);
const permissionsData = await permissionsReponse.json();
@ -201,7 +201,7 @@ async function deletePortfolio({
if (!response.ok) {
throw new Error(
"deletePortfolio has been called into action but utterly failed to do the API handoff"
"deletePortfolio has been called into action but utterly failed to do the API handoff",
);
}
@ -241,13 +241,13 @@ export default function PortfolioSettings({
onError: (error) => {
console.error(
"Because the API hand off failed, we're right back here at the mutation station",
error
error,
);
},
});
const [portfolioName, setPortfolioName] = useState(
portfolioSettingsData.name
portfolioSettingsData.name,
);
const [portfolioBudget, setPortfolioBudget] = useState<
@ -255,11 +255,11 @@ export default function PortfolioSettings({
>(portfolioSettingsData.budget);
const [portfolioGoal, setPortfolioGoal] = useState(
portfolioSettingsData.goal
portfolioSettingsData.goal,
);
const [portfolioStatus, setPortfolioStatus] = useState(
portfolioSettingsData.status
portfolioSettingsData.status,
);
// Set up state for deleteModal and deleteConfirmation
@ -268,9 +268,13 @@ export default function PortfolioSettings({
const [deleteConfirmationByName, setDeleteConfirmationByName] = useState("");
if (session.status === "loading") {
// You can return a loading spinner or placeholder here
return <div>Loading...</div>;
}
if (!session.data) {
// The user is not logged in, redirect them to sign in
router.push("/");
return null;
}
@ -473,7 +477,14 @@ export default function PortfolioSettings({
<UsersPermissionsCard portfolioId={portfolioId} />
<div className="rounded-md border border-red-500 mt-2">
<Table>
<TableHead className="text-lg text-brandblue">Danger Zone:</TableHead>
<TableHeader>
<TableRow>
<TableHead colSpan={2} className="text-lg text-brandblue">
Danger Zone:
</TableHead>
</TableRow>
</TableHeader>
<TableBody>
<TableRow>
<TableHead className="text-brandblue">
@ -483,6 +494,7 @@ export default function PortfolioSettings({
assigned to this portfolio
</p>
</TableHead>
<TableCell className="flex justify-end">
<Button
className="bg-red-700 w-42"