-
Notifications
You must be signed in to change notification settings - Fork 60
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
Document evaluation results table with pagination #300
Merged
andresgutgon
merged 2 commits into
main
from
feature/paginate-document-evaluation-results-table
Sep 30, 2024
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 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
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { useCallback, useState } from 'react' | ||
import { useCallback, useRef, useState } from 'react' | ||
|
||
import { EvaluationDto, ProviderLogDto } from '@latitude-data/core/browser' | ||
import { | ||
|
@@ -12,6 +12,7 @@ import { | |
ReactStateDispatch, | ||
TabSelector, | ||
} from '@latitude-data/web-ui' | ||
import useDynamicHeight from '$/hooks/useDynamicHeight' | ||
import useProviderLogs from '$/stores/providerLogs' | ||
import useSWR from 'swr' | ||
|
||
|
@@ -83,23 +84,35 @@ export function EvaluationResultInfo({ | |
evaluationResult: EvaluationResultWithMetadata | ||
providerLog?: ProviderLogDto | ||
}) { | ||
const ref = useRef<HTMLDivElement>(null) | ||
const [selectedTab, setSelectedTab] = useState<string>('metadata') | ||
const [selected, setSelected] = useState<MaybeDocumentLog>(null) | ||
const onClickOpen = useCallback(async () => { | ||
setSelected(evaluationResult.documentLogId) | ||
}, [evaluationResult.documentLogId]) | ||
const height = useDynamicHeight({ ref, paddingBottom: 16 }) | ||
return ( | ||
<> | ||
<div className='w-80 flex-shrink-0 flex flex-col border border-border rounded-lg px-4 pt-6 items-center'> | ||
<TabSelector | ||
options={[ | ||
{ label: 'Metadata', value: 'metadata' }, | ||
{ label: 'Messages', value: 'messages' }, | ||
]} | ||
selected={selectedTab} | ||
onSelect={setSelectedTab} | ||
/> | ||
<div className='flex flex-col relative w-full h-full max-h-full max-w-full overflow-auto'> | ||
<div | ||
ref={ref} | ||
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. 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. |
||
className='relative w-80 flex-shrink-0 flex flex-col border border-border rounded-lg items-center custom-scrollbar overflow-y-auto' | ||
style={{ | ||
maxHeight: height ? `${height}px` : 'auto', | ||
}} | ||
> | ||
<div className='z-10 w-full sticky top-0 px-4 bg-white flex justify-center'> | ||
<div className='pt-6'> | ||
<TabSelector | ||
options={[ | ||
{ label: 'Metadata', value: 'metadata' }, | ||
{ label: 'Messages', value: 'messages' }, | ||
]} | ||
selected={selectedTab} | ||
onSelect={setSelectedTab} | ||
/> | ||
</div> | ||
</div> | ||
<div className='px-4 flex flex-col relative w-full max-w-full'> | ||
{selectedTab === 'metadata' && ( | ||
<EvaluationResultMetadata | ||
evaluation={evaluation} | ||
|
@@ -110,8 +123,10 @@ export function EvaluationResultInfo({ | |
{selectedTab === 'messages' && ( | ||
<EvaluationResultMessages providerLog={providerLog} /> | ||
)} | ||
</div> | ||
<div className='w-full py-4 sticky bottom-0 bg-white flex justify-center'> | ||
<Button variant='link' onClick={onClickOpen}> | ||
Check original log metadata | ||
Check original log | ||
<Icon name='arrowRight' widthClass='w-4' heightClass='h-4' /> | ||
</Button> | ||
</div> | ||
|
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.
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.
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.
No so bad in the end. We just need to invoke
$dynamic()
in our queries and it will be paginated and fully typed