Skip to content

feat: background Shape component#40

Open
toto04 wants to merge 1 commit intomainfrom
toto04/shapes
Open

feat: background Shape component#40
toto04 wants to merge 1 commit intomainfrom
toto04/shapes

Conversation

@toto04
Copy link
Contributor

@toto04 toto04 commented Mar 5, 2026

SVGs where taken from figma and optimized for distribution with svgo

I figured having a single component for all shapes would be easier for quick UI iterations, but we might consider other options for this

@coderabbitai
Copy link

coderabbitai bot commented Mar 5, 2026

Walkthrough

A new Shape component is created to render decorative SVG shapes with variant support. Four Shape component instances are injected into the root layout with Tailwind positioning classes to display these SVGs at specific locations.

Changes

Cohort / File(s) Summary
Shape Component
src/components/shapes.tsx
New component that renders one of four SVG shape variants (big-blue, big-teal, small-blue, looper) via Next.js Image. Exports ShapeVariant and ShapeProps types.
Layout Integration
src/app/layout.tsx
Imported Shape component and added four instances within ThemeProvider with absolute positioning classes for layout decoration.
🚥 Pre-merge checks | ✅ 1 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: background Shape component' clearly and concisely describes the main change: introducing a new Shape component for background decorations.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/app/layout.tsx`:
- Around line 64-67: The absolute-positioned Shape components are rendered
without a positioned ancestor, causing their negative z-index (e.g., -z-10) to
behave unpredictably; wrap the group of Shape elements in a positioned stacking
context (e.g., add a wrapper element with position set, such as
className="relative z-0" or equivalent) so Shape (from
src/components/shapes.tsx) has a positioned ancestor and its z-index and
placement behave consistently across viewports and the page root.

In `@src/components/shapes.tsx`:
- Around line 34-35: The image is marked aria-hidden but still uses a
descriptive alt={`${variant} shape`}; update the component's image element so
that when aria-hidden is present the alt prop is an empty string (alt="")
instead of using variant text—locate the image JSX in src/components/shapes.tsx
(the element with aria-hidden and alt props referencing `variant`) and change
the alt assignment accordingly so decorative shapes don't expose
redundant/incorrect alt text to assistive tech.
- Around line 2-5: Add a TypeScript module declaration for "*.svg" (e.g., create
src/types/svg.d.ts) that exports StaticImageData so imports like bigBlueSvg,
bigTealSvg, looperSvg, and smallBlueSvg are type-safe; then fix the decorative
image accessibility in the component where the Image element is absolutely
positioned and uses both aria-hidden and a descriptive alt: choose either to
keep a meaningful alt and remove aria-hidden, or set alt="" and keep aria-hidden
to mark it decorative (update the Image usage accordingly).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2f03b2bb-9dc7-42f0-b5ca-e2d3b4da5489

📥 Commits

Reviewing files that changed from the base of the PR and between 26f93aa and 0a1dbc5.

⛔ Files ignored due to path filters (4)
  • src/assets/shapes/big-blue.svg is excluded by !**/*.svg
  • src/assets/shapes/big-teal.svg is excluded by !**/*.svg
  • src/assets/shapes/looper.svg is excluded by !**/*.svg
  • src/assets/shapes/small-blue.svg is excluded by !**/*.svg
📒 Files selected for processing (2)
  • src/app/layout.tsx
  • src/components/shapes.tsx

Comment on lines +64 to +67
<Shape variant="big-teal" className="top-2 left-1/2 -translate-x-1/2" />
<Shape variant="small-blue" className="top-2 left-1/4 -translate-x-1/2 translate-y-1/2" />
<Shape variant="big-blue" className="top-0 left-1/2 -translate-x-1/2 -translate-y-1/2" />
<Shape variant="looper" className="top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2" />
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Add a positioned stacking context for the background layer.

On Lines 64-67, these shapes are absolute-positioned (from src/components/shapes.tsx, Line 36) but are mounted without a guaranteed positioned ancestor in layout.tsx. This makes placement/visibility depend on global stacking/viewport behavior and can make -z-10 assets disappear behind the page root.

💡 Proposed fix
         <ThemeProvider
           attribute="class"
           defaultTheme="light"
           enableSystem={false} // TODO: enable when dark mode design is ready
           // storageKey="polinetwork_darkmode_temp" // TODO: enable when dark mode design is ready
           disableTransitionOnChange
         >
-          <Shape variant="big-teal" className="top-2 left-1/2 -translate-x-1/2" />
-          <Shape variant="small-blue" className="top-2 left-1/4 -translate-x-1/2 translate-y-1/2" />
-          <Shape variant="big-blue" className="top-0 left-1/2 -translate-x-1/2 -translate-y-1/2" />
-          <Shape variant="looper" className="top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2" />
-          <div className="flex min-h-screen w-full flex-col items-center justify-start">
+          <div className="relative isolate min-h-screen w-full overflow-hidden">
+            <Shape variant="big-teal" className="top-2 left-1/2 -translate-x-1/2" />
+            <Shape variant="small-blue" className="top-2 left-1/4 -translate-x-1/2 translate-y-1/2" />
+            <Shape variant="big-blue" className="top-0 left-1/2 -translate-x-1/2 -translate-y-1/2" />
+            <Shape variant="looper" className="top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2" />
+            <div className="relative z-10 flex min-h-screen w-full flex-col items-center justify-start">
               <Header />
               {children}
+            </div>
           </div>
         </ThemeProvider>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/app/layout.tsx` around lines 64 - 67, The absolute-positioned Shape
components are rendered without a positioned ancestor, causing their negative
z-index (e.g., -z-10) to behave unpredictably; wrap the group of Shape elements
in a positioned stacking context (e.g., add a wrapper element with position set,
such as className="relative z-0" or equivalent) so Shape (from
src/components/shapes.tsx) has a positioned ancestor and its z-index and
placement behave consistently across viewports and the page root.

Comment on lines +2 to +5
import bigBlueSvg from "@/assets/shapes/big-blue.svg"
import bigTealSvg from "@/assets/shapes/big-teal.svg"
import looperSvg from "@/assets/shapes/looper.svg"
import smallBlueSvg from "@/assets/shapes/small-blue.svg"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "1) Verify expected SVG files exist:"
fd -a 'big-blue\.svg|big-teal\.svg|small-blue\.svg|looper\.svg' src/assets/shapes 2>&1 || echo "Pattern search completed (may have found nothing)"

echo ""
echo "2) Verify TypeScript has an SVG module declaration:"
rg -n --glob '**/*.d.ts' 'declare module ["'\'']\*\.svg["'\'']' 2>&1 || echo "No SVG declarations found"

echo ""
echo "3) Verify tsconfig includes declaration files:"
if [ -f tsconfig.json ]; then
  cat tsconfig.json
else
  echo "tsconfig.json not found"
fi

Repository: PoliNetworkOrg/web

Length of output: 1398


🏁 Script executed:

# Check file structure and content of shapes.tsx
wc -l src/components/shapes.tsx

Repository: PoliNetworkOrg/web

Length of output: 90


🏁 Script executed:

# Read the shapes.tsx file to see full context
cat -n src/components/shapes.tsx

Repository: PoliNetworkOrg/web

Length of output: 1308


SVG imports lack type declarations; also fix accessibility semantics.

SVG import type declarations are missing. Lines 2-5 import SVGs without corresponding TypeScript module declarations. With moduleResolution: "Bundler" and the Next.js plugin, these imports may work at runtime but could fail strict TypeScript checking. Add an SVG declaration file (e.g., src/types/svg.d.ts):

declare module "*.svg" {
  import type { StaticImageData } from "next/image"
  const content: StaticImageData
  export default content
}

Accessibility conflict at lines 34–35: The Image component uses both aria-hidden and a descriptive alt attribute. Since the shape is decorative (absolute positioning, -z-10), either remove aria-hidden and keep the alt text, or use alt="" with aria-hidden.

🧰 Tools
🪛 GitHub Actions: Test

[error] 2-2: Cannot find module '@/assets/shapes/big-blue.svg' or its corresponding type declarations. (tsc --noEmit)

🪛 GitHub Check: Typecheck and Lint

[failure] 5-5:
Cannot find module '@/assets/shapes/small-blue.svg' or its corresponding type declarations.


[failure] 4-4:
Cannot find module '@/assets/shapes/looper.svg' or its corresponding type declarations.


[failure] 3-3:
Cannot find module '@/assets/shapes/big-teal.svg' or its corresponding type declarations.


[failure] 2-2:
Cannot find module '@/assets/shapes/big-blue.svg' or its corresponding type declarations.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/shapes.tsx` around lines 2 - 5, Add a TypeScript module
declaration for "*.svg" (e.g., create src/types/svg.d.ts) that exports
StaticImageData so imports like bigBlueSvg, bigTealSvg, looperSvg, and
smallBlueSvg are type-safe; then fix the decorative image accessibility in the
component where the Image element is absolutely positioned and uses both
aria-hidden and a descriptive alt: choose either to keep a meaningful alt and
remove aria-hidden, or set alt="" and keep aria-hidden to mark it decorative
(update the Image usage accordingly).

Comment on lines +34 to +35
aria-hidden
alt={`${variant} shape`}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Use empty alt for decorative shapes.

On Line 34 the image is hidden from assistive tech (aria-hidden), so Line 35 should use alt="" instead of descriptive text.

💡 Proposed fix
-      alt={`${variant} shape`}
+      alt=""
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
aria-hidden
alt={`${variant} shape`}
aria-hidden
alt=""
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/shapes.tsx` around lines 34 - 35, The image is marked
aria-hidden but still uses a descriptive alt={`${variant} shape`}; update the
component's image element so that when aria-hidden is present the alt prop is an
empty string (alt="") instead of using variant text—locate the image JSX in
src/components/shapes.tsx (the element with aria-hidden and alt props
referencing `variant`) and change the alt assignment accordingly so decorative
shapes don't expose redundant/incorrect alt text to assistive tech.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant