Skip to repository content

tenant.openagents/omega

No repository description is available.

OpenAgents Git authority 2026-07-28T05:57:18.539Z Public web read
NIP-34 coordinate30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omega
MaintainersHidden in public view
References2 branches · 1 tag
Read-only clonegit clone https://openagents.com/git/tenant.openagents/omega.git
Browse files

gif_viewer.rs

57 lines · 1.3 KB · rust
1#![cfg_attr(target_family = "wasm", no_main)]
2
3use gpui::{App, Context, Render, Window, WindowOptions, div, img, prelude::*};
4use gpui_platform::application;
5use std::path::PathBuf;
6
7struct GifViewer {
8    gif_path: PathBuf,
9}
10
11impl GifViewer {
12    fn new(gif_path: PathBuf) -> Self {
13        Self { gif_path }
14    }
15}
16
17impl Render for GifViewer {
18    fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
19        div().size_full().child(
20            img(self.gif_path.clone())
21                .size_full()
22                .object_fit(gpui::ObjectFit::Contain)
23                .id("gif"),
24        )
25    }
26}
27
28fn run_example() {
29    application().run(|cx: &mut App| {
30        let gif_path =
31            PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("examples/image/black-cat-typing.gif");
32
33        cx.open_window(
34            WindowOptions {
35                focus: true,
36                ..Default::default()
37            },
38            |_, cx| cx.new(|_| GifViewer::new(gif_path)),
39        )
40        .unwrap();
41        cx.activate(true);
42    });
43}
44
45#[cfg(not(target_family = "wasm"))]
46fn main() {
47    env_logger::init();
48    run_example();
49}
50
51#[cfg(target_family = "wasm")]
52#[wasm_bindgen::prelude::wasm_bindgen(start)]
53pub fn start() {
54    gpui_platform::web_init();
55    run_example();
56}
57
Served at tenant.openagents/omega Member data and write actions are omitted.