Standardize agent previews (#29790)
This PR makes agent previews render like any other preview in the component preview list & pages. Page:  List:  Release Notes: - N/A
This commit is contained in:
parent
225deb6785
commit
3bd7ae6e5b
4 changed files with 114 additions and 105 deletions
|
@ -18,6 +18,9 @@ pub trait Component {
|
|||
fn name() -> &'static str {
|
||||
std::any::type_name::<Self>()
|
||||
}
|
||||
fn id() -> ComponentId {
|
||||
ComponentId(Self::name())
|
||||
}
|
||||
/// Returns a name that the component should be sorted by.
|
||||
///
|
||||
/// Implement this if the component should be sorted in an alternate order than its name.
|
||||
|
@ -81,7 +84,7 @@ pub fn register_component<T: Component>() {
|
|||
let component_data = (T::scope(), T::name(), T::sort_name(), T::description());
|
||||
let mut data = COMPONENT_DATA.write();
|
||||
data.components.push(component_data);
|
||||
data.previews.insert(T::name(), T::preview);
|
||||
data.previews.insert(T::id().0, T::preview);
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue