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: add command bar #2815

Merged
merged 8 commits into from
Mar 4, 2024
Merged

feat: add command bar #2815

merged 8 commits into from
Mar 4, 2024

Conversation

markphelps
Copy link
Collaborator

command

Adds Command Bar to quickly jump around the app via cmd+k or ctrl+k

Uses: https://cmdk.paco.me/

Currently supports navigating to:

  • flags
  • segments
  • console
  • general settings
  • namespace settings
  • API tokens
  • support

In the future we could maybe extend this to support 'paging' so that you select Flags then maybe it pops up with the last 5-10 last updated flags you can chose to quickly navigate to. Or maybe we add the ability to quickly toggle lightmode/darkmode for example.

Either way this greatly increases the speed in which you can navigate through the app

Here's how it looks in darkmode:
CleanShot 2024-03-03 at 12 47 00@2x

@markphelps markphelps requested a review from erka March 3, 2024 17:53
@markphelps markphelps requested a review from a team as a code owner March 3, 2024 17:53
name: 'Flags',
description: 'Manage feature flags',
route: '/flags',
keywords: ['flags', 'flags', 'feature']
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Suggested change
keywords: ['flags', 'flags', 'feature']
keywords: ['flags', 'flag', 'feature']

Copy link
Collaborator

Choose a reason for hiding this comment

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

Probably flag could be deleted as it will be covered with flags

}
];

const items = [
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Could prob move these outside the component. Not sure the impact though

Copy link
Collaborator

Choose a reason for hiding this comment

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

Probably it will be good but not critical.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Just wonder if we could add namespaces here to have a quicker switcher. Something like flags production or segments staging

Copy link
Collaborator

Choose a reason for hiding this comment

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


  const namespacedItems = useMemo(() => {
    const namespaces = listNamespaces.data?.namespaces || [];
    return namespaces.flatMap((namespace) => [
      {
        name: 'Flags ' + namespace.name,
        description: 'Manage feature flags',
        route: namespace.key + '/flags',
        keywords: ['flags', 'feature']
      },
      {
        name: 'Segments ' + namespace.name,
        description: 'Manage segments',
        route: namespace.key + '/segments',
        keywords: ['segments']
      },
      {
        name: 'Console ' + namespace.name,
        description: 'Debug and test flags and segments',
        route: namespace.key + '/console',
        keywords: ['console', 'debug', 'test']
      }
    ]);
  }, [listNamespaces]);

Looks not such great but moving between is faster

Copy link
Collaborator

@erka erka left a comment

Choose a reason for hiding this comment

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

It looks great!

I have suggestion only to have the same overlay styling. Also it would be nice to have some ui element which will let user know about this command.

<Dialog
open={open}
onClose={setOpen}
className="fixed inset-0 z-10 overflow-y-auto p-4 pt-[15vh]"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
className="fixed inset-0 z-10 overflow-y-auto p-4 pt-[15vh]"
className="fixed inset-0 z-20 overflow-y-auto p-4 pt-[15vh]"

onClose={setOpen}
className="fixed inset-0 z-10 overflow-y-auto p-4 pt-[15vh]"
>
<Dialog.Overlay className="fixed inset-0 backdrop-blur-[2px]" />
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
<Dialog.Overlay className="fixed inset-0 backdrop-blur-[2px]" />
<Dialog.Overlay className="bg-gray-500 fixed inset-0 bg-opacity-75" />

Just to have similar design as Flipt has for modal dialog.

@markphelps
Copy link
Collaborator Author

2024-03-04 10 59 34

@erka I made most of the changes requested and also added the ability to switch namespaces from the command bar. lmk what you think

@erka
Copy link
Collaborator

erka commented Mar 4, 2024

@erka I made most of the changes requested and also added the ability to switch namespaces from the command bar. lmk what you think

I like 'Switch Namespaces' a lot. Great idea! It looks minimalistic and works majestic.

…mmand-k

* 'command-k' of https://github.com/flipt-io/flipt:
  chore(deps): bump github.com/XSAM/otelsql from 0.27.0 to 0.29.0 (#2819)
  chore(deps): bump cuelang.org/go from 0.7.0 to 0.7.1 (#2820)
  chore(deps): bump go.opentelemetry.io/otel/exporters/zipkin (#2816)
  chore(deps): bump github.com/redis/go-redis/v9 from 9.4.0 to 9.5.1 (#2818)
  chore(deps): bump github.com/go-jose/go-jose/v3 from 3.0.1 to 3.0.2 (#2817)
Copy link
Member

@GeorgeMac GeorgeMac left a comment

Choose a reason for hiding this comment

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

Very nice

@markphelps markphelps added the automerge Used by Kodiak bot to automerge PRs label Mar 4, 2024
@kodiakhq kodiakhq bot merged commit ba1aa35 into main Mar 4, 2024
31 checks passed
@kodiakhq kodiakhq bot deleted the command-k branch March 4, 2024 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Used by Kodiak bot to automerge PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants