Desktop | Fantaasta
// store/leagueStore.ts import create from 'zustand'; interface LeagueState null; players: Player[]; isLoading: boolean; setLeague: (league: League) => void; refreshPlayers: (sport: string) => Promise<void>;
#[tauri::command] fn simulate_draft(league_id: u32) -> Result<DraftResult, String> // AI simulation logic
Live Data Service (Frontend to Tauri) // services/playerService.ts import invoke from '@tauri-apps/api/tauri'; export async function fetchPlayers(sport: string) return await invoke('get_player_stats', sport ); fantaasta desktop
Use GitHub Actions to build for all platforms on tag push:
pub fn get_players(&self, sport: &str) -> Result<Vec<Player>> Ok(Player id: row.get(0)?, name: row.get(1)?, avg_points: row.get(3)?, ) )?; Ok(players.filter_map(Result::ok).collect()) // store/leagueStore
#[cfg(test)] mod tests use super::*; #[test] fn test_get_player_stats() let result = get_player_stats("football".to_string()); assert!(result.is_ok());
impl Database pub fn new() -> Self let conn = Connection::open("fantaasta.db").unwrap(); conn.execute( "CREATE TABLE IF NOT EXISTS players ( id INTEGER PRIMARY KEY, name TEXT, sport TEXT, avg_points REAL )", [], ).unwrap(); Database conn // store/leagueStore.ts import create from 'zustand'
use rusqlite::Connection, Result; pub struct Database conn: Connection,