Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: improve alignment of runout sensor switch and icon #1469

Merged
merged 3 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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