Skip to content

Commit ff762d3

Browse files
move formatSize to format file (RooCodeInc#2662)
1 parent 6e40ec1 commit ff762d3

File tree

5 files changed

+17
-11
lines changed

5 files changed

+17
-11
lines changed

.changeset/orange-geese-attend.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"claude-dev": patch
3+
---
4+
5+
cleanup

webview-ui/src/components/chat/TaskHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { mentionRegexGlobal } from "../../../../src/shared/context-mentions"
55
import { ClineMessage } from "../../../../src/shared/ExtensionMessage"
66
import { useExtensionState } from "../../context/ExtensionStateContext"
77
import { formatLargeNumber } from "../../utils/format"
8-
import { formatSize } from "../../utils/size"
8+
import { formatSize } from "../../utils/format"
99
import { vscode } from "../../utils/vscode"
1010
import Thumbnails from "../common/Thumbnails"
1111
import { normalizeApiConfiguration } from "../settings/ApiOptions"

webview-ui/src/components/history/HistoryView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Virtuoso } from "react-virtuoso"
55
import { memo, useMemo, useState, useEffect, useCallback } from "react"
66
import Fuse, { FuseResult } from "fuse.js"
77
import { formatLargeNumber } from "../../utils/format"
8-
import { formatSize } from "../../utils/size"
8+
import { formatSize } from "../../utils/format"
99
import { ExtensionMessage } from "../../../../src/shared/ExtensionMessage"
1010
import { useEvent } from "react-use"
1111
import DangerButton from "../common/DangerButton"

webview-ui/src/utils/format.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import prettyBytes from "pretty-bytes"
2+
13
export function formatLargeNumber(num: number): string {
24
if (num >= 1e9) {
35
return (num / 1e9).toFixed(1) + "b"
@@ -34,3 +36,11 @@ export function formatTimestamp(timestamp: string): string {
3436

3537
return dateFormatter.format(date)
3638
}
39+
40+
export function formatSize(bytes?: number) {
41+
if (bytes === undefined) {
42+
return "--kb"
43+
}
44+
45+
return prettyBytes(bytes)
46+
}

webview-ui/src/utils/size.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)