refactor: refine toolbar controls and model drawer
This commit is contained in:
+22
-19
@@ -19,7 +19,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
import { useState, useCallback, useMemo } from 'react'
|
||||
import { useQueryClient, useIsFetching } from '@tanstack/react-query'
|
||||
import { useNavigate, getRouteApi } from '@tanstack/react-router'
|
||||
import { type Table } from '@tanstack/react-table'
|
||||
import type { Table } from '@tanstack/react-table'
|
||||
import { Eye, EyeOff } from 'lucide-react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useIsAdmin } from '@/hooks/use-admin'
|
||||
@@ -265,26 +265,28 @@ export function CommonLogsFilterBar<TData>(
|
||||
const statsBar = (
|
||||
<div className='flex flex-wrap items-center gap-2'>
|
||||
<CommonLogsStats />
|
||||
<Tooltip>
|
||||
<TooltipTrigger
|
||||
render={
|
||||
<Button
|
||||
variant='ghost'
|
||||
size='icon'
|
||||
onClick={() => setSensitiveVisible(!sensitiveVisible)}
|
||||
aria-label={sensitiveVisible ? t('Hide') : t('Show')}
|
||||
className='text-muted-foreground hover:text-foreground size-7'
|
||||
/>
|
||||
}
|
||||
>
|
||||
{sensitiveVisible ? <Eye /> : <EyeOff />}
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>
|
||||
{sensitiveVisible ? t('Hide') : t('Show')}
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</div>
|
||||
)
|
||||
const sensitiveToggle = (
|
||||
<Tooltip>
|
||||
<TooltipTrigger
|
||||
render={
|
||||
<Button
|
||||
variant='ghost'
|
||||
size='icon'
|
||||
onClick={() => setSensitiveVisible(!sensitiveVisible)}
|
||||
aria-label={sensitiveVisible ? t('Hide') : t('Show')}
|
||||
className='text-muted-foreground hover:text-foreground size-7'
|
||||
/>
|
||||
}
|
||||
>
|
||||
{sensitiveVisible ? <Eye /> : <EyeOff />}
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>
|
||||
{sensitiveVisible ? t('Hide') : t('Show')}
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
)
|
||||
|
||||
const dateRangeFilter = (
|
||||
<LogsFilterField wide>
|
||||
@@ -410,6 +412,7 @@ export function CommonLogsFilterBar<TData>(
|
||||
<LogsFilterToolbar
|
||||
table={props.table}
|
||||
stats={statsBar}
|
||||
actionStart={sensitiveToggle}
|
||||
primaryFilters={
|
||||
<>
|
||||
{dateRangeFilter}
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { useState, type ComponentProps, type ReactNode } from 'react'
|
||||
import { type Table } from '@tanstack/react-table'
|
||||
import type { Table } from '@tanstack/react-table'
|
||||
import { useMediaQuery } from '@/hooks'
|
||||
import { ChevronDown, Loader2 } from 'lucide-react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
@@ -44,6 +44,7 @@ interface LogsFilterToolbarProps<TData> {
|
||||
mobileFilters?: ReactNode
|
||||
mobileFilterCount?: number
|
||||
stats?: ReactNode
|
||||
actionStart?: ReactNode
|
||||
hasActiveFilters: boolean
|
||||
hasAdvancedActiveFilters?: boolean
|
||||
advancedFilterCount?: number
|
||||
@@ -142,6 +143,7 @@ export function LogsFilterToolbar<TData>(props: LogsFilterToolbarProps<TData>) {
|
||||
<div className='mt-2 flex flex-col gap-2'>
|
||||
{props.stats}
|
||||
<div className='flex items-center justify-end gap-1.5'>
|
||||
{props.actionStart}
|
||||
<DrawerTrigger asChild>
|
||||
<Button
|
||||
type='button'
|
||||
@@ -240,6 +242,7 @@ export function LogsFilterToolbar<TData>(props: LogsFilterToolbarProps<TData>) {
|
||||
<div className='mt-2 flex flex-wrap items-center gap-2'>
|
||||
{props.stats}
|
||||
<div className='ms-auto flex flex-wrap items-center justify-end gap-1.5 sm:gap-2'>
|
||||
{props.actionStart}
|
||||
<Button
|
||||
type='button'
|
||||
variant='outline'
|
||||
|
||||
Reference in New Issue
Block a user