chore: cleanup
This commit is contained in:
@@ -22,6 +22,7 @@ export default function FileTree(props: {
|
|||||||
nodeClass?: string
|
nodeClass?: string
|
||||||
level?: number
|
level?: number
|
||||||
allowed?: readonly string[]
|
allowed?: readonly string[]
|
||||||
|
modified?: readonly string[]
|
||||||
draggable?: boolean
|
draggable?: boolean
|
||||||
tooltip?: boolean
|
tooltip?: boolean
|
||||||
onFileClick?: (file: FileNode) => void
|
onFileClick?: (file: FileNode) => void
|
||||||
@@ -50,6 +51,12 @@ export default function FileTree(props: {
|
|||||||
return { files, dirs }
|
return { files, dirs }
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const marks = createMemo(() => {
|
||||||
|
const modified = props.modified
|
||||||
|
if (!modified || modified.length === 0) return
|
||||||
|
return new Set(modified)
|
||||||
|
})
|
||||||
|
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
const current = filter()
|
const current = filter()
|
||||||
if (!current) return
|
if (!current) return
|
||||||
@@ -89,7 +96,7 @@ export default function FileTree(props: {
|
|||||||
<Dynamic
|
<Dynamic
|
||||||
component={local.as ?? "div"}
|
component={local.as ?? "div"}
|
||||||
classList={{
|
classList={{
|
||||||
"w-full flex items-center gap-x-2 rounded-md px-2 py-1 hover:bg-surface-raised-base-hover active:bg-surface-base-active transition-colors cursor-pointer": true,
|
"w-full min-w-0 flex items-center gap-x-2 rounded-md px-2 py-1 hover:bg-surface-raised-base-hover active:bg-surface-base-active transition-colors cursor-pointer": true,
|
||||||
...(local.classList ?? {}),
|
...(local.classList ?? {}),
|
||||||
[local.class ?? ""]: !!local.class,
|
[local.class ?? ""]: !!local.class,
|
||||||
[props.nodeClass ?? ""]: !!props.nodeClass,
|
[props.nodeClass ?? ""]: !!props.nodeClass,
|
||||||
@@ -125,13 +132,16 @@ export default function FileTree(props: {
|
|||||||
{local.children}
|
{local.children}
|
||||||
<span
|
<span
|
||||||
classList={{
|
classList={{
|
||||||
"text-12-regular whitespace-nowrap truncate": true,
|
"flex-1 min-w-0 text-12-regular whitespace-nowrap truncate": true,
|
||||||
"text-text-weaker": local.node.ignored,
|
"text-text-weaker": local.node.ignored,
|
||||||
"text-text-weak": !local.node.ignored,
|
"text-text-weak": !local.node.ignored,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{local.node.name}
|
{local.node.name}
|
||||||
</span>
|
</span>
|
||||||
|
{local.node.type === "file" && marks()?.has(local.node.path) ? (
|
||||||
|
<div class="shrink-0 size-1.5 rounded-full bg-surface-warning-strong" />
|
||||||
|
) : null}
|
||||||
</Dynamic>
|
</Dynamic>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -173,6 +183,7 @@ export default function FileTree(props: {
|
|||||||
path={node.path}
|
path={node.path}
|
||||||
level={level + 1}
|
level={level + 1}
|
||||||
allowed={props.allowed}
|
allowed={props.allowed}
|
||||||
|
modified={props.modified}
|
||||||
draggable={props.draggable}
|
draggable={props.draggable}
|
||||||
tooltip={props.tooltip}
|
tooltip={props.tooltip}
|
||||||
onFileClick={props.onFileClick}
|
onFileClick={props.onFileClick}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -219,7 +219,6 @@
|
|||||||
height: auto;
|
height: auto;
|
||||||
padding: 6px;
|
padding: 6px;
|
||||||
gap: 4px;
|
gap: 4px;
|
||||||
border-bottom: 1px solid var(--border-weak-base);
|
|
||||||
background-color: var(--background-base);
|
background-color: var(--background-base);
|
||||||
|
|
||||||
&::after {
|
&::after {
|
||||||
@@ -230,7 +229,7 @@
|
|||||||
[data-slot="tabs-trigger-wrapper"] {
|
[data-slot="tabs-trigger-wrapper"] {
|
||||||
height: 32px;
|
height: 32px;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 999px;
|
border-radius: var(--radius-sm);
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
gap: 0;
|
gap: 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user