Skip to content

Commit

Permalink
feat: allow toggle for temp chart
Browse files Browse the repository at this point in the history
  • Loading branch information
cadriel committed Oct 24, 2020
1 parent 94602e5 commit 121e36c
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 23 deletions.
29 changes: 25 additions & 4 deletions src/components/cards/TemperatureCard.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
<template>
<v-card color="tertiary" class="mb-4">
<v-card-title class="quaternary">
<v-icon left>{{ icons.fire }}</v-icon>
<span class="font-weight-light">Temperatures</span>
<v-card-title class="quaternary py-3">

<v-col cols="12" lg="auto" class="pa-0">
<v-icon left>{{ icons.fire }}</v-icon>
<span class="font-weight-light">Temperatures</span>
</v-col>

<v-col class="pa-0 d-inline-flex justify-start justify-md-end flex-wrap">
<v-btn
@click="chartVisible = !chartVisible"
color="secondary"
class="ml-0 ml-md-2 mr-2 mr-md-0 my-1">
<v-icon small class="mr-1">{{ icons.chart }}</v-icon>
<span>Chart</span>
</v-btn>
</v-col>
</v-card-title>
<v-divider></v-divider>

<temperature-targets-widget></temperature-targets-widget>

<v-card-text class="chart-container">
<v-card-text class="chart-container" v-if="chartVisible">
<temperature-chart-widget v-if="chartReady && klippyConnected" :chart-data="chartData" :styles="chartStyles"></temperature-chart-widget>
</v-card-text>
</v-card>
Expand Down Expand Up @@ -54,6 +67,14 @@ export default class TemperatureCard extends Mixins(UtilsMixin) {
this.chartData = this.allChartData
this.chartReady = true
}
get chartVisible (): boolean {
return this.$store.state.config.localConfig.chartVisible
}
set chartVisible (val: boolean) {
this.$store.dispatch('config/saveLocalStorage', { chartVisible: val })
}
}
</script>

Expand Down
2 changes: 1 addition & 1 deletion src/components/cards/ToolheadCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<v-card color="tertiary" class="mb-4">
<v-card-title class="quaternary">
<v-icon left>{{ icons.printer3dNozzle }}</v-icon>
<span class="font-weight-light">Toolhead</span>
<span class="font-weight-light">Tool</span>
<v-spacer />
<v-btn
v-if="!printerPrinting"
Expand Down
50 changes: 33 additions & 17 deletions src/components/widgets/TemperatureTargetsWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,39 @@
Actual
</v-col>
<v-col class="py-0 px-2 text-subtitle-1 grey--text text--darken-1">
Target
<!-- <v-menu bottom :offset-y="true">
<template v-slot:activator="{ on, attrs }">
<v-btn small v-bind="attrs" v-on="on" icon color="grey"><v-icon>mdi-chevron-down</v-icon></v-btn>
</template>
<v-list nav dense transition="slide-y-transition">
<v-list-item>
<v-list-item-title>Off</v-list-item-title>
</v-list-item>
<v-list-item>
<v-list-item-title>Set ABS</v-list-item-title>
</v-list-item>
<v-list-item>
<v-list-item-title>Set PLA</v-list-item-title>
</v-list-item>
</v-list>
</v-menu> -->
<v-layout>
Target
<v-spacer></v-spacer>
<!-- <v-menu bottom left :offset-y="true" :min-width="150">
<template v-slot:activator="{ on, attrs }">
<v-btn
:min-width="40"
v-bind="attrs" v-on="on"
color="secondary"
small
class="pa-0">
<v-icon>{{ icons.chevronDown }}</v-icon>
</v-btn>
</template>
<v-list
nav
dense
color="secondary">
<v-list-item link>
<v-list-item-title>Off</v-list-item-title>
</v-list-item>
<v-list-item link>
<v-list-item-title>Preheat</v-list-item-title>
</v-list-item>
<v-list-item link>
<v-list-item-title>ABS</v-list-item-title>
</v-list-item>
<v-list-item link>
<v-list-item-title>PLA</v-list-item-title>
</v-list-item>
</v-list>
</v-menu> -->
</v-layout>
</v-col>
</v-row>

Expand Down
4 changes: 3 additions & 1 deletion src/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ import {
mdiCogs,
mdiContentSaveOutline,
mdiAlert,
mdiPowerPlug
mdiPowerPlug,
mdiChartBellCurve
} from '@mdi/js'

/**
Expand All @@ -71,6 +72,7 @@ export const Globals = Object.freeze({
})

export const Icons = Object.freeze({
chart: mdiChartBellCurve,
power: mdiPowerPlug,
home: mdiHome,
close: mdiClose,
Expand Down
1 change: 1 addition & 0 deletions src/store/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const state: ConfigState = {
unsavedChanges: false,
localConfig: {
cameraVisible: false,
chartVisible: true,
darkMode: true
},
fileConfig: {
Expand Down
1 change: 1 addition & 0 deletions src/store/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface ConfigState {
export interface LocalConfig {
[key: string]: string | boolean | number;
cameraVisible: boolean;
chartVisible: boolean;
darkMode: boolean;
}

Expand Down
1 change: 1 addition & 0 deletions todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
- add a widget to configure ztilt (needed?)

## User wants
- another request to have the current temps above the macors etc during a print, but not while not printing.
- draggable dashboard panels?
- maybe look at tightening the mobile ui. have fan's as a value, that you can click
on which then makes a popout to adjust fan?
Expand Down

0 comments on commit 121e36c

Please sign in to comment.