Skip to content

Commit 9338eee

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/ExpenseDetailScreen.tsx` * `apps/mobile/app/screens/GuestGroupDetailScreen.tsx` * `apps/mobile/app/screens/HomeScreen.tsx` * `apps/web/app/dashboard/groups/[groupId]/page.tsx` * `apps/web/app/dashboard/page.tsx` * `apps/web/src/components/activity/ActivityFeed.tsx` * `apps/web/src/components/dashboard/ActivityList.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 kept as they were: * `apps/mobile/app/screens/AddExpenseScreen.tsx` * `apps/mobile/app/screens/GroupDetailScreen.tsx` * `apps/web/app/dashboard/activity/page.tsx` * `apps/web/app/share/[token]/page.tsx` * `apps/web/src/components/groups/ExpenseDetailCard.tsx` * `apps/web/src/components/groups/ExpenseRow.tsx` * `apps/web/src/components/groups/ExpenseTable.tsx` These files were ignored: * `apps/backend/src/activity/activity.service.spec.ts` These file types are not supported: * `README.md` * `packages/shared-types/tsconfig.json` * `tsconfig.base.json`
1 parent 178e243 commit 9338eee

13 files changed

Lines changed: 91 additions & 46 deletions

File tree

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,11 @@ interface MoneyTextProps {
1111
}
1212

1313
/**
14-
* Render a Text element showing a formatted currency amount.
14+
* Renders a Text element that displays a currency amount formatted from a cents string and sets the accessibility label to the same formatted string.
1515
*
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
16+
* @param cents - Amount in cents as a string (for example, `"150"` represents $1.50)
17+
* @param currency - ISO currency code used for formatting (defaults to `'USD'`)
18+
* @returns A React element that renders the formatted currency string
2119
*/
2220
export function MoneyText({ cents, size = 'md', variant = 'default', currency = 'USD' }: MoneyTextProps) {
2321
const { colors } = useAppTheme();

apps/mobile/app/screens/ActivityScreen.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,13 @@ const relativeTime = (iso: string): string => {
8383
};
8484

8585
/**
86-
* Render the Activity screen showing a scrollable, paginated list of activity events for a specific group or the current user.
86+
* Renders the Activity screen with a paginated, refreshable list of activity events for a group or the current user.
8787
*
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.
88+
* The screen supports pull-to-refresh, infinite scroll pagination, animated item entry, and displays loading or empty states.
89+
* Amounts and currencies are derived from activity metadata when available.
9090
*
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.
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 React element.
9393
*/
9494
export function ActivityScreen({ route }: { route?: { params?: { groupId?: string } } }) {
9595
const groupId = route?.params?.groupId;

apps/mobile/app/screens/ExpenseDetailScreen.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ function getReceiptUrl(fileKey?: string | null): string | null {
3030
return `${base.replace(/\/$/, '')}/${fileKey}`;
3131
}
3232

33+
/**
34+
* Infers a file extension for an image asset from its filename or MIME type.
35+
*
36+
* @param asset - The ImagePicker asset to inspect (may include `fileName` and `mimeType`)
37+
* @returns The inferred file extension in lowercase (e.g., `png`, `heic`, `jpg`), or `undefined` if no information is available
38+
*/
3339
function inferExtension(asset: ImagePicker.ImagePickerAsset): string | undefined {
3440
const fileName = asset.fileName ?? '';
3541
const fileExtension = fileName.includes('.') ? fileName.split('.').pop() : undefined;

apps/mobile/app/screens/GuestGroupDetailScreen.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,14 @@ import { SectionHeader } from '../components/SectionHeader';
1313
import { useToastStore } from '../store/toastStore';
1414

1515
/**
16-
* Render a view-only detail screen for a shared group link.
16+
* Render a read-only detail screen for a shared group link.
1717
*
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.
18+
* Fetches guest-visible group data on mount and displays group header, stats, recent expenses, and activity history,
19+
* along with a prompt to register. On fetch failure a toast is shown and navigation goes back.
2120
*
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.
21+
* @param route - Navigation route; expects `route.params.token` containing the shared guest token.
22+
* @param navigation - Navigation object used to navigate to the Register screen and to go back on error.
23+
* @returns A JSX.Element representing the guest group detail screen.
2524
*/
2625
export function GuestGroupDetailScreen({ route, navigation }: { route: any; navigation: any }) {
2726
const { token } = route.params;

apps/mobile/app/screens/HomeScreen.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,11 @@ const subtitleForActivity = (activity: ActivityDto): string => {
101101
};
102102

103103
/**
104-
* Renders the app's dashboard home screen with summary, quick actions, attention items, and recent activity.
104+
* Display the app dashboard with balance, quick actions, attention items, and recent activity.
105105
*
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.
106+
* On mount, loads user summary, recent activities, and per-group attention items to populate the screen.
107107
*
108-
* @param navigation - React Navigation prop used to navigate to other screens (e.g., 'AddExpense', 'Groups', 'SettleUp', 'GroupDetail', 'Activity', 'Profile')
108+
* @param navigation - React Navigation prop used to navigate to other screens
109109
* @returns The Home screen React element
110110
*/
111111
export function HomeScreen({ navigation }: { navigation: any }) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ interface GroupDetailPageProps {
2525
/**
2626
* Renders the group detail dashboard for a specified group.
2727
*
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.
28+
* @param params - An object containing `groupId` that identifies which group's data to load and display.
29+
* @returns The page JSX for the group's detail dashboard, including the header (name, creation date, currency, member count, total spend), current user's balance pill, summary panel, recurring expenses, expense table, member list, and group actions.
3030
*/
3131
export default async function GroupDetailPage({ params }: GroupDetailPageProps) {
3232
const { groupId } = await params;

apps/web/app/dashboard/page.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ import { GlassCard } from '../../components/ui/GlassCard';
1818
type Group = { id: string; name: string; currency: string };
1919

2020
/**
21-
* Format an amount given in cents into a localized currency string.
21+
* Format an amount in cents into a localized currency string.
2222
*
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.
23+
* If `cents` or `currency` is missing, returns "$0.00". For currency codes "USD",
24+
* "EUR", and "INR" the value is formatted using that currency; for any other code
25+
* the value is formatted using "USD" as a fallback.
2626
*
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`
27+
* @param cents - The amount in the smallest currency unit (e.g., cents) as a string or `null`
28+
* @param currency - An ISO currency code (e.g., "USD", "EUR", "INR") or `null`
2929
* @returns A formatted currency string (for example, "$1.23")
3030
*/
3131
function formatMoney(cents: string | null, currency: string | null): string {

apps/web/src/components/activity/ActivityFeed.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,10 @@ function labelFor(activity: ActivityDto): string {
6464
}
6565

6666
/**
67-
* Format an activity's monetary amount using cents and currency from its metadata.
67+
* Format an activity's monetary amount using cents and a currency code from its metadata.
6868
*
69-
* Uses `metadata.amountCents` or `metadata.totalAmountCents` (preferring `amountCents`) and the optional `metadata.currency`.
70-
*
71-
* @param activity - Activity object whose `metadata` should contain a string cents value and optional currency
72-
* @returns A formatted currency string when cents are present as a string; `null` if no string cents value is available. Values with currency `USD`, `EUR`, or `INR` are formatted with that currency; other currencies are formatted as `USD`.
69+
* @param activity - Activity whose `metadata` should contain cents as a string (`amountCents` or `totalAmountCents`) and may include a `currency` code
70+
* @returns A formatted currency string when cents are present as a string; `null` otherwise. Uses `metadata.currency` when it is `USD`, `EUR`, or `INR`; otherwise formats using `USD`.
7371
*/
7472
function formatAmount(activity: ActivityDto): string | null {
7573
const cents = activity.metadata?.amountCents ?? activity.metadata?.totalAmountCents;

apps/web/src/components/dashboard/ActivityList.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ import { ActivityDto, formatCurrencyFromCents } from '@fairshare/shared-types';
55
import { Clock, Receipt, Users, Plus, Trash2, UserPlus, Milestone, ArrowUpRight, BellRing, ActivitySquare } from 'lucide-react';
66
import { motion } from 'framer-motion';
77

8+
/**
9+
* Selects the icon component and Tailwind color classes for a given activity type.
10+
*
11+
* @param type - Activity event type used to determine the icon and color scheme
12+
* @returns An object containing `Icon` (the React icon component) and `color` (a Tailwind CSS class string)
13+
*/
814
function getIconForType(type: ActivityDto['type']) {
915
switch (type) {
1016
case 'expense_created': return { Icon: Plus, color: 'bg-emerald-500/10 text-emerald-400 border-emerald-500/20' };
@@ -64,6 +70,12 @@ function labelForActivity(activity: ActivityDto): string {
6470
}
6571
}
6672

73+
/**
74+
* Produce a concise subtitle describing an activity, including a formatted amount when available.
75+
*
76+
* @param activity - The activity record to generate the subtitle for
77+
* @returns A short subtitle string for the given activity. If the activity contains a monetary amount, the formatted amount is included in the returned text; otherwise a fixed descriptive phrase is returned.
78+
*/
6779
function subtitleForActivity(activity: ActivityDto): string {
6880
const amount = formatAmount(activity);
6981
switch (activity.type) {

apps/web/src/components/groups/GroupSummaryPanel.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { BalanceDto, CurrencyCode, GroupMemberSummaryDto, GroupSummaryDto, formatCurrencyFromCents } from '@fairshare/shared-types';
22

33
/**
4-
* Compute the total balance in cents for a given user.
4+
* Calculate the total amount in cents for the specified user.
55
*
6-
* @param balances - Array of ledger balance entries to consider; each entry's `amountCents` is included when its `userId` matches `userId`
7-
* @param userId - The user identifier whose balances will be summed
8-
* @returns The sum of `amountCents` for all balances with the given `userId`
6+
* @param balances - Ledger balance entries to sum
7+
* @param userId - User identifier to match against each entry's `userId`
8+
* @returns The sum of `amountCents` for all entries whose `userId` matches `userId`
99
*/
1010
function getNetBalanceCents(balances: BalanceDto[], userId: string) {
1111
return balances

0 commit comments

Comments
 (0)