Add pickers for rule creation with control API and CLI examples#3285
Add pickers for rule creation with control API and CLI examples#3285owenpearson wants to merge 1 commit intomainfrom
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| children: ReactNode; | ||
| } | ||
|
|
||
| export const MethodPicker: React.FC<MethodPickerProps> = ({ children }) => { |
There was a problem hiding this comment.
[nitpick] Could probably benefit from unit tests for this
There was a problem hiding this comment.
good shout, i've added a few now 👍
| <div className="my-5"> | ||
| <div className="flex gap-1 border-b border-neutral-300 dark:border-neutral-800 mb-5"> | ||
| {methods.map((method) => ( | ||
| <button |
There was a problem hiding this comment.
[nitpick] Could add aria attributes role="tab" and aria-selected
There was a problem hiding this comment.
also a good idea - i've added some accessibility attributes now
|
|
||
| Refer to the [Control API reference](/docs/api/control-api) for a full list of available parameters. | ||
|
|
||
| </Method> |
There was a problem hiding this comment.
[nitpick] Noticed in a few that we don't always have a CLI method. Due to lack of CLI support or something else?
There was a problem hiding this comment.
yeah the CLI doesn't support a few of the rule types. tbh I wanted to avoid opening a can of worms with this work but I'll make an issue on the CLI repo so that we fix this properly in future by adding support for them in the CLI
| } | ||
| }); | ||
|
|
||
| const [activeMethod, setActiveMethod] = useState(methods[0] ?? 'dashboard'); |
There was a problem hiding this comment.
[nitpick] Did you consider saving the user choice of method? Like we do for languages?
There was a problem hiding this comment.
I did consider it, but i decided to leave it for a future enhancement :)
m-hulbert
left a comment
There was a problem hiding this comment.
This is a cool little feature, Owen! Just a few comments:
- I think we should name this
TabsandTabrather than use 'Method'. This is to avoid confusion from LLMs, but also means it's more widely usable. - I think we might need to bound this somewhat, so it's obvious where the tab ends and the copy continues.
Channel rule-->Rulethroughout please.
src/pages/docs/channels/index.mdx
Outdated
| ``` | ||
| </Code> | ||
|
|
||
| Refer to the [Control API reference](/docs/api/control-api) for a full list of available parameters. |
There was a problem hiding this comment.
I don't think we need to link to this for every command considering we already link out to the docs on the Control API. If it's important enough to include then we should make the path a link to the reference for itself.
There was a problem hiding this comment.
thanks, all good feedback. i've addressed all the above now 👍
|
|
||
| const MethodContext = createContext<MethodContextType | undefined>(undefined); | ||
|
|
||
| const METHOD_LABELS: Record<string, string> = { |
There was a problem hiding this comment.
Ah missed this - I also don't think we should be hardcoding this. At the end of the day it's a label on a tab, so this should just take whatever value is defined by the author to make this a flexible component.
There was a problem hiding this comment.
yeah good point, it's generic now 👍
14f6fdd to
be09949
Compare
be09949 to
357bdc5
Compare
|
@owenpearson Will re-review changes shortly but just an FYI |
357bdc5 to
34ed5bb
Compare
AIT-375
Adds pickers for channel/integration rule creation examples so that where applicable, users can choose between:
The UI looks like this:

Some possible future enhancements which I haven't implemented here could be to: