-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Avanced Settings: Custom API names for Select & Multi-Select Keys #7489
Conversation
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.
PR Summary
This PR implements advanced settings for Select and Multi-Select fields in the data model settings, focusing on custom API names for options. Key changes include:
- Added 'Advanced Mode' toggle to display and edit API keys for Select/Multi-Select options
- Introduced new UI components for advanced settings, including animated transitions
- Updated TextInputV2 component to improve right icon and error state handling
- Implemented state management using Recoil for advanced mode toggle
- Created new animation constants and variants for smooth UI transitions
5 file(s) reviewed, 5 comment(s)
Edit PR Review Bot Settings
width: 0, | ||
overflow: 'hidden', | ||
transition: { | ||
opactity: { duration: ADVANCED_SETTINGS_ANIMATION_DURATION.opacity }, |
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.
syntax: 'opactity' is misspelled. It should be 'opacity'.
@@ -0,0 +1,31 @@ | |||
import { ADVANCED_SETTINGS_ANIMATION_DURATION } from '@/settings/constants/AdvancedSettingsAnimationDurations'; | |||
|
|||
export const EXPANDED_WIDTH_ANIMATION_VARIANTS = { |
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.
style: Consider using a loop or helper function to reduce repetition in the variant definitions.
@@ -205,7 +245,33 @@ export const SettingsDataModelFieldSelectForm = ({ | |||
render={({ field: { onChange, value: options } }) => ( | |||
<> | |||
<StyledContainer> | |||
<StyledLabel>Options</StyledLabel> | |||
<StyledLabelContainer> | |||
<AnimatePresence> |
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.
style: This AnimatePresence block could be extracted into a separate component for better readability and maintainability
onDragEnd={(result) => handleDragEnd(options, result, onChange)} | ||
draggableItems={ |
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.
style: Consider memoizing this callback to prevent unnecessary re-renders
>` | ||
background-color: ${({ theme }) => theme.background.transparent.lighter}; | ||
border: 1px solid | ||
${({ theme, error }) => | ||
error ? theme.border.color.danger : theme.border.color.medium}; | ||
border-bottom-left-radius: ${({ theme, LeftIcon }) => | ||
!LeftIcon && theme.border.radius.sm}; | ||
border-right: none; | ||
border-right: ${({ RightIcon }) => RightIcon && 'none'}; |
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.
style: Consider using a ternary operator for consistency with other style properties
color: ${({ theme }) => theme.font.color.light}; | ||
font-size: ${({ theme }) => theme.font.size.xs}; | ||
font-weight: ${({ theme }) => theme.font.weight.semiBold}; | ||
margin-bottom: 6px; |
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.
can you use theme sizes?
@@ -126,7 +156,10 @@ export const SettingsDataModelFieldSelectFormOptionRow = ({ | |||
onChange({ | |||
...option, | |||
label, | |||
value: getOptionValueFromLabel(label), | |||
value: | |||
option.value === getOptionValueFromLabel(option.label) |
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.
Can you explain your condition rationale?
Why not use isAdvancedModeEnabled here to decide whether or not label update should trigger value update?
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.
Hello @ijreilly
Before the changes, if the user edited the label, the API value changed accordingly, right? now we are maintaining this synchronization if the user does not change the API value, so the user do not need to write everything again for each API value, if the user just wants to edit few values
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.
Got it thanks, I will add an intermediary const to make that clear
Hello @Bonapara |
Sorry my bad @gitstart-twenty! |
Log
|
Description
Demo
https://www.loom.com/share/17a37bf5549a4a23ba12343b6046ec6b?sid=4cf297f3-66db-44c9-9a9b-7bde89b90d02
Refs
#6146