Compare commits

...

46 Commits

Author SHA1 Message Date
Thomas Camlong
5c6541e1a7 🚀 Patch v0.3.1
Patch v0.3.1
2022-05-16 23:50:54 +02:00
Bjorn L
da81783c8e 🧑‍💻 Adds release note template 2022-05-16 23:11:48 +02:00
Chris
6a90a124b3 Update docker.yml 2022-05-16 23:03:16 +02:00
Chris
bd6edbbec6 Reverting changes from c593334
Changing to back to how it was before c593334
2022-05-16 23:03:16 +02:00
Chris
53ab06f97e Update docker_dev.yml 2022-05-16 23:03:16 +02:00
Chris
6904018585 temp edit 2 2022-05-16 23:03:16 +02:00
Chris
8c14b3ccf9 temp edit to test workflow 2022-05-16 23:03:16 +02:00
Chris
8557820e6e Update docker_dev.yml 2022-05-16 23:03:16 +02:00
Walkx
3782499da5 💚 Update .github/workflows/docker_dev.yml
Co-authored-by: Thomas Camlong <49837342+ajnart@users.noreply.github.com>
2022-05-16 23:03:16 +02:00
Walkx
97ca45964a 💚 Update .github/workflows/docker_dev.yml
Co-authored-by: Thomas Camlong <49837342+ajnart@users.noreply.github.com>
2022-05-16 23:03:16 +02:00
Walkx
7fa464b38f 💚 Update .github/workflows/docker.yml
Co-authored-by: Thomas Camlong <49837342+ajnart@users.noreply.github.com>
2022-05-16 23:03:16 +02:00
Chris
fe5fa99b4a 💚 Fixed CI fail on PR from fork
Fixed CI failing when a PR is made from a fork due to user from fork not having the permission packages: write. CI will now check if it has write perms before push built docker image.
2022-05-16 23:03:16 +02:00
Chris
9bf8b337f6 test CI fix 4 2022-05-16 23:03:16 +02:00
Chris
06caa2ca5e test CI fix 3 2022-05-16 23:03:16 +02:00
Chris
1145ee39b6 test CI fix 2 2022-05-16 23:03:16 +02:00
Chris
68111616fe test CI fix 2022-05-16 23:03:16 +02:00
Chris
7662c11bb5 💚 CI won't push to docker on PRs from forks
If not from fork it still will. Since that's how it was set by ajnart.
2022-05-16 23:03:16 +02:00
Chris
1aaa575480 💚 Stop running CI when ignored files are updated
CI will now not run when some files are updated that are not related to building.
2022-05-16 23:03:16 +02:00
Chris
3529e46b11 🔥 Remove unneeded lines
Removed adduser and addgroup since they aren't needed.
2022-05-16 23:03:16 +02:00
ajnart
006b1a61bf 💄 Update styling of AppShelf 2022-05-16 23:03:16 +02:00
ajnart
f5eb36ff00 💄 Update styling of AppShelf 2022-05-16 23:03:16 +02:00
Aj - Thomas
a97c9b0c0f 💄 Update styling 2022-05-16 23:03:16 +02:00
Aj - Thomas
08daeb87bc � Header styling 2022-05-16 23:03:16 +02:00
Aj - Thomas
ebc7ba9684 � Update search bar styling 2022-05-16 23:03:16 +02:00
Aj - Thomas
8392dcef20 � Module styling 2022-05-16 23:03:16 +02:00
Aj - Thomas
20a37b678f Update header styling 2022-05-16 23:03:16 +02:00
Aj - Thomas
d3bd894c2a 🙈 Add configs to gitingore 2022-05-16 23:03:16 +02:00
Aj - Thomas
e75ff14975 🔥 Remove search bar from index 2022-05-16 23:03:16 +02:00
Aj - Thomas
ab1e2a32a0 🔥 Remove Navbar 2022-05-16 23:03:16 +02:00
Aj - Thomas
22cd5c8b93 Add search bar in top bar 2022-05-16 23:03:16 +02:00
Aj - Thomas
5c8b1c4fc4 Add all components in Aside bar 2022-05-16 23:03:16 +02:00
Aj - Thomas
a71b50e33f 📄 Documenting keybinds for theme switch 2022-05-16 23:03:16 +02:00
Aj - Thomas
d4c1148025 💄 Style the modal for adding a service 2022-05-16 23:03:16 +02:00
Aj - Thomas
0d11244506 ♻ Rework the search bar 2022-05-16 23:03:16 +02:00
Aj - Thomas
e786b1e44f ✏ Fix typos 2022-05-16 23:03:16 +02:00
Aj - Thomas
509873db55 💄 App shell styling
The modal now looks a little bit better
2022-05-16 23:03:16 +02:00
Aj - Thomas
c5178ee288 💄 Styling and responsiveness
Co-authored-by: Walkx <walkxnl@gmail.com>
2022-05-16 23:03:16 +02:00
Walkx
4045628166 🔥 Remove this random href 2022-05-16 23:03:16 +02:00
Thomas Camlong
f8b2d64a26 📝 Updates documentation
Thanks to @walkxcode
2022-05-16 22:53:36 +02:00
Walkx
62ba99f6cd 📝 Updates ToC and adds Back to Top link 2022-05-16 16:59:08 +02:00
Walkx
2fad4d06bd 📝 Adds Known Issues 2022-05-16 16:58:20 +02:00
Walkx
c9e58e17da 📝 Update Docs 2022-05-16 16:17:41 +02:00
Walkx
8e03719a51 📝 Update README.md
Co-authored-by: Thomas Camlong <49837342+ajnart@users.noreply.github.com>
2022-05-16 16:15:04 +02:00
Walkx
c4df55060b 📝 Update Docs 2022-05-16 15:43:58 +02:00
Walkx
47c636e810 📝 Updates documentation 2022-05-16 01:30:35 +02:00
Walkx
38d18fc433 🚀Change demo page link 2022-05-15 22:45:55 +02:00
20 changed files with 340 additions and 296 deletions

27
.github/release-note.md vendored Normal file
View File

@@ -0,0 +1,27 @@
## 🦞 Homarr [v0.0.0](https://github.com/ajnart/homarr/compare/v0.0.0...v0.0.0) (2022-01-01)
<!-- Small release message -->
<!-- Bigger announcement marked in bold -->
### Upgrade Steps
*Upgrading without a mounted config? Make sure to download your config from the settings first! You can add it back later by drag and dropping it into your browser.*
* `docker pull ghcr.io/ajnart/homarr:latest`
* `docker stop [container_id]`
* `docker rm [container_id]`
* `docker run --name homarr -p 7575:7575 -v /data/docker/homarr:/app/data/configs -d ghcr.io/ajnart/homarr:latest`
* *(or use our [docker_compose.yml](https://github.com/ajnart/homarr#-installation))*
### Breaking Changes
### New Features
### Bug Fixes
### UI Changes
### GitHub Changes
### Other Changes
_**Special thanks to our contributors: @ajnart, @c00ldude1oo, @walkxcode, and of course all people using our project.**_

View File

@@ -4,8 +4,12 @@ name: Master docker CI
on:
push:
branches: [master]
paths-ignore:
- '.github/**'
- '**.md'
tags:
- v*
workflow_dispatch:
env:
@@ -110,6 +114,6 @@ jobs:
with:
platforms: linux/amd64,linux/arm64,linux/arm/v7
context: .
push: ${{ github.event_name != 'pull_request' }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

View File

@@ -6,7 +6,13 @@ name: Development CI
on:
push:
branches: [dev]
paths-ignore:
- '.github/**'
- '**.md'
pull_request:
paths-ignore:
- '.github/**'
- '**.md'
workflow_dispatch:
inputs:
tags:
@@ -25,13 +31,17 @@ jobs:
yarn_install_and_build:
runs-on: ubuntu-latest
steps:
- name: Setup
uses: actions/setup-node@v3
- name: Checkout
uses: actions/checkout@v3
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Yarn cache
uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
@@ -39,6 +49,7 @@ jobs:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-
- name: Nextjs cache
uses: actions/cache@v2
with:
@@ -50,8 +61,10 @@ jobs:
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
- run: yarn install --frozen-lockfile
- run: yarn build
- name: Cache build output
uses: actions/cache@v2
id: restore-build
@@ -72,8 +85,10 @@ jobs:
packages: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/cache@v2
id: restore-build
with:
@@ -85,6 +100,7 @@ jobs:
./.next/standalone/
./packages.json
key: ${{ github.sha }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
@@ -95,11 +111,15 @@ jobs:
tags: |
type=ref,event=pr
tpye=raw,value=dev,priority=1
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
@@ -111,6 +131,6 @@ jobs:
with:
platforms: linux/amd64,linux/arm64,linux/arm/v7
context: .
push: true
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

3
.gitignore vendored
View File

@@ -35,4 +35,5 @@ yarn-error.log*
*.tsbuildinfo
# storybook
storybook-static
storybook-static
data/configs

View File

@@ -1,19 +1,13 @@
FROM node:16-alpine
WORKDIR /app
ENV NODE_ENV production
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
COPY /next.config.js ./
COPY /public ./public
COPY /package.json ./package.json
# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
# Automatically leverage output traces to reduce image size. https://nextjs.org/docs/advanced-features/output-file-tracing
COPY /.next/standalone ./
COPY /.next/static ./.next/static
EXPOSE 7575
ENV PORT 7575
VOLUME /app/data/configs
CMD ["node", "server.js"]
CMD ["node", "server.js"]

108
README.md
View File

@@ -1,5 +1,5 @@
<h3 align="center">Homarr</h3>
<br/>
<br>
<p align="center">
<a href="https://github.com/ajnart/homarr/actions/workflows/docker.yml">
<img title="Docker CI Status" src="https://github.com/ajnart/homarr/actions/workflows/docker.yml/badge.svg" alt="CI Status"></a>
@@ -9,14 +9,12 @@
<img alt="Docker Pulls" src="https://img.shields.io/docker/pulls/ajnart/homarr?label=Downloads%20"></a>
</p>
<p align="center">
<a href="">
<img align="end" width=600 src="https://user-images.githubusercontent.com/49837342/168315259-b778c816-10fe-44db-bd25-3eea6f31b233.png" />
<a/>
</p>
<p align = "center">
A homepage for <i>your</i> server.
<br/>
<a href = "https://github.com/ajnart/homarr/deployments/activity_log?environment=Production" > <strong> Demo ↗️ </strong> </a> • <a href = "#-installation" > <strong> Install ➡️ </strong> </a>
<a href = "https://homarr.netlify.app/" > <strong> Demo ↗️ </strong> </a> • <a href = "#-installation" > <strong> Install ➡️ </strong> </a>
<br />
<br />
<i>Join the discord!</i>
@@ -30,12 +28,19 @@
- [📃 Table of Contents](#-table-of-contents)
- [🚀 Getting Started](#-getting-started)
- [ About](#-about)
- [🐛 Known Issues](#-known-issues)
- [💥 Known Issues](#-known-issues)
- [⚡ Installation](#-installation)
- [Deploying from Docker Image 🐳](#deploying-from-docker-image-)
- [Building from Source 🛠️](#building-from-source-)
- [🐳 Deploying from Docker Image](#-deploying-from-docker-image)
- [🛠️ Building from Source](#%EF%B8%8F-building-from-source)
- [🔧 Configuration](#-configuration)
- [🧩 Integrations](#--integrations)
- [🧑‍🤝‍🧑 Multiple Configs](#-multiple-configs)
- [🐻 Icons](#-icons)
- [📊 Modules](#-modules)
- [🔍 Search Bar](#-search-bar)
- [💖 Contributing](#-contributing)
<!-- Getting Started -->
# 🚀 Getting Started
@@ -45,9 +50,16 @@ Homarr is a simple and lightweight homepage for your server, that helps you easi
**[⤴️ Back to Top](#-table-of-contents)**
## 💥 Known Issues
- Posters on the Calendar get blocked by adblockers. (IMDb posters)
- Editing a service creates a duplicate (#97)
- Used search engine not properly selected (#35)
**[⤴️ Back to Top](#-table-of-contents)**
## ⚡ Installation
### Deploying from Docker Image 🐳
### 🐳 Deploying from Docker Image
> Supported architectures: x86-64, ARM, ARM64
_Requirements_:
@@ -78,7 +90,7 @@ services:
***Getting EACCESS errors in the logs? Try running `sudo chmod 775 /directory-you-mounted-to`!***
### Building from Source 🛠️
### 🛠️ Building from Source
_Requirements_:
- [Git](https://git-scm.com/downloads)
@@ -93,6 +105,84 @@ _Requirements_:
- Start the NextJS web server: ``yarn start``
- *Note: If you want to update the code in real time, launch with ``yarn dev``*
## 🔧 Configuration
### 🧩 Integrations
Homarr natively integrates with your services. Here is a list of all supported services.
**Emby**
*The Emby integration is still in development.*
**Lidarr**
*The Lidarr integration is still in development.*
**Sonarr**
*Sonarr needs an API key.*<br>
Make a new API key in `Advanced > Security > Create new API key`<br>
**Current integration:** Upcoming media is displayed in the **Calendar** module.
**Plex**
*The Plex integration is still in development.*
**Radarr**
*Radarr needs an API key.*<br>
Make a new API key in `Advanced > Security > Create new API key`<br>
**Current integration:** Upcoming media is displayed in the **Calendar** module.
**qBittorent**
*The qBittorent integration is still in development.*
**[⤴️ Back to Top](#-table-of-contents)**
### 🧑‍🤝‍🧑 Multiple Configs
Homarr allows the usage of multiple configs. You can add a new config in two ways.
**Drag-and-Drop**
1. Download your config from the Homarr settings.
2. Change the name of the `.json` file and the name in the `.json` file to any name you want *(just make sure it's different)*.
3. Drag-and-Drop the file into the Homarr tab in your browser.
4. Change the config in settings.
**Using a filebrowser**
1. Locate your mounted `default.json` file.
2. Duplicate your `default.json` file.
3. Change the name of the `.json` file and the name in the `.json` file to any name you want *(just make sure it's different)*.
4. Refresh the Homarr tab in your browser.
5. Change the config in settings.
**[⤴️ Back to Top](#-table-of-contents)**
### 🐻 Icons
The icons used in Homarr are automatically requested from the [dashboard-icons](https://github.com/walkxhub/dashboard-icons) repo.
Icons are requested in the following way: <br>
`Grab name > Replace ' ' with '-' > .toLower() > https://cdn.jsdelivr.net/gh/walkxhub/dashboard-icons/png/{name}.png`
**[⤴️ Back to Top](#-table-of-contents)**
### 📊 Modules
Modules are blocks shown on the sides of the Homarr dashboard that display information. They can be enabled in settings.
**Clock Module**
The clock module will display your current time and date.
**Calendar Module**
The Calendar module uses [integrations](#--integrations-1) to display new content.
**[⤴️ Back to Top](#-table-of-contents)**
### 🔍 Search Bar
The Search Bar will open any Search Query after the Query URL you've specified in settings.
*(Eg. `https://www.google.com/search?q=*Your Query will be inserted here*`)*
**[⤴️ Back to Top](#-table-of-contents)**
# 💖 Contributing
**Please read our [Contribution Guidelines](/CONTRIBUTING.md)**

View File

@@ -1,12 +1,26 @@
{
"name": "config",
"services": [],
"services": [
{
"type": "Other",
"name": "YouTube",
"icon": "https://cdn.jsdelivr.net/gh/walkxhub/dashboard-icons/png/youtube.png",
"url": "https://youtube.com/"
},
{
"type": "Other",
"name": "YouTube ",
"icon": "https://cdn.jsdelivr.net/gh/walkxhub/dashboard-icons/png/youtube.png",
"url": "https://youtube.com/"
}
],
"settings": {
"searchBar": true,
"searchUrl": "https://duckduckgo.com/?q=",
"searchUrl": "Custom",
"enabledModules": [
"Date",
"Calendar"
"Calendar",
"Weather"
]
}
}

View File

@@ -1,2 +1,2 @@
export const REPO_URL = 'ajnart/homarr';
export const CURRENT_VERSION = 'v0.3.0';
export const CURRENT_VERSION = 'v0.3.1';

View File

@@ -12,6 +12,7 @@ import {
LoadingOverlay,
ActionIcon,
Tooltip,
Title,
} from '@mantine/core';
import { useForm } from '@mantine/form';
import { motion } from 'framer-motion';
@@ -28,9 +29,9 @@ export function AddItemShelfButton(props: any) {
<Modal
size="xl"
radius="md"
title={<Title order={3}>Add service</Title>}
opened={props.opened || opened}
onClose={() => setOpened(false)}
title="Add a service"
>
<AddAppShelfItemForm setOpened={setOpened} />
</Modal>

View File

@@ -1,30 +1,21 @@
import React, { useState } from 'react';
import { motion } from 'framer-motion';
import { Text, AspectRatio, SimpleGrid, Card, Image, useMantineTheme } from '@mantine/core';
import { Text, AspectRatio, Card, Image, useMantineTheme, Center, Grid } from '@mantine/core';
import { useConfig } from '../../tools/state';
import { serviceItem } from '../../tools/types';
import AppShelfMenu from './AppShelfMenu';
const AppShelf = () => {
const AppShelf = (props: any) => {
const { config } = useConfig();
return (
<SimpleGrid
cols={7}
spacing="xl"
breakpoints={[
{ maxWidth: 2400, cols: 6, spacing: 'xl' },
{ maxWidth: 1800, cols: 5, spacing: 'xl' },
{ maxWidth: 1500, cols: 4, spacing: 'lg' },
{ maxWidth: 800, cols: 3, spacing: 'md' },
{ maxWidth: 400, cols: 3, spacing: 'sm' },
{ maxWidth: 400, cols: 2, spacing: 'sm' },
]}
>
<Grid gutter="xl" align="center">
{config.services.map((service) => (
<AppShelfItem key={service.name} service={service} />
<Grid.Col span={6} xl={2} xs={4} sm={3} md={3}>
<AppShelfItem key={service.name} service={service} />
</Grid.Col>
))}
</SimpleGrid>
</Grid>
);
};
@@ -42,16 +33,9 @@ export function AppShelfItem(props: any) {
setHovering(false);
}}
>
<Card
style={{
boxShadow: hovering ? '0px 0px 3px rgba(0, 0, 0, 0.5)' : '0px 0px 1px rgba(0, 0, 0, 0.5)',
backgroundColor:
theme.colorScheme === 'dark' ? theme.colors.dark[6] : theme.colors.gray[1],
}}
radius="md"
>
<Card withBorder radius="lg" shadow="md">
<Card.Section>
<Text mt="sm" align="center" lineClamp={1} weight={500}>
<Text mt="sm" align="center" lineClamp={1} weight={550}>
{service.name}
</Text>
<motion.div
@@ -68,34 +52,35 @@ export function AppShelfItem(props: any) {
<AppShelfMenu service={service} />
</motion.div>
</Card.Section>
<Card.Section>
<AspectRatio
ratio={3 / 5}
m="xl"
style={{
width: 150,
height: 90,
}}
>
<motion.i
whileHover={{
cursor: 'pointer',
scale: 1.1,
<Center>
<Card.Section>
<AspectRatio
ratio={3 / 5}
m="xl"
style={{
width: 150,
height: 90,
}}
>
<Image
style={{
maxWidth: 80,
<motion.i
whileHover={{
cursor: 'pointer',
scale: 1.1,
}}
fit="contain"
onClick={() => {
window.open(service.url);
}}
src={service.icon}
/>
</motion.i>
</AspectRatio>
</Card.Section>
>
<Image
width={80}
height={80}
src={service.icon}
fit="contain"
onClick={() => {
window.open(service.url);
}}
/>
</motion.i>
</AspectRatio>
</Card.Section>
</Center>
</Card>
</motion.div>
);

View File

@@ -1,5 +1,5 @@
import React from 'react';
import { createStyles, Switch, Group, useMantineColorScheme } from '@mantine/core';
import { createStyles, Switch, Group, useMantineColorScheme, Kbd } from '@mantine/core';
import { Sun, MoonStars } from 'tabler-icons-react';
const useStyles = createStyles((theme) => ({
@@ -40,6 +40,9 @@ export function ColorSchemeSwitch() {
<Switch checked={colorScheme === 'dark'} onChange={() => toggleColorScheme()} size="md" />
</div>
Switch to {colorScheme === 'dark' ? 'light' : 'dark'} mode
<Group spacing={2}>
<Kbd>Ctrl</Kbd>+<Kbd>J</Kbd>
</Group>
</Group>
);
}

View File

@@ -1,18 +1,40 @@
import { TextInput, Text, Popover, Box } from '@mantine/core';
import { useForm } from '@mantine/hooks';
import { useState } from 'react';
import { TextInput, Kbd, createStyles, useMantineTheme, Text, Popover } from '@mantine/core';
import { useForm, useHotkeys } from '@mantine/hooks';
import { useRef, useState } from 'react';
import { Search, BrandYoutube, Download } from 'tabler-icons-react';
import { useConfig } from '../../tools/state';
const useStyles = createStyles((theme) => ({
hide: {
[theme.fn.smallerThan('sm')]: {
display: 'none',
},
display: 'flex',
alignItems: 'center',
},
}));
export default function SearchBar(props: any) {
const { config, setConfig } = useConfig();
const [opened, setOpened] = useState(false);
const [icon, setIcon] = useState(<Search />);
const querryUrl = config.settings.searchUrl || 'https://www.google.com/search?q=';
const queryUrl = config.settings.searchUrl || 'https://www.google.com/search?q=';
const textInput: any = useRef(null);
useHotkeys([['ctrl+K', () => textInput.current.focus()]]);
const { classes, cx } = useStyles();
const theme = useMantineTheme();
const rightSection = (
<div className={classes.hide}>
<Kbd>Ctrl</Kbd>
<span style={{ margin: '0 5px' }}>+</span>
<Kbd>K</Kbd>
</div>
);
const form = useForm({
initialValues: {
querry: '',
query: '',
},
});
@@ -21,70 +43,66 @@ export default function SearchBar(props: any) {
}
return (
<Box
mb={"xl"}
style={{
width: '100%',
<form
onChange={() => {
// If query contains !yt or !t add "Searching on YouTube" or "Searching torrent"
const query = form.values.query.trim();
const isYoutube = query.startsWith('!yt');
const isTorrent = query.startsWith('!t');
if (isYoutube) {
setIcon(<BrandYoutube size={22} />);
} else if (isTorrent) {
setIcon(<Download size={22} />);
} else {
setIcon(<Search size={22} />);
}
}}
onSubmit={form.onSubmit((values) => {
// Find if query is prefixed by !yt or !t
const query = values.query.trim();
const isYoutube = query.startsWith('!yt');
const isTorrent = query.startsWith('!t');
if (isYoutube) {
window.open(`https://www.youtube.com/results?search_query=${query.substring(3)}`);
} else if (isTorrent) {
window.open(`https://bitsearch.to/search?q=${query.substring(3)}`);
} else {
window.open(`${queryUrl}${values.query}`);
}
})}
>
<form
onChange={() => {
// If querry contains !yt or !t add "Searching on YouTube" or "Searching torrent"
const querry = form.values.querry.trim();
const isYoutube = querry.startsWith('!yt');
const isTorrent = querry.startsWith('!t');
if (isYoutube) {
setIcon(<BrandYoutube size={22} />);
} else if (isTorrent) {
setIcon(<Download size={22} />);
} else {
setIcon(<Search size={22} />);
}
}}
onSubmit={form.onSubmit((values) => {
// Find if querry is prefixed by !yt or !t
const querry = values.querry.trim();
const isYoutube = querry.startsWith('!yt');
const isTorrent = querry.startsWith('!t');
if (isYoutube) {
window.open(`https://www.youtube.com/results?search_query=${querry.substring(3)}`);
} else if (isTorrent) {
window.open(`https://bitsearch.to/search?q=${querry.substring(3)}`);
} else {
window.open(`${querryUrl}${values.querry}`);
}
})}
<Popover
opened={opened}
position="bottom"
placement="start"
width={260}
withArrow
radius="md"
trapFocus={false}
transition="pop-bottom-right"
onFocusCapture={() => setOpened(true)}
onBlurCapture={() => setOpened(false)}
target={
<TextInput
variant="filled"
icon={icon}
ref={textInput}
rightSectionWidth={90}
rightSection={rightSection}
radius="md"
size="md"
styles={{ rightSection: { pointerEvents: 'none' } }}
placeholder="Search the web..."
{...props}
{...form.getInputProps('query')}
/>
}
>
<Popover
opened={opened}
style={{
width: '100%',
}}
position="bottom"
placement="start"
withArrow
trapFocus={false}
transition="pop-top-left"
onFocusCapture={() => setOpened(true)}
onBlurCapture={() => setOpened(false)}
target={
<TextInput
variant="filled"
color="blue"
icon={icon}
radius="md"
size="md"
placeholder="Search the web"
{...props}
{...form.getInputProps('querry')}
/>
}
>
<Text>
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.
</Text>
</Popover>
</form>
</Box>
<Text>
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.
</Text>
</Popover>
</form>
);
}

View File

@@ -74,8 +74,8 @@ function SettingsMenu(props: any) {
/>
{searchUrl === 'Custom' && (
<TextInput
label="Querry URL"
placeholder="Custom querry url"
label="Query URL"
placeholder="Custom query url"
value={customSearchUrl}
onChange={(event) => {
setCustomSearchUrl(event.currentTarget.value);
@@ -142,7 +142,8 @@ export function SettingsMenuButton(props: any) {
return (
<>
<Modal
size="md"
size="xl"
radius="md"
title={<Title order={3}>Settings</Title>}
opened={props.opened || opened}
onClose={() => setOpened(false)}

View File

@@ -1,8 +1,9 @@
import { Aside as MantineAside, Group } from '@mantine/core';
import { DateModule } from '../modules';
import { CalendarModule } from '../modules/calendar/CalendarModule';
import ModuleWrapper from '../modules/moduleWrapper';
export default function Aside() {
export default function Aside(props: any) {
return (
<MantineAside
hiddenBreakpoint="md"
@@ -14,8 +15,9 @@ export default function Aside() {
base: 'auto',
}}
>
<Group mt="sm" direction="column">
<Group mt="sm" grow direction="column">
<ModuleWrapper module={CalendarModule} />
<ModuleWrapper module={DateModule} />
</Group>
</MantineAside>
);

View File

@@ -54,24 +54,12 @@ export function Footer({ links }: FooterCenteredProps) {
</Anchor>
));
return (
<FooterComponent height="auto" style={{ border: 'none' }}>
<Group
sx={{
position: 'fixed',
bottom: 0,
right: 15,
}}
direction="row"
align="center"
mb={15}
>
<Group className={classes.links}>{items}</Group>
<Group spacing="xs" position="right" noWrap>
<ActionIcon<'a'> component="a" href="https://github.com/ajnart/homarr" size="lg">
<BrandGithub size={18} />
</ActionIcon>
</Group>
return (
<FooterComponent p={5} height="auto" style={{ border: 'none', position: 'fixed', bottom: 0, right: 0 }}>
<Group position="right" mr="xs" mb="xs">
<ActionIcon<'a'> component="a" href="https://github.com/ajnart/homarr" size="lg">
<BrandGithub size={18} />
</ActionIcon>
<Text
style={{
fontSize: '0.90rem',

View File

@@ -1,117 +1,35 @@
import React from 'react';
import { createStyles, Header as Head, Group, Drawer, Center } from '@mantine/core';
import { useBooleanToggle } from '@mantine/hooks';
import { NextLink } from '@mantine/next';
import { createStyles, Header as Head, Group, Box } from '@mantine/core';
import { Logo } from './Logo';
import CalendarComponent from '../modules/calendar/CalendarModule';
import { SettingsMenuButton } from '../Settings/SettingsMenu';
import SearchBar from '../SearchBar/SearchBar';
import { AddItemShelfButton } from '../AppShelf/AddAppShelfItem';
import { SettingsMenuButton } from '../Settings/SettingsMenu';
const HEADER_HEIGHT = 60;
const useStyles = createStyles((theme) => ({
root: {
position: 'relative',
zIndex: 1,
},
dropdown: {
position: 'absolute',
top: HEADER_HEIGHT,
left: 0,
right: 0,
zIndex: 0,
borderTopRightRadius: 0,
borderTopLeftRadius: 0,
borderTopWidth: 0,
overflow: 'hidden',
[theme.fn.largerThan('md')]: {
hide: {
[theme.fn.smallerThan('xs')]: {
display: 'none',
},
},
header: {
display: 'flex',
height: '100%',
},
links: {
[theme.fn.smallerThan('md')]: {
display: 'none',
},
},
burger: {
[theme.fn.largerThan('md')]: {
display: 'none',
},
},
link: {
display: 'block',
lineHeight: 1,
padding: '8px 12px',
borderRadius: theme.radius.sm,
textDecoration: 'none',
color: theme.colorScheme === 'dark' ? theme.colors.dark[0] : theme.colors.gray[7],
fontSize: theme.fontSizes.sm,
fontWeight: 500,
'&:hover': {
backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[6] : theme.colors.gray[0],
},
[theme.fn.smallerThan('sm')]: {
borderRadius: 0,
padding: theme.spacing.md,
},
},
linkActive: {
'&, &:hover': {
backgroundColor:
theme.colorScheme === 'dark'
? theme.fn.rgba(theme.colors[theme.primaryColor][9], 0.25)
: theme.colors[theme.primaryColor][0],
color: theme.colors[theme.primaryColor][theme.colorScheme === 'dark' ? 3 : 7],
},
},
}));
interface HeaderResponsiveProps {
links: { link: string; label: string }[];
}
export function Header({ links }: HeaderResponsiveProps) {
const [opened, toggleOpened] = useBooleanToggle(false);
export function Header(props: any) {
const { classes, cx } = useStyles();
return (
<Head height={HEADER_HEIGHT}>
<Group direction="row" align="center" position="apart" className={classes.header} mx="xl">
<NextLink style={{ textDecoration: 'none' }} href="/">
<Head height="auto">
<Group m="xs" position="apart">
<Box className={classes.hide}>
<Logo style={{ fontSize: 22 }} />
</NextLink>
<Group>
</Box>
<Group noWrap>
<SearchBar />
<SettingsMenuButton />
<AddItemShelfButton />
</Group>
</Group>
<Drawer
opened={opened}
overlayOpacity={0.55}
overlayBlur={3}
onClose={() => toggleOpened()}
position="right"
>
{opened ?? (
<Center>
<CalendarComponent />
</Center>
)}
</Drawer>
</Head>
);
}

View File

@@ -1,36 +1,28 @@
import { AppShell, Center, createStyles } from '@mantine/core';
import { AppShell, createStyles } from '@mantine/core';
import { Header } from './Header';
import { Footer } from './Footer';
import Aside from './Aside';
import Navbar from './Navbar';
const useStyles = createStyles((theme) => ({
main: {
[theme.fn.largerThan('md')]: {
maxWidth: 1500,
},
},
main: {},
}));
export default function Layout({ children, style }: any) {
const { classes, cx } = useStyles();
return (
<AppShell
navbar={<Navbar />}
aside={<Aside />}
header={<Header links={[]} />}
header={<Header />}
footer={<Footer links={[]} />}
>
<Center>
<main
className={cx(classes.main)}
style={{
...style,
}}
>
{children}
</main>
</Center>
<main
className={cx(classes.main)}
style={{
...style,
}}
>
{children}
</main>
</AppShell>
);
}

View File

@@ -14,7 +14,7 @@ export default function Navbar() {
base: 'auto',
}}
>
<Group mt="sm" direction="column">
<Group mt="sm" direction="column" align="center">
<ModuleWrapper module={DateModule} />
</Group>
</MantineNavbar>

View File

@@ -13,16 +13,7 @@ export default function ModuleWrapper(props: any) {
return null;
}
return (
<Card
hidden={!isShown}
mx="sm"
radius="lg"
shadow="sm"
style={{
// Make background color of the card depend on the theme
backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[5] : 'white',
}}
>
<Card hidden={!isShown} mx="sm" withBorder radius="lg" shadow="sm">
<module.component />
</Card>
);

View File

@@ -1,4 +1,3 @@
import { Group } from '@mantine/core';
import { getCookie, setCookies } from 'cookies-next';
import { GetServerSidePropsContext } from 'next';
import path from 'path';
@@ -6,7 +5,6 @@ import fs from 'fs';
import { useEffect } from 'react';
import AppShelf from '../components/AppShelf/AppShelf';
import LoadConfigComponent from '../components/Config/LoadConfig';
import SearchBar from '../components/SearchBar/SearchBar';
import { Config } from '../tools/types';
import { useConfig } from '../tools/state';
@@ -54,10 +52,7 @@ export default function HomePage(props: any) {
}, [initialConfig]);
return (
<>
<SearchBar />
<Group align="start" position="apart" noWrap>
<AppShelf />
</Group>
<AppShelf />
<LoadConfigComponent />
</>
);