|
6 | 6 |
|
7 | 7 | import React from 'react'; |
8 | 8 |
|
9 | | -import { FaConfluence, FaSlack, FaGoogleDrive } from "react-icons/fa"; |
| 9 | +import { FaConfluence, FaSlack, FaGoogleDrive, FaUser } from "react-icons/fa"; |
10 | 10 |
|
11 | 11 | // This imports the full-color icons |
12 | 12 | import Slack from '../assets/images/slack.svg'; |
13 | 13 | import Confluence from '../assets/images/confluence.svg'; |
14 | 14 | import GoogleDrive from '../assets/images/google-drive.svg' |
| 15 | +import BlueFolder from '../assets/images/' |
| 16 | +import ProfileDefault from "../assets/images/profile-picture-default.svg" |
| 17 | + |
| 18 | +const paths = { |
| 19 | + "slack": Slack, |
| 20 | + "confluence": Confluence, |
| 21 | + "google drive": GoogleDrive |
| 22 | +} |
15 | 23 |
|
16 | 24 | export interface TextPart { |
17 | 25 | content: string |
@@ -52,7 +60,7 @@ export const SearchResult = (props: SearchResultProps) => { |
52 | 60 | <a className="relative text-sm float-right text-white right-2 top-2" href={props.url}>{props.score}%</a> |
53 | 61 | <div className="flex flex-row items-start"> |
54 | 62 | <div className="relative w-[60px] h-[60px]"> |
55 | | - {ProfilePic(props.author_image_url, props.platform as Platform, props.type)} |
| 63 | + {ResultImage(props.platform as Platform, props.type, props.author_image_url)} |
56 | 64 | </div> |
57 | 65 | <p className='p-2 pt-0 ml-1 text-[#A3A3A3] text-sm font-poppins'> |
58 | 66 | <a className="text-[24px] text-[#A78BF6] text-xl font-poppins font-medium hover:underline hover:cursor-pointer" href={props.url} target='_blank'> |
@@ -110,7 +118,7 @@ export const SearchResult = (props: SearchResultProps) => { |
110 | 118 | ); |
111 | 119 | } |
112 | 120 |
|
113 | | -export function getPlatformDisplayName(platform: Platfom) { |
| 121 | +export function getPlatformDisplayName(platform: Platform) { |
114 | 122 | // This converts the platform name to title case for display purposes. |
115 | 123 | // example input : "google drive" |
116 | 124 | // example output: "Google Drive" |
@@ -142,33 +150,27 @@ function getSmallIconByPlatform(platform: Platform) { |
142 | 150 | } |
143 | 151 |
|
144 | 152 |
|
145 | | -function ProfilePic(profilePicture, platform, ResultType) { |
| 153 | +function ResultImage(platform: Platform, resultType: ResultType, profilePicture = ProfileDefault) { |
146 | 154 | /* |
147 | 155 | This function displays an image: either a profile picture or a logo. |
148 | | - The first parameter is the path/url to the profile picture. |
149 | | - The second parameter is the platform name. |
| 156 | + The first parameter is the platform name. |
| 157 | + The second parameter is |
150 | 158 | */ |
151 | | - platform = platform.toLowerCase(); |
152 | | - let profileStyle = "rounded-full w-full h-full object-cover"; |
153 | | - let lilLogoStyle = "company-logo rounded-full w-1/2 h-1/2 absolute object-cover -right-1.5 -bottom-1.5 bg-white" |
154 | | - if (platform === "slack" && ResultType === "comment") { |
| 159 | + const profileStyle = "rounded-full w-full h-full object-cover"; |
| 160 | + const lilLogoStyle = "company-logo rounded-full w-1/2 h-1/2 absolute object-cover -right-1.5 -bottom-1.5 bg-white"; |
| 161 | + const full = "w-full h-full" |
| 162 | + if (resultType === "message") { |
155 | 163 | return ( |
156 | | - <div className="w-full h-full"> |
| 164 | + <div className={full}> |
157 | 165 | <img className={profileStyle} alt="Profile" src={profilePicture} /> |
158 | 166 | <img src={Slack} alt={platform} className={lilLogoStyle} /> |
159 | 167 | </div> |
160 | 168 | ); |
161 | 169 | } |
162 | 170 | else { |
163 | | - let classes = "w-full h-full" |
164 | | - if (platform === "confluence") { |
165 | | - return ( |
166 | | - <img className={classes} alt="Profile" src={Confluence} /> |
167 | | - ); |
168 | | - } |
169 | | - if (platform === "google drive") { |
170 | | - return <img className={classes} alt="Profile" src={GoogleDrive} /> |
171 | | - } |
| 171 | + return ( |
| 172 | + <img src={paths[platform]} className={full} alt={platform} /> |
| 173 | + ); |
172 | 174 | } |
173 | 175 | } |
174 | 176 |
|
0 commit comments