From 0ce07642049cf71e8f4d1b4f7d454bf13e1333d1 Mon Sep 17 00:00:00 2001 From: Adrien Date: Thu, 4 Apr 2024 14:27:58 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Isolate=20infra=20and=20ui=20com?= =?UTF-8?q?ponents?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The src/base.rs is still to be reworked. --- build.rs | 2 +- {src/fonts => fonts}/Geist/Geist-Black.woff2 | Bin {src/fonts => fonts}/Geist/Geist-Bold.woff2 | Bin {src/fonts => fonts}/Geist/Geist-Light.woff2 | Bin {src/fonts => fonts}/Geist/Geist-Medium.woff2 | Bin {src/fonts => fonts}/Geist/Geist-Regular.woff2 | Bin {src/fonts => fonts}/Geist/Geist-SemiBold.woff2 | Bin {src/fonts => fonts}/Geist/Geist-Thin.woff2 | Bin {src/fonts => fonts}/Geist/Geist-UltraBlack.woff2 | Bin {src/fonts => fonts}/Geist/Geist-UltraLight.woff2 | Bin {src/fonts => fonts}/Geist/GeistVariableVF.ttf | Bin {src/fonts => fonts}/Geist/GeistVariableVF.woff2 | Bin {src/fonts => fonts}/Geist/LICENSE.TXT | 0 src/base.rs | 8 ++++---- src/components/mod.rs | 13 ------------- src/data/mod.rs | 1 - .../messaging/matrix}/client.rs | 0 src/infrastructure/messaging/matrix/mod.rs | 3 +++ .../messaging/matrix}/requester.rs | 0 .../messaging/matrix}/worker_tasks.rs | 0 src/infrastructure/messaging/mod.rs | 1 + src/infrastructure/mod.rs | 2 ++ .../datasources => infrastructure/services}/mod.rs | 0 .../services}/random_svg_generators.rs | 0 src/main.rs | 11 +++++------ src/matrix_interface/mod.rs | 3 --- src/{ => ui}/_base.scss | 0 src/{ => ui}/components/avatar_selector.rs | 2 +- src/{ => ui}/components/avatar_selector.scss | 0 src/{ => ui}/components/button.rs | 2 +- src/{ => ui}/components/button.scss | 0 .../components/chats_window/chats_window.scss | 0 .../components/chats_window/conversation.rs | 6 +++--- .../components/chats_window/conversation.scss | 0 .../components/chats_window/edit_section.rs | 2 +- .../components/chats_window/edit_section.scss | 0 src/{ => ui}/components/chats_window/interface.rs | 0 src/{ => ui}/components/chats_window/mod.rs | 7 ++++--- src/{ => ui}/components/chats_window/navbar.rs | 2 +- src/{ => ui}/components/chats_window/navbar.scss | 0 .../components/contacts_window/contacts.rs | 4 ++-- .../components/contacts_window/contacts.scss | 0 .../components/contacts_window/contacts_section.rs | 4 ++-- .../contacts_window/contacts_section.scss | 0 .../contacts_window/contacts_window.scss | 0 src/{ => ui}/components/contacts_window/mod.rs | 6 +++--- .../components/contacts_window/user_infos.rs | 6 +++--- .../components/contacts_window/user_infos.scss | 0 src/{ => ui}/components/header.rs | 2 +- src/{ => ui}/components/header.scss | 0 src/{ => ui}/components/icons.rs | 2 +- src/{ => ui}/components/icons.scss | 0 src/{ => ui}/components/loading.rs | 2 +- src/{ => ui}/components/loading.scss | 0 src/{ => ui}/components/login.rs | 6 ++++-- src/{ => ui}/components/login.scss | 0 src/{ => ui}/components/main_window.rs | 2 +- src/ui/components/mod.rs | 13 +++++++++++++ src/{ => ui}/components/modal.rs | 4 ++-- src/{ => ui}/components/modal.scss | 0 src/{ => ui}/components/spinner.rs | 2 +- src/{ => ui}/components/spinner.scss | 0 src/{ => ui}/components/text_input.rs | 2 +- src/{ => ui}/components/text_input.scss | 0 src/{ => ui}/components/wallpaper.rs | 2 +- src/{ => ui}/components/wallpaper.scss | 0 src/ui/mod.rs | 1 + 67 files changed, 64 insertions(+), 59 deletions(-) rename {src/fonts => fonts}/Geist/Geist-Black.woff2 (100%) rename {src/fonts => fonts}/Geist/Geist-Bold.woff2 (100%) rename {src/fonts => fonts}/Geist/Geist-Light.woff2 (100%) rename {src/fonts => fonts}/Geist/Geist-Medium.woff2 (100%) rename {src/fonts => fonts}/Geist/Geist-Regular.woff2 (100%) rename {src/fonts => fonts}/Geist/Geist-SemiBold.woff2 (100%) rename {src/fonts => fonts}/Geist/Geist-Thin.woff2 (100%) rename {src/fonts => fonts}/Geist/Geist-UltraBlack.woff2 (100%) rename {src/fonts => fonts}/Geist/Geist-UltraLight.woff2 (100%) rename {src/fonts => fonts}/Geist/GeistVariableVF.ttf (100%) rename {src/fonts => fonts}/Geist/GeistVariableVF.woff2 (100%) rename {src/fonts => fonts}/Geist/LICENSE.TXT (100%) delete mode 100644 src/components/mod.rs delete mode 100644 src/data/mod.rs rename src/{matrix_interface => infrastructure/messaging/matrix}/client.rs (100%) create mode 100644 src/infrastructure/messaging/matrix/mod.rs rename src/{matrix_interface => infrastructure/messaging/matrix}/requester.rs (100%) rename src/{matrix_interface => infrastructure/messaging/matrix}/worker_tasks.rs (100%) create mode 100644 src/infrastructure/messaging/mod.rs create mode 100644 src/infrastructure/mod.rs rename src/{data/datasources => infrastructure/services}/mod.rs (100%) rename src/{data/datasources => infrastructure/services}/random_svg_generators.rs (100%) delete mode 100644 src/matrix_interface/mod.rs rename src/{ => ui}/_base.scss (100%) rename src/{ => ui}/components/avatar_selector.rs (96%) rename src/{ => ui}/components/avatar_selector.scss (100%) rename src/{ => ui}/components/button.rs (98%) rename src/{ => ui}/components/button.scss (100%) rename src/{ => ui}/components/chats_window/chats_window.scss (100%) rename src/{ => ui}/components/chats_window/conversation.rs (93%) rename src/{ => ui}/components/chats_window/conversation.scss (100%) rename src/{ => ui}/components/chats_window/edit_section.rs (93%) rename src/{ => ui}/components/chats_window/edit_section.scss (100%) rename src/{ => ui}/components/chats_window/interface.rs (100%) rename src/{ => ui}/components/chats_window/mod.rs (96%) rename src/{ => ui}/components/chats_window/navbar.rs (95%) rename src/{ => ui}/components/chats_window/navbar.scss (100%) rename src/{ => ui}/components/contacts_window/contacts.rs (80%) rename src/{ => ui}/components/contacts_window/contacts.scss (100%) rename src/{ => ui}/components/contacts_window/contacts_section.rs (95%) rename src/{ => ui}/components/contacts_window/contacts_section.scss (100%) rename src/{ => ui}/components/contacts_window/contacts_window.scss (100%) rename src/{ => ui}/components/contacts_window/mod.rs (92%) rename src/{ => ui}/components/contacts_window/user_infos.rs (92%) rename src/{ => ui}/components/contacts_window/user_infos.scss (100%) rename src/{ => ui}/components/header.rs (90%) rename src/{ => ui}/components/header.scss (100%) rename src/{ => ui}/components/icons.rs (98%) rename src/{ => ui}/components/icons.scss (100%) rename src/{ => ui}/components/loading.rs (88%) rename src/{ => ui}/components/loading.scss (100%) rename src/{ => ui}/components/login.rs (99%) rename src/{ => ui}/components/login.scss (100%) rename src/{ => ui}/components/main_window.rs (79%) create mode 100644 src/ui/components/mod.rs rename src/{ => ui}/components/modal.rs (96%) rename src/{ => ui}/components/modal.scss (100%) rename src/{ => ui}/components/spinner.rs (94%) rename src/{ => ui}/components/spinner.scss (100%) rename src/{ => ui}/components/text_input.rs (98%) rename src/{ => ui}/components/text_input.scss (100%) rename src/{ => ui}/components/wallpaper.rs (82%) rename src/{ => ui}/components/wallpaper.scss (100%) create mode 100644 src/ui/mod.rs diff --git a/build.rs b/build.rs index 90cf41a..58ada3f 100644 --- a/build.rs +++ b/build.rs @@ -14,7 +14,7 @@ fn main() { let out_dir = env::var("OUT_DIR").unwrap(); - let style_src_path = PathBuf::from("src/_base.scss"); + let style_src_path = PathBuf::from("src/ui/_base.scss"); let style_dst_path = Path::new(&out_dir).join("style_vars.rs"); export_color_variables(&style_src_path, &style_dst_path) diff --git a/src/fonts/Geist/Geist-Black.woff2 b/fonts/Geist/Geist-Black.woff2 similarity index 100% rename from src/fonts/Geist/Geist-Black.woff2 rename to fonts/Geist/Geist-Black.woff2 diff --git a/src/fonts/Geist/Geist-Bold.woff2 b/fonts/Geist/Geist-Bold.woff2 similarity index 100% rename from src/fonts/Geist/Geist-Bold.woff2 rename to fonts/Geist/Geist-Bold.woff2 diff --git a/src/fonts/Geist/Geist-Light.woff2 b/fonts/Geist/Geist-Light.woff2 similarity index 100% rename from src/fonts/Geist/Geist-Light.woff2 rename to fonts/Geist/Geist-Light.woff2 diff --git a/src/fonts/Geist/Geist-Medium.woff2 b/fonts/Geist/Geist-Medium.woff2 similarity index 100% rename from src/fonts/Geist/Geist-Medium.woff2 rename to fonts/Geist/Geist-Medium.woff2 diff --git a/src/fonts/Geist/Geist-Regular.woff2 b/fonts/Geist/Geist-Regular.woff2 similarity index 100% rename from src/fonts/Geist/Geist-Regular.woff2 rename to fonts/Geist/Geist-Regular.woff2 diff --git a/src/fonts/Geist/Geist-SemiBold.woff2 b/fonts/Geist/Geist-SemiBold.woff2 similarity index 100% rename from src/fonts/Geist/Geist-SemiBold.woff2 rename to fonts/Geist/Geist-SemiBold.woff2 diff --git a/src/fonts/Geist/Geist-Thin.woff2 b/fonts/Geist/Geist-Thin.woff2 similarity index 100% rename from src/fonts/Geist/Geist-Thin.woff2 rename to fonts/Geist/Geist-Thin.woff2 diff --git a/src/fonts/Geist/Geist-UltraBlack.woff2 b/fonts/Geist/Geist-UltraBlack.woff2 similarity index 100% rename from src/fonts/Geist/Geist-UltraBlack.woff2 rename to fonts/Geist/Geist-UltraBlack.woff2 diff --git a/src/fonts/Geist/Geist-UltraLight.woff2 b/fonts/Geist/Geist-UltraLight.woff2 similarity index 100% rename from src/fonts/Geist/Geist-UltraLight.woff2 rename to fonts/Geist/Geist-UltraLight.woff2 diff --git a/src/fonts/Geist/GeistVariableVF.ttf b/fonts/Geist/GeistVariableVF.ttf similarity index 100% rename from src/fonts/Geist/GeistVariableVF.ttf rename to fonts/Geist/GeistVariableVF.ttf diff --git a/src/fonts/Geist/GeistVariableVF.woff2 b/fonts/Geist/GeistVariableVF.woff2 similarity index 100% rename from src/fonts/Geist/GeistVariableVF.woff2 rename to fonts/Geist/GeistVariableVF.woff2 diff --git a/src/fonts/Geist/LICENSE.TXT b/fonts/Geist/LICENSE.TXT similarity index 100% rename from src/fonts/Geist/LICENSE.TXT rename to fonts/Geist/LICENSE.TXT diff --git a/src/base.rs b/src/base.rs index 6ba67ab..c05e805 100644 --- a/src/base.rs +++ b/src/base.rs @@ -6,9 +6,9 @@ use futures_util::stream::StreamExt; use std::cell::RefCell; use std::{collections::HashMap, sync::Arc}; -use crate::matrix_interface::client::{Client, RoomEvent}; -use crate::matrix_interface::requester::{Receivers, Requester}; -use crate::matrix_interface::worker_tasks::LoginStyle; +use crate::infrastructure::messaging::matrix::client::{Client, RoomEvent}; +use crate::infrastructure::messaging::matrix::requester::{Receivers, Requester}; +use crate::infrastructure::messaging::matrix::worker_tasks::LoginStyle; use dioxus::prelude::*; use matrix_sdk::{ room::{Room as MatrixRoom, RoomMember}, @@ -17,7 +17,7 @@ use matrix_sdk::{ use tokio::select; use tracing::{debug, error, warn}; -use crate::components::chats_window::interface::Interface as ChatsWinInterface; +use crate::ui::components::chats_window::interface::Interface as ChatsWinInterface; // #[derive(Clone, Debug)] // pub struct UserInfo { diff --git a/src/components/mod.rs b/src/components/mod.rs deleted file mode 100644 index a429ed3..0000000 --- a/src/components/mod.rs +++ /dev/null @@ -1,13 +0,0 @@ -pub mod avatar_selector; -pub mod button; -pub mod chats_window; -pub mod contacts_window; -pub mod header; -pub mod icons; -pub mod loading; -pub mod login; -pub mod main_window; -pub mod modal; -pub mod spinner; -pub mod text_input; -pub mod wallpaper; diff --git a/src/data/mod.rs b/src/data/mod.rs deleted file mode 100644 index e3d884c..0000000 --- a/src/data/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub(crate) mod datasources; diff --git a/src/matrix_interface/client.rs b/src/infrastructure/messaging/matrix/client.rs similarity index 100% rename from src/matrix_interface/client.rs rename to src/infrastructure/messaging/matrix/client.rs diff --git a/src/infrastructure/messaging/matrix/mod.rs b/src/infrastructure/messaging/matrix/mod.rs new file mode 100644 index 0000000..e0e9b7d --- /dev/null +++ b/src/infrastructure/messaging/matrix/mod.rs @@ -0,0 +1,3 @@ +pub(crate) mod client; +pub(crate) mod requester; +pub(crate) mod worker_tasks; diff --git a/src/matrix_interface/requester.rs b/src/infrastructure/messaging/matrix/requester.rs similarity index 100% rename from src/matrix_interface/requester.rs rename to src/infrastructure/messaging/matrix/requester.rs diff --git a/src/matrix_interface/worker_tasks.rs b/src/infrastructure/messaging/matrix/worker_tasks.rs similarity index 100% rename from src/matrix_interface/worker_tasks.rs rename to src/infrastructure/messaging/matrix/worker_tasks.rs diff --git a/src/infrastructure/messaging/mod.rs b/src/infrastructure/messaging/mod.rs new file mode 100644 index 0000000..772af26 --- /dev/null +++ b/src/infrastructure/messaging/mod.rs @@ -0,0 +1 @@ +pub(crate) mod matrix; diff --git a/src/infrastructure/mod.rs b/src/infrastructure/mod.rs new file mode 100644 index 0000000..70c831a --- /dev/null +++ b/src/infrastructure/mod.rs @@ -0,0 +1,2 @@ +pub(crate) mod messaging; +pub(crate) mod services; diff --git a/src/data/datasources/mod.rs b/src/infrastructure/services/mod.rs similarity index 100% rename from src/data/datasources/mod.rs rename to src/infrastructure/services/mod.rs diff --git a/src/data/datasources/random_svg_generators.rs b/src/infrastructure/services/random_svg_generators.rs similarity index 100% rename from src/data/datasources/random_svg_generators.rs rename to src/infrastructure/services/random_svg_generators.rs diff --git a/src/main.rs b/src/main.rs index dce7f83..c47a94a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,8 +1,7 @@ #![allow(non_snake_case)] -mod components; -mod data; -mod matrix_interface; +mod infrastructure; +mod ui; mod utils; use dioxus::prelude::*; @@ -11,9 +10,9 @@ use tracing::{debug, Level}; use crate::base::{login, sync_rooms}; use crate::base::{APP_SETTINGS, ROOMS, SESSION}; -use crate::components::loading::LoadingPage; -use crate::components::login::Login; -use crate::components::main_window::MainWindow; +use crate::ui::components::loading::LoadingPage; +use crate::ui::components::login::Login; +use crate::ui::components::main_window::MainWindow; mod base; diff --git a/src/matrix_interface/mod.rs b/src/matrix_interface/mod.rs deleted file mode 100644 index e239b70..0000000 --- a/src/matrix_interface/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub mod client; -pub mod requester; -pub mod worker_tasks; diff --git a/src/_base.scss b/src/ui/_base.scss similarity index 100% rename from src/_base.scss rename to src/ui/_base.scss diff --git a/src/components/avatar_selector.rs b/src/ui/components/avatar_selector.rs similarity index 96% rename from src/components/avatar_selector.rs rename to src/ui/components/avatar_selector.rs index b0da778..bf9ba91 100644 --- a/src/components/avatar_selector.rs +++ b/src/ui/components/avatar_selector.rs @@ -1,6 +1,6 @@ use dioxus::prelude::*; -turf::style_sheet!("src/components/avatar_selector.scss"); +turf::style_sheet!("src/ui/components/avatar_selector.scss"); pub fn AvatarSelector() -> Element { rsx! { diff --git a/src/components/avatar_selector.scss b/src/ui/components/avatar_selector.scss similarity index 100% rename from src/components/avatar_selector.scss rename to src/ui/components/avatar_selector.scss diff --git a/src/components/button.rs b/src/ui/components/button.rs similarity index 98% rename from src/components/button.rs rename to src/ui/components/button.rs index 3facb47..f10f73c 100644 --- a/src/components/button.rs +++ b/src/ui/components/button.rs @@ -1,7 +1,7 @@ use dioxus::prelude::*; use dioxus_free_icons::{Icon, IconShape}; -turf::style_sheet!("src/components/button.scss"); +turf::style_sheet!("src/ui/components/button.scss"); #[derive(PartialEq, Clone, Props)] struct _ButtonProps { diff --git a/src/components/button.scss b/src/ui/components/button.scss similarity index 100% rename from src/components/button.scss rename to src/ui/components/button.scss diff --git a/src/components/chats_window/chats_window.scss b/src/ui/components/chats_window/chats_window.scss similarity index 100% rename from src/components/chats_window/chats_window.scss rename to src/ui/components/chats_window/chats_window.scss diff --git a/src/components/chats_window/conversation.rs b/src/ui/components/chats_window/conversation.rs similarity index 93% rename from src/components/chats_window/conversation.rs rename to src/ui/components/chats_window/conversation.rs index 689fa2b..e7cfd9a 100644 --- a/src/components/chats_window/conversation.rs +++ b/src/ui/components/chats_window/conversation.rs @@ -4,10 +4,10 @@ use tracing::error; use super::edit_section::EditSection; use crate::base::{sync_messages, ROOMS}; -use crate::components::avatar_selector::AvatarSelector; -use crate::components::icons::DownArrowIcon; +use crate::ui::components::avatar_selector::AvatarSelector; +use crate::ui::components::icons::DownArrowIcon; -turf::style_sheet!("src/components/chats_window/conversation.scss"); +turf::style_sheet!("src/ui/components/chats_window/conversation.scss"); #[component] pub(super) fn Conversation(room_id: OwnedRoomId) -> Element { diff --git a/src/components/chats_window/conversation.scss b/src/ui/components/chats_window/conversation.scss similarity index 100% rename from src/components/chats_window/conversation.scss rename to src/ui/components/chats_window/conversation.scss diff --git a/src/components/chats_window/edit_section.rs b/src/ui/components/chats_window/edit_section.rs similarity index 93% rename from src/components/chats_window/edit_section.rs rename to src/ui/components/chats_window/edit_section.rs index 597053f..3400783 100644 --- a/src/components/chats_window/edit_section.rs +++ b/src/ui/components/chats_window/edit_section.rs @@ -1,6 +1,6 @@ use dioxus::prelude::*; -turf::style_sheet!("src/components/chats_window/edit_section.scss"); +turf::style_sheet!("src/ui/components/chats_window/edit_section.scss"); pub fn EditSection() -> Element { rsx! { diff --git a/src/components/chats_window/edit_section.scss b/src/ui/components/chats_window/edit_section.scss similarity index 100% rename from src/components/chats_window/edit_section.scss rename to src/ui/components/chats_window/edit_section.scss diff --git a/src/components/chats_window/interface.rs b/src/ui/components/chats_window/interface.rs similarity index 100% rename from src/components/chats_window/interface.rs rename to src/ui/components/chats_window/interface.rs diff --git a/src/components/chats_window/mod.rs b/src/ui/components/chats_window/mod.rs similarity index 96% rename from src/components/chats_window/mod.rs rename to src/ui/components/chats_window/mod.rs index 2dd933d..8de957d 100644 --- a/src/components/chats_window/mod.rs +++ b/src/ui/components/chats_window/mod.rs @@ -1,8 +1,9 @@ mod conversation; mod edit_section; -pub mod interface; mod navbar; +pub(crate) mod interface; + use std::cell::RefCell; use std::collections::{HashMap, HashSet}; @@ -12,13 +13,13 @@ use tokio::sync::broadcast::Receiver; use tracing::{debug, error}; use crate::base::{sync_rooms, Room, ROOMS}; -use crate::matrix_interface::requester::Receivers; +use crate::infrastructure::messaging::matrix::requester::Receivers; use conversation::Conversation; use navbar::Navbar; use interface::{Interface, Tasks}; -turf::style_sheet!("src/components/chats_window/chats_window.scss"); +turf::style_sheet!("src/ui/components/chats_window/chats_window.scss"); #[derive(Props, Clone, PartialEq)] pub struct ChatsWindowProps { diff --git a/src/components/chats_window/navbar.rs b/src/ui/components/chats_window/navbar.rs similarity index 95% rename from src/components/chats_window/navbar.rs rename to src/ui/components/chats_window/navbar.rs index cebf9e7..605a153 100644 --- a/src/components/chats_window/navbar.rs +++ b/src/ui/components/chats_window/navbar.rs @@ -1,7 +1,7 @@ use dioxus::prelude::*; use tracing::debug; -turf::style_sheet!("src/components/chats_window/navbar.scss"); +turf::style_sheet!("src/ui/components/chats_window/navbar.scss"); pub fn Navbar() -> Element { debug!("Navbar rendering"); diff --git a/src/components/chats_window/navbar.scss b/src/ui/components/chats_window/navbar.scss similarity index 100% rename from src/components/chats_window/navbar.scss rename to src/ui/components/chats_window/navbar.scss diff --git a/src/components/contacts_window/contacts.rs b/src/ui/components/contacts_window/contacts.rs similarity index 80% rename from src/components/contacts_window/contacts.rs rename to src/ui/components/contacts_window/contacts.rs index bbd9dde..7e949df 100644 --- a/src/components/contacts_window/contacts.rs +++ b/src/ui/components/contacts_window/contacts.rs @@ -3,11 +3,11 @@ use std::rc::Rc; use dioxus::prelude::*; use tracing::debug; -use crate::components::contacts_window::contacts_section::{ +use crate::ui::components::contacts_window::contacts_section::{ filter_people_conversations, filter_room_conversations, ContactsSection, }; -turf::style_sheet!("src/components/contacts_window/contacts.scss"); +turf::style_sheet!("src/ui/components/contacts_window/contacts.scss"); pub fn Contacts() -> Element { debug!("Contacts rendering"); diff --git a/src/components/contacts_window/contacts.scss b/src/ui/components/contacts_window/contacts.scss similarity index 100% rename from src/components/contacts_window/contacts.scss rename to src/ui/components/contacts_window/contacts.scss diff --git a/src/components/contacts_window/contacts_section.rs b/src/ui/components/contacts_window/contacts_section.rs similarity index 95% rename from src/components/contacts_window/contacts_section.rs rename to src/ui/components/contacts_window/contacts_section.rs index 5292c46..a6f5750 100644 --- a/src/components/contacts_window/contacts_section.rs +++ b/src/ui/components/contacts_window/contacts_section.rs @@ -8,9 +8,9 @@ use matrix_sdk::{ruma::OwnedRoomId, RoomState}; use tracing::debug; use crate::base::{ByIdRooms, Room, CHATS_WIN_INTERFACE, ROOMS}; -use crate::components::chats_window::interface::Interface as ChatsWindowInterface; +use crate::ui::components::chats_window::interface::Interface as ChatsWindowInterface; -turf::style_sheet!("src/components/contacts_window/contacts_section.scss"); +turf::style_sheet!("src/ui/components/contacts_window/contacts_section.scss"); fn ContactsArrow() -> Element { rsx! { diff --git a/src/components/contacts_window/contacts_section.scss b/src/ui/components/contacts_window/contacts_section.scss similarity index 100% rename from src/components/contacts_window/contacts_section.scss rename to src/ui/components/contacts_window/contacts_section.scss diff --git a/src/components/contacts_window/contacts_window.scss b/src/ui/components/contacts_window/contacts_window.scss similarity index 100% rename from src/components/contacts_window/contacts_window.scss rename to src/ui/components/contacts_window/contacts_window.scss diff --git a/src/components/contacts_window/mod.rs b/src/ui/components/contacts_window/mod.rs similarity index 92% rename from src/components/contacts_window/mod.rs rename to src/ui/components/contacts_window/mod.rs index 5458823..678eaef 100644 --- a/src/components/contacts_window/mod.rs +++ b/src/ui/components/contacts_window/mod.rs @@ -5,10 +5,10 @@ mod user_infos; use dioxus::prelude::*; use tracing::debug; -use crate::components::contacts_window::contacts::Contacts; -use crate::components::contacts_window::user_infos::UserInfos; +use crate::ui::components::contacts_window::contacts::Contacts; +use crate::ui::components::contacts_window::user_infos::UserInfos; -turf::style_sheet!("src/components/contacts_window/contacts_window.scss"); +turf::style_sheet!("src/ui/components/contacts_window/contacts_window.scss"); pub fn ContactsWindow() -> Element { debug!("ContactsWindow rendering"); diff --git a/src/components/contacts_window/user_infos.rs b/src/ui/components/contacts_window/user_infos.rs similarity index 92% rename from src/components/contacts_window/user_infos.rs rename to src/ui/components/contacts_window/user_infos.rs index 5d8395e..ef3e11d 100644 --- a/src/components/contacts_window/user_infos.rs +++ b/src/ui/components/contacts_window/user_infos.rs @@ -1,10 +1,10 @@ use dioxus::prelude::*; use tracing::debug; -use crate::components::avatar_selector::AvatarSelector; -use crate::components::icons::DownArrowIcon; +use crate::ui::components::avatar_selector::AvatarSelector; +use crate::ui::components::icons::DownArrowIcon; -turf::style_sheet!("src/components/contacts_window/user_infos.scss"); +turf::style_sheet!("src/ui/components/contacts_window/user_infos.scss"); static MESSAGE_PLACEHOLDER: &str = ""; diff --git a/src/components/contacts_window/user_infos.scss b/src/ui/components/contacts_window/user_infos.scss similarity index 100% rename from src/components/contacts_window/user_infos.scss rename to src/ui/components/contacts_window/user_infos.scss diff --git a/src/components/header.rs b/src/ui/components/header.rs similarity index 90% rename from src/components/header.rs rename to src/ui/components/header.rs index d670556..394ad5b 100644 --- a/src/components/header.rs +++ b/src/ui/components/header.rs @@ -1,6 +1,6 @@ use dioxus::prelude::*; -turf::style_sheet!("src/components/header.scss"); +turf::style_sheet!("src/ui/components/header.scss"); pub fn Header() -> Element { rsx! { diff --git a/src/components/header.scss b/src/ui/components/header.scss similarity index 100% rename from src/components/header.scss rename to src/ui/components/header.scss diff --git a/src/components/icons.rs b/src/ui/components/icons.rs similarity index 98% rename from src/components/icons.rs rename to src/ui/components/icons.rs index cf099e9..e689af5 100644 --- a/src/components/icons.rs +++ b/src/ui/components/icons.rs @@ -2,7 +2,7 @@ use dioxus::prelude::*; use dioxus_free_icons::icons::md_navigation_icons::MdArrowDropDown; use dioxus_free_icons::{Icon, IconShape}; -turf::style_sheet!("src/components/icons.scss"); +turf::style_sheet!("src/ui/components/icons.scss"); include!(concat!(env!("OUT_DIR"), "/style_vars.rs")); diff --git a/src/components/icons.scss b/src/ui/components/icons.scss similarity index 100% rename from src/components/icons.scss rename to src/ui/components/icons.scss diff --git a/src/components/loading.rs b/src/ui/components/loading.rs similarity index 88% rename from src/components/loading.rs rename to src/ui/components/loading.rs index 8d07831..67b2d86 100644 --- a/src/components/loading.rs +++ b/src/ui/components/loading.rs @@ -4,7 +4,7 @@ use tracing::debug; use super::spinner::Spinner; use super::wallpaper::Wallpaper; -turf::style_sheet!("src/components/loading.scss"); +turf::style_sheet!("src/ui/components/loading.scss"); pub fn LoadingPage() -> Element { debug!("LoadingPage rendering"); diff --git a/src/components/loading.scss b/src/ui/components/loading.scss similarity index 100% rename from src/components/loading.scss rename to src/ui/components/loading.scss diff --git a/src/components/login.rs b/src/ui/components/login.rs similarity index 99% rename from src/components/login.rs rename to src/ui/components/login.rs index 87e5f58..c9cac7b 100644 --- a/src/components/login.rs +++ b/src/ui/components/login.rs @@ -10,7 +10,9 @@ use validator::{Validate, ValidateArgs, ValidateEmail, ValidationError, Validati use zxcvbn::zxcvbn; use crate::base::{Session, SESSION}; -use crate::data::datasources::random_svg_generators::{generate_random_svg_shape, ShapeConfig}; +use crate::infrastructure::services::random_svg_generators::{ + generate_random_svg_shape, ShapeConfig, +}; use super::button::{LoginButton, RegisterButton}; use super::modal::{Modal, Severity}; @@ -29,7 +31,7 @@ use style::{ COLOR_TERNARY_150, COLOR_TERNARY_80, COLOR_TERNARY_90, }; -turf::style_sheet!("src/components/login.scss"); +turf::style_sheet!("src/ui/components/login.scss"); const BACKGROUND_COLORS_STR: &str = formatcp!( "{COLOR_PRIMARY_150},{COLOR_PRIMARY_140},\ diff --git a/src/components/login.scss b/src/ui/components/login.scss similarity index 100% rename from src/components/login.scss rename to src/ui/components/login.scss diff --git a/src/components/main_window.rs b/src/ui/components/main_window.rs similarity index 79% rename from src/components/main_window.rs rename to src/ui/components/main_window.rs index dc75a22..08f63ca 100644 --- a/src/components/main_window.rs +++ b/src/ui/components/main_window.rs @@ -2,7 +2,7 @@ use dioxus::prelude::*; use tracing::debug; use crate::base::SESSION; -use crate::components::contacts_window::ContactsWindow; +use crate::ui::components::contacts_window::ContactsWindow; pub fn MainWindow() -> Element { debug!("MainWindow rendering"); diff --git a/src/ui/components/mod.rs b/src/ui/components/mod.rs new file mode 100644 index 0000000..ecab4e3 --- /dev/null +++ b/src/ui/components/mod.rs @@ -0,0 +1,13 @@ +pub(crate) mod avatar_selector; +pub(crate) mod button; +pub(crate) mod chats_window; +pub(crate) mod contacts_window; +pub(crate) mod header; +pub(crate) mod icons; +pub(crate) mod loading; +pub(crate) mod login; +pub(crate) mod main_window; +pub(crate) mod modal; +pub(crate) mod spinner; +pub(crate) mod text_input; +pub(crate) mod wallpaper; diff --git a/src/components/modal.rs b/src/ui/components/modal.rs similarity index 96% rename from src/components/modal.rs rename to src/ui/components/modal.rs index 9fe197e..59a5016 100644 --- a/src/components/modal.rs +++ b/src/ui/components/modal.rs @@ -5,7 +5,7 @@ use dioxus::prelude::*; use super::button::{ErrorButton, SuccessButton, WarningButton}; -use crate::data::datasources::random_svg_generators::{ +use crate::infrastructure::services::random_svg_generators::{ generate_random_svg_avatar, AvatarConfig, AvatarFeeling, }; @@ -13,7 +13,7 @@ include!(concat!(env!("OUT_DIR"), "/style_vars.rs")); use style::{COLOR_CRITICAL_100, COLOR_SUCCESS_100, COLOR_WARNING_100}; -turf::style_sheet!("src/components/modal.scss"); +turf::style_sheet!("src/ui/components/modal.scss"); #[derive(Clone, Copy, Eq, PartialEq, Hash)] pub enum Severity { diff --git a/src/components/modal.scss b/src/ui/components/modal.scss similarity index 100% rename from src/components/modal.scss rename to src/ui/components/modal.scss diff --git a/src/components/spinner.rs b/src/ui/components/spinner.rs similarity index 94% rename from src/components/spinner.rs rename to src/ui/components/spinner.rs index 3cc2ae5..e1523ac 100644 --- a/src/components/spinner.rs +++ b/src/ui/components/spinner.rs @@ -1,7 +1,7 @@ use dioxus::prelude::*; use dioxus_free_icons::{Icon, IconShape}; -turf::style_sheet!("src/components/spinner.scss"); +turf::style_sheet!("src/ui/components/spinner.scss"); #[derive(Clone, PartialEq)] struct _Spinner; diff --git a/src/components/spinner.scss b/src/ui/components/spinner.scss similarity index 100% rename from src/components/spinner.scss rename to src/ui/components/spinner.scss diff --git a/src/components/text_input.rs b/src/ui/components/text_input.rs similarity index 98% rename from src/components/text_input.rs rename to src/ui/components/text_input.rs index 03b8dc9..1ecb3ef 100644 --- a/src/components/text_input.rs +++ b/src/ui/components/text_input.rs @@ -5,7 +5,7 @@ use dioxus_free_icons::Icon; use super::icons::Pyramid; -turf::style_sheet!("src/components/text_input.scss"); +turf::style_sheet!("src/ui/components/text_input.scss"); pub trait InputPropsData {} diff --git a/src/components/text_input.scss b/src/ui/components/text_input.scss similarity index 100% rename from src/components/text_input.scss rename to src/ui/components/text_input.scss diff --git a/src/components/wallpaper.rs b/src/ui/components/wallpaper.rs similarity index 82% rename from src/components/wallpaper.rs rename to src/ui/components/wallpaper.rs index 3d02b5b..84212b4 100644 --- a/src/components/wallpaper.rs +++ b/src/ui/components/wallpaper.rs @@ -1,6 +1,6 @@ use dioxus::prelude::*; -turf::style_sheet!("src/components/wallpaper.scss"); +turf::style_sheet!("src/ui/components/wallpaper.scss"); pub fn Wallpaper() -> Element { rsx! { diff --git a/src/components/wallpaper.scss b/src/ui/components/wallpaper.scss similarity index 100% rename from src/components/wallpaper.scss rename to src/ui/components/wallpaper.scss diff --git a/src/ui/mod.rs b/src/ui/mod.rs new file mode 100644 index 0000000..ac15021 --- /dev/null +++ b/src/ui/mod.rs @@ -0,0 +1 @@ +pub(crate) mod components;