Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
platypii committed Jun 6, 2024
1 parent 814c790 commit a61cb3d
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 17 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"scripts": {
"build": "rollup -c",
"lint": "eslint src",
"serve": "node src/cli.js serve",
"serve": "node src/cli.js",
"test": "vitest run"
},
"devDependencies": {
Expand Down
3 changes: 3 additions & 0 deletions public/HighTable.css
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@
overflow: hidden;
white-space: nowrap;
}
.table td {
cursor: pointer;
}

/* don't hover on mobile */
@media (hover: hover) {
Expand Down
4 changes: 2 additions & 2 deletions public/bundle.min.js → public/build/render.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions public/build/render.min.js.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion public/bundle.min.js.map

This file was deleted.

2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
</head>
<body>
<div id="app"></div>
<script type="module" src="/public/bundle.min.js"></script>
<script type="module" src="/public/build/render.min.js"></script>
</body>
</html>
3 changes: 2 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import replace from '@rollup/plugin-replace'
import terser from '@rollup/plugin-terser'
import typescript from '@rollup/plugin-typescript'


export default {
input: 'src/render.js',
output: {
file: 'public/bundle.min.js',
file: 'public/build/render.min.js',
name: 'hyperparam',
format: 'iife',
sourcemap: true,
Expand Down
12 changes: 11 additions & 1 deletion src/Cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const editorOptions = {
/**
* Cell viewer displays a single cell from a table.
*/
export default function CellView(): JSX.Element {
export default function CellView() {
const [loading, setLoading] = useState<LoadingState>(LoadingState.NotLoaded)
const [text, setText] = useState<string | undefined>()
const [error, setError] = useState<Error>()
Expand Down Expand Up @@ -61,6 +61,16 @@ export default function CellView(): JSX.Element {
}, [col, row, loading, setError])

return <Layout error={error} title={key}>
<nav className='top-header'>
<div className='path'>
<a href='/files'>/</a>
{key && key.split('/').slice(0, -1).map((sub, depth) =>
<a href={`/files/${path.slice(2, depth + 3).join('/')}/`} key={depth}>{sub}/</a>
)}
<a href={`/files/${key}`}>{path.at(-1)}</a>
</div>
</nav>

{/* @ts-expect-error MonocoEditor type is wrong? */
<MonacoEditor
className='code'
Expand Down
11 changes: 9 additions & 2 deletions src/File.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ export default function File() {
const path = location.pathname.split('/')
const key = decodeURI(path.slice(2).join('/'))

if (!key.endsWith('.parquet')) {
return <Layout error={new Error('Invalid file type')} title={key}>
<div className='center'>Invalid file type</div>
</Layout>
}

// Filename loaded immediately from url, file contents loaded async
const [loading, setLoading] = useState(false)

Expand All @@ -33,9 +39,10 @@ export default function File() {
<nav className='top-header'>
<div className='path'>
<a href='/files'>/</a>
{key && key.split('/').map((sub, depth) =>
<a href={'/files/' + path.slice(2, depth + 3).join('/')} key={depth}>{sub}/</a>
{key && key.split('/').slice(0, -1).map((sub, depth) =>
<a href={`/files/${path.slice(2, depth + 3).join('/')}/`} key={depth}>{sub}/</a>
)}
<a href={`/files/${key}`}>{path.at(-1)}</a>
</div>
</nav>

Expand Down
4 changes: 2 additions & 2 deletions src/Folder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function Folder() {

// Folder path from url
const path = location.pathname.split('/')
const prefix = decodeURI(path.slice(2).join('/'))
const prefix = decodeURI(path.slice(2, -1).join('/'))

// Fetch files on component mount
useEffect(() => {
Expand All @@ -35,7 +35,7 @@ export default function Folder() {
<div className='path'>
<a href='/files'>/</a>
{prefix && prefix.split('/').map((sub, depth) =>
<a href={'/files/' + path.slice(2, depth + 3).join('/')} key={depth}>{sub}/</a>
<a href={`/files/${path.slice(2, depth + 3).join('/')}/`} key={depth}>{sub}/</a>
)}
</div>
</nav>
Expand Down
6 changes: 1 addition & 5 deletions src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

if (process.argv[2] === 'chat') {
import('./chat.js').then(({ chat }) => chat())
} else if (process.argv[2] === 'serve') {
import('./serve.js').then(({ serve }) => serve())
} else {
console.log('usage:')
console.log('hyperparam chat')
console.log('hyperparam serve')
import('./serve.js').then(({ serve }) => serve())
}
1 change: 0 additions & 1 deletion src/tableProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { readableStreamToArrayBuffer } from './streamConverters.js'
* Construct a dataframe from a parquet file asynchronously.
*/
export async function parquetDataFrame(url: string): Promise<DataFrame> {
console.log('parquetDataFrame', url)
const asyncBuffer = await asyncBufferFrom(url)
// load parquet metadata
const metadata = await parquetMetadataAsync(asyncBuffer)
Expand Down

0 comments on commit a61cb3d

Please sign in to comment.