chore: update prettier configuration for print width (#519)
* feat: update prettier configuration for print width * chore: apply code formatting to entire repository * fix: remove build files * fix: format issue --------- Co-authored-by: Meier Lukas <meierschlumpf@gmail.com>
This commit is contained in:
@@ -1,15 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import type { PropsWithChildren } from "react";
|
||||
import {
|
||||
Center,
|
||||
Flex,
|
||||
Loader,
|
||||
Stack,
|
||||
Text,
|
||||
Tooltip,
|
||||
UnstyledButton,
|
||||
} from "@mantine/core";
|
||||
import { Center, Flex, Loader, Stack, Text, Tooltip, UnstyledButton } from "@mantine/core";
|
||||
import { IconDeviceDesktopX } from "@tabler/icons-react";
|
||||
|
||||
import { clientApi } from "@homarr/api/client";
|
||||
@@ -19,13 +11,7 @@ import { useScopedI18n } from "@homarr/translation/client";
|
||||
import type { WidgetComponentProps } from "../definition";
|
||||
import classes from "./app.module.css";
|
||||
|
||||
export default function AppWidget({
|
||||
options,
|
||||
serverData,
|
||||
isEditMode,
|
||||
width,
|
||||
height,
|
||||
}: WidgetComponentProps<"app">) {
|
||||
export default function AppWidget({ options, serverData, isEditMode, width, height }: WidgetComponentProps<"app">) {
|
||||
const t = useScopedI18n("widget.app");
|
||||
const isQueryEnabled = Boolean(options.appId);
|
||||
const {
|
||||
@@ -90,11 +76,7 @@ export default function AppWidget({
|
||||
}
|
||||
|
||||
return (
|
||||
<AppLink
|
||||
href={app?.href ?? ""}
|
||||
openInNewTab={options.openInNewTab}
|
||||
enabled={Boolean(app?.href) && !isEditMode}
|
||||
>
|
||||
<AppLink href={app?.href ?? ""} openInNewTab={options.openInNewTab} enabled={Boolean(app?.href) && !isEditMode}>
|
||||
<Flex align="center" justify="center" h="100%">
|
||||
<Tooltip.Floating
|
||||
label={app?.description}
|
||||
@@ -118,11 +100,7 @@ export default function AppWidget({
|
||||
{app?.name}
|
||||
</Text>
|
||||
)}
|
||||
<img
|
||||
src={app?.iconUrl}
|
||||
alt={app?.name}
|
||||
className={classes.appIcon}
|
||||
/>
|
||||
<img src={app?.iconUrl} alt={app?.name} className={classes.appIcon} />
|
||||
</Flex>
|
||||
</Tooltip.Floating>
|
||||
</Flex>
|
||||
@@ -136,20 +114,9 @@ interface AppLinkProps {
|
||||
enabled: boolean;
|
||||
}
|
||||
|
||||
const AppLink = ({
|
||||
href,
|
||||
openInNewTab,
|
||||
enabled,
|
||||
children,
|
||||
}: PropsWithChildren<AppLinkProps>) =>
|
||||
const AppLink = ({ href, openInNewTab, enabled, children }: PropsWithChildren<AppLinkProps>) =>
|
||||
enabled ? (
|
||||
<UnstyledButton
|
||||
component="a"
|
||||
href={href}
|
||||
target={openInNewTab ? "_blank" : undefined}
|
||||
h="100%"
|
||||
w="100%"
|
||||
>
|
||||
<UnstyledButton component="a" href={href} target={openInNewTab ? "_blank" : undefined} h="100%" w="100%">
|
||||
{children}
|
||||
</UnstyledButton>
|
||||
) : (
|
||||
|
||||
@@ -3,14 +3,13 @@ import { IconApps } from "@tabler/icons-react";
|
||||
import { createWidgetDefinition } from "../definition";
|
||||
import { optionsBuilder } from "../options";
|
||||
|
||||
export const { definition, componentLoader, serverDataLoader } =
|
||||
createWidgetDefinition("app", {
|
||||
icon: IconApps,
|
||||
options: optionsBuilder.from((factory) => ({
|
||||
appId: factory.app(),
|
||||
openInNewTab: factory.switch({ defaultValue: true }),
|
||||
showDescriptionTooltip: factory.switch({ defaultValue: false }),
|
||||
})),
|
||||
})
|
||||
.withServerData(() => import("./serverData"))
|
||||
.withDynamicImport(() => import("./component"));
|
||||
export const { definition, componentLoader, serverDataLoader } = createWidgetDefinition("app", {
|
||||
icon: IconApps,
|
||||
options: optionsBuilder.from((factory) => ({
|
||||
appId: factory.app(),
|
||||
openInNewTab: factory.switch({ defaultValue: true }),
|
||||
showDescriptionTooltip: factory.switch({ defaultValue: false }),
|
||||
})),
|
||||
})
|
||||
.withServerData(() => import("./serverData"))
|
||||
.withDynamicImport(() => import("./component"));
|
||||
|
||||
@@ -4,9 +4,7 @@ import { api } from "@homarr/api/server";
|
||||
|
||||
import type { WidgetProps } from "../definition";
|
||||
|
||||
export default async function getServerDataAsync({
|
||||
options,
|
||||
}: WidgetProps<"app">) {
|
||||
export default async function getServerDataAsync({ options }: WidgetProps<"app">) {
|
||||
try {
|
||||
const app = await api.app.byId({ id: options.appId });
|
||||
return { app };
|
||||
|
||||
Reference in New Issue
Block a user