From 53b4f9ebfcc52da009fca0c16f4918bf957b978b Mon Sep 17 00:00:00 2001 From: "coderabbitai[bot]" <136622811+coderabbitai[bot]@users.noreply.github.com> Date: Mon, 2 Mar 2026 12:14:23 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Add=20docstrings=20to=20`claude/?= =?UTF-8?q?fix-timeline-flicker-k9rBq`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Docstrings generation was requested by @TinyKitten. * https://github.com/TrainLCD/THQMe/pull/30#issuecomment-3983524617 The following files were modified: * `app/(tabs)/logs.tsx` * `app/(tabs)/timeline.tsx` * `lib/location-store.tsx` --- app/(tabs)/logs.tsx | 95 +++++++++++++++++++---------------------- app/(tabs)/timeline.tsx | 91 +++++++++++++++++---------------------- lib/location-store.tsx | 23 +++++++++- 3 files changed, 106 insertions(+), 103 deletions(-) diff --git a/app/(tabs)/logs.tsx b/app/(tabs)/logs.tsx index cc58901..a01d9e6 100644 --- a/app/(tabs)/logs.tsx +++ b/app/(tabs)/logs.tsx @@ -42,7 +42,16 @@ const LOG_LEVELS: { value: LogLevel; label: string }[] = [ // アコーディオンコンテンツの最大高さ(アニメーション用) const ACCORDION_MAX_HEIGHT_BASE = 300; // タイプ + レベルフィルターのみ -const ACCORDION_MAX_HEIGHT_WITH_DEVICE = 400; // + デバイスフィルター +const ACCORDION_MAX_HEIGHT_WITH_DEVICE = 400; /** + * Render the Logs screen with search, filter controls, and a list of log entries. + * + * Displays a sticky header with connection status, a search box, and an expandable filter + * accordion (type, level, device). Filters, search query, and device presence control the + * displayed log list. Provides controls to clear stored logs and preserves scroll position + * when new items are prepended. + * + * @returns The JSX element for the Logs screen containing the header, filter UI, and filtered log list. + */ export default function LogsScreen() { const { state, clearUpdates } = useLocation(); @@ -244,13 +253,31 @@ export default function LogsScreen() { [] ); - const keyExtractor = useCallback((item: LogData, index: number) => { - return item.id || `log-${item.timestamp}-${index}`; - }, []); + const keyExtractor = useCallback((item: LogData) => item.id, []); - const ListHeader = useMemo( + const ListEmpty = useMemo( () => ( - + + 📝 + + {hasActiveFilter + ? "条件に一致するログがありません" + : "ログがありません"} + + + {hasActiveFilter + ? "フィルター条件を変更してください" + : "WebSocketに接続してログデータを受信してください"} + + + ), + [hasActiveFilter] + ); + + return ( + + {/* ヘッダー部分(スクロールに追従して固定表示) */} + {/* Header with status */} ログ @@ -510,58 +537,18 @@ export default function LogsScreen() { )} - ), - [ - state.connectionStatus, - state.logs.length, - searchQuery, - selectedTypes, - selectedLevels, - selectedDevices, - logDeviceIds, - filteredLogs.length, - hasActiveFilter, - handleClearData, - handleTypeSelect, - handleLevelSelect, - handleDeviceSelect, - handleClearSearch, - toggleFilter, - arrowStyle, - contentStyle, - colors.muted, - ] - ); - const ListEmpty = useMemo( - () => ( - - 📝 - - {hasActiveFilter - ? "条件に一致するログがありません" - : "ログがありません"} - - - {hasActiveFilter - ? "フィルター条件を変更してください" - : "WebSocketに接続してログデータを受信してください"} - - - ), - [hasActiveFilter] - ); - - return ( - item.id, []); - const ListHeader = useMemo( + const ListEmpty = useMemo( () => ( - + + 📍 + + {hasActiveFilter + ? "条件に一致するデータがありません" + : "データがありません"} + + + {hasActiveFilter + ? "フィルター条件を変更してください" + : "WebSocketに接続して位置情報データを受信してください"} + + + ), + [hasActiveFilter] + ); + + return ( + + {/* ヘッダー部分(スクロールに追従して固定表示) */} + {/* Header with status */} タイムライン @@ -510,61 +536,18 @@ export default function TimelineScreen() { )} - ), - [ - state.connectionStatus, - state.deviceIds, - state.lineIds, - lineNames, - lineColors, - state.updates.length, - searchQuery, - selectedStates, - selectedDevices, - selectedRoutes, - filteredUpdates.length, - hasActiveFilter, - handleClearData, - handleStateSelect, - handleDeviceSelect, - handleRouteSelect, - handleClearSearch, - toggleFilter, - arrowStyle, - contentStyle, - colors.muted, - ] - ); - - const ListEmpty = useMemo( - () => ( - - 📍 - - {hasActiveFilter - ? "条件に一致するデータがありません" - : "データがありません"} - - - {hasActiveFilter - ? "フィルター条件を変更してください" - : "WebSocketに接続して位置情報データを受信してください"} - - - ), - [hasActiveFilter] - ); - return ( -