From 61644f73af85d5ca24beae75dca56f644f6b02d3 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Tue, 13 Jun 2023 16:09:21 +0200 Subject: [PATCH] change(ui): city state in more details, and list --- .../EventsBlock/UserCard/UserCard.js | 7 ++- .../SessionInfoItem/SessionInfoItem.tsx | 2 +- .../shared/SessionItem/SessionItem.tsx | 6 ++- .../components/ui/CountryFlag/CountryFlag.js | 54 ++++++++++++------- 4 files changed, 47 insertions(+), 22 deletions(-) diff --git a/frontend/app/components/Session/Player/ReplayPlayer/EventsBlock/UserCard/UserCard.js b/frontend/app/components/Session/Player/ReplayPlayer/EventsBlock/UserCard/UserCard.js index ca49bf47e..020272303 100644 --- a/frontend/app/components/Session/Player/ReplayPlayer/EventsBlock/UserCard/UserCard.js +++ b/frontend/app/components/Session/Player/ReplayPlayer/EventsBlock/UserCard/UserCard.js @@ -89,7 +89,12 @@ function UserCard({ className, request, session, width, height, similarSessions, } label={countries[userCountry]} - value={{formatTimeOrDate(startedAt)}} + value={{ + <> + {userCity && {userCity},} + {userState && {userState}} + + }} /> diff --git a/frontend/app/components/Session_/SessionInfoItem/SessionInfoItem.tsx b/frontend/app/components/Session_/SessionInfoItem/SessionInfoItem.tsx index b29730215..a71eb7c65 100644 --- a/frontend/app/components/Session_/SessionInfoItem/SessionInfoItem.tsx +++ b/frontend/app/components/Session_/SessionInfoItem/SessionInfoItem.tsx @@ -18,7 +18,7 @@ export default function SessionInfoItem(props: Props) { { comp && comp }
{label}
-
{value}
+
{value}
) } diff --git a/frontend/app/components/shared/SessionItem/SessionItem.tsx b/frontend/app/components/shared/SessionItem/SessionItem.tsx index 6f23776c7..a842be074 100644 --- a/frontend/app/components/shared/SessionItem/SessionItem.tsx +++ b/frontend/app/components/shared/SessionItem/SessionItem.tsx @@ -35,6 +35,8 @@ interface Props { userAnonymousId: string; userDisplayName: string; userCountry: string; + userCity: string; + usetState: string; startedAt: number; duration: Duration; eventsCount: number; @@ -93,6 +95,8 @@ function SessionItem(props: RouteComponentProps & Props) { userAnonymousId, userDisplayName, userCountry, + userCity, + userState, startedAt, duration, eventsCount, @@ -218,7 +222,7 @@ function SessionItem(props: RouteComponentProps & Props) {
- +
diff --git a/frontend/app/components/ui/CountryFlag/CountryFlag.js b/frontend/app/components/ui/CountryFlag/CountryFlag.js index 4e4ba4cba..f22a37e27 100644 --- a/frontend/app/components/ui/CountryFlag/CountryFlag.js +++ b/frontend/app/components/ui/CountryFlag/CountryFlag.js @@ -4,26 +4,42 @@ import { countries } from 'App/constants'; import { Icon } from 'UI'; import stl from './countryFlag.module.css'; -const CountryFlag = ({ country = '', className = '', style = {}, label = false, width = 22, height = 15}) => { - const knownCountry = !!country && country !== 'UN'; - const countryFlag = knownCountry ? country.toLowerCase() : ''; - const countryName = knownCountry ? countries[ country ] : 'Unknown Country'; +const CountryFlag = ({ + userCity = '', + userState = '', + country = '', + className = '', + style = {}, + label = false, + width = 22, + height = 15, +}) => { + const knownCountry = !!country && country !== 'UN'; + const countryFlag = knownCountry ? country.toLowerCase() : ''; + const countryName = knownCountry ? countries[country] : 'Unknown Country'; - return ( -
- {knownCountry - ?
- : ( -
- -
Unknown Country
-
- )} - { knownCountry && label &&
{ countryName }
} -
- ); -} + return ( +
+ {knownCountry ? ( +
+ ) : ( +
+ +
+ Unknown Country +
+
+ )} + {userCity && {userCity},} + {userState && {userState},} + {knownCountry && label &&
{countryName}
} +
+ ); +}; -CountryFlag.displayName = "CountryFlag"; +CountryFlag.displayName = 'CountryFlag'; export default React.memo(CountryFlag);