style: format merged dev files

This commit is contained in:
ajnart committed 2026-09-10 19:58:44 +02:00
1 parent 92a7a83e92
commit 1735aeb139
2 files changed
+16 -54

No files matched your search

+13 -54
View File
@@ -150,21 +150,13 @@ Create a CSS file alongside the component:
/* Hover: translucent instead of opaque */ /* Hover: translucent instead of opaque */
.my-table .mantine-datatable-table tbody tr:hover { .my-table .mantine-datatable-table tbody tr:hover {
background-color: color-mix( background-color: color-mix(in srgb, var(--mantine-color-default-hover) 40%, transparent) !important;
in srgb,
var(--mantine-color-default-hover) 40%,
transparent
) !important;
} }
/* Headers: frosted glass effect */ /* Headers: frosted glass effect */
.my-table th { .my-table th {
white-space: nowrap; white-space: nowrap;
background-color: color-mix( background-color: color-mix(in srgb, var(--mantine-color-body) 60%, transparent) !important;
in srgb,
var(--mantine-color-body) 60%,
transparent
) !important;
backdrop-filter: blur(8px); backdrop-filter: blur(8px);
} }
@@ -186,11 +178,7 @@ Create a CSS file alongside the component:
/* Row expansion area */ /* Row expansion area */
.my-table .mantine-datatable-row-expansion-cell { .my-table .mantine-datatable-row-expansion-cell {
background-color: color-mix( background-color: color-mix(in srgb, var(--mantine-color-body) 40%, transparent) !important;
in srgb,
var(--mantine-color-body) 40%,
transparent
) !important;
} }
``` ```
@@ -258,9 +246,7 @@ const size = useMemo(() => getSizeConfig(width), [width]);
Then use a visibility check lookup table for columns: Then use a visibility check lookup table for columns:
```typescript ```typescript
const columnVisibilityChecks: Partial< const columnVisibilityChecks: Partial<Record<string, (ctx: ColumnContext) => boolean>> = {
Record<string, (ctx: ColumnContext) => boolean>
> = {
upSpeed: (ctx) => ctx.hasTorrents && ctx.size.showSpeedColumns, upSpeed: (ctx) => ctx.hasTorrents && ctx.size.showSpeedColumns,
downSpeed: (ctx) => ctx.size.showSpeedColumns, downSpeed: (ctx) => ctx.size.showSpeedColumns,
time: (ctx) => ctx.size.showTimeColumn, time: (ctx) => ctx.size.showTimeColumn,
@@ -319,13 +305,8 @@ const storeKey = `mytable-${itemId ?? "preview"}-${[...options.columns].toSorted
On mount, seed `useDataTableColumns` with server-persisted values. Use a `hydrated` ref to prevent the persist effect from immediately writing defaults back: On mount, seed `useDataTableColumns` with server-persisted values. Use a `hydrated` ref to prevent the persist effect from immediately writing defaults back:
```typescript ```typescript
const { const { effectiveColumns, columnsOrder, columnsWidth, setColumnsOrder, setMultipleColumnWidths } =
effectiveColumns, useDataTableColumns<MyRow>({ key: storeKey, columns });
columnsOrder,
columnsWidth,
setColumnsOrder,
setMultipleColumnWidths,
} = useDataTableColumns<MyRow>({ key: storeKey, columns });
const lastStoreKey = useRef(storeKey); const lastStoreKey = useRef(storeKey);
const hydrated = useRef(false); const hydrated = useRef(false);
@@ -348,13 +329,7 @@ useEffect(() => {
requestAnimationFrame(() => { requestAnimationFrame(() => {
hydrated.current = true; hydrated.current = true;
}); });
}, [ }, [storeKey, savedOrder, savedWidths, setColumnsOrder, setMultipleColumnWidths]);
storeKey,
savedOrder,
savedWidths,
setColumnsOrder,
setMultipleColumnWidths,
]);
``` ```
### Persist localStorage → server ### Persist localStorage → server
@@ -367,17 +342,14 @@ const prevWidths = useRef(columnsWidth);
useEffect(() => { useEffect(() => {
if (!hydrated.current) return; if (!hydrated.current) return;
const orderChanged = const orderChanged = JSON.stringify(columnsOrder) !== JSON.stringify(prevOrder.current);
JSON.stringify(columnsOrder) !== JSON.stringify(prevOrder.current); const widthsChanged = JSON.stringify(columnsWidth) !== JSON.stringify(prevWidths.current);
const widthsChanged =
JSON.stringify(columnsWidth) !== JSON.stringify(prevWidths.current);
prevOrder.current = columnsOrder; prevOrder.current = columnsOrder;
prevWidths.current = columnsWidth; prevWidths.current = columnsWidth;
if (!orderChanged && !widthsChanged) return; if (!orderChanged && !widthsChanged) return;
if (orderChanged) if (orderChanged) persistOption({ columnOrder: JSON.stringify(columnsOrder) });
persistOption({ columnOrder: JSON.stringify(columnsOrder) });
if (widthsChanged) { if (widthsChanged) {
const widthMap: Record<string, number> = {}; const widthMap: Record<string, number> = {};
for (const entry of columnsWidth) { for (const entry of columnsWidth) {
@@ -385,8 +357,7 @@ useEffect(() => {
if (!key) continue; if (!key) continue;
const v = entry[key as keyof typeof entry]; const v = entry[key as keyof typeof entry];
if (typeof v === "number") widthMap[key] = v; if (typeof v === "number") widthMap[key] = v;
else if (typeof v === "string" && v.endsWith("px")) else if (typeof v === "string" && v.endsWith("px")) widthMap[key] = parseInt(v, 10);
widthMap[key] = parseInt(v, 10);
} }
persistOption({ columnWidths: JSON.stringify(widthMap) }); persistOption({ columnWidths: JSON.stringify(widthMap) });
} }
@@ -426,22 +397,10 @@ const handleContextMenu = useCallback(
The menu component uses `Portal` for correct z-index: The menu component uses `Portal` for correct z-index:
```tsx ```tsx
function RowContextMenu({ function RowContextMenu({ state, onClose }: { state: ContextMenuState; onClose: () => void }) {
state,
onClose,
}: {
state: ContextMenuState;
onClose: () => void;
}) {
return ( return (
<Portal> <Portal>
<Menu <Menu opened onClose={onClose} closeOnItemClick={false} position="right-start" offset={0}>
opened
onClose={onClose}
closeOnItemClick={false}
position="right-start"
offset={0}
>
<Menu.Target> <Menu.Target>
<Box <Box
style={{ style={{
@@ -54,16 +54,19 @@ The certificates are stored in the `/appdata/trusted-certificates` directory whi
This means you can automate the update of the certificates by simply replacing or adding a new file in the directory. This means you can automate the update of the certificates by simply replacing or adding a new file in the directory.
## Obtaining certificates ## Obtaining certificates
Every integration has its own way of obtaining certificates. Every integration has its own way of obtaining certificates.
Generally it is recommended to search for the documentation of the integration you are using. Generally it is recommended to search for the documentation of the integration you are using.
Most of the time you can find the certificate in the file system of the integration. Most of the time you can find the certificate in the file system of the integration.
The certificate file needs to be uploaded to Homarr. To first get the file on your computer you can either: The certificate file needs to be uploaded to Homarr. To first get the file on your computer you can either:
- use `scp user@host:/path/to/file ./certificate.pem` - use `scp user@host:/path/to/file ./certificate.pem`
- use `cat /path/to/file` to print the certificate. Then recreate the file on your machine. - use `cat /path/to/file` to print the certificate. Then recreate the file on your machine.
Below you can find instructions for some of the integrations. Below you can find instructions for some of the integrations.
### Pi-hole (v6) ### Pi-hole (v6)
Since version 6 of Pi-hole, the web interface can be accessed through HTTPS. Since version 6 of Pi-hole, the web interface can be accessed through HTTPS.
The certificate can be found in the path `/etc/pihole/tls_ca.crt`. To add the certificate, this file needs to be copied and uploaded to Homarr. The certificate can be found in the path `/etc/pihole/tls_ca.crt`. To add the certificate, this file needs to be copied and uploaded to Homarr.
You can find more details regarding SSL / TLS for Pi-hole [here](https://docs.pi-hole.net/api/tls/). You can find more details regarding SSL / TLS for Pi-hole [here](https://docs.pi-hole.net/api/tls/).