Skip to content

Commit bedd552

Browse files
🔨 refactor: enhance SignIn component with dynamic link generation
- Introduced `baseUrl` import from `@/utils` in `SignIn.tsx`. This change centralizes the management of base URLs, making the component more maintainable and adaptable to different environments. - Updated the "Create a free account" link to dynamically generate the URL using `baseUrl`. This ensures that the link remains accurate and functional across different deployment environments, improving the user experience.
1 parent 3e9a0db commit bedd552

1 file changed

Lines changed: 32 additions & 28 deletions

File tree

‎src/components/SignIn.tsx‎

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,46 @@
11
import screenlinkLogo from "../assets/screenlink.svg";
22
import screenlinkLogoDark from "../assets/screenlink-dark.svg";
33
import { useTheme } from "./theme-provider";
4+
import { baseUrl } from "@/utils";
45

56
export default function SignIn() {
67
const { theme } = useTheme();
78
return (
89
<div className="card items-center justify-center min-h-screen w-screen">
9-
<div className="flex min-h-full flex-1 flex-col justify-center px-6 py-12 lg:px-8">
10-
<div className="sm:mx-auto sm:w-full sm:max-w-sm">
11-
<img
12-
className="mx-auto h-10 w-auto"
13-
src={theme === "dark" ? screenlinkLogoDark : screenlinkLogo}
14-
alt="ScreenLink"
15-
/>
16-
<h2 className="mt-10 text-center text-2xl font-bold leading-9 tracking-tight text-gray-300">
17-
Login to get started
18-
</h2>
19-
</div>
20-
21-
<div className="mt-10 sm:mx-auto sm:w-full sm:max-w-sm">
22-
<div>
23-
<button
24-
type="submit"
25-
className="flex w-full justify-center rounded-md bg-indigo-600 px-3 py-1.5 text-sm font-semibold leading-6 text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
26-
onClick={() => window.electron.openNewDevice()}
27-
>
28-
Sign in on web
29-
</button>
30-
</div>
10+
<div className="flex min-h-full flex-1 flex-col justify-center px-6 py-12 lg:px-8">
11+
<div className="sm:mx-auto sm:w-full sm:max-w-sm">
12+
<img
13+
className="mx-auto h-10 w-auto"
14+
src={theme === "dark" ? screenlinkLogoDark : screenlinkLogo}
15+
alt="ScreenLink"
16+
/>
17+
<h2 className="mt-10 text-center text-2xl font-bold leading-9 tracking-tight text-gray-300">
18+
Login to get started
19+
</h2>
20+
</div>
3121

32-
<p className="mt-10 text-center text-sm text-gray-500">
33-
Don't have an account?{" "}
34-
<a className="font-semibold leading-6 text-indigo-600 hover:text-indigo-500">
35-
Create a free account
36-
</a>
37-
</p>
22+
<div className="mt-10 sm:mx-auto sm:w-full sm:max-w-sm">
23+
<div>
24+
<button
25+
type="submit"
26+
className="flex w-full justify-center rounded-md bg-indigo-600 px-3 py-1.5 text-sm font-semibold leading-6 text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
27+
onClick={() => window.electron.openNewDevice()}
28+
>
29+
Sign in on web
30+
</button>
3831
</div>
32+
33+
<p className="mt-10 text-center text-sm text-gray-500">
34+
Don't have an account?{" "}
35+
<a
36+
className="font-semibold leading-6 text-indigo-600 hover:text-indigo-500"
37+
onClick={() => window.electron.openInBrowser(`${baseUrl}/signup`)}
38+
>
39+
Create a free account
40+
</a>
41+
</p>
3942
</div>
43+
</div>
4044
</div>
4145
);
4246
}

0 commit comments

Comments
 (0)