feat: add GIF search and trending functionality with Tauri commands

- Implemented `search_gifs` and `get_trending_gifs` commands in Tauri for GIF retrieval.
- Created a new protocol for GIF requests and responses.
- Added `EmojiPicker` component for emoji selection with recent emoji storage.
- Developed `GifPicker` component for searching and selecting GIFs.
- Introduced emoji data management with recent emoji tracking.
- Added markdown conversion utilities for rendering formatted text.
- Updated Vite configuration to optimize dependencies for Prosemirror.
This commit is contained in:
cloudwithax 2026-02-15 16:46:31 -05:00
parent e468f5ae44
commit 26c1563ea9
5 changed files with 14 additions and 11 deletions

View File

@ -31,7 +31,8 @@ pub async fn search_gifs(
// drop the lock before awaiting the response
drop(handle_ref);
rx.await.map_err(|_| "gif search response channel closed".to_string())?
rx.await
.map_err(|_| "gif search response channel closed".to_string())?
}
#[tauri::command]
@ -59,5 +60,6 @@ pub async fn get_trending_gifs(
drop(handle_ref);
rx.await.map_err(|_| "trending gifs response channel closed".to_string())?
rx.await
.map_err(|_| "trending gifs response channel closed".to_string())?
}

View File

@ -1,8 +1,8 @@
use libp2p::{
gossipsub, identify, kad, mdns, ping, relay,
rendezvous, request_response::cbor, swarm::NetworkBehaviour,
};
use crate::protocol::gif::{GifRequest, GifResponse};
use libp2p::{
gossipsub, identify, kad, mdns, ping, relay, rendezvous, request_response::cbor,
swarm::NetworkBehaviour,
};
#[derive(NetworkBehaviour)]
pub struct DuskBehaviour {

View File

@ -76,7 +76,9 @@ pub fn build_swarm(
mdns,
identify,
// ping every 30s to keep the relay connection alive
ping: ping::Behaviour::new(ping::Config::new().with_interval(Duration::from_secs(30))),
ping: ping::Behaviour::new(
ping::Config::new().with_interval(Duration::from_secs(30)),
),
// gif search via request-response to the relay (outbound only)
gif_service: cbor::Behaviour::<GifRequest, GifResponse>::new(
[(GIF_PROTOCOL, ProtocolSupport::Outbound)],

View File

@ -5,7 +5,8 @@ import type { GifResult } from "../../lib/types";
import * as tauri from "../../lib/tauri";
// detect if running inside tauri (vs standalone vite dev)
const isTauri = typeof window !== "undefined" && "__TAURI_INTERNALS__" in window;
const isTauri =
typeof window !== "undefined" && "__TAURI_INTERNALS__" in window;
interface GifPickerProps {
onSelect: (gifUrl: string) => void;

View File

@ -351,8 +351,6 @@ export async function searchGifs(
return invoke("search_gifs", { query, limit });
}
export async function getTrendingGifs(
limit?: number,
): Promise<GifResponse> {
export async function getTrendingGifs(limit?: number): Promise<GifResponse> {
return invoke("get_trending_gifs", { limit });
}