-
Notifications
You must be signed in to change notification settings - Fork 4
right click contextual menu in the limit sets edition #3427
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
Open
Mathieu-Deharbe
wants to merge
16
commits into
main
Choose a base branch
from
limitsets-ui-improvements
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
a76e400
right click contextual menu in the limit sets edition
Mathieu-Deharbe e9f57b9
disableRipple
Mathieu-Deharbe 53eaf23
OperationalLimitsGroupTab + flexBasis: 'fit-content'
Mathieu-Deharbe 0db0652
Merge branch 'main' into limitsets-ui-improvements
Mathieu-Deharbe 73e2890
correction post merge main/conflicts
Mathieu-Deharbe 61d8065
Merge branch 'main' into limitsets-ui-improvements
Mathieu-Deharbe 0af363a
corrections post review
Mathieu-Deharbe 1b3399f
Merge branch 'main' into limitsets-ui-improvements
Mathieu-Deharbe 83acfa4
corrections post conflicts
Mathieu-Deharbe dcd6621
specific limitsStyles.tabs
Mathieu-Deharbe 9b4ae9d
grey line on the right side of tabs
Mathieu-Deharbe 9ff2acd
limit limit sets name size in tab
Mathieu-Deharbe 2d156e5
tabs styles / scroll
Mathieu-Deharbe 8173f5f
updates scrollbar after Stephane remarks
Mathieu-Deharbe 729811a
tab icon on the button + hover
Mathieu-Deharbe 18b2a28
override tabBackground maxWidth
Mathieu-Deharbe 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
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
95 changes: 95 additions & 0 deletions
95
src/components/dialogs/limits/operational-limits-group-tab.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,95 @@ | ||
| import { useCallback, useEffect, useState } from 'react'; | ||
| import { OperationalLimitsGroupFormInfos } from '../network-modifications/line/modification/line-modification-type'; | ||
| import { Stack, TextField, Typography } from '@mui/material'; | ||
| import { FormattedMessage } from 'react-intl'; | ||
| import { grey } from '@mui/material/colors'; | ||
| import { APPLICABILITY } from '../../network/constants'; | ||
| import { LimitsPropertiesStack } from './limits-properties-stack'; | ||
| import { LIMITS_PROPERTIES, OPERATIONAL_LIMITS_GROUPS } from '../../utils/field-constants'; | ||
|
|
||
| export interface OperationalLimitsGroupTabProps { | ||
| editing: boolean; | ||
| opLg: OperationalLimitsGroupFormInfos; | ||
| isAModification: boolean; | ||
| editionError: string; | ||
| parentFormName: string; | ||
| editedLimitGroupName: string; | ||
| index: number; | ||
| finishEditingLimitsGroup: () => void; | ||
| setEditedLimitGroupName: React.Dispatch<React.SetStateAction<string>>; | ||
| } | ||
|
|
||
| export function OperationalLimitsGroupTab({ | ||
| editing, | ||
| opLg, | ||
| isAModification, | ||
| finishEditingLimitsGroup, | ||
| editionError, | ||
| parentFormName, | ||
| editedLimitGroupName, | ||
| setEditedLimitGroupName, | ||
| index, | ||
| }: Readonly<OperationalLimitsGroupTabProps>) { | ||
| // control of the focus on the edited tab | ||
| const [editLimitGroupRef, setEditLimitGroupRef] = useState<HTMLInputElement>(); | ||
| useEffect(() => { | ||
| if (editing && editLimitGroupRef) { | ||
| editLimitGroupRef.focus(); | ||
| } | ||
| }, [editing, editLimitGroupRef]); | ||
| const onRefSet = useCallback((ref: HTMLInputElement) => { | ||
| setEditLimitGroupRef(ref); | ||
| }, []); | ||
|
|
||
| const handleKeyDown = useCallback( | ||
| (event: React.KeyboardEvent) => { | ||
| if (event.key === 'Enter') { | ||
| finishEditingLimitsGroup(); | ||
| } | ||
| }, | ||
| [finishEditingLimitsGroup] | ||
| ); | ||
|
|
||
| return ( | ||
| <> | ||
| {editing ? ( | ||
| <TextField | ||
| value={editedLimitGroupName} | ||
| onChange={(event: React.ChangeEvent<HTMLInputElement>) => { | ||
| setEditedLimitGroupName(event.target.value); | ||
| }} | ||
| onKeyDown={handleKeyDown} | ||
| inputRef={onRefSet} | ||
| onBlur={() => finishEditingLimitsGroup()} | ||
| error={!!editionError} | ||
| helperText={!!editionError && <FormattedMessage id={editionError} />} | ||
| size="small" | ||
| fullWidth | ||
| /> | ||
| ) : ( | ||
| <Stack direction="row" spacing={1}> | ||
| <Stack spacing={0}> | ||
| {opLg.name} | ||
| {opLg?.applicability ? ( | ||
| <Typography noWrap align="left" color={grey[500]}> | ||
| <FormattedMessage | ||
| id={ | ||
| Object.values(APPLICABILITY).find((item) => item.id === opLg.applicability) | ||
| ?.label | ||
| } | ||
| /> | ||
| </Typography> | ||
| ) : ( | ||
| '' | ||
| )} | ||
| </Stack> | ||
| {!isAModification && ( | ||
| <LimitsPropertiesStack | ||
| name={`${parentFormName}.${OPERATIONAL_LIMITS_GROUPS}[${index}].${LIMITS_PROPERTIES}`} | ||
| /> | ||
| )} | ||
| </Stack> | ||
| )} | ||
| </> | ||
| ); | ||
| } | ||
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.