This commit is contained in:
parent
ac858ab9d3
commit
f9aad6d945
@ -50,7 +50,7 @@ pub trait Client: Clone + PartialEq {
|
||||
url: String,
|
||||
) -> impl Future<Output = Result<(), ClientError>>;
|
||||
|
||||
fn get_card(&self, card_id: &CardId) -> impl Future<Output = Result<Card, ClientError>>;
|
||||
// fn get_card(&self, card_id: &CardId) -> impl Future<Output = Result<Card, ClientError>>;
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn get_all_cards(
|
||||
@ -58,10 +58,12 @@ pub trait Client: Clone + PartialEq {
|
||||
game_id: GameId,
|
||||
) -> impl Future<Output = Result<Vec<Card>, ClientError>>;
|
||||
|
||||
/*
|
||||
fn get_user_cards(
|
||||
&self,
|
||||
game_id: GameId,
|
||||
) -> impl Future<Output = Result<Vec<Card>, ClientError>>;
|
||||
*/
|
||||
|
||||
fn connect_to_game(
|
||||
&self,
|
||||
@ -205,6 +207,7 @@ impl Client for Connection {
|
||||
handle_response(response).await
|
||||
}
|
||||
|
||||
/*
|
||||
async fn get_card(&self, card_id: &CardId) -> Result<Card, ClientError> {
|
||||
let response = Request::get(&format!("/api/cards/{}", card_id.as_str()))
|
||||
.header(
|
||||
@ -217,6 +220,7 @@ impl Client for Connection {
|
||||
|
||||
handle_response(response).await
|
||||
}
|
||||
*/
|
||||
|
||||
async fn get_all_cards(&self, game_id: GameId) -> Result<Vec<Card>, ClientError> {
|
||||
let response = Request::get(&format!("/api/games/{}/all_cards", game_id.as_str()))
|
||||
@ -231,6 +235,7 @@ impl Client for Connection {
|
||||
handle_response(response).await
|
||||
}
|
||||
|
||||
/*
|
||||
async fn get_user_cards(&self, game_id: GameId) -> Result<Vec<Card>, ClientError> {
|
||||
let response = Request::get(&format!("/api/games/{}/cards", game_id.as_str()))
|
||||
.header(
|
||||
@ -243,6 +248,7 @@ impl Client for Connection {
|
||||
|
||||
handle_response(response).await
|
||||
}
|
||||
*/
|
||||
|
||||
fn connect_to_game(
|
||||
&self,
|
||||
|
||||
@ -1,14 +1,4 @@
|
||||
/*
|
||||
* The item being dragged
|
||||
* The underlying data to transfer
|
||||
* The drop target
|
||||
*
|
||||
* ondragstart occurs on the item being dragged when dragging starts
|
||||
*
|
||||
* ondrop occurs on the drop target
|
||||
*/
|
||||
|
||||
use gloo_console::{error, log};
|
||||
use gloo_console::error;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use stylist::css;
|
||||
use thiserror::Error;
|
||||
@ -95,7 +85,7 @@ pub fn DropTarget(DropTargetProps { on_drop, children }: &DropTargetProps) -> Ht
|
||||
e.prevent_default();
|
||||
current_styles.set(styles.clone());
|
||||
}))}
|
||||
ondragleave={Callback::from(clone!((styles, current_styles), move |e: DragEvent| {
|
||||
ondragleave={Callback::from(clone!(current_styles, move |_: DragEvent| {
|
||||
current_styles.set(css!());
|
||||
}))}
|
||||
ondrop={Callback::from(clone!((current_styles, on_drop), move |e: DragEvent| {
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
use serde::Serialize;
|
||||
use stylist::css;
|
||||
use yew::prelude::*;
|
||||
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
use gloo_console::{error, log};
|
||||
use serde::Serialize;
|
||||
use stylist::css;
|
||||
use visions_types::{
|
||||
Card, CardId, Charsheet, GameId, GameMessage, GameOverview, GameRequest, Location, SceneId,
|
||||
@ -465,10 +463,10 @@ fn GmView_<C: Client + Clone + 'static>(
|
||||
);
|
||||
|
||||
let on_save_card = use_callback(
|
||||
(socket.clone(), state.clone()),
|
||||
move |(is_new, card): (bool, Card), (socket, state)| {
|
||||
socket.clone(),
|
||||
move |(is_new, card): (bool, Card), socket| {
|
||||
clone!(
|
||||
(socket, state, is_new, card),
|
||||
(socket, is_new, card),
|
||||
wasm_bindgen_futures::spawn_local(async move {
|
||||
if is_new {
|
||||
socket.send(GameRequest::CardNew(card))
|
||||
@ -524,7 +522,7 @@ pub fn GmView<C: Client + Clone + 'static>(GmViewProps { client, game }: &GmView
|
||||
|
||||
let on_message = use_callback(
|
||||
(),
|
||||
clone!((client, view_state), {
|
||||
clone!(view_state, {
|
||||
move |message: GameMessage, _| match message {
|
||||
GameMessage::AvailableImages(images) => {
|
||||
view_state.dispatch(ViewStateAction::SetAvailableImages(images));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user