BlueGit

ict rusty-teams

Files

rusty-teams / crates / app-base / src / assets.rs

assets.rs

assets.rs 2.5 KiB Download Raw
1use std::borrow::Cow;
2
3use gpui_kit::{AssetSource, Result, SharedString};
4
5macro_rules! symbols {
6 ($($name:literal),* $(,)?) => {
7 [$((concat!("symbols/", $name, ".svg"), include_bytes!(concat!("../../app/assets/symbols/", $name, ".svg")) as &[u8])),*]
8 };
9}
10
11const SYMBOLS: [(&str, &[u8]); 78] = symbols![
12 "campaign",
13 "bot",
14 "copilot_color",
15 "done",
16 "table",
17 "done_all",
18 "keyboard_return",
19 "schedule",
20 "schedule_send",
21 "event",
22 "wb_sunny",
23 "work",
24 "close",
25 "reply",
26 "group",
27 "tag",
28 "image",
29 "check_circle",
30 "error",
31 "notifications",
32 "content_copy",
33 "attach_file",
34 "upload",
35 "download",
36 "folder_open",
37 "refresh",
38 "code",
39 "link",
40 "format_list_bulleted",
41 "format_list_numbered",
42 "format_quote",
43 "mood",
44 "status_dot",
45 "status_dnd",
46 "status_away",
47 "status_ring",
48 "status_available",
49 "status_offline",
50 "recap",
51 "zoom_in",
52 "zoom_out",
53 "rotate_right",
54 "forward",
55 "open_in_new",
56 "chevron_left",
57 "chevron_right",
58 "fullscreen",
59 "spinner_track",
60 "spinner_arc",
61 "shield",
62 "call",
63 "call_missed",
64 "videocam",
65 "fluent_video",
66 "fluent_record",
67 "fluent_record_stop",
68 "fluent_cloud_arrow_up",
69 "fluent_share",
70 "fluent_clock",
71 "fluent_document_text",
72 "fluent_text_edit_style",
73 "fluent_text_edit_style_filled",
74 "fluent_table_add",
75 "fluent_table_dismiss",
76 "fluent_important",
77 "fluent_important_filled",
78 "fluent_alert_urgent",
79 "fluent_alert_urgent_filled",
80 "fluent_chat",
81 "fluent_text_color",
82 "fluent_highlight",
83 "fluent_text_indent_increase",
84 "fluent_text_indent_decrease",
85 "fluent_line_horizontal_1",
86 "fluent_text_clear_formatting",
87 "fluent_code_block",
88 "fluent_text_header_1",
89 "fluent_text_font_size",
90];
91
92pub struct AppAssets;
93
94impl AssetSource for AppAssets {
95 fn load(&self, path: &str) -> Result<Option<Cow<'static, [u8]>>> {
96 if let Some((_, bytes)) = SYMBOLS.iter().find(|(name, _)| *name == path) {
97 return Ok(Some(Cow::Borrowed(bytes)));
98 }
99 gpui_kit::assets::AllAssets.load(path)
100 }
101
102 fn list(&self, path: &str) -> Result<Vec<SharedString>> {
103 let mut names = gpui_kit::assets::AllAssets.list(path)?;
104 names.extend(
105 SYMBOLS
106 .iter()
107 .filter(|(name, _)| name.starts_with(path))
108 .map(|(name, _)| SharedString::from(*name)),
109 );
110 Ok(names)
111 }
112}