From 378160444c015b5475192bf25faae208e9d2bf85 Mon Sep 17 00:00:00 2001 From: wkrokosz Date: Wed, 5 Feb 2025 15:25:16 +0100 Subject: [PATCH 1/4] Handle the case when the group expense has amount 0 --- src/pages/groups/[groupId].tsx | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/src/pages/groups/[groupId].tsx b/src/pages/groups/[groupId].tsx index 8e2e8e4..5667aeb 100644 --- a/src/pages/groups/[groupId].tsx +++ b/src/pages/groups/[groupId].tsx @@ -416,15 +416,25 @@ const BalancePage: NextPageWithUser<{ {isSettlement ? null : (
-
- {youPaid ? 'You lent' : 'You owe'} -
-
- {e.currency}{' '} - {toUIString(yourExpenseAmount)} -
+ {youPaid || yourExpenseAmount !== 0 ? ( + <> +
+ {youPaid ? 'You lent' : 'You owe'} +
+
+ {e.currency}{' '} + {toUIString(yourExpenseAmount)} +
+ + ) : ( +
+

Not involved

+
+ )}
)} From 9c2c57b3105d363a0249c413da44500683498d48 Mon Sep 17 00:00:00 2001 From: krokosik Date: Tue, 25 Feb 2025 16:16:23 +0100 Subject: [PATCH 2/4] Organize imports --- src/pages/activity.tsx | 17 +++++++-------- src/pages/groups/[groupId].tsx | 40 +++++++++++++++++----------------- 2 files changed, 28 insertions(+), 29 deletions(-) diff --git a/src/pages/activity.tsx b/src/pages/activity.tsx index f999e24..8696462 100644 --- a/src/pages/activity.tsx +++ b/src/pages/activity.tsx @@ -1,16 +1,15 @@ -import Head from 'next/head'; -import MainLayout from '~/components/Layout/MainLayout'; import { SplitType } from '@prisma/client'; -import { api } from '~/utils/api'; import { format } from 'date-fns'; -import { UserAvatar } from '~/components/ui/avatar'; -import { toUIString } from '~/utils/numbers'; -import Link from 'next/link'; -import { type NextPageWithUser } from '~/types'; import { type User } from 'next-auth'; -import { BalanceSkeleton } from '~/components/ui/skeleton'; -import useEnableAfter from '~/hooks/useEnableAfter'; +import Head from 'next/head'; +import Link from 'next/link'; +import MainLayout from '~/components/Layout/MainLayout'; +import { UserAvatar } from '~/components/ui/avatar'; import { LoadingSpinner } from '~/components/ui/spinner'; +import useEnableAfter from '~/hooks/useEnableAfter'; +import { type NextPageWithUser } from '~/types'; +import { api } from '~/utils/api'; +import { toUIString } from '~/utils/numbers'; function getPaymentString( user: User, diff --git a/src/pages/groups/[groupId].tsx b/src/pages/groups/[groupId].tsx index 5667aeb..db375a5 100644 --- a/src/pages/groups/[groupId].tsx +++ b/src/pages/groups/[groupId].tsx @@ -1,34 +1,28 @@ -import Head from 'next/head'; -import MainLayout from '~/components/Layout/MainLayout'; +import { SplitType } from '@prisma/client'; import Avatar from 'boring-avatars'; import clsx from 'clsx'; -import { Button } from '~/components/ui/button'; -import { SplitType } from '@prisma/client'; -import { api } from '~/utils/api'; -import { useRouter } from 'next/router'; +import { format } from 'date-fns'; +import { motion } from 'framer-motion'; import { + BarChartHorizontal, Check, ChevronLeft, DoorOpen, + Info, Share, Trash2, UserPlus, - BarChartHorizontal, - Info, } from 'lucide-react'; -import { AppDrawer } from '~/components/ui/drawer'; -import { UserAvatar } from '~/components/ui/avatar'; -import NoMembers from '~/components/group/NoMembers'; -import { format } from 'date-fns'; -import AddMembers from '~/components/group/AddMembers'; +import Head from 'next/head'; import Image from 'next/image'; -import { toUIString } from '~/utils/numbers'; import Link from 'next/link'; -import { CategoryIcon } from '~/components/ui/categoryIcons'; -import { env } from '~/env'; +import { useRouter } from 'next/router'; import { useState } from 'react'; -import { type NextPageWithUser } from '~/types'; -import { motion } from 'framer-motion'; +import { toast } from 'sonner'; +import AddMembers from '~/components/group/AddMembers'; +import GroupMyBalance from '~/components/group/GroupMyBalance'; +import NoMembers from '~/components/group/NoMembers'; +import MainLayout from '~/components/Layout/MainLayout'; import { AlertDialog, AlertDialogCancel, @@ -39,8 +33,14 @@ import { AlertDialogTitle, AlertDialogTrigger, } from '~/components/ui/alert-dialog'; -import { toast } from 'sonner'; -import GroupMyBalance from '~/components/group/GroupMyBalance'; +import { UserAvatar } from '~/components/ui/avatar'; +import { Button } from '~/components/ui/button'; +import { CategoryIcon } from '~/components/ui/categoryIcons'; +import { AppDrawer } from '~/components/ui/drawer'; +import { env } from '~/env'; +import { type NextPageWithUser } from '~/types'; +import { api } from '~/utils/api'; +import { toUIString } from '~/utils/numbers'; const BalancePage: NextPageWithUser<{ enableSendingInvites: boolean; From a817958e601960a73e3572970910094fb6672508 Mon Sep 17 00:00:00 2001 From: krokosik Date: Tue, 25 Feb 2025 16:22:15 +0100 Subject: [PATCH 3/4] Also do not paint activity tab in red --- src/pages/activity.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pages/activity.tsx b/src/pages/activity.tsx index 8696462..1a9bc56 100644 --- a/src/pages/activity.tsx +++ b/src/pages/activity.tsx @@ -22,6 +22,8 @@ function getPaymentString( ) { if (isDeleted) { return null; + } else if (expenseUserAmt === 0) { + return
Not involved
; } else if (isSettlement) { return (
From 1f3cdd93b0dca12f527ca7632c8353d314d78883 Mon Sep 17 00:00:00 2001 From: krokosik Date: Tue, 25 Feb 2025 16:25:12 +0100 Subject: [PATCH 4/4] Fix overflow issues in activity tab --- src/pages/activity.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/pages/activity.tsx b/src/pages/activity.tsx index 1a9bc56..3d937e6 100644 --- a/src/pages/activity.tsx +++ b/src/pages/activity.tsx @@ -53,7 +53,7 @@ const ActivityPage: NextPageWithUser = ({ user }) => { -
+
{expensesQuery.isLoading ? ( showProgress ? ( @@ -118,7 +118,6 @@ const ActivityPage: NextPageWithUser = ({ user }) => { )}
-