import { Box, Text, Tooltip, UnstyledButton } from '@mantine/core'; import { createStyles, useMantineTheme } from '@mantine/styles'; import { motion } from 'framer-motion'; import { useExternalUrl } from '~/hooks/useExternalUrl'; import { AppType } from '~/types/app'; import { useEditModeStore } from '../../Views/useEditModeStore'; import { HomarrCardWrapper } from '../HomarrCardWrapper'; import { BaseTileProps } from '../type'; import { AppMenu } from './AppMenu'; import { AppPing } from './AppPing'; interface AppTileProps extends BaseTileProps { app: AppType; } export const AppTile = ({ className, app }: AppTileProps) => { const isEditMode = useEditModeStore((x) => x.enabled); const { cx, classes } = useStyles(); const { colorScheme } = useMantineTheme(); const tooltipContent = [ app.appearance.appNameStatus === 'hover' ? app.name : undefined, app.behaviour.tooltipDescription, ] .filter((e) => e) .join(': '); const isRow = app.appearance.positionAppName.includes('row'); const href = useExternalUrl(app); function Inner() { return ( {app.appearance.appNameStatus === 'normal' && ( {app.name} )} ); } return ( {!app.url || isEditMode ? ( ) : ( )} ); }; const useStyles = createStyles((theme, _params, getRef) => ({ base: { display: 'flex', alignItems: 'center', justifyContent: 'center', }, appContent: { gap: 0, overflow: 'visible', flexGrow: 5, }, appImage: { maxHeight: '100%', maxWidth: '100%', overflow: 'auto', flex: 1, objectFit: 'contain', }, appName: { wordBreak: 'break-word', }, button: { height: '100%', width: '100%', gap: 4, }, })); export const appTileDefinition = { component: AppTile, minWidth: 1, minHeight: 1, maxWidth: 12, maxHeight: 12, };