BlueGit

ict rusty-teams

Files

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

assets.rs

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