fix: replace return null with empty tags

This commit is contained in:
2025-09-02 22:35:36 +02:00
parent ab0c5e3e99
commit 0689a5827f
9 changed files with 22 additions and 22 deletions

View File

@@ -1,7 +1,7 @@
import { ReactNode } from "react"; import { ReactNode } from "react";
export default function Debug({children}: {children: ReactNode}) { export default function Debug({children}: {children: ReactNode}) {
if (process.env.NODE_ENV !== 'development') return null if (process.env.NODE_ENV !== 'development') return <></>
return ( return (
<div className="debug"> <div className="debug">
{children} {children}

View File

@@ -38,7 +38,7 @@ export default function SettingsPage() {
// handleDeleteAccount function removed // handleDeleteAccount function removed
if (!settings) return null if (!settings) return <></>
return ( return (
<> <>

View File

@@ -24,13 +24,13 @@ interface HabitItemProps {
} }
const renderUserAvatars = (habit: Habit, currentUser: User | null, usersData: { users: User[] }) => { const renderUserAvatars = (habit: Habit, currentUser: User | null, usersData: { users: User[] }) => {
if (!habit.userIds || habit.userIds.length <= 1) return null; if (!habit.userIds || habit.userIds.length <= 1) return <></>;
return ( return (
<div className="flex -space-x-2 ml-2 flex-shrink-0"> <div className="flex -space-x-2 ml-2 flex-shrink-0">
{habit.userIds?.filter((u) => u !== currentUser?.id).map(userId => { {habit.userIds?.filter((u) => u !== currentUser?.id).map(userId => {
const user = usersData.users.find(u => u.id === userId) const user = usersData.users.find(u => u.id === userId)
if (!user) return null if (!user) return <></>;
return ( return (
<Avatar key={user.id} className="h-6 w-6"> <Avatar key={user.id} className="h-6 w-6">
<AvatarImage src={user?.avatarPath && `/api/avatars/${user.avatarPath.split('/').pop()}` || ""} /> <AvatarImage src={user?.avatarPath && `/api/avatars/${user.avatarPath.split('/').pop()}` || ""} />

View File

@@ -8,7 +8,7 @@ export default async function PermissionError() {
// If everything is fine, render nothing // If everything is fine, render nothing
if (permissionResult.success) { if (permissionResult.success) {
return null return <></>
} }
// Get error message // Get error message

View File

@@ -177,7 +177,7 @@ export default function PomodoroTimer() {
const progress = (timeLeft / currentTimerRef.current.duration) * 100 const progress = (timeLeft / currentTimerRef.current.duration) * 100
if (!show) return null if (!show) return <></>
return ( return (
<div className="fixed bottom-20 right-4 lg:bottom-4 bg-background border rounded-lg shadow-lg"> <div className="fixed bottom-20 right-4 lg:bottom-4 bg-background border rounded-lg shadow-lg">

View File

@@ -9,7 +9,7 @@ export default function TodayEarnedCoins({ longFormat }: { longFormat?: boolean
const [settings] = useAtom(settingsAtom) const [settings] = useAtom(settingsAtom)
const { coinsEarnedToday } = useCoins() const { coinsEarnedToday } = useCoins()
if (coinsEarnedToday <= 0) return null if (coinsEarnedToday <= 0) return <></>;
return ( return (
<span className="text-md text-green-600 dark:text-green-400 font-medium mt-1"> <span className="text-md text-green-600 dark:text-green-400 font-medium mt-1">

View File

@@ -29,13 +29,13 @@ interface WishlistItemProps {
} }
const renderUserAvatars = (item: WishlistItemType, currentUser: User | null, usersData: { users: User[] }) => { const renderUserAvatars = (item: WishlistItemType, currentUser: User | null, usersData: { users: User[] }) => {
if (!item.userIds || item.userIds.length <= 1) return null; if (!item.userIds || item.userIds.length <= 1) return <></>;
return ( return (
<div className="flex -space-x-2 ml-2 flex-shrink-0"> <div className="flex -space-x-2 ml-2 flex-shrink-0">
{item.userIds?.filter((u) => u !== currentUser?.id).map(userId => { {item.userIds?.filter((u) => u !== currentUser?.id).map(userId => {
const user = usersData.users.find(u => u.id === userId) const user = usersData.users.find(u => u.id === userId)
if (!user) return null if (!user) return <></>;
return ( return (
<Avatar key={user.id} className="h-6 w-6"> <Avatar key={user.id} className="h-6 w-6">
<AvatarImage src={user?.avatarPath && `/api/avatars/${user.avatarPath.split('/').pop()}` || ""} /> <AvatarImage src={user?.avatarPath && `/api/avatars/${user.avatarPath.split('/').pop()}` || ""} />

View File

@@ -73,7 +73,7 @@ const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
) )
if (!colorConfig.length) { if (!colorConfig.length) {
return null return <></>;
} }
return ( return (
@@ -135,7 +135,7 @@ const ChartTooltipContent = React.forwardRef<
const tooltipLabel = React.useMemo(() => { const tooltipLabel = React.useMemo(() => {
if (hideLabel || !payload?.length) { if (hideLabel || !payload?.length) {
return null return <></>;
} }
const [item] = payload const [item] = payload
@@ -155,7 +155,7 @@ const ChartTooltipContent = React.forwardRef<
} }
if (!value) { if (!value) {
return null return <></>;
} }
return <div className={cn("font-medium", labelClassName)}>{value}</div> return <div className={cn("font-medium", labelClassName)}>{value}</div>
@@ -170,7 +170,7 @@ const ChartTooltipContent = React.forwardRef<
]) ])
if (!active || !payload?.length) { if (!active || !payload?.length) {
return null return <></>;
} }
const nestLabel = payload.length === 1 && indicator !== "dot" const nestLabel = payload.length === 1 && indicator !== "dot"
@@ -273,7 +273,7 @@ const ChartLegendContent = React.forwardRef<
const { config } = useChart() const { config } = useChart()
if (!payload?.length) { if (!payload?.length) {
return null return <></>;
} }
return ( return (

View File

@@ -90,20 +90,20 @@ export function useCoins(options?: { selectedUser?: string }) {
]); ]);
const add = async (amount: number, description: string, note?: string) => { const add = async (amount: number, description: string, note?: string) => {
if (!handlePermissionCheck(currentUser, 'coins', 'write', tCommon)) return null if (!handlePermissionCheck(currentUser, 'coins', 'write', tCommon)) return <></>;
if (isNaN(amount) || amount <= 0) { if (isNaN(amount) || amount <= 0) {
toast({ toast({
title: t("invalidAmountTitle"), title: t("invalidAmountTitle"),
description: t("invalidAmountDescription") description: t("invalidAmountDescription")
}) })
return null return <></>;
} }
if (amount > MAX_COIN_LIMIT) { if (amount > MAX_COIN_LIMIT) {
toast({ toast({
title: t("invalidAmountTitle"), title: t("invalidAmountTitle"),
description: t("maxAmountExceededDescription", { max: MAX_COIN_LIMIT }) description: t("maxAmountExceededDescription", { max: MAX_COIN_LIMIT })
}) })
return null return <></>;
} }
const data = await addCoins({ const data = await addCoins({
@@ -119,21 +119,21 @@ export function useCoins(options?: { selectedUser?: string }) {
} }
const remove = async (amount: number, description: string, note?: string) => { const remove = async (amount: number, description: string, note?: string) => {
if (!handlePermissionCheck(currentUser, 'coins', 'write', tCommon)) return null if (!handlePermissionCheck(currentUser, 'coins', 'write', tCommon)) return <></>;
const numAmount = Math.abs(amount) const numAmount = Math.abs(amount)
if (isNaN(numAmount) || numAmount <= 0) { if (isNaN(numAmount) || numAmount <= 0) {
toast({ toast({
title: t("invalidAmountTitle"), title: t("invalidAmountTitle"),
description: t("invalidAmountDescription") description: t("invalidAmountDescription")
}) })
return null return <></>;
} }
if (numAmount > MAX_COIN_LIMIT) { if (numAmount > MAX_COIN_LIMIT) {
toast({ toast({
title: t("invalidAmountTitle"), title: t("invalidAmountTitle"),
description: t("maxAmountExceededDescription", { max: MAX_COIN_LIMIT }) description: t("maxAmountExceededDescription", { max: MAX_COIN_LIMIT })
}) })
return null return <></>;
} }
const data = await removeCoins({ const data = await removeCoins({
@@ -149,14 +149,14 @@ export function useCoins(options?: { selectedUser?: string }) {
} }
const updateNote = async (transactionId: string, note: string) => { const updateNote = async (transactionId: string, note: string) => {
if (!handlePermissionCheck(currentUser, 'coins', 'write', tCommon)) return null if (!handlePermissionCheck(currentUser, 'coins', 'write', tCommon)) return <></>;
const transaction = coins.transactions.find(t => t.id === transactionId) const transaction = coins.transactions.find(t => t.id === transactionId)
if (!transaction) { if (!transaction) {
toast({ toast({
title: tCommon("errorTitle"), title: tCommon("errorTitle"),
description: t("transactionNotFoundDescription") description: t("transactionNotFoundDescription")
}) })
return null return <></>;
} }
const updatedTransaction = { const updatedTransaction = {