Skip to content

Commit

Permalink
Swap CarbonEmissions sections to use persistentToggle
Browse files Browse the repository at this point in the history
  • Loading branch information
dannon committed Nov 6, 2023
1 parent 35aa512 commit 5f5a18b
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
import type { GetComponentPropTypes } from "types/utilityTypes";
import { computed, unref } from "vue";
import { usePersistentToggle } from "@/composables/persistentToggle";
import * as carbonEmissionsConstants from "./carbonEmissionConstants.js";
import BarChart from "./BarChart.vue";
Expand Down Expand Up @@ -34,6 +36,8 @@ const props = withDefaults(defineProps<CarbonEmissionsProps>(), {
memoryAllocatedInMebibyte: 0,
});
const { toggled, toggle } = usePersistentToggle("carbonEmissions");
const carbonEmissions = computed(() => {
const memoryPowerUsed = carbonEmissionsConstants.memoryPowerUsage;
const runtimeInHours = props.jobRuntimeInSeconds / (60 * 60); // Convert to hours
Expand Down Expand Up @@ -270,9 +274,11 @@ function getEnergyNeededText(energyNeededInKiloWattHours: number) {

<template v-if="carbonEmissions && carbonEmissionsComparisons">
<div class="mt-4">
<Heading h2 separator size="md" inline> Carbon Footprint </Heading>
<Heading h2 separator size="md" inline collapsible :collapsed="toggled" @click="toggle()">
Carbon Footprint
</Heading>

<section class="carbon-emission-values my-4">
<section v-if="!toggled" class="carbon-emission-values my-4">
<div class="emissions-grid">
<!-- Carbon Footprint Totals -->
<CarbonEmissionsCard
Expand Down

0 comments on commit 5f5a18b

Please sign in to comment.