Skip to content

Commit

Permalink
refactor: Move src/widgets/*_switcher.* to src/widgets/switchers/,
Browse files Browse the repository at this point in the history
…Close #54
  • Loading branch information
wangeguo committed Feb 27, 2024
1 parent dad462f commit 2f9c529
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "desktop"
version = "0.6.3"
version = "0.6.4"
edition = "2021"

[[bin]]
Expand Down
3 changes: 2 additions & 1 deletion src/views/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ use crate::styles::constants::{FONT_SIZE_SMALLER, ICON_FONT_SIZE_TOOLBAR, SPACIN
use crate::views::detail::inspect::{self, Information};
use crate::views::detail::logs::{self, Logs};
use crate::views::detail::stats::{self, Stats};
use crate::widgets::switchers::CharacterSwitcher;
use crate::widgets::tabs::Tab;
use crate::widgets::{Button, CharacterSwitcher, Column, Container, Element, Row, Tabs, Text};
use crate::widgets::{Button, Column, Container, Element, Row, Tabs, Text};

// #[derive(Default)]
pub struct Body {
Expand Down
2 changes: 2 additions & 0 deletions src/views/sidebar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ use crate::utils::connection_status::ConnectionStatus;
use crate::widgets::lists::PlaybookItem;
use crate::widgets::*;

use crate::widgets::switchers::ContextSwitcher;

use super::compose::{self, Compose};

pub struct Sidebar {
Expand Down
7 changes: 1 addition & 6 deletions src/widgets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,9 @@

pub mod empty;
pub mod lists;
pub mod switchers;
pub mod tabs;

mod context_switcher;
pub use context_switcher::ContextSwitcher;

mod character_switcher;
pub use character_switcher::CharacterSwitcher;

use crate::styles::Theme;

pub type Element<'a, Message> = iced::Element<'a, Message, Theme>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

use crate::{
styles::{self, constants::ICON_FONT_SIZE_TOOLBAR, Theme},
widgets::Button,
widgets::{Button, Container, Element, Text},
};
use amp_common::resource::CharacterSpec;
use iced::{widget::Component, Length};
Expand All @@ -21,8 +21,6 @@ use iced_aw::{
};
use tracing::debug;

use super::{Container, Element, Text};

#[derive(Default)]
pub struct CharacterSwitcher<Message> {
current: CharacterSpec,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use std::collections::HashMap;

use crate::{
styles::{self, Theme},
widgets::Button,
widgets::{Button, Column, Container, Element, Row, Text},
};
use amp_common::config::Cluster;
use iced::{widget::Component, Alignment, Length};
Expand All @@ -25,8 +25,6 @@ use tracing::debug;

use crate::utils::connection_status::ConnectionStatus;

use super::{Column, Container, Element, Row, Text};

#[derive(Default)]
pub struct ContextSwitcher<Message> {
name: String,
Expand Down
16 changes: 16 additions & 0 deletions src/widgets/switchers/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

mod context_switcher;
pub use context_switcher::ContextSwitcher;

mod character_switcher;
pub use character_switcher::CharacterSwitcher;

0 comments on commit 2f9c529

Please sign in to comment.