diff --git a/apps/desktop/src/routes/app/onboarding/index.tsx b/apps/desktop/src/routes/app/onboarding/index.tsx index 02e54989b6..186a8216ed 100644 --- a/apps/desktop/src/routes/app/onboarding/index.tsx +++ b/apps/desktop/src/routes/app/onboarding/index.tsx @@ -1,6 +1,6 @@ import { createFileRoute, useNavigate } from "@tanstack/react-router"; import type { ReactNode } from "react"; -import { useCallback } from "react"; +import { useCallback, useMemo } from "react"; import { z } from "zod"; import { commands as windowsCommands } from "@hypr/plugin-windows"; @@ -8,12 +8,13 @@ import { commands as windowsCommands } from "@hypr/plugin-windows"; import { Permissions } from "../../../components/onboarding/permissions"; import type { OnboardingNext } from "../../../components/onboarding/shared"; import { Welcome } from "../../../components/onboarding/welcome"; +import { useIsLinux } from "../../../hooks/usePlatform"; import { commands } from "../../../types/tauri.gen"; -const STEPS = ["welcome", "permissions"] as const; +const ALL_STEPS = ["welcome", "permissions"] as const; const validateSearch = z.object({ - step: z.enum(STEPS).default("welcome"), + step: z.enum(ALL_STEPS).default("welcome"), local: z.boolean().default(false), }); @@ -52,13 +53,23 @@ function useOnboarding() { const navigate = useNavigate(); const search: OnboardingSearch = Route.useSearch(); const { step, local } = search; + const isLinux = useIsLinux(); - const previous = STEPS?.[STEPS.indexOf(step) - 1] as - | (typeof STEPS)[number] - | undefined; - const next = STEPS?.[STEPS.indexOf(step) + 1] as - | (typeof STEPS)[number] - | undefined; + const steps = useMemo(() => { + if (isLinux) { + return ALL_STEPS.filter((s) => s !== "permissions"); + } + return [...ALL_STEPS]; + }, [isLinux]); + + const stepIndex = steps.indexOf(step); + + const previous = stepIndex > 0 ? steps[stepIndex - 1] : undefined; + + const next = + stepIndex >= 0 && stepIndex < steps.length - 1 + ? steps[stepIndex + 1] + : undefined; const goPrevious = useCallback(() => { if (!previous) { diff --git a/crates/audio/src/mic.rs b/crates/audio/src/mic.rs index 7de9c85fa7..85cf9045a8 100644 --- a/crates/audio/src/mic.rs +++ b/crates/audio/src/mic.rs @@ -302,5 +302,4 @@ mod tests { assert!(chunks_received > 0, "should receive at least one chunk"); assert!(total_samples > 0, "should receive samples"); } - }