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

Refactor BaseLayoutHeader #2123

Open
gweiying opened this issue Dec 6, 2022 · 0 comments
Open

Refactor BaseLayoutHeader #2123

gweiying opened this issue Dec 6, 2022 · 0 comments
Assignees

Comments

@gweiying
Copy link
Contributor

gweiying commented Dec 6, 2022

BaseLayoutHeader stores all private and public header buttons in a single array of objects called headers. Each header has a boolean public indicating whether the button is for public or private use.

const headers = [
    {
      text: 'Dashboard',
      link: i18next.t('general.links.dashboard'),
      public: false,
      icon: homeIcon,
      mobileOrder: 1,
      internalLink: true,
    },
    {
      text: 'Directory',
      link: i18next.t('general.links.directory'),
      public: false,
      icon: directoryIcon,
      mobileOrder: 2,
      internalLink: true,
    },
    {
      text: 'API Integration',
      link: i18next.t('general.links.apiintegration'),
      public: false,
      icon: apiIcon,
      mobileOrder: 3,
      internalLink: true,
    },
    {
      text: 'Send us feedback',
      link: i18next.t('general.links.feedback'),
      public: true,
      icon: feedbackIcon,
    },
    {
      text: 'Guide',
      link: i18next.t('general.links.faq'),
      public: true,
      icon: helpIcon,
    },
    {
      text: 'Contribute',
      link: i18next.t('general.links.contribute'),
      public: true,
      icon: githubIcon,
    },
    {
      text: 'Guide',
      link: i18next.t('general.links.faq'),
      public: false,
      icon: helpIcon,
      mobileOrder: 4,
    },
    {
      text: 'Send us feedback',
      link: i18next.t('general.links.contact'),
      public: false,
      icon: feedbackIcon,
      mobileOrder: 5,
    },
  ]

Maintaining the headers array is messy because public and private buttons are all mixed up in one array.

We should refactor the headers array into two arrays, publicHeaders and privateHeaders and remove the boolean public. Instead, if a user is logged in, we should just show the privateHeaders, otherwise the publicHeaders.

@disKeith disKeith linked a pull request Dec 16, 2022 that will close this issue
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 a pull request may close this issue.

2 participants