Skip to content

Commit

Permalink
feat: improve alignment of runout sensor switch and icon (#1469)
Browse files Browse the repository at this point in the history
Signed-off-by: Helge Keck <[email protected]>
Co-authored-by: Pedro Lamas <[email protected]>
  • Loading branch information
HelgeKeck and pedrolamas committed Aug 5, 2024
1 parent bda900d commit 7d0a890
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 24 deletions.
2 changes: 1 addition & 1 deletion components.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
export {}

/* prettier-ignore */
declare module 'vue' {
export interface GlobalComponents {
ActionCommandPromptDialog: typeof import('./src/components/common/ActionCommandPromptDialog.vue')['default']
Expand Down
51 changes: 28 additions & 23 deletions src/components/widgets/runout-sensors/RunoutSensorsCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,36 @@
</app-btn>
</template>

<v-card-text>
<v-layout
<v-list>
<v-list-item
v-for="item in sensors"
:key="item.name"
align-center
justify-start
class="py-1"
>
<span class="text-subtitle-1">{{ item.name }}</span>
<v-icon
:color="(item.filament_detected) ? 'success' : 'warning'"
class="ml-3"
left
>
{{ (item.filament_detected) ? '$checkedCircle' : '$alertCircle' }}
</v-icon>
<v-switch
class="ml-2"
color="success"
:input-value="item.enabled"
@change="changeSensor(item, $event)"
/>
</v-layout>
</v-card-text>
<v-list-item-content>
<v-list-item-title>{{ item.prettyName }}</v-list-item-title>
</v-list-item-content>
<v-list-item-icon>
<v-icon
v-if="item.filament_detected"
color="success"
>
$checkedCircle
</v-icon>
<v-icon
v-else
color="warning"
>
$alertCircle
</v-icon>
</v-list-item-icon>
<v-list-item-action>
<v-switch
:input-value="item.enabled"
@change="changeSensor(item, $event)"
/>
</v-list-item-action>
</v-list-item>
</v-list>
</collapsable-card>
</template>

Expand All @@ -62,8 +68,7 @@ export default class RunoutSensorsCard extends Mixins(StateMixin) {
}
changeSensor (item: RunoutSensor, value: boolean) {
const enable: number = (value) ? 1 : 0
this.sendGcode(`SET_FILAMENT_SENSOR SENSOR=${item.name} ENABLE=${enable}`)
this.sendGcode(`SET_FILAMENT_SENSOR SENSOR=${item.name} ENABLE=${+value}`)
}
}
</script>
1 change: 1 addition & 0 deletions src/store/printer/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ export const getters: GetterTree<PrinterState, RootState> = {
const sensor = get(state.printer, item, undefined)
sensors.push({
name,
prettyName: Vue.$filters.prettyCase(name),
...sensor
})
}
Expand Down

0 comments on commit 7d0a890

Please sign in to comment.