chore: Fix typos. (#364)

This commit is contained in:
Jason Lee 2024-10-18 14:30:24 +08:00 committed by GitHub
parent 274b9edc32
commit a798bd81c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 38 additions and 52 deletions

View file

@ -28,7 +28,11 @@ jobs:
~/.cargo/git/db/ ~/.cargo/git/db/
target/ target/
key: ubuntu-test-cargo-${{ hashFiles('**/Cargo.lock') }} key: ubuntu-test-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install Tools
run: cargo install typos-cli
- name: Lint - name: Lint
run: cargo clippy -- --deny warnings run: |
cargo clippy -- --deny warnings
typos
- name: Build test - name: Build test
run: cargo build run: cargo build

View file

@ -1,4 +1,4 @@
# GPUI Compoment # GPUI Component
> This is still an early stage of development, we may change API frequently. > This is still an early stage of development, we may change API frequently.
> But the features is ok to use, you must keep tracking our changes. > But the features is ok to use, you must keep tracking our changes.

View file

@ -2,7 +2,7 @@
"border_radius": 2, "border_radius": 2,
"width": 400, "width": 400,
"height": 300, "height": 300,
"inner_radus": 30, "inner_radius": 30,
"legend_margin": { "legend_margin": {
"top": 0 "top": 0
}, },
@ -12,55 +12,39 @@
"series_list": [ "series_list": [
{ {
"name": "rose 1", "name": "rose 1",
"data": [ "data": [40]
40
]
}, },
{ {
"name": "rose 2", "name": "rose 2",
"data": [ "data": [38]
38
]
}, },
{ {
"name": "rose 3", "name": "rose 3",
"data": [ "data": [32]
32
]
}, },
{ {
"name": "rose 4", "name": "rose 4",
"data": [ "data": [30]
30
]
}, },
{ {
"name": "rose 5", "name": "rose 5",
"data": [ "data": [28]
28
]
}, },
{ {
"name": "rose 6", "name": "rose 6",
"data": [ "data": [26]
26
]
}, },
{ {
"name": "rose 7", "name": "rose 7",
"data": [ "data": [22]
22
]
}, },
{ {
"name": "rose 8", "name": "rose 8",
"data": [ "data": [18]
18
]
} }
], ],
"sub_title_text": "Sub Title", "sub_title_text": "Sub Title",
"theme": "light", "theme": "light",
"title_text": "Nightingale Chart", "title_text": "Nightingale Chart",
"type": "pie" "type": "pie"
} }

View file

@ -102,7 +102,7 @@ impl Render for SwitchStory {
card(cx) card(cx)
.child( .child(
title("Security emails").child( title("Security emails").child(
Label::new("Receive emails about your account security. When turn off, you never recive email again.").text_color(theme.muted_foreground) Label::new("Receive emails about your account security. When turn off, you never receive email again.").text_color(theme.muted_foreground)
) )
) )
.child( .child(
@ -116,7 +116,7 @@ impl Render for SwitchStory {
) )
.child( .child(
card(cx).v_flex() card(cx).v_flex()
.items_start().child(title("Disabled Switchs")).child( .items_start().child(title("Disabled Switches")).child(
h_flex().items_center() h_flex().items_center()
.gap_6() .gap_6()
.child(Switch::new("switch3").disabled(true).on_click(|v, _| { .child(Switch::new("switch3").disabled(true).on_click(|v, _| {
@ -133,7 +133,7 @@ impl Render for SwitchStory {
) )
.child( .child(
card(cx).v_flex() card(cx).v_flex()
.items_start().child(title("Small Switchs")).child( .items_start().child(title("Small Switches")).child(
h_flex().items_center() h_flex().items_center()
.gap_6() .gap_6()
.child(Switch::new("switch3").checked(self.switch3).label("Small Size").small().on_click(cx.listener(move |view, checked, cx| { .child(Switch::new("switch3").checked(self.switch3).label("Small Size").small().on_click(cx.listener(move |view, checked, cx| {

View file

@ -136,12 +136,12 @@ pub(crate) struct ShadcnColors {
pub(crate) struct ShadcnColor { pub(crate) struct ShadcnColor {
#[serde(default)] #[serde(default)]
pub(crate) scale: usize, pub(crate) scale: usize,
#[serde(deserialize_with = "from_hsa_channel", alias = "hslChannel")] #[serde(deserialize_with = "from_hsl_channel", alias = "hslChannel")]
pub(crate) hsla: Hsla, pub(crate) hsla: Hsla,
} }
/// Deserialize Hsla from a string in the format "210 40% 98%" /// Deserialize Hsla from a string in the format "210 40% 98%"
fn from_hsa_channel<'de, D>(deserializer: D) -> Result<Hsla, D::Error> fn from_hsl_channel<'de, D>(deserializer: D) -> Result<Hsla, D::Error>
where where
D: Deserializer<'de>, D: Deserializer<'de>,
{ {

View file

@ -50,7 +50,7 @@ impl Render for InvalidPanel {
.justify_center() .justify_center()
.text_color(cx.theme().muted_foreground) .text_color(cx.theme().muted_foreground)
.child(format!( .child(format!(
"The `{}` panel type is not registed in PanelRegistry.", "The `{}` panel type is not registered in PanelRegistry.",
self.name.clone() self.name.clone()
)) ))
} }

View file

@ -48,7 +48,7 @@ pub trait Panel: EventEmitter<PanelEvent> + FocusableView {
true true
} }
/// Return true if the panel is collapsable, default is `false`. /// Return true if the panel is collapsible, default is `false`.
fn collapsible(&self, _cx: &WindowContext) -> bool { fn collapsible(&self, _cx: &WindowContext) -> bool {
false false
} }

View file

@ -706,7 +706,7 @@ impl TabPanel {
} }
} }
// Here is looks like remove_panel on a same item, but it differnece. // Here is looks like remove_panel on a same item, but it difference.
// //
// We must to split it to remove_panel, unless it will be crash by error: // We must to split it to remove_panel, unless it will be crash by error:
// Cannot update ui::dock::tab_panel::TabPanel while it is already being updated // Cannot update ui::dock::tab_panel::TabPanel while it is already being updated

View file

@ -386,7 +386,7 @@ where
ListSizingBehavior::Auto ListSizingBehavior::Auto
}; };
let inital_view = if let Some(input) = &self.query_input { let initial_view = if let Some(input) = &self.query_input {
if input.read(cx).text().is_empty() { if input.read(cx).text().is_empty() {
self.delegate().render_initial(cx) self.delegate().render_initial(cx)
} else { } else {
@ -420,7 +420,7 @@ where
) )
}) })
.map(|this| { .map(|this| {
if let Some(view) = inital_view { if let Some(view) = initial_view {
this.child(view) this.child(view)
} else { } else {
this.child( this.child(

View file

@ -130,7 +130,7 @@ impl PopupMenu {
}) })
} }
/// Bind the focus handle of the menu, when clicked, it will focus back to this handle and then dispath the action /// Bind the focus handle of the menu, when clicked, it will focus back to this handle and then dispatch the action
pub fn track_focus(mut self, focus_handle: &FocusHandle) -> Self { pub fn track_focus(mut self, focus_handle: &FocusHandle) -> Self {
self.action_focus_handle = Some(focus_handle.clone()); self.action_focus_handle = Some(focus_handle.clone());
self self

View file

@ -278,7 +278,7 @@ pub struct ResizablePanel {
group: Option<View<ResizablePanelGroup>>, group: Option<View<ResizablePanelGroup>>,
/// Initial size is the size that the panel has when it is created. /// Initial size is the size that the panel has when it is created.
initial_size: Option<Pixels>, initial_size: Option<Pixels>,
/// size is the size that the panel has when it is resized or ajusted by flex layout. /// size is the size that the panel has when it is resized or adjusted by flex layout.
size: Option<Pixels>, size: Option<Pixels>,
/// the size ratio that the panel has relative to its group /// the size ratio that the panel has relative to its group
size_ratio: Option<f32>, size_ratio: Option<f32>,
@ -352,7 +352,7 @@ impl Render for ResizablePanel {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement { fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
let view = cx.view().clone(); let view = cx.view().clone();
let total_size = self.group.as_ref().map(|group| group.read(cx).total_size()); let total_size = self.group.as_ref().map(|group| group.read(cx).total_size());
div() div()
.flex() .flex()
.flex_grow() .flex_grow()
@ -367,16 +367,14 @@ impl Render for ResizablePanel {
this.when(self.size.is_none(), |this| this.flex_shrink_0()) this.when(self.size.is_none(), |this| this.flex_shrink_0())
.flex_basis(size) .flex_basis(size)
}) })
.map( .map(|this| match (self.size_ratio, self.size, total_size) {
|this| match (self.size_ratio, self.size, total_size) { (Some(size_ratio), _, _) => this.flex_basis(relative(size_ratio)),
(Some(size_ratio), _, _) => this.flex_basis(relative(size_ratio)), (None, Some(size), Some(total_size)) => {
(None, Some(size), Some(total_size)) => { this.flex_basis(relative(size / total_size))
this.flex_basis(relative(size / total_size)) }
} (None, Some(size), None) => this.flex_basis(size),
(None, Some(size), None) => this.flex_basis(size), _ => this,
_ => this, })
},
)
.child({ .child({
canvas( canvas(
move |bounds, cx| view.update(cx, |r, cx| r.update_size(bounds, cx)), move |bounds, cx| view.update(cx, |r, cx| r.update_size(bounds, cx)),

View file

@ -202,7 +202,7 @@ impl<'a, V> ContextModal for ViewContext<'a, V> {
/// ///
/// It is used to manage the Drawer, Modal, and Notification. /// It is used to manage the Drawer, Modal, and Notification.
pub struct Root { pub struct Root {
/// Used to store the focus handle of the previus revious view. /// Used to store the focus handle of the previous view.
/// When the Modal, Drawer closes, we will focus back to the previous view. /// When the Modal, Drawer closes, we will focus back to the previous view.
previous_focus_handle: Option<FocusHandle>, previous_focus_handle: Option<FocusHandle>,
active_drawer: Option<ActiveDrawer>, active_drawer: Option<ActiveDrawer>,