1+ import { useState } from 'react' ;
12import styled from '@emotion/styled' ;
23import { PlatformIcon } from 'platformicons' ;
34
@@ -10,6 +11,7 @@ import Feature from 'sentry/components/acl/feature';
1011import { IconClock , IconFile , IconJson , IconLink , IconMobile } from 'sentry/icons' ;
1112import { t } from 'sentry/locale' ;
1213import { getFormat , getFormattedDate , getUtcToSystem } from 'sentry/utils/dates' ;
14+ import useOrganization from 'sentry/utils/useOrganization' ;
1315import { openInstallModal } from 'sentry/views/preprod/components/installModal' ;
1416import { type BuildDetailsAppInfo } from 'sentry/views/preprod/types/buildDetailsTypes' ;
1517import {
@@ -27,19 +29,35 @@ interface BuildDetailsSidebarAppInfoProps {
2729}
2830
2931export function BuildDetailsSidebarAppInfo ( props : BuildDetailsSidebarAppInfoProps ) {
32+ const organization = useOrganization ( ) ;
3033 const labels = getLabels ( props . appInfo . platform ?? undefined ) ;
34+ const [ imageError , setImageError ] = useState ( false ) ;
3135
3236 const datetimeFormat = getFormat ( {
3337 seconds : true ,
3438 timeZone : true ,
3539 } ) ;
3640
41+ let iconUrl = null ;
42+ if ( props . appInfo . app_icon_id ) {
43+ iconUrl = `/api/0/projects/${ organization . slug } /${ props . projectId } /files/images/${ props . appInfo . app_icon_id } /` ;
44+ }
45+
3746 return (
3847 < Flex direction = "column" gap = "xl" >
3948 < Flex align = "center" gap = "sm" >
40- < AppIcon >
49+ { iconUrl && ! imageError && (
50+ < AppIcon
51+ src = { iconUrl }
52+ alt = "App Icon"
53+ width = { 24 }
54+ height = { 24 }
55+ onError = { ( ) => setImageError ( true ) }
56+ />
57+ ) }
58+ { ( ! iconUrl || imageError ) && (
4159 < AppIconPlaceholder > { props . appInfo . name ?. charAt ( 0 ) || '' } </ AppIconPlaceholder >
42- </ AppIcon >
60+ ) }
4361 { props . appInfo . name && < Heading as = "h3" > { props . appInfo . name } </ Heading > }
4462 </ Flex >
4563
@@ -133,19 +151,20 @@ export function BuildDetailsSidebarAppInfo(props: BuildDetailsSidebarAppInfoProp
133151 ) ;
134152}
135153
136- const AppIcon = styled ( 'div' ) `
154+ const AppIcon = styled ( 'img' ) `
155+ border-radius: 4px;
156+ ` ;
157+
158+ const AppIconPlaceholder = styled ( 'div' ) `
137159 width: 24px;
138160 height: 24px;
139161 border-radius: 4px;
140- background: #ff6600;
141162 display: flex;
142163 align-items: center;
143164 justify-content: center;
144165 flex-shrink: 0;
145- ` ;
146-
147- const AppIconPlaceholder = styled ( 'div' ) `
148- color: white;
166+ background: ${ p => p . theme . purple400 } ;
167+ color: ${ p => p . theme . white } ;
149168 font-weight: ${ p => p . theme . fontWeight . bold } ;
150169 font-size: ${ p => p . theme . fontSize . sm } ;
151170` ;
0 commit comments