-
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
Fix boolean field in table view #5728
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { useBooleanField } from '@/object-record/record-field/meta-types/hooks/useBooleanField'; | ||
import { BooleanDisplay } from '@/ui/field/display/components/BooleanDisplay'; | ||
|
||
export const BooleanFieldDisplay = () => { | ||
const { fieldValue } = useBooleanField(); | ||
|
||
return <BooleanDisplay value={fieldValue} />; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { useTheme } from '@emotion/react'; | ||
import styled from '@emotion/styled'; | ||
import { IconCheck, IconX } from 'twenty-ui'; | ||
|
||
const StyledBooleanFieldValue = styled.div` | ||
margin-left: ${({ theme }) => theme.spacing(1)}; | ||
`; | ||
|
||
type BooleanDisplayProps = { | ||
value: boolean | null; | ||
}; | ||
|
||
export const BooleanDisplay = ({ value }: BooleanDisplayProps) => { | ||
const theme = useTheme(); | ||
|
||
return ( | ||
<> | ||
{' '} | ||
{value ? ( | ||
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. @ijreilly I think we prefer to explicitly use isDefined in the FE for this case 👍 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. Actually isDefined = |
||
<IconCheck size={theme.icon.size.sm} /> | ||
) : ( | ||
<IconX size={theme.icon.size.sm} /> | ||
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. Check if 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. indeed, think either you should display nothing in case of null value (here you will display IconX) or explicitelly display IconX |
||
)} | ||
<StyledBooleanFieldValue> | ||
{value ? 'True' : 'False'} | ||
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. same |
||
</StyledBooleanFieldValue> | ||
</> | ||
); | ||
}; |
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.
Remove the unnecessary space character.