Merge pull request #169 from ajnart/qol

🚸 Improve UX and QoL
This commit is contained in:
Thomas Camlong
2022-06-03 13:55:29 +02:00
committed by GitHub
14 changed files with 50 additions and 29 deletions

View File

@@ -256,14 +256,14 @@ export function AddAppShelfItemForm(props: { setOpened: (b: boolean) => void } &
color: 'gray', color: 'gray',
}} }}
> >
tip: Get your API key{' '} Tip: Get your API key{' '}
<Anchor <Anchor
target="_blank" target="_blank"
weight="bold" weight="bold"
style={{ fontStyle: 'inherit', fontSize: 'inherit' }} style={{ fontStyle: 'inherit', fontSize: 'inherit' }}
href={`${hostname}/settings/general`} href={`${hostname}/settings/general`}
> >
here here.
</Anchor> </Anchor>
</Text> </Text>
</> </>

View File

@@ -91,11 +91,11 @@ export function AppShelfItem(props: any) {
> >
<motion.i <motion.i
whileHover={{ whileHover={{
cursor: 'pointer',
scale: 1.1, scale: 1.1,
}} }}
> >
<Image <Image
styles={{ root: { cursor: 'pointer' } }}
width={80} width={80}
height={80} height={80}
src={service.icon} src={service.icon}

View File

@@ -66,7 +66,7 @@ export default function AppShelfMenu(props: any) {
autoClose: 5000, autoClose: 5000,
title: ( title: (
<Text> <Text>
Service <b>{service.name}</b> removed successfully Service <b>{service.name}</b> removed successfully!
</Text> </Text>
), ),
color: 'green', color: 'green',

View File

@@ -60,7 +60,7 @@ export default function SaveConfigComponent(props: any) {
</form> </form>
</Modal> </Modal>
<Button leftIcon={<Download />} variant="outline" onClick={onClick}> <Button leftIcon={<Download />} variant="outline" onClick={onClick}>
Download your config Download config
</Button> </Button>
<Button <Button
leftIcon={<Trash />} leftIcon={<Trash />}
@@ -91,10 +91,10 @@ export default function SaveConfigComponent(props: any) {
setConfig({ ...config, name: 'default' }); setConfig({ ...config, name: 'default' });
}} }}
> >
Delete current config Delete config
</Button> </Button>
<Button leftIcon={<Plus />} variant="outline" onClick={() => setOpened(true)}> <Button leftIcon={<Plus />} variant="outline" onClick={() => setOpened(true)}>
Save a copy of your config Save a copy
</Button> </Button>
</Group> </Group>
); );

View File

@@ -12,7 +12,7 @@ export default function ModuleEnabler(props: any) {
key={module.title} key={module.title}
size="md" size="md"
checked={config.modules?.[module.title]?.enabled ?? false} checked={config.modules?.[module.title]?.enabled ?? false}
label={`Enable ${module.title} module`} label={`Enable ${module.title}`}
onChange={(e) => { onChange={(e) => {
setConfig({ setConfig({
...config, ...config,

View File

@@ -92,7 +92,7 @@ function SettingsMenu(props: any) {
color: 'gray', color: 'gray',
}} }}
> >
tip: You can upload your config file by dragging and dropping it onto the page Tip: You can upload your config file by dragging and dropping it onto the page!
</Text> </Text>
<Group position="center" direction="row" mr="xs"> <Group position="center" direction="row" mr="xs">
<Group spacing={0}> <Group spacing={0}>

View File

@@ -2,6 +2,7 @@ import React, { useEffect } from 'react';
import { createStyles, Footer as FooterComponent } from '@mantine/core'; import { createStyles, Footer as FooterComponent } from '@mantine/core';
import { showNotification } from '@mantine/notifications'; import { showNotification } from '@mantine/notifications';
import { CURRENT_VERSION, REPO_URL } from '../../../data/constants'; import { CURRENT_VERSION, REPO_URL } from '../../../data/constants';
import { IconAlertCircle as AlertCircle } from '@tabler/icons';
const useStyles = createStyles((theme) => ({ const useStyles = createStyles((theme) => ({
footer: { footer: {
@@ -38,12 +39,22 @@ export function Footer({ links }: FooterCenteredProps) {
// Fetch Data here when component first mounted // Fetch Data here when component first mounted
fetch(`https://api.github.com/repos/${REPO_URL}/releases/latest`).then((res) => { fetch(`https://api.github.com/repos/${REPO_URL}/releases/latest`).then((res) => {
res.json().then((data) => { res.json().then((data) => {
if (data.tag_name !== CURRENT_VERSION) { if (data.tag_name >= CURRENT_VERSION) {
showNotification({ showNotification({
color: 'yellow', color: 'yellow',
autoClose: false, autoClose: false,
title: 'New version available', title: 'New version available',
message: `Version ${data.tag_name} is available, update now! 😡`, icon: <AlertCircle />,
message: `Version ${data.tag_name} is available, update now!`,
});
} else if (data.tag_name <= CURRENT_VERSION) {
showNotification({
color: 'orange',
autoClose: 5000,
title: 'You are using a development version',
icon: <AlertCircle />,
loading: true,
message: 'This version of Homarr is still in development! Bugs are expected 🐛',
}); });
} }
}); });

View File

@@ -13,11 +13,11 @@ export function Logo({ style }: any) {
}} }}
/> />
<NextLink <NextLink
href="/"
style={{ style={{
textDecoration: 'none', textDecoration: 'none',
position: 'relative', position: 'relative',
}} }}
href="/"
> >
<Text <Text
sx={style} sx={style}

View File

@@ -1,13 +1,4 @@
import { import { Table, Text, Tooltip, Title, Group, Progress, Skeleton, ScrollArea } from '@mantine/core';
Table,
Text,
Tooltip,
Title,
Group,
Progress,
Skeleton,
ScrollArea,
} from '@mantine/core';
import { IconDownload as Download } from '@tabler/icons'; import { IconDownload as Download } from '@tabler/icons';
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import axios from 'axios'; import axios from 'axios';
@@ -63,9 +54,9 @@ export default function DownloadComponent() {
if (!qBittorrentService && !delugeService) { if (!qBittorrentService && !delugeService) {
return ( return (
<Group direction="column"> <Group direction="column">
<Title>Critical: No qBittorrent/Deluge instance found in services.</Title> <Title order={3}>No supported download clients found!</Title>
<Group> <Group>
<Title order={3}>Add a qBittorrent/Deluge service to view current downloads</Title> <Text>Add a download service to view your current downloads...</Text>
<AddItemShelfButton /> <AddItemShelfButton />
</Group> </Group>
</Group> </Group>

View File

@@ -43,7 +43,7 @@ function humanFileSize(initialBytes: number, si = true, dp = 1) {
} }
export const TotalDownloadsModule: IModule = { export const TotalDownloadsModule: IModule = {
title: 'Download speed', title: 'Download Speed',
description: 'Show the current download speed of supported services', description: 'Show the current download speed of supported services',
icon: Download, icon: Download,
component: TotalDownloadsComponent, component: TotalDownloadsComponent,
@@ -104,9 +104,9 @@ export default function TotalDownloadsComponent() {
if (!qBittorrentService && !delugeService) { if (!qBittorrentService && !delugeService) {
return ( return (
<Group direction="column"> <Group direction="column">
<Title order={3}>Critical: No qBittorrent/Deluge instance found in services.</Title> <Title order={4}>No supported download clients found!</Title>
<Group noWrap> <Group noWrap>
<Title order={5}>Add a qBittorrent/Deluge service to view current downloads</Title> <Text>Add a download service to view your current downloads...</Text>
<AddItemShelfButton /> <AddItemShelfButton />
</Group> </Group>
</Group> </Group>

View File

@@ -116,7 +116,7 @@ export default function SearchBar(props: any) {
} }
> >
<Text> <Text>
tip: Use the prefixes <b>!yt</b> and <b>!t</b> in front of your query to search on YouTube Tip: Use the prefixes <b>!yt</b> and <b>!t</b> in front of your query to search on YouTube
or for a Torrent respectively. or for a Torrent respectively.
</Text> </Text>
</Popover> </Popover>

View File

@@ -9,6 +9,7 @@ import { useHotkeys } from '@mantine/hooks';
import Layout from '../components/layout/Layout'; import Layout from '../components/layout/Layout';
import { ConfigProvider } from '../tools/state'; import { ConfigProvider } from '../tools/state';
import { theme } from '../tools/theme'; import { theme } from '../tools/theme';
import { styles } from '../tools/styles';
export default function App(props: AppProps & { colorScheme: ColorScheme }) { export default function App(props: AppProps & { colorScheme: ColorScheme }) {
const { Component, pageProps } = props; const { Component, pageProps } = props;
@@ -35,6 +36,9 @@ export default function App(props: AppProps & { colorScheme: ColorScheme }) {
...theme, ...theme,
colorScheme, colorScheme,
}} }}
styles={{
...styles,
}}
withGlobalStyles withGlobalStyles
withNormalizeCSS withNormalizeCSS
> >

12
src/tools/styles.ts Normal file
View File

@@ -0,0 +1,12 @@
import { MantineProviderProps } from '@mantine/core';
export const styles: MantineProviderProps['styles'] = {
Checkbox: {
input: { cursor: 'pointer' },
label: { cursor: 'pointer' },
},
Switch: {
input: { cursor: 'pointer' },
label: { cursor: 'pointer' },
},
};

View File

@@ -1,3 +1,6 @@
import { MantineProviderProps } from '@mantine/core'; import { MantineProviderProps } from '@mantine/core';
export const theme: MantineProviderProps['theme'] = {}; export const theme: MantineProviderProps['theme'] = {
primaryColor: 'red',
primaryShade: 6,
};