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/
target/
key: ubuntu-test-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install Tools
run: cargo install typos-cli
- name: Lint
run: cargo clippy -- --deny warnings
run: |
cargo clippy -- --deny warnings
typos
- name: Build test
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.
> But the features is ok to use, you must keep tracking our changes.

View file

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

View file

@ -102,7 +102,7 @@ impl Render for SwitchStory {
card(cx)
.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(
@ -116,7 +116,7 @@ impl Render for SwitchStory {
)
.child(
card(cx).v_flex()
.items_start().child(title("Disabled Switchs")).child(
.items_start().child(title("Disabled Switches")).child(
h_flex().items_center()
.gap_6()
.child(Switch::new("switch3").disabled(true).on_click(|v, _| {
@ -133,7 +133,7 @@ impl Render for SwitchStory {
)
.child(
card(cx).v_flex()
.items_start().child(title("Small Switchs")).child(
.items_start().child(title("Small Switches")).child(
h_flex().items_center()
.gap_6()
.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 {
#[serde(default)]
pub(crate) scale: usize,
#[serde(deserialize_with = "from_hsa_channel", alias = "hslChannel")]
#[serde(deserialize_with = "from_hsl_channel", alias = "hslChannel")]
pub(crate) hsla: Hsla,
}
/// 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
D: Deserializer<'de>,
{

View file

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

View file

@ -48,7 +48,7 @@ pub trait Panel: EventEmitter<PanelEvent> + FocusableView {
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 {
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:
// Cannot update ui::dock::tab_panel::TabPanel while it is already being updated

View file

@ -386,7 +386,7 @@ where
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() {
self.delegate().render_initial(cx)
} else {
@ -420,7 +420,7 @@ where
)
})
.map(|this| {
if let Some(view) = inital_view {
if let Some(view) = initial_view {
this.child(view)
} else {
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 {
self.action_focus_handle = Some(focus_handle.clone());
self

View file

@ -278,7 +278,7 @@ pub struct ResizablePanel {
group: Option<View<ResizablePanelGroup>>,
/// Initial size is the size that the panel has when it is created.
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>,
/// the size ratio that the panel has relative to its group
size_ratio: Option<f32>,
@ -352,7 +352,7 @@ impl Render for ResizablePanel {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
let view = cx.view().clone();
let total_size = self.group.as_ref().map(|group| group.read(cx).total_size());
div()
.flex()
.flex_grow()
@ -367,16 +367,14 @@ impl Render for ResizablePanel {
this.when(self.size.is_none(), |this| this.flex_shrink_0())
.flex_basis(size)
})
.map(
|this| match (self.size_ratio, self.size, total_size) {
(Some(size_ratio), _, _) => this.flex_basis(relative(size_ratio)),
(None, Some(size), Some(total_size)) => {
this.flex_basis(relative(size / total_size))
}
(None, Some(size), None) => this.flex_basis(size),
_ => this,
},
)
.map(|this| match (self.size_ratio, self.size, total_size) {
(Some(size_ratio), _, _) => this.flex_basis(relative(size_ratio)),
(None, Some(size), Some(total_size)) => {
this.flex_basis(relative(size / total_size))
}
(None, Some(size), None) => this.flex_basis(size),
_ => this,
})
.child({
canvas(
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.
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.
previous_focus_handle: Option<FocusHandle>,
active_drawer: Option<ActiveDrawer>,