Skip to content

Commit 9b0f6f8

Browse files
committed
refactor: adds pixels value string formatter
Signed-off-by: Pedro Lamas <[email protected]>
1 parent d501979 commit 9b0f6f8

File tree

11 files changed

+42
-22
lines changed

11 files changed

+42
-22
lines changed

src/components/widgets/bedmesh/BedMeshCard.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
:options="options"
5858
:data="series"
5959
:graphics="graphics"
60-
:height="(isMobileViewport) ? '225px' : '525px'"
60+
:height="(isMobileViewport) ? 225 : 525"
6161
/>
6262

6363
<span v-else>{{ $t('app.bedmesh.msg.not_loaded') }}</span>

src/components/widgets/bedmesh/BedMeshChart.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<template>
22
<div
33
class="chart"
4-
:style="{ 'height': height }"
4+
:style="{
5+
height: $filters.getPixelsString(height)
6+
}"
57
>
68
<e-chart
79
ref="chart"
@@ -35,8 +37,8 @@ export default class BedMeshChart extends Mixins(BrowserMixin) {
3537
@Prop({ type: Object, default: () => {} })
3638
readonly options!: Record<string, unknown>
3739
38-
@Prop({ type: String, default: '100%' })
39-
readonly height!: string
40+
@Prop({ type: [String, Number], default: '100%' })
41+
readonly height!: string | number
4042
4143
@Ref('chart')
4244
readonly chart!: ECharts

src/components/widgets/filesystem/FileSystem.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ export default class FileSystem extends Mixins(StateMixin, FilesMixin, ServicesM
487487
text: '',
488488
value: 'data-table-icons',
489489
sortable: false,
490-
width: this.dense ? '28px' : '56px'
490+
width: this.dense ? 28 : 56
491491
},
492492
{
493493
text: this.$tc('app.general.table.header.name'),

src/components/widgets/history/JobHistory.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ export default class JobHistory extends Mixins(FilesMixin) {
369369
text: '',
370370
value: 'data-table-icons',
371371
sortable: false,
372-
width: '24px'
372+
width: 24
373373
},
374374
{
375375
text: this.$tc('app.general.table.header.name'),

src/components/widgets/job-queue/JobQueue.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,13 @@ export default class JobQueue extends Vue {
134134
text: '',
135135
value: 'handle',
136136
sortable: false,
137-
width: '24px'
137+
width: 24
138138
},
139139
{
140140
text: '',
141141
value: 'data-table-icons',
142142
sortable: false,
143-
width: this.dense ? '28px' : '56px'
143+
width: this.dense ? 28 : 56
144144
},
145145
{
146146
text: this.$tc('app.general.table.header.name'),

src/components/widgets/spoolman/SpoolmanCard.vue

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
>
88
<template #menu>
99
<app-btn
10-
v-if="!targetableMacros.length"
10+
v-if="!klippyReady || !targetableMacros.length"
1111
small
1212
class="me-1 my-1"
1313
:disabled="!isConnected"
@@ -42,6 +42,7 @@
4242
</v-icon>
4343
</app-btn>
4444
</template>
45+
4546
<v-list dense>
4647
<v-list-item @click="handleSelectSpool">
4748
<v-list-item-content>
@@ -109,7 +110,7 @@
109110
<status-label
110111
:key="`spoolman-card-${field}`"
111112
:label="$t(`app.spoolman.label.${field}`)"
112-
:label-width="labelWidth"
113+
:label-width="86"
113114
>
114115
<template v-if="field === 'remaining_weight'">
115116
<span v-if="remainingFilamentUnit === 'weight'">
@@ -162,21 +163,21 @@
162163
<v-icon
163164
v-if="activeSpool"
164165
:color="getSpoolColor(activeSpool)"
165-
size="110px"
166+
size="110"
166167
class="spool-icon"
167168
>
168169
$filament
169170
</v-icon>
170171
<v-icon
171172
v-else-if="isConnected"
172-
size="55px"
173+
size="55"
173174
>
174175
$progressQuestion
175176
</v-icon>
176177
<v-icon
177178
v-else
178179
color="warning"
179-
size="55px"
180+
size="55"
180181
>
181182
$warning
182183
</v-icon>
@@ -204,8 +205,6 @@ type MacroWithSpoolId = Macro & {
204205
components: { StatusLabel }
205206
})
206207
export default class SpoolmanCard extends Mixins(StateMixin) {
207-
labelWidth = '86px'
208-
209208
handleSelectSpool (targetMacro?: Macro) {
210209
this.$typedCommit('spoolman/setDialogState', {
211210
show: true,

src/components/widgets/status/ReprintTab.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export default class ReprintTab extends Mixins(StateMixin, FilesMixin) {
111111
112112
get headers () {
113113
const headers = [
114-
{ text: '', value: 'data-table-icons', sortable: false, width: '24px' },
114+
{ text: '', value: 'data-table-icons', sortable: false, width: 24 },
115115
{ text: this.$tc('app.general.table.header.name'), value: 'filename', sortable: false },
116116
{ text: this.$tc('app.general.table.header.status'), value: 'status', sortable: false },
117117
{ text: this.$tc('app.general.table.header.print_duration'), value: 'print_duration', sortable: false }

src/components/widgets/status/StatusLabel.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
<v-layout align-center>
33
<span
44
class="label body-2 secondary--text"
5-
:style="`width: ${labelWidth}; min-width: ${labelWidth};`"
5+
:style="{
6+
width: $filters.getPixelsString(labelWidth),
7+
'min-width': $filters.getPixelsString(labelWidth)
8+
}"
69
v-html="label"
710
/>
811
<span class="value"><slot /></span>
@@ -22,7 +25,7 @@ export default class AppSwitch extends Mixins(StateMixin) {
2225
@Prop({ type: String, required: true })
2326
readonly label!: string
2427
25-
@Prop({ type: [String, Number], default: '70px' })
28+
@Prop({ type: [String, Number], default: 70 })
2629
readonly labelWidth!: string | number
2730
}
2831
</script>

src/components/widgets/thermals/TemperatureCard.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102

103103
<thermal-chart
104104
ref="thermalchart"
105-
:height="(isMobileViewport) ? '180px' : '260px'"
105+
:height="(isMobileViewport) ? 180 : 260"
106106
/>
107107
</template>
108108
</collapsable-card>

src/components/widgets/thermals/ThermalChart.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<template>
22
<div
33
class="chart"
4-
:style="{ 'height': height }"
4+
:style="{
5+
height: $filters.getPixelsString(height)
6+
}"
57
>
68
<e-chart
79
ref="chart"
@@ -26,8 +28,8 @@ import type { ChartData, ChartSelectedLegends } from '@/store/charts/types'
2628
2729
@Component({})
2830
export default class ThermalChart extends Mixins(BrowserMixin) {
29-
@Prop({ type: String, default: '100%' })
30-
readonly height!: string
31+
@Prop({ type: [String, Number], default: '100%' })
32+
readonly height!: string | number
3133
3234
@Ref('chart')
3335
readonly chart!: ECharts

0 commit comments

Comments
 (0)