From 910ea043844dd763e6bc66f573b60ce8327252c7 Mon Sep 17 00:00:00 2001 From: Yang Luo Date: Fri, 18 Jun 2021 23:43:36 +0800 Subject: [PATCH] Add renderAffiliation(). --- web/src/Setting.js | 4 ++++ web/src/auth/PromptPage.js | 19 ++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/web/src/Setting.js b/web/src/Setting.js index 8bf73078..7e34f2d8 100644 --- a/web/src/Setting.js +++ b/web/src/Setting.js @@ -74,6 +74,10 @@ export function isProviderVisibleForSignIn(providerItem) { return isProviderVisible(providerItem); } +export function isProviderPrompted(providerItem) { + return isProviderVisible(providerItem) && providerItem.prompted; +} + export function parseJson(s) { if (s === "") { return null; diff --git a/web/src/auth/PromptPage.js b/web/src/auth/PromptPage.js index 7f158a9b..1c5df31a 100644 --- a/web/src/auth/PromptPage.js +++ b/web/src/auth/PromptPage.js @@ -74,13 +74,26 @@ class PromptPage extends React.Component { }); } + renderAffiliation(application) { + const signupItems = application.signupItems.filter(signupItem => signupItem.name === "Affiliation"); + if (signupItems.length === 0) { + return null; + } + + if (!signupItems[0].prompted) { + return null; + } + + return ( + { return this.updateUserField(key, value)}} /> + ) + } + renderContent(application) { return (
{ - (application === null || this.state.user === null) ? null : ( - { return this.updateUserField(key, value)}} /> - ) + this.renderAffiliation(application) }
)