Skip to content

Commit

Permalink
panel derecho
Browse files Browse the repository at this point in the history
  • Loading branch information
fermelli committed Jan 12, 2022
1 parent e78c8ff commit 6d53845
Show file tree
Hide file tree
Showing 8 changed files with 219 additions and 15 deletions.
90 changes: 90 additions & 0 deletions public/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -511,14 +511,30 @@ Ensure the default browser behavior of the `hidden` attribute.
margin-bottom: 0.25rem;
}

.mb-2 {
margin-bottom: 0.5rem;
}

.mb-3 {
margin-bottom: 0.75rem;
}

.block {
display: block;
}

.inline-block {
display: inline-block;
}

.flex {
display: flex;
}

.inline-flex {
display: inline-flex;
}

.grid {
display: grid;
}
Expand All @@ -543,6 +559,10 @@ Ensure the default browser behavior of the `hidden` attribute.
height: 100%;
}

.h-8 {
height: 2rem;
}

.w-full {
width: 100%;
}
Expand All @@ -551,6 +571,14 @@ Ensure the default browser behavior of the `hidden` attribute.
width: 50%;
}

.w-8 {
width: 2rem;
}

.w-10 {
width: 2.5rem;
}

.transform {
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
}
Expand All @@ -567,6 +595,18 @@ Ensure the default browser behavior of the `hidden` attribute.
grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-cols-\[480px_1fr_360px\] {
grid-template-columns: 480px 1fr 360px;
}

.grid-cols-\[480px_1fr_400px\] {
grid-template-columns: 480px 1fr 400px;
}

.grid-cols-\[480px_1fr_320px\] {
grid-template-columns: 480px 1fr 320px;
}

.grid-rows-1 {
grid-template-rows: repeat(1, minmax(0, 1fr));
}
Expand All @@ -575,6 +615,10 @@ Ensure the default browser behavior of the `hidden` attribute.
grid-template-rows: 1fr 2fr;
}

.flex-wrap {
flex-wrap: wrap;
}

.items-end {
align-items: flex-end;
}
Expand Down Expand Up @@ -652,6 +696,21 @@ Ensure the default browser behavior of the `hidden` attribute.
background-color: rgb(229 231 235 / var(--tw-bg-opacity));
}

.bg-green-500 {
--tw-bg-opacity: 1;
background-color: rgb(34 197 94 / var(--tw-bg-opacity));
}

.bg-green-600 {
--tw-bg-opacity: 1;
background-color: rgb(22 163 74 / var(--tw-bg-opacity));
}

.bg-red-600 {
--tw-bg-opacity: 1;
background-color: rgb(220 38 38 / var(--tw-bg-opacity));
}

.p-4 {
padding: 1rem;
}
Expand All @@ -675,6 +734,16 @@ Ensure the default browser behavior of the `hidden` attribute.
padding-bottom: 0.25rem;
}

.px-6 {
padding-left: 1.5rem;
padding-right: 1.5rem;
}

.py-2 {
padding-top: 0.5rem;
padding-bottom: 0.5rem;
}

.text-center {
text-align: center;
}
Expand Down Expand Up @@ -704,6 +773,11 @@ Ensure the default browser behavior of the `hidden` attribute.
line-height: 2.25rem;
}

.text-xs {
font-size: 0.75rem;
line-height: 1rem;
}

.font-bold {
font-weight: 700;
}
Expand All @@ -712,6 +786,10 @@ Ensure the default browser behavior of the `hidden` attribute.
font-weight: 600;
}

.font-light {
font-weight: 300;
}

.uppercase {
text-transform: uppercase;
}
Expand All @@ -737,6 +815,18 @@ Ensure the default browser behavior of the `hidden` attribute.
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
}

.shadow-sm {
--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
}

.shadow-lg {
--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
}

.outline-none {
outline: 2px solid transparent;
outline-offset: 2px;
Expand Down
10 changes: 9 additions & 1 deletion src/components/Alarm.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup>
import { computed } from 'vue';
import { computed, watch } from 'vue';
import { useStore } from 'vuex';
import SpriteAlarm from './sprites/SpriteAlarm.vue';
Expand Down Expand Up @@ -27,7 +27,15 @@ const alarmColor = computed(() => {
} else {
return 'red'
}
});
watch(alarmColor, (color, prevColor) => {
if (color == 'green')
store.commit('updateTimeGreen')
if (color == '#f6d015')
store.commit('updateTimeYellow')
if (color == 'red')
store.commit('updateTimeRed')
});
Expand Down
21 changes: 14 additions & 7 deletions src/components/ControlPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,14 @@ const constantK = computed({
}
});
const currentTemperature = computed(() => store.state.currentTemperature);
const currentTemperature = computed({
get: () => {
return store.state.currentTemperature
},
set: (value) => {
store.dispatch('updateCurrentTemperature', value)
}
});
const currentTime = computed({
get: () => {
Expand Down Expand Up @@ -111,8 +118,8 @@ const initSimulation = (e) => {
turnOnVentilator.value = false
}
let C
let temperature
let C;
let temperature;
if (turnOnVentilator.value) {
timeOn.value += timeFrame.value
Expand All @@ -126,7 +133,7 @@ const initSimulation = (e) => {
Math.E ** (-constantK.value * (currentTime.value / 1000))
}
store.dispatch('updateCurrentTemperature', temperature)
currentTemperature.value = temperature;
currentTime.value += timeFrame.value;
Expand Down Expand Up @@ -160,7 +167,7 @@ const resetSimulation = (e) => {
<span
class="font-bold"
>{{ heaterTemperature }}</span>
)
) [° C]
</label>
<input
class="h-9 w-full rounded outline-none border"
Expand Down Expand Up @@ -232,7 +239,7 @@ const resetSimulation = (e) => {
class="h-10 w-full px-4 my-2 py-1 rounded-full bg-[#0c2f3f] uppercase text-white font-semibold cursor-pointer hover:bg-[#103e53] disabled:bg-gray-200 disabled:text-gray-400 disabled:cursor-not-allowed"
type="submit"
value="Iniciar simulación"
:disabled="!isActive"
:disabled="!isActive || currentTemperature != roomTemperature"
/>
<input
class="h-10 w-full px-4 my-2 py-1 rounded-full uppercase text-gray-500 font-semibold cursor-pointer border border-gray-500 disabled:bg-gray-200 disabled:text-gray-400 disabled:cursor-not-allowed disabled:border-none"
Expand All @@ -242,7 +249,7 @@ const resetSimulation = (e) => {
/>
</form>
<div class="p-4 my-4 text-center">
<h3>Tiempo simulando</h3>
<h4>Tiempo simulando</h4>
<span class="block text-5xl">{{ Math.trunc(currentTime / 1000) }}</span>
<span class="block text-3xl">segundos</span>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Heater.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const heaterTemperature = computed(() => store.state.heaterTemperature);
const styles = computed(() => {
return {
bottom: `${33 - (heaterTemperature.value / 50)}%`,
width: heaterTemperature.value == 0 ? '0%' : `${heaterTemperature.value}%`,
width: heaterTemperature.value == 0 ? '0%' : `${heaterTemperature.value * 0.6}%`,
}
});
Expand Down
80 changes: 80 additions & 0 deletions src/components/RightPanel.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<script setup>
import { computed } from 'vue';
import { useStore } from 'vuex';
const store = useStore();
const turnOnVentilator = computed({
get: () => {
return store.state.turnOnVentilator;
},
set: (value) => {
store.dispatch('updateTurnOnVentilator', value);
}
});
const timeFrame = computed({
get: () => {
return store.state.timeFrame;
},
set: (value) => {
store.dispatch('updateTimeFrame', value);
}
});
const timeGreen = computed(() => store.state.timeGreen);
const timeYellow = computed(() => store.state.timeYellow);
const timeRed = computed(() => store.state.timeRed);
</script>

<template>
<div class="w-full h-screen bg-gray-100 rounded px-4 py-8">
<h2 class="text-2xl text-center mb-4">DATOS</h2>
<div>
<h4>Ventilador</h4>
<span
class="flex justify-center items-center h-10 w-10 rounded-full bg-green-600 text-white font-semibold shadow-lg cursor-pointer my-2"
v-if="turnOnVentilator"
@click="turnOnVentilator = false"
>ON</span>
<span
class="flex justify-center items-center h-10 w-10 rounded-full bg-red-600 text-white font-semibold shadow-lg cursor-pointer my-2"
v-else
@click="turnOnVentilator = true"
>OFF</span>
</div>
<form>
<div class="mt-2 mb-4">
<label class="block mb-1 text-sm" for="timeFrame">Periodicidad [ms]</label>
<input
class="h-9 w-full rounded px-4 outline-none border border-slate-800"
type="number"
id="timeFrame"
placeholder="Temperatura máxima"
min="10"
step="10"
max="1000"
v-model="timeFrame"
/>
</div>
</form>
<div>
<h4 class="mb-2">Tiempo de activación</h4>
<ul>
<li class="mb-3">
<span class="block text-xs font-bold">Led verde</span>
<span class="block font-light">{{ timeGreen / 1000 }} segundos</span>
</li>
<li class="mb-3">
<span class="block text-xs font-bold">Led amarillo</span>
<span class="block font-light">{{ timeYellow / 1000 }} segundos</span>
</li>
<li class="mb-3">
<span class="block text-xs font-bold">Led rojo</span>
<span class="block font-light">{{ timeRed / 1000 }} segundos</span>
</li>
</ul>
</div>
</div>
</template>
5 changes: 2 additions & 3 deletions src/components/Ventilator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const animation = computed(() => {
</script>
<template>
<div class="ventilator p-8 rounded bg-white shadow">
<div class="ventilator px-6 py-8 rounded bg-white shadow">
<div class="heatsinks">
<div class="heatsink"></div>
<div class="heatsink"></div>
Expand All @@ -41,9 +41,8 @@ const animation = computed(() => {

<style scoped>
.ventilator {
width: 320px;
max-width: 320px;
}
.heatsinks {
display: flex;
flex-direction: column;
Expand Down
Loading

0 comments on commit 6d53845

Please sign in to comment.