mirror of
https://github.com/OpenSquawk/OpenSquawk
synced 2026-08-01 14:16:05 +08:00
fix(onboarding): also ask OS for X-Plane, not just 'other'
X-Plane runs on Windows/Mac/Linux same as any non-MSFS sim, so it should trigger the OS follow-up too.
This commit is contained in:
@@ -67,7 +67,7 @@
|
||||
</div>
|
||||
|
||||
<Transition name="fade-slide">
|
||||
<div v-if="answers.simulator === 'other'" class="mt-6">
|
||||
<div v-if="simulatorRequiresOs" class="mt-6">
|
||||
<p class="text-xs uppercase tracking-[0.3em] text-cyan-200/70">Which OS?</p>
|
||||
<div class="mt-3 grid grid-cols-3 gap-3">
|
||||
<button
|
||||
@@ -105,7 +105,7 @@
|
||||
<button
|
||||
type="button"
|
||||
class="btn primary mt-8"
|
||||
:disabled="!answers.simulator || (answers.simulator === 'other' && !answers.os)"
|
||||
:disabled="!answers.simulator || (simulatorRequiresOs && !answers.os)"
|
||||
@click="continueCockpit"
|
||||
>
|
||||
Continue
|
||||
@@ -298,6 +298,7 @@ import {
|
||||
MAX_FEATURE_WISHES,
|
||||
PRICING_PREFERENCE_OPTIONS,
|
||||
ONBOARDING_TOTAL_STEPS,
|
||||
SIMULATORS_REQUIRING_OS,
|
||||
createDefaultOnboardingProfile,
|
||||
} from '~~/shared/onboarding/config'
|
||||
import type { HardwareItem, NetworkExperience, PricingPreference, Simulator, ToolkitItem } from '~~/shared/onboarding/config'
|
||||
@@ -333,6 +334,7 @@ const progress = computed(() => {
|
||||
})
|
||||
|
||||
const simulatorLabel = computed(() => SIMULATOR_OPTIONS.find(o => o.value === answers.simulator)?.label || '')
|
||||
const simulatorRequiresOs = computed(() => Boolean(answers.simulator && (SIMULATORS_REQUIRING_OS as string[]).includes(answers.simulator)))
|
||||
const toolkitLabels = computed(() => TOOLKIT_OPTIONS.filter(o => answers.toolkit.includes(o.value)).map(o => o.label))
|
||||
|
||||
function toggleInArray<T>(arr: T[], value: T) {
|
||||
@@ -372,7 +374,7 @@ function continueCockpit() {
|
||||
simulator: answers.simulator,
|
||||
hardware: answers.hardware,
|
||||
}
|
||||
if (answers.simulator === 'other') {
|
||||
if (simulatorRequiresOs.value) {
|
||||
payload.os = answers.os
|
||||
}
|
||||
saveAnswer(payload)
|
||||
|
||||
@@ -13,9 +13,11 @@ describe('sanitizeOnboardingUpdate', () => {
|
||||
assert.equal('simulator' in result, false)
|
||||
})
|
||||
|
||||
it('only keeps os when simulator is other', () => {
|
||||
it('keeps os for non-Windows-only simulators (other, xplane12)', () => {
|
||||
const withOther = sanitizeOnboardingUpdate({ simulator: 'other', os: 'linux' })
|
||||
assert.equal(withOther.os, 'linux')
|
||||
const withXplane = sanitizeOnboardingUpdate({ simulator: 'xplane12', os: 'mac' })
|
||||
assert.equal(withXplane.os, 'mac')
|
||||
const withMsfs = sanitizeOnboardingUpdate({ simulator: 'msfs2024', os: 'linux' })
|
||||
assert.equal('os' in withMsfs, false)
|
||||
})
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
SIMULATOR_OPTIONS, OS_OPTIONS, HARDWARE_OPTIONS, RADIO_PAIN_POINT_OPTIONS,
|
||||
NETWORK_OPTIONS, TOOLKIT_OPTIONS, PAID_TOOLKIT_VALUES, TOOLKIT_DURATION_OPTIONS,
|
||||
FEATURE_WISH_OPTIONS, PRICING_PREFERENCE_OPTIONS, MAX_FEATURE_WISHES,
|
||||
FEATURE_WISH_OPTIONS, PRICING_PREFERENCE_OPTIONS, MAX_FEATURE_WISHES, SIMULATORS_REQUIRING_OS,
|
||||
} from '~~/shared/onboarding/config'
|
||||
import type {
|
||||
FeatureWish, HardwareItem, NetworkExperience, OperatingSystem, PricingPreference,
|
||||
@@ -54,7 +54,7 @@ export interface SanitizedOnboardingUpdate {
|
||||
skipped?: boolean
|
||||
}
|
||||
|
||||
/** WHY: os is only meaningful when simulator === 'other' — MSFS/X-Plane imply Windows/cross-platform already. */
|
||||
/** WHY: os is only meaningful for non-Windows-only sims (X-Plane, Other) — MSFS implies Windows already. */
|
||||
export function sanitizeOnboardingUpdate(body: OnboardingUpdateInput): SanitizedOnboardingUpdate {
|
||||
const result: SanitizedOnboardingUpdate = {}
|
||||
|
||||
@@ -62,7 +62,12 @@ export function sanitizeOnboardingUpdate(body: OnboardingUpdateInput): Sanitized
|
||||
result.simulator = body.simulator as Simulator
|
||||
}
|
||||
|
||||
if (result.simulator === 'other' && typeof body.os === 'string' && OS_VALUES.has(body.os as OperatingSystem)) {
|
||||
if (
|
||||
result.simulator &&
|
||||
(SIMULATORS_REQUIRING_OS as Simulator[]).includes(result.simulator) &&
|
||||
typeof body.os === 'string' &&
|
||||
OS_VALUES.has(body.os as OperatingSystem)
|
||||
) {
|
||||
result.os = body.os as OperatingSystem
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,9 @@ export const OS_OPTIONS: OnboardingOption<OperatingSystem>[] = [
|
||||
{ value: 'linux', label: 'Linux', icon: 'mdi-linux' },
|
||||
]
|
||||
|
||||
/** Simulators that aren't Windows-only — asking OS here tells us real platform reach. */
|
||||
export const SIMULATORS_REQUIRING_OS: Simulator[] = ['xplane12', 'other']
|
||||
|
||||
export const HARDWARE_OPTIONS: OnboardingOption<HardwareItem>[] = [
|
||||
{ value: 'keyboard_mouse', label: 'Keyboard & mouse', icon: 'mdi-keyboard-outline' },
|
||||
{ value: 'hotas', label: 'HOTAS / joystick', icon: 'mdi-controller-classic-outline' },
|
||||
|
||||
Reference in New Issue
Block a user