diff --git a/packages/app/components/feed/FeedCard.tsx b/packages/app/components/feed/FeedCard.tsx
index d7f02b17b..356c48b2f 100644
--- a/packages/app/components/feed/FeedCard.tsx
+++ b/packages/app/components/feed/FeedCard.tsx
@@ -11,6 +11,8 @@ import { formatNumber } from 'app/utils/formatNumber';
import { useAddFavorite, useFetchUserFavorites } from 'app/hooks/favorites';
import { useAuthUser } from 'app/auth/hooks';
import { useRouter } from 'app/hooks/router';
+import { useItemWeightUnit } from 'app/hooks/items';
+import { convertWeight } from 'app/utils/convertWeight';
interface CardProps {
type: string;
@@ -57,6 +59,7 @@ export default function Card({
useTheme();
const { addFavorite } = useAddFavorite();
+ const [weightUnit] = useItemWeightUnit();
const { data: favorites = [] } = useFetchUserFavorites(user?.id);
@@ -97,8 +100,7 @@ export default function Card({
const truncatedName = truncateString(name, 25);
const truncatedDestination = truncateString(destination, 25);
- // const formattedWeight = formatNumber(total_weight); // TODO convert to user preference once implemented
- const formattedWeight = total_weight;
+ const formattedWeight = convertWeight(total_weight, 'g', weightUnit);
let numberOfNights;
if (duration) numberOfNights = JSON.parse(duration).numberOfNights;
@@ -184,7 +186,7 @@ export default function Card({
{type === 'pack' && (
- Total Weight: {formattedWeight}
+ Total Weight: {formatNumber(formattedWeight)} {weightUnit}
)}
diff --git a/packages/app/hooks/items/index.ts b/packages/app/hooks/items/index.ts
index 45e4966a6..e36816bb6 100644
--- a/packages/app/hooks/items/index.ts
+++ b/packages/app/hooks/items/index.ts
@@ -2,3 +2,4 @@ export { useAddItem } from './useAddItem';
export { useItems } from './useItems';
export { useDeleteItem } from './useDeleteItem';
export { useItemsUpdater } from './useItemsUpdater';
+export { useItemWeightUnit } from './useItemWeightUnit';
diff --git a/packages/app/hooks/items/useItemWeightUnit.ts b/packages/app/hooks/items/useItemWeightUnit.ts
new file mode 100644
index 000000000..52adfecd3
--- /dev/null
+++ b/packages/app/hooks/items/useItemWeightUnit.ts
@@ -0,0 +1,17 @@
+import { useState } from 'react';
+import { useAuthUser } from 'app/auth/hooks';
+
+type WeightUnit = 'g' | 'kg' | 'oz' | 'lb' | 'lbs';
+
+export const useItemWeightUnit = (): [
+ WeightUnit,
+ React.Dispatch>,
+] => {
+ const authUser = useAuthUser();
+ const userPreferWeight = authUser.preferredWeight as WeightUnit | null;
+ const [weightUnit, setWeightUnit] = useState(
+ userPreferWeight || 'kg',
+ );
+
+ return [weightUnit, setWeightUnit];
+};
diff --git a/packages/app/hooks/packs/usePackTable.tsx b/packages/app/hooks/packs/usePackTable.tsx
index e49528416..9cb2fab84 100644
--- a/packages/app/hooks/packs/usePackTable.tsx
+++ b/packages/app/hooks/packs/usePackTable.tsx
@@ -3,8 +3,7 @@ import { ItemCategoryEnum } from 'app/constants/itemCategory';
import { convertWeight } from 'app/utils/convertWeight';
import { useAuthUser } from 'app/auth/hooks';
import { useDuplicatePackItem } from './useDuplicatePackItem';
-
-type WeightUnit = 'g' | 'kg' | 'oz' | 'lb' | 'lbs';
+import { useItemWeightUnit } from 'app/hooks/items';
export const usePackTable = ({
currentPack,
@@ -21,6 +20,7 @@ export const usePackTable = ({
}
const [checkedItems, setCheckedItems] = useState([...ids]);
+ const [weightUnit, setWeightUnit] = useItemWeightUnit();
const handleDuplicate = () => {
const data = {
@@ -32,7 +32,6 @@ export const usePackTable = ({
duplicatePackItem(data);
};
- const [weightUnit, setWeightUnit] = useState('g');
const data = currentPack?.items;
let totalFoodWeight = 0;
let totalWaterWeight = 0;
diff --git a/server/src/services/item/addGlobalItemToPackService.ts b/server/src/services/item/addGlobalItemToPackService.ts
index 021446038..4be07ad27 100644
--- a/server/src/services/item/addGlobalItemToPackService.ts
+++ b/server/src/services/item/addGlobalItemToPackService.ts
@@ -19,7 +19,6 @@ export const addGlobalItemToPackService = async (
): Promise