summaryrefslogtreecommitdiffhomepage
path: root/packages/ui/src/components/file.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/ui/src/components/file.tsx')
-rw-r--r--packages/ui/src/components/file.tsx7
1 files changed, 5 insertions, 2 deletions
diff --git a/packages/ui/src/components/file.tsx b/packages/ui/src/components/file.tsx
index b78f0bae4..633b23b70 100644
--- a/packages/ui/src/components/file.tsx
+++ b/packages/ui/src/components/file.tsx
@@ -1,4 +1,4 @@
-import { sampledChecksum } from "@opencode-ai/util/encode"
+import { sampledChecksum } from "@opencode-ai/shared/util/encode"
import {
DEFAULT_VIRTUAL_FILE_METRICS,
type DiffLineAnnotation,
@@ -655,7 +655,7 @@ function ViewerShell(props: {
style={styleVariables}
class="relative outline-none"
classList={{
- ...(props.classList || {}),
+ ...props.classList,
[props.class ?? ""]: !!props.class,
}}
ref={(el) => (props.viewer.wrapper = el)}
@@ -698,6 +698,7 @@ function TextViewer<T>(props: TextFileProps<T>) {
if (typeof value === "string") return value
if (Array.isArray(value)) return value.join("\n")
if (value == null) return ""
+ // oxlint-disable-next-line no-base-to-string -- file contents cast to unknown, coercion is intentional
return String(value)
}
@@ -712,11 +713,13 @@ function TextViewer<T>(props: TextFileProps<T>) {
if (typeof value === "string") return value.length
if (Array.isArray(value)) {
return value.reduce(
+ // oxlint-disable-next-line no-base-to-string -- array parts coerced intentionally
(sum, part) => sum + (typeof part === "string" ? part.length + 1 : String(part).length + 1),
0,
)
}
if (value == null) return 0
+ // oxlint-disable-next-line no-base-to-string -- file contents cast to unknown, coercion is intentional
return String(value).length
})