Skip to content

Commit

Permalink
Feed Cards and Global Checklist fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ata Shaikh committed Apr 27, 2024
1 parent 1bdef1f commit 5b281d4
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 11 deletions.
12 changes: 11 additions & 1 deletion packages/app/components/feed/FeedCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export default function Card({
createdAt,
owners,
duration,
itemPacks,
}: CardProps) {
const user = useAuthUser();
const { enableDarkMode, enableLightMode, isDark, isLight, currentTheme } =
Expand Down Expand Up @@ -98,7 +99,11 @@ 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 = total_weight ?? 0;
const quantity = itemPacks?.reduce(
(accumulator, currentValue) => accumulator + currentValue?.item?.quantity ?? 0,
0,
) ?? 0;
let numberOfNights;

if (duration) numberOfNights = JSON.parse(duration).numberOfNights;
Expand Down Expand Up @@ -187,6 +192,11 @@ export default function Card({
Total Weight: {formattedWeight}
</RText>
)}
{type === 'pack' && (
<RText fontSize="$1" color="mediumpurple" ml={-0.5} mt={-1}>
Total Quantity: {quantity}
</RText>
)}

{type === 'trip' && (
<RText fontSize="$1" color="mediumpurple" ml={-0.5} mt={-1}>
Expand Down
2 changes: 1 addition & 1 deletion packages/app/components/feed/FeedSearchFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ const FeedSearchFilter = ({
onValueChange={handleSortChange}
placeholder="Sort By"
style={styles.dropdown}
width={150}
width={160}
/>
</RStack>
{(feedType === 'userPacks' || feedType === 'userTrips') && (
Expand Down
10 changes: 5 additions & 5 deletions packages/app/components/itemtable/itemTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export const ItemsTable = ({
<RButton
style={{
width: 50,
backgroundColor: '#0284c7',
backgroundColor: page < 2 ? 'gray' : '#0284c7',
borderRadius: 5,
borderColor: page < 2 ? 'gray' : '#0284c7',
borderWidth: 1,
Expand All @@ -222,16 +222,16 @@ export const ItemsTable = ({
<AntDesign
name="left"
size={16}
color={page < 2 ? 'gray' : 'white'}
color='white'
/>
</RButton>
<RButton
style={{
marginLeft: 10,
width: 50,
backgroundColor: '#0284c7',
backgroundColor: page === totalPages ? 'gray' : '#0284c7',
borderRadius: 5,
borderColor: page === totalPages ? 'gray' : 'white',
borderColor: page === totalPages ? 'gray' : '#0284c7',
borderWidth: 1,
borderStyle: 'solid',
}}
Expand All @@ -241,7 +241,7 @@ export const ItemsTable = ({
<AntDesign
name="right"
size={16}
color={page === totalPages ? 'gray' : 'white'}
color='white'
/>
</RButton>
</View>
Expand Down
4 changes: 2 additions & 2 deletions packages/app/constants/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

import { NODE_ENV, API_URL, NEXT_PUBLIC_API_URL } from '@env';

let api = 'http://localhost:8787/api';
let api = 'http://localhost:8080/api';

if (NODE_ENV === 'production') {
// api = API_URL;
api = NEXT_PUBLIC_API_URL;
} else {
api = 'http://localhost:8787/api';
api = 'http://localhost:8080/api';
// api = "https://packrat.onrender.com";
}

Expand Down
2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"prisma:generate": "npx prisma generate --schema=src/prisma/schema.prisma --data-proxy",
"prisma:validate": "npx prisma validate --schema=src/prisma/schema.prisma",
"prisma:pull": "npx prisma db pull --schema=src/prisma/schema.prisma",
"wrangler:dev": "npx wrangler dev --port 8787 --local",
"wrangler:dev": "npx wrangler dev --port 8080 --local",
"wrangler:dev2": "npx wrangler pages dev --proxy 3001 --local --persist-to=./db.sqlite --d1=DB -- npm run dev",
"generate": "drizzle-kit generate:sqlite --schema=./src/db/schema.ts --out=./migrations",
"migrate": "wrangler d1 migrations apply production",
Expand Down
2 changes: 1 addition & 1 deletion server/src/swaggerOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const options = {

servers: [
{
url: 'http://localhost:8787',
url: 'http://localhost:8080',
description: 'Development server',
},
{
Expand Down

0 comments on commit 5b281d4

Please sign in to comment.