mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-10 23:45:48 +01:00
💄 Styling backgrounds of widgets
This commit is contained in:
@@ -36,10 +36,11 @@ export default function AppShelfMenu(props: any) {
|
|||||||
<Menu
|
<Menu
|
||||||
position="right"
|
position="right"
|
||||||
radius="md"
|
radius="md"
|
||||||
|
shadow="xl"
|
||||||
styles={{
|
styles={{
|
||||||
body: {
|
body: {
|
||||||
backgroundColor:
|
// Add shadow and elevation to the body
|
||||||
theme.colorScheme === 'dark' ? theme.colors.dark[5] : theme.colors.gray[1],
|
boxShadow: '0 0 14px 14px rgba(0, 0, 0, 0.1), 0 14px 11px rgba(0, 0, 0, 0.1)',
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -247,6 +247,11 @@ function DayComponent(props: any) {
|
|||||||
radius="lg"
|
radius="lg"
|
||||||
shadow="xl"
|
shadow="xl"
|
||||||
transition="pop"
|
transition="pop"
|
||||||
|
styles={{
|
||||||
|
body: {
|
||||||
|
boxShadow: '0 0 14px 14px rgba(0, 0, 0, 0.1), 0 14px 11px rgba(0, 0, 0, 0.1)',
|
||||||
|
},
|
||||||
|
}}
|
||||||
width={700}
|
width={700}
|
||||||
onClose={() => setOpened(false)}
|
onClose={() => setOpened(false)}
|
||||||
opened={opened}
|
opened={opened}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import { getCookie, setCookies } from 'cookies-next';
|
import { getCookie, setCookies } from 'cookies-next';
|
||||||
import { GetServerSidePropsContext } from 'next';
|
import { GetServerSidePropsContext } from 'next';
|
||||||
import path from 'path';
|
|
||||||
import fs from 'fs';
|
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import AppShelf from '../components/AppShelf/AppShelf';
|
import AppShelf from '../components/AppShelf/AppShelf';
|
||||||
import LoadConfigComponent from '../components/Config/LoadConfig';
|
import LoadConfigComponent from '../components/Config/LoadConfig';
|
||||||
@@ -10,6 +8,7 @@ import { useConfig } from '../tools/state';
|
|||||||
import { migrateToIdConfig } from '../tools/migrate';
|
import { migrateToIdConfig } from '../tools/migrate';
|
||||||
import { ModuleWrapper } from '../components/modules/moduleWrapper';
|
import { ModuleWrapper } from '../components/modules/moduleWrapper';
|
||||||
import { DownloadsModule } from '../components/modules';
|
import { DownloadsModule } from '../components/modules';
|
||||||
|
import { getConfig } from '../tools/getConfig';
|
||||||
|
|
||||||
export async function getServerSideProps({
|
export async function getServerSideProps({
|
||||||
req,
|
req,
|
||||||
@@ -17,38 +16,20 @@ export async function getServerSideProps({
|
|||||||
}: GetServerSidePropsContext): Promise<{ props: { config: Config } }> {
|
}: GetServerSidePropsContext): Promise<{ props: { config: Config } }> {
|
||||||
let cookie = getCookie('config-name', { req, res });
|
let cookie = getCookie('config-name', { req, res });
|
||||||
if (!cookie) {
|
if (!cookie) {
|
||||||
setCookies('config-name', 'default', { req, res, maxAge: 60 * 60 * 24 * 30 });
|
setCookies('config-name', 'default', {
|
||||||
|
req,
|
||||||
|
res,
|
||||||
|
maxAge: 60 * 60 * 24 * 30,
|
||||||
|
sameSite: 'strict',
|
||||||
|
});
|
||||||
cookie = 'default';
|
cookie = 'default';
|
||||||
}
|
}
|
||||||
// Check if the config file exists
|
return getConfig(cookie as string);
|
||||||
const configPath = path.join(process.cwd(), 'data/configs', `${cookie}.json`);
|
|
||||||
if (!fs.existsSync(configPath)) {
|
|
||||||
return {
|
|
||||||
props: {
|
|
||||||
config: {
|
|
||||||
name: cookie.toString(),
|
|
||||||
services: [],
|
|
||||||
settings: {
|
|
||||||
searchUrl: 'https://www.google.com/search?q=',
|
|
||||||
},
|
|
||||||
modules: {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const config = fs.readFileSync(configPath, 'utf8');
|
|
||||||
// Print loaded config
|
|
||||||
return {
|
|
||||||
props: {
|
|
||||||
config: JSON.parse(config),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function HomePage(props: any) {
|
export default function HomePage(props: any) {
|
||||||
const { config: initialConfig }: { config: Config } = props;
|
const { config: initialConfig }: { config: Config } = props;
|
||||||
const { config, loadConfig, setConfig, getConfigs } = useConfig();
|
const { setConfig } = useConfig();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const migratedConfig = migrateToIdConfig(initialConfig);
|
const migratedConfig = migrateToIdConfig(initialConfig);
|
||||||
setConfig(migratedConfig);
|
setConfig(migratedConfig);
|
||||||
|
|||||||
31
src/tools/getConfig.ts
Normal file
31
src/tools/getConfig.ts
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import path from 'path';
|
||||||
|
import fs from 'fs';
|
||||||
|
|
||||||
|
export function getConfig(name: string) {
|
||||||
|
// Check if the config file exists
|
||||||
|
const configPath = path.join(process.cwd(), 'data/configs', `${name}.json`);
|
||||||
|
if (!fs.existsSync(configPath)) {
|
||||||
|
return {
|
||||||
|
props: {
|
||||||
|
configName: name,
|
||||||
|
config: {
|
||||||
|
name: name.toString(),
|
||||||
|
services: [],
|
||||||
|
settings: {
|
||||||
|
searchUrl: 'https://www.google.com/search?q=',
|
||||||
|
},
|
||||||
|
modules: {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const config = fs.readFileSync(configPath, 'utf8');
|
||||||
|
// Print loaded config
|
||||||
|
return {
|
||||||
|
props: {
|
||||||
|
configName: name,
|
||||||
|
config: JSON.parse(config),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user