From 18e83c1ab10b77fcf4aa8ff1546b78a7ee83c40c Mon Sep 17 00:00:00 2001 From: RobDavenport Date: Sat, 4 May 2024 22:43:20 +0900 Subject: [PATCH] game image progress --- .../src/modes/arcade_mode/manage_game.rs | 16 ++++++++++++++-- gamercade_app/src/task_manager/http.rs | 10 ++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/gamercade_app/src/modes/arcade_mode/manage_game.rs b/gamercade_app/src/modes/arcade_mode/manage_game.rs index 0871ec8..906b762 100644 --- a/gamercade_app/src/modes/arcade_mode/manage_game.rs +++ b/gamercade_app/src/modes/arcade_mode/manage_game.rs @@ -30,8 +30,6 @@ impl ManageGameView { } } - // TODO: Add game icon visible here - // TODO: Add ability to upload game icons pub fn draw(&mut self, context: &mut AppDrawContext) -> bool { let mut done = false; let ui = &mut context.ui; @@ -48,6 +46,20 @@ impl ManageGameView { ui.label("Short Description: "); ui.text_edit_singleline(&mut self.short_description); + // TODO: Add game icon visible here + ui.horizontal(|ui| { + if ui.button("Upload Image").clicked() { + // TODO: Add the upload image logic + }; + + if ui.button("Delete Image").clicked() { + // TODO: Add delete image "are you sure?" check + // TODO: If sure, delete it + }; + }); + + ui.separator(); + ui.label("Long Description: "); ui.text_edit_singleline(&mut self.long_description); ui.separator(); diff --git a/gamercade_app/src/task_manager/http.rs b/gamercade_app/src/task_manager/http.rs index d72796d..8b84225 100644 --- a/gamercade_app/src/task_manager/http.rs +++ b/gamercade_app/src/task_manager/http.rs @@ -43,6 +43,8 @@ pub enum DownloadStatus { pub enum HttpRequest { DownloadRom(WithSession), UploadRom(WithSession), + DownloadImage(u64), + UploadImage(WithSession), } #[derive(Debug)] @@ -62,6 +64,12 @@ pub struct UploadRom { pub bytes: Vec, } +#[derive(Debug)] +pub struct UploadImage { + pub game_id: i64, + pub image: Vec, +} + impl TaskRequest for HttpRequest { async fn handle_request( self, @@ -117,6 +125,8 @@ impl TaskRequest for HttpRequest { .unwrap(), } } + HttpRequest::DownloadImage(request) => todo!(), + HttpRequest::UploadImage(request) => todo!(), } } }