Skip to content
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

Merged
merged 9 commits into from
Oct 31, 2024

Conversation

SgtPooki
Copy link
Contributor

@SgtPooki SgtPooki commented Sep 6, 2024

FYI: This is incorporating the new ipld-explorer-components updates from ipfs/ipld-explorer-components#448

Primary changes:

  • rename translation files from explore.json to app.json. They can override translations provided by ipld-explorer-components if desired.
  • Remove redux-bundler and use ipld-explorer-components providers
  • add aegir linting & dep-check
  • convert old commented out puppeteer test to playwright
  • remove unused (and experimental) playwright component testing that wasn't being used and wasn't working properly.

@SgtPooki SgtPooki requested a review from a team as a code owner September 6, 2024 17:03
@SgtPooki SgtPooki marked this pull request as draft October 11, 2024 02:08
@SgtPooki SgtPooki changed the title chore: update ipld-explorer-components feat!: use latest ipld-explorer-components Oct 11, 2024
@SgtPooki SgtPooki marked this pull request as ready for review October 18, 2024 17:57
Copy link
Contributor Author

@SgtPooki SgtPooki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self review

Comment on lines +8 to +26
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')
})
Copy link
Contributor Author

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

Comment on lines +6 to +7
file_filter = public/locales/<lang>/app.json
source_file = public/locales/en/app.json
Copy link
Contributor Author

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
Comment on lines 6 to 29
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 />
)
}

Copy link
Contributor Author

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
Copy link
Contributor Author

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}
Copy link
Contributor Author

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)
Copy link
Contributor Author

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

@SgtPooki SgtPooki merged commit c043579 into master Oct 31, 2024
@SgtPooki SgtPooki deleted the chore/update-explorer-components branch October 31, 2024 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant