Skip to content

Commit

Permalink
icons
Browse files Browse the repository at this point in the history
  • Loading branch information
lacymorrow committed Apr 3, 2024
2 parents e8b59a6 + deea775 commit 174f075
Show file tree
Hide file tree
Showing 26 changed files with 139 additions and 155 deletions.
57 changes: 0 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,63 +17,6 @@ Organize your movies by genre and sort by popularity, release date, runtime, or

Cinematic prefers filenames like `Independence Day [1996].mp4` but will happily parse torrent-style `Movies.That.Look.Like.This.2015.HDRip.XviD.XXX-XXX.AVI`.

## Features

- 💬 App and System-wide Notifications
- 🏃‍♂️ Auto Updater
- 📦 Built-in Store
- 🖱️ Context Menu
- 🌙 Dark Mode
- ❌ Error Handler
- ⌨️ Keyboard Shortcut Manager
- 📝 Logging
- 🀱 Menu Bar for macOS, Windows, and Linux
- 📂 Multi-Window
- 🖥️ System Tray

## Getting Started

```bash

# Clone this repository
git clone https://github.com/lacymorrow/electron-hotplate.git

# Go into the repository
cd electron-hotplate

# Install dependencies
yarn

# Run the app
yarn start
```

## BuiltWith

- [Electron](https://electronjs.org/)
- [React](https://reactjs.org/)
- [React Router](https://reacttraining.com/react-router/)
- [Tailwind CSS](https://tailwindcss.com/)
- [Shadcn](https://ui.shadcn.com/)
- [TypeScript](https://www.typescriptlang.org/)

## Development

### Tailwind CSS

We use Tailwind CSS for styling. See the [Tailwind CSS docs](https://tailwindcss.com/docs) for more information.

Some Tailwind plugins have been added for convenience:

- [Tailwind Animate](https://github.com/jamiebuilds/tailwindcss-animate) - `tailwindcss-animate`
- [Tailwind Container Queries](https://github.com/tailwindlabs/tailwindcss-container-queries) - `@tailwindcss/container-queries`
- Child selectors to target immediate children like `child:w-xl`
- Don't forget group selectors too: `group` (Parent) `group-hover:bg-gray-100` (Child)

### Shadcn

Shadcn is a UI component library for React. See the [Shadcn docs](https://ui.shadcn.com/) for more information.
Use `npx shadcn-ui@latest add accordion ...` to add a component to your project.

### Features

Expand Down
Binary file modified assets/icon.icns
Binary file not shown.
Binary file modified assets/icon.ico
Binary file not shown.
Binary file modified assets/icon.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 34 additions & 21 deletions assets/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/icons/tray-Template.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/icons/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/favicons/favicon.ico
Binary file not shown.
Binary file removed public/favicons/icon.icns
Binary file not shown.
Binary file removed public/favicons/icon.png
Binary file not shown.
36 changes: 0 additions & 36 deletions public/favicons/safari-pinned-tab.svg

This file was deleted.

2 changes: 1 addition & 1 deletion src/__tests__/App.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import '@testing-library/jest-dom';
import { render } from '@testing-library/react';
import App from '../renderer/App';
import App from '../renderer/components/windows/main/App';

describe('App', () => {
it('should render', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/config/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface SettingsType {
allowSounds: boolean;
allowAutoUpdate: boolean;
allowNotifications: boolean;
notifcationType: NotificationType;
notificationType: NotificationType;
showDockIcon: boolean; // macOS only
showTrayIcon: boolean;
startMinimized: boolean;
Expand Down Expand Up @@ -54,7 +54,7 @@ export const DEFAULT_SETTINGS: SettingsType = {
allowAutoUpdate: true,
allowSounds: true,
allowNotifications: true,
notifcationType: 'all',
notificationType: 'all',
showDockIcon: true,
showTrayIcon: true,
startMinimized: false,
Expand Down
5 changes: 4 additions & 1 deletion src/config/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ export const $settings = {
title: 'Settings',
description: 'Manage your account settings and application preferences',
app: {
githubUrl: 'https://github.com/lacymorrow/electron-hotplate',
githubUrl: 'https://github.com/lacymorrow/cinematic',
repo: 'lacymorrow/cinematic',
description: 'A boilerplate for Electron applications',
},
appearance: {
themeLabel: 'Theme',
Expand Down Expand Up @@ -59,6 +61,7 @@ export const $errors = {
prefix: 'Main> ',
blockedNavigation: 'Blocked navigation to: ',
invalidChannel: 'Invalid IPC channel',
github: 'Failed to fetch GitHub data',
};

export const $messages = {
Expand Down
2 changes: 1 addition & 1 deletion src/main/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const rendererNotification = (options: NotificationOptions) => {
export const notification = (options: NotificationOptions) => {
// Use either the system notification or the renderer notification
if (getSetting('allowNotifications')) {
const type = getSetting('notifcationType');
const type = getSetting('notificationType');
if (type === 'system' || type === 'all') {
mainNotification(options);
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { CustomAcceleratorsType } from '@/types/keyboard';
import { CollectionItemType } from '@/types/media';
import Store from 'electron-store';
import {
DEFAULT_KEYBINDS,
DEFAULT_SETTINGS,
SettingsType,
DEFAULT_KEYBINDS,

Check failure on line 6 in src/main/store.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

Replace `····` with `↹`

Check failure on line 6 in src/main/store.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

Replace `····` with `↹`
DEFAULT_SETTINGS,

Check failure on line 7 in src/main/store.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

Replace `····` with `↹`

Check failure on line 7 in src/main/store.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

Replace `····` with `↹`
SettingsType,

Check failure on line 8 in src/main/store.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

Replace `····` with `↹`

Check failure on line 8 in src/main/store.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

Replace `····` with `↹`
} from '../config/settings';

export interface CollectionStoreType {
Expand Down Expand Up @@ -113,7 +113,7 @@ const schema: Store.Schema<StoreType> = {
allowNotifications: {
type: 'boolean',
},
notifcationType: {
notificationType: {
type: 'string',
enum: ['system', 'app', 'all'],
},
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/child.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Layout } from '@/renderer/components/layout/Layout';
import App from '@/renderer/windows/child/ChildApp';
import App from '@/renderer/components/windows/child/ChildApp';
import { createRoot } from 'react-dom/client';

const container = document.getElementById('root') as HTMLElement;
Expand Down
19 changes: 19 additions & 0 deletions src/renderer/components/pages/ErrorPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { useRouteError } from 'react-router-dom';

export default function ErrorPage() {
const error: any = useRouteError();
console.error(error);

return (
<div
className="align-items-center bg-white d-flex flex-column flex-grow-1 justify-content-center"
id="error-page"
>
<h1 className="mt-0">Oops!</h1>
<p>Sorry, an unexpected error has occurred.</p>
<p>
<i>{error.statusText || error.message}</i>
</p>
</div>
);
}
63 changes: 48 additions & 15 deletions src/renderer/components/pages/settings/about/CardGithub.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CircleIcon, StarIcon } from '@radix-ui/react-icons';
import { CircleIcon, StarFilledIcon, StarIcon } from '@radix-ui/react-icons';

import { Button } from '@/components/ui/button';
import {
Expand All @@ -8,11 +8,35 @@ import {
CardHeader,
CardTitle,
} from '@/components/ui/card';
import { useCallback } from 'react';
import { useCallback, useEffect, useState } from 'react';

import { $settings } from '@/config/strings';
import { $errors, $settings } from '@/config/strings';

export function CardGithub() {
const [githubData, setGithubData] = useState<any>(null);

useEffect(() => {
// fetch star count
const fetchStarCount = async () => {
const response = await fetch(
`https://api.github.com/repos/${$settings.app.repo}`,
);
await response
.json()
.then((data: any) => {
setGithubData(data);
})
.catch((error) => {
window.electron.notify({
title: $errors.github,
});

console.error(error);
});
};
fetchStarCount();
}, []);

const handleClickStar = useCallback(() => {
window?.electron?.openUrl($settings.app.githubUrl);
}, []);
Expand All @@ -21,27 +45,36 @@ export function CardGithub() {
<Card>
<CardHeader className="grid grid-cols-[1fr_110px] items-start gap-4 space-y-0">
<div className="space-y-1">
<CardTitle>Electron-Hotplate</CardTitle>
<CardTitle>
{githubData?.full_name || githubData?.name || $settings.app.repo}
</CardTitle>
<CardDescription>
Beautifully designed organization for your digital media collection.
{githubData?.description || $settings.app.description}
</CardDescription>
</div>
<Button variant="secondary" onClick={handleClickStar}>
<StarIcon className="mr-2 h-4 w-4" />
<StarFilledIcon className="mr-2 h-4 w-4" />
Star
</Button>
</CardHeader>
<CardContent>
<div className="flex space-x-4 text-sm text-muted-foreground">
<div className="flex items-center">
<CircleIcon className="mr-1 h-3 w-3 fill-sky-400 text-sky-400" />
TypeScript
</div>
<div className="flex items-center">
<StarIcon className="mr-1 h-3 w-3" />
33
</div>
<div>Updated December 2024</div>
{githubData?.language && (
<div className="flex items-center">
<CircleIcon className="mr-1 h-3 w-3 fill-sky-400 text-sky-400" />
{githubData?.language || 'Unknown'}
</div>
)}
{githubData?.stargazers_count && (
<div className="flex items-center">
<StarIcon className="mr-1 h-3 w-3" />

{githubData.stargazers_count}
</div>
)}
{githubData?.updated_at && (
<div>Updated {new Date(githubData.updated_at).toDateString()}</div>
)}
</div>
</CardContent>
</Card>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function CardNotifications() {
const handleChange = (e: NotificationType | 'none') => {
setSettings({
allowNotifications: e !== 'none',
...(e !== 'none' ? { notifcationType: e } : {}),
...(e !== 'none' ? { notificationType: e } : {}),
});
};

Expand All @@ -39,7 +39,7 @@ export function CardNotifications() {
className={cn(
'-mx-2 flex items-start space-x-4 rounded-md p-2 transition-all',
settings.allowNotifications &&
settings.notifcationType === 'all' &&
settings.notificationType === 'all' &&
'bg-accent hover:text-accent-foreground',
)}
>
Expand All @@ -59,7 +59,7 @@ export function CardNotifications() {
className={cn(
'-mx-2 flex items-start space-x-4 rounded-md p-2 text-accent-foreground transition-all',
settings.allowNotifications &&
settings.notifcationType === 'system' &&
settings.notificationType === 'system' &&
'bg-accent hover:text-accent-foreground',
)}
>
Expand All @@ -79,7 +79,7 @@ export function CardNotifications() {
className={cn(
'-mx-2 flex items-start space-x-4 rounded-md p-2 text-accent-foreground transition-all',
settings.allowNotifications &&
settings.notifcationType === 'app' &&
settings.notificationType === 'app' &&
'bg-accent hover:text-accent-foreground',
)}
>
Expand Down
Loading

0 comments on commit 174f075

Please sign in to comment.