-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* upgrade dependencies in apps * adapt code to [email protected] * decode the key parameter in the backend * upgrade components to 0.1.6 * fix linter
- Loading branch information
Showing
8 changed files
with
80 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { HttpFileSystem, HyperparamFileSystem, Page } from '@hyparam/components' | ||
import React from 'react' | ||
|
||
const fileSystems = [ | ||
new HttpFileSystem(), | ||
new HyperparamFileSystem({ endpoint: location.origin }), | ||
] | ||
|
||
export default function App() { | ||
const search = new URLSearchParams(location.search) | ||
const url = search.get('key') ?? '' | ||
const row = search.get('row') === null ? undefined : Number(search.get('row')) | ||
const col = search.get('col') === null ? undefined : Number(search.get('col')) | ||
|
||
let source = undefined | ||
for (const fileSystem of fileSystems) { | ||
const fsSource = fileSystem.getSource(url) | ||
if (fsSource) { | ||
source = fsSource | ||
break | ||
} | ||
} | ||
|
||
if (!source) { | ||
return React.createElement('div', { children: 'Could not load a data source. You have to pass a valid source in the url.' }) | ||
} | ||
return React.createElement(Page, { | ||
source, | ||
navigation: { row, col }, | ||
config: { | ||
slidePanel: { minWidth: 250, maxWidth: 750 }, | ||
routes: { | ||
getSourceRouteUrl: ({ source }) => `/files?key=${source}`, | ||
getCellRouteUrl: ({ source, col, row }) => `/files?key=${source}&col=${col}&row=${row}`, | ||
}, | ||
}, | ||
}) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import { App } from '@hyparam/components' | ||
import React from 'react' | ||
import ReactDOM from 'react-dom/client' | ||
import App from './AppComponent.js' | ||
|
||
const app = document.getElementById('app') | ||
if (!app) throw new Error('missing app element') | ||
|
||
const root = ReactDOM.createRoot(app) | ||
root.render(React.createElement(App, { apiBaseUrl: location.origin })) | ||
root.render(React.createElement(App)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters