Skip to content

Commit a64b338

Browse files
fix(files): fixed resource spacing on files directories pages (#4618)
* fix(files): fixed resource spacing on files directories pages * fix(build): align turbo schema version Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent d3d8f9c commit a64b338

4 files changed

Lines changed: 30 additions & 16 deletions

File tree

apps/sim/app/workspace/[workspaceId]/components/resource/resource.tsx

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,8 @@ interface ResourceColGroupProps {
642642
hasCheckbox?: boolean
643643
}
644644

645-
const CHECKBOX_WEIGHT = 0.4
645+
const CHECKBOX_COLUMN_WIDTH_PX = 52
646+
const CHECKBOX_COLUMN_WIDTH = `${CHECKBOX_COLUMN_WIDTH_PX}px`
646647

647648
const ResourceColGroup = memo(function ResourceColGroup({
648649
columns,
@@ -651,14 +652,27 @@ const ResourceColGroup = memo(function ResourceColGroup({
651652
const weights = columns.map(
652653
(col, colIdx) => (colIdx === 0 ? 2.5 : 1.0) * (col.widthMultiplier ?? 1)
653654
)
654-
const total = (hasCheckbox ? CHECKBOX_WEIGHT : 0) + weights.reduce((s, w) => s + w, 0)
655+
const total = weights.reduce((s, w) => s + w, 0)
655656

656657
return (
657658
<colgroup>
658-
{hasCheckbox && <col style={{ width: `${(CHECKBOX_WEIGHT / total) * 100}%` }} />}
659-
{columns.map((col, colIdx) => (
660-
<col key={col.id} style={{ width: `${(weights[colIdx] / total) * 100}%` }} />
661-
))}
659+
{hasCheckbox && <col style={{ width: CHECKBOX_COLUMN_WIDTH }} />}
660+
{columns.map((col, colIdx) => {
661+
const columnRatio = weights[colIdx] / total
662+
const columnPercent = columnRatio * 100
663+
const checkboxOffset = CHECKBOX_COLUMN_WIDTH_PX * columnRatio
664+
665+
return (
666+
<col
667+
key={col.id}
668+
style={{
669+
width: hasCheckbox
670+
? `calc(${columnPercent}% - ${checkboxOffset}px)`
671+
: `${columnPercent}%`,
672+
}}
673+
/>
674+
)
675+
})}
662676
</colgroup>
663677
)
664678
})

bun.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"husky": "9.1.7",
6464
"json-schema-to-typescript": "15.0.4",
6565
"lint-staged": "16.0.0",
66-
"turbo": "2.9.6",
66+
"turbo": "2.9.12",
6767
"yaml": "^2.8.1"
6868
},
6969
"lint-staged": {

turbo.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://v2-9-6.turborepo.dev/schema.json",
2+
"$schema": "https://v2-9-12.turborepo.dev/schema.json",
33
"envMode": "loose",
44
"tasks": {
55
"transit": {

0 commit comments

Comments
 (0)