feat(custom-widgets): add extensible widget platform
This commit is contained in:
1 parent
6cca757493
commit
8f152f1929
317 files changed
+32326
-1788
No files matched your search
@@ -1,25 +1 @@
|
||||
import { useParams } from "next/navigation";
|
||||
import { useSuspenseQuery } from "@tanstack/react-query";
|
||||
import type { MRT_RowData, MRT_TableOptions } from "mantine-react-table";
|
||||
import { useMantineReactTable } from "mantine-react-table";
|
||||
|
||||
import type { SupportedLanguage } from "@homarr/translation";
|
||||
import { localeConfigurations } from "@homarr/translation";
|
||||
|
||||
export const useTranslatedMantineReactTable = <TData extends MRT_RowData>(
|
||||
tableOptions: Omit<MRT_TableOptions<TData>, "localization">,
|
||||
) => {
|
||||
const { locale } = useParams<{ locale: SupportedLanguage }>();
|
||||
const { data: mantineReactTable } = useSuspenseQuery({
|
||||
queryKey: ["mantine-react-table-locale", locale],
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
queryFn: async () => {
|
||||
return await localeConfigurations[locale].importMrtLocalization();
|
||||
},
|
||||
});
|
||||
|
||||
return useMantineReactTable<TData>({
|
||||
...tableOptions,
|
||||
localization: mantineReactTable,
|
||||
});
|
||||
};
|
||||
export { useTranslatedMantineReactTable } from "@homarr/widget-sdk/table/localization";
|
||||
@@ -1,13 +1,10 @@
|
||||
import { createTheme, rem } from "@mantine/core";
|
||||
|
||||
import { scrollAreaDefaultProps } from "@homarr/widget-sdk/ui-settings";
|
||||
|
||||
import { modalComponent } from "./theme/modal";
|
||||
|
||||
export const scrollAreaDefaultProps = {
|
||||
type: "hover",
|
||||
scrollbarSize: 2,
|
||||
scrollHideDelay: 500,
|
||||
offsetScrollbars: true,
|
||||
} as const;
|
||||
export { scrollAreaDefaultProps };
|
||||
|
||||
export const theme = createTheme({
|
||||
primaryColor: "red",
|
||||
|
||||
Reference in new issue
Block a user