Address review: ring structural test, doc fixes, kit icon_assets! macro (#141)
Hovering the icon leaves the cached ring unrendered (asserted in the grid test). performance.md opens « Statistiques » by the chart icon, and interface.md no longer claims the icon leaves the text untouched in a narrow window. The chart icon comes from gpui_kit::assets::icon_assets!, so the vendored SVG and Lucide license are removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
771f6f3d31
commit
be2eee469e
6 files changed
+15
-42
No files matched your search
@@ -1,15 +0,0 @@
|
||||
ISC License
|
||||
|
||||
Copyright (c) 2026 Lucide Icons and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
@@ -1,14 +0,0 @@
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M3 3v16a2 2 0 0 0 2 2h16" />
|
||||
<path d="m19 9-5 5-4-4-3 3" />
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 281 B |
@@ -1,30 +1,27 @@
|
||||
//! The app's asset source: the kit's default bundle, plus the one Lucide icon it does not
|
||||
//! embed (`chart-line`, ISC, see `assets/Lucide-LICENSE.txt`). `AllAssets` would embed the whole
|
||||
//! catalog for this one icon.
|
||||
//! embed (`chart-line`). `AllAssets` would embed the whole catalog for this one icon.
|
||||
|
||||
use std::borrow::Cow;
|
||||
|
||||
use gpui_kit::{AssetSource, Result, SharedString};
|
||||
|
||||
const CHART_LINE: &str = "icons/chart-line.svg";
|
||||
gpui_kit::assets::icon_assets!(ExtraIcons, [ChartLine]);
|
||||
|
||||
pub struct Assets;
|
||||
|
||||
impl AssetSource for Assets {
|
||||
fn load(&self, path: &str) -> Result<Option<Cow<'static, [u8]>>> {
|
||||
if path == CHART_LINE {
|
||||
return Ok(Some(Cow::Borrowed(include_bytes!(
|
||||
"../assets/chart-line.svg"
|
||||
))));
|
||||
if let Some(bytes) = ExtraIcons.load(path)? {
|
||||
return Ok(Some(bytes));
|
||||
}
|
||||
gpui_kit::assets::Assets.load(path)
|
||||
}
|
||||
|
||||
fn list(&self, path: &str) -> Result<Vec<SharedString>> {
|
||||
let mut paths = gpui_kit::assets::Assets.list(path)?;
|
||||
if CHART_LINE.starts_with(path) {
|
||||
paths.push(CHART_LINE.into());
|
||||
}
|
||||
paths.extend(ExtraIcons.list(path)?);
|
||||
paths.sort();
|
||||
paths.dedup();
|
||||
Ok(paths)
|
||||
}
|
||||
}
|
||||
@@ -33,6 +30,8 @@ impl AssetSource for Assets {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
const CHART_LINE: &str = "icons/chart-line.svg";
|
||||
|
||||
#[test]
|
||||
fn serves_chart_line_and_delegates_the_rest() {
|
||||
assert!(matches!(Assets.load(CHART_LINE), Ok(Some(_))));
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
use super::banner_fixtures::ring_renders;
|
||||
use super::page_fixtures::{
|
||||
center, champions, count_hovers, draw, grid_names, open_page_in_season, settle, show,
|
||||
statistics, switch_tab,
|
||||
@@ -193,8 +194,9 @@ fn hovering_outside_the_grid_does_not_render_the_cards(cx: &mut TestAppContext)
|
||||
let grid = page.read_with(cx, |page, _| page.home_grid.clone());
|
||||
let renders = grid.read_with(cx, |grid, _| grid.renders);
|
||||
assert!(renders > 0);
|
||||
let ring = ring_renders(&page, cx);
|
||||
|
||||
// A navigation button's hover style redraws the window.
|
||||
// A navigation button's hover style redraws the window (the icon from where no tick is lit).
|
||||
for _ in 0..2 {
|
||||
let button = center(cx, "statistics-link");
|
||||
cx.simulate_mouse_move(button, None, Modifiers::none());
|
||||
@@ -203,6 +205,7 @@ fn hovering_outside_the_grid_does_not_render_the_cards(cx: &mut TestAppContext)
|
||||
draw(cx);
|
||||
}
|
||||
assert_eq!(grid.read_with(cx, |grid, _| grid.renders), renders);
|
||||
assert_eq!(ring_renders(&page, cx), ring);
|
||||
|
||||
// The count does move when the grid changes.
|
||||
grid.update(cx, |_, cx| cx.notify());
|
||||
|
||||
Reference in new issue
Block a user