Skip to content

Commit

Permalink
fix flip tracking item dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-luger committed Jan 21, 2025
1 parent 941d458 commit a31dfd3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 22 deletions.
35 changes: 16 additions & 19 deletions components/FlipTracking/FlipTracking.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ export function FlipTracking(props: Props) {
allowShowLess
initialHeight={60}
onShowChange={show => setIsFilterExpanded(show)}
containerStyle={{ overflow: 'visible' }}
content={
<div style={{ display: 'flex', gap: 10, flexDirection: 'column', paddingBottom: 20 }}>
<div className={styles.filterContainer}>
Expand Down Expand Up @@ -307,23 +308,19 @@ export function FlipTracking(props: Props) {
<div className={styles.filterContainer}>
<label style={{ minWidth: '100px' }}>Item:</label>
<div className={styles.itemFilterContainer} style={{ position: 'relative', height: '38px' }}>
<div style={{ position: 'absolute' }}>
<div style={isFilterExpanded ? { position: 'fixed' } : undefined}>
<ApiSearchField
multiple={false}
defaultSelected={item ? [item] : undefined}
className={styles.multiSearch}
onChange={items => {
if (!items || items.length === 0) {
setItem(undefined)
} else {
setItem(items[0])
}
}}
searchFunction={api.itemSearch}
/>
</div>
</div>
<ApiSearchField
multiple={false}
defaultSelected={item ? [item] : undefined}
className={styles.multiSearch}
onChange={items => {
if (!items || items.length === 0) {
setItem(undefined)
} else {
setItem(items[0])
}
}}
searchFunction={api.itemSearch}
/>
</div>
</div>
</div>
Expand All @@ -348,8 +345,8 @@ export function FlipTracking(props: Props) {
<DatePicker
className={'form-control'}
onChange={e => {
setRangeEndDate(e?? new Date())
loadFlipsForTimespan(rangeStartDate, e?? new Date())
setRangeEndDate(e ?? new Date())
loadFlipsForTimespan(rangeStartDate, e ?? new Date())
}}
minDate={new Date(new Date().getTime() - 1000 * 60 * 60 * 24 * 30 * 2)}
maxDate={new Date()}
Expand Down
4 changes: 2 additions & 2 deletions components/FlipTracking/FlipTrackingListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ export function FlipTrackingListItem(props: Props) {
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<Table>
<tbody>
{props.trackedFlip.propertyChanges.map(change => (
<tr>
{props.trackedFlip.propertyChanges.map((change, i) => (
<tr key={props.trackedFlip.uId + '-' + i}>
<td>{change.description}</td>
<td>
{change.effect > 0 ? (
Expand Down
6 changes: 5 additions & 1 deletion components/ShowMoreText/ShowMoreText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ interface Props {
alwaysShowAll?: boolean
allowShowLess?: boolean
onShowChange?: (isExpanded: boolean) => void
containerStyle?: React.CSSProperties
}

const ShowMoreText = (props: Props) => {
Expand All @@ -22,7 +23,10 @@ const ShowMoreText = (props: Props) => {
}

return (
<div className={`${styles.textContainer} ${isExpanded ? styles.expanded : ''}`} style={{ height: isExpanded ? 'auto' : props.initialHeight }}>
<div
className={`${styles.textContainer} ${isExpanded ? styles.expanded : ''}`}
style={{ height: isExpanded ? 'auto' : props.initialHeight, ...props.containerStyle }}
>
{props.content}
<div className={styles.showMoreContainer} onClick={toggleExpand}>
<span className={styles.showMoreText}>
Expand Down

0 comments on commit a31dfd3

Please sign in to comment.