Skip to content

Commit

Permalink
Use intern Vue capitalize method when possible
Browse files Browse the repository at this point in the history
Much more readable.
  • Loading branch information
rafaellehmkuhl committed Nov 8, 2023
1 parent 137e89c commit 22ea103
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/stores/mainVehicle.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useStorage, useTimestamp } from '@vueuse/core'
import { defineStore } from 'pinia'
import { computed, onBeforeUnmount, reactive, ref, watch } from 'vue'
import { capitalize, computed, onBeforeUnmount, reactive, ref, watch } from 'vue'

import { defaultGlobalAddress } from '@/assets/defaults'
import * as Connection from '@/libs/connection/connection'
Expand Down Expand Up @@ -428,7 +428,7 @@ export const useMainVehicleStore = defineStore('main-vehicle', () => {
// @ts-ignore: This type is huge. Needs refactoring typing here.
Object.entries(parametersTable['BTN0_FUNCTION']['Values']).forEach((param) => {
const rawText = param[1] as string
const formatedText = (rawText.charAt(0).toUpperCase() + rawText.slice(1)).replace(new RegExp('_', 'g'), ' ')
const formatedText = capitalize(rawText).replace(new RegExp('_', 'g'), ' ')
buttonParameterTable.push({ title: formatedText as string, value: Number(param[0]) })
})
Object.entries(currentParameters).forEach((param) => {
Expand Down
8 changes: 3 additions & 5 deletions src/views/ConfigurationAlertsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
<span class="text-sm font-medium text-slate-500">Enable voice on specific alert levels:</span>
<div class="flex items-center justify-start">
<div v-for="enabledLevel in alertStore.enabledAlertLevels" :key="enabledLevel.level" class="mx-2">
<v-switch
v-model="enabledLevel.enabled"
:label="enabledLevel.level.charAt(0).toUpperCase() + enabledLevel.level.slice(1)"
class="text-slate-800"
/>
<v-switch v-model="enabledLevel.enabled" :label="capitalize(enabledLevel.level)" class="text-slate-800" />
</div>
</div>
<span class="text-sm font-medium text-slate-500">Alert voice:</span>
Expand All @@ -26,6 +22,8 @@
</template>

<script setup lang="ts">
import { capitalize } from 'vue'
import Dropdown from '@/components/Dropdown.vue'
import { useAlertStore } from '@/stores/alert'
Expand Down

0 comments on commit 22ea103

Please sign in to comment.