Skip to content

Commit

Permalink
minor theme fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
xgi committed Dec 5, 2024
1 parent 9d41db6 commit acb893a
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/renderer/components/about/About.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from 'react';
const { ipcRenderer } = require('electron');
import { Title, Group } from '@mantine/core';
import { Group } from '@mantine/core';
import packageJson from '../../../../package.json';
import ipcChannels from '@/common/constants/ipcChannels.json';
import { IconGitFork, IconHome, IconNotebook, IconScale } from '@tabler/icons';
Expand Down
35 changes: 35 additions & 0 deletions src/renderer/components/downloads/DeleteDownloadsModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import React from 'react';
import { Group } from '@mantine/core';
import DefaultModal from '../general/DefaultModal';
import DefaultText from '../general/DefaultText';
import DefaultButton from '../general/DefaultButton';

type Props = {
count: number;
showing: boolean;
deleteFunc: () => void;
close: () => void;
};

const DeleteDownloadsModal: React.FC<Props> = (props: Props) => {
const onDelete = () => {
props.deleteFunc();
props.close();
};

return (
<DefaultModal opened={props.showing} title="Deleting downloaded chapters" onClose={props.close}>
<DefaultText size="sm" mb="sm">
Are you sure you want to delete {props.count} downloaded chapters?
</DefaultText>
<Group justify="flex-end" mt="sm">
<DefaultButton onClick={props.close}>Cancel</DefaultButton>
<DefaultButton oc="red" onClick={onDelete}>
Delete
</DefaultButton>
</Group>
</DefaultModal>
);
};

export default DeleteDownloadsModal;
25 changes: 9 additions & 16 deletions src/renderer/components/downloads/MyDownloads.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const { ipcRenderer } = require('electron');
import { useRecoilValue } from 'recoil';
import { Accordion, Badge, Group, Stack } from '@mantine/core';
import { IconTrash } from '@tabler/icons';
import { openConfirmModal } from '@mantine/modals';
import ipcChannels from '@/common/constants/ipcChannels.json';
import library from '@/renderer/services/library';
import { customDownloadsDirState } from '@/renderer/state/settingStates';
Expand All @@ -14,13 +13,15 @@ import DefaultCheckbox from '../general/DefaultCheckbox';
import DefaultText from '../general/DefaultText';
import DefaultButton from '../general/DefaultButton';
import DefaultTitle from '../general/DefaultTitle';
import DeleteDownloadsModal from './DeleteDownloadsModal';

const defaultDownloadsDir = await ipcRenderer.invoke(ipcChannels.GET_PATH.DEFAULT_DOWNLOADS_DIR);

const MyDownloads: React.FC = () => {
const [seriesList, setSeriesList] = useState<Series[]>([]);
const [chapterLists, setChapterLists] = useState<{ [key: string]: Chapter[] }>({});
const [checkedChapters, setCheckedChapters] = useState<string[]>([]);
const [showingDeleteModal, setShowingDeleteModal] = useState(false);
const customDownloadsDir = useRecoilValue(customDownloadsDirState);

const loadDownloads = async () => {
Expand Down Expand Up @@ -71,21 +72,7 @@ const MyDownloads: React.FC = () => {
const count = new Set(checkedChapters).size;

if (count > 1) {
openConfirmModal({
title: 'Deleting downloaded chapters',
children: (
<DefaultText size="sm">
Are you sure you want to delete{' '}
<DefaultText c="teal" component="span" fw={700}>
{count}
</DefaultText>{' '}
downloaded chapters?
</DefaultText>
),
labels: { confirm: 'Delete', cancel: 'Cancel' },
confirmProps: { color: 'red' },
onConfirm: deleteChecked,
});
setShowingDeleteModal(true);
} else {
deleteChecked();
}
Expand Down Expand Up @@ -146,6 +133,12 @@ const MyDownloads: React.FC = () => {

return (
<>
<DeleteDownloadsModal
count={checkedChapters.length}
deleteFunc={deleteChecked}
showing={showingDeleteModal}
close={() => setShowingDeleteModal(false)}
/>
{renderHeader()}
{seriesList.length === 0 || Object.keys(chapterLists).length === 0 ? (
<DefaultText>
Expand Down
15 changes: 8 additions & 7 deletions src/renderer/components/library/Library.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect, useState } from 'react';
import { Series } from '@tiyo/common';
import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil';
import { ScrollArea, Text } from '@mantine/core';
import { ScrollArea } from '@mantine/core';
import LibraryControlBar from './LibraryControlBar';
import { LibrarySort, LibraryView, ProgressFilter } from '@/common/models/types';
import {
Expand All @@ -25,6 +25,7 @@ import LibraryList from './LibraryList';
import library from '@/renderer/services/library';
import EditCategoriesModal from './EditCategoriesModal';
import LibraryControlBarMultiSelect from './LibraryControlBarMultiSelect';
import DefaultText from '../general/DefaultText';

type Props = unknown;

Expand Down Expand Up @@ -128,19 +129,19 @@ const Library: React.FC<Props> = () => {

const renderEmptyMessage = () => {
return (
<Text ta="center" style={{ paddingTop: '30vh' }}>
<DefaultText ta="center" style={{ paddingTop: '30vh' }}>
Your library is empty. Install{' '}
<Text component="span" c="violet" fw={700}>
<DefaultText component="span" c="violet" fw={700}>
Plugins
</Text>{' '}
</DefaultText>{' '}
from the tab on the left,
<br />
and then go to{' '}
<Text component="span" c="teal" fw={700}>
<DefaultText component="span" c="teal" fw={700}>
Add Series
</Text>{' '}
</DefaultText>{' '}
to start building your library.
</Text>
</DefaultText>
);
};

Expand Down
6 changes: 5 additions & 1 deletion src/renderer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { MantineProvider } from '@mantine/core';
import { ErrorBoundary } from './components/general/ErrorBoundary';
import { themeState } from './state/settingStates';
import { themeProps, THEMES } from './util/themes';
import { Theme } from '@/common/models/types';

const main = document.createElement('main');
document.body.appendChild(main);
Expand All @@ -18,8 +19,11 @@ const root = createRoot(main);
function Root() {
const theme = useRecoilValue(themeState);

// TODO hack to ignore some remaning theme changes
const forceColorScheme = theme === Theme.Light ? 'light' : 'dark';

return (
<MantineProvider theme={THEMES[theme]} forceColorScheme="dark">
<MantineProvider theme={THEMES[theme]} forceColorScheme={forceColorScheme}>
<header id="titlebar">
<Titlebar />
</header>
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/services/ipc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export const createRendererIpcHandlers = () => {
Houdoku v{updateInfo.version} was released on{' '}
{new Date(updateInfo.releaseDate).toLocaleDateString()}.
</Text>
<Box bg={'dark.8'} p="xs">
<Box p="xs">
<Text size="sm">
{parse(updateInfo.releaseNotes as string, {
transform(reactNode) {
Expand Down

0 comments on commit acb893a

Please sign in to comment.