Add a new TaskTable component that displays tasks in a sortable, paginated table. Columns include ID, Description, Project, Due, Priority, and Status. Clicking column headers sorts the data (toggles between ascending and descending). Priority and status are color-coded based on theme colors. Update Panel component to accept an ID and simplify child rendering. Add warning, info, and priority colors (high/medium/low) to Theme. Add Into<usize> and Into<String> implementations for TaskPriority and TaskStatus to support sorting and display.
88 lines
2.3 KiB
Rust
88 lines
2.3 KiB
Rust
pub type Color = gpui::Rgba;
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub struct Theme {
|
|
pub background: Color,
|
|
pub foreground: Color,
|
|
pub panel: Color,
|
|
pub muted: Color,
|
|
pub accent: Color,
|
|
pub border: Color,
|
|
pub error: Color,
|
|
pub success: Color,
|
|
pub warning: Color,
|
|
pub info: Color,
|
|
pub selection: Color,
|
|
pub selection_foreground: Color,
|
|
pub text: Color,
|
|
pub text_size: Option<gpui::Size<u32>>,
|
|
|
|
pub high: Color,
|
|
pub medium: Color,
|
|
pub low: Color,
|
|
}
|
|
|
|
impl Theme {
|
|
pub fn dark() -> Self {
|
|
Self {
|
|
background: gpui::rgb(0x1E1E2E),
|
|
panel: gpui::rgb(0x181825),
|
|
foreground: gpui::rgb(0xCDD6F4),
|
|
muted: gpui::rgb(0x7F849C),
|
|
accent: gpui::rgb(0x89B4FA),
|
|
border: gpui::rgb(0x313244),
|
|
error: gpui::rgb(0xF38BA8),
|
|
success: gpui::rgb(0xA6E3A1),
|
|
warning: gpui::rgb(0xF9E2AF),
|
|
info: gpui::rgb(0x74C7EC),
|
|
selection: gpui::rgb(0x45475A),
|
|
selection_foreground: gpui::rgb(0xCDD6F4),
|
|
text: gpui::rgb(0xCDD6F4),
|
|
text_size: Some(gpui::Size::new(14, 14)),
|
|
|
|
high: gpui::rgb(0xF38BA8),
|
|
medium: gpui::rgb(0xF9E2AF),
|
|
low: gpui::rgb(0xA6E3A1),
|
|
}
|
|
}
|
|
|
|
pub fn light() -> Self {
|
|
Self {
|
|
background: gpui::rgb(0xF5F5F5),
|
|
panel: gpui::rgb(0xF0F0F0),
|
|
foreground: gpui::rgb(0x333333),
|
|
muted: gpui::rgb(0x999999),
|
|
accent: gpui::rgb(0x0078D4),
|
|
border: gpui::rgb(0xE0E0E0),
|
|
error: gpui::rgb(0xFF4444),
|
|
success: gpui::rgb(0x4CAF50),
|
|
warning: gpui::rgb(0xFFA726),
|
|
info: gpui::rgb(0x29B6F6),
|
|
selection: gpui::rgb(0xD0D0D0),
|
|
selection_foreground: gpui::rgb(0x333333),
|
|
text: gpui::rgb(0x333333),
|
|
text_size: Some(gpui::Size::new(14, 14)),
|
|
high: gpui::rgb(0xF38BA8),
|
|
medium: gpui::rgb(0xF9E2AF),
|
|
low: gpui::rgb(0xA6E3A1),
|
|
}
|
|
}
|
|
|
|
pub fn global(app: &gpui::App) -> &Self {
|
|
app.global::<Self>()
|
|
}
|
|
}
|
|
|
|
impl gpui::Global for Theme {}
|
|
|
|
pub trait ActiveTheme {
|
|
fn theme(&self) -> &Theme;
|
|
}
|
|
|
|
impl ActiveTheme for gpui::App {
|
|
#[inline(always)]
|
|
fn theme(&self) -> &Theme {
|
|
Theme::global(self)
|
|
}
|
|
}
|