-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: resolve empty value display in
DoubleTag
and update `BAIInterv…
…alView` (#2813) **Changes:** - Replaced `BAIIntervalText` with new `BAIIntervalView` component that supports render props - Updated `DoubleTag` component to handle string highlighting and simplified value types - Refactored tag rendering to use object-based values consistently - Added type safety improvements for tag labels and values **Rationale:** Improves component reusability and type safety by introducing a more flexible interval view component with render prop support. Standardizes the way tags are rendered across the application while adding proper highlighting capabilities. **How to test:** 1. Check agent list running time displays correctly 2. Verify session elapsed time shows properly 3. Test customized image tags display correctly Example usage: ```tsx <BAIIntervalView callback={() => baiClient.utils.elapsedTime(value, Date.now())} delay={1000} render={(intervalValue) => ( <DoubleTag values={[ { label: 'Running' }, { label: intervalValue } ]} /> )} /> ``` **Checklist:** - [ ] Test interval updates across all usage locations - [ ] Verify tag highlighting works with search functionality - [ ] Check type safety of tag value props - [ ] Ensure backwards compatibility with existing tag implementations **Screenshots:** Before ![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/2HueYSdFvL8pOB5mgrUQ/497082c2-e79a-43bd-a86a-70554e2984c3.png) After ![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/2HueYSdFvL8pOB5mgrUQ/9b654ec0-cfa6-400d-88d4-bd1cebcd99a2.png)
- Loading branch information
Showing
15 changed files
with
125 additions
and
156 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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,21 @@ | ||
import { useIntervalValue } from '../hooks/useIntervalValue'; | ||
import _ from 'lodash'; | ||
import React from 'react'; | ||
|
||
type RenderProp<T> = (data: T) => React.ReactNode; | ||
const BAIIntervalView = <T,>({ | ||
callback, | ||
render, | ||
delay, | ||
triggerKey, | ||
}: { | ||
callback: () => T; | ||
render?: RenderProp<T>; | ||
delay: number; | ||
triggerKey?: string; | ||
}) => { | ||
const value = useIntervalValue(callback, delay, triggerKey); | ||
return _.isUndefined(render) ? value : render(value); | ||
}; | ||
|
||
export default BAIIntervalView; |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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.