Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 20 additions & 9 deletions apps/desktop/src/routes/app/onboarding/index.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
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";

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),
});

Expand Down Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion crates/audio/src/mic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,5 +302,4 @@ mod tests {
assert!(chunks_received > 0, "should receive at least one chunk");
assert!(total_samples > 0, "should receive samples");
}

}