Conversation
3be031c to
a012304
Compare
a012304 to
baf359d
Compare
AdonaiVera
left a comment
There was a problem hiding this comment.
Hi @imanjra,
I left a few suggestions. Sorry if I went a bit deep, but I think this will be one of the main reference examples for hybrid panels, so it felt worth being extra careful. Let me know what you think and I can do a final pass after. Thanks!
| # Utilities | ||
|
|
||
|
|
||
| def is_fibonacci(n): |
There was a problem hiding this comment.
This function is never used, we can remove it to avoid confusing users.
| return get_fibonacci_number(n - 1) + get_fibonacci_number(n - 2) | ||
|
|
||
|
|
||
| def get_fibonacci_sequence(n): |
There was a problem hiding this comment.
This function is not using either, we can remove to clean the example
| | | ||
| """ | ||
|
|
||
| # from .py.sample_auditing_panel import SampleAuditingPanel |
There was a problem hiding this comment.
We can remove this import if its not use it
There was a problem hiding this comment.
I’m not sure we’re going to use this file in the example, since the import is commented out, if not we can remove this file
| const panelState = usePanelStatePartial("state", {}); | ||
| const panelData = usePanelStatePartial("data", {}, true); | ||
|
|
||
| console.log(">>>", panelState, panelData); |
There was a problem hiding this comment.
We can remove this console log for the final example
| import { PluginComponentType, registerComponent } from "@fiftyone/plugins"; | ||
| import { useCallback, useState } from "react"; | ||
| import { useTriggerPanelEvent } from "@fiftyone/operators"; | ||
| import { usePanelState, usePanelStatePartial } from "@fiftyone/spaces"; |
There was a problem hiding this comment.
We can remove the usePanelState
| the backbone of the panel’s logic flow, ensuring that user actions and | ||
| application state stay in sync across Python and React. | ||
|
|
||
| ### Python: Defining amd providing panel event to custom view |
There was a problem hiding this comment.
| ### Python: Defining amd providing panel event to custom view | |
| ### Python: Defining and providing panel event to custom view |
|
|
||
| def increment(self, ctx): | ||
| count = ctx.panel.get_state("count") | ||
| if count is None |
There was a problem hiding this comment.
| if count is None | |
| if count is None: |
| version: 1.0.0 | ||
| fiftyone: | ||
| version: "*" | ||
| url: https://github.com/voxel51/fiftyone-plugins |
There was a problem hiding this comment.
| url: https://github.com/voxel51/fiftyone-plugins | |
| url: https://github.com/voxel51/fiftyone-plugins/tree/main/plugins/hybrid-panel |
| return ( | ||
| <Stack direction="row" spacing={1}> | ||
| <Typography>{count}</Typography> | ||
| <Button onClick={() => { | ||
| handleIncrement() | ||
| handleSetDoubleCount() | ||
| }}> | ||
| </Stack>; | ||
| ) |
There was a problem hiding this comment.
| return ( | |
| <Stack direction="row" spacing={1}> | |
| <Typography>{count}</Typography> | |
| <Button onClick={() => { | |
| handleIncrement() | |
| handleSetDoubleCount() | |
| }}> | |
| </Stack>; | |
| ) | |
| return ( | |
| <Stack direction="row" spacing={1}> | |
| <Typography>{count}</Typography> | |
| <Button onClick={() => { | |
| handleIncrement() | |
| handleSetDoubleCount() | |
| }}> | |
| Increment | |
| </Button> | |
| </Stack> | |
| ) |
Add an example plugin with a sample hybrid panel