This repository was archived by the owner on Jul 9, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 376
feat: Updating to Tab UI for bot settings page #6592
Merged
Merged
Changes from 3 commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
adddaa2
move provisionig readme into scripts folder so that main package read…
benbrown 620c8fb
Read in and display a readme.md file for the project
benbrown 1be5eb0
Merge branch 'main' into benbrown/readmes
benbrown c5788b2
remove errant constant
benbrown 6f3d46a
Merge branch 'main' of https://github.com/microsoft/BotFramework-Comp…
benbrown fd85954
Merge branch 'benbrown/readmes' of https://github.com/microsoft/BotFr…
benbrown 415bda8
adding bot project tab view
pavolumMsft a9411c4
Updating botProjectInfo
pavolumMsft b3e0ea2
Adding support for deep linking into settings page
pavolumMsft 83d3336
Merging latest form main and resolving conflict
pavolumMsft d4f6571
Main merge clean up
pavolumMsft 7062fc9
Fixing skills settings dependency
pavolumMsft 7bab94a
Adding bottons for luis and qna provision in settings page
pavolumMsft a15430a
Updating setting after qna and luis provisioning
pavolumMsft 6ad4e83
Merge branch 'main' into benbrown/readmes
pavolum a388c4e
Naming changes for readme modal
pavolumMsft 3bf7cfa
Merge branch 'benbrown/readmes' of https://github.com/microsoft/BotFr…
pavolumMsft 6bfcdf5
removing unused isBack option
pavolumMsft b2f243e
address feedback
benbrown 3821132
Adding formatMesage
pavolumMsft b679759
Removing unused ref
pavolumMsft cbc2cc3
Merge branch 'benbrown/readmes' of https://github.com/microsoft/BotFr…
benbrown 77ed140
Merge branch 'benbrown/readmes' of https://github.com/microsoft/BotFr…
benbrown ac01860
Temp remove template tag and text
pavolumMsft 7aa06a7
Merge branch 'benbrown/readmes' of https://github.com/microsoft/BotFr…
pavolumMsft 4b61a62
Removing unused variables and deps
pavolumMsft 6858230
removing unsed imports
pavolumMsft 3f02de5
Resolving merge conflicts
pavolumMsft 17cb268
Adding testIds to tabs in settings page and updating broken integrati…
pavolumMsft c86c43c
Merge branch 'main' into benbrown/readmes
pavolum 80d219d
Fixing Luis deploy test to work with tab experience
pavolumMsft a80a2e4
Merge branch 'benbrown/readmes' of https://github.com/microsoft/BotFr…
pavolumMsft 1dbdf31
Merging and resolving conflicts
pavolumMsft 9b7bba9
Fixing import in test
pavolumMsft 9fefd80
Fixing header unit test
pavolumMsft 182ad9f
Merge branch 'main' into benbrown/readmes
pavolum ac28eb2
use iconUrl field instead of icon. Fix for https://github.com/microso…
benbrown b426df2
Merge branch 'main' into benbrown/readmes
beyackle 7376c45
read in icon and include it as a data url
benbrown 90f0909
Merge branch 'benbrown/fixicon' into benbrown/readmes
benbrown 8322ca4
Merge branch 'main' of https://github.com/microsoft/BotFramework-Comp…
benbrown 2f13e3c
Merge branch 'benbrown/readmes' of https://github.com/microsoft/BotFr…
benbrown ebb499a
Merge branch 'main' into benbrown/readmes
pavolum 03bfbdf
Simplyfing array inclusion check
pavolumMsft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
65 changes: 65 additions & 0 deletions
65
Composer/packages/client/src/pages/botProject/BotProjectInfo.tsx
This file contains hidden or 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,65 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| /** @jsx jsx */ | ||
| import { jsx } from '@emotion/core'; | ||
| import { useRecoilValue } from 'recoil'; | ||
| import React, { useState, Fragment } from 'react'; | ||
| import { RouteComponentProps } from '@reach/router'; | ||
| import { DisplayReadme } from '@bfc/ui-shared'; | ||
| import formatMessage from 'format-message'; | ||
| import { DefaultButton } from 'office-ui-fabric-react/lib/Button'; | ||
|
|
||
| import { readmeState, locationState } from '../../recoilModel/atoms'; | ||
| import { localBotsDataSelector } from '../../recoilModel/selectors/project'; | ||
|
|
||
| export const BotProjectInfo: React.FC<RouteComponentProps<{ | ||
| projectId: string; | ||
| }>> = (props) => { | ||
| const { projectId = '' } = props; | ||
| const botProjects = useRecoilValue(localBotsDataSelector); | ||
| const botProject = botProjects.find((b) => b.projectId === projectId); | ||
| const readme = useRecoilValue(readmeState(projectId)); | ||
| const location = useRecoilValue(locationState(projectId)); | ||
| const [readmeHidden, setReadmeHidden] = useState<boolean>(true); | ||
|
|
||
| return ( | ||
| <div> | ||
| <h1>{botProject?.name}</h1> | ||
| <p> | ||
| {formatMessage('File Location:')} | ||
| <span | ||
| style={{ | ||
| display: 'inline-block', | ||
| overflowWrap: 'break-word', | ||
| maxWidth: '100%', | ||
| fontSize: 12, | ||
| }} | ||
| > | ||
| {location} | ||
| </span> | ||
| </p> | ||
| {readme && ( | ||
| <Fragment> | ||
| <DefaultButton | ||
| onClick={() => { | ||
| setReadmeHidden(false); | ||
| }} | ||
| > | ||
| {formatMessage('View project readme')} | ||
| </DefaultButton> | ||
| <DisplayReadme | ||
| hidden={readmeHidden} | ||
| readme={readme} | ||
| title={'Project Readme'} | ||
| onDismiss={() => { | ||
| setReadmeHidden(true); | ||
| }} | ||
| /> | ||
| </Fragment> | ||
| )} | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default BotProjectInfo; |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
43 changes: 43 additions & 0 deletions
43
Composer/packages/lib/ui-shared/src/components/DisplayReadme/DisplayReadme.tsx
This file contains hidden or 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,43 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
|
pavolum marked this conversation as resolved.
|
||
| // Licensed under the MIT License. | ||
|
|
||
| /** @jsx jsx */ | ||
| import { jsx } from '@emotion/core'; | ||
| import { DialogFooter } from 'office-ui-fabric-react/lib/Dialog'; | ||
| import { PrimaryButton, DefaultButton } from 'office-ui-fabric-react/lib/Button'; | ||
| import { ScrollablePane } from 'office-ui-fabric-react/lib/ScrollablePane'; | ||
| import formatMessage from 'format-message'; | ||
| import ReactMarkdown from 'react-markdown'; | ||
|
|
||
| import { DialogTypes, DialogWrapper } from '../DialogWrapper'; | ||
|
|
||
| type DisplayReadmeProps = { | ||
| title: string; | ||
| readme: string; | ||
|
pavolum marked this conversation as resolved.
Outdated
|
||
| hidden: boolean; | ||
| onBack?: () => void; | ||
|
pavolum marked this conversation as resolved.
Outdated
|
||
| onDismiss: () => void; | ||
| }; | ||
|
|
||
| export const DisplayReadme = (props: DisplayReadmeProps) => { | ||
| return ( | ||
| <DialogWrapper | ||
| dialogType={DialogTypes.CreateFlow} | ||
| isOpen={!props.hidden} | ||
| title={props.title} | ||
| onDismiss={props.onDismiss} | ||
| > | ||
| <div css={{ height: 500, position: 'relative', border: '1px solid #333' }}> | ||
| <ScrollablePane> | ||
| <ReactMarkdown css={{ padding: 20 }} linkTarget="_blank"> | ||
| {props.readme} | ||
| </ReactMarkdown> | ||
| </ScrollablePane> | ||
| </div> | ||
| <DialogFooter> | ||
| {props.onBack && <DefaultButton text={formatMessage('Back')} onClick={props.onBack} />} | ||
| <PrimaryButton text={formatMessage('Okay')} onClick={props.onDismiss} /> | ||
|
pavolum marked this conversation as resolved.
Outdated
|
||
| </DialogFooter> | ||
| </DialogWrapper> | ||
| ); | ||
| }; | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -32,7 +32,7 @@ import { | |
| useTelemetryClient, | ||
| TelemetryClient, | ||
| } from '@bfc/extension-client'; | ||
| import { Toolbar, IToolbarItem, LoadingSpinner } from '@bfc/ui-shared'; | ||
| import { Toolbar, IToolbarItem, LoadingSpinner, DisplayReadme } from '@bfc/ui-shared'; | ||
| import ReactMarkdown from 'react-markdown'; | ||
|
|
||
| import { ContentHeaderStyle, HeaderText } from '../components/styles'; | ||
|
|
@@ -78,6 +78,7 @@ const Library: React.FC = () => { | |
| const [readmeContent, setReadmeContent] = useState<string>(''); | ||
| const [versionOptions, setVersionOptions] = useState<IContextualMenuProps | undefined>(undefined); | ||
| const [isUpdate, setIsUpdate] = useState<boolean>(false); | ||
| const [readmeHidden, setReadmeHidden] = useState<boolean>(true); | ||
|
Contributor
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. This may be my personal opinion here, but I find confusing when the variable value and the thing being hidden/shown matches. (not sure how to word this) So I would suggest something like |
||
| const httpClient = useHttpClient(); | ||
| const API_ROOT = ''; | ||
| const TABS = { | ||
|
|
@@ -399,6 +400,14 @@ const Library: React.FC = () => { | |
| setWorking(''); | ||
| updateInstalledComponents(results.data.components); | ||
|
|
||
| // find newly installed item | ||
| // and pop up the readme if one exists. | ||
| const newItem = results.data.components.find((i) => i.name === packageName); | ||
| if (newItem?.readme) { | ||
| setSelectedItem(newItem); | ||
| setReadmeHidden(false); | ||
| } | ||
|
|
||
| // reload modified content | ||
| await reloadProject(); | ||
| } | ||
|
|
@@ -571,6 +580,16 @@ const Library: React.FC = () => { | |
| hidden={!isModalVisible} | ||
| onUpdateFeed={updateFeed} | ||
| /> | ||
| {selectedItem && ( | ||
| <DisplayReadme | ||
| hidden={readmeHidden} | ||
| readme={selectedItem?.readme} | ||
| title={'Project Readme'} | ||
| onDismiss={() => { | ||
| setReadmeHidden(true); | ||
| }} | ||
| /> | ||
| )} | ||
| <Toolbar toolbarItems={toolbarItems} /> | ||
| <div css={ContentHeaderStyle}> | ||
| <h1 css={HeaderText}>{strings.title}</h1> | ||
|
|
@@ -826,6 +845,18 @@ const Library: React.FC = () => { | |
| </p> | ||
| )} | ||
|
|
||
| {selectedItem.readme && ( | ||
| <Fragment> | ||
| <DefaultButton | ||
| onClick={() => { | ||
| setReadmeHidden(false); | ||
| }} | ||
| > | ||
| View readme | ||
|
pavolum marked this conversation as resolved.
Outdated
|
||
| </DefaultButton> | ||
| | ||
|
pavolum marked this conversation as resolved.
Outdated
|
||
| </Fragment> | ||
| )} | ||
| {isInstalled(selectedItem) && <DefaultButton onClick={removeComponent}>Uninstall</DefaultButton>} | ||
| </Fragment> | ||
| ) : ( | ||
|
|
||
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.