-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: use latest ipld-explorer-components #144
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self review
test('should resolve a dag-pb cid with a path', async ({ page }) => { | ||
await page.goto('/') | ||
const waitForTitle = async (title) => { | ||
await page.waitForFunction(`document.title === '${title}'`, { timeout: 5000 }) | ||
} | ||
|
||
await waitForTitle('Explore - IPLD') | ||
|
||
// Focus the explore form, type a path, hit enter to submit | ||
await page.click('#ipfs-path') | ||
await page.fill('#ipfs-path', 'QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv/readme') | ||
await page.keyboard.press('Enter') | ||
|
||
// Expect the CID for the path target to have resolved | ||
await page.waitForSelector('[data-id=ObjectInfo-cid]') | ||
const resolvedCid = await page.$eval('[data-id=ObjectInfo-cid]', el => el.innerText) | ||
expect(resolvedCid).toEqual('QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB') | ||
expect(await page.title()).toBe('Exploring - IPLD') | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
finally converted the puppeteer test to playwright
file_filter = public/locales/<lang>/app.json | ||
source_file = public/locales/en/app.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use the new namespace files, so we can get translations from ipld-explorer-components (they can still be overridden)
src/App.jsx
Outdated
const Page = () => { | ||
const [route, setRoute] = useState(window.location.hash.slice(1) ?? '/') | ||
|
||
useEffect(() => { | ||
const onHashChange = () => { setRoute(window.location.hash.slice(1) ?? '/') } | ||
window.addEventListener('hashchange', onHashChange) | ||
return () => { window.removeEventListener('hashchange', onHashChange) } | ||
}, []) | ||
|
||
const RenderPage = () => { | ||
switch (true) { | ||
case route.startsWith('/explore'): | ||
return <ExplorePage /> | ||
case route === '/': | ||
default: | ||
return <StartExploringPage /> | ||
} | ||
} | ||
|
||
return ( | ||
<RenderPage /> | ||
) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simple router component
src/App.jsx
Outdated
render() { | ||
const { showUpdateAvailable } = this.state | ||
const Page = this.props.route | ||
const { embed } = this.props.queryObject | ||
const embed = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
explore.ipld.io should never be "embedded", it's its own page.
@@ -25,88 +17,50 @@ export const viteConfig = (configEnv = {}) => { | |||
} | |||
} | |||
/** | |||
* @type {typeof import('vite').UserConfigExport} | |||
* @type {import('vite').UserConfigExport} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed type resolution
} | ||
|
||
export default defineConfig(viteConfig); | ||
export default defineConfig(viteConfig) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we no longer needed a lot of this since the ipld-explorer-components is updated and outputting a more usable bundle now
FYI: This is incorporating the new ipld-explorer-components updates from ipfs/ipld-explorer-components#448
Primary changes:
explore.json
toapp.json
. They can override translations provided by ipld-explorer-components if desired.