Skip to content

Commit

Permalink
Use ErrorBar from components
Browse files Browse the repository at this point in the history
  • Loading branch information
platypii committed Dec 12, 2024
1 parent e163be8 commit 94a02f1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 35 deletions.
2 changes: 1 addition & 1 deletion apps/hightable-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"eslint-plugin-react-refresh": "0.4.16",
"globals": "15.13.0",
"typescript": "5.7.2",
"typescript-eslint": "8.17.0",
"typescript-eslint": "8.18.0",
"vite": "6.0.3",
"vitest": "2.1.8"
}
Expand Down
4 changes: 2 additions & 2 deletions apps/hyparquet-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"test": "vitest run --dir test"
},
"dependencies": {
"@hyparam/components": "0.1.10",
"@hyparam/components": "0.1.11",
"hightable": "0.7.2",
"hyparquet": "1.6.4",
"hyparquet-compressors": "1.0.0",
Expand All @@ -32,7 +32,7 @@
"eslint-plugin-react-refresh": "0.4.16",
"globals": "15.13.0",
"typescript": "5.7.2",
"typescript-eslint": "8.17.0",
"typescript-eslint": "8.18.0",
"vite": "6.0.3",
"vitest": "2.1.8"
}
Expand Down
30 changes: 3 additions & 27 deletions apps/hyparquet-demo/src/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { cn } from '@hyparam/components'
import { ReactNode, useEffect, useState } from 'react'
import { ErrorBar, cn } from '@hyparam/components'
import { ReactNode, useEffect } from 'react'

interface LayoutProps {
children: ReactNode
Expand All @@ -20,20 +20,6 @@ interface LayoutProps {
* @returns {ReactNode}
*/
export default function Layout({ children, className, progress, error }: LayoutProps): ReactNode {
const [showError, setShowError] = useState(false)
const errorMessage = error?.toString()
if (error) console.error(error)

// Reset error visibility when error prop changes
useEffect(() => {
if (error) {
setShowError(true)
console.error(error)
} else {
setShowError(false)
}
}, [error])

// Update title
useEffect(() => {
document.title = 'hyparquet demo - apache parquet file viewer online'
Expand All @@ -44,17 +30,7 @@ export default function Layout({ children, className, progress, error }: LayoutP
<div className={cn('content', className)}>
{children}
</div>
<div className={cn('error-bar', showError && 'show-error')}>
<div className='error-content'>
<span>{errorMessage}</span>
<button
aria-label='Close error message'
className='close-button'
onClick={() => { setShowError(false) }}>
&times;
</button>
</div>
</div>
<ErrorBar error={error} />
</div>
{progress !== undefined && progress < 1 &&
<div className={'progress-bar'} role='progressbar'>
Expand Down
12 changes: 7 additions & 5 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"name": "hyperparam",
"version": "0.2.12",
"description": "Hyperparam CLI",
"author": "Hyperparam",
"homepage": "https://hyperparam.app",
"license": "MIT",
"main": "src/cli.js",
"type": "module",
Expand All @@ -24,7 +26,7 @@
},
"dependencies": {
"highlight.js": "11.10.0",
"@hyparam/components": "0.1.10",
"@hyparam/components": "0.1.11",
"react": "18.3.1",
"react-dom": "18.3.1"
},
Expand All @@ -34,20 +36,20 @@
"@rollup/plugin-replace": "6.0.1",
"@rollup/plugin-terser": "0.4.4",
"@rollup/plugin-typescript": "12.1.1",
"@testing-library/react": "16.0.1",
"@types/node": "22.10.1",
"@testing-library/react": "16.1.0",
"@types/node": "22.10.2",
"@types/react": "18.3.12",
"@types/react-dom": "18.3.1",
"@vitejs/plugin-react": "4.3.4",
"@vitest/coverage-v8": "2.1.8",
"eslint": "9.16.0",
"globals": "15.13.0",
"jsdom": "25.0.1",
"rollup": "4.28.0",
"rollup": "4.28.1",
"rollup-plugin-postcss": "4.0.2",
"tslib": "2.8.1",
"typescript": "5.7.2",
"typescript-eslint": "8.17.0",
"typescript-eslint": "8.18.0",
"vitest": "2.1.8"
}
}

0 comments on commit 94a02f1

Please sign in to comment.