From 59198534c1f017dd1536bf8b61411c3cf680e030 Mon Sep 17 00:00:00 2001 From: Robert Kossessa Date: Sun, 4 Feb 2024 13:21:03 +0100 Subject: [PATCH] UPD: Pane switching (random for testing) --- src/App.vue | 8 +++++++- src/components/config/ConfigPane.vue | 6 ++++-- src/components/device/DevicePreview.vue | 6 ++++-- src/lang/en.json | 2 +- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/App.vue b/src/App.vue index 166e489..3451198 100644 --- a/src/App.vue +++ b/src/App.vue @@ -4,9 +4,12 @@ import DevicePreview from '@/components/device/DevicePreview.vue' import ConfigPane from '@/components/config/ConfigPane.vue' import Navbar from '@/components/Navbar.vue' import { useStore } from '@/store' +import { ref } from 'vue' const store = useStore() +const currentConfigPage = ref(0) + store.fetchProfiles() @@ -16,8 +19,11 @@ store.fetchProfiles()
- +
diff --git a/src/components/config/ConfigPane.vue b/src/components/config/ConfigPane.vue index 3f273e1..04d2c19 100644 --- a/src/components/config/ConfigPane.vue +++ b/src/components/config/ConfigPane.vue @@ -27,7 +27,6 @@ import ProfileConfig from '@/components/config/pages/ProfileConfig.vue' import MappingConfig from '@/components/config/pages/MappingConfig.vue' import HapticConfig from '@/components/config/pages/HapticConfig.vue' import { Separator } from '@/components/ui/separator' -import { ref } from 'vue' defineProps({ showTabs: { @@ -36,7 +35,10 @@ defineProps({ }, }) -const currentPage = ref(1) +const currentPage = defineModel({ + type: Number, + default: 0, +}) const configPageOptions = [ { diff --git a/src/components/device/DevicePreview.vue b/src/components/device/DevicePreview.vue index e8586f8..9097e9f 100644 --- a/src/components/device/DevicePreview.vue +++ b/src/components/device/DevicePreview.vue @@ -30,10 +30,10 @@ class="rounded-full outline-2 absolute h-[41.5%] top-[24.5%] aspect-square left-0 right-0 mx-auto transition-all" :class="{'outline outline-white': selected==='ring', 'hover:outline outline-zinc-400': selected!=='ring'}" - @click="selected='ring'" /> + @click="selected='ring'; $emit('select', selected)" /> + @select="args => {selected=args; $emit('select', selected)}" /> @@ -48,6 +48,8 @@ import DeviceLEDRing from '@/components/device/DeviceLEDRing.vue' import gsap from 'gsap' import DeviceKeys from '@/components/device/DeviceKeys.vue' +defineEmits(['select']) + const selected = ref('a') const value = ref(69) diff --git a/src/lang/en.json b/src/lang/en.json index e8e7e9c..77837b5 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -16,7 +16,7 @@ "feedback_type": { "coarse_detents": "Coarse Detents", "fine_detents": "Fine Detents", - "return_to_center": "Return to Center", + "return_to_center": "Snap to Center", "title": "Feedback Type", "viscous_rotation": "Viscous Rotation" },