Skip to content

Commit f161b18

Browse files
📝 Add docstrings to issue-bundle-fixes
Docstrings generation was requested by @Arun-kushwaha007. The following files were modified: * `apps/mobile/app/components/ui/MoneyText.tsx` * `apps/mobile/app/screens/ActivityScreen.tsx` * `apps/mobile/app/screens/AddExpenseScreen.tsx` * `apps/mobile/app/screens/ExpenseDetailScreen.tsx` * `apps/mobile/app/screens/GroupDetailScreen.tsx` * `apps/mobile/app/screens/GuestGroupDetailScreen.tsx` * `apps/mobile/app/screens/HomeScreen.tsx` * `apps/web/app/dashboard/activity/page.tsx` * `apps/web/app/dashboard/groups/[groupId]/page.tsx` * `apps/web/app/dashboard/page.tsx` * `apps/web/app/share/[token]/page.tsx` * `apps/web/src/components/activity/ActivityFeed.tsx` * `apps/web/src/components/dashboard/ActivityList.tsx` * `apps/web/src/components/groups/ExpenseDetailCard.tsx` * `apps/web/src/components/groups/ExpenseRow.tsx` * `apps/web/src/components/groups/ExpenseTable.tsx` * `apps/web/src/components/groups/GroupSummaryPanel.tsx` * `apps/web/src/components/groups/RecurringExpenseList.tsx` * `apps/web/src/components/groups/SettlementList.tsx` * `packages/shared-types/src/index.ts` These files were ignored: * `apps/backend/src/activity/activity.service.spec.ts` These file types are not supported: * `README.md`
1 parent 3347c73 commit f161b18

20 files changed

Lines changed: 253 additions & 0 deletions

File tree

apps/mobile/app/components/ui/MoneyText.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ interface MoneyTextProps {
1010
currency?: CurrencyCode;
1111
}
1212

13+
/**
14+
* Render a Text element showing a formatted currency amount.
15+
*
16+
* @param cents - Amount in cents as a string (e.g., `"150"` for $1.50)
17+
* @param size - One of `'sm' | 'md' | 'lg'`; controls the text font size
18+
* @param variant - One of `'default' | 'success' | 'danger'`; controls the text color
19+
* @param currency - Currency code used for formatting (defaults to `'USD'`)
20+
* @returns A React Native Text element displaying the formatted currency string; the same string is used for the accessibility label
21+
*/
1322
export function MoneyText({ cents, size = 'md', variant = 'default', currency = 'USD' }: MoneyTextProps) {
1423
const { colors } = useAppTheme();
1524
const amount = formatCurrencyFromCents(cents, currency);

apps/mobile/app/screens/ActivityScreen.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,15 @@ const relativeTime = (iso: string): string => {
8282
return `${diffDay}d ago`;
8383
};
8484

85+
/**
86+
* Render the Activity screen showing a scrollable, paginated list of activity events for a specific group or the current user.
87+
*
88+
* The screen loads the first page on mount, supports pull-to-refresh and infinite scroll pagination, animates item entry,
89+
* and displays loading or empty states as appropriate. Amounts and currencies are resolved from activity metadata when available.
90+
*
91+
* @param route - Optional navigation route; if `route.params.groupId` is provided the screen shows that group's activity, otherwise it shows the current user's activity.
92+
* @returns The rendered Activity screen element.
93+
*/
8594
export function ActivityScreen({ route }: { route?: { params?: { groupId?: string } } }) {
8695
const groupId = route?.params?.groupId;
8796
const toast = useToastStore((state) => state.show);

apps/mobile/app/screens/AddExpenseScreen.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,17 @@ const STEPS = [
5555
{ title: 'Review', subtitle: 'Vibe check before we post?' },
5656
];
5757

58+
/**
59+
* Multi-step screen for creating an expense within a group.
60+
*
61+
* Renders a five-step flow to enter expense details, choose a payer, select participants,
62+
* configure the split (equal/exact/percentage), optionally enable recurring settings,
63+
* review the summary, and create the expense.
64+
*
65+
* @param route - Screen route with `params.groupId` identifying the target group
66+
* @param navigation - Navigation object with `goBack()` for dismissing the screen
67+
* @returns The React element for the Add Expense screen
68+
*/
5869
export function AddExpenseScreen({
5970
route,
6071
navigation,

apps/mobile/app/screens/ExpenseDetailScreen.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,15 @@ function inferExtension(asset: ImagePicker.ImagePickerAsset): string | undefined
4343
return 'jpg';
4444
}
4545

46+
/**
47+
* Render the expense detail screen allowing viewing, editing, and receipt upload for a single expense.
48+
*
49+
* Fetches and displays an expense by `route.params.expenseId`, provides inline editing of description and category,
50+
* and supports attaching or replacing a receipt image with size and permission checks.
51+
*
52+
* @param route - Navigation route object whose `params.expenseId` is the ID of the expense to display
53+
* @returns A React element that renders the expense detail screen
54+
*/
4655
export function ExpenseDetailScreen({ route }: { route: { params: { expenseId: string } } }) {
4756
const [loading, setLoading] = React.useState(true);
4857
const [expense, setExpense] = React.useState<ExpenseDto | null>(null);

apps/mobile/app/screens/GroupDetailScreen.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,15 @@ const getBalanceStatus = (value: number) => {
8080
return 'All settled';
8181
};
8282

83+
/**
84+
* Screen component that displays a group's details, balances, expenses, recurring bills, members, and related actions.
85+
*
86+
* Loads group data and expenses, provides filtering and grouping of expenses, editing/removing recurring bills, exporting CSV, and navigation to related screens.
87+
*
88+
* @param route - Route object whose `params.groupId` selects the group to show
89+
* @param navigation - Navigation object used to navigate to other screens (e.g., AddExpense, ExpenseDetail, GroupMembers)
90+
* @returns The rendered Group detail screen element
91+
*/
8392
export function GroupDetailScreen({
8493
route,
8594
navigation,

apps/mobile/app/screens/GuestGroupDetailScreen.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@ import { ExpenseCard } from '../components/ExpenseCard';
1212
import { SectionHeader } from '../components/SectionHeader';
1313
import { useToastStore } from '../store/toastStore';
1414

15+
/**
16+
* Render a view-only detail screen for a shared group link.
17+
*
18+
* Fetches group details, summary statistics, recent expenses, members, and recent activity for the guest token;
19+
* displays loading and error states, a read-only UI with stats, recent expenses, and activity history,
20+
* and offers a prompt to register. On fetch failure a toast is shown and navigation goes back.
21+
*
22+
* @param route - The navigation route; expects `route.params.token` containing the shared guest token.
23+
* @param navigation - Navigation object used to go back on error and navigate to the Register screen.
24+
* @returns A `JSX.Element` representing the guest group detail screen.
25+
*/
1526
export function GuestGroupDetailScreen({ route, navigation }: { route: any; navigation: any }) {
1627
const { token } = route.params;
1728
const { colors, typography, shadows } = useAppTheme();

apps/mobile/app/screens/HomeScreen.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,14 @@ const subtitleForActivity = (activity: ActivityDto): string => {
100100
}
101101
};
102102

103+
/**
104+
* Renders the app's dashboard home screen with summary, quick actions, attention items, and recent activity.
105+
*
106+
* Loads user summary, recent activities, and per-group attention items on mount; displays a balance card, quick action tiles, a "Needs Attention" list (when present), and a recent activity feed with navigation handlers for related screens.
107+
*
108+
* @param navigation - React Navigation prop used to navigate to other screens (e.g., 'AddExpense', 'Groups', 'SettleUp', 'GroupDetail', 'Activity', 'Profile')
109+
* @returns The Home screen React element
110+
*/
103111
export function HomeScreen({ navigation }: { navigation: any }) {
104112
const user = useAuthStore((state) => state.user);
105113
const groups = useGroupStore((state) => state.groups);

apps/web/app/dashboard/activity/page.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ import { backendFetch } from '../../../src/lib/backend';
55

66
type ActivityResponse = { items: ActivityDto[]; nextCursor: number | null };
77

8+
/**
9+
* Render the Activity page, fetching groups and an initial page of activity items before rendering the feed.
10+
*
11+
* If fetching groups or activity fails, errors are suppressed and the corresponding data defaults to an empty list
12+
* (for groups) or an empty activity response with `items: []` and `nextCursor: null` (for activity).
13+
*
14+
* @returns A React element containing the dashboard-styled Activity page with the fetched groups and initial activity items.
15+
*/
816
export default async function ActivityPage() {
917
let groups: GroupDto[] = [];
1018
let activity: ActivityResponse = { items: [], nextCursor: null };

apps/web/app/dashboard/groups/[groupId]/page.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ interface GroupDetailPageProps {
2222
}>;
2323
}
2424

25+
/**
26+
* Renders the group detail dashboard for a specified group.
27+
*
28+
* @param params - A Promise that resolves to an object containing `groupId`, used to fetch all data for the group.
29+
* @returns The page JSX showing the group header (name, creation date, currency, member count, total spend), current user's balance status, summary panel, recurring expenses, expense table, member list, and group actions.
30+
*/
2531
export default async function GroupDetailPage({ params }: GroupDetailPageProps) {
2632
const { groupId } = await params;
2733

apps/web/app/dashboard/page.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@ import { GlassCard } from '../../components/ui/GlassCard';
1717

1818
type Group = { id: string; name: string; currency: string };
1919

20+
/**
21+
* Format an amount given in cents into a localized currency string.
22+
*
23+
* If `cents` or `currency` is missing, returns "$0.00". For supported currency codes
24+
* "USD", "EUR", and "INR" the value is formatted using that currency; for any other
25+
* currency code the value is formatted using "USD" as a fallback.
26+
*
27+
* @param cents - The amount in the smallest currency unit (cents) as a string, or `null`
28+
* @param currency - An ISO currency code (e.g., "USD", "EUR", "INR"), or `null`
29+
* @returns A formatted currency string (for example, "$1.23")
30+
*/
2031
function formatMoney(cents: string | null, currency: string | null): string {
2132
if (!cents || !currency) {
2233
return '$0.00';
@@ -29,6 +40,13 @@ function formatMoney(cents: string | null, currency: string | null): string {
2940
return formatCurrencyFromCents(cents, 'USD');
3041
}
3142

43+
/**
44+
* Render the dashboard page showing account summaries, attention items, activity, charts, and group listings.
45+
*
46+
* Fetches dashboard and recent-activity data, derives view state (summary cards, attention queue, recent activity, and groups), and returns the assembled UI layout.
47+
*
48+
* @returns The dashboard page JSX element that displays summaries, an attention queue (when present), spending chart, quick actions, recent activity, and a list of groups.
49+
*/
3250
export default async function DashboardPage() {
3351
const [dashboard, recentActivityData] = await Promise.all([
3452
backendFetch<GroupDashboardDto>('/groups/dashboard'),

0 commit comments

Comments
 (0)