Skip to content

Commit b5d01a5

Browse files
committed
tried to fix white screen
1 parent 9c3ccc5 commit b5d01a5

File tree

5 files changed

+90
-5
lines changed

5 files changed

+90
-5
lines changed

src/components/ui/badge.tsx

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import * as React from "react"
2+
import { cva, type VariantProps } from "class-variance-authority"
3+
4+
import { cn } from "@/lib/utils"
5+
6+
const badgeVariants = cva(
7+
"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
8+
{
9+
variants: {
10+
variant: {
11+
default:
12+
"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
13+
secondary:
14+
"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
15+
destructive:
16+
"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
17+
outline: "text-foreground",
18+
},
19+
},
20+
defaultVariants: {
21+
variant: "default",
22+
},
23+
}
24+
)
25+
26+
export interface BadgeProps
27+
extends React.HTMLAttributes<HTMLDivElement>,
28+
VariantProps<typeof badgeVariants> {}
29+
30+
function Badge({ className, variant, ...props }: BadgeProps) {
31+
return (
32+
<div className={cn(badgeVariants({ variant }), className)} {...props} />
33+
)
34+
}
35+
36+
export { Badge, badgeVariants }

src/lib/config/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
export const config = {
22
title: "Electron Vite",
3+
github: "https://github.com/Strahinja2112/electron-vite",
4+
portfolio: "https://strahinja.vercel.app",
35
};

src/main.ts

+14-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { app, BrowserWindow } from "electron";
22
import registerListeners from "./helpers/ipc/listeners-register";
33
// "electron-squirrel-startup" seems broken when packaging with vite
44
//import started from "electron-squirrel-startup";
5+
import { shell } from "electron";
56
import path from "path";
67

78
const inDevelopment = process.env.NODE_ENV === "development";
@@ -18,19 +19,31 @@ function createWindow() {
1819
contextIsolation: true,
1920
nodeIntegration: true,
2021
nodeIntegrationInSubFrames: false,
21-
2222
preload: preload,
2323
},
2424
titleBarStyle: "hidden",
2525
alwaysOnTop: inDevelopment,
26+
backgroundColor: "#09090b",
27+
});
28+
29+
mainWindow.webContents.setWindowOpenHandler((details) => {
30+
shell.openExternal(details.url);
31+
return {
32+
action: "deny",
33+
};
2634
});
35+
2736
registerListeners(mainWindow);
2837

2938
if (MAIN_WINDOW_VITE_DEV_SERVER_URL) {
3039
mainWindow.loadURL(MAIN_WINDOW_VITE_DEV_SERVER_URL);
3140
} else {
3241
mainWindow.loadFile(path.join(__dirname, `../renderer/${MAIN_WINDOW_VITE_NAME}/index.html`));
3342
}
43+
44+
// mainWindow.on("ready-to-show", () => {
45+
// mainWindow.show();
46+
// });
3447
}
3548

3649
app.whenReady().then(createWindow);

src/pages/home.tsx

+31-3
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,47 @@
1-
import { Button } from "@/components/ui/button";
1+
import { Badge } from "@/components/ui/badge";
2+
import { Button, buttonVariants } from "@/components/ui/button";
23
import { config } from "@/lib/config";
4+
import { ChevronRight, Code2, Github } from "lucide-react";
35
import React from "react";
46

57
export default function HomePage() {
68
return (
79
<div className="flex flex-col items-center justify-between bg-background text-foreground">
810
<main className="flex w-full flex-1 flex-col items-center justify-center px-8">
11+
<Badge className="mb-8" variant="outline">
12+
<a href={config.portfolio} target="_blank" className="flex items-center gap-2 pl-2">
13+
<span>See developer portfolio</span>
14+
<ChevronRight className="size-5" />
15+
</a>
16+
</Badge>
917
<h2 className="text-5xl font-semibold">Welcome to the Home Page</h2>
1018
<p className="mt-4 text-center text-muted-foreground">
1119
This is a template for a desktop application built with Electron, Vite, ShadCN, and
1220
Tailwind CSS.
1321
</p>
1422
<div className="mt-8 flex space-x-4">
15-
<Button>Get Started</Button>
16-
<Button variant="secondary">Learn More</Button>
23+
<a
24+
href={config.github}
25+
target="_blank"
26+
className={buttonVariants({
27+
className: "space-x-2",
28+
variant: "secondary",
29+
})}
30+
>
31+
<Github />
32+
<span>See Code</span>
33+
</a>
34+
<a
35+
href={`${config.portfolio}/project/electron-vite`}
36+
target="_blank"
37+
className={buttonVariants({
38+
className: "space-x-2",
39+
variant: "secondary",
40+
})}
41+
>
42+
<Code2 />
43+
<span>Learn More</span>
44+
</a>
1745
</div>
1846
</main>
1947
</div>

src/styles/global.css

+7-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
}
136136

137137
.dark {
138-
--background: 240 10% 3.9%;
138+
--background: 240 10% 4%;
139139
--foreground: 0 0% 98%;
140140
--card: 240 10% 3.9%;
141141
--card-foreground: 0 0% 98%;
@@ -159,6 +159,12 @@
159159
}
160160
}
161161

162+
#app,
163+
body,
164+
html {
165+
background-color: hsl(var(--background));
166+
}
167+
162168
@layer base {
163169
/* Custom Scrollbar Styles */
164170
::-webkit-scrollbar {

0 commit comments

Comments
 (0)