Skip to content

Commit

Permalink
Merge branch 'feat/project-provision-status' into releases/1.10
Browse files Browse the repository at this point in the history
  • Loading branch information
Remi749 committed Aug 5, 2024
2 parents 7384862 + e27c578 commit 5583fa6
Show file tree
Hide file tree
Showing 34 changed files with 1,751 additions and 819 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import {
FluentProvider,
IdPrefixProvider,
Menu,
MenuButtonProps,
MenuItem,
Expand All @@ -9,23 +11,23 @@ import {
SkeletonItem,
SplitButton,
Toaster,
useId,
useRestoreFocusTarget,
useToastController
} from '@fluentui/react-components'
import React, { FC } from 'react'
import { IProjectProvisionProps } from './types'
import { getFluentIcon } from 'pp365-shared-library'
import { customLightTheme, getFluentIcon } from 'pp365-shared-library'
import { ProvisionStatus } from './ProvisionStatus'
import { useProjectProvision } from './useProjectProvision'
import { ProjectProvisionContext } from './context'
import { ProvisionDrawer } from './ProvisionDrawer'
import strings from 'PortfolioWebPartsStrings'
import { ProvisionSettings } from './ProvisionSettings'

export const ProjectProvision: FC<IProjectProvisionProps> = (props) => {
const { state, setState, column, setColumn } = useProjectProvision(props)
const { state, setState, column, setColumn, toasterId, fluentProviderId } =
useProjectProvision(props)
const restoreFocusTargetAttribute = useRestoreFocusTarget()
const toasterId = useId('saveToaster')
const { dispatchToast } = useToastController(toasterId)

if (state.loading) {
Expand All @@ -38,39 +40,52 @@ export const ProjectProvision: FC<IProjectProvisionProps> = (props) => {

return (
<ProjectProvisionContext.Provider value={{ props, state, setState, column, setColumn }}>
<ProvisionDrawer toast={dispatchToast} />
<Menu positioning='below-end'>
<MenuTrigger disableButtonEnhancement>
{(triggerProps: MenuButtonProps) => (
<SplitButton
menuButton={triggerProps}
primaryActionButton={{
onClick: () => setState({ showProvisionDrawer: true })
}}
icon={getFluentIcon('Add')}
appearance='primary'
size='large'
>
{strings.Provision.ProvisionButtonLabel}
</SplitButton>
)}
</MenuTrigger>
<MenuPopover>
<MenuList>
<MenuItem
{...restoreFocusTargetAttribute}
onClick={() => {
setState({ showProvisionStatus: true })
}}
>
{strings.Provision.StatusMenuLabel}
</MenuItem>
<MenuItem>{strings.Provision.IdeaMenuLabel}</MenuItem>
</MenuList>
</MenuPopover>
</Menu>
<ProvisionStatus />
<Toaster toasterId={toasterId} />
<IdPrefixProvider value={fluentProviderId}>
<FluentProvider theme={customLightTheme}>
<ProvisionDrawer toast={dispatchToast} />
<Menu positioning='below-end'>
<MenuTrigger disableButtonEnhancement>
{(triggerProps: MenuButtonProps) => (
<SplitButton
menuButton={triggerProps}
primaryActionButton={{
onClick: () => setState({ showProvisionDrawer: true })
}}
icon={getFluentIcon('Add')}
appearance='primary'
size='large'
>
{strings.Provision.ProvisionButtonLabel}
</SplitButton>
)}
</MenuTrigger>
<MenuPopover>
<MenuList>
<MenuItem
{...restoreFocusTargetAttribute}
onClick={() => {
setState({ showProvisionStatus: true })
}}
>
{strings.Provision.StatusMenuLabel}
</MenuItem>
<MenuItem
{...restoreFocusTargetAttribute}
onClick={() => {
setState({ showProvisionSettings: true })
}}
>
{strings.Provision.SettingsMenuLabel}
</MenuItem>
<MenuItem disabled>{strings.Provision.IdeaMenuLabel}</MenuItem>
</MenuList>
</MenuPopover>
</Menu>
<ProvisionStatus toast={dispatchToast} />
<ProvisionSettings toast={dispatchToast} />
<Toaster toasterId={toasterId} />
</FluentProvider>
</IdPrefixProvider>
</ProjectProvisionContext.Provider>
)
}
Loading

0 comments on commit 5583fa6

Please sign in to comment.