Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
oandregal committed Feb 6, 2025
1 parent 064329a commit b3515b6
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions client/sites/tools/logs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import {
getVisibleFields,
getFilterValue,
} from './hooks/use-view';
import type { View, ViewTable } from '@wordpress/dataviews';
import type { View } from '@wordpress/dataviews';
import type { Moment } from 'moment';
import './style.scss';

Expand Down Expand Up @@ -265,6 +265,7 @@ export const SiteLogsDataViews = ( { logType }: { logType: LogType } ) => {

const { __ } = useI18n();
const moment = useLocalizedMoment();
const siteGmtOffset = useCurrentSiteGmtOffset();
const getLatestDateRange = useCallback( () => {
const startTime = moment().subtract( 7, 'd' );
const endTime = moment();
Expand Down Expand Up @@ -307,16 +308,6 @@ export const SiteLogsDataViews = ( { logType }: { logType: LogType } ) => {
const fields = useFields( { logType } );
const [ view, setView ] = useView( { logType } );
const { data, paginationInfo, isLoading } = useData( { view, logType, dateRange } );
const onChangeView = ( newView: View ) =>
setView(
( oldView: View ) =>
( {
...oldView,
...newView,
type: 'table' as const,
layout: ( oldView as ViewTable )?.layout,
} ) as ViewTable
);
useEffect( () => {
setView( ( view: View ) => ( {
...view,
Expand All @@ -328,8 +319,6 @@ export const SiteLogsDataViews = ( { logType }: { logType: LogType } ) => {
} ) );
}, [ logType, setView ] );

const siteGmtOffset = useCurrentSiteGmtOffset();

const { downloadLogs } = useSiteLogsDownloader( { roundDateRangeToWholeDays: false } );
const onDownloadLogs = useCallback( () => {
downloadLogs( {
Expand Down Expand Up @@ -427,7 +416,7 @@ export const SiteLogsDataViews = ( { logType }: { logType: LogType } ) => {
paginationInfo={ paginationInfo }
fields={ fields }
view={ view }
onChangeView={ onChangeView }
onChangeView={ setView }
search={ false }
getItemId={ getItemId }
defaultLayouts={ { table: {} } }
Expand Down

0 comments on commit b3515b6

Please sign in to comment.