From a8469d5842d5ae114fcca8ca790da62cd4148b9a Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Thu, 24 Oct 2024 05:31:04 -0400 Subject: [PATCH 1/2] ci(alpha): updating the expo lcagents workflow --- .github/workflows/ci-alpha.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-alpha.yml b/.github/workflows/ci-alpha.yml index 548a9050d..904008923 100644 --- a/.github/workflows/ci-alpha.yml +++ b/.github/workflows/ci-alpha.yml @@ -165,11 +165,11 @@ jobs: API_TOKEN_GITHUB: ${{ secrets.UNITY_PAT }} with: source_file: 'dist/apps/expo-lcagents/' - destination_repo: 'kbve/lc-agents.com' + destination_repo: 'KBVE/lc-agents.com' destination_folder: '/docs' destination_branch: 'main' destination_branch_create: 'patch-kbve-lcagents-deploy-${{ needs.globals.outputs.sha256head }}' - user_email: '5599058+h0lybyte@users.noreply.github.com' + user_email: 'h0lybyte@users.noreply.github.com' user_name: 'h0lybyte' commit_message: ${{ github.event.head_commit.message }} rsync_option: '-avrh --delete' From 0a6a0a9b756215ddb2efe3fdd6a57cc3ecf51798 Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Thu, 24 Oct 2024 05:31:24 -0400 Subject: [PATCH 2/2] feat(expo-bbq): updated instacard component --- apps/expo-lcagents/src/app/consulting.tsx | 70 +++++++----- .../src/components/card/InstaCard.tsx | 107 +++++++++++------- 2 files changed, 107 insertions(+), 70 deletions(-) diff --git a/apps/expo-lcagents/src/app/consulting.tsx b/apps/expo-lcagents/src/app/consulting.tsx index 76162d735..3ffcc9d66 100644 --- a/apps/expo-lcagents/src/app/consulting.tsx +++ b/apps/expo-lcagents/src/app/consulting.tsx @@ -14,6 +14,26 @@ const Consulting = () => { const navigation = useNavigation(); const router = useRouter(); + const postData = { + username: 'john_doe', + location: 'San Francisco', + avatarUrl: 'https://example.com/avatar.jpg', + postImageUrl: + 'https://images.unsplash.com/photo-1729326688022-865844a8baa9?q=80&w=800&auto=format&fit=crop&ixlib=rb-4.0.3&', + likes: [ + { avatarUrl: 'https://example.com/like1.jpg', name: 'alice' }, + { avatarUrl: 'https://example.com/like2.jpg', name: 'bob' }, + ], + caption: 'This is a great day!', + }; + + const postId = '01JAYT7NKZPW7BXYKDHDWDHMVC'; + + const handleAction = (actionState: string, content: string) => { + console.log(`Action: ${actionState}, Content: ${content}`); + // Handle the action and content here (e.g., update state or UI) + }; + // Memoizing navigation update function const updateNavigationOptions = useCallback(() => { navigation.setOptions({ @@ -41,7 +61,6 @@ const Consulting = () => { ai="center" padding="$1" flexDirection="column" - $gtLg={{ flexDirection: 'row', // For screens greater than large justifyContent: 'space-between', @@ -52,13 +71,13 @@ const Consulting = () => { { Welcome to the Consultants of LC Agents - - - - - - - - - - + - - - + + + + ); }; diff --git a/packages/expo-bbq/src/components/card/InstaCard.tsx b/packages/expo-bbq/src/components/card/InstaCard.tsx index f9a402029..aa5bc7f87 100644 --- a/packages/expo-bbq/src/components/card/InstaCard.tsx +++ b/packages/expo-bbq/src/components/card/InstaCard.tsx @@ -1,4 +1,4 @@ -import React, { ReactNode, useState } from 'react'; +import React, { memo, useCallback } from 'react'; import { YStack, XStack, @@ -24,10 +24,37 @@ interface PopoverDemoProps extends PopoverProps { Icon?: any; Name?: string; shouldAdapt?: boolean; + onAction: (actionState: string, content: string) => void; } -export function InstaCard() { - const [shouldAdapt, setShouldAdapt] = useState(true); +interface InstaCardProps { + username: string; + location: string; + avatarUrl: string; + postImageUrl: string; + likes: Array<{ avatarUrl: string; name: string }>; + caption: string; + ulid: string; + onAction: (actionState: string, content: string) => void; +} + +// Memoizing InstaCard to avoid unnecessary re-renders +export const InstaCard = memo(function InstaCard({ + username, + location, + avatarUrl, + postImageUrl, + likes, + caption, + ulid, + onAction, +}: InstaCardProps) { + const handleAction = useCallback( + (actionState: string, content: string) => { + onAction(actionState, content); + }, + [onAction], // Ensures the callback only changes if onAction changes + ); return ( - leroy_jenkins72 + {username} - Somewhere + {location} @@ -65,12 +90,13 @@ export function InstaCard() { placement="bottom" Icon={MoreVertical} Name="options-popover" + onAction={handleAction} /> {/* Image */} {/* Likes Section */} - - - - - - - - - + {likes.map((like, index) => ( + + + + ))} - Liked by Mamba UI and{' '} - 86 others + Liked by{' '} + {likes[0]?.name}{' '} + and{' '} + + {likes.length} others + {/* Caption */} - leroy_jenkins72 - Nemo ea quasi debitis impedit! + {username} + {caption} @@ -153,7 +169,7 @@ export function InstaCard() { ); -} +}); // PopoverDemo component @@ -161,12 +177,19 @@ function PopoverDemo({ Icon, Name, shouldAdapt = true, + onAction, ...props }: PopoverDemoProps) { + const handleClick = () => { + if (Name) { + onAction(Name, `${Name} content is displayed`); + } + }; + return ( -