diff --git a/packages/api/src/postComment.ts b/packages/api/src/postComment.ts index e7693bc5..73764c89 100644 --- a/packages/api/src/postComment.ts +++ b/packages/api/src/postComment.ts @@ -1,7 +1,7 @@ import { ApiRequest, PostCommentRequest, PostCommentResponse } from './types'; export async function postComment({ - questionOptionId, + optionId, value, serverUrl, }: ApiRequest): Promise { @@ -12,7 +12,7 @@ export async function postComment({ headers: { 'Content-type': 'application/json', }, - body: JSON.stringify({ value, questionOptionId }), + body: JSON.stringify({ value, optionId }), }); if (!response.ok) { diff --git a/packages/api/src/types/Comments.ts b/packages/api/src/types/Comments.ts index ae006265..e8b931bb 100644 --- a/packages/api/src/types/Comments.ts +++ b/packages/api/src/types/Comments.ts @@ -4,7 +4,7 @@ export type Comment = { updatedAt: Date; userId: string | null; value: string; - questionOptionId: string | null; + optionId: string | null; }; export type GetCommentsRequest = { @@ -22,7 +22,7 @@ export type GetCommentsResponse = (Comment & { export type PostCommentRequest = { value: string; - questionOptionId: string; + optionId: string; }; export type DeleteCommentRequest = { diff --git a/packages/api/src/types/Options.ts b/packages/api/src/types/Options.ts index 8c0dbfe6..e13b8cdf 100644 --- a/packages/api/src/types/Options.ts +++ b/packages/api/src/types/Options.ts @@ -3,9 +3,9 @@ export type Option = { createdAt: string; updatedAt: string; questionId: string; - optionTitle: string; + title: string; userId?: string; - optionSubTitle?: string; + subTitle?: string; accepted: boolean; data: unknown; fundingRequest: string; diff --git a/packages/api/src/types/UserOptions.ts b/packages/api/src/types/UserOptions.ts index 6208f635..f6afb6f9 100644 --- a/packages/api/src/types/UserOptions.ts +++ b/packages/api/src/types/UserOptions.ts @@ -5,8 +5,8 @@ export type GetUserOptionsResponse = { userId: string | null; registrationId: string | null; questionId: string; - optionTitle: string; - optionSubTitle: string | null; + title: string; + subTitle: string | null; accepted: boolean | null; voteScore: string; fundingRequest: string | null; diff --git a/packages/berlin/src/pages/Account.tsx b/packages/berlin/src/pages/Account.tsx index 782a522d..f6e51c37 100644 --- a/packages/berlin/src/pages/Account.tsx +++ b/packages/berlin/src/pages/Account.tsx @@ -141,7 +141,7 @@ function AccountHub({ user }: { user: GetUserResponse | null | undefined }) { key={option.id} to={`/events/${cycles.find((c) => c.data?.id === option.question.cycleId)?.data?.eventId}/cycles/${option.question.cycleId}/options/${option.id}`} > - - {option.optionTitle} + - {option.title} ))} diff --git a/packages/berlin/src/pages/Comments.tsx b/packages/berlin/src/pages/Comments.tsx index 2b221805..607b45c3 100644 --- a/packages/berlin/src/pages/Comments.tsx +++ b/packages/berlin/src/pages/Comments.tsx @@ -7,17 +7,6 @@ import { useMemo, useState } from 'react'; // API import { fetchOption, fetchComments, postComment, fetchOptionUsers } from 'api'; -// Hooks -// import useUser from '../hooks/useUser'; - -// Utils -// import { -// handleSaveVotes, -// handleAvailableHearts, -// handleLocalUnVote, -// handleLocalVote, -// } from '../utils/voting'; - // Components import { Body } from '../components/typography/Body.styled'; import { Bold } from '../components/typography/Bold.styled'; @@ -31,9 +20,6 @@ import CommentsColumns from '../components/columns/comments-columns'; import CommentsTable from '../components/tables/comment-table'; import Icon from '../components/icon'; import Textarea from '../components/textarea'; -// import { INITIAL_HEARTS } from '../utils/constants'; - -// type LocalUserVotes = { optionId: string; numOfVotes: number }[]; function Comments() { const queryClient = useQueryClient(); @@ -89,7 +75,7 @@ function Comments() { const handlePostComment = () => { if (optionId && comment) { mutateComments({ - questionOptionId: optionId, + optionId: optionId, value: comment, serverUrl: import.meta.env.VITE_SERVER_URL, }); @@ -105,8 +91,8 @@ function Comments() { - {option?.optionTitle} - {option?.optionSubTitle} + {option?.title} + {option?.subTitle} Lead author: {optionUsers?.user?.firstName} {optionUsers?.user?.lastName} {coauthors && coauthors.length > 0 && (