diff --git a/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/_components/DocumentEditor/Editor/Playground/DocumentParams/HistoryLogParams/useLogHistoryParams.ts b/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/_components/DocumentEditor/Editor/Playground/DocumentParams/HistoryLogParams/useLogHistoryParams.ts index 0cef5d1f7..21e7bcebc 100644 --- a/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/_components/DocumentEditor/Editor/Playground/DocumentParams/HistoryLogParams/useLogHistoryParams.ts +++ b/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/_components/DocumentEditor/Editor/Playground/DocumentParams/HistoryLogParams/useLogHistoryParams.ts @@ -8,7 +8,7 @@ import useDocumentLogWithPaginationPosition, { LogWithPosition, } from '$/stores/documentLogWithPaginationPosition' import useDocumentLogsPagination from '$/stores/useDocumentLogsPagination' -import { useFilterOptions } from '$/hooks/useLogFilterOptions' +import { useDefaultLogFilterOptions } from '$/hooks/logFilters/useDefaultLogFilterOptions' const ONLY_ONE_PAGE = '1' @@ -28,7 +28,7 @@ export function useLogHistoryParams({ commitVersionUuid, }) - const filterOptions = useFilterOptions() + const filterOptions = useDefaultLogFilterOptions() const { data: pagination, isLoading: isLoadingCounter } = useDocumentLogsPagination({ documentUuid: document.documentUuid, diff --git a/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/evaluations/[evaluationId]/_components/ManualEvaluationResults/DocumentLogsTable/index.tsx b/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/evaluations/[evaluationId]/_components/ManualEvaluationResults/DocumentLogsTable/index.tsx index 6912acd33..179c671e6 100644 --- a/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/evaluations/[evaluationId]/_components/ManualEvaluationResults/DocumentLogsTable/index.tsx +++ b/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/evaluations/[evaluationId]/_components/ManualEvaluationResults/DocumentLogsTable/index.tsx @@ -30,7 +30,7 @@ import { useSearchParams } from 'next/navigation' import { DocumentLogWithMetadataAndErrorAndEvaluationResult } from '..' import { ResultCellContent } from '../../EvaluationResults/EvaluationResultsTable' import { useCommits } from '$/stores/commitsStore' -import { useFilterOptions } from '$/hooks/useLogFilterOptions' +import { useDefaultLogFilterOptions } from '$/hooks/logFilters/useDefaultLogFilterOptions' const countLabel = (selected: number) => (count: number) => { return selected ? `${selected} of ${count} logs selected` : `${count} logs` @@ -69,7 +69,7 @@ export const DocumentLogsTable = forwardRef( const { commit } = useCurrentCommit() const { document } = useCurrentDocument() const { data: commits } = useCommits() - const filterOptions = useFilterOptions() + const filterOptions = useDefaultLogFilterOptions() const { data: pagination, isLoading } = useDocumentLogsPagination({ documentUuid: commits ? document.documentUuid : undefined, projectId: project.id, diff --git a/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/logs/_components/DocumentLogs/DocumentLogsTable.tsx b/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/logs/_components/DocumentLogs/DocumentLogsTable.tsx index 277f7c1ba..c34ed68a2 100644 --- a/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/logs/_components/DocumentLogs/DocumentLogsTable.tsx +++ b/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/logs/_components/DocumentLogs/DocumentLogsTable.tsx @@ -6,6 +6,7 @@ import { capitalize } from 'lodash-es' import { DocumentLogFilterOptions, EvaluationResultableType, + LOG_FILTERS_ENCODED_PARAMS, } from '@latitude-data/core/browser' import { buildPagination } from '@latitude-data/core/lib/pagination/buildPagination' import { @@ -142,6 +143,7 @@ export const DocumentLogsTable = forwardRef( }) const queryParams = typeof window !== 'undefined' ? window.location.search : '' + return ( ( .root, count: pagination.count, queryParams, + encodeQueryParams: false, + paramsToEncode: LOG_FILTERS_ENCODED_PARAMS, page: Number(page), pageSize: Number(pageSize), }) diff --git a/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/logs/_components/Filters/CommitFilter.tsx b/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/logs/_components/Filters/CommitFilter/index.tsx similarity index 81% rename from apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/logs/_components/Filters/CommitFilter.tsx rename to apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/logs/_components/Filters/CommitFilter/index.tsx index 0877f33bb..087921470 100644 --- a/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/logs/_components/Filters/CommitFilter.tsx +++ b/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/logs/_components/Filters/CommitFilter/index.tsx @@ -4,17 +4,17 @@ import { Commit } from '@latitude-data/core/browser' import { Button, Checkbox, Text } from '@latitude-data/web-ui' import { useCommits } from '$/stores/commitsStore' -import { BadgeCommit } from '../../../../../_components/Sidebar/CommitSelector/CommitItem' -import { FilterButton } from './FilterButton' +import { BadgeCommit } from '../../../../../../_components/Sidebar/CommitSelector/CommitItem' +import { FilterButton } from '../FilterButton' function CommitCheckbox({ commit, selectedCommitsIds, - setSelectedCommitsIds, + onSelectCommits, }: { commit: Commit selectedCommitsIds: number[] - setSelectedCommitsIds: (selectedCommitsIds: number[]) => void + onSelectCommits: (selectedCommitsIds: number[]) => void }) { const isSelected = useMemo( () => selectedCommitsIds.includes(commit.id), @@ -22,7 +22,7 @@ function CommitCheckbox({ ) const onSelect = useCallback(() => { - setSelectedCommitsIds( + onSelectCommits( isSelected ? selectedCommitsIds.filter((id) => id !== commit.id) : [...selectedCommitsIds, commit.id], @@ -51,12 +51,12 @@ function CommitsList({ title, commits, selectedCommitsIds, - setSelectedCommitsIds, + onSelectCommits, }: { title: string commits: Commit[] selectedCommitsIds: number[] - setSelectedCommitsIds: (selectedCommitsIds: number[]) => void + onSelectCommits: (selectedCommitsIds: number[]) => void }) { return (
@@ -67,7 +67,7 @@ function CommitsList({ ))} @@ -78,12 +78,12 @@ function CommitsList({ export function CommitFilter({ selectedCommitsIds, - setSelectedCommitsIds, + onSelectCommits, isDefault, reset, }: { selectedCommitsIds: number[] - setSelectedCommitsIds: (selectedCommitsIds: number[]) => void + onSelectCommits: (selectedCommitsIds: number[]) => void isDefault: boolean reset: () => void }) { @@ -131,7 +131,7 @@ export function CommitFilter({ - setSelectedCommitsIds(headerState ? [] : commits.map((c) => c.id)) + onSelectCommits(headerState ? [] : commits.map((c) => c.id)) } label={ @@ -140,29 +140,24 @@ export function CommitFilter({ } /> -
-
+
{drafts.length > 0 ? ( ) : null}
diff --git a/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/logs/_components/Filters/LogSourceFilter.tsx b/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/logs/_components/Filters/LogSourceFilter/index.tsx similarity index 79% rename from apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/logs/_components/Filters/LogSourceFilter.tsx rename to apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/logs/_components/Filters/LogSourceFilter/index.tsx index 0e9752334..4a87d67e5 100644 --- a/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/logs/_components/Filters/LogSourceFilter.tsx +++ b/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/logs/_components/Filters/LogSourceFilter/index.tsx @@ -3,7 +3,7 @@ import { useCallback, useMemo } from 'react' import { LOG_SOURCES, LogSources } from '@latitude-data/core/browser' import { Button, Checkbox, Text } from '@latitude-data/web-ui' -import { FilterButton } from './FilterButton' +import { FilterButton } from '../FilterButton' const LogSourceLabel: { [key in LogSources]: string } = { [LogSources.API]: 'API', @@ -16,11 +16,11 @@ const LogSourceLabel: { [key in LogSources]: string } = { function LogSourceCheckbox({ logSource, selectedLogSources, - setSelectedLogSources, + onSelectLogSources, }: { logSource: LogSources selectedLogSources: LogSources[] - setSelectedLogSources: (selectedLogSources: LogSources[]) => void + onSelectLogSources: (selectedLogSources: LogSources[]) => void }) { const isSelected = useMemo( () => selectedLogSources.includes(logSource), @@ -28,12 +28,12 @@ function LogSourceCheckbox({ ) const onSelect = useCallback(() => { - setSelectedLogSources( + onSelectLogSources( isSelected ? selectedLogSources.filter((origin) => origin !== logSource) : [...selectedLogSources, logSource], ) - }, [selectedLogSources, logSource, isSelected]) + }, [selectedLogSources, logSource, isSelected, onSelectLogSources]) return ( void + onSelectLogSources: (selectedOrigins: LogSources[]) => void isDefault: boolean reset: () => void }) { @@ -87,7 +87,7 @@ export function LogSourceFilter({ - setSelectedLogSources(headerState ? [] : LOG_SOURCES) + onSelectLogSources(headerState ? [] : LOG_SOURCES) } label={ @@ -96,22 +96,17 @@ export function LogSourceFilter({ } /> -
-