diff --git a/api/src/graphql/partReactions.sdl.js b/api/src/graphql/partReactions.sdl.js index 4eaaa26..b27334e 100644 --- a/api/src/graphql/partReactions.sdl.js +++ b/api/src/graphql/partReactions.sdl.js @@ -13,6 +13,7 @@ export const schema = gql` type Query { partReactions: [PartReaction!]! partReaction(id: String!): PartReaction + partReactionsByPartId(partId: String!): [PartReaction!]! } input TogglePartReactionInput { diff --git a/api/src/services/partReactions/partReactions.js b/api/src/services/partReactions/partReactions.js index 9116014..6adac0f 100644 --- a/api/src/services/partReactions/partReactions.js +++ b/api/src/services/partReactions/partReactions.js @@ -15,6 +15,12 @@ export const partReaction = ({ id }) => { }) } +export const partReactionsByPartId = ({ partId }) => { + return db.partReaction.findMany({ + where: { partId: partId }, + }) +} + export const togglePartReaction = async ({ input }) => { // if write fails emote_userId_partId @@unique constraint, then delete it instead requireAuth() diff --git a/web/src/components/ReactionList/ReactionList.js b/web/src/components/ReactionList/ReactionList.js new file mode 100644 index 0000000..3aeaa8a --- /dev/null +++ b/web/src/components/ReactionList/ReactionList.js @@ -0,0 +1,72 @@ +import { useState } from 'react' +import Dialog from '@material-ui/core/Dialog' +import Tab from '@material-ui/core/Tab' +import Tabs from '@material-ui/core/Tabs' + +export const QUERY = gql` + query FIND_PART_BY_USERNAME_TITLE( + $userName: String! + $partTitle: String + $currentUserId: String + ) { + userPart: userName(userName: $userName) { + id + name + userName + bio + image + Part(partTitle: $partTitle) { + id + title + description + code + mainImage + createdAt + updatedAt + userId + Reaction { + emote + user { + userName + image + } + } + userReactions: Reaction(userId: $currentUserId) { + emote + } + Comment { + id + text + user { + userName + image + } + } + } + } + } +` + +const emojiMenu = ['all', '❤️', '👍', '😄', '🙌'] + +const ReactionList = ({}) => { + return ( + + {}} + variant="scrollable" + scrollButtons="off" + textColor="primary" + indicatorColor="primary" + > + {emojiMenu.map((emoji, i) => ( + + ))} + +
List
+
+ ) +} + +export default ReactionList diff --git a/web/src/components/ReactionList/ReactionList.test.js b/web/src/components/ReactionList/ReactionList.test.js new file mode 100644 index 0000000..e69de29