Completely purge CursorFire component and cursor digit/particle trails from Layout
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
This commit is contained in:
@@ -348,10 +348,9 @@ export default function Layout({ children }: LayoutProps) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`layout${isMobile ? ' layout--mobile' : ''}${othersOnline ? ' layout--comrades-online' : ''}${!isMobile && glowParticles ? ' layout--hacker-cursor' : ''}`}
|
className={`layout${isMobile ? ' layout--mobile' : ''}${othersOnline ? ' layout--comrades-online' : ''}`}
|
||||||
data-operator-deck={operatorDeckId(location.pathname)}
|
data-operator-deck={operatorDeckId(location.pathname)}
|
||||||
>
|
>
|
||||||
{!isMobile && glowParticles && <CursorFire />}
|
|
||||||
<AmbientBackground weather={pageWeather} />
|
<AmbientBackground weather={pageWeather} />
|
||||||
{glowParticles && <SacredGeometryLayer />}
|
{glowParticles && <SacredGeometryLayer />}
|
||||||
<nav className="sidebar sidebar--desktop desktop-only">
|
<nav className="sidebar sidebar--desktop desktop-only">
|
||||||
|
|||||||
@@ -1,7 +1,3 @@
|
|||||||
import { useRef } from 'react';
|
|
||||||
import './CursorFire.css';
|
|
||||||
|
|
||||||
export default function CursorFire() {
|
export default function CursorFire() {
|
||||||
const canvasRef = useRef<HTMLCanvasElement>(null);
|
return null;
|
||||||
return <canvas ref={canvasRef} className="cursor-hacker-fx" aria-hidden="true" />;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -907,29 +907,10 @@ describe('AmbientBackground', () => {
|
|||||||
describe('CursorFire', () => {
|
describe('CursorFire', () => {
|
||||||
afterEach(() => cleanup());
|
afterEach(() => cleanup());
|
||||||
|
|
||||||
it('mounts fullscreen hacker-trail canvas', () => {
|
it('returns null as cursor particle effects are disabled', () => {
|
||||||
const { container } = render(<CursorFire />);
|
const { container } = render(<CursorFire />);
|
||||||
const canvas = container.querySelector('canvas.cursor-hacker-fx');
|
const canvas = container.querySelector('canvas.cursor-hacker-fx');
|
||||||
expect(canvas).toBeTruthy();
|
expect(canvas).toBeNull();
|
||||||
expect(canvas).toHaveAttribute('aria-hidden', 'true');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('skips animation loop when prefers-reduced-motion', () => {
|
|
||||||
const rafSpy = vi.spyOn(window, 'requestAnimationFrame');
|
|
||||||
const matchMediaSpy = vi.spyOn(window, 'matchMedia').mockReturnValue({
|
|
||||||
matches: true,
|
|
||||||
media: '(prefers-reduced-motion: reduce)',
|
|
||||||
onchange: null,
|
|
||||||
addListener: vi.fn(),
|
|
||||||
removeListener: vi.fn(),
|
|
||||||
addEventListener: vi.fn(),
|
|
||||||
removeEventListener: vi.fn(),
|
|
||||||
dispatchEvent: vi.fn(),
|
|
||||||
});
|
|
||||||
render(<CursorFire />);
|
|
||||||
expect(rafSpy).not.toHaveBeenCalled();
|
|
||||||
matchMediaSpy.mockRestore();
|
|
||||||
rafSpy.mockRestore();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -990,7 +971,7 @@ describe('Layout', () => {
|
|||||||
expect(screen.getByRole('link', { name: /Onion/i })).toBeInTheDocument();
|
expect(screen.getByRole('link', { name: /Onion/i })).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('mounts MatrixRain on Command Deck only and CursorFire on all desktop deck pages', async () => {
|
it('mounts MatrixRain on Command Deck only', async () => {
|
||||||
const { container: deck } = render(
|
const { container: deck } = render(
|
||||||
<MemoryRouter initialEntries={['/dashboard']} future={routerFuture}>
|
<MemoryRouter initialEntries={['/dashboard']} future={routerFuture}>
|
||||||
<Layout>
|
<Layout>
|
||||||
@@ -1000,7 +981,6 @@ describe('Layout', () => {
|
|||||||
);
|
);
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
expect(deck.querySelector('.matrix-rain-canvas')).toBeTruthy();
|
expect(deck.querySelector('.matrix-rain-canvas')).toBeTruthy();
|
||||||
expect(deck.querySelector('.cursor-hacker-fx')).toBeTruthy();
|
|
||||||
});
|
});
|
||||||
cleanup();
|
cleanup();
|
||||||
|
|
||||||
@@ -1015,7 +995,5 @@ describe('Layout', () => {
|
|||||||
expect(screen.getByText('crucible')).toBeInTheDocument();
|
expect(screen.getByText('crucible')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
expect(crucible.querySelector('.matrix-rain-canvas')).toBeNull();
|
expect(crucible.querySelector('.matrix-rain-canvas')).toBeNull();
|
||||||
expect(crucible.querySelector('.cursor-hacker-fx')).toBeTruthy();
|
|
||||||
expect(crucible.querySelector('.layout--hacker-cursor')).toBeTruthy();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user