use re_types::components::EntityPath;
use re_viewer_context::{MaybeMutRef, ViewerContext};
pub(crate) fn edit_or_view_entity_path(
ctx: &ViewerContext<'_>,
ui: &mut egui::Ui,
path: &mut MaybeMutRef<'_, EntityPath>,
) -> egui::Response {
if let Some(path) = path.as_mut() {
let mut string = path.to_string();
let response = ui.text_edit_singleline(&mut string);
*path = string.into();
response
} else {
let query = ctx.current_query();
let db = ctx.recording();
let entity_path = path.as_ref().as_str().into();
re_data_ui::item_ui::entity_path_button(ctx, &query, db, ui, None, &entity_path)
}
}