Skip to content

Commit cadd849

Browse files
🌙 feat: Implement comprehensive dark mode support across the application
This update introduces a major feature: dark mode support throughout the application. It includes updates in various components such as `AudioSources`, `CameraSources`, `Loading`, `NavBar`, and more, to ensure a consistent dark theme. Additionally, the commit includes other refinements such as updating the `package.json` version, adding new SVG assets, and improving user interface elements to enhance the overall user experience. This significant enhancement aims to provide a more comfortable and customizable visual experience for users preferring dark mode.
1 parent 397bd84 commit cadd849

17 files changed

Lines changed: 199 additions & 43 deletions

‎electron/main.ts‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ const deviceCodeFilePath = path.join(sessionDataPath, 'deviceCode.txt');
1818
const userAccountFilePath = path.join(sessionDataPath, 'userAccount.txt');
1919
const userPreferencesFilePath = path.join(sessionDataPath, 'userPreferences.txt');
2020

21-
2221
autoUpdater.logger = logger
2322
Sentry.init({
2423
dsn: 'https://d9c49d59e5554239ac977e3a7c409cda@glitchtip.dermot.email/2'
@@ -132,7 +131,7 @@ ipcMain.handle('get-desktop-capturer-sources', async () => {
132131
if (!sourceMatched) return;
133132
const sourceThumbnail = sourceMatched?.thumbnail.toDataURL() ?? '';
134133
const sourceId = sourceMatched?.id ?? '';
135-
if (!sourceThumbnail || !sourceId || !window.ownerName) return;
134+
if (!sourceThumbnail || !sourceId || !window.ownerName || window.ownerName === 'ScreenLink') return;
136135

137136
return {
138137
id: sourceId,
@@ -142,7 +141,7 @@ ipcMain.handle('get-desktop-capturer-sources', async () => {
142141
height: window.height,
143142
},
144143
...window,
145-
name: `[${window.ownerName}] - ${window.name}`,
144+
name: window.name,
146145
applicationName: window.ownerName,
147146
};
148147
}).filter(source => source !== undefined); // Filter out undefined entries
@@ -400,8 +399,6 @@ ipcMain.handle('upload-video', async (_, uploadFile, uploadLink: string) => {
400399

401400
// When the upload is complete, send a message to the renderer process to update the UI
402401
mainWindow?.webContents.send('set-window', 'main');
403-
webcamWindow?.hide();
404-
floatingWindow?.hide();
405402

406403
}).catch((err) => {
407404
console.log(JSON.stringify({ e: "failed to upload video", err, uploadLink }))
@@ -468,6 +465,8 @@ const toggleCameraWindow = (show: boolean) => {
468465

469466
const verifyDeviceCode = async (deviceCode: string) => {
470467
try {
468+
if (!deviceCode || deviceCode === "{}") return null;
469+
471470
const url = `${baseUrl}/api/devices/verify`;
472471
const response = await axios.post(url, { deviceCode });
473472
if (response.status !== 200) {

‎package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "screenlink-desktop",
33
"private": true,
4-
"version": "0.0.5",
4+
"version": "0.0.6",
55
"author": "Screenlink",
66
"description": "Screenlink Desktop",
77
"scripts": {
@@ -22,6 +22,7 @@
2222
"@radix-ui/react-dialog": "^1.0.5",
2323
"@radix-ui/react-dropdown-menu": "^2.0.6",
2424
"@radix-ui/react-label": "^2.0.2",
25+
"@radix-ui/react-progress": "^1.0.3",
2526
"@radix-ui/react-slot": "^1.0.2",
2627
"@radix-ui/react-switch": "^1.0.3",
2728
"@sentry/electron": "^4.15.1",

‎src/App.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ function App() {
6161
email: account?.user?.email,
6262
name: account?.user?.name,
6363
id: account?.id,
64-
6564
});
6665
};
6766
getAccount();
@@ -176,8 +175,9 @@ function App() {
176175
/>
177176
</div>
178177
<p className="read-the-docs mb-4">
179-
Screenlink is an open-source video capture tool that lets you record
180-
your screen and camera to share your ideas with your anyone.
178+
Screenlink is an open-source Loom alternative. Easily record your
179+
screen, camera, and microphone; then get an instant shareable link for
180+
your recording.
181181
</p>
182182
</>
183183
);
Lines changed: 1 addition & 0 deletions
Loading

‎src/assets/screenlink.png‎

25.4 KB
Loading

‎src/components/AudioSources.tsx‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ export default function AudioSources({
3333
return (
3434
<Menu as="div" className="relative inline-block text-left">
3535
<div>
36-
<Menu.Button className="inline-flex w-full justify-between rounded-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50">
36+
<Menu.Button className="inline-flex w-full justify-between rounded-md bg-white dark:bg-gray-800 px-3 py-2 text-sm font-semibold text-gray-900 dark:text-white shadow-sm ring-1 ring-inset ring-gray-300 dark:ring-gray-600 hover:bg-gray-50 dark:hover:bg-gray-700">
3737
<span className="h-5 w-5 opacity-0 pointer-events-none">
3838
<ChevronDown />
3939
</span>
4040
<span className="text-center flex-grow">
4141
{audioSource ? audioSource.label : "Select Audio"}
4242
</span>
43-
<ChevronDown className="h-5 w-5 text-gray-400" />
43+
<ChevronDown className="h-5 w-5 text-gray-400 dark:text-gray-200" />
4444
</Menu.Button>
4545
</div>
4646

@@ -53,20 +53,20 @@ export default function AudioSources({
5353
leaveFrom="transform opacity-100 scale-100"
5454
leaveTo="transform opacity-0 scale-95"
5555
>
56-
<Menu.Items className="absolute right-0 z-10 mt-2 w-56 origin-top-right divide-y divide-gray-100 rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none">
56+
<Menu.Items className="absolute right-0 z-10 mt-2 w-56 origin-top-right divide-y divide-gray-100 dark:divide-gray-700 rounded-md bg-white dark:bg-gray-800 shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none">
5757
<div className="py-1">
5858
{devices.map((device) => (
5959
<Menu.Item key={device.deviceId}>
6060
{({ active }) => (
6161
<a
6262
className={`${
63-
active ? "bg-gray-100 text-gray-900" : "text-gray-700"
63+
active ? "bg-gray-100 dark:bg-gray-700 text-gray-900 dark:text-white" : "text-gray-700 dark:text-gray-200"
6464
} group flex items-center px-4 py-2 text-sm cursor-pointer`}
6565
onClick={() => setAudioSource(device)}
6666
>
6767
<span className="flex-shrink-0">
6868
<Mic
69-
className="h-5 w-5 text-gray-400 group-hover:text-gray-500"
69+
className="h-5 w-5 text-gray-400 dark:text-gray-200 group-hover:text-gray-500 dark:group-hover:text-gray-300"
7070
aria-hidden="true"
7171
/>
7272
</span>
@@ -81,16 +81,16 @@ export default function AudioSources({
8181
{({ active }) => (
8282
<a
8383
className={`${
84-
active ? "bg-gray-100 text-gray-900" : "text-gray-700"
85-
} group flex items-center px-4 py-2 text-sm`}
84+
active ? "bg-gray-100 dark:bg-gray-700 text-gray-900 dark:text-white" : "text-gray-700 dark:text-gray-200"
85+
} group flex items-center px-4 py-2 text-sm cursor-pointer`}
8686
onClick={() => {
8787
setAudioSource(null);
8888
}}
8989
id="no-camera"
9090
>
9191
<span className="flex-shrink-0">
9292
<MicOff
93-
className="h-5 w-5 text-gray-400 group-hover:text-gray-500"
93+
className="h-5 w-5 text-gray-400 dark:text-gray-200 group-hover:text-gray-500 dark:group-hover:text-gray-300"
9494
aria-hidden="true"
9595
/>
9696
</span>

‎src/components/CameraSources.tsx‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ export default function CameraSources({
3838
return (
3939
<Menu as="div" className="relative inline-block text-left">
4040
<div>
41-
<Menu.Button className="inline-flex w-full justify-between rounded-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50">
41+
<Menu.Button className="inline-flex w-full justify-between rounded-md bg-white dark:bg-gray-800 px-3 py-2 text-sm font-semibold text-gray-900 dark:text-white shadow-sm ring-1 ring-inset ring-gray-300 dark:ring-gray-600 hover:bg-gray-50 dark:hover:bg-gray-700">
4242
<span className="h-5 w-5 opacity-0 pointer-events-none">
4343
<ChevronDown />
4444
</span>
4545
<span className="text-center flex-grow">
4646
{cameraSource ? cameraSource.label : "Select Camera"}
4747
</span>
48-
<ChevronDown className="h-5 w-5 text-gray-400" />
48+
<ChevronDown className="h-5 w-5 text-gray-400 dark:text-gray-200" />
4949
</Menu.Button>
5050
</div>
5151

@@ -58,20 +58,20 @@ export default function CameraSources({
5858
leaveFrom="transform opacity-100 scale-100"
5959
leaveTo="transform opacity-0 scale-95"
6060
>
61-
<Menu.Items className="absolute right-0 z-10 mt-2 w-56 origin-top-right divide-y divide-gray-100 rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none">
61+
<Menu.Items className="absolute right-0 z-10 mt-2 w-56 origin-top-right divide-y divide-gray-100 rounded-md bg-white dark:bg-gray-800 shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none">
6262
<div className="py-1">
6363
{devices.map((device) => (
6464
<Menu.Item key={device.deviceId}>
6565
{({ active }) => (
6666
<a
6767
className={`${
68-
active ? "bg-gray-100 text-gray-900" : "text-gray-700"
68+
active ? "bg-gray-100 dark:bg-gray-700 text-gray-900 dark:text-white" : "text-gray-700 dark:text-gray-200"
6969
} group flex items-center px-4 py-2 text-sm cursor-pointer`}
7070
onClick={() => setCameraSource(device)}
7171
>
7272
<span className="flex-shrink-0">
7373
<Camera
74-
className="h-5 w-5 text-gray-400 group-hover:text-gray-500"
74+
className="h-5 w-5 text-gray-400 dark:text-gray-200 group-hover:text-gray-500 dark:group-hover:text-gray-300"
7575
aria-hidden="true"
7676
/>
7777
</span>
@@ -86,16 +86,16 @@ export default function CameraSources({
8686
{({ active }) => (
8787
<a
8888
className={`${
89-
active ? "bg-gray-100 text-gray-900" : "text-gray-700"
90-
} group flex items-center px-4 py-2 text-sm`}
89+
active ? "bg-gray-100 dark:bg-gray-700 text-gray-900 dark:text-white" : "text-gray-700 dark:text-gray-200"
90+
} group flex items-center px-4 py-2 text-sm cursor-pointer`}
9191
onClick={() => {
9292
setCameraSource(null);
9393
}}
9494
id="no-camera"
9595
>
9696
<span className="flex-shrink-0">
9797
<CameraOff
98-
className="h-5 w-5 text-gray-400 group-hover:text-gray-500"
98+
className="h-5 w-5 text-gray-400 dark:text-gray-200 group-hover:text-gray-500 dark:group-hover:text-gray-300"
9999
aria-hidden="true"
100100
/>
101101
</span>

‎src/components/Floating.tsx‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,13 @@ export const Floating = () => {
5757
let interval: NodeJS.Timeout | null = null;
5858

5959
if (isRecording) {
60-
// alert("Recording started");
6160
interval = setInterval(() => {
62-
// alert(`Timer: ${timer} seconds`);
6361
setTimer((prevTimer) => prevTimer + 1);
6462
}, 1000);
6563
} else if (!isRecording && timer !== 0) {
6664
clearInterval(interval!);
6765
}
6866

69-
// } else if (!isRecording && timer !== 0) {
70-
// clearInterval(interval!);
71-
// }
72-
7367
return () => {
7468
if (interval) {
7569
clearInterval(interval);
@@ -102,7 +96,9 @@ export const Floating = () => {
10296
<span className="flex items-center justify-center px-6 py-4 text-sm font-medium">
10397
<span
10498
className={`text-sm font-medium ${
105-
timer >= 60 * 5 ? "text-red-600 dark:text-red-400" : "text-gray-900 dark:text-gray-200"
99+
timer >= 60 * 5
100+
? "text-red-600 dark:text-red-400"
101+
: "text-gray-900 dark:text-gray-200"
106102
}`}
107103
>
108104
{timer < 60 && timer}

‎src/components/Loading.tsx‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
import screenlinkLogo from "../assets/screenlink.svg";
2+
import { useTheme } from "./theme-provider";
3+
import screenlinkLogoDark from "../assets/screenlink-dark.svg";
4+
25
export const Loading = ({
36
loadingMessage,
47
}: {
58
loadingMessage?: string | null;
69
}) => {
10+
const { theme } = useTheme();
711
return (
812
<div className="card items-center justify-center min-h-screen w-screen">
913
<div className="flex min-h-full flex-1 flex-col justify-center px-6 py-12 lg:px-8">
1014
<div className="sm:mx-auto sm:w-full sm:max-w-md">
1115
<img
1216
className="mx-auto h-16 w-auto mb-4 cursor-pointer transition-transform duration-300 ease-in-out hover:scale-110"
13-
src={screenlinkLogo}
17+
src={theme === "dark" ? screenlinkLogoDark : screenlinkLogo}
1418
alt="ScreenLink"
1519
onClick={() => {
1620
window.electron.openInBrowser("https://screenlink.io/app");

0 commit comments

Comments
 (0)