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: fixed admin app navigation issue #1298

Merged
merged 3 commits into from
Oct 19, 2020
Merged

feat: fixed admin app navigation issue #1298

merged 3 commits into from
Oct 19, 2020

Conversation

BhuwanChandra
Copy link
Contributor

Related Issue

Closes #1259

Your solution

changed the height and width of Api information icon
moved community section and source section to seperate plugins

How Has This Been Tested?

Manual Testing

Screenshots (if relevant):

Capture

@BhuwanChandra BhuwanChandra mentioned this pull request Oct 14, 2020
2 tasks
@Ashu96 Ashu96 self-requested a review October 14, 2020 09:38
Copy link
Contributor

@Ashu96 Ashu96 left a comment

Choose a reason for hiding this comment

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

Good work @BhuwanChandra and sorry for the delay in the review.
I've left a few comments nothing major. Please check them out 🙂

It's about the plugin implementation approach.
The point of having plugin type is that you can have many plugins with common functionality.
That’s why type can be reused, and name makes that particular plugin unique.

import { i18n } from "@webiny/app/i18n";
const t = i18n.ns("app-admin/navigation");

const plugin: AdminMenuCommunityPlugin = {
Copy link
Contributor

Choose a reason for hiding this comment

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

@BhuwanChandra I think instead of creating a plugin type for each list item. We should create some plugins with type say "admin-drawer-footer-menu". For example,

{
    type: "admin-drawer-footer-menu",
    name: "admin-drawer-footer-menu-source",
    render() {
        // Some custom component
        return <MenuItemSource />;
    }
}

And then render all "admin-drawer-footer-menu" plugins inside packages/app-admin/src/plugins/Menu/Navigation/index.tsx:67

import { i18n } from "@webiny/app/i18n";
const t = i18n.ns("app-admin/navigation");

const plugin: AdminMenuSourcePlugin = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please do the same as suggested above :)

@@ -41,6 +39,22 @@ const Navigation = () => {
return null;
}, []);

const community = useMemo(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

@BhuwanChandra after doing the suggested change. (please check the other comment)
You can simply use the following code snippet:

const footerMenuPlugins =  getPlugins<AdminDrawerFooterMenu>("admin-drawer-footer-menu");

And then Iterate over these plugins and render the component. Like we are doing for menu plugins here

return (
<>
<a
href="https://community.webiny.com/"
Copy link
Contributor

Choose a reason for hiding this comment

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

@BhuwanChandra also please change Community with Slack as mentioned in the original issue.

This means changing the link, text, and icon of the menu item.

Copy link
Contributor

@Ashu96 Ashu96 left a comment

Choose a reason for hiding this comment

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

Great work @BhuwanChandra 👍

Almost there 🚀
I've just left a comment, minor stuff. Please take a look.

PS: Code format check is also failing can you please also fix that. You can use this command: yarn run prettier:check 🙂

const footerMenuPlugins = getPlugins<AdminDrawerFooterMenuPlugin>("admin-drawer-footer-menu");

footerMenuPlugins &&
sortBy(footerMenuPlugins, [p => p.order || 50, p => p.name]).forEach(plugin => {
Copy link
Contributor

Choose a reason for hiding this comment

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

@BhuwanChandra I don't think we need sortBy here as we don't define order property on the plugin itself.

Copy link
Contributor

@Ashu96 Ashu96 left a comment

Choose a reason for hiding this comment

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

LGTM 🚀
Nicely done @BhuwanChandra 👍

Not sure why the checks are falling. We'll check and merge it soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve admin app navigation
2 participants