Skip to repository content47 lines · 1.5 KB · rust
tenant.openagents/omega
No repository description is available.
OpenAgents Git authority 2026-07-28T03:34:28.445Z Public web read
NIP-34 coordinate
30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omegaMaintainersHidden in public view
References2 branches · 1 tag
Read-only clone
git clone https://openagents.com/git/tenant.openagents/omega.gitBrowse files
table_cell.rs
1//! Table Cell Rendering
2
3use gpui::{AnyElement, ElementId};
4use ui::{SharedString, Tooltip, div, prelude::*};
5
6use crate::{CsvPreviewView, settings::VerticalAlignment, types::DisplayCellId};
7
8impl CsvPreviewView {
9 /// Create selectable table cell with mouse event handlers.
10 pub fn create_selectable_cell(
11 display_cell_id: DisplayCellId,
12 cell_content: SharedString,
13 vertical_alignment: VerticalAlignment,
14 cx: &Context<CsvPreviewView>,
15 ) -> AnyElement {
16 create_table_cell(display_cell_id, cell_content, vertical_alignment, cx)
17 // Mouse events handlers will be here
18 .into_any_element()
19 }
20}
21
22/// Create styled table cell div element.
23fn create_table_cell(
24 display_cell_id: DisplayCellId,
25 cell_content: SharedString,
26 vertical_alignment: VerticalAlignment,
27 cx: &Context<'_, CsvPreviewView>,
28) -> gpui::Stateful<Div> {
29 div()
30 .id(ElementId::NamedInteger(
31 format!("csv-display-cell-{}", *display_cell_id.row).into(),
32 *display_cell_id.col as u64,
33 ))
34 .cursor_pointer()
35 .flex()
36 .h_full()
37 .px_1()
38 .border_color(cx.theme().colors().border_variant)
39 .map(|div| match vertical_alignment {
40 VerticalAlignment::Top => div.items_start(),
41 VerticalAlignment::Center => div.items_center(),
42 })
43 .font_buffer(cx)
44 .tooltip(Tooltip::text(cell_content.clone()))
45 .child(div().child(cell_content))
46}
47