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

doc: Update README.md #33

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

doc: Update README.md #33

wants to merge 1 commit into from

Conversation

stefanoamorelli
Copy link
Member

No description provided.

@stefanoamorelli stefanoamorelli self-assigned this Jan 24, 2025
@stefanoamorelli stefanoamorelli marked this pull request as draft January 24, 2025 16:05
@SkoebaSteve
Copy link
Collaborator

SkoebaSteve commented Jan 24, 2025

At the top of the file there's a link to a banner image:

![ember-autofocus-modifier-illustration](https://gitlab.qonto.co/npm-packages/react-migration-toolkit/uploads/c0af9dd2fe40080b5e340a35f319147e/react-migration-toolkit-banner.png)
which is broken now. It only worked in our own github repo.

It's also broken on npmjs (checked in incognito mode):
image

@stefanoamorelli
Copy link
Member Author

At the top of the file there's a link to a banner image:

![ember-autofocus-modifier-illustration](https://gitlab.qonto.co/npm-packages/react-migration-toolkit/uploads/c0af9dd2fe40080b5e340a35f319147e/react-migration-toolkit-banner.png)

which is broken now. It only worked in our own github repo.

It's also broken on npmjs (checked in incognito mode): image

That's removed ✔️

@stefanoamorelli stefanoamorelli force-pushed the doc/update-readme branch 2 times, most recently from c932030 to 108b52f Compare January 27, 2025 10:50

Additional providers might be needed for your app. For example, the toolkit provides the following providers and associated hooks:

- `RawIntlProvider` (for `react-intl`) → `useIntl` (requires passing the Ember `intl` instance from `useEmberIntl`)
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not provided by the package per se (at lest not currently), consumers of the addon need to install react-intl and pass the result of useEmberIntl themselves to RawIntlProvider, which is coming the react-intl package.

README.md Outdated

#### `providersOptions` (optional)

To have access to the Launch Darkly feature flags in react components, use `ReactBridgeWithProviders` instead of `ReactBridge`, and in the react component you will then be able to use the flags hook.
Copy link
Contributor

Choose a reason for hiding this comment

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

there's no ReactBridgeWithProviders in this package, also I feel like this text is focusing too much on LD / flags. It's unclear what providerOptions mean here

README.md Outdated
Comment on lines 95 to 102
<ReactBridgeWithProviders
@reactComponent={{this.TransactionsSidebarFooter}}
@props={{hash
highlightedItem=@highlightedItem
handleShowHelpSection=@handleShowHelpSection
className=(local-class "footer")
}}
/>
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above, this component is created (optionally) on the consumer's side, it's not provided here

README.md Outdated
Comment on lines 105 to 111
In the React component you can use the `useFlags` hook imported from `@qonto/react-migration-toolkit/react/hooks` which is accessible from the flags object (in camelCase)

It renders React components within Ember templates, permitting progressive UI migration and preserving existing logics and tests.
Example:

Full documentation can be found [here](https://www.notion.so/qonto/How-to-use-React-components-in-Ember-applications-e2f8513fc4a442b0967274d9e57b18b0) (Qonto VPN must be on).
```jsx
const { featurePrismicZendeskMigration } = useFlags()
```
Copy link
Contributor

Choose a reason for hiding this comment

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

doesn't seem related to the section, and maybe we should remove stuff about LD for now

|---------------------|-------------------------------------------|----------|---------|
| reactComponent | ComponentType | Yes | None |
| props | object | No | None |
| providersComponent | ComponentType<{ children: ReactNode } & P> | No | None |
Copy link
Contributor

Choose a reason for hiding this comment

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

doesn't seem right, in the current state of things, this should be providerOptions with component and props inside

const { featurePrismicZendeskMigration } = useFlags()
```

#### `component` prop
Copy link
Contributor

Choose a reason for hiding this comment

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

it looks unclear where this is coming from here, this is not really a "prop" and it's one of the keys of the providerOptions argument


- `RawIntlProvider` (for `react-intl`) → `useIntl` (requires passing the Ember `intl` instance from `useEmberIntl`)
- `PolymorphicRouterContextProvider` → `useRouter`
- `LDProvider` (LaunchDarkly) → `useFlags`
Copy link
Contributor

Choose a reason for hiding this comment

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

there's more setup to do on the apps side to make LDProvider works, it's just easier if we don't document it for now


[This branch](https://gitlab.qonto.co/front/qonto-js/-/blob/bifrost/app/components/react-bifrost.hbs) uses the ReactBridge extensively and can be checked for reference.
#### `props` prop
Copy link
Contributor

Choose a reason for hiding this comment

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

same as the "component" comment, I think it's not super clear

README.md Outdated

#### `tagName` prop

By default, the bridge will wrap the React component in a `div` which sometimes this breaks the semantic flow. For example, a `table` can not have a `div` element as a child. With this, we can to set another tag dynamically to wrap the react component which solves this problem.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
By default, the bridge will wrap the React component in a `div` which sometimes this breaks the semantic flow. For example, a `table` can not have a `div` element as a child. With this, we can to set another tag dynamically to wrap the react component which solves this problem.
By default, the bridge will wrap the React component in a `div` which sometimes breaks the semantic flow. For example, a `table` cannot have a `div` element as a child. With this, we can set another tag dynamically to wrap the react component which solves this problem.

some typos here

README.md Outdated
import { useEmberService } from '@qonto/react-migration-toolkit/react/hooks';

export const useOrganizationManager = () => {
return useEmberService('organization-manager');
Copy link
Contributor

Choose a reason for hiding this comment

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

can we use a more generic service name here?

README.md Outdated

To make sure the correct types is available when a service is injected with `useEmberService` hook, the service should be declared in Ember’s dependency injection registry which will be then used through [declaration merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html).

```tsx
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: this is a typescript file, not tsx

README.md Outdated

The same API of the Ember service is available after exposing it via the hook.

To make sure the correct types is available when a service is injected with `useEmberService` hook, the service should be declared in Ember’s dependency injection registry which will be then used through [declaration merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html).
Copy link
Contributor

Choose a reason for hiding this comment

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

this is optional, and I would use a wording closer to what's in the official docs here (check the last section)

README.md Outdated
<details>
<summary>How to test React components in Ember</summary>

Testing for React is currently done via **QUnit** and existing Ember test suites should still largely be compatible with migrated components. Changing framework should not impact components behavior.
Copy link
Contributor

Choose a reason for hiding this comment

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

the way this is phrased, this sounds more like an internal note than public documentation

@stefanoamorelli stefanoamorelli force-pushed the doc/update-readme branch 3 times, most recently from f68ef96 to 83ad31c Compare January 27, 2025 16:48
doc: add LICENSE.md file
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.

3 participants