-
Notifications
You must be signed in to change notification settings - Fork 1.4k
add {PROVIDER}_DISPLAY_NAME env-var #8967
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<script lang="ts"> | ||
import { concatLink } from '@hcengineering/core' | ||
import { concatLink, type ProviderInfo } from '@hcengineering/core' | ||
import { getMetadata } from '@hcengineering/platform' | ||
import { AnySvelteComponent, Button, Grid, deviceOptionsStore, getCurrentLocation } from '@hcengineering/ui' | ||
import { onMount } from 'svelte' | ||
|
@@ -12,28 +12,41 @@ | |
interface Provider { | ||
name: string | ||
component: AnySvelteComponent | ||
displayName: null | ||
} | ||
|
||
const providers: Provider[] = [ | ||
{ | ||
name: 'google', | ||
component: Google | ||
component: Google, | ||
displayName: null | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor: |
||
}, | ||
{ | ||
name: 'github', | ||
component: Github | ||
component: Github, | ||
displayName: null | ||
}, | ||
{ | ||
name: 'openid', | ||
component: OpenId | ||
component: OpenId, | ||
displayName: null | ||
} | ||
] | ||
|
||
let enabledProviders: Provider[] = [] | ||
|
||
onMount(() => { | ||
void getProviders().then((res) => { | ||
enabledProviders = providers.filter((provider) => res.includes(provider.name)) | ||
void getProviders().then((res: ProviderInfo[]) => { | ||
enabledProviders = providers | ||
.map((provider) => { | ||
const match = res.find((r) => r.name === provider.name) | ||
if (!match) return null | ||
return { | ||
...provider, | ||
displayName: match.displayName | ||
} | ||
}) | ||
.filter((p): p is Provider & { displayName: string } => p !== null) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor: there's a |
||
}) | ||
}) | ||
|
||
|
@@ -70,7 +83,7 @@ | |
<a href={getLink(provider)}> | ||
<Button kind={'contrast'} shape={'round2'} size={'x-large'} width="100%" stopPropagation={false}> | ||
<svelte:fragment slot="content"> | ||
<svelte:component this={provider.component} /> | ||
<svelte:component this={provider.component} displayName={provider.displayName} /> | ||
</svelte:fragment> | ||
</Button> | ||
</a> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels like it doesn't belong to
core
. Please define it both inauth-providers
and inaccount-client
instead.