-
Notifications
You must be signed in to change notification settings - Fork 378
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into refactor/openDialog
- Loading branch information
Showing
195 changed files
with
9,831 additions
and
873 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
Composer/packages/adaptive-form/src/components/fields/RecognizerField/getDropdownOptions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
import { RecognizerSchema, FallbackRecognizerKey } from '@bfc/extension-client'; | ||
import { RecognizerSchema, FallbackRecognizerKey, ShellApi, ShellData } from '@bfc/extension-client'; | ||
|
||
import { recognizerOrderMap } from './defaultRecognizerOrder'; | ||
import { mapRecognizerSchemaToDropdownOption } from './mappers'; | ||
|
||
const getRankScore = (r: RecognizerSchema) => { | ||
const getRankScore = (r: RecognizerSchema, shellData: ShellData, shellApi: ShellApi) => { | ||
// Always put disabled recognizer behind. Handle 'disabled' before 'default'. | ||
if (r.disabled) return Number.MAX_VALUE; | ||
if ((typeof r.disabled === 'function' && r.disabled(shellData, shellApi)) || r.disabled) return Number.MAX_VALUE; | ||
// Always put default recognzier ahead. | ||
if (r.default) return -1; | ||
// Put fallback recognizer behind. | ||
if (r.id === FallbackRecognizerKey) return Number.MAX_VALUE - 1; | ||
return recognizerOrderMap[r.id] ?? Number.MAX_VALUE - 1; | ||
}; | ||
|
||
export const getDropdownOptions = (recognizerConfigs: RecognizerSchema[]) => { | ||
export const getDropdownOptions = (recognizerConfigs: RecognizerSchema[], shellData: ShellData, shellApi: ShellApi) => { | ||
return recognizerConfigs | ||
.filter((r) => !r.disabled) | ||
.filter((r) => (typeof r.disabled === 'function' && !r.disabled(shellData, shellApi)) || !r.disabled) | ||
.sort((r1, r2) => { | ||
return getRankScore(r1) - getRankScore(r2); | ||
return getRankScore(r1, shellData, shellApi) - getRankScore(r2, shellData, shellApi); | ||
}) | ||
.map(mapRecognizerSchemaToDropdownOption); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
Composer/packages/client/src/components/DataCollectionDialog.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
import formatMessage from 'format-message'; | ||
import { DefaultButton, PrimaryButton } from 'office-ui-fabric-react/lib/Button'; | ||
import { Dialog, DialogFooter } from 'office-ui-fabric-react/lib/Dialog'; | ||
import { Link } from 'office-ui-fabric-react/lib/Link'; | ||
import React from 'react'; | ||
import { useRecoilValue } from 'recoil'; | ||
|
||
import { dispatcherState } from '../recoilModel'; | ||
|
||
const DataCollectionDialog: React.FC = () => { | ||
const { updateServerSettings } = useRecoilValue(dispatcherState); | ||
|
||
const handleDataCollectionChange = (allowDataCollection: boolean) => () => { | ||
updateServerSettings({ | ||
telemetry: { | ||
allowDataCollection, | ||
}, | ||
}); | ||
}; | ||
|
||
return ( | ||
<Dialog | ||
hidden={false} | ||
modalProps={{ | ||
isBlocking: true, | ||
}} | ||
title={formatMessage('Help us improve?')} | ||
onDismiss={handleDataCollectionChange(false)} | ||
> | ||
<p> | ||
{formatMessage( | ||
'Composer includes a telemetry feature that collects usage information. It is important that the Composer team understands how the tool is being used so that it can be improved.' | ||
)} | ||
</p> | ||
<p>{formatMessage('You can turn data collection on or off at any time in the Application Settings.')}</p> | ||
<p> | ||
<Link | ||
aria-label={formatMessage('Privacy statement')} | ||
href={'https://privacy.microsoft.com/privacystatement'} | ||
target={'_blank'} | ||
> | ||
{formatMessage('Privacy statement')} | ||
</Link> | ||
</p> | ||
<DialogFooter> | ||
<DefaultButton text={formatMessage('Not now')} onClick={handleDataCollectionChange(false)} /> | ||
<PrimaryButton text={formatMessage('Yes, collect data')} onClick={handleDataCollectionChange(true)} /> | ||
</DialogFooter> | ||
</Dialog> | ||
); | ||
}; | ||
|
||
export default DataCollectionDialog; | ||
export { DataCollectionDialog }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.