From 36727172a2e0caa442e25334f2a4077548ea9595 Mon Sep 17 00:00:00 2001 From: davy-c Date: Fri, 19 Feb 2021 16:58:39 +0900 Subject: [PATCH 1/3] fix team icons --- src/components/App.tsx | 8 +++++++- src/components/organisms/BoostHubSignInForm.tsx | 8 +++++++- src/lib/boosthub.tsx | 7 ++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/components/App.tsx b/src/components/App.tsx index 352e28f466..1fd2da7b69 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -58,6 +58,7 @@ import CreateWorkspaceModal from './organisms/CreateWorkspaceModal' import { useStorageRouter } from '../lib/storageRouter' import ExternalStyle from './ExternalStyle' import { useDialog, DialogIconTypes } from '../lib/dialog' +import { buildIconUrl } from '../cloud/api/files' const LoadingText = styled.div` margin: 30px; @@ -234,7 +235,12 @@ const App = () => { id: team.id, name: team.name, domain: team.domain, - iconUrl: team.iconUrl, + iconUrl: + team.icon != null + ? `${process.env.BOOST_HUB_BASE_URL}${buildIconUrl( + team.icon.location + )}` + : undefined, } }), }) diff --git a/src/components/organisms/BoostHubSignInForm.tsx b/src/components/organisms/BoostHubSignInForm.tsx index ede9e240e7..c28927f101 100644 --- a/src/components/organisms/BoostHubSignInForm.tsx +++ b/src/components/organisms/BoostHubSignInForm.tsx @@ -30,6 +30,7 @@ import styled from '../../lib/styled' import { osName } from '../../lib/platform' import { fetchDesktopGlobalData } from '../../lib/boosthub' import { boostHubBaseUrl } from '../../cloud/lib/consts' +import { buildIconUrl } from '../../cloud/api/files' const BoostHubSignInForm = () => { const { setPreferences } = usePreferences() @@ -109,7 +110,12 @@ const BoostHubSignInForm = () => { id: team.id, name: team.name, domain: team.domain, - iconUrl: team.iconUrl, + iconUrl: + team.icon != null + ? `${process.env.BOOST_HUB_BASE_URL}${buildIconUrl( + team.icon.location + )}` + : undefined, } }), }) diff --git a/src/lib/boosthub.tsx b/src/lib/boosthub.tsx index ab2bb54c18..49c12c7ad5 100644 --- a/src/lib/boosthub.tsx +++ b/src/lib/boosthub.tsx @@ -73,7 +73,12 @@ export async function fetchDesktopGlobalData(token: string) { uniqueName: string displayName: string } - teams: { id: string; name: string; domain: string; iconUrl?: string }[] + teams: { + id: string + name: string + domain: string + icon?: { location: string } + }[] } } From 33f9a93cc9bc2dddc940c924c3ac18ec967cb7b1 Mon Sep 17 00:00:00 2001 From: davy-c Date: Fri, 19 Feb 2021 17:12:02 +0900 Subject: [PATCH 2/3] use correct function --- src/components/App.tsx | 5 +---- src/components/organisms/BoostHubSignInForm.tsx | 11 ++++++----- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/components/App.tsx b/src/components/App.tsx index 1fd2da7b69..179b7cf581 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -58,7 +58,6 @@ import CreateWorkspaceModal from './organisms/CreateWorkspaceModal' import { useStorageRouter } from '../lib/storageRouter' import ExternalStyle from './ExternalStyle' import { useDialog, DialogIconTypes } from '../lib/dialog' -import { buildIconUrl } from '../cloud/api/files' const LoadingText = styled.div` margin: 30px; @@ -237,9 +236,7 @@ const App = () => { domain: team.domain, iconUrl: team.icon != null - ? `${process.env.BOOST_HUB_BASE_URL}${buildIconUrl( - team.icon.location - )}` + ? `${getBoostHubTeamIconUrl(team.icon.location)}` : undefined, } }), diff --git a/src/components/organisms/BoostHubSignInForm.tsx b/src/components/organisms/BoostHubSignInForm.tsx index c28927f101..f5dd5d5088 100644 --- a/src/components/organisms/BoostHubSignInForm.tsx +++ b/src/components/organisms/BoostHubSignInForm.tsx @@ -15,7 +15,11 @@ import { FormSecondaryButton, } from '../atoms/form' import { generateId } from '../../lib/string' -import { openLoginPage, createDesktopAccessToken } from '../../lib/boosthub' +import { + openLoginPage, + createDesktopAccessToken, + getBoostHubTeamIconUrl, +} from '../../lib/boosthub' import { useGeneralStatus } from '../../lib/generalStatus' import { BoostHubLoginEvent, @@ -30,7 +34,6 @@ import styled from '../../lib/styled' import { osName } from '../../lib/platform' import { fetchDesktopGlobalData } from '../../lib/boosthub' import { boostHubBaseUrl } from '../../cloud/lib/consts' -import { buildIconUrl } from '../../cloud/api/files' const BoostHubSignInForm = () => { const { setPreferences } = usePreferences() @@ -112,9 +115,7 @@ const BoostHubSignInForm = () => { domain: team.domain, iconUrl: team.icon != null - ? `${process.env.BOOST_HUB_BASE_URL}${buildIconUrl( - team.icon.location - )}` + ? `${getBoostHubTeamIconUrl(team.icon.location)}` : undefined, } }), From 61454f2097fb1aa8f8296c3d5c12a7a789a931a7 Mon Sep 17 00:00:00 2001 From: davy-c Date: Fri, 19 Feb 2021 17:15:31 +0900 Subject: [PATCH 3/3] cleanup --- src/components/App.tsx | 2 +- src/components/organisms/BoostHubSignInForm.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/App.tsx b/src/components/App.tsx index 179b7cf581..a59e38901c 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -236,7 +236,7 @@ const App = () => { domain: team.domain, iconUrl: team.icon != null - ? `${getBoostHubTeamIconUrl(team.icon.location)}` + ? getBoostHubTeamIconUrl(team.icon.location) : undefined, } }), diff --git a/src/components/organisms/BoostHubSignInForm.tsx b/src/components/organisms/BoostHubSignInForm.tsx index f5dd5d5088..ab709db187 100644 --- a/src/components/organisms/BoostHubSignInForm.tsx +++ b/src/components/organisms/BoostHubSignInForm.tsx @@ -115,7 +115,7 @@ const BoostHubSignInForm = () => { domain: team.domain, iconUrl: team.icon != null - ? `${getBoostHubTeamIconUrl(team.icon.location)}` + ? getBoostHubTeamIconUrl(team.icon.location) : undefined, } }),