mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-10 07:25:48 +01:00
Add growth option for the main appshelf
This commit is contained in:
@@ -10,5 +10,6 @@
|
|||||||
},
|
},
|
||||||
"credits": {
|
"credits": {
|
||||||
"madeWithLove": "Made with ❤️ by @"
|
"madeWithLove": "Made with ❤️ by @"
|
||||||
}
|
},
|
||||||
|
"grow": "Grow grid (take all space)"
|
||||||
}
|
}
|
||||||
@@ -95,7 +95,7 @@ const AppShelf = (props: any) => {
|
|||||||
onDragEnd={handleDragEnd}
|
onDragEnd={handleDragEnd}
|
||||||
>
|
>
|
||||||
<SortableContext items={config.services}>
|
<SortableContext items={config.services}>
|
||||||
<Grid gutter="lg" align="center">
|
<Grid gutter="lg" grow={config.settings.grow}>
|
||||||
{filtered.map((service) => (
|
{filtered.map((service) => (
|
||||||
<Grid.Col key={service.id} span="content">
|
<Grid.Col key={service.id} span="content">
|
||||||
<SortableItem service={service} key={service.id} id={service.id}>
|
<SortableItem service={service} key={service.id} id={service.id}>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { ColorSelector } from './ColorSelector';
|
|||||||
import { OpacitySelector } from './OpacitySelector';
|
import { OpacitySelector } from './OpacitySelector';
|
||||||
import { AppCardWidthSelector } from './AppCardWidthSelector';
|
import { AppCardWidthSelector } from './AppCardWidthSelector';
|
||||||
import { ShadeSelector } from './ShadeSelector';
|
import { ShadeSelector } from './ShadeSelector';
|
||||||
|
import { GrowthSelector } from './GrowthSelector';
|
||||||
|
|
||||||
export default function TitleChanger() {
|
export default function TitleChanger() {
|
||||||
const { config, setConfig } = useConfig();
|
const { config, setConfig } = useConfig();
|
||||||
@@ -74,6 +75,7 @@ export default function TitleChanger() {
|
|||||||
<Button type="submit">{t('buttons.submit')}</Button>
|
<Button type="submit">{t('buttons.submit')}</Button>
|
||||||
</Stack>
|
</Stack>
|
||||||
</form>
|
</form>
|
||||||
|
<GrowthSelector />
|
||||||
<ColorSelector type="primary" />
|
<ColorSelector type="primary" />
|
||||||
<ColorSelector type="secondary" />
|
<ColorSelector type="secondary" />
|
||||||
<ShadeSelector />
|
<ShadeSelector />
|
||||||
|
|||||||
30
src/components/Settings/GrowthSelector.tsx
Normal file
30
src/components/Settings/GrowthSelector.tsx
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
import { Switch } from '@mantine/core';
|
||||||
|
import { useTranslation } from 'next-i18next';
|
||||||
|
import { useState } from 'react';
|
||||||
|
import { useConfig } from '../../tools/state';
|
||||||
|
|
||||||
|
export function GrowthSelector() {
|
||||||
|
const { config, setConfig } = useConfig();
|
||||||
|
const defaultPosition = config?.settings?.grow || false;
|
||||||
|
const [growState, setGrowState] = useState(defaultPosition);
|
||||||
|
const { t } = useTranslation('settings/common.json');
|
||||||
|
const toggleGrowState = () => {
|
||||||
|
setGrowState(!growState);
|
||||||
|
setConfig({
|
||||||
|
...config,
|
||||||
|
settings: {
|
||||||
|
...config.settings,
|
||||||
|
grow: !growState,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Switch
|
||||||
|
label={t('settings/common:grow')}
|
||||||
|
checked={growState === true}
|
||||||
|
onChange={() => toggleGrowState()}
|
||||||
|
size="md"
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -48,15 +48,11 @@ export function WidgetsPositionSwitch() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Group>
|
<Switch
|
||||||
<div className={classes.root}>
|
label={t('label')}
|
||||||
<Switch
|
checked={widgetPosition === 'left'}
|
||||||
checked={widgetPosition === 'left'}
|
onChange={() => toggleWidgetPosition()}
|
||||||
onChange={() => toggleWidgetPosition()}
|
size="md"
|
||||||
size="md"
|
/>
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{t('label')}
|
|
||||||
</Group>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ export interface Settings {
|
|||||||
customCSS?: string;
|
customCSS?: string;
|
||||||
appOpacity?: number;
|
appOpacity?: number;
|
||||||
widgetPosition?: string;
|
widgetPosition?: string;
|
||||||
|
grow?: boolean;
|
||||||
appCardWidth?: number;
|
appCardWidth?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user