From 43f494078ea541af9ec416d731bf52f67dbba2e9 Mon Sep 17 00:00:00 2001 From: seanquiambao Date: Mon, 19 Aug 2024 16:15:48 -0700 Subject: [PATCH 1/2] finished styling for comment --- assets/icons/Send.svg | 3 +++ components/dashboard/comment.tsx | 30 ++++++++++++++++++++++++++++++ components/dashboard/index.tsx | 11 ++++++++--- 3 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 assets/icons/Send.svg create mode 100644 components/dashboard/comment.tsx diff --git a/assets/icons/Send.svg b/assets/icons/Send.svg new file mode 100644 index 0000000..5e7e2e3 --- /dev/null +++ b/assets/icons/Send.svg @@ -0,0 +1,3 @@ + + + diff --git a/components/dashboard/comment.tsx b/components/dashboard/comment.tsx new file mode 100644 index 0000000..5736e56 --- /dev/null +++ b/components/dashboard/comment.tsx @@ -0,0 +1,30 @@ +import { View, Pressable, TextInput, InputAccessoryView } from "react-native"; +import { Image, ImageSource } from "expo-image"; +import Send from "@/assets/icons/Send.svg"; +interface props { + photo: ImageSource; +} + +const Comment = ({ photo }: props) => { + return ( + + + + + + + + + + + + ); +}; + +export default Comment; diff --git a/components/dashboard/index.tsx b/components/dashboard/index.tsx index 24c149e..ce9c8b3 100644 --- a/components/dashboard/index.tsx +++ b/components/dashboard/index.tsx @@ -6,7 +6,7 @@ import BottomSheet, { } from "@gorhom/bottom-sheet"; import { Image } from "expo-image"; import Like from "@/assets/icons/Like.svg"; -import Comment from "@/assets/icons/Comment.svg"; +import CommentIcon from "@/assets/icons/Comment.svg"; import Beat from "@/components/global/beat"; import moment from "moment"; import MapView from "react-native-maps"; @@ -15,6 +15,7 @@ import Entypo from "@expo/vector-icons/Entypo"; import { comment, drop, beat } from "@/types"; import Toolbar from "./toolbar"; import Toaster from "@/utils/toast"; +import Comment from "@/components/dashboard/comment"; const comments: comment[] = [ { @@ -173,7 +174,7 @@ const DashboardScreen = () => { - + { - + { )} + )} From 0e40073f1d4b816907655bf4aa8d452c896d55c2 Mon Sep 17 00:00:00 2001 From: seanquiambao Date: Mon, 19 Aug 2024 17:04:15 -0700 Subject: [PATCH 2/2] finished functionality --- components/dashboard/comment.tsx | 32 ++++++++++++++++++++++++++++++-- components/dashboard/index.tsx | 4 ++-- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/components/dashboard/comment.tsx b/components/dashboard/comment.tsx index 5736e56..418bc4a 100644 --- a/components/dashboard/comment.tsx +++ b/components/dashboard/comment.tsx @@ -1,11 +1,35 @@ import { View, Pressable, TextInput, InputAccessoryView } from "react-native"; import { Image, ImageSource } from "expo-image"; import Send from "@/assets/icons/Send.svg"; +import { beat, drop, comment } from "@/types"; +import { useState } from "react"; interface props { photo: ImageSource; + beat: Record | (beat & drop); + setBeat: any; } -const Comment = ({ photo }: props) => { +const Comment = ({ photo, beat, setBeat }: props) => { + const [message, setMessage] = useState(""); + + const handlePress = () => { + if (message.length === 0) return; + console.log(message); + const NEWCOMMENT: comment = { + timestamp: new Date(), + username: "bobby", + likes: 150, + comment: message, + photo: { + uri: "https://media.licdn.com/dms/image/C5603AQFRF-WuzzVSPw/profile-displayphoto-shrink_200_200/0/1648079904789?e=2147483647&v=beta&t=iQ5MB_agi9aY0JUDxSXlAEa3icdQWn8l9twByRP5ItQ", + }, + }; + + setBeat({ + ...beat, + comments: [NEWCOMMENT, ...(beat.comments ? beat.comments : [])], + }); + }; return ( @@ -17,8 +41,12 @@ const Comment = ({ photo }: props) => { - + diff --git a/components/dashboard/index.tsx b/components/dashboard/index.tsx index ce9c8b3..17b2a15 100644 --- a/components/dashboard/index.tsx +++ b/components/dashboard/index.tsx @@ -92,7 +92,7 @@ const beats: (drop & beat)[] = [ artist: "G(I)-DLE", description: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.", - comments: comments.slice(0, 1), + comments: [], }, { uid: "1", @@ -295,7 +295,7 @@ const DashboardScreen = () => { )} - + )}