Skip to content

Commit

Permalink
fixed based on review
Browse files Browse the repository at this point in the history
  • Loading branch information
NazireAta committed Dec 14, 2024
1 parent 4042738 commit 6882536
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 26 deletions.
3 changes: 2 additions & 1 deletion frontend/src/routes/profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { Link, useParams } from "react-router-dom";

import { Badge } from "@/components/ui/badge";
import { Textarea } from "@/components/ui/textarea";
import placeholderProfile from "@/assets/placeholder_profile.png";

export default function Profile() {
const { userId = "" } = useParams<{ userId: string }>();
Expand Down Expand Up @@ -80,7 +81,7 @@ export default function Profile() {
<Avatar className="h-24 w-24">
<AvatarImage
alt={`Profile picture of ${profile.username}`}
src="frontend\src\assets\placeholder_profile.png"
src={placeholderProfile}
/>
</Avatar>
<div className="flex space-x-4 text-center">
Expand Down
1 change: 0 additions & 1 deletion frontend/src/routes/question.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { DifficultyBar } from "@/components/DifficultyBar";




const mockQuestionData = vi.hoisted(
() =>
({
Expand Down
5 changes: 2 additions & 3 deletions mobile/app/(tabs)/profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import useAuthStore from "@/services/auth";
import { Link, router } from "expo-router";
import { ChevronDownIcon, Plus, Bookmark, MenuIcon, LogOutIcon } from "lucide-react-native";
import { useEffect, useState } from "react";
import placeholderProfile from "@/assets/images/placeholder_profile.png";

export default function Profile() {
return <UserProfile userId="me" />;
Expand Down Expand Up @@ -141,9 +142,7 @@ export function UserProfile({ userId }: { userId: string }) {

<HStack space="lg" className="items-center justify-between py-4">
<Image
source={{
uri: "frontend\src\assets\placeholder_profile.png",
}}
source={profile.profilePicture ? {uri: profile.profilePicture} : placeholderProfile}
alt={`Profile picture of ${profile.username}`}
style={{ width: 96, height: 96, borderRadius: 48 }}
/>
Expand Down
9 changes: 4 additions & 5 deletions mobile/app/question/[questionId].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import {
} from "lucide-react-native";
import { useEffect, useState } from "react";
import { ScrollView, View } from "react-native";
import placeholderProfile from "@/assets/placeholder_profile.png";
import placeholderProfile from "@/assets/images/placeholder_profile.png";

export default function QuestionPage() {
const { questionId } = useLocalSearchParams();
Expand Down Expand Up @@ -259,10 +259,9 @@ export default function QuestionPage() {
className="flex flex-row items-center gap-4"
>
<Image
source={{
uri:
question.author.profilePicture || placeholderProfile,
}}
source={
question.author.profilePicture ? {uri: question.author.profilePicture} : placeholderProfile
}
alt={question.author.name}
width={32}
height={32}
Expand Down
Binary file added mobile/assets/images/placeholder_profile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions mobile/components/AnswerCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ArrowRight, CornerDownRight, Star } from "lucide-react-native";
import React from "react";
import { View } from "react-native";
import { ContentWithSnippets } from "./ContentWithSnippets";
import placeholderProfile from "@/assets/placeholder_profile.png";
import placeholderProfile from "@/assets/images/placeholder_profile.png";

interface AnswerCardProps {
id: string;
Expand Down Expand Up @@ -47,7 +47,7 @@ export const AnswerCard: React.FC<AnswerCardProps> = ({
<View className="flex items-center justify-between">
<Link href={`/users/${author.id}`}>
<Image
source={{ uri: author?.profilePicture || placeholderProfile }}
source={author.profilePicture ? {uri: author.profilePicture} : placeholderProfile}
alt={author.name}
className="rounded-full object-cover"
/>
Expand Down
7 changes: 2 additions & 5 deletions mobile/components/AnswerItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ThumbsDown, ThumbsUp } from "lucide-react-native";
import React from "react";
import { View } from "react-native";
import { ContentWithSnippets } from "./ContentWithSnippets";
import placeholderProfile from "@/assets/placeholder_profile.png";
import placeholderProfile from "@/assets/images/placeholder_profile.png";

interface AnswerItemProps {
answer: AnswerDetails;
Expand Down Expand Up @@ -70,10 +70,7 @@ export const AnswerItem: React.FC<AnswerItemProps> = ({
className="flex items-center gap-2"
>
<Image
source={{
uri:
answer.author?.profilePicture || placeholderProfile,
}}
source={answer.author.profilePicture ? {uri: answer.author.profilePicture} : placeholderProfile}
alt={answer.author?.name}
className="h-8 w-8 rounded-full object-cover"
/>
Expand Down
6 changes: 2 additions & 4 deletions mobile/components/QuestionCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { DifficultyLevel } from "@/services/api/programmingForumSchemas";
import { Link } from "expo-router";
import { ArrowRight, MessageSquare, Star, StarsIcon } from "lucide-react-native";
import React from "react";
import placeholderProfile from "@/assets/placeholder_profile.png";
import placeholderProfile from "@/assets/images/placeholder_profile.png";

interface QuestionCardProps {
id: string;
Expand Down Expand Up @@ -63,9 +63,7 @@ export const QuestionCard: React.FC<QuestionCardProps> = ({
<HStack className="flex items-center gap-2">
<Link href={`/users/${author.id}`} className="h-10 w-10">
<Image
source={{
uri: author?.profilePicture || placeholderProfile,
}}
source={author.profilePicture ? {uri: author.profilePicture} : placeholderProfile}
alt={author.name || "Author"}
className="h-full w-full rounded-full object-cover"
/>
Expand Down
2 changes: 1 addition & 1 deletion mobile/services/api/programmingForumSchemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export type UserProfileUpdate = {
};

/**
* @example {"id":1,"username":"john_doe","reputationPoints":100,"profilePicture":"frontend\src\assets\placeholder_profile.png","name":"John Doe"}
* @example {"id":1,"username":"john_doe","reputationPoints":100,"profilePicture":"@/assets/images/placeholder_profile.png","name":"John Doe"}
*/
export type UserSummary = {
id: number;
Expand Down
6 changes: 3 additions & 3 deletions mobile/services/temporaryMocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const temporaryMocks = {
id: 2,
username: "john_doe",
reputationPoints: 100,
profilePicture: "frontend\src\assets\placeholder_profile.png",
profilePicture: "@/assets/images/placeholder_profile.png",
name: "John Doe",
experienceLevel: "INTERMEDIATE"
},
Expand Down Expand Up @@ -62,7 +62,7 @@ export const temporaryMocks = {
id: 1,
username: "jane_doe",
reputationPoints: 150,
profilePicture: "frontend\src\assets\placeholder_profile.png",
profilePicture: "@/assets/images/placeholder_profile.png",
name: "Jane Doe",
experienceLevel: "EXPERT"
},
Expand All @@ -83,7 +83,7 @@ export const temporaryMocks = {
id: 2,
username: "john_doe",
reputationPoints: 100,
profilePicture: "frontend\src\assets\placeholder_profile.png",
profilePicture: "@/assets/images/placeholder_profile.png",
name: "John Doe",
experienceLevel: "INTERMEDIATE"
},
Expand Down
2 changes: 1 addition & 1 deletion swagger/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1354,7 +1354,7 @@ components:
- id: 1
username: "john_doe"
reputationPoints: 100
profilePicture: "frontend\src\assets\placeholder_profile.png"
profilePicture: "https://placehold.co/640x640"
name: "John Doe"

DifficultyLevel:
Expand Down

0 comments on commit 6882536

Please sign in to comment.