Skip to content

Commit cb077ea

Browse files
committed
🎨 refactor(frontend): Reformat with prettier
1 parent 56a224f commit cb077ea

File tree

8 files changed

+44
-31
lines changed

8 files changed

+44
-31
lines changed

src/frontend-nextjs/components/Timeline/Post.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export function Post(props: PostProps) {
7373
</CardBody>
7474
<CardFooter className='gap-3 justify-between px-3'>
7575
<div className='flex items-center'>
76-
<PostSpamPrediction isSpamPredictedLabel={props.isSpamPredictedLabel} postId={props.postId}/>
76+
<PostSpamPrediction isSpamPredictedLabel={props.isSpamPredictedLabel} postId={props.postId} />
7777
</div>
7878

7979
{isLoggedIn && (

src/frontend-nextjs/components/Timeline/PostSpamPrediction.tsx

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
'use client';
22

33
import React from 'react';
4-
import {Alert} from "@heroui/react";
4+
import { Alert } from '@heroui/react';
5+
import { ErrorBoundary } from 'react-error-boundary';
56

6-
import {SpamPredictionUserRating} from "@/components/Timeline/SpamPredictionUserRating";
7-
import {useCheckLogin} from "@/hooks/queries/useCheckLogin";
8-
import {ErrorBoundary} from "react-error-boundary";
9-
import {ErrorCard} from "@/components/ErrorCard";
7+
import { SpamPredictionUserRating } from '@/components/Timeline/SpamPredictionUserRating';
8+
import { useCheckLogin } from '@/hooks/queries/useCheckLogin';
9+
import { ErrorCard } from '@/components/ErrorCard';
1010

1111
export interface PostSpamPredictionProps {
1212
isSpamPredictedLabel?: boolean | null;
@@ -21,13 +21,18 @@ export function PostSpamPrediction(props: Readonly<PostSpamPredictionProps>) {
2121

2222
return (
2323
<div key={color} className='w-full flex items-center my-3'>
24-
<div className="w-full">
24+
<div className='w-full'>
2525
<Alert color={color}>
26-
<div className="flex w-full items-center justify-between gap-3">
27-
<div className="font-semibold">{props.isSpamPredictedLabel? "Potential Spam Detected" : "No Spam Detected"}</div>
26+
<div className='flex w-full items-center justify-between gap-3'>
27+
<div className='font-semibold'>
28+
{props.isSpamPredictedLabel ? 'Potential Spam Detected' : 'No Spam Detected'}
29+
</div>
2830
{isLoggedIn && (
2931
<ErrorBoundary fallbackRender={(props) => <ErrorCard message={props.error.message} />}>
30-
<SpamPredictionUserRating isSpamPredictedLabel={props.isSpamPredictedLabel} postId={props.postId} />
32+
<SpamPredictionUserRating
33+
isSpamPredictedLabel={props.isSpamPredictedLabel}
34+
postId={props.postId}
35+
/>
3136
</ErrorBoundary>
3237
)}
3338
</div>
Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
'use client';
22

33
import React from 'react';
4-
import {BsHandThumbsDown, BsHandThumbsDownFill, BsHandThumbsUp, BsHandThumbsUpFill} from 'react-icons/bs';
4+
import { BsHandThumbsDown, BsHandThumbsDownFill, BsHandThumbsUp, BsHandThumbsUpFill } from 'react-icons/bs';
55
import { Button, Spinner } from '@heroui/react';
6-
import {useSpamPredictionUserRating} from "@/hooks/queries/useSpamPredictionUserRating";
7-
import {useRateSpamPrediction} from "@/hooks/mutations/useRateSpamPrediction";
6+
7+
import { useSpamPredictionUserRating } from '@/hooks/queries/useSpamPredictionUserRating';
8+
import { useRateSpamPrediction } from '@/hooks/mutations/useRateSpamPrediction';
89

910
export interface SpamPredictionUserRatingProps {
1011
isSpamPredictedLabel?: boolean | null;
1112
postId: string;
1213
}
1314

1415
export function SpamPredictionUserRating(props: Readonly<SpamPredictionUserRatingProps>) {
15-
16-
const { data: spamPredictionUserRatingData, isLoading} = useSpamPredictionUserRating(props.postId);
16+
const { data: spamPredictionUserRatingData, isLoading } = useSpamPredictionUserRating(props.postId);
1717
const { handleSpamPredictionUpvote, handleSpamPredictionDownvote } = useRateSpamPrediction(props.postId);
1818

1919
if (isLoading) {
@@ -22,15 +22,22 @@ export function SpamPredictionUserRating(props: Readonly<SpamPredictionUserRatin
2222

2323
return (
2424
<div>
25-
<Button className=' text-default-600 bg-transparent' name='upvoteSpamRating' onPress={() => handleSpamPredictionUpvote()}>
25+
<Button
26+
className=' text-default-600 bg-transparent'
27+
name='upvoteSpamRating'
28+
onPress={() => handleSpamPredictionUpvote()}
29+
>
2630
<p>{spamPredictionUserRatingData?.spamPredictionUserUpvotes}</p>
2731
{spamPredictionUserRatingData?.isUpvotedByUser ? <BsHandThumbsUpFill /> : <BsHandThumbsUp />}
2832
</Button>
29-
<Button className=' text-default-600 bg-transparent' name='downvoteSpamRating' onPress={() => handleSpamPredictionDownvote()}>
33+
<Button
34+
className=' text-default-600 bg-transparent'
35+
name='downvoteSpamRating'
36+
onPress={() => handleSpamPredictionDownvote()}
37+
>
3038
<p>{spamPredictionUserRatingData?.spamPredictionUserDownvotes}</p>
3139
{spamPredictionUserRatingData?.isDownvotedByUser ? <BsHandThumbsDownFill /> : <BsHandThumbsDown />}
3240
</Button>
3341
</div>
34-
)
35-
42+
);
3643
}

src/frontend-nextjs/components/Timeline/Timeline.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ export function Timeline({ posts, isLoading }: TimelineProps) {
2727
<Post
2828
body={post.body}
2929
imageUrl={post.imageUrl}
30+
isSpamPredictedLabel={post.isSpamPredictedLabel}
3031
postId={post.postId}
3132
timestamp={post.timestamp}
3233
username={post.username}
33-
isSpamPredictedLabel={post.isSpamPredictedLabel}
3434
/>
3535
<Spacer y={4} />
3636
</div>

src/frontend-nextjs/hooks/mutations/useRateSpamPrediction.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useMutation, useQueryClient } from '@tanstack/react-query';
22

3-
import {handleSpamPredictionDownvote, handleSpamPredictionUpvote} from '@/services/SpamPredictionVotingService';
3+
import { handleSpamPredictionDownvote, handleSpamPredictionUpvote } from '@/services/SpamPredictionVotingService';
44
import { QUERY_KEYS } from '@/enums/queryKeys';
55

66
export function useRateSpamPrediction(postId: string) {
@@ -22,6 +22,6 @@ export function useRateSpamPrediction(postId: string) {
2222

2323
return {
2424
handleSpamPredictionUpvote: handleUpvoteMutation.mutate,
25-
handleSpamPredictionDownvote: handleDownvoteMutation.mutate
25+
handleSpamPredictionDownvote: handleDownvoteMutation.mutate,
2626
};
2727
}

src/frontend-nextjs/hooks/queries/useSpamPredictionUserRating.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import path from 'path';
22

3-
import {useQuery} from '@tanstack/react-query';
3+
import { useQuery } from '@tanstack/react-query';
44

5-
import {QUERY_KEYS} from '@/enums/queryKeys';
6-
import {BASE_PATH} from '@/constants';
5+
import { QUERY_KEYS } from '@/enums/queryKeys';
6+
import { BASE_PATH } from '@/constants';
77

88
type SpamPredictionUserRating = {
99
spamPredictionUserUpvotes: number;

src/frontend-nextjs/services/api/SpamPredictionVotesService.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
import {getMicroblogApi} from '@/axios';
2-
import {getJwtFromCookie} from '@/services/api/AuthService';
3-
import type {AxiosRequestConfig} from 'axios';
4-
import {AxiosHeaders} from 'axios';
1+
import { AxiosHeaders, AxiosRequestConfig } from 'axios';
2+
3+
import { getMicroblogApi } from '@/axios';
4+
import { getJwtFromCookie } from '@/services/api/AuthService';
55

66
async function withJwtCookie(): Promise<AxiosRequestConfig> {
77
const jwt = await getJwtFromCookie();
88

99
const headers = new AxiosHeaders();
10+
1011
headers.set('Cookie', `jwt=${jwt}`);
1112

12-
return {headers};
13+
return { headers };
1314
}
1415

1516
export async function fetchSpamPredictionUserRating(postId: string): Promise<any> {

src/microblog-service/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM gradle:6.9.1-jdk11 as builder
1+
FROM gradle:6.9.1-jdk11 AS builder
22

33
COPY --chown=gradle:gradle . /home/gradle/src
44
WORKDIR /home/gradle/src

0 commit comments

Comments
 (0)