🎨 Isolate infra and ui components

The src/base.rs is still to be reworked.
This commit is contained in:
2024-04-04 14:27:58 +02:00
parent 92bf860101
commit 0ce0764204
67 changed files with 64 additions and 59 deletions

View File

@@ -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 {

View File

@@ -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;

View File

@@ -1 +0,0 @@
pub(crate) mod datasources;

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,92 +0,0 @@
Geist Sans and Geist Mono Font
(C) 2023 Vercel, made in collaboration with basement.studio
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is available with a FAQ at: http://scripts.sil.org/OFL and copied below
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION AND CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

View File

@@ -0,0 +1,3 @@
pub(crate) mod client;
pub(crate) mod requester;
pub(crate) mod worker_tasks;

View File

@@ -0,0 +1 @@
pub(crate) mod matrix;

View File

@@ -0,0 +1,2 @@
pub(crate) mod messaging;
pub(crate) mod services;

View File

@@ -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;

View File

@@ -1,3 +0,0 @@
pub mod client;
pub mod requester;
pub mod worker_tasks;

View File

@@ -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! {

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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! {

View File

@@ -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 {

View File

@@ -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");

View File

@@ -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");

View File

@@ -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! {

View File

@@ -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");

View File

@@ -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 = "<Enter a personal message>";

View File

@@ -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! {

View File

@@ -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"));

View File

@@ -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");

View File

@@ -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},\

View File

@@ -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");

13
src/ui/components/mod.rs Normal file
View File

@@ -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;

View File

@@ -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 {

View File

@@ -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;

View File

@@ -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 {}

View File

@@ -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! {

1
src/ui/mod.rs Normal file
View File

@@ -0,0 +1 @@
pub(crate) mod components;