Skip to content

Commit 9089845

Browse files
committed
formatting
1 parent 5fdaa26 commit 9089845

File tree

63 files changed

+3649
-2427
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+3649
-2427
lines changed

apps/desktop/src/components/onboarding/calendar.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,10 @@ import { Icon } from "@iconify-icon/react";
22
import { platform } from "@tauri-apps/plugin-os";
33

44
import { useAuth } from "../../auth";
5-
import type { OnboardingStepId } from "./config";
5+
import { getNextAfterConfigureNotice, type StepProps } from "./config";
66
import { Divider, IntegrationRow, OnboardingContainer } from "./shared";
77

8-
export function Calendars({
9-
onNavigate,
10-
}: {
11-
onNavigate: (step: OnboardingStepId | "done") => void;
12-
}) {
8+
export function Calendars({ onNavigate }: StepProps) {
139
const auth = useAuth();
1410
const currentPlatform = platform();
1511
const isLoggedIn = !!auth?.session;
@@ -55,9 +51,7 @@ export function Calendars({
5551
</div>
5652

5753
<button
58-
onClick={() =>
59-
onNavigate(currentPlatform === "macos" ? "permissions" : "done")
60-
}
54+
onClick={() => onNavigate(getNextAfterConfigureNotice(currentPlatform))}
6155
className="mt-4 text-sm text-neutral-400 transition-colors hover:text-neutral-600"
6256
>
6357
skip

apps/desktop/src/components/onboarding/config.tsx

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,29 @@ export type OnboardingStepId =
1111
| "configure-notice"
1212
| "permissions";
1313

14+
export type StepProps = {
15+
onNavigate: (step: OnboardingStepId | "done") => void;
16+
};
17+
18+
export function getNextAfterLogin(
19+
platform: string,
20+
isPro: boolean,
21+
): OnboardingStepId | "done" {
22+
if (!isPro) {
23+
return "configure-notice";
24+
}
25+
return platform === "macos" ? "permissions" : "done";
26+
}
27+
28+
export function getNextAfterConfigureNotice(
29+
platform: string,
30+
): OnboardingStepId | "done" {
31+
return platform === "macos" ? "permissions" : "done";
32+
}
33+
1434
type StepConfig = {
1535
id: OnboardingStepId;
16-
component: ComponentType<{
17-
onNavigate: (step: OnboardingStepId | "done") => void;
18-
}>;
36+
component: ComponentType<StepProps>;
1937
};
2038

2139
export const STEP_CONFIGS: StepConfig[] = [

apps/desktop/src/components/onboarding/configure-notice.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
import { platform } from "@tauri-apps/plugin-os";
22

3-
import type { OnboardingStepId } from "./config";
3+
import { getNextAfterConfigureNotice, type StepProps } from "./config";
44
import { OnboardingContainer } from "./shared";
55

6-
export function ConfigureNotice({
7-
onNavigate,
8-
}: {
9-
onNavigate: (step: OnboardingStepId | "done") => void;
10-
}) {
6+
export function ConfigureNotice({ onNavigate }: StepProps) {
117
const currentPlatform = platform();
128

139
return (
@@ -30,7 +26,7 @@ export function ConfigureNotice({
3026
<div className="flex flex-col gap-3 mt-4">
3127
<button
3228
onClick={() =>
33-
onNavigate(currentPlatform === "macos" ? "permissions" : "done")
29+
onNavigate(getNextAfterConfigureNotice(currentPlatform))
3430
}
3531
className="w-full py-3 rounded-full bg-gradient-to-t from-stone-600 to-stone-500 text-white text-sm font-medium duration-150 hover:scale-[1.01] active:scale-[0.99]"
3632
>

apps/desktop/src/components/onboarding/login.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,10 @@ import { useAuth } from "../../auth";
99
import { getEntitlementsFromToken } from "../../billing";
1010
import { env } from "../../env";
1111
import * as settings from "../../store/tinybase/settings";
12-
import type { OnboardingStepId } from "./config";
12+
import { getNextAfterLogin, type StepProps } from "./config";
1313
import { Divider, OnboardingContainer } from "./shared";
1414

15-
export function Login({
16-
onNavigate,
17-
}: {
18-
onNavigate: (step: OnboardingStepId | "done") => void;
19-
}) {
15+
export function Login({ onNavigate }: StepProps) {
2016
const auth = useAuth();
2117
const currentPlatform = platform();
2218
const [callbackUrl, setCallbackUrl] = useState("");
@@ -79,10 +75,8 @@ export function Login({
7975
onSuccess: (isPro) => {
8076
if (isPro) {
8177
setTrialDefaults();
82-
onNavigate(currentPlatform === "macos" ? "permissions" : "done");
83-
} else {
84-
onNavigate("configure-notice");
8578
}
79+
onNavigate(getNextAfterLogin(currentPlatform, isPro));
8680
},
8781
onError: (e) => {
8882
console.error(e);

apps/desktop/src/components/onboarding/permissions.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { cn } from "@hypr/utils";
44

55
import { useAuth } from "../../auth";
66
import { usePermissions } from "../../hooks/use-permissions";
7-
import type { OnboardingStepId } from "./config";
7+
import type { StepProps } from "./config";
88
import { OnboardingContainer } from "./shared";
99

1010
function PermissionBlock({
@@ -71,11 +71,7 @@ function PermissionBlock({
7171
);
7272
}
7373

74-
export function Permissions({
75-
onNavigate,
76-
}: {
77-
onNavigate: (step: OnboardingStepId | "done") => void;
78-
}) {
74+
export function Permissions({ onNavigate }: StepProps) {
7975
const auth = useAuth();
8076
const {
8177
micPermissionStatus,

apps/desktop/src/components/onboarding/welcome.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,9 @@ import { arch, platform } from "@tauri-apps/plugin-os";
33

44
import { TextAnimate } from "@hypr/ui/components/ui/text-animate";
55

6-
import type { OnboardingStepId } from "./config";
6+
import type { StepProps } from "./config";
77

8-
export function Welcome({
9-
onNavigate,
10-
}: {
11-
onNavigate: (step: OnboardingStepId | "done") => void;
12-
}) {
8+
export function Welcome({ onNavigate }: StepProps) {
139
const currentPlatform = platform();
1410
const archQuery = useQuery({
1511
queryKey: ["arch"],

0 commit comments

Comments
 (0)