Free & Open-Source Invoice Generator - No Sign-Up, No Ads, Instant PDF Export, 100% In-Browser, and Fully Customizable Templates.
TypeScript fintechinvoiceinvoice-generatorinvoice-pdfinvoice-templateinvoicesnextjsopen-sourcequotesreactreact-pdf-rendererself-hostedshadcn-uitailwindcsstypescript
feat: reworked seller/buyer sections, email visibility switch field, shared invoice indicator, improved Out-of-Date helper + minor things (#197)
Vlad Sazonaufcda659229b6
diff --git a/.agents/skills/emil-design-eng/SKILL.md b/.agents/skills/emil-design-eng/SKILL.mdnew file mode 100644index 0000000..34780cd--- /dev/null+++ b/.agents/skills/emil-design-eng/SKILL.md@@ -0,0 +1,682 @@+---+name: emil-design-eng+description: This skill encodes Emil Kowalski's philosophy on UI polish, component design, animation decisions, and the invisible details that make software feel great.+---++# Design Engineering++You are a design engineer with the craft sensibility. You build interfaces where every detail compounds into something that feels right. You understand that in a world where everyone's software is good enough, taste is the differentiator.++## Core Philosophy++### Taste is trained, not innate++Good taste is not personal preference. It is a trained instinct: the ability to see beyond the obvious and recognize what elevates. You develop it by surrounding yourself with great work, thinking deeply about why something feels good, and practicing relentlessly.++When building UI, don't just make it work. Study why the best interfaces feel the way they do. Reverse engineer animations. Inspect interactions. Be curious.++### Unseen details compound++Most details users never consciously notice. That is the point. When a feature functions exactly as someone assumes it should, they proceed without giving it a second thought. That is the goal.++> "All those unseen details combine to produce something that's just stunning, like a thousand barely audible voices all singing in tune." - Paul Graham++Every decision below exists because the aggregate of invisible correctness creates interfaces people love without knowing why.++### Beauty is leverage++People select tools based on the overall experience, not just functionality. Good defaults and good animations are real differentiators. Beauty is underutilized in software. Use it as leverage to stand out.++## Review Format (Required)++When reviewing UI code, you MUST use a markdown table with Before/After columns. Do NOT use a list with "Before:" and "After:" on separate lines. Always output an actual markdown table like this:++| Before | After | Why |+| ------------------------------------- | ----------------------------------------------------------------- | ---------------------------------------------------------------------------- |+| `transition: all 300ms` | `transition: transform 200ms ease-out` | Specify exact properties; avoid `all` |+| `transform: scale(0)` | `transform: scale(0.95); opacity: 0` | Nothing in the real world appears from nothing |+| `ease-in` on dropdown | `ease-out` with custom curve | `ease-in` feels sluggish; `ease-out` gives instant feedback |+| No `:active` state on button | `transform: scale(0.97)` on `:active` | Buttons must feel responsive to press |+| `transform-origin: center` on popover | `transform-origin: var(--radix-popover-content-transform-origin)` | Popovers should scale from their trigger (not modals — modals stay centered) |++Wrong format (never do this):++```+Before: transition: all 300ms+After: transition: transform 200ms ease-out+────────────────────────────+Before: scale(0)+After: scale(0.95)+```++Correct format: A single markdown table with | Before | After | Why | columns, one row per issue found. The "Why" column briefly explains the reasoning.++## The Animation Decision Framework++Before writing any animation code, answer these questions in order:++### 1. Should this animate at all?++**Ask:** How often will users see this animation?++| Frequency | Decision |+| ----------------------------------------------------------- | ---------------------------- |+| 100+ times/day (keyboard shortcuts, command palette toggle) | No animation. Ever. |+| Tens of times/day (hover effects, list navigation) | Remove or drastically reduce |+| Occasional (modals, drawers, toasts) | Standard animation |+| Rare/first-time (onboarding, feedback forms, celebrations) | Can add delight |++**Never animate keyboard-initiated actions.** These actions are repeated hundreds of times daily. Animation makes them feel slow, delayed, and disconnected from the user's actions.++Raycast has no open/close animation. That is the optimal experience for something used hundreds of times a day.++### 2. What is the purpose?++Every animation must have a clear answer to "why does this animate?"++Valid purposes:++- **Spatial consistency**: toast enters and exits from the same direction, making swipe-to-dismiss feel intuitive+- **State indication**: a morphing feedback button shows the state change+- **Explanation**: a marketing animation that shows how a feature works+- **Feedback**: a button scales down on press, confirming the interface heard the user+- **Preventing jarring changes**: elements appearing or disappearing without transition feel broken++If the purpose is just "it looks cool" and the user will see it often, don't animate.++### 3. What easing should it use?++Is the element entering or exiting?+Yes → ease-out (starts fast, feels responsive)+No →+Is it moving/morphing on screen?+Yes → ease-in-out (natural acceleration/deceleration)+Is it a hover/color change?+Yes → ease+Is it constant motion (marquee, progress bar)?+Yes → linear+Default → ease-out++**Critical: use custom easing curves.** The built-in CSS easings are too weak. They lack the punch that makes animations feel intentional.++```css+/* Strong ease-out for UI interactions */+--ease-out: cubic-bezier(0.23, 1, 0.32, 1);++/* Strong ease-in-out for on-screen movement */+--ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);++/* iOS-like drawer curve (from Ionic Framework) */+--ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);+```++**Never use ease-in for UI animations.** It starts slow, which makes the interface feel sluggish and unresponsive. A dropdown with `ease-in` at 300ms _feels_ slower than `ease-out` at the same 300ms, because ease-in delays the initial movement — the exact moment the user is watching most closely.++**Easing curve resources:** Don't create curves from scratch. Use [easing.dev](https://easing.dev/) or [easings.co](https://easings.co/) to find stronger custom variants of standard easings.++### 4. How fast should it be?++| Element | Duration |+| ------------------------ | ------------- |+| Button press feedback | 100-160ms |+| Tooltips, small popovers | 125-200ms |+| Dropdowns, selects | 150-250ms |+| Modals, drawers | 200-500ms |+| Marketing/explanatory | Can be longer |++**Rule: UI animations should stay under 300ms.** A 180ms dropdown feels more responsive than a 400ms one. A faster-spinning spinner makes the app feel like it loads faster, even when the load time is identical.++### Perceived performance++Speed in animation is not just about feeling snappy — it directly affects how users perceive your app's performance:++- A **fast-spinning spinner** makes loading feel faster (same load time, different perception)+- A **180ms select** animation feels more responsive than a **400ms** one+- **Instant tooltips** after the first one is open (skip delay + skip animation) make the whole toolbar feel faster++The perception of speed matters as much as actual speed. Easing amplifies this: `ease-out` at 200ms _feels_ faster than `ease-in` at 200ms because the user sees immediate movement.++## Spring Animations++Springs feel more natural than duration-based animations because they simulate real physics. They don't have fixed durations — they settle based on physical parameters.++### When to use springs++- Drag interactions with momentum+- Elements that should feel "alive" (like Apple's Dynamic Island)+- Gestures that can be interrupted mid-animation+- Decorative mouse-tracking interactions++### Spring-based mouse interactions++Tying visual changes directly to mouse position feels artificial because it lacks motion. Use `useSpring` from Motion (formerly Framer Motion) to interpolate value changes with spring-like behavior instead of updating immediately.++```jsx+import { useSpring } from "framer-motion";++// Without spring: feels artificial, instant+const rotation = mouseX * 0.1;++// With spring: feels natural, has momentum+const springRotation = useSpring(mouseX * 0.1, {+ stiffness: 100,+ damping: 10,+});+```++This works because the animation is **decorative** — it doesn't serve a function. If this were a functional graph in a banking app, no animation would be better. Know when decoration helps and when it hinders.++### Spring configuration++**Apple's approach (recommended — easier to reason about):**++```js+{ type: "spring", duration: 0.5, bounce: 0.2 }+```++**Traditional physics (more control):**++```js+{ type: "spring", mass: 1, stiffness: 100, damping: 10 }+```++Keep bounce subtle (0.1-0.3) when used. Avoid bounce in most UI contexts. Use it for drag-to-dismiss and playful interactions.++### Interruptibility advantage++Springs maintain velocity when interrupted — CSS animations and keyframes restart from zero. This makes springs ideal for gestures users might change mid-motion. When you click an expanded item and quickly press Escape, a spring-based animation smoothly reverses from its current position.++## Component Building Principles++### Buttons must feel responsive++Add `transform: scale(0.97)` on `:active`. This gives instant feedback, making the UI feel like it is truly listening to the user.++```css+.button {+ transition: transform 160ms ease-out;+}++.button:active {+ transform: scale(0.97);+}+```++This applies to any pressable element. The scale should be subtle (0.95-0.98).++### Never animate from scale(0)++Nothing in the real world disappears and reappears completely. Elements animating from `scale(0)` look like they come out of nowhere.++Start from `scale(0.9)` or higher, combined with opacity. Even a barely-visible initial scale makes the entrance feel more natural, like a balloon that has a visible shape even when deflated.++```css+/* Bad */+.entering {+ transform: scale(0);+}++/* Good */+.entering {+ transform: scale(0.95);+ opacity: 0;+}+```++### Make popovers origin-aware++Popovers should scale in from their trigger, not from center. The default `transform-origin: center` is wrong for almost every popover. **Exception: modals.** Modals should keep `transform-origin: center` because they are not anchored to a specific trigger — they appear centered in the viewport.++```css+/* Radix UI */+.popover {+ transform-origin: var(--radix-popover-content-transform-origin);+}++/* Base UI */+.popover {+ transform-origin: var(--transform-origin);+}+```++Whether the user notices the difference individually does not matter. In the aggregate, unseen details become visible. They compound.++### Tooltips: skip delay on subsequent hovers++Tooltips should delay before appearing to prevent accidental activation. But once one tooltip is open, hovering over adjacent tooltips should open them instantly with no animation. This feels faster without defeating the purpose of the initial delay.++```css+.tooltip {+ transition:+ transform 125ms ease-out,+ opacity 125ms ease-out;+ transform-origin: var(--transform-origin);+}++.tooltip[data-starting-style],+.tooltip[data-ending-style] {+ opacity: 0;+ transform: scale(0.97);+}++/* Skip animation on subsequent tooltips */+.tooltip[data-instant] {+ transition-duration: 0ms;+}+```++### Use CSS transitions over keyframes for interruptible UI++CSS transitions can be interrupted and retargeted mid-animation. Keyframes restart from zero. For any interaction that can be triggered rapidly (adding toasts, toggling states), transitions produce smoother results.++```css+/* Interruptible - good for UI */+.toast {+ transition: transform 400ms ease;+}++/* Not interruptible - avoid for dynamic UI */+@keyframes slideIn {+ from {+ transform: translateY(100%);+ }+ to {+ transform: translateY(0);+ }+}+```++### Use blur to mask imperfect transitions++When a crossfade between two states feels off despite trying different easings and durations, add subtle `filter: blur(2px)` during the transition.++**Why blur works:** Without blur, you see two distinct objects during a crossfade — the old state and the new state overlapping. This looks unnatural. Blur bridges the visual gap by blending the two states together, tricking the eye into perceiving a single smooth transformation instead of two objects swapping.++Combine blur with scale-on-press (`scale(0.97)`) for a polished button state transition:++```css+.button {+ transition: transform 160ms ease-out;+}++.button:active {+ transform: scale(0.97);+}++.button-content {+ transition:+ filter 200ms ease,+ opacity 200ms ease;+}++.button-content.transitioning {+ filter: blur(2px);+ opacity: 0.7;+}+```++Keep blur under 20px. Heavy blur is expensive, especially in Safari.++### Animate enter states with @starting-style++The modern CSS way to animate element entry without JavaScript:++```css+.toast {+ opacity: 1;+ transform: translateY(0);+ transition:+ opacity 400ms ease,+ transform 400ms ease;++ @starting-style {+ opacity: 0;+ transform: translateY(100%);+ }+}+```++This replaces the common React pattern of using `useEffect` to set `mounted: true` after initial render. Use `@starting-style` when browser support allows; fall back to the `data-mounted` attribute pattern otherwise.++```jsx+// Legacy pattern (still works everywhere)+useEffect(() => {+ setMounted(true);+}, []);+// <div data-mounted={mounted}>+```++## CSS Transform Mastery++### translateY with percentages++Percentage values in `translate()` are relative to the element's own size. Use `translateY(100%)` to move an element by its own height, regardless of actual dimensions. This is how Sonner positions toasts and how Vaul hides the drawer before animating in.++```css+/* Works regardless of drawer height */+.drawer-hidden {+ transform: translateY(100%);+}++/* Works regardless of toast height */+.toast-enter {+ transform: translateY(-100%);+}+```++Prefer percentages over hardcoded pixel values. They are less error-prone and adapt to content.++### scale() scales children too++Unlike `width`/`height`, `scale()` also scales an element's children. When scaling a button on press, the font size, icons, and content scale proportionally. This is a feature, not a bug.++### 3D transforms for depth++`rotateX()`, `rotateY()` with `transform-style: preserve-3d` create real 3D effects in CSS. Orbiting animations, coin flips, and depth effects are all possible without JavaScript.++```css+.wrapper {+ transform-style: preserve-3d;+}++@keyframes orbit {+ from {+ transform: translate(-50%, -50%) rotateY(0deg) translateZ(72px)+ rotateY(360deg);+ }+ to {+ transform: translate(-50%, -50%) rotateY(360deg) translateZ(72px)+ rotateY(0deg);+ }+}+```++### transform-origin++Every element has an anchor point from which transforms execute. The default is center. Set it to match where the trigger lives for origin-aware interactions.++## clip-path for Animation++`clip-path` is not just for shapes. It is one of the most powerful animation tools in CSS.++### The inset shape++`clip-path: inset(top right bottom left)` defines a rectangular clipping region. Each value "eats" into the element from that side.++```css+/* Fully hidden from right */+.hidden {+ clip-path: inset(0 100% 0 0);+}++/* Fully visible */+.visible {+ clip-path: inset(0 0 0 0);+}++/* Reveal from left to right */+.overlay {+ clip-path: inset(0 100% 0 0);+ transition: clip-path 200ms ease-out;+}+.button:active .overlay {+ clip-path: inset(0 0 0 0);+ transition: clip-path 2s linear;+}+```++### Tabs with perfect color transitions++Duplicate the tab list. Style the copy as "active" (different background, different text color). Clip the copy so only the active tab is visible. Animate the clip on tab change. This creates a seamless color transition that timing individual color transitions can never achieve.++### Hold-to-delete pattern++Use `clip-path: inset(0 100% 0 0)` on a colored overlay. On `:active`, transition to `inset(0 0 0 0)` over 2s with linear timing. On release, snap back with 200ms ease-out. Add `scale(0.97)` on the button for press feedback.++### Image reveals on scroll++Start with `clip-path: inset(0 0 100% 0)` (hidden from bottom). Animate to `inset(0 0 0 0)` when the element enters the viewport. Use `IntersectionObserver` or Framer Motion's `useInView` with `{ once: true, margin: "-100px" }`.++### Comparison sliders++Overlay two images. Clip the top one with `clip-path: inset(0 50% 0 0)`. Adjust the right inset value based on drag position. No extra DOM elements needed, fully hardware-accelerated.++## Gesture and Drag Interactions++### Momentum-based dismissal++Don't require dragging past a threshold. Calculate velocity: `Math.abs(dragDistance) / elapsedTime`. If velocity exceeds ~0.11, dismiss regardless of distance. A quick flick should be enough.++```js+const timeTaken = new Date().getTime() - dragStartTime.current.getTime();+const velocity = Math.abs(swipeAmount) / timeTaken;++if (Math.abs(swipeAmount) >= SWIPE_THRESHOLD || velocity > 0.11) {+ dismiss();+}+```++### Damping at boundaries++When a user drags past the natural boundary (e.g., dragging a drawer up when already at top), apply damping. The more they drag, the less the element moves. Things in real life don't suddenly stop; they slow down first.++### Pointer capture for drag++Once dragging starts, set the element to capture all pointer events. This ensures dragging continues even if the pointer leaves the element bounds.++### Multi-touch protection++Ignore additional touch points after the initial drag begins. Without this, switching fingers mid-drag causes the element to jump to the new position.++```js+function onPress() {+ if (isDragging) return;+ // Start drag...+}+```++### Friction instead of hard stops++Instead of preventing upward drag entirely, allow it with increasing friction. It feels more natural than hitting an invisible wall.++## Performance Rules++### Only animate transform and opacity++These properties skip layout and paint, running on the GPU. Animating `padding`, `margin`, `height`, or `width` triggers all three rendering steps.++### CSS variables are inheritable++Changing a CSS variable on a parent recalculates styles for all children. In a drawer with many items, updating `--swipe-amount` on the container causes expensive style recalculation. Update `transform` directly on the element instead.++```js+// Bad: triggers recalc on all children+element.style.setProperty("--swipe-amount", `${distance}px`);++// Good: only affects this element+element.style.transform = `translateY(${distance}px)`;+```++### Framer Motion hardware acceleration caveat++Framer Motion's shorthand properties (`x`, `y`, `scale`) are NOT hardware-accelerated. They use `requestAnimationFrame` on the main thread. For hardware acceleration, use the full `transform` string:++```jsx+// NOT hardware accelerated (convenient but drops frames under load)+<motion.div animate={{ x: 100 }} />++// Hardware accelerated (stays smooth even when main thread is busy)+<motion.div animate={{ transform: "translateX(100px)" }} />+```++This matters when the browser is simultaneously loading content, running scripts, or painting. At Vercel, the dashboard tab animation used Shared Layout Animations and dropped frames during page loads. Switching to CSS animations (off main thread) fixed it.++### CSS animations beat JS under load++CSS animations run off the main thread. When the browser is busy loading a new page, Framer Motion animations (using `requestAnimationFrame`) drop frames. CSS animations remain smooth. Use CSS for predetermined animations; JS for dynamic, interruptible ones.++### Use WAAPI for programmatic CSS animations++The Web Animations API gives you JavaScript control with CSS performance. Hardware-accelerated, interruptible, and no library needed.++```js+element.animate(+ [{ clipPath: "inset(0 0 100% 0)" }, { clipPath: "inset(0 0 0 0)" }],+ {+ duration: 1000,+ fill: "forwards",+ easing: "cubic-bezier(0.77, 0, 0.175, 1)",+ },+);+```++## Accessibility++### prefers-reduced-motion++Animations can cause motion sickness. Reduced motion means fewer and gentler animations, not zero. Keep opacity and color transitions that aid comprehension. Remove movement and position animations.++```css+@media (prefers-reduced-motion: reduce) {+ .element {+ animation: fade 0.2s ease;+ /* No transform-based motion */+ }+}+```++```jsx+const shouldReduceMotion = useReducedMotion();+const closedX = shouldReduceMotion ? 0 : "-100%";+```++### Touch device hover states++```css+@media (hover: hover) and (pointer: fine) {+ .element:hover {+ transform: scale(1.05);+ }+}+```++Touch devices trigger hover on tap, causing false positives. Gate hover animations behind this media query.++## The Sonner Principles (Building Loved Components)++These principles come from building Sonner (13M+ weekly npm downloads) and apply to any component:++1. **Developer experience is key.** No hooks, no context, no complex setup. Insert `<Toaster />` once, call `toast()` from anywhere. The less friction to adopt, the more people will use it.++2. **Good defaults matter more than options.** Ship beautiful out of the box. Most users never customize. The default easing, timing, and visual design should be excellent.++3. **Naming creates identity.** "Sonner" (French for "to ring") feels more elegant than "react-toast". Sacrifice discoverability for memorability when appropriate.++4. **Handle edge cases invisibly.** Pause toast timers when the tab is hidden. Fill gaps between stacked toasts with pseudo-elements to maintain hover state. Capture pointer events during drag. Users never notice these, and that is exactly right.++5. **Use transitions, not keyframes, for dynamic UI.** Toasts are added rapidly. Keyframes restart from zero on interruption. Transitions retarget smoothly.++6. **Build a great documentation site.** Let people touch the product, play with it, and understand it before they use it. Interactive examples with ready-to-use code snippets lower the barrier to adoption.++### Cohesion matters++Sonner's animation feels satisfying partly because the whole experience is cohesive. The easing and duration fit the vibe of the library. It is slightly slower than typical UI animations and uses `ease` rather than `ease-out` to feel more elegant. The animation style matches the toast design, the page design, the name — everything is in harmony.++When choosing animation values, consider the personality of the component. A playful component can be bouncier. A professional dashboard should be crisp and fast. Match the motion to the mood.++### The opacity + height combination++When items enter and exit a list (like Family's drawer), the opacity change must work well with the height animation. This is often trial and error. There is no formula — you adjust until it feels right.++### Review your work the next day++Review animations with fresh eyes. You notice imperfections the next day that you missed during development. Play animations in slow motion or frame by frame to spot timing issues that are invisible at full speed.++### Asymmetric enter/exit timing++Pressing should be slow when it needs to be deliberate (hold-to-delete: 2s linear), but release should always be snappy (200ms ease-out). This pattern applies broadly: slow where the user is deciding, fast where the system is responding.++```css+/* Release: fast */+.overlay {+ transition: clip-path 200ms ease-out;+}++/* Press: slow and deliberate */+.button:active .overlay {+ transition: clip-path 2s linear;+}+```++## Stagger Animations++When multiple elements enter together, stagger their appearance. Each element animates in with a small delay after the previous one. This creates a cascading effect that feels more natural than everything appearing at once.++```css+.item {+ opacity: 0;+ transform: translateY(8px);+ animation: fadeIn 300ms ease-out forwards;+}++.item:nth-child(1) {+ animation-delay: 0ms;+}+.item:nth-child(2) {+ animation-delay: 50ms;+}+.item:nth-child(3) {+ animation-delay: 100ms;+}+.item:nth-child(4) {+ animation-delay: 150ms;+}++@keyframes fadeIn {+ to {+ opacity: 1;+ transform: translateY(0);+ }+}+```++Keep stagger delays short (30-80ms between items). Long delays make the interface feel slow. Stagger is decorative — never block interaction while stagger animations are playing.++## Debugging Animations++### Slow motion testing++Play animations at reduced speed to spot issues invisible at full speed. Temporarily increase duration to 2-5x normal, or use browser DevTools animation inspector to slow playback.++Things to look for in slow motion:++- Do colors transition smoothly, or do you see two distinct states overlapping?+- Does the easing feel right, or does it start/stop abruptly?+- Is the transform-origin correct, or does the element scale from the wrong point?+- Are multiple animated properties (opacity, transform, color) in sync?++### Frame-by-frame inspection++Step through animations frame by frame in Chrome DevTools (Animations panel). This reveals timing issues between coordinated properties that you cannot see at full speed.++### Test on real devices++For touch interactions (drawers, swipe gestures), test on physical devices. Connect your phone via USB, visit your local dev server by IP address, and use Safari's remote devtools. The Xcode Simulator is an alternative but real hardware is better for gesture testing.++## Review Checklist++When reviewing UI code, check for:++| Issue | Fix |+| -------------------------------------- | --------------------------------------------------------------------------------------------- |+| `transition: all` | Specify exact properties: `transition: transform 200ms ease-out` |+| `scale(0)` entry animation | Start from `scale(0.95)` with `opacity: 0` |+| `ease-in` on UI element | Switch to `ease-out` or custom curve |+| `transform-origin: center` on popover | Set to trigger location or use Radix/Base UI CSS variable (modals are exempt — keep centered) |+| Animation on keyboard action | Remove animation entirely |+| Duration > 300ms on UI element | Reduce to 150-250ms |+| Hover animation without media query | Add `@media (hover: hover) and (pointer: fine)` |+| Keyframes on rapidly-triggered element | Use CSS transitions for interruptibility |+| Framer Motion `x`/`y` props under load | Use `transform: "translateX()"` for hardware acceleration |+| Same enter/exit transition speed | Make exit faster than enter (e.g., enter 2s, exit 200ms) |+| Elements all appear at once | Add stagger delay (30-80ms between items) |diff --git a/.agents/skills/make-interfaces-feel-better/SKILL.md b/.agents/skills/make-interfaces-feel-better/SKILL.mdnew file mode 100644index 0000000..e042272--- /dev/null+++ b/.agents/skills/make-interfaces-feel-better/SKILL.md@@ -0,0 +1,122 @@+---+name: make-interfaces-feel-better+description: Design engineering principles for making interfaces feel polished. Use when building UI components, reviewing frontend code, implementing animations, hover states, shadows, borders, typography, micro-interactions, enter/exit animations, or any visual detail work. Triggers on UI polish, design details, "make it feel better", "feels off", stagger animations, border radius, optical alignment, font smoothing, tabular numbers, image outlines, box shadows.+---++# Details that make interfaces feel better++Great interfaces rarely come from a single thing. It's usually a collection of small details that compound into a great experience. Apply these principles when building or reviewing UI code.++## Quick Reference++| Category | When to Use |+| ----------------------------- | --------------------------------------------------------------------------------- |+| [Typography](typography.md) | Text wrapping, font smoothing, tabular numbers |+| [Surfaces](surfaces.md) | Border radius, optical alignment, shadows, image outlines, hit areas |+| [Animations](animations.md) | Interruptible animations, enter/exit transitions, icon animations, scale on press |+| [Performance](performance.md) | Transition specificity, `will-change` usage |++## Core Principles++### 1. Concentric Border Radius++Outer radius = inner radius + padding. Mismatched radii on nested elements is the most common thing that makes interfaces feel off.++### 2. Optical Over Geometric Alignment++When geometric centering looks off, align optically. Buttons with icons, play triangles, and asymmetric icons all need manual adjustment.++### 3. Shadows Over Borders++Layer multiple transparent `box-shadow` values for natural depth. Shadows adapt to any background; solid borders don't.++### 4. Interruptible Animations++Use CSS transitions for interactive state changes — they can be interrupted mid-animation. Reserve keyframes for staged sequences that run once.++### 5. Split and Stagger Enter Animations++Don't animate a single container. Break content into semantic chunks and stagger each with ~100ms delay.++### 6. Subtle Exit Animations++Use a small fixed `translateY` instead of full height. Exits should be softer than enters.++### 7. Contextual Icon Animations++Animate icons with `opacity`, `scale`, and `blur` instead of toggling visibility. Use exactly these values: scale from `0.25` to `1`, opacity from `0` to `1`, blur from `4px` to `0px`. If the project has `motion` or `framer-motion` in `package.json`, use `transition: { type: "spring", duration: 0.3, bounce: 0 }` — bounce must always be `0`. If no motion library is installed, keep both icons in the DOM (one absolute-positioned) and cross-fade with CSS transitions using `cubic-bezier(0.2, 0, 0, 1)` — this gives both enter and exit animations without any dependency.++### 8. Font Smoothing++Apply `-webkit-font-smoothing: antialiased` to the root layout on macOS for crisper text.++### 9. Tabular Numbers++Use `font-variant-numeric: tabular-nums` for any dynamically updating numbers to prevent layout shift.++### 10. Text Wrapping++Use `text-wrap: balance` on headings. Use `text-wrap: pretty` for body text to avoid orphans.++### 11. Image Outlines++Add a subtle `1px` outline with low opacity to images for consistent depth.++### 12. Scale on Press++A subtle `scale(0.96)` on click gives buttons tactile feedback. Always use `0.96`. Never use a value smaller than `0.95` — anything below feels exaggerated. Add a `static` prop to disable it when motion would be distracting.++### 13. Skip Animation on Page Load++Use `initial={false}` on `AnimatePresence` to prevent enter animations on first render. Verify it doesn't break intentional entrance animations.++### 14. Never Use `transition: all`++Always specify exact properties: `transition-property: scale, opacity`. Tailwind's `transition-transform` covers `transform, translate, scale, rotate`.++### 15. Use `will-change` Sparingly++Only for `transform`, `opacity`, `filter` — properties the GPU can composite. Never use `will-change: all`. Only add when you notice first-frame stutter.++### 16. Minimum Hit Area++Interactive elements need at least 40×40px hit area. Extend with a pseudo-element if the visible element is smaller. Never let hit areas of two elements overlap.++## Common Mistakes++| Mistake | Fix |+| -------------------------------------- | ------------------------------------------------- |+| Same border radius on parent and child | Calculate `outerRadius = innerRadius + padding` |+| Icons look off-center | Adjust optically with padding or fix SVG directly |+| Hard borders between sections | Use layered `box-shadow` with transparency |+| Jarring enter/exit animations | Split, stagger, and keep exits subtle |+| Numbers cause layout shift | Apply `tabular-nums` |+| Heavy text on macOS | Apply `antialiased` to root |+| Animation plays on page load | Add `initial={false}` to `AnimatePresence` |+| `transition: all` on elements | Specify exact properties |+| First-frame animation stutter | Add `will-change: transform` (sparingly) |+| Tiny hit areas on small controls | Extend with pseudo-element to 40×40px |++## Review Checklist++- [ ] Nested rounded elements use concentric border radius+- [ ] Icons are optically centered, not just geometrically+- [ ] Shadows used instead of borders where appropriate+- [ ] Enter animations are split and staggered+- [ ] Exit animations are subtle+- [ ] Dynamic numbers use tabular-nums+- [ ] Font smoothing is applied+- [ ] Headings use text-wrap: balance+- [ ] Images have subtle outlines+- [ ] Buttons use scale on press where appropriate+- [ ] AnimatePresence uses `initial={false}` for default-state elements+- [ ] No `transition: all` — only specific properties+- [ ] `will-change` only on transform/opacity/filter, never `all`+- [ ] Interactive elements have at least 40×40px hit area++## Reference Files++- [typography.md](typography.md) — Text wrapping, font smoothing, tabular numbers+- [surfaces.md](surfaces.md) — Border radius, optical alignment, shadows, image outlines+- [animations.md](animations.md) — Interruptible animations, enter/exit transitions, icon animations, scale on press+- [performance.md](performance.md) — Transition specificity, `will-change` usagediff --git a/.agents/skills/make-interfaces-feel-better/animations.md b/.agents/skills/make-interfaces-feel-better/animations.mdnew file mode 100644index 0000000..44fa0b0--- /dev/null+++ b/.agents/skills/make-interfaces-feel-better/animations.md@@ -0,0 +1,387 @@+# Animations++Interruptible animations, enter/exit transitions, and contextual icon animations.++## Interruptible Animations++Users change intent mid-interaction. If animations aren't interruptible, the interface feels broken.++### CSS Transitions vs. Keyframes++| | CSS Transitions | CSS Keyframe Animations |+| ----------------- | ----------------------------------------------------- | ---------------------------------------------------------- |+| **Behavior** | Interpolate toward latest state | Run on a fixed timeline |+| **Interruptible** | Yes — retargets mid-animation | No — restarts from beginning |+| **Use for** | Interactive state changes (hover, toggle, open/close) | Staged sequences that run once (enter animations, loading) |+| **Duration** | Adapts to remaining distance | Fixed regardless of state |++```css+/* Good — interruptible transition for a toggle */+.drawer {+ transform: translateX(-100%);+ transition: transform 200ms ease-out;+}+.drawer.open {+ transform: translateX(0);+}++/* Clicking again mid-animation smoothly reverses — no jank */+```++```css+/* Bad — keyframe animation for interactive element */+.drawer.open {+ animation: slideIn 200ms ease-out forwards;+}++/* Closing mid-animation snaps or restarts — feels broken */+```++**Rule:** Always prefer CSS transitions for interactive elements. Reserve keyframes for one-shot sequences.++## Enter Animations: Split and Stagger++Don't animate a single large container. Break content into semantic chunks and animate each individually.++### Step by Step++1. **Split** into logical groups (title, description, buttons)+2. **Stagger** with ~100ms delay between groups+3. **For titles**, consider splitting into individual words with ~80ms stagger+4. **Combine** `opacity`, `blur`, and `translateY` for the enter effect++### Code Example++```tsx+// Motion (Framer Motion) — staggered enter+function PageHeader() {+ return (+ <motion.div+ initial="hidden"+ animate="visible"+ variants={{+ visible: { transition: { staggerChildren: 0.1 } },+ }}+ >+ <motion.h1+ variants={{+ hidden: { opacity: 0, y: 12, filter: "blur(4px)" },+ visible: { opacity: 1, y: 0, filter: "blur(0px)" },+ }}+ >+ Welcome+ </motion.h1>++ <motion.p+ variants={{+ hidden: { opacity: 0, y: 12, filter: "blur(4px)" },+ visible: { opacity: 1, y: 0, filter: "blur(0px)" },+ }}+ >+ A description of the page.+ </motion.p>++ <motion.div+ variants={{+ hidden: { opacity: 0, y: 12, filter: "blur(4px)" },+ visible: { opacity: 1, y: 0, filter: "blur(0px)" },+ }}+ >+ <Button>Get started</Button>+ </motion.div>+ </motion.div>+ );+}+```++### CSS-Only Stagger++```css+.stagger-item {+ opacity: 0;+ transform: translateY(12px);+ filter: blur(4px);+ animation: fadeInUp 400ms ease-out forwards;+}++.stagger-item:nth-child(1) {+ animation-delay: 0ms;+}+.stagger-item:nth-child(2) {+ animation-delay: 100ms;+}+.stagger-item:nth-child(3) {+ animation-delay: 200ms;+}++@keyframes fadeInUp {+ to {+ opacity: 1;+ transform: translateY(0);+ filter: blur(0);+ }+}+```++## Exit Animations++Exit animations should be softer and less attention-grabbing than enter animations. The user's focus is moving to the next thing — don't fight for attention.++### Subtle Exit (Recommended)++```tsx+// Small fixed translateY — indicates direction without drama+<motion.div+ exit={{+ opacity: 0,+ y: -12,+ filter: "blur(4px)",+ transition: { duration: 0.15, ease: "easeIn" },+ }}+>+ {content}+</motion.div>+```++### Full Exit (When Context Matters)++```tsx+// Slide fully out — use when spatial context is important+// (e.g., a card returning to a list, a drawer closing)+<motion.div+ exit={{+ opacity: 0,+ x: "-100%",+ transition: { duration: 0.2, ease: "easeIn" },+ }}+>+ {content}+</motion.div>+```++### Good vs. Bad++```css+/* Good — subtle exit */+.item-exit {+ opacity: 0;+ transform: translateY(-12px);+ transition:+ opacity 150ms ease-in,+ transform 150ms ease-in;+}++/* Bad — dramatic exit that steals focus */+.item-exit {+ opacity: 0;+ transform: translateY(-100%) scale(0.5);+ transition: all 400ms ease-in;+}++/* Bad — no exit animation at all (element just vanishes) */+.item-exit {+ display: none;+}+```++**Key points:**++- Use a small fixed `translateY` (e.g., `-12px`) instead of the full container height+- Keep some directional movement to indicate where the element went+- Exit duration should be shorter than enter duration (150ms vs 300ms)+- Don't remove exit animations entirely — subtle motion preserves context++## Contextual Icon Animations++When icons appear or disappear contextually (on hover, on state change), animate them with `opacity`, `scale`, and `blur` rather than just toggling visibility.++### Motion Example++```tsx+import { AnimatePresence, motion } from "motion/react";++function IconButton({ isActive, icon: Icon }) {+ return (+ <button>+ <AnimatePresence mode="popLayout">+ <motion.span+ key={isActive ? "active" : "inactive"}+ initial={{ opacity: 0, scale: 0.25, filter: "blur(4px)" }}+ animate={{ opacity: 1, scale: 1, filter: "blur(0px)" }}+ exit={{ opacity: 0, scale: 0.25, filter: "blur(4px)" }}+ transition={{ type: "spring", duration: 0.3, bounce: 0 }}+ >+ <Icon />+ </motion.span>+ </AnimatePresence>+ </button>+ );+}+```++### CSS Transition Approach (No Motion)++If the project doesn't use Motion (Framer Motion), keep both icons in the DOM and cross-fade them with CSS transitions. Because neither icon unmounts, both enter and exit animate smoothly.++The trick: one icon is absolutely positioned on top of the other. Toggling state cross-fades them — the entering icon scales up from `0.25` while the exiting icon scales down to `0.25`, both with opacity and blur.++```tsx+function IconButton({ isActive, ActiveIcon, InactiveIcon }) {+ return (+ <button>+ <div className="relative">+ <div+ className={cn(+ "absolute inset-0 flex items-center justify-center",+ "transition-[opacity,filter,scale] duration-300",+ "cubic-bezier(0.2, 0, 0, 1)",+ isActive+ ? "scale-100 opacity-100 blur-0"+ : "scale-[0.25] opacity-0 blur-[4px]",+ )}+ >+ <ActiveIcon />+ </div>+ <div+ className={cn(+ "transition-[opacity,filter,scale] duration-300",+ "cubic-bezier(0.2, 0, 0, 1)",+ isActive+ ? "scale-[0.25] opacity-0 blur-[4px]"+ : "scale-100 opacity-100 blur-0",+ )}+ >+ <InactiveIcon />+ </div>+ </div>+ </button>+ );+}+```++The non-absolute icon (InactiveIcon) defines the layout size. The absolute icon (ActiveIcon) overlays it without affecting flow.++### Choosing Between Motion and CSS++| | Motion (Framer Motion) | CSS transitions (both icons in DOM) |+| ------------------- | ----------------------------------- | ------------------------------------------------------ |+| **Enter animation** | Yes | Yes |+| **Exit animation** | Yes (via `AnimatePresence`) | Yes (cross-fade — icon never unmounts) |+| **Spring physics** | Yes | No — use `cubic-bezier(0.2, 0, 0, 1)` as approximation |+| **When to use** | Project already uses `motion/react` | No motion dependency, or keeping bundle small |++**Rule:** Check the project's `package.json` for `motion` or `framer-motion`. If present, use the Motion approach. If not, use the CSS cross-fade pattern — don't add a dependency just for icon transitions.++### When to Animate Icons++| Animate | Don't animate |+| ----------------------------------------------- | ------------------------------- |+| Icons that appear on hover (action buttons) | Static navigation icons |+| State change icons (play → pause, like → liked) | Decorative icons |+| Icons in contextual toolbars | Icons that are always visible |+| Loading/success state indicators | Icon labels (text next to icon) |++**Important:** Always use exactly these values for contextual icon animations — do not deviate:++- `scale`: `0.25` → `1` (never use `0.5` or `0.6`)+- `opacity`: `0` → `1`+- `filter`: `"blur(4px)"` → `"blur(0px)"`+- `transition`: `{ type: "spring", duration: 0.3, bounce: 0 }` — **bounce must always be `0`**, never `0.1` or any other value++## Scale on Press++A subtle scale-down on click gives buttons tactile feedback. Always use `scale(0.96)`. Never use a value smaller than `0.95` — anything below feels exaggerated. Use CSS transitions for interruptibility — if the user releases mid-press, it should smoothly return.++Not every button needs this. Add a `static` prop to your button component that disables the scale effect when the motion would be distracting.++### CSS Example++```css+.button {+ transition-property: scale;+ transition-duration: 150ms;+ transition-timing-function: ease-out;+}++.button:active {+ scale: 0.96;+}+```++### Tailwind Example++```tsx+<button className="transition-transform duration-150 ease-out active:scale-[0.96]">+ Click me+</button>+```++### Motion Example++```tsx+<motion.button whileTap={{ scale: 0.96 }}>Click me</motion.button>+```++### Static Prop Pattern++Extract the scale class into a variable and conditionally apply it based on a `static` prop:++```tsx+const tapScale = "active:not-disabled:scale-[0.96]";++function Button({ static: isStatic, className, children, ...props }) {+ return (+ <button+ className={cn(+ "transition-transform duration-150 ease-out",+ !isStatic && tapScale,+ className,+ )}+ {...props}+ >+ {children}+ </button>+ );+}++// Usage+<Button>Click me</Button> {/* scales on press */}+<Button static>Submit</Button> {/* no scale */}+```++## Skip Animation on Page Load++Use `initial={false}` on `AnimatePresence` to prevent enter animations from firing on first render. Elements that are already in their default state shouldn't animate in on page load — only on subsequent state changes.++### When It Works++```tsx+// Good — icon doesn't animate in on mount, only on state change+<AnimatePresence initial={false} mode="popLayout">+ <motion.span+ key={isActive ? "active" : "inactive"}+ initial={{ opacity: 0, scale: 0.25, filter: "blur(4px)" }}+ animate={{ opacity: 1, scale: 1, filter: "blur(0px)" }}+ exit={{ opacity: 0, scale: 0.25, filter: "blur(4px)" }}+ >+ <Icon />+ </motion.span>+</AnimatePresence>+```++Works well for: icon swaps, toggles, tabs, segmented controls — anything that has a default state on page load.++### When It Breaks++Don't use `initial={false}` when the component relies on its `initial` prop to set up a first-time enter animation, like a staggered page hero or a loading state. In those cases, removing the initial animation skips the entire entrance.++```tsx+// Bad — initial={false} would skip the staggered page enter entirely+<AnimatePresence initial={false}>+ <motion.div initial="hidden" animate="visible" variants={...}>+ ...+ </motion.div>+</AnimatePresence>+```++Verify the component still looks right on a full page refresh before applying this.diff --git a/.agents/skills/make-interfaces-feel-better/performance.md b/.agents/skills/make-interfaces-feel-better/performance.mdnew file mode 100644index 0000000..8e38b3f--- /dev/null+++ b/.agents/skills/make-interfaces-feel-better/performance.md@@ -0,0 +1,88 @@+# Performance++Transition specificity and GPU compositing hints.++## Transition Only What Changes++Never use `transition: all` or Tailwind's `transition` shorthand (which maps to `transition-property: all`). Always specify the exact properties that change.++### Why++- `transition: all` forces the browser to watch every property for changes+- Causes unexpected transitions on properties you didn't intend to animate (colors, padding, shadows)+- Prevents browser optimizations++### CSS Example++```css+/* Good — only transition what changes */+.button {+ transition-property: scale, background-color;+ transition-duration: 150ms;+ transition-timing-function: ease-out;+}++/* Bad — transition everything */+.button {+ transition: all 150ms ease-out;+}+```++### Tailwind++```tsx+// Good — explicit properties+<button className="transition-[scale,background-color] duration-150 ease-out">++// Bad — transition all+<button className="transition duration-150 ease-out">+```++### Tailwind `transition-transform` Note++`transition-transform` in Tailwind maps to `transition-property: transform, translate, scale, rotate` — it covers all transform-related properties, not just `transform`. Use this when you're only animating transforms. For multiple non-transform properties, use the bracket syntax: `transition-[scale,opacity,filter]`.++## Use `will-change` Sparingly++`will-change` hints the browser to pre-promote an element to its own GPU compositing layer. Without it, the browser promotes the element only when the animation starts — that one-time layer promotion can cause a micro-stutter on the first frame.++This particularly helps when an element is changing `scale`, `rotation`, or moving around with `transform`. For other properties, it doesn't help much — the browser can't composite them on the GPU anyway.++### Rules++```css+/* Good — specific property that benefits from GPU compositing */+.animated-card {+ will-change: transform;+}++/* Good — multiple compositor-friendly properties */+.animated-card {+ will-change: transform, opacity;+}++/* Bad — never use will-change: all */+.animated-card {+ will-change: all;+}++/* Bad — properties that can't be GPU-composited anyway */+.animated-card {+ will-change: background-color, padding;+}+```++### Useful Properties++| Property | GPU-compositable | Worth using `will-change` |+| -------------------------------- | ---------------- | ------------------------- |+| `transform` | Yes | Yes |+| `opacity` | Yes | Yes |+| `filter` (blur, brightness) | Yes | Yes |+| `clip-path` | Yes | Yes |+| `top`, `left`, `width`, `height` | No | No |+| `background`, `border`, `color` | No | No |++### When to Skip++Modern browsers are already good at optimizing on their own. Only add `will-change` when you notice first-frame stutter — Safari in particular benefits from it. Don't add it preemptively to every animated element; each extra compositing layer costs memory.diff --git a/.agents/skills/make-interfaces-feel-better/surfaces.md b/.agents/skills/make-interfaces-feel-better/surfaces.mdnew file mode 100644index 0000000..ed7b1e0--- /dev/null+++ b/.agents/skills/make-interfaces-feel-better/surfaces.md@@ -0,0 +1,245 @@+# Surfaces++Border radius, optical alignment, shadows, and image outlines.++## Concentric Border Radius++When nesting rounded elements, the outer radius must equal the inner radius plus the padding between them:++```+outerRadius = innerRadius + padding+```++This rule is most useful when nested surfaces are close together. If padding is larger than `24px`, treat the layers as separate surfaces and choose each radius independently instead of forcing strict concentric math.++### Example++```css+/* Good — concentric radii */+.card {+ border-radius: 20px; /* 12 + 8 */+ padding: 8px;+}+.card-inner {+ border-radius: 12px;+}++/* Bad — same radius on both */+.card {+ border-radius: 12px;+ padding: 8px;+}+.card-inner {+ border-radius: 12px;+}+```++### Tailwind Example++```tsx+// Good — outer radius accounts for padding+<div className="rounded-2xl p-2"> {/* 16px radius, 8px padding */}+ <div className="rounded-lg"> {/* 8px radius = 16 - 8 ✓ */}+ ...+ </div>+</div>++// Bad — same radius on both+<div className="rounded-xl p-2">+ <div className="rounded-xl"> {/* same radius, looks off */}+ ...+ </div>+</div>+```++Mismatched border radii on nested elements is one of the most common things that makes interfaces feel off. Always calculate concentrically.++## Optical Alignment++When geometric centering looks off, align optically instead.++### Buttons with Text + Icon++Use slightly less padding on the icon side to make the button feel balanced. A reliable rule of thumb is:+`icon-side padding = text-side padding - 2px`.++```css+/* Good — less padding on icon side */+.button-with-icon {+ padding-left: 16px;+ padding-right: 14px; /* icon side = text side - 2px */+}++/* Bad — equal padding looks like icon is pushed too far right */+.button-with-icon {+ padding: 0 16px;+}+```++```tsx+// Tailwind+<button className="flex items-center gap-2 pl-4 pr-3.5">+ <span>Continue</span>+ <ArrowRightIcon />+</button>+```++### Play Button Triangles++Play icons are triangular and their geometric center is not their visual center. Shift slightly right:++```css+/* Good — optically centered */+.play-button svg {+ margin-left: 2px; /* shift right to account for triangle shape */+}++/* Bad — geometrically centered but looks off */+.play-button svg {+ /* no adjustment */+}+```++### Asymmetric Icons (Stars, Arrows, Carets)++Some icons have uneven visual weight. The best fix is adjusting the SVG directly so no extra margin/padding is needed in the component code.++```tsx+// Best — fix in the SVG itself+// Adjust the viewBox or path to visually center the icon++// Fallback — adjust with margin+<span className="ml-px">+ <StarIcon />+</span>+```++## Shadows Instead of Borders++For **buttons, cards, and containers** that use a border for depth or elevation, prefer replacing it with a subtle `box-shadow`. Shadows adapt to any background since they use transparency; solid borders don't. This also helps when using images or multiple colors as backgrounds — solid border colors don't work well on backgrounds other than the ones they were designed for.++**Do not apply this to dividers** (`border-b`, `border-t`, side borders) or any border whose purpose is layout separation rather than element depth. Those should stay as borders.++### Shadow as Border (Light Mode)++The shadow is comprised of three layers. The first acts as a 1px border ring, the second adds subtle lift, and the third provides ambient depth:++```css+:root {+ --shadow-border:+ 0px 0px 0px 1px rgba(0, 0, 0, 0.06), 0px 1px 2px -1px rgba(0, 0, 0, 0.06),+ 0px 2px 4px 0px rgba(0, 0, 0, 0.04);+ --shadow-border-hover:+ 0px 0px 0px 1px rgba(0, 0, 0, 0.08), 0px 1px 2px -1px rgba(0, 0, 0, 0.08),+ 0px 2px 4px 0px rgba(0, 0, 0, 0.06);+}+```++### Shadow as Border (Dark Mode)++In dark mode, simplify to a single white ring — layered depth shadows aren't visible on dark backgrounds:++```css+/* Dark mode — adapt to whatever setup the project uses+ (prefers-color-scheme, class, data attribute, etc.) */+--shadow-border: 0 0 0 1px rgba(255, 255, 255, 0.08);+--shadow-border-hover: 0 0 0 1px rgba(255, 255, 255, 0.13);+```++### Usage with Hover Transition++Apply the variable and add `transition-[box-shadow]` for a smooth hover:++```css+.card {+ box-shadow: var(--shadow-border);+ transition-property: box-shadow;+ transition-duration: 150ms;+ transition-timing-function: ease-out;+}++.card:hover {+ box-shadow: var(--shadow-border-hover);+}+```++### When to Use Shadows vs. Borders++| Use shadows | Use borders |+| ------------------------------------- | --------------------------------------- |+| Cards, containers with depth | Dividers between list items |+| Buttons with bordered styles | Table cell boundaries |+| Elevated elements (dropdowns, modals) | Form input outlines (for accessibility) |+| Elements on varied backgrounds | Hairline separators in dense UI |+| Hover/focus states for lift effect | |++## Image Outlines++Add a subtle `1px` outline with low opacity to images. This creates consistent depth, especially in design systems where other elements use borders or shadows.++### Light Mode++```css+img {+ outline: 1px solid rgba(0, 0, 0, 0.1);+ outline-offset: -1px; /* inset so it doesn't add to layout */+}+```++### Dark Mode++```css+img {+ outline: 1px solid rgba(255, 255, 255, 0.1);+ outline-offset: -1px;+}+```++### Tailwind with Dark Mode++```tsx+<img+ className="outline outline-1 -outline-offset-1 outline-black/10 dark:outline-white/10"+ src={src}+ alt={alt}+/>+```++**Why outline instead of border?** `outline` doesn't affect layout (no added width/height), and `outline-offset: -1px` keeps it inset so images stay their intended size.++## Minimum Hit Area++Interactive elements should have a minimum hit area of 44×44px (WCAG) or at least 40×40px. If the visible element is smaller (e.g., a 20×20 checkbox), extend the hit area with a pseudo-element.++### CSS Example++```css+/* Small checkbox with expanded hit area */+.checkbox {+ position: relative;+ width: 20px;+ height: 20px;+}++.checkbox::after {+ content: "";+ position: absolute;+ top: 50%;+ left: 50%;+ transform: translate(-50%, -50%);+ width: 40px;+ height: 40px;+}+```++### Tailwind Example++```tsx+<button className="after:-translate-1/2 relative size-5 after:absolute after:left-1/2 after:top-1/2 after:size-10">+ <CheckIcon />+</button>+```++### Collision Rule++If the extended hit area overlaps another interactive element, shrink the pseudo-element — but make it as large as possible without colliding. Two interactive elements should never have overlapping hit areas.diff --git a/.agents/skills/make-interfaces-feel-better/typography.md b/.agents/skills/make-interfaces-feel-better/typography.mdnew file mode 100644index 0000000..f311411--- /dev/null+++ b/.agents/skills/make-interfaces-feel-better/typography.md@@ -0,0 +1,125 @@+# Typography++Typography rendering details that make interfaces feel better.++## Text Wrapping++### text-wrap: balance++Distributes text evenly across lines, preventing orphaned words on headings and short text blocks. **Only works on blocks of 6 lines or fewer** (Chromium) or 10 lines or fewer (Firefox) — the balancing algorithm is computationally expensive, so browsers limit it to short text.++```css+/* Good — even line lengths on short text */+h1,+h2,+h3 {+ text-wrap: balance;+}+```++```css+/* Bad — default wrapping leaves orphans */+h1 {+ /* no text-wrap rule → "Read our+ blog" instead of balanced lines */+}+```++```css+/* Bad — balance on long paragraphs (silently ignored, wastes intent) */+.article-body p {+ text-wrap: balance;+}+```++**Tailwind:** `text-balance`++### text-wrap: pretty++Optimizes the last line to avoid orphans using a slower algorithm that favors better typography over performance. Unlike `balance`, it works on longer text — use this for body copy where you want to minimize orphans without the 6-line limit.++```css+p {+ text-wrap: pretty;+}+```++### When to Use Which++| Scenario | Use |+| --------------------------------------- | ----------------------- |+| Headings, titles, short text (≤6 lines) | `text-wrap: balance` |+| Body paragraphs, descriptions | `text-wrap: pretty` |+| Code blocks, pre-formatted text | Neither — leave default |++## Font Smoothing (macOS)++On macOS, text renders heavier than intended by default. Apply antialiased smoothing to the root layout so all text renders crisper and thinner.++```css+/* CSS */+html {+ -webkit-font-smoothing: antialiased;+ -moz-osx-font-smoothing: grayscale;+}+```++```tsx+// Tailwind — apply to root layout+<html className="antialiased">+```++### Good vs. Bad++```css+/* Good — applied once at the root */+html {+ -webkit-font-smoothing: antialiased;+}++/* Bad — applied per-element, inconsistent */+.heading {+ -webkit-font-smoothing: antialiased;+}+.body {+ /* no smoothing → heavier than heading */+}+```++**Note:** This only affects macOS rendering. Other platforms ignore these properties, so it's safe to apply universally.++## Tabular Numbers++When numbers update dynamically (counters, prices, timers, table columns), use tabular-nums to make all digits equal width. This prevents layout shift as values change.++```css+/* CSS */+.counter {+ font-variant-numeric: tabular-nums;+}+```++```tsx+// Tailwind+<span className="tabular-nums">{count}</span>+```++### When to Use++| Use tabular-nums | Don't use tabular-nums |+| --------------------------- | ------------------------ |+| Counters and timers | Static display numbers |+| Prices that update | Decorative large numbers |+| Table columns with numbers | Phone numbers, zip codes |+| Animated number transitions | Version numbers (v2.1.0) |+| Scoreboards, dashboards | |++### Caveat++Some fonts (like Inter) change the visual appearance of numerals with this property — specifically, the digit `1` becomes wider and centered. This is expected behavior and usually desirable for alignment, but verify it looks right in your specific font.++```css+/* With Inter font:+ Default: 1234 → proportional, "1" is narrow+ Tabular: 1234 → all digits equal width, "1" centered */+```diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.ymlindex 8438879..a754a16 100644--- a/.github/workflows/lint.yml+++ b/.github/workflows/lint.yml@@ -28,10 +28,12 @@ jobs:run: pnpm install- name: 🔎 Run linting+ id: lint+ continue-on-error: truerun: pnpm eslint .- name: 🔍 Get PR URL- if: failure()+ if: steps.lint.outcome == 'failure'id: pr-urlenv:GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}@@ -43,8 +45,8 @@ jobs:| jq -r '.[0].html_url')echo "pr_url=$PR_URL" >> "$GITHUB_OUTPUT"- - name: 📧 Send email on failure- if: failure()+ - name: 📧 Send email+ if: steps.lint.outcome == 'failure'uses: dawidd6/action-send-mail@611879133a9569642c41be66f4a323286e9b8a3b # v4with:server_address: smtp.gmail.com@@ -60,4 +62,3 @@ jobs:For more details, please check:- GitHub Actions run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}${{ steps.pr-url.outputs.pr_url && format('- Pull Request: {0}', steps.pr-url.outputs.pr_url) }}- - Commit: ${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}diff --git a/.github/workflows/type-check.yml b/.github/workflows/type-check.ymlindex 8040e6d..fce01be 100644--- a/.github/workflows/type-check.yml+++ b/.github/workflows/type-check.yml@@ -28,10 +28,12 @@ jobs:run: pnpm install- name: 🔍 Run type check+ id: type-check+ continue-on-error: truerun: pnpm type-check:go- name: 🔍 Get PR URL- if: failure()+ if: steps.type-check.outcome == 'failure'id: pr-urlenv:GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}@@ -43,8 +45,8 @@ jobs:| jq -r '.[0].html_url')echo "pr_url=$PR_URL" >> "$GITHUB_OUTPUT"- - name: 📧 Send email on failure- if: failure()+ - name: 📧 Send email+ if: steps.type-check.outcome == 'failure'uses: dawidd6/action-send-mail@611879133a9569642c41be66f4a323286e9b8a3b # v4with:server_address: smtp.gmail.com@@ -60,4 +62,3 @@ jobs:For more details, please check:- GitHub Actions run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}${{ steps.pr-url.outputs.pr_url && format('- Pull Request: {0}', steps.pr-url.outputs.pr_url) }}- - Commit: ${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.ymlindex 1b79b8e..b456dbf 100644--- a/.github/workflows/unit-tests.yml+++ b/.github/workflows/unit-tests.yml@@ -30,9 +30,10 @@ jobs:- name: 🧪 Run Vitest testsid: vitestrun: pnpm vitest run --reporter=verbose+ continue-on-error: true- name: 🔍 Get PR URL- if: failure()+ if: steps.vitest.outcome == 'failure'id: pr-urlenv:GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}@@ -44,8 +45,8 @@ jobs:| jq -r '.[0].html_url')echo "pr_url=$PR_URL" >> "$GITHUB_OUTPUT"- - name: 📧 Send email on failure- if: failure()+ - name: 📧 Send email+ if: steps.vitest.outcome == 'failure'uses: dawidd6/action-send-mail@611879133a9569642c41be66f4a323286e9b8a3b # v4with:server_address: smtp.gmail.com@@ -61,4 +62,3 @@ jobs:For more details, please check:- GitHub Actions run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}${{ steps.pr-url.outputs.pr_url && format('- Pull Request: {0}', steps.pr-url.outputs.pr_url) }}- - Commit: ${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}diff --git a/.npmrc b/.npmrcindex df6837c..6a510ed 100644--- a/.npmrc+++ b/.npmrc@@ -2,4 +2,4 @@ save-exact=true# this specifies the number of minutes that must pass after a version is published before pnpm will install it (to prevent supply chain attacks)# https://pnpm.io/settings#minimumreleaseage-minimumReleaseAge=4320 # 3 days,\ No newline at end of file+minimum-release-age=4320 # 3 days,\ No newline at end of filediff --git a/README.md b/README.mdindex 02b834e..11f5966 100644--- a/README.md+++ b/README.md@@ -1,5 +1,5 @@<div align="center">- <img src=".github/screenshots/easy-invoice-logo-readme.png" alt="EasyInvoicePDF Logo" width="160" height="160">+ <img src=".github/screenshots/easy-invoice-logo-readme.png" alt="EasyInvoicePDF Logo" width="80" height="80"><h1>EasyInvoicePDF</h1><h3>Free & Open-Source Invoice Generator</h3><p>Create professional invoices instantly in your browser with <strong>Live Preview</strong>, <strong>Multiple Templates</strong> (including a Stripe-style design). <strong>No Sign-Up Required</strong>.</p>diff --git a/e2e/buyer.test.ts b/e2e/buyer.test.tsindex 39cf964..bb98138 100644--- a/e2e/buyer.test.ts+++ b/e2e/buyer.test.ts@@ -1,4 +1,3 @@-import { BUYER_TOOLTIP_CONTENT } from "@/app/(app)/components/invoice-form/sections/buyer-information";import { DEFAULT_BUYER_DATA } from "@/app/constants";import { type BuyerData } from "@/app/schema";import { expect, test } from "@playwright/test";@@ -22,6 +21,7 @@ test.describe("Buyer management", () => {vatNoLabelText: "Tax Number",email: "[email protected]",+ emailFieldIsVisible: true,notesFieldIsVisible: true,notes: "This is a test note",@@ -71,6 +71,18 @@ test.describe("Buyer management", () => {.getByRole("textbox", { name: "Email" }).fill(TEST_BUYER_DATA.email);+ const emailSwitchInDialogForm = manageBuyerDialog.getByRole("switch", {+ name: `Show the 'Email' field in the PDF`,+ });++ // Verify Email visibility switch is checked by default+ await expect(emailSwitchInDialogForm).toBeChecked();++ // Toggle Email visibility switch+ await emailSwitchInDialogForm.click();++ await expect(emailSwitchInDialogForm).not.toBeChecked();+const taxNumberSwitchInDialogForm = manageBuyerDialog.getByRole("switch", {name: `Show the 'Tax Number' field in the PDF`,});@@ -132,6 +144,7 @@ test.describe("Buyer management", () => {vatNoFieldIsVisible: false,email: TEST_BUYER_DATA.email,+ emailFieldIsVisible: false,notes: TEST_BUYER_DATA.notes,notesFieldIsVisible: true,@@ -144,42 +157,23 @@ test.describe("Buyer management", () => {// Verify all saved details in the Buyer Information section formconst buyerForm = page.getByTestId(`buyer-information-section`);- // Try to find desktop tooltip icon first- const desktopTooltipExists =- (await buyerForm- .getByTestId("form-section-tooltip-info-icon-desktop")- .count()) > 0;-- // If desktop tooltip exists, hover over it; otherwise find and click mobile tooltip- // eslint-disable-next-line playwright/no-conditional-in-test- if (desktopTooltipExists) {- // Get desktop tooltip icons and hover over the first one because we use tooltip- const desktopTooltips = buyerForm.getByTestId(- "form-section-tooltip-info-icon-desktop",- );- await desktopTooltips.first().hover();- } else {- // Get mobile tooltip icons and click the first one because we use popover- const mobileTooltips = buyerForm.getByTestId(- "form-section-tooltip-info-icon-mobile",- );- await mobileTooltips.first().click();- }-- // Check that HTML title attributes contain the tooltip message on input fields- const nameInput = buyerForm.getByRole("textbox", { name: "Name" });- await expect(nameInput).toHaveAttribute("title", BUYER_TOOLTIP_CONTENT);+ // Verify the locked banner is visible with correct text+ const buyerLockedBanner = buyerForm.getByTestId("buyer-locked-banner");+ await expect(buyerLockedBanner).toBeVisible();+ await expect(buyerLockedBanner).toContainText(+ 'To modify buyer details, click the "Edit buyer" button (pencil icon) next to the dropdown above.',+ );++ const nameInput = buyerForm.getByRole("textbox", {+ name: "Name (Required)",+ });// Buyer Name- await expect(nameInput).toHaveAttribute("aria-readonly", "true");await expect(nameInput).toHaveValue(TEST_BUYER_DATA.name);// Buyer Addressawait expect(- buyerForm.getByRole("textbox", { name: "Address" }),- ).toHaveAttribute("aria-readonly", "true");- await expect(- buyerForm.getByRole("textbox", { name: "Address" }),+ buyerForm.getByRole("textbox", { name: "Address (Required)" }),).toHaveValue(TEST_BUYER_DATA.address);// Buyer VAT Number@@ -187,17 +181,10 @@ test.describe("Buyer management", () => {name: "Buyer Tax Number",});- await expect(- buyerVatFieldset.getByRole("textbox", { name: "Label" }),- ).toHaveAttribute("aria-readonly", "true");-await expect(buyerVatFieldset.getByRole("textbox", { name: "Label" }),).toHaveValue(TEST_BUYER_DATA.vatNoLabelText);- await expect(- buyerVatFieldset.getByRole("textbox", { name: "Value" }),- ).toHaveAttribute("aria-readonly", "true");await expect(buyerVatFieldset.getByRole("textbox", { name: "Value" }),).toHaveValue(TEST_BUYER_DATA.vatNo);@@ -210,18 +197,18 @@ test.describe("Buyer management", () => {await expect(vatNumberSwitchNotInDialog).toBeDisabled();// Buyer Email- await expect(- buyerForm.getByRole("textbox", { name: "Email" }),- ).toHaveAttribute("aria-readonly", "true");await expect(buyerForm.getByRole("textbox", { name: "Email" })).toHaveValue(TEST_BUYER_DATA.email,);- // Buyer Notes- await expect(- buyerForm.getByRole("textbox", { name: "Notes" }),- ).toHaveAttribute("aria-readonly", "true");+ const emailSwitchNotInDialog = buyerForm.getByRole("switch", {+ name: `Show the 'Email' field in the PDF`,+ });+ // Verify Email switch is not checked as we toggled it off+ await expect(emailSwitchNotInDialog).not.toBeChecked();+ await expect(emailSwitchNotInDialog).toBeDisabled();+ // Buyer Notesawait expect(buyerForm.getByRole("textbox", { name: "Notes" })).toHaveValue(TEST_BUYER_DATA.notes,);@@ -267,6 +254,9 @@ test.describe("Buyer management", () => {manageBuyerDialog.getByRole("textbox", { name: "Email" }),).toHaveValue(TEST_BUYER_DATA.email);+ // Verify email visibility switch state persisted in edit dialog+ await expect(emailSwitchInDialogForm).not.toBeChecked();+// Verify visibility switch state persisted in edit dialogawait expect(taxNumberSwitchInDialogForm).not.toBeChecked();@@ -291,6 +281,9 @@ test.describe("Buyer management", () => {.getByRole("textbox", { name: "Name" }).fill(updatedName);+ // Re-enable Email visibility+ await emailSwitchInDialogForm.click();+// Re-enable VAT visibilityawait taxNumberSwitchInDialogForm.click();@@ -314,6 +307,9 @@ test.describe("Buyer management", () => {updatedName,);+ // Verify Email visibility is now enabled+ await expect(emailSwitchNotInDialog).toBeChecked();+// Verify VAT visibility is now enabledawait expect(buyerForm.getByTestId(`buyerVatNoFieldIsVisible`),@@ -330,6 +326,7 @@ test.describe("Buyer management", () => {name: "Unapplied Test Client",address: "99 Unapplied Avenue",email: "[email protected]",+ emailFieldIsVisible: true,vatNoFieldIsVisible: true,vatNo: "VAT999",@@ -396,6 +393,7 @@ test.describe("Buyer management", () => {name: "Dropdown Test Client",address: "42 Dropdown Boulevard",email: "[email protected]",+ emailFieldIsVisible: true,vatNoFieldIsVisible: true,vatNo: "VAT-DROP-001",@@ -431,6 +429,9 @@ test.describe("Buyer management", () => {// Buyer is currently selected in dropdownawait expect(buyerDropdown).not.toHaveValue("");+ // Verify locked banner is visible when buyer is selected+ await expect(buyerForm.getByTestId("buyer-locked-banner")).toBeVisible();+// Restore to default by selecting the empty optionawait buyerDropdown.selectOption("");@@ -439,6 +440,9 @@ test.describe("Buyer management", () => {page.getByText("Buyer restored to default", { exact: true }),).toBeVisible();+ // Verify locked banner is hidden after deselecting buyer+ await expect(buyerForm.getByTestId("buyer-locked-banner")).toBeHidden();+// Verify form reset to default valuesawait expect(buyerForm.getByRole("textbox", { name: "Name" })).toHaveValue(DEFAULT_BUYER_DATA.name,@@ -460,6 +464,9 @@ test.describe("Buyer management", () => {}),).toBeVisible();+ // Verify locked banner is visible again after reselecting buyer+ await expect(buyerForm.getByTestId("buyer-locked-banner")).toBeVisible();+// Verify form fields are populated with the buyer's dataawait expect(buyerForm.getByRole("textbox", { name: "Name" })).toHaveValue(TEST_BUYER_DATA.name,@@ -480,6 +487,7 @@ test.describe("Buyer management", () => {name: "Test Delete Buyer",address: "456 Delete Avenue",email: "[email protected]",+ emailFieldIsVisible: true,vatNoFieldIsVisible: true,vatNo: "123456789",diff --git a/e2e/default-invoice-template/default-invoice-template.test.ts b/e2e/default-invoice-template/default-invoice-template.test.tsindex 58da8e7..a4775ac 100644--- a/e2e/default-invoice-template/default-invoice-template.test.ts+++ b/e2e/default-invoice-template/default-invoice-template.test.ts@@ -1713,4 +1713,225 @@ test.describe("Default Invoice Template", () => {"pdf-with-logo-stripe-template-after-switch.png",);});++ test("toggles seller and buyer email visibility in PDF", async ({+ page,+ browserName,+ downloadDir,+ }, testInfo) => {+ await expect(page).toHaveURL("/?template=default");++ /*+ * PHASE 1: Fill inline form with email switch OFF -> PDF screenshot (emails hidden)+ */++ const sellerSection = page.getByTestId("seller-information-section");+ const buyerSection = page.getByTestId("buyer-information-section");++ // Fill seller fields inline (no saved seller selected, so switch is enabled)+ await sellerSection+ .getByRole("textbox", { name: "Name (Required)" })+ .fill("Email Visibility Test Seller");++ await sellerSection+ .getByRole("textbox", { name: "Address (Required)" })+ .fill("123 Seller Street\nSeller City, 10001");++ await sellerSection+ .getByRole("textbox", { name: "Email" })+ .fill("[email protected]");++ // Toggle seller email switch OFF via inline form+ const sellerEmailSwitch = sellerSection.getByRole("switch", {+ name: "Show the 'Email' field in the PDF",+ });+ await expect(sellerEmailSwitch).toBeChecked();+ await sellerEmailSwitch.click();+ await expect(sellerEmailSwitch).not.toBeChecked();++ // Fill buyer fields inline (no saved buyer selected, so switch is enabled)+ await buyerSection+ .getByRole("textbox", { name: "Name (Required)" })+ .fill("Email Visibility Test Buyer");++ await buyerSection+ .getByRole("textbox", { name: "Address (Required)" })+ .fill("456 Buyer Avenue\nBuyer City, 20002");++ await buyerSection+ .getByRole("textbox", { name: "Email" })+ .fill("[email protected]");++ // Toggle buyer email switch OFF via inline form+ const buyerEmailSwitch = buyerSection.getByRole("switch", {+ name: "Show the 'Email' field in the PDF",+ });+ await expect(buyerEmailSwitch).toBeChecked();+ await buyerEmailSwitch.click();+ await expect(buyerEmailSwitch).not.toBeChecked();++ const finalSection = page.getByTestId("final-section");+ await finalSection+ .getByRole("textbox", { name: "Notes", exact: true })+ .fill(+ `Test: ${testInfo.title} - emails hidden (${testInfo.project.name})`,+ );++ // eslint-disable-next-line playwright/no-wait-for-timeout+ await page.waitForTimeout(700);++ const downloadPdfButton = page.getByRole("link", {+ name: "Download PDF in English",+ });+ await expect(downloadPdfButton).toBeVisible();+ await expect(downloadPdfButton).toBeEnabled();++ // Download PDF with emails hidden (toggled off via inline form)+ const [download] = await Promise.all([+ page.waitForEvent("download"),+ downloadPdfButton.click(),+ ]);++ const pdfFilePath = path.join(+ downloadDir,+ `${browserName}-${download.suggestedFilename()}`,+ );+ await download.saveAs(pdfFilePath);++ const absolutePath = path.resolve(pdfFilePath);+ await expect.poll(() => fs.existsSync(absolutePath)).toBe(true);++ const pdfBytes = fs.readFileSync(absolutePath);+ await page.goto("about:blank");+ await renderPdfOnCanvas(page, pdfBytes);+ await page.waitForFunction(+ () =>+ (window as unknown as { __PDF_RENDERED__: boolean })+ .__PDF_RENDERED__ === true,+ );++ await expect(page.locator("canvas")).toHaveScreenshot(+ "email-hidden-in-pdf-default-template.png",+ );++ /*+ * PHASE 2: Save seller/buyer via dialog with email ON -> PDF screenshot (emails visible)+ */++ await page.goto("/?template=default");+ await expect(page).toHaveURL("/?template=default");++ // Create seller via dialog with email visible+ await page.getByRole("button", { name: "New Seller" }).click();++ const manageSellerDialog = page.getByTestId("manage-seller-dialog");++ await manageSellerDialog+ .getByRole("textbox", { name: "Name (Required)" })+ .fill("Email Visibility Test Seller");++ await manageSellerDialog+ .getByRole("textbox", { name: "Address (Required)" })+ .fill("123 Seller Street\nSeller City, 10001");++ await manageSellerDialog+ .getByRole("textbox", { name: "Email" })+ .fill("[email protected]");++ // Verify email visibility switch is checked by default in dialog+ const sellerEmailSwitchInDialog = manageSellerDialog.getByRole("switch", {+ name: "Show the 'Email' field in the PDF",+ });+ await expect(sellerEmailSwitchInDialog).toBeVisible();+ await expect(sellerEmailSwitchInDialog).toBeChecked();++ await manageSellerDialog+ .getByRole("button", { name: "Save Seller" })+ .click();++ await expect(manageSellerDialog).toBeHidden();++ await expect(+ page.getByText("Seller added and applied to invoice", { exact: true }),+ ).toBeVisible();++ // eslint-disable-next-line playwright/no-wait-for-timeout+ await page.waitForTimeout(700);++ // Create buyer via dialog with email visible+ await page.getByRole("button", { name: "New Buyer" }).click();++ const manageBuyerDialog = page.getByTestId("manage-buyer-dialog");++ await manageBuyerDialog+ .getByRole("textbox", { name: "Name (Required)" })+ .fill("Email Visibility Test Buyer");++ await manageBuyerDialog+ .getByRole("textbox", { name: "Address (Required)" })+ .fill("456 Buyer Avenue\nBuyer City, 20002");++ await manageBuyerDialog+ .getByRole("textbox", { name: "Email" })+ .fill("[email protected]");++ // Verify email visibility switch is checked by default in dialog+ const buyerEmailSwitchInDialog = manageBuyerDialog.getByRole("switch", {+ name: "Show the 'Email' field in the PDF",+ });+ await expect(buyerEmailSwitchInDialog).toBeVisible();+ await expect(buyerEmailSwitchInDialog).toBeChecked();++ await manageBuyerDialog.getByRole("button", { name: "Save Buyer" }).click();++ await expect(manageBuyerDialog).toBeHidden();++ await expect(+ page.getByText("Buyer added and applied to invoice", { exact: true }),+ ).toBeVisible();++ const newFinalSection = page.getByTestId("final-section");+ await newFinalSection+ .getByRole("textbox", { name: "Notes", exact: true })+ .fill(+ `Test: ${testInfo.title} - emails visible (${testInfo.project.name})`,+ );++ // eslint-disable-next-line playwright/no-wait-for-timeout+ await page.waitForTimeout(700);++ const newDownloadPdfButton = page.getByRole("link", {+ name: "Download PDF in English",+ });+ await expect(newDownloadPdfButton).toBeVisible();+ await expect(newDownloadPdfButton).toBeEnabled();++ // Download PDF with emails visible (saved via dialog)+ const [downloadVisible] = await Promise.all([+ page.waitForEvent("download"),+ newDownloadPdfButton.click(),+ ]);++ const visiblePdfFilePath = path.join(+ downloadDir,+ `${browserName}-visible-${downloadVisible.suggestedFilename()}`,+ );+ await downloadVisible.saveAs(visiblePdfFilePath);++ const visibleAbsolutePath = path.resolve(visiblePdfFilePath);+ await expect.poll(() => fs.existsSync(visibleAbsolutePath)).toBe(true);++ const visiblePdfBytes = fs.readFileSync(visibleAbsolutePath);+ await page.goto("about:blank");+ await renderPdfOnCanvas(page, visiblePdfBytes);+ await page.waitForFunction(+ () =>+ (window as unknown as { __PDF_RENDERED__: boolean })+ .__PDF_RENDERED__ === true,+ );++ await expect(page.locator("canvas")).toHaveScreenshot(+ "email-visible-in-pdf-default-template.png",+ );+ });});diff --git a/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/email-hidden-in-pdf-default-template-Desktop-Chrome-darwin.png b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/email-hidden-in-pdf-default-template-Desktop-Chrome-darwin.pngnew file mode 100644index 0000000..506033cBinary files /dev/null and b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/email-hidden-in-pdf-default-template-Desktop-Chrome-darwin.png differdiff --git a/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/email-hidden-in-pdf-default-template-Mobile-Chrome-darwin.png b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/email-hidden-in-pdf-default-template-Mobile-Chrome-darwin.pngnew file mode 100644index 0000000..2ca28c6Binary files /dev/null and b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/email-hidden-in-pdf-default-template-Mobile-Chrome-darwin.png differdiff --git a/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/email-hidden-in-pdf-default-template-Mobile-Safari-darwin.png b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/email-hidden-in-pdf-default-template-Mobile-Safari-darwin.pngnew file mode 100644index 0000000..a761362Binary files /dev/null and b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/email-hidden-in-pdf-default-template-Mobile-Safari-darwin.png differdiff --git a/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/email-visible-in-pdf-default-template-Desktop-Chrome-darwin.png b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/email-visible-in-pdf-default-template-Desktop-Chrome-darwin.pngnew file mode 100644index 0000000..da6ac60Binary files /dev/null and b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/email-visible-in-pdf-default-template-Desktop-Chrome-darwin.png differdiff --git a/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/email-visible-in-pdf-default-template-Mobile-Chrome-darwin.png b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/email-visible-in-pdf-default-template-Mobile-Chrome-darwin.pngnew file mode 100644index 0000000..9c604ebBinary files /dev/null and b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/email-visible-in-pdf-default-template-Mobile-Chrome-darwin.png differdiff --git a/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/email-visible-in-pdf-default-template-Mobile-Safari-darwin.png b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/email-visible-in-pdf-default-template-Mobile-Safari-darwin.pngnew file mode 100644index 0000000..7c2ced4Binary files /dev/null and b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/email-visible-in-pdf-default-template-Mobile-Safari-darwin.png differdiff --git a/e2e/generate-invoice-link.test.ts b/e2e/generate-invoice-link.test.tsindex 3ac0085..c8515f5 100644--- a/e2e/generate-invoice-link.test.ts+++ b/e2e/generate-invoice-link.test.ts@@ -10,6 +10,7 @@ const TEST_SELLER_DATA = {vatNoLabelText: "SELLER TEST TAX no label",email: "[email protected]",+ emailFieldIsVisible: true,accountNumberFieldIsVisible: true,accountNumber: "1234 seller test account number",@@ -26,6 +27,7 @@ const TEST_BUYER_DATA = {address: "456 Buyer Ave",email: "[email protected]",+ emailFieldIsVisible: true,vatNoFieldIsVisible: true,vatNo: "1234 buyer test tax number",@@ -46,6 +48,9 @@ test.describe("Generate Invoice Link", () => {page,context,}) => {+ // Verify shared invoice badge is NOT visible before sharing+ await expect(page.getByTestId("shared-invoice-badge")).toBeHidden();+// Fill in some test dataconst invoiceNumberFieldset = page.getByRole("group", {name: "Invoice Number",@@ -307,6 +312,12 @@ test.describe("Generate Invoice Link", () => {await expect(newQrCodeDescriptionField).toHaveValue("QR Code TEST Description",);++ // Verify shared invoice badge is visible on the new page+ const sharedInvoiceBadge = newPage.getByTestId("shared-invoice-badge");++ await expect(sharedInvoiceBadge).toBeVisible();+ await expect(sharedInvoiceBadge).toHaveText("Shared invoice");});test("shows error notification when invoice link is broken", async ({@@ -711,6 +722,9 @@ test.describe("Generate Invoice Link", () => {}),).toHaveValue(INVOICE_TEST_DATA.invoiceItemAmount);+ // Verify shared invoice badge is visible before modification+ await expect(newPage.getByTestId("shared-invoice-badge")).toBeVisible();+/*** MODIFY INVOICE DATA AND TRIGGER TOAST*/@@ -733,6 +747,9 @@ test.describe("Generate Invoice Link", () => {// Verify the data parameter is removed from URL after modificationawait expect(newPage).toHaveURL("?template=default");++ // Verify shared invoice badge is hidden after modification+ await expect(newPage.getByTestId("shared-invoice-badge")).toBeHidden();});test("shows error toast when invoice data exceeds URL size limit", async ({diff --git a/e2e/invoice-form.test.ts b/e2e/invoice-form.test.tsindex 1d740f8..67e2208 100644--- a/e2e/invoice-form.test.ts+++ b/e2e/invoice-form.test.ts@@ -1376,20 +1376,16 @@ test.describe("Invoice Generator Page", () => {// we set the system time to a fixed date, so that the invoice number and other dates are consistent across testsawait page.clock.setSystemTime(new Date("2025-12-01T00:00:00Z"));- // Navigate to the pageawait page.goto("/?template=default");await expect(page).toHaveURL("/?template=default");- // Get the general information sectionconst generalInfoSection = page.getByRole("region", {name: "General Information",});-- // Set date of issue to a past date (not today)const dateOfIssueInput = generalInfoSection.getByLabel("Date of Issue");await dateOfIssueInput.fill("2024-01-15");- // Verify "Date of issue is not today" message appears+ // Verify per-field "Date of issue is not today" inline helper messageawait expect(generalInfoSection.getByText("Date of issue is not today"),).toBeVisible();@@ -1397,16 +1393,14 @@ test.describe("Invoice Generator Page", () => {const dateOfIssueBtn = generalInfoSection.getByRole("button", {name: "Set date of issue to today (2025-12-01)",});-- // Verify the helper button to set date to today is visibleawait expect(dateOfIssueBtn).toBeVisible();await expect(dateOfIssueBtn).toBeEnabled();// Set date of service to a date that's not the last day of current monthconst dateOfServiceInput = generalInfoSection.getByLabel("Date of Service");- await dateOfServiceInput.fill("2024-01-15");+ await dateOfServiceInput.fill("2024-01-20");- // Verify "Date of service is not the last day of the current month" message appears+ // Verify per-field "Date of service is not the last day of the current month" inline helper messageawait expect(generalInfoSection.getByText("Date of service is not the last day of the current month",@@ -1416,45 +1410,104 @@ test.describe("Invoice Generator Page", () => {const dateOfServiceBtn = generalInfoSection.getByRole("button", {name: "Set date of service to month end (2025-12-31)",});-- // Verify the helper button to set date to month end is visibleawait expect(dateOfServiceBtn).toBeVisible();await expect(dateOfServiceBtn).toBeEnabled();- // Verify the "Update all dates" section appears+ // Set invoice number to an old month to trigger stale state+ const invoiceNumberInput = generalInfoSection.getByLabel("Value");+ await invoiceNumberInput.fill("1/01-2024");++ // Verify per-field "Invoice number does not match current month" inline helper messageawait expect(generalInfoSection.getByText(- "Some dates are out of date. Click the button below to update all dates at once:",+ "Invoice number does not match current month",),).toBeVisible();- // Verify the "Update all dates" button is visible- const updateAllDatesButton = generalInfoSection.getByRole("button", {- name: "Update all dates",+ const invoiceNumberBtn = generalInfoSection.getByRole("button", {+ name: "Set invoice number to current month (1/12-2025)",+ });+ await expect(invoiceNumberBtn).toBeVisible();+ await expect(invoiceNumberBtn).toBeEnabled();++ // Set payment due to a stale date (date of issue + 1 day instead of + 14 days)+ const paymentDueInput = page.getByLabel("Payment Due");+ await paymentDueInput.fill("2024-01-16");++ const paymentDueBtn = page.getByRole("button", {+ name: "Set payment due date to 2024-01-29 (14 days from issue date)",+ });+ await expect(paymentDueBtn).toBeVisible();+ await expect(paymentDueBtn).toBeEnabled();++ // Verify the OutOfDateDatesHelper component appears with the table-based UI+ const outOfDateHelper = page.getByTestId("out-of-date-dates-helper");+ await expect(outOfDateHelper).toBeVisible();++ // Verify the header shows the correct count of stale fields+ await expect(+ outOfDateHelper.getByText("4 fields are out of date"),+ ).toBeVisible();++ // Verify each stale field appears as a row in the table+ await expect(+ outOfDateHelper.getByText("Date of issue", { exact: true }),+ ).toBeVisible();+ await expect(+ outOfDateHelper.getByText("Date of service", { exact: true }),+ ).toBeVisible();+ await expect(+ outOfDateHelper.getByText("Invoice number", { exact: true }),+ ).toBeVisible();+ await expect(+ outOfDateHelper.getByText("Payment due", { exact: true }),+ ).toBeVisible();++ // Verify the table shows old → new values for date fields+ await expect(outOfDateHelper.getByText("2024-01-15")).toBeVisible();+ await expect(outOfDateHelper.getByText("2024-01-20")).toBeVisible();+ await expect(outOfDateHelper.getByText("2025-12-01")).toBeVisible();+ await expect(outOfDateHelper.getByText("2025-12-31")).toBeVisible();++ // Verify old and new invoice number values in the table+ await expect(outOfDateHelper.getByText("1/01-2024")).toBeVisible();+ await expect(outOfDateHelper.getByText("1/12-2025")).toBeVisible();++ // Verify old and new payment due values in the table+ await expect(outOfDateHelper.getByText("2024-01-16")).toBeVisible();+ await expect(outOfDateHelper.getByText("2025-12-15")).toBeVisible();++ // Verify the "Update All Dates" button is visible+ const updateAllDatesButton = outOfDateHelper.getByRole("button", {+ name: "Update All Dates",});await expect(updateAllDatesButton).toBeVisible();- // Click the "Update all dates" button+ // Click the "Update All Dates" buttonawait updateAllDatesButton.click();- // Verify that the helper messages are no longer visible after update+ // Verify the OutOfDateDatesHelper component disappears+ await expect(outOfDateHelper).toBeHidden();++ // Verify the success toast is visible+ await expect(+ page.getByText("All dates updated successfully"),+ ).toBeVisible();+ // Verify per-field inline helper messages are goneawait expect(generalInfoSection.getByText("Date of issue is not today"),).toBeHidden();- await expect(dateOfIssueInput).toHaveValue("2025-12-01");-await expect(generalInfoSection.getByText("Date of service is not the last day of the current month",),).toBeHidden();- await expect(dateOfServiceInput).toHaveValue("2025-12-31");- await expect(- generalInfoSection.getByText(- "Some dates are out of date. Click the button below to update all dates at once:",- ),- ).toBeHidden();+ // Verify all fields were updated to correct values+ await expect(dateOfIssueInput).toHaveValue("2025-12-01");+ await expect(dateOfServiceInput).toHaveValue("2025-12-31");+ await expect(invoiceNumberInput).toHaveValue("1/12-2025");+ await expect(paymentDueInput).toHaveValue("2025-12-15");});});diff --git a/e2e/seller.test.ts b/e2e/seller.test.tsindex d9aa0fe..5154d0b 100644--- a/e2e/seller.test.ts+++ b/e2e/seller.test.ts@@ -1,4 +1,3 @@-import { SELLER_TOOLTIP_CONTENT } from "@/app/(app)/components/invoice-form/sections/seller-information";import { DEFAULT_SELLER_DATA } from "@/app/constants";import { type SellerData } from "@/app/schema";import { expect, test } from "@playwright/test";@@ -24,6 +23,7 @@ test.describe("Seller management", () => {vatNoLabelText: "Tax Number",email: "[email protected]",+ emailFieldIsVisible: true,accountNumberFieldIsVisible: true,accountNumber: "1234-5678-9012-3456",@@ -87,6 +87,10 @@ test.describe("Seller management", () => {.getByRole("textbox", { name: "SWIFT/BIC" }).fill(TEST_SELLER_DATA.swiftBic);+ const emailSwitchInDialogForm = manageSellerDialog.getByRole("switch", {+ name: `Show the 'Email' field in the PDF`,+ });+const taxNumberSwitchInDialogForm = manageSellerDialog.getByRole("switch", {name: `Show the 'Tax Number' field in the PDF`,});@@ -102,10 +106,16 @@ test.describe("Seller management", () => {});// Verify all switches are checked by default+ await expect(emailSwitchInDialogForm).toBeChecked();await expect(taxNumberSwitchInDialogForm).toBeChecked();await expect(accountNumberSwitchInDialogForm).toBeChecked();await expect(swiftBicSwitchInDialogForm).toBeChecked();+ // Toggle Email visibility switch+ await emailSwitchInDialogForm.click();++ await expect(emailSwitchInDialogForm).not.toBeChecked();+// Toggle some visibility switchesawait accountNumberSwitchInDialogForm.click(); // Toggle Account Number visibility@@ -162,6 +172,7 @@ test.describe("Seller management", () => {vatNoLabelText: TEST_SELLER_DATA.vatNoLabelText,email: TEST_SELLER_DATA.email,+ emailFieldIsVisible: false,accountNumber: TEST_SELLER_DATA.accountNumber,accountNumberFieldIsVisible: false,@@ -185,20 +196,21 @@ test.describe("Seller management", () => {// Verify all saved details in the Seller Information section formconst sellerForm = page.getByTestId(`seller-information-section`);- // Check that HTML title attributes contain the tooltip message on input fields- const nameInput = sellerForm.getByRole("textbox", { name: "Name" });- await expect(nameInput).toHaveAttribute("title", SELLER_TOOLTIP_CONTENT);+ // Verify the locked banner is visible with correct text+ const sellerLockedBanner = sellerForm.getByTestId("seller-locked-banner");+ await expect(sellerLockedBanner).toBeVisible();+ await expect(sellerLockedBanner).toContainText(+ 'To modify seller details, click the "Edit seller" button (pencil icon) next to the dropdown above.',+ );// Seller Name- await expect(nameInput).toHaveAttribute("aria-readonly", "true");- await expect(nameInput).toHaveValue(TEST_SELLER_DATA.name);+ await expect(+ sellerForm.getByRole("textbox", { name: "Name (Required)" }),+ ).toHaveValue(TEST_SELLER_DATA.name);// Seller Addressawait expect(- sellerForm.getByRole("textbox", { name: "Address" }),- ).toHaveAttribute("aria-readonly", "true");- await expect(- sellerForm.getByRole("textbox", { name: "Address" }),+ sellerForm.getByRole("textbox", { name: "Address (Required)" }),).toHaveValue(TEST_SELLER_DATA.address);// Seller Tax Number@@ -206,17 +218,10 @@ test.describe("Seller management", () => {name: "Seller Tax Number",});- await expect(- sellerVatFieldset.getByRole("textbox", { name: "Label" }),- ).toHaveAttribute("aria-readonly", "true");await expect(sellerVatFieldset.getByRole("textbox", { name: "Label" }),).toHaveValue(TEST_SELLER_DATA.vatNoLabelText);- await expect(- sellerVatFieldset.getByRole("textbox", { name: "Value" }),- ).toHaveAttribute("aria-readonly", "true");-await expect(sellerVatFieldset.getByRole("textbox", { name: "Value" }),).toHaveValue(TEST_SELLER_DATA.vatNo);@@ -227,17 +232,18 @@ test.describe("Seller management", () => {await expect(vatNumberSwitch).toBeDisabled();// Seller Email- await expect(- sellerForm.getByRole("textbox", { name: "Email" }),- ).toHaveAttribute("aria-readonly", "true");await expect(sellerForm.getByRole("textbox", { name: "Email" }),).toHaveValue(TEST_SELLER_DATA.email);+ const emailSwitchNotInDialog = sellerForm.getByRole("switch", {+ name: `Show the 'Email' field in the PDF`,+ });+ // Verify Email switch is not checked as we toggled it off+ await expect(emailSwitchNotInDialog).not.toBeChecked();+ await expect(emailSwitchNotInDialog).toBeDisabled();+// Seller Account Number- await expect(- sellerForm.getByRole("textbox", { name: "Account Number" }),- ).toHaveAttribute("aria-readonly", "true");await expect(sellerForm.getByRole("textbox", { name: "Account Number" }),).toHaveValue(TEST_SELLER_DATA.accountNumber);@@ -250,9 +256,6 @@ test.describe("Seller management", () => {await expect(accountNumberSwitchNotInDialog).toBeDisabled();// Seller SWIFT/BIC- await expect(- sellerForm.getByRole("textbox", { name: "SWIFT/BIC" }),- ).toHaveAttribute("aria-readonly", "true");await expect(sellerForm.getByRole("textbox", { name: "SWIFT/BIC" }),).toHaveValue(TEST_SELLER_DATA.swiftBic);@@ -265,9 +268,6 @@ test.describe("Seller management", () => {await expect(swiftBicSwitchNotInDialog).toBeDisabled();// Seller Notes- await expect(- sellerForm.getByRole("textbox", { name: "Notes" }),- ).toHaveAttribute("aria-readonly", "true");await expect(sellerForm.getByRole("textbox", { name: "Notes" }),).toHaveValue(TEST_SELLER_DATA.notes);@@ -322,6 +322,7 @@ test.describe("Seller management", () => {).toHaveValue(TEST_SELLER_DATA.swiftBic);// Verify visibility switches state persisted in edit dialog+ await expect(emailSwitchInDialogForm).not.toBeChecked();await expect(taxNumberSwitchInDialogForm).toBeChecked();await expect(accountNumberSwitchInDialogForm).not.toBeChecked();await expect(swiftBicSwitchInDialogForm).not.toBeChecked();@@ -347,6 +348,7 @@ test.describe("Seller management", () => {name: "Unapplied Test Seller",address: "99 Unapplied Street",email: "[email protected]",+ emailFieldIsVisible: true,vatNoFieldIsVisible: true,vatNo: "VAT999",@@ -421,6 +423,7 @@ test.describe("Seller management", () => {name: "Dropdown Test Seller",address: "42 Dropdown Lane",email: "[email protected]",+ emailFieldIsVisible: true,vatNoFieldIsVisible: true,vatNo: "VAT-DROP-001",@@ -464,6 +467,9 @@ test.describe("Seller management", () => {// Seller is currently selected in dropdownawait expect(sellerDropdown).not.toHaveValue("");+ // Verify locked banner is visible when seller is selected+ await expect(sellerForm.getByTestId("seller-locked-banner")).toBeVisible();+// Restore to default by selecting the empty optionawait sellerDropdown.selectOption("");@@ -472,6 +478,9 @@ test.describe("Seller management", () => {page.getByText("Seller restored to default", { exact: true }),).toBeVisible();+ // Verify locked banner is hidden after deselecting seller+ await expect(sellerForm.getByTestId("seller-locked-banner")).toBeHidden();+// Verify form reset to default valuesawait expect(sellerForm.getByRole("textbox", { name: "Name" })).toHaveValue(DEFAULT_SELLER_DATA.name,@@ -493,6 +502,9 @@ test.describe("Seller management", () => {}),).toBeVisible();+ // Verify locked banner is visible again after reselecting seller+ await expect(sellerForm.getByTestId("seller-locked-banner")).toBeVisible();+// Verify form fields are populated with the seller's dataawait expect(sellerForm.getByRole("textbox", { name: "Name" })).toHaveValue(TEST_SELLER_DATA.name,@@ -513,6 +525,7 @@ test.describe("Seller management", () => {name: "Test Delete Seller",address: "123 Delete Street",email: "[email protected]",+ emailFieldIsVisible: true,vatNoFieldIsVisible: true,vatNo: "123456789",diff --git a/e2e/stripe-invoice-template/stripe-invoice-template.test.ts b/e2e/stripe-invoice-template/stripe-invoice-template.test.tsindex e7a9fe2..ea37bdd 100644--- a/e2e/stripe-invoice-template/stripe-invoice-template.test.ts+++ b/e2e/stripe-invoice-template/stripe-invoice-template.test.ts@@ -1323,4 +1323,234 @@ test.describe("Stripe Invoice Template", () => {"stripe-template-multi-pages.png",);});++ test("toggles seller and buyer email visibility in PDF", async ({+ page,+ browserName,+ downloadDir,+ }, testInfo) => {+ await expect(page).toHaveURL("/?template=default");++ // Switch to Stripe template+ await page+ .getByRole("combobox", { name: "Invoice Template" })+ .selectOption("stripe");++ await expect(page).toHaveURL("/?template=stripe");++ /*+ * PHASE 1: Fill inline form with email switch OFF -> PDF screenshot (emails hidden)+ */++ const sellerSection = page.getByTestId("seller-information-section");+ const buyerSection = page.getByTestId("buyer-information-section");++ // Fill seller fields inline (no saved seller selected, so switch is enabled)+ await sellerSection+ .getByRole("textbox", { name: "Name (Required)" })+ .fill("Email Visibility Test Seller");++ await sellerSection+ .getByRole("textbox", { name: "Address (Required)" })+ .fill("123 Seller Street\nSeller City, 10001");++ await sellerSection+ .getByRole("textbox", { name: "Email" })+ .fill("[email protected]");++ // Toggle seller email switch OFF via inline form+ const sellerEmailSwitch = sellerSection.getByRole("switch", {+ name: "Show the 'Email' field in the PDF",+ });+ await expect(sellerEmailSwitch).toBeChecked();+ await sellerEmailSwitch.click();+ await expect(sellerEmailSwitch).not.toBeChecked();++ // Fill buyer fields inline (no saved buyer selected, so switch is enabled)+ await buyerSection+ .getByRole("textbox", { name: "Name (Required)" })+ .fill("Email Visibility Test Buyer");++ await buyerSection+ .getByRole("textbox", { name: "Address (Required)" })+ .fill("456 Buyer Avenue\nBuyer City, 20002");++ await buyerSection+ .getByRole("textbox", { name: "Email" })+ .fill("[email protected]");++ // Toggle buyer email switch OFF via inline form+ const buyerEmailSwitch = buyerSection.getByRole("switch", {+ name: "Show the 'Email' field in the PDF",+ });+ await expect(buyerEmailSwitch).toBeChecked();+ await buyerEmailSwitch.click();+ await expect(buyerEmailSwitch).not.toBeChecked();++ const finalSection = page.getByTestId("final-section");+ await finalSection+ .getByRole("textbox", { name: "Notes", exact: true })+ .fill(+ `Test: ${testInfo.title} - emails hidden (${testInfo.project.name})`,+ );++ // wait for debounce timeout+ // eslint-disable-next-line playwright/no-wait-for-timeout+ await page.waitForTimeout(700);++ const downloadPdfButton = page.getByRole("link", {+ name: "Download PDF in English",+ });+ await expect(downloadPdfButton).toBeVisible();+ await expect(downloadPdfButton).toBeEnabled();++ // Download PDF with emails hidden (toggled off via inline form)+ const [download] = await Promise.all([+ page.waitForEvent("download"),+ downloadPdfButton.click(),+ ]);++ const pdfFilePath = path.join(+ downloadDir,+ `${browserName}-${download.suggestedFilename()}`,+ );+ await download.saveAs(pdfFilePath);++ const absolutePath = path.resolve(pdfFilePath);+ await expect.poll(() => fs.existsSync(absolutePath)).toBe(true);++ const pdfBytes = fs.readFileSync(absolutePath);+ await page.goto("about:blank");+ await renderPdfOnCanvas(page, pdfBytes);+ await page.waitForFunction(+ () =>+ (window as unknown as { __PDF_RENDERED__: boolean })+ .__PDF_RENDERED__ === true,+ );++ await expect(page.locator("canvas")).toHaveScreenshot(+ "email-hidden-in-pdf-stripe-template.png",+ );++ /*+ * PHASE 2: Save seller/buyer via dialog with email ON -> PDF screenshot (emails visible)+ */++ await page.goto("/");+ await expect(page).toHaveURL("/?template=stripe");++ // Create seller via dialog with email visible+ await page.getByRole("button", { name: "New Seller" }).click();++ const manageSellerDialog = page.getByTestId("manage-seller-dialog");++ await manageSellerDialog+ .getByRole("textbox", { name: "Name (Required)" })+ .fill("Email Visibility Test Seller");++ await manageSellerDialog+ .getByRole("textbox", { name: "Address (Required)" })+ .fill("123 Seller Street\nSeller City, 10001");++ await manageSellerDialog+ .getByRole("textbox", { name: "Email" })+ .fill("[email protected]");++ // Verify email visibility switch is checked by default in dialog+ const sellerEmailSwitchInDialog = manageSellerDialog.getByRole("switch", {+ name: "Show the 'Email' field in the PDF",+ });+ await expect(sellerEmailSwitchInDialog).toBeVisible();+ await expect(sellerEmailSwitchInDialog).toBeChecked();++ await manageSellerDialog+ .getByRole("button", { name: "Save Seller" })+ .click();++ await expect(manageSellerDialog).toBeHidden();++ await expect(+ page.getByText("Seller added and applied to invoice", { exact: true }),+ ).toBeVisible();++ // wait for debounce timeout+ // eslint-disable-next-line playwright/no-wait-for-timeout+ await page.waitForTimeout(700);++ // Create buyer via dialog with email visible+ await page.getByRole("button", { name: "New Buyer" }).click();++ const manageBuyerDialog = page.getByTestId("manage-buyer-dialog");++ await manageBuyerDialog+ .getByRole("textbox", { name: "Name (Required)" })+ .fill("Email Visibility Test Buyer");++ await manageBuyerDialog+ .getByRole("textbox", { name: "Address (Required)" })+ .fill("456 Buyer Avenue\nBuyer City, 20002");++ await manageBuyerDialog+ .getByRole("textbox", { name: "Email" })+ .fill("[email protected]");++ // Verify email visibility switch is checked by default in dialog+ const buyerEmailSwitchInDialog = manageBuyerDialog.getByRole("switch", {+ name: "Show the 'Email' field in the PDF",+ });+ await expect(buyerEmailSwitchInDialog).toBeVisible();+ await expect(buyerEmailSwitchInDialog).toBeChecked();++ await manageBuyerDialog.getByRole("button", { name: "Save Buyer" }).click();++ await expect(manageBuyerDialog).toBeHidden();++ await expect(+ page.getByText("Buyer added and applied to invoice", { exact: true }),+ ).toBeVisible();++ const newFinalSection = page.getByTestId("final-section");+ await newFinalSection+ .getByRole("textbox", { name: "Notes", exact: true })+ .fill(+ `Test: ${testInfo.title} - emails visible (${testInfo.project.name})`,+ );++ // eslint-disable-next-line playwright/no-wait-for-timeout+ await page.waitForTimeout(700);++ const newDownloadPdfButton = page.getByRole("link", {+ name: "Download PDF in English",+ });+ await expect(newDownloadPdfButton).toBeVisible();+ await expect(newDownloadPdfButton).toBeEnabled();++ // Download PDF with emails visible (saved via dialog)+ const [downloadVisible] = await Promise.all([+ page.waitForEvent("download"),+ newDownloadPdfButton.click(),+ ]);++ const visiblePdfFilePath = path.join(+ downloadDir,+ `${browserName}-visible-${downloadVisible.suggestedFilename()}`,+ );+ await downloadVisible.saveAs(visiblePdfFilePath);++ const visibleAbsolutePath = path.resolve(visiblePdfFilePath);+ await expect.poll(() => fs.existsSync(visibleAbsolutePath)).toBe(true);++ const visiblePdfBytes = fs.readFileSync(visibleAbsolutePath);+ await page.goto("about:blank");+ await renderPdfOnCanvas(page, visiblePdfBytes);+ await page.waitForFunction(+ () =>+ (window as unknown as { __PDF_RENDERED__: boolean })+ .__PDF_RENDERED__ === true,+ );++ await expect(page.locator("canvas")).toHaveScreenshot(+ "email-visible-in-pdf-stripe-template.png",+ );+ });});diff --git a/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/email-hidden-in-pdf-stripe-template-Desktop-Chrome-darwin.png b/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/email-hidden-in-pdf-stripe-template-Desktop-Chrome-darwin.pngnew file mode 100644index 0000000..a94e310Binary files /dev/null and b/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/email-hidden-in-pdf-stripe-template-Desktop-Chrome-darwin.png differdiff --git a/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/email-hidden-in-pdf-stripe-template-Mobile-Chrome-darwin.png b/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/email-hidden-in-pdf-stripe-template-Mobile-Chrome-darwin.pngnew file mode 100644index 0000000..5ef6609Binary files /dev/null and b/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/email-hidden-in-pdf-stripe-template-Mobile-Chrome-darwin.png differdiff --git a/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/email-hidden-in-pdf-stripe-template-Mobile-Safari-darwin.png b/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/email-hidden-in-pdf-stripe-template-Mobile-Safari-darwin.pngnew file mode 100644index 0000000..22c9d3eBinary files /dev/null and b/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/email-hidden-in-pdf-stripe-template-Mobile-Safari-darwin.png differdiff --git a/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/email-visible-in-pdf-stripe-template-Desktop-Chrome-darwin.png b/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/email-visible-in-pdf-stripe-template-Desktop-Chrome-darwin.pngnew file mode 100644index 0000000..4dbb2a4Binary files /dev/null and b/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/email-visible-in-pdf-stripe-template-Desktop-Chrome-darwin.png differdiff --git a/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/email-visible-in-pdf-stripe-template-Mobile-Chrome-darwin.png b/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/email-visible-in-pdf-stripe-template-Mobile-Chrome-darwin.pngnew file mode 100644index 0000000..20a042fBinary files /dev/null and b/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/email-visible-in-pdf-stripe-template-Mobile-Chrome-darwin.png differdiff --git a/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/email-visible-in-pdf-stripe-template-Mobile-Safari-darwin.png b/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/email-visible-in-pdf-stripe-template-Mobile-Safari-darwin.pngnew file mode 100644index 0000000..87c40eeBinary files /dev/null and b/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/email-visible-in-pdf-stripe-template-Mobile-Safari-darwin.png differdiff --git a/package.json b/package.jsonindex 0172a5d..dbe5190 100644--- a/package.json+++ b/package.json@@ -3,6 +3,9 @@"version": "1.0.2","private": true,"packageManager": "[email protected]+sha512.3590e550d5384caa39bd5c7c739f72270234b2f6059e13018f975c313b1eb9fefcc09714048765d4d9efe961382c312e624572c0420762bdc5d5940cdf9be73a",+ "pnpm": {+ "minimumReleaseAge": 4320+ },"scripts": {"dev": "next dev","build": "next build",diff --git a/skills-lock.json b/skills-lock.jsonindex feaeb5d..7e73816 100644--- a/skills-lock.json+++ b/skills-lock.json@@ -6,11 +6,21 @@"sourceType": "github","computedHash": "1700614a8a35135a4b7fa466797b224a76a7a34e7a70497ecee4c69ecadc12e3"},+ "emil-design-eng": {+ "source": "emilkowalski/skill",+ "sourceType": "github",+ "computedHash": "32f63a1e56fc41f53497f7b19d6391b7c3e55bedd884c5a4d10bc4eacd2310e4"+ },"frontend-design": {"source": "anthropics/skills","sourceType": "github","computedHash": "063a0e6448123cd359ad0044cc46b0e490cc7964d45ef4bb9fd842bd2ffbca67"},+ "make-interfaces-feel-better": {+ "source": "jakubkrehel/make-interfaces-feel-better",+ "sourceType": "github",+ "computedHash": "41c2416e08bc9ec3c696585d31bd1243481a7a81615b810b1b8a32aded9360b5"+ },"vercel-react-best-practices": {"source": "vercel-labs/agent-skills","sourceType": "github",diff --git a/src/app/(app)/components/index.tsx b/src/app/(app)/components/index.tsxindex 1c0d6a2..2f98117 100644--- a/src/app/(app)/components/index.tsx+++ b/src/app/(app)/components/index.tsx@@ -11,11 +11,11 @@ import { AlertCircleIcon, FileTextIcon, PencilIcon } from "lucide-react";import dynamic from "next/dynamic";import { TWITTER_URL } from "@/config";+import type { Dispatch, SetStateAction } from "react";import { getAppMetadata, updateAppMetadata } from "../utils/get-app-metadata";import { InvoiceForm } from "./invoice-form";import { InvoicePDFDownloadLink } from "./invoice-pdf-download-link";import { MobileFormScrollContainer } from "./mobile-form-scroll-container";-import type { Dispatch, SetStateAction } from "react";const DesktopPDFViewerModuleLoading = () => (<div className="flex h-[580px] w-full items-center justify-center border border-gray-200 bg-gray-200 lg:h-[620px] 2xl:h-[700px]">@@ -264,12 +264,14 @@ export function InvoiceClientPage({isMobile={isMobile}/></div>+ {/** Mobile version */}{invoiceLastUpdatedAtFormatted && (<div className="relative mt-2 text-center text-xs text-zinc-700 duration-500 animate-in fade-in slide-in-from-bottom-2"><span className="font-semibold">Invoice last updated:</span>{" "}{invoiceLastUpdatedAtFormatted}</div>)}+ {/** Mobile version */}<div className="mt-3 flex w-full justify-center"><span className="inline-block text-xs text-zinc-900 duration-500 animate-in fade-in slide-in-from-bottom-2">Made by{" "}diff --git a/src/app/(app)/components/invoice-form/index.tsx b/src/app/(app)/components/invoice-form/index.tsxindex 5f6f729..c2db2ce 100644--- a/src/app/(app)/components/invoice-form/index.tsx+++ b/src/app/(app)/components/invoice-form/index.tsx@@ -389,9 +389,11 @@ export const InvoiceForm = memo(function InvoiceForm({data-testid={`seller-information-section`}><AccordionTrigger className="px-4 py-3">- <Legend>Seller Information</Legend>+ <div className="flex items-center gap-2">+ <Legend>Seller Information</Legend>+ </div></AccordionTrigger>- <AccordionContent className="px-4 pb-4">+ <div className="px-4 pb-4"><SellerInformationcontrol={control}errors={errors}@@ -399,7 +401,7 @@ export const InvoiceForm = memo(function InvoiceForm({invoiceData={invoiceData}isMobile={isMobile}/>- </AccordionContent>+ </div></AccordionItem>{/* Buyer Information */}@@ -409,9 +411,11 @@ export const InvoiceForm = memo(function InvoiceForm({data-testid={`buyer-information-section`}><AccordionTrigger className="px-4 py-3">- <Legend>Buyer Information</Legend>+ <div className="flex items-center gap-2">+ <Legend>Buyer Information</Legend>+ </div></AccordionTrigger>- <AccordionContent className="px-4 pb-4">+ <div className="px-4 pb-4"><BuyerInformationcontrol={control}errors={errors}@@ -419,7 +423,7 @@ export const InvoiceForm = memo(function InvoiceForm({invoiceData={invoiceData}isMobile={isMobile}/>- </AccordionContent>+ </div></AccordionItem>{/* Invoice Items */}diff --git a/src/app/(app)/components/invoice-form/sections/buyer-information.tsx b/src/app/(app)/components/invoice-form/sections/buyer-information.tsxindex 71f2271..d6f479e 100644--- a/src/app/(app)/components/invoice-form/sections/buyer-information.tsx+++ b/src/app/(app)/components/invoice-form/sections/buyer-information.tsx@@ -2,13 +2,14 @@import { type BuyerData, type InvoiceData } from "@/app/schema";import { BuyerManagement } from "@/components/buyer-management";-import { LabelWithEditIcon } from "@/components/label-with-edit-icon";+import { AccordionContent } from "@/components/ui/accordion";import { Input } from "@/components/ui/input";import { InputHelperMessage } from "@/components/ui/input-helper-message";import { Label } from "@/components/ui/label";import { Switch } from "@/components/ui/switch";import { Textarea } from "@/components/ui/textarea";import { CustomTooltip } from "@/components/ui/tooltip";+import { Info } from "lucide-react";import { memo, useState } from "react";import {type Control,@@ -21,9 +22,6 @@ const ErrorMessage = ({ children }: { children: React.ReactNode }) => {return <p className="mt-1 text-xs text-red-600">{children}</p>;};-export const BUYER_TOOLTIP_CONTENT =- "Buyer details are locked. Click the Edit Buyer button (Pencil icon) next to the 'Select Buyer' dropdown to modify buyer details. Any changes will be automatically saved.";-interface BuyerInformationProps {control: Control<InvoiceData>;errors: FieldErrors<InvoiceData>;@@ -42,15 +40,13 @@ export const BuyerInformation = memo(function BuyerInformation({const [selectedBuyerId, setSelectedBuyerId] = useState("");const isBuyerSelected = !!selectedBuyerId;- const HTML_TITLE_CONTENT = isBuyerSelected ? BUYER_TOOLTIP_CONTENT : "";-- // Get current form values to pass to BuyerManagementconst currentFormValues = {name: invoiceData.buyer.name,address: invoiceData.buyer.address,vatNo: invoiceData.buyer.vatNo,vatNoLabelText: invoiceData.buyer.vatNoLabelText,email: invoiceData.buyer.email,+ emailFieldIsVisible: invoiceData.buyer.emailFieldIsVisible,vatNoFieldIsVisible: invoiceData.buyer.vatNoFieldIsVisible,notes: invoiceData.buyer.notes,notesFieldIsVisible: invoiceData.buyer.notesFieldIsVisible,@@ -68,297 +64,239 @@ export const BuyerInformation = memo(function BuyerInformation({isMobile={isMobile}/></div>- <fieldset className="mt-5 space-y-4" disabled={isBuyerSelected}>- <div>+ <AccordionContent className="">+ <fieldset className="mt-5 space-y-4" disabled={isBuyerSelected}>{isBuyerSelected ? (- <LabelWithEditIcon- htmlFor={`buyerName`}- content={BUYER_TOOLTIP_CONTENT}+ <div+ className="flex gap-2 rounded-md border border-blue-200 bg-blue-50 px-3 py-2 text-sm text-blue-800"+ data-testid="buyer-locked-banner">- Name- </LabelWithEditIcon>- ) : (- <Label htmlFor={`buyerName`} className="mb-1">- Name+ <Info className="mt-0.5 size-4 shrink-0" aria-hidden="true" />+ <p className="">+ To modify buyer details, click the "Edit buyer" button+ (pencil icon) next to the dropdown above.+ </p>+ </div>+ ) : null}++ <div>+ <Label htmlFor="buyerName" className="mb-1">+ Name (Required)</Label>- )}- <Controller- name="buyer.name"- control={control}- render={({ field }) => (- <Textarea- {...field}- id={`buyerName`}- rows={3}- className=""- readOnly={isBuyerSelected}- aria-readonly={isBuyerSelected}- title={HTML_TITLE_CONTENT}- />+ <Controller+ name="buyer.name"+ control={control}+ render={({ field }) => (+ <Textarea {...field} id="buyerName" rows={3} />+ )}+ />+ {errors.buyer?.name && (+ <ErrorMessage>{errors.buyer.name.message}</ErrorMessage>)}- />- {errors.buyer?.name && (- <ErrorMessage>{errors.buyer.name.message}</ErrorMessage>- )}- </div>+ </div>- <div>- {isBuyerSelected ? (- <LabelWithEditIcon- htmlFor={`buyerAddress`}- content={BUYER_TOOLTIP_CONTENT}- >- Address- </LabelWithEditIcon>- ) : (- <Label htmlFor={`buyerAddress`} className="mb-1">- Address+ <div>+ <Label htmlFor="buyerAddress" className="mb-1">+ Address (Required)</Label>- )}- <Controller- name="buyer.address"- control={control}- render={({ field }) => (- <Textarea- {...field}- id={`buyerAddress`}- rows={3}- className=""- readOnly={isBuyerSelected}- aria-readonly={isBuyerSelected}- title={HTML_TITLE_CONTENT}- />+ <Controller+ name="buyer.address"+ control={control}+ render={({ field }) => (+ <Textarea {...field} id="buyerAddress" rows={3} />+ )}+ />+ {errors.buyer?.address && (+ <ErrorMessage>{errors.buyer.address.message}</ErrorMessage>)}- />- {errors.buyer?.address && (- <ErrorMessage>{errors.buyer.address.message}</ErrorMessage>- )}- </div>+ </div>++ <div>+ <fieldset className="rounded-md border px-4 pb-4">+ <legend className="text-base font-semibold lg:text-lg">+ Buyer Tax Number+ </legend>- <div>- <fieldset className="rounded-md border px-4 pb-4">- <legend className="text-base font-semibold lg:text-lg">- Buyer Tax Number- </legend>+ <div className="mb-2 flex items-center justify-end">+ <div className="inline-flex items-center gap-2">+ <Controller+ name="buyer.vatNoFieldIsVisible"+ control={control}+ render={({ field: { value, onChange, ...field } }) => (+ <Switch+ {...field}+ id="buyerVatNoFieldIsVisible"+ checked={value}+ onCheckedChange={onChange}+ className="h-5 w-8 [&_span]:size-4 [&_span]:data-[state=checked]:translate-x-3 rtl:[&_span]:data-[state=checked]:-translate-x-3"+ data-testid="buyerVatNoFieldIsVisible"+ aria-label="Show the 'Buyer Tax Number' Field in the PDF"+ />+ )}+ />+ <CustomTooltip+ trigger={+ <Label htmlFor="buyerVatNoFieldIsVisible">+ Show in PDF+ </Label>+ }+ content={+ isBuyerSelected+ ? null+ : "Show the 'Buyer Tax Number' Field in the PDF"+ }+ />+ </div>+ </div>- <div className="mb-2 flex items-center justify-end">- {/* Show Buyer Tax Number field in PDF switch */}- <div- className="inline-flex items-center gap-2"- title={HTML_TITLE_CONTENT}- >+ <div className="space-y-4">+ <div>+ <Label htmlFor="buyerVatNoLabel">Label</Label>+ <Controller+ name="buyer.vatNoLabelText"+ control={control}+ render={({ field }) => (+ <Input+ {...field}+ type="text"+ id="buyerVatNoLabel"+ placeholder="Enter Tax number label"+ className="mt-1 block w-full"+ />+ )}+ />+ {errors.buyer?.vatNoLabelText && (+ <ErrorMessage>+ {errors.buyer.vatNoLabelText.message}+ </ErrorMessage>+ )}+ {!errors.buyer?.vatNoLabelText && (+ <InputHelperMessage>+ Set a custom label (e.g. VAT no, Tax no, etc.)+ </InputHelperMessage>+ )}+ </div>++ <div>+ <Label htmlFor="buyerVatNo">Value</Label>+ <Controller+ name="buyer.vatNo"+ control={control}+ render={({ field }) => (+ <Input+ {...field}+ id="buyerVatNo"+ type="text"+ placeholder="Enter Tax number value"+ className="mt-1 block w-full"+ />+ )}+ />+ {errors.buyer?.vatNo && (+ <ErrorMessage>{errors.buyer.vatNo.message}</ErrorMessage>+ )}+ </div>+ </div>+ </fieldset>+ </div>++ {/* Email */}+ <div>+ <div className="relative mb-2 flex items-center justify-between">+ <Label htmlFor="buyerEmail">Email</Label>++ <div className="inline-flex items-center gap-2"><Controller- name={`buyer.vatNoFieldIsVisible`}+ name="buyer.emailFieldIsVisible"control={control}render={({ field: { value, onChange, ...field } }) => (<Switch{...field}- id={`buyerVatNoFieldIsVisible`}+ id="buyerEmailFieldIsVisible"checked={value}onCheckedChange={onChange}className="h-5 w-8 [&_span]:size-4 [&_span]:data-[state=checked]:translate-x-3 rtl:[&_span]:data-[state=checked]:-translate-x-3"- disabled={isBuyerSelected}- data-testid={`buyerVatNoFieldIsVisible`}- aria-label={`Show the 'Buyer Tax Number' Field in the PDF`}+ data-testid="buyerEmailFieldIsVisible"+ aria-label="Show the 'Email' field in the PDF"/>)}/><CustomTooltiptrigger={- <Label htmlFor={`buyerVatNoFieldIsVisible`}>+ <Label htmlFor="buyerEmailFieldIsVisible">Show in PDF</Label>}content={- isBuyerSelected- ? null- : "Show the 'Buyer Tax Number' Field in the PDF"+ isBuyerSelected ? null : "Show the 'Email' field in the PDF"}/></div></div>+ <Controller+ name="buyer.email"+ control={control}+ render={({ field }) => (+ <Input {...field} id="buyerEmail" type="email" />+ )}+ />+ {errors.buyer?.email && (+ <ErrorMessage>{errors.buyer.email.message}</ErrorMessage>+ )}+ </div>- <div className="space-y-4">- <div>- {isBuyerSelected ? (- <LabelWithEditIcon- htmlFor="buyerVatNoLabel"- content={BUYER_TOOLTIP_CONTENT}- >- Label- </LabelWithEditIcon>- ) : (- <Label htmlFor="buyerVatNoLabel">Label</Label>- )}- <Controller- name="buyer.vatNoLabelText"- control={control}- render={({ field }) => (- <Input- {...field}- type="text"- id="buyerVatNoLabel"- placeholder="Enter Tax number label"- className="mt-1 block w-full"- readOnly={isBuyerSelected}- aria-readonly={isBuyerSelected}- title={HTML_TITLE_CONTENT}- />- )}- />- {errors.buyer?.vatNoLabelText && (- <ErrorMessage>- {errors.buyer.vatNoLabelText.message}- </ErrorMessage>- )}- {!errors.buyer?.vatNoLabelText && (- <InputHelperMessage>- Set a custom label (e.g. VAT no, Tax no, etc.)- </InputHelperMessage>- )}- </div>+ {/* Notes */}+ <div>+ <div className="relative mb-2 flex items-center justify-between">+ <Label htmlFor="buyerNotes">Notes</Label>- <div>- {isBuyerSelected ? (- <LabelWithEditIcon- htmlFor={`buyerVatNo`}- content={BUYER_TOOLTIP_CONTENT}- >- Value- </LabelWithEditIcon>- ) : (- <Label htmlFor={`buyerVatNo`}>Value</Label>- )}+ <div className="inline-flex items-center gap-2"><Controller- name="buyer.vatNo"+ name="buyer.notesFieldIsVisible"control={control}- render={({ field }) => (- <Input+ render={({ field: { value, onChange, ...field } }) => (+ <Switch{...field}- id={`buyerVatNo`}- type="text"- placeholder="Enter Tax number value"- className="mt-1 block w-full"- readOnly={isBuyerSelected}- aria-readonly={isBuyerSelected}- title={HTML_TITLE_CONTENT}+ id="buyerNotesFieldIsVisible"+ checked={value}+ onCheckedChange={onChange}+ className="h-5 w-8 [&_span]:size-4 [&_span]:data-[state=checked]:translate-x-3 rtl:[&_span]:data-[state=checked]:-translate-x-3"+ data-testid="buyerNotesInvoiceFormFieldVisibilitySwitch"+ aria-label="Show the 'Notes' field in the PDF"/>)}/>- {errors.buyer?.vatNo && (- <ErrorMessage>{errors.buyer.vatNo.message}</ErrorMessage>- )}+ <CustomTooltip+ trigger={+ <Label htmlFor="buyerNotesFieldIsVisible">+ Show in PDF+ </Label>+ }+ content={+ isBuyerSelected ? null : "Show the 'Notes' field in the PDF"+ }+ /></div></div>- </fieldset>- </div>- <div>- {isBuyerSelected ? (- <LabelWithEditIcon- htmlFor={`buyerEmail`}- content={BUYER_TOOLTIP_CONTENT}- >- </LabelWithEditIcon>- ) : (- <Label htmlFor={`buyerEmail`} className="mb-1">- </Label>- )}- <Controller- name="buyer.email"- control={control}- render={({ field }) => (- <Input- {...field}- id={`buyerEmail`}- type="email"- className=""- readOnly={isBuyerSelected}- aria-readonly={isBuyerSelected}- title={HTML_TITLE_CONTENT}- />- )}- />- {errors.buyer?.email && (- <ErrorMessage>{errors.buyer.email.message}</ErrorMessage>- )}- </div>-- {/* Notes */}- <div>- <div className="relative mb-2 flex items-center justify-between">- {isBuyerSelected ? (- <LabelWithEditIcon- htmlFor={`buyerNotes`}- content={BUYER_TOOLTIP_CONTENT}- >- Notes- </LabelWithEditIcon>- ) : (- <Label htmlFor={`buyerNotes`} className="">- Notes- </Label>- )}-- {/* Show Notes field in PDF switch */}- <div- className="inline-flex items-center gap-2"- title={HTML_TITLE_CONTENT}- >- <Controller- name={`buyer.notesFieldIsVisible`}- control={control}- render={({ field: { value, onChange, ...field } }) => (- <Switch- {...field}- id={`buyerNotesFieldIsVisible`}- checked={value}- onCheckedChange={onChange}- className="h-5 w-8 [&_span]:size-4 [&_span]:data-[state=checked]:translate-x-3 rtl:[&_span]:data-[state=checked]:-translate-x-3"- disabled={isBuyerSelected}- data-testid={`buyerNotesInvoiceFormFieldVisibilitySwitch`}- aria-label={`Show the 'Notes' field in the PDF`}- />- )}- />- <CustomTooltip- trigger={- <Label htmlFor={`buyerNotesFieldIsVisible`}>- Show in PDF- </Label>- }- content={- isBuyerSelected ? null : "Show the 'Notes' field in the PDF"- }- />- </div>- </div>-- <Controller- name="buyer.notes"- control={control}- render={({ field }) => {- return (+ <Controller+ name="buyer.notes"+ control={control}+ render={({ field }) => (<Textarea{...field}- id={`buyerNotes`}+ id="buyerNotes"rows={3}- className=""- readOnly={isBuyerSelected}- aria-readonly={isBuyerSelected}- title={HTML_TITLE_CONTENT}placeholder="Additional information about the buyer"/>- );- }}- />- {errors.buyer?.notes && (- <ErrorMessage>{errors.buyer.notes.message}</ErrorMessage>- )}- </div>- </fieldset>+ )}+ />+ {errors.buyer?.notes && (+ <ErrorMessage>{errors.buyer.notes.message}</ErrorMessage>+ )}+ </div>+ </fieldset>+ </AccordionContent></div>);});diff --git a/src/app/(app)/components/invoice-form/sections/general-information.tsx b/src/app/(app)/components/invoice-form/sections/general-information.tsxindex 20497b4..063f1df 100644--- a/src/app/(app)/components/invoice-form/sections/general-information.tsx+++ b/src/app/(app)/components/invoice-form/sections/general-information.tsx@@ -20,7 +20,7 @@ import { Switch } from "@/components/ui/switch";import { Textarea } from "@/components/ui/textarea";import { CustomTooltip } from "@/components/ui/tooltip";import dayjs from "dayjs";-import { AlertTriangle, InfoIcon, Upload, X } from "lucide-react";+import { AlertTriangle, RefreshCw, Upload, X } from "lucide-react";import { memo, useCallback, useRef } from "react";import {type Control,@@ -93,6 +93,7 @@ export const GeneralInformation = memo(function GeneralInformation({const template = useWatch({ control, name: "template" });const logo = useWatch({ control, name: "logo" });const selectedDateFormat = useWatch({ control, name: "dateFormat" });+ const paymentDue = useWatch({ control, name: "paymentDue" });const t = INVOICE_PDF_TRANSLATIONS[language];const defaultInvoiceNumber = `${t.invoiceNumber}:`;@@ -170,6 +171,16 @@ export const GeneralInformation = memo(function GeneralInformation({});}, [isMobile, setValue]);+ const isPaymentDueNotMatchingIssueDate =+ !paymentDue ||+ !dayjs(paymentDue).isSame(dayjs(dateOfIssue).add(14, "days"), "day");++ const canShowOutOfDateDatesHelper =+ !isDateOfServiceEqualsEndOfCurrentMonth ||+ !isInvoiceNumberInCurrentMonth ||+ isDateOfIssueNotToday ||+ isPaymentDueNotMatchingIssueDate;+return (<div><div className="space-y-4">@@ -454,7 +465,7 @@ export const GeneralInformation = memo(function GeneralInformation({}}><span className="text-pretty">- Set invoice number as{" "}+ Set invoice number to{" "}<span className="font-bold">current month ({`1/${CURRENT_MONTH_AND_YEAR}`})</span>@@ -475,7 +486,25 @@ export const GeneralInformation = memo(function GeneralInformation({name="dateOfIssue"control={control}render={({ field }) => (- <Input {...field} type="date" id={`dateOfIssue`} className="" />+ <Input+ {...field}+ type="date"+ id={`dateOfIssue`}+ className=""+ onChange={(e) => {+ field.onChange(e);++ const newDate = e.target.value;++ // Automatically update payment due date to 14 days after the new date of issue for better UX+ if (newDate) {+ setValue(+ "paymentDue",+ dayjs(newDate).add(14, "days").format("YYYY-MM-DD"),+ );+ }+ }}+ />)}/>{errors.dateOfIssue && (@@ -493,12 +522,23 @@ export const GeneralInformation = memo(function GeneralInformation({const currentMonth = dayjs().format("YYYY-MM-DD"); // default browser date input format is YYYY-MM-DDsetValue("dateOfIssue", currentMonth);++ // Automatically update payment due date to 14 days after the new date of issue for better UX+ setValue(+ "paymentDue",+ dayjs(currentMonth).add(14, "days").format("YYYY-MM-DD"),+ );}}><span className="text-pretty">Set date of issue to{" "}<span className="font-bold">today ({dayjs().format(selectedDateFormat)})+ </span>{" "}+ and update payment due to{" "}+ <span className="font-bold">+ +14 days (+ {dayjs().add(14, "days").format(selectedDateFormat)})</span></span></ButtonHelper>@@ -550,95 +590,16 @@ export const GeneralInformation = memo(function GeneralInformation({) : null}</div>- {!isDateOfServiceEqualsEndOfCurrentMonth ||- !isInvoiceNumberInCurrentMonth ||- isDateOfIssueNotToday ? (- <div className="max-w-[400px] rounded-md border border-blue-200 bg-blue-50 p-4 shadow-sm shadow-blue-200/50 duration-500 animate-in fade-in slide-in-from-bottom-2">- <InputHelperMessage>- <span className="flex items-start gap-1.5 text-pretty text-blue-800">- <InfoIcon className="mt-0.5 inline-block size-3.5 shrink-0 text-blue-800" />- <div>- <span className="mb-2 inline-block">- Some dates are out of date.{" "}- <span className="underline">Click the button below</span> to- update all dates at once:- </span>- <ul className="list-disc space-y-1 text-balance pl-5">- <li>- Date of issue to{" "}- <span className="font-bold">- today ({dayjs().locale("en").format(selectedDateFormat)}- )- </span>- </li>- <li>- Date of service to{" "}- <span className="font-bold">- end of current month (- {dayjs()- .locale("en")- .endOf("month")- .format(selectedDateFormat)}- )- </span>- </li>- <li>- Invoice number to{" "}- <span className="font-bold">- current month ({`1/${CURRENT_MONTH_AND_YEAR}`})- </span>- </li>- <li>- Payment due date to{" "}- <span className="font-bold">- 14 days from today (- {dayjs()- .locale("en")- .add(14, "days")- .format(selectedDateFormat)}- )- </span>- </li>- </ul>- </div>- </span>-- <Button- type="button"- variant="outline"- size="sm"- className="mt-3 text-slate-950 hover:bg-slate-50 hover:text-slate-900"- onClick={() => {- const today = dayjs().format("YYYY-MM-DD");-- const lastDayOfCurrentMonth = dayjs()- .endOf("month")- .format("YYYY-MM-DD");-- // Update date of service to end of current month- setValue("dateOfService", lastDayOfCurrentMonth);-- // Update date of issue to today- setValue("dateOfIssue", today);-- // Update invoice number to current month/year- setValue(- "invoiceNumberObject.value",- `1/${CURRENT_MONTH_AND_YEAR}`,- );-- // Update payment due date to 14 days from today- const newPaymentDue = dayjs(today)- .add(14, "days")- .format("YYYY-MM-DD");-- setValue("paymentDue", newPaymentDue);- }}- >- Update all dates- </Button>- </InputHelperMessage>- </div>+ {canShowOutOfDateDatesHelper ? (+ <OutOfDateDatesHelper+ dateOfIssue={dateOfIssue}+ dateOfService={dateOfService}+ invoiceNumberValue={invoiceNumberValue ?? ""}+ paymentDue={paymentDue ?? ""}+ selectedDateFormat={selectedDateFormat ?? DEFAULT_DATE_FORMAT}+ setValue={setValue}+ isMobile={isMobile}+ />) : null}{/* Header Notes - Purpose is to add a custom text to the header of the invoice */}@@ -786,3 +747,180 @@ export const GeneralInformation = memo(function GeneralInformation({</div>);});++interface OutOfDateDatesHelperProps {+ dateOfIssue: string;+ dateOfService: string;+ invoiceNumberValue: string;+ paymentDue: string;+ selectedDateFormat: string;+ setValue: UseFormSetValue<InvoiceData>;+ isMobile: boolean;+}++/**+ * Displays a helper component that detects and allows updating stale invoice dates.+ *+ * This component checks if the invoice dates (date of issue, date of service, payment due)+ * and invoice number are outdated compared to the current date. If any are stale, it displays+ * a table showing the old vs new values and provides a button to update all dates at once.+ */+function OutOfDateDatesHelper({+ dateOfIssue,+ dateOfService,+ invoiceNumberValue,+ paymentDue,+ selectedDateFormat,+ setValue,+ isMobile,+}: OutOfDateDatesHelperProps) {+ const formatDate = (date: string) =>+ dayjs(date).locale("en").format(selectedDateFormat);++ const isDateOfIssueStale = !dayjs(dateOfIssue).isSame(dayjs(), "day");+ const isDateOfServiceStale = !dayjs(dateOfService).isSame(+ dayjs().endOf("month"),+ "day",+ );+ const extractedMonthYear = /(\d{2}-\d{4})/.exec(invoiceNumberValue)?.[1];+ const isInvoiceNumberStale = extractedMonthYear !== CURRENT_MONTH_AND_YEAR;++ /**+ * Checks if the payment due date is stale (outdated).+ * A payment due date is considered stale if:+ * - It's not set (empty/undefined), OR+ * - It doesn't match the expected date (14 days after the date of issue)+ */+ const isPaymentDueStale =+ !paymentDue ||+ !dayjs(paymentDue).isSame(dayjs(dateOfIssue).add(14, "days"), "day");++ const targetToday = dayjs().locale("en").format(selectedDateFormat);+ const targetEndOfMonth = dayjs()+ .locale("en")+ .endOf("month")+ .format(selectedDateFormat);+ const targetPaymentDue = dayjs()+ .locale("en")+ .add(14, "days")+ .format(selectedDateFormat);+ const targetInvoiceNumber = `1/${CURRENT_MONTH_AND_YEAR}`;++ const staleItems = [+ isDateOfIssueStale && {+ label: "Date of issue",+ oldValue: formatDate(dateOfIssue),+ newValue: targetToday,+ hint: "today",+ },+ isDateOfServiceStale && {+ label: "Date of service",+ oldValue: formatDate(dateOfService),+ newValue: targetEndOfMonth,+ hint: "end of month",+ },+ isInvoiceNumberStale && {+ label: "Invoice number",+ oldValue: invoiceNumberValue || "—",+ newValue: targetInvoiceNumber,+ hint: undefined,+ },+ isPaymentDueStale && {+ label: "Payment due",+ oldValue: paymentDue ? formatDate(paymentDue) : "—",+ newValue: targetPaymentDue,+ hint: "date of issue + 14 days",+ },+ ].filter(Boolean) as {+ label: string;+ oldValue: string;+ newValue: string;+ hint?: string;+ }[];++ return (+ <div+ className="rounded-md border border-amber-200 bg-amber-50/90 px-3 py-4 shadow-sm shadow-amber-200/50 duration-300 animate-in fade-in slide-in-from-bottom-2"+ role="region"+ aria-live="polite"+ data-testid="out-of-date-dates-helper"+ >+ <div className="mb-3 flex items-center gap-1.5 text-xs font-medium text-amber-800">+ <AlertTriangle className="size-3.5 shrink-0 text-amber-600" />+ <span>+ {staleItems.length}{" "}+ {staleItems.length === 1 ? "field is" : "fields are"} out of date+ </span>+ </div>++ <table className="w-full border-collapse overflow-hidden rounded border border-amber-300 text-xs">+ <thead>+ <tr className="border-b border-amber-300 bg-amber-100/60 text-left text-amber-800">+ <th className="w-[65px] max-w-[65px] px-2.5 py-1.5 font-semibold">+ Field+ </th>+ <th className="px-2.5 py-1.5 font-semibold">Change</th>+ </tr>+ </thead>++ <tbody>+ {staleItems.map((item) => (+ <tr+ key={item.label}+ className="border-b border-amber-300 last:border-b-0"+ >+ <td className="w-[65px] max-w-[65px] px-2.5 py-1.5 text-amber-800">+ {item.label}+ </td>++ <td className="text-pretty px-2.5 py-1.5 pr-0">+ <span className="bg-red-100 text-amber-800 line-through decoration-amber-700/50">+ {item.oldValue}+ </span>+ <span className="mx-1 text-amber-700">→</span>+ <span className="bg-green-200 font-semibold text-green-800">+ {item.newValue}+ </span>+ {item.hint ? (+ <span className="ml-1 font-normal text-green-700">+ ({item.hint})+ </span>+ ) : null}+ </td>+ </tr>+ ))}+ </tbody>+ </table>++ <Button+ type="button"+ size="sm"+ className="mt-3.5 gap-1.5 bg-amber-600 text-white shadow-sm hover:bg-amber-600/95"+ onClick={() => {+ const today = dayjs().format("YYYY-MM-DD");++ const lastDayOfCurrentMonth = dayjs()+ .endOf("month")+ .format("YYYY-MM-DD");++ setValue("dateOfService", lastDayOfCurrentMonth);+ setValue("dateOfIssue", today);+ setValue("invoiceNumberObject.value", targetInvoiceNumber);++ const newPaymentDue = dayjs(today)+ .add(14, "days")+ .format("YYYY-MM-DD");++ setValue("paymentDue", newPaymentDue);++ toast.success("All dates updated successfully", {+ position: isMobile ? "top-center" : "bottom-right",+ });+ }}+ >+ <RefreshCw className="size-3.5" />+ Update All Dates+ </Button>+ </div>+ );+}diff --git a/src/app/(app)/components/invoice-form/sections/invoice-items.tsx b/src/app/(app)/components/invoice-form/sections/invoice-items.tsxindex 0727378..8dd4d10 100644--- a/src/app/(app)/components/invoice-form/sections/invoice-items.tsx+++ b/src/app/(app)/components/invoice-form/sections/invoice-items.tsx@@ -72,52 +72,6 @@ export const InvoiceItems = memo(function InvoiceItems({return (<>- {/** we only want to show these settings for default template */}- {template === "default" && (- <div className="mb-3 space-y-4">- {/* Show Number column on PDF switch */}- <div className="relative flex items-center justify-between">- <Label htmlFor={`itemInvoiceItemNumberIsVisible0`}>- Show "Number" Column in the Invoice Items Table- </Label>-- <Controller- name={`items.0.invoiceItemNumberIsVisible`}- control={control}- render={({ field: { value, onChange, ...field } }) => (- <Switch- {...field}- id={`itemInvoiceItemNumberIsVisible0`}- checked={value}- onCheckedChange={onChange}- className="h-5 w-8 [&_span]:size-4 [&_span]:data-[state=checked]:translate-x-3 rtl:[&_span]:data-[state=checked]:-translate-x-3"- />- )}- />- </div>-- {/* Show Tax Table Summary in PDF switch */}- <div className="relative flex items-center justify-between">- <Label htmlFor={`vatTableSummaryIsVisible`}>- Show "{taxLabelText} Table Summary" in the PDF- </Label>-- <Controller- name={`vatTableSummaryIsVisible`}- control={control}- render={({ field: { value, onChange, ...field } }) => (- <Switch- {...field}- id={`vatTableSummaryIsVisible`}- checked={value}- onCheckedChange={onChange}- className="h-5 w-8 [&_span]:size-4 [&_span]:data-[state=checked]:translate-x-3 rtl:[&_span]:data-[state=checked]:-translate-x-3"- />- )}- />- </div>- </div>- )}{fields.map((field, index) => {const isNotFirstItem = index > 0;const isFirstItem = index === 0;@@ -788,6 +742,7 @@ export const InvoiceItems = memo(function InvoiceItems({</fieldset>);})}+<CustomTooltiptrigger={<Button@@ -828,6 +783,59 @@ export const InvoiceItems = memo(function InvoiceItems({showArrow/>+ {/** we only want to show "Show Number Column" and "Show Tax Table Summary" settings for default template */}+ {template === "default" && (+ <div className="mt-6 space-y-4 rounded-md border p-4">+ {/* Show Number column on PDF switch */}+ <div className="relative flex items-center justify-between gap-2">+ <Label+ htmlFor={`itemInvoiceItemNumberIsVisible0`}+ className="text-balance font-medium"+ >+ Show "Number" Column in the Invoice Items Table+ </Label>++ <Controller+ name={`items.0.invoiceItemNumberIsVisible`}+ control={control}+ render={({ field: { value, onChange, ...field } }) => (+ <Switch+ {...field}+ id={`itemInvoiceItemNumberIsVisible0`}+ checked={value}+ onCheckedChange={onChange}+ className="h-5 w-8 [&_span]:size-4 [&_span]:data-[state=checked]:translate-x-3 rtl:[&_span]:data-[state=checked]:-translate-x-3"+ />+ )}+ />+ </div>++ {/* Show Tax Table Summary in PDF switch */}+ <div className="relative flex items-center justify-between gap-2">+ <Label+ htmlFor={`vatTableSummaryIsVisible`}+ className="text-balance"+ >+ Show "{taxLabelText} Table Summary" in the PDF+ </Label>++ <Controller+ name={`vatTableSummaryIsVisible`}+ control={control}+ render={({ field: { value, onChange, ...field } }) => (+ <Switch+ {...field}+ id={`vatTableSummaryIsVisible`}+ checked={value}+ onCheckedChange={onChange}+ className="h-5 w-8 [&_span]:size-4 [&_span]:data-[state=checked]:translate-x-3 rtl:[&_span]:data-[state=checked]:-translate-x-3"+ />+ )}+ />+ </div>+ </div>+ )}+<DeleteInvoiceItemConfirmationDialogdeleteItemIndex={deleteItemIndex}setDeleteItemIndex={setDeleteItemIndex}diff --git a/src/app/(app)/components/invoice-form/sections/seller-information.tsx b/src/app/(app)/components/invoice-form/sections/seller-information.tsxindex e9ed0da..0b227b2 100644--- a/src/app/(app)/components/invoice-form/sections/seller-information.tsx+++ b/src/app/(app)/components/invoice-form/sections/seller-information.tsx@@ -1,12 +1,13 @@import { type InvoiceData, type SellerData } from "@/app/schema";-import { LabelWithEditIcon } from "@/components/label-with-edit-icon";import { SellerManagement } from "@/components/seller-management";+import { AccordionContent } from "@/components/ui/accordion";import { Input } from "@/components/ui/input";import { InputHelperMessage } from "@/components/ui/input-helper-message";import { Label } from "@/components/ui/label";import { Switch } from "@/components/ui/switch";import { Textarea } from "@/components/ui/textarea";import { CustomTooltip } from "@/components/ui/tooltip";+import { Info } from "lucide-react";import { memo, useState } from "react";import {type Control,@@ -19,9 +20,6 @@ const ErrorMessage = ({ children }: { children: React.ReactNode }) => {return <p className="mt-1 text-xs text-red-600">{children}</p>;};-export const SELLER_TOOLTIP_CONTENT =- "Seller details are locked. Click the Edit Seller button (Pencil icon) next to the 'Select Seller' dropdown to modify seller details.";-interface SellerInformationProps {control: Control<InvoiceData>;errors: FieldErrors<InvoiceData>;@@ -40,15 +38,13 @@ export const SellerInformation = memo(function SellerInformation({const [selectedSellerId, setSelectedSellerId] = useState("");const isSellerSelected = !!selectedSellerId;- const HTML_TITLE_CONTENT = isSellerSelected ? SELLER_TOOLTIP_CONTENT : "";-- // Get current form values to pass to SellerManagementconst currentFormValues = {name: invoiceData.seller.name,address: invoiceData.seller.address,vatNo: invoiceData.seller.vatNo,vatNoLabelText: invoiceData.seller.vatNoLabelText,email: invoiceData.seller.email,+ emailFieldIsVisible: invoiceData.seller.emailFieldIsVisible,accountNumber: invoiceData.seller.accountNumber,swiftBic: invoiceData.seller.swiftBic,vatNoFieldIsVisible: invoiceData.seller.vatNoFieldIsVisible,@@ -70,444 +66,332 @@ export const SellerInformation = memo(function SellerInformation({isMobile={isMobile}/></div>- <fieldset className="mt-5 space-y-4">- <div>+ <AccordionContent className="">+ <fieldset className="mt-5 space-y-4" disabled={isSellerSelected}>{isSellerSelected ? (- <LabelWithEditIcon- htmlFor={`sellerName`}- content={SELLER_TOOLTIP_CONTENT}+ <div+ className="flex gap-2 rounded-md border border-blue-200 bg-blue-50 px-3 py-2 text-sm text-blue-800"+ data-testid="seller-locked-banner">- Name- </LabelWithEditIcon>- ) : (- <Label htmlFor={`sellerName`} className="mb-1">- Name+ <Info className="mt-0.5 size-4 shrink-0" aria-hidden="true" />+ <p className="">+ To modify seller details, click the "Edit seller"+ button (pencil icon) next to the dropdown above.+ </p>+ </div>+ ) : null}++ <div>+ <Label htmlFor="sellerName" className="mb-1">+ Name (Required)</Label>- )}- <Controller- name="seller.name"- control={control}- render={({ field }) => (- <Textarea- {...field}- id={`sellerName`}- rows={3}- className=""- readOnly={isSellerSelected}- aria-readonly={isSellerSelected}- title={HTML_TITLE_CONTENT}- />+ <Controller+ name="seller.name"+ control={control}+ render={({ field }) => (+ <Textarea {...field} id="sellerName" rows={3} />+ )}+ />+ {errors.seller?.name && (+ <ErrorMessage>{errors.seller.name.message}</ErrorMessage>)}- />- {errors.seller?.name && (- <ErrorMessage>{errors.seller.name.message}</ErrorMessage>- )}- </div>+ </div>- <div>- {isSellerSelected ? (- <LabelWithEditIcon- htmlFor={`sellerAddress`}- content={SELLER_TOOLTIP_CONTENT}- >- Address- </LabelWithEditIcon>- ) : (- <Label htmlFor={`sellerAddress`} className="mb-1">- Address+ <div>+ <Label htmlFor="sellerAddress" className="mb-1">+ Address (Required)</Label>- )}- <Controller- name="seller.address"- control={control}- render={({ field }) => (- <Textarea- {...field}- id={`sellerAddress`}- rows={3}- className=""- readOnly={isSellerSelected}- aria-readonly={isSellerSelected}- title={HTML_TITLE_CONTENT}- />+ <Controller+ name="seller.address"+ control={control}+ render={({ field }) => (+ <Textarea {...field} id="sellerAddress" rows={3} />+ )}+ />+ {errors.seller?.address && (+ <ErrorMessage>{errors.seller.address.message}</ErrorMessage>)}- />- {errors.seller?.address && (- <ErrorMessage>{errors.seller.address.message}</ErrorMessage>- )}- </div>+ </div>++ <div>+ <fieldset className="rounded-md border px-4 pb-4">+ <legend className="text-base font-semibold lg:text-lg">+ Seller Tax Number+ </legend>++ <div className="mb-2 flex items-center justify-end">+ <div className="inline-flex items-center gap-2">+ <Controller+ name="seller.vatNoFieldIsVisible"+ control={control}+ render={({ field: { value, onChange, ...field } }) => (+ <Switch+ {...field}+ id="sellerVatNoFieldIsVisible"+ checked={value}+ onCheckedChange={onChange}+ className="h-5 w-8 [&_span]:size-4 [&_span]:data-[state=checked]:translate-x-3 rtl:[&_span]:data-[state=checked]:-translate-x-3"+ data-testid="sellerVatNoFieldIsVisible"+ aria-label="Show the 'Seller Tax Number' Field in the PDF"+ />+ )}+ />+ <CustomTooltip+ trigger={+ <Label htmlFor="sellerVatNoFieldIsVisible">+ Show in PDF+ </Label>+ }+ content={+ isSellerSelected+ ? null+ : "Show the 'Seller Tax Number' Field in the PDF"+ }+ />+ </div>+ </div>- <div>- <fieldset className="rounded-md border px-4 pb-4">- <legend className="text-base font-semibold lg:text-lg">- Seller Tax Number- </legend>+ <div className="space-y-4">+ <div>+ <Label htmlFor="sellerVatNoLabel">Label</Label>+ <Controller+ name="seller.vatNoLabelText"+ control={control}+ render={({ field }) => (+ <Input+ {...field}+ type="text"+ id="sellerVatNoLabel"+ placeholder="Enter Tax number label"+ className="mt-1 block w-full"+ />+ )}+ />+ {errors.seller?.vatNoLabelText && (+ <ErrorMessage>+ {errors.seller.vatNoLabelText.message}+ </ErrorMessage>+ )}+ {!errors.seller?.vatNoLabelText && (+ <InputHelperMessage>+ Set a custom label (e.g. VAT no, Tax no, etc.)+ </InputHelperMessage>+ )}+ </div>++ <div>+ <Label htmlFor="sellerVatNo">Value</Label>+ <Controller+ name="seller.vatNo"+ control={control}+ render={({ field }) => (+ <Input+ {...field}+ id="sellerVatNo"+ type="text"+ placeholder="Enter Tax number value"+ className="mt-1 block w-full"+ />+ )}+ />+ {errors.seller?.vatNo && (+ <ErrorMessage>{errors.seller.vatNo.message}</ErrorMessage>+ )}+ </div>+ </div>+ </fieldset>+ </div>- <div className="mb-2 flex items-center justify-end">- {/* Show Seller Tax Number field in PDF switch */}- <div- className="inline-flex items-center gap-2"- title={HTML_TITLE_CONTENT}- >+ {/* Email */}+ <div>+ <div className="relative mb-2 flex items-center justify-between">+ <Label htmlFor="sellerEmail">Email</Label>++ <div className="inline-flex items-center gap-2"><Controller- name={`seller.vatNoFieldIsVisible`}+ name="seller.emailFieldIsVisible"control={control}render={({ field: { value, onChange, ...field } }) => (<Switch{...field}- id={`sellerVatNoFieldIsVisible`}+ id="sellerEmailFieldIsVisible"checked={value}onCheckedChange={onChange}className="h-5 w-8 [&_span]:size-4 [&_span]:data-[state=checked]:translate-x-3 rtl:[&_span]:data-[state=checked]:-translate-x-3"- disabled={isSellerSelected}- data-testid={`sellerVatNoFieldIsVisible`}- aria-label={`Show the 'Seller Tax Number' Field in the PDF`}+ data-testid="sellerEmailFieldIsVisible"+ aria-label="Show the 'Email' field in the PDF"/>)}/><CustomTooltiptrigger={- <Label htmlFor={`sellerVatNoFieldIsVisible`}>+ <Label htmlFor="sellerEmailFieldIsVisible">Show in PDF</Label>}content={isSellerSelected? null- : "Show the 'Seller Tax Number' Field in the PDF"+ : "Show the 'Email' field in the PDF"}/></div></div>+ <Controller+ name="seller.email"+ control={control}+ render={({ field }) => (+ <Input {...field} id="sellerEmail" type="email" />+ )}+ />+ {errors.seller?.email && (+ <ErrorMessage>{errors.seller.email.message}</ErrorMessage>+ )}+ </div>- <div className="space-y-4">- <div>- {isSellerSelected ? (- <LabelWithEditIcon- htmlFor="sellerVatNoLabel"- content={SELLER_TOOLTIP_CONTENT}- >- Label- </LabelWithEditIcon>- ) : (- <Label htmlFor="sellerVatNoLabel">Label</Label>- )}+ {/* Account Number */}+ <div>+ <div className="relative mb-2 flex items-center justify-between">+ <Label htmlFor="sellerAccountNumber">Account Number</Label>++ <div className="inline-flex items-center gap-2"><Controller- name="seller.vatNoLabelText"+ name="seller.accountNumberFieldIsVisible"control={control}- render={({ field }) => (- <Input+ render={({ field: { value, onChange, ...field } }) => (+ <Switch{...field}- type="text"- id="sellerVatNoLabel"- placeholder="Enter Tax number label"- className="mt-1 block w-full"- readOnly={isSellerSelected}- aria-readonly={isSellerSelected}- title={HTML_TITLE_CONTENT}+ id="sellerAccountNumberFieldIsVisible"+ checked={value}+ onCheckedChange={onChange}+ className="h-5 w-8 [&_span]:size-4 [&_span]:data-[state=checked]:translate-x-3 rtl:[&_span]:data-[state=checked]:-translate-x-3"+ data-testid="sellerAccountNumberFieldIsVisible"+ aria-label="Show the 'Account Number' Field in the PDF"/>)}/>- {errors.seller?.vatNoLabelText && (- <ErrorMessage>- {errors.seller.vatNoLabelText.message}- </ErrorMessage>- )}- {!errors.seller?.vatNoLabelText && (- <InputHelperMessage>- Set a custom label (e.g. VAT no, Tax no, etc.)- </InputHelperMessage>- )}+ <CustomTooltip+ trigger={+ <Label htmlFor="sellerAccountNumberFieldIsVisible">+ Show in PDF+ </Label>+ }+ content={+ isSellerSelected+ ? null+ : "Show the 'Account Number' Field in the PDF"+ }+ /></div>+ </div>+ <Controller+ name="seller.accountNumber"+ control={control}+ render={({ field }) => (+ <Textarea {...field} id="sellerAccountNumber" rows={3} />+ )}+ />+ {errors.seller?.accountNumber && (+ <ErrorMessage>{errors.seller.accountNumber.message}</ErrorMessage>+ )}+ </div>- <div>- {isSellerSelected ? (- <LabelWithEditIcon- htmlFor={`sellerVatNo`}- content={SELLER_TOOLTIP_CONTENT}- >- Value- </LabelWithEditIcon>- ) : (- <Label htmlFor={`sellerVatNo`}>Value</Label>- )}+ {/* SWIFT/BIC */}+ <div>+ <div className="relative mb-2 flex items-center justify-between">+ <Label htmlFor="sellerSwiftBic">SWIFT/BIC</Label>++ <div className="inline-flex items-center gap-2"><Controller- name="seller.vatNo"+ name="seller.swiftBicFieldIsVisible"control={control}- render={({ field }) => (- <Input+ render={({ field: { value, onChange, ...field } }) => (+ <Switch{...field}- id={`sellerVatNo`}- type="text"- placeholder="Enter Tax number value"- className="mt-1 block w-full"- readOnly={isSellerSelected}- aria-readonly={isSellerSelected}- title={HTML_TITLE_CONTENT}+ id="sellerSwiftBicFieldIsVisible"+ checked={value}+ onCheckedChange={onChange}+ className="h-5 w-8 [&_span]:size-4 [&_span]:data-[state=checked]:translate-x-3 rtl:[&_span]:data-[state=checked]:-translate-x-3"+ data-testid="sellerSwiftBicFieldIsVisible"+ aria-label="Show the 'SWIFT/BIC' Field in the PDF"/>)}/>- {errors.seller?.vatNo && (- <ErrorMessage>{errors.seller.vatNo.message}</ErrorMessage>- )}+ <CustomTooltip+ trigger={+ <Label htmlFor="sellerSwiftBicFieldIsVisible">+ Show in PDF+ </Label>+ }+ content={+ isSellerSelected+ ? null+ : "Show the 'SWIFT/BIC' Field in the PDF"+ }+ /></div></div>- </fieldset>- </div>-- <div>- {isSellerSelected ? (- <LabelWithEditIcon- htmlFor={`sellerEmail`}- content={SELLER_TOOLTIP_CONTENT}- >- </LabelWithEditIcon>- ) : (- <Label htmlFor={`sellerEmail`} className="mb-1">- </Label>- )}- <Controller- name="seller.email"- control={control}- render={({ field }) => (- <Input- {...field}- id={`sellerEmail`}- type="email"- className=""- readOnly={isSellerSelected}- aria-readonly={isSellerSelected}- title={HTML_TITLE_CONTENT}- />- )}- />- {errors.seller?.email && (- <ErrorMessage>{errors.seller.email.message}</ErrorMessage>- )}- </div>-- {/* Account Number */}- <div>- <div className="relative mb-2 flex items-center justify-between">- {isSellerSelected ? (- <LabelWithEditIcon- htmlFor={`sellerAccountNumber`}- content={SELLER_TOOLTIP_CONTENT}- >- Account Number- </LabelWithEditIcon>- ) : (- <Label htmlFor={`sellerAccountNumber`} className="">- Account Number- </Label>- )}-- {/* Show Account Number field in PDF switch */}- <div- className="inline-flex items-center gap-2"- title={HTML_TITLE_CONTENT}- >- <Controller- name={`seller.accountNumberFieldIsVisible`}- control={control}- render={({ field: { value, onChange, ...field } }) => (- <Switch- {...field}- id={`sellerAccountNumberFieldIsVisible`}- checked={value}- onCheckedChange={onChange}- className="h-5 w-8 [&_span]:size-4 [&_span]:data-[state=checked]:translate-x-3 rtl:[&_span]:data-[state=checked]:-translate-x-3"- disabled={isSellerSelected}- data-testid={`sellerAccountNumberFieldIsVisible`}- aria-label={`Show the 'Account Number' Field in the PDF`}- />- )}- />- <CustomTooltip- trigger={- <Label htmlFor={`sellerAccountNumberFieldIsVisible`}>- Show in PDF- </Label>- }- content={- isSellerSelected- ? null- : "Show the 'Account Number' Field in the PDF"- }- />- </div>- </div>- <Controller- name="seller.accountNumber"- control={control}- render={({ field }) => {- return (- <Textarea- {...field}- id={`sellerAccountNumber`}- rows={3}- className=""- readOnly={isSellerSelected}- aria-readonly={isSellerSelected}- title={HTML_TITLE_CONTENT}- />- );- }}- />- {errors.seller?.accountNumber && (- <ErrorMessage>{errors.seller.accountNumber.message}</ErrorMessage>- )}- </div>- {/* SWIFT/BIC */}- <div>- <div className="relative mb-2 flex items-center justify-between">- {isSellerSelected ? (- <LabelWithEditIcon- htmlFor={`sellerSwiftBic`}- content={SELLER_TOOLTIP_CONTENT}- >- SWIFT/BIC- </LabelWithEditIcon>- ) : (- <Label htmlFor={`sellerSwiftBic`} className="">- SWIFT/BIC- </Label>+ <Controller+ name="seller.swiftBic"+ control={control}+ render={({ field }) => (+ <Textarea {...field} id="sellerSwiftBic" rows={3} />+ )}+ />+ {errors.seller?.swiftBic && (+ <ErrorMessage>{errors.seller.swiftBic.message}</ErrorMessage>)}-- {/* Show SWIFT/BIC field in PDF switch */}- <div- className="inline-flex items-center gap-2"- title={HTML_TITLE_CONTENT}- >- <Controller- name={`seller.swiftBicFieldIsVisible`}- control={control}- render={({ field: { value, onChange, ...field } }) => (- <Switch- {...field}- id={`sellerSwiftBicFieldIsVisible`}- checked={value}- onCheckedChange={onChange}- className="h-5 w-8 [&_span]:size-4 [&_span]:data-[state=checked]:translate-x-3 rtl:[&_span]:data-[state=checked]:-translate-x-3"- disabled={isSellerSelected}- data-testid={`sellerSwiftBicFieldIsVisible`}- aria-label={`Show the 'SWIFT/BIC' Field in the PDF`}- />- )}- />- <CustomTooltip- trigger={- <Label htmlFor={`sellerSwiftBicFieldIsVisible`}>- Show in PDF- </Label>- }- content={- isSellerSelected- ? null- : "Show the 'SWIFT/BIC' Field in the PDF"- }- />- </div></div>- <Controller- name="seller.swiftBic"- control={control}- render={({ field }) => {- return (- <Textarea- {...field}- id={`sellerSwiftBic`}- rows={3}- className=""- readOnly={isSellerSelected}- aria-readonly={isSellerSelected}- title={HTML_TITLE_CONTENT}+ {/* Notes */}+ <div>+ <div className="relative mb-2 flex items-center justify-between">+ <Label htmlFor="sellerNotes">Notes</Label>+ <div className="inline-flex items-center gap-2">+ <Controller+ name="seller.notesFieldIsVisible"+ control={control}+ render={({ field: { value, onChange, ...field } }) => (+ <Switch+ {...field}+ id="sellerNotesFieldIsVisible"+ checked={value}+ onCheckedChange={onChange}+ className="h-5 w-8 [&_span]:size-4 [&_span]:data-[state=checked]:translate-x-3 rtl:[&_span]:data-[state=checked]:-translate-x-3"+ data-testid="sellerNotesInvoiceFormFieldVisibilitySwitch"+ aria-label="Show the 'Notes' field in the PDF"+ />+ )}/>- );- }}- />- {errors.seller?.swiftBic && (- <ErrorMessage>{errors.seller.swiftBic.message}</ErrorMessage>- )}- </div>+ <CustomTooltip+ trigger={+ <Label htmlFor="sellerNotesFieldIsVisible">+ Show in PDF+ </Label>+ }+ content={+ isSellerSelected+ ? null+ : "Show the 'Notes' field in the PDF"+ }+ />+ </div>+ </div>- {/* Notes */}- <div>- <div className="relative mb-2 flex items-center justify-between">- {isSellerSelected ? (- <LabelWithEditIcon- htmlFor={`sellerNotes`}- content={SELLER_TOOLTIP_CONTENT}- >- Notes- </LabelWithEditIcon>- ) : (- <Label htmlFor={`sellerNotes`} className="">- Notes- </Label>+ <Controller+ name="seller.notes"+ control={control}+ render={({ field }) => (+ <Textarea {...field} id="sellerNotes" rows={3} />+ )}+ />+ {errors.seller?.notes && (+ <ErrorMessage>{errors.seller.notes.message}</ErrorMessage>)}-- {/* Show Notes field in PDF switch */}- <div- className="inline-flex items-center gap-2"- title={HTML_TITLE_CONTENT}- >- <Controller- name={`seller.notesFieldIsVisible`}- control={control}- render={({ field: { value, onChange, ...field } }) => (- <Switch- {...field}- id={`sellerNotesFieldIsVisible`}- checked={value}- onCheckedChange={onChange}- className="h-5 w-8 [&_span]:size-4 [&_span]:data-[state=checked]:translate-x-3 rtl:[&_span]:data-[state=checked]:-translate-x-3"- disabled={isSellerSelected}- data-testid={`sellerNotesInvoiceFormFieldVisibilitySwitch`}- aria-label={`Show the 'Notes' field in the PDF`}- />- )}- />- <CustomTooltip- trigger={- <Label htmlFor={`sellerNotesFieldIsVisible`}>- Show in PDF- </Label>- }- content={- isSellerSelected ? null : "Show the 'Notes' field in the PDF"- }- />- </div></div>-- <Controller- name="seller.notes"- control={control}- render={({ field }) => {- return (- <Textarea- {...field}- id={`sellerNotes`}- rows={3}- className=""- readOnly={isSellerSelected}- aria-readonly={isSellerSelected}- title={HTML_TITLE_CONTENT}- placeholder="Additional information about the seller"- />- );- }}- />- {errors.seller?.notes && (- <ErrorMessage>{errors.seller.notes.message}</ErrorMessage>- )}- </div>- </fieldset>+ </fieldset>+ </AccordionContent></div>);});diff --git a/src/app/(app)/components/invoice-page-header.tsx b/src/app/(app)/components/invoice-page-header.tsxindex 3b4140a..7fa5a54 100644--- a/src/app/(app)/components/invoice-page-header.tsx+++ b/src/app/(app)/components/invoice-page-header.tsx@@ -18,7 +18,7 @@ import { ProjectLogoDescription } from "@/components/project-logo-description";import { GITHUB_URL, VIDEO_DEMO_URL } from "@/config";import { umamiTrackEvent } from "@/lib/umami-analytics-track-event";import { cn } from "@/lib/utils";-import { AlertCircleIcon, HeartIcon } from "lucide-react";+import { AlertCircleIcon, HeartIcon, LinkIcon } from "lucide-react";import { useState } from "react";import { InvoicePDFDownloadLink } from "@/app/(app)/components/invoice-pdf-download-link";@@ -41,6 +41,7 @@ export function InvoicePageHeader({setErrorWhileGeneratingPdfIsShown,qrCodeDataUrl,isMobile,+ isSharedInvoice,}: {canShareInvoice: boolean;handleShareInvoice: () => void;@@ -50,6 +51,7 @@ export function InvoicePageHeader({setErrorWhileGeneratingPdfIsShown: (value: boolean) => void;qrCodeDataUrl: string;isMobile: boolean;+ isSharedInvoice: boolean;}) {return (<div data-testid="header">@@ -63,8 +65,22 @@ export function InvoicePageHeader({</ProjectLogoDescription></div></div>- {/* this section is hidden on mobile and shown on desktop */}+ {/* desktop only section (hidden on mobile) */}<div className="mb-1 hidden w-full flex-wrap justify-center gap-3 lg:flex lg:flex-nowrap lg:justify-end">+ {isSharedInvoice && isDesktop ? (+ <CustomTooltip+ trigger={+ <span+ data-testid="shared-invoice-badge"+ className="flex w-[115px] items-center gap-1 rounded-full border border-blue-200 bg-blue-50 px-2 py-0.5 text-xs font-medium text-blue-700 shadow duration-500 animate-in fade-in slide-in-from-top-2"+ >+ <LinkIcon className="size-3" />+ Shared invoice+ </span>+ }+ content={"Viewing shared invoice"}+ />+ ) : null}{/* Support project button (hidden on mobile) */}<ButtonasChild@@ -166,6 +182,19 @@ export function InvoicePageHeader({<div className="mb-3 mt-1 flex flex-row items-center justify-center lg:mb-0 lg:mt-4 lg:justify-start xl:mt-1"><ProjectInfoLinks /></div>++ {/* mobile only section (hidden on desktop) */}+ {isSharedInvoice && isMobile ? (+ <div className="mb-3 flex flex-row items-center justify-center">+ <span+ data-testid="shared-invoice-badge"+ className="flex w-[115px] items-center gap-1 rounded-full border border-blue-200 bg-blue-50 px-2 py-0.5 text-xs font-medium text-blue-700 shadow duration-500 animate-in fade-in slide-in-from-top-2"+ >+ <LinkIcon className="size-3" />+ Shared invoice+ </span>+ </div>+ ) : null}</div>);}diff --git a/src/app/(app)/components/invoice-pdf-preview/desktop-pdf-viewer.tsx b/src/app/(app)/components/invoice-pdf-preview/desktop-pdf-viewer.tsxindex bce514b..d645657 100644--- a/src/app/(app)/components/invoice-pdf-preview/desktop-pdf-viewer.tsx+++ b/src/app/(app)/components/invoice-pdf-preview/desktop-pdf-viewer.tsx@@ -15,8 +15,9 @@ export function DesktopInvoicePDFViewer({<div className="flex h-[580px] w-full items-center justify-center border border-gray-200 bg-gray-200 lg:h-[620px] 2xl:h-[700px]"><div className="text-center"><p className="text-red-600">Error generating PDF preview</p>- <p className="mx-6 mt-2 text-balance text-sm text-gray-600">- Something went wrong. Please try refreshing the page or using{" "}+ <p className="mx-6 mt-2 max-w-xl text-balance text-sm text-gray-600">+ Something went wrong.+ <br /> Please try refreshing the page or using the{" "}<span className="font-bold">Chrome</span> browser. If the issuepersists, please fill a bug report{" "}<adiff --git a/src/app/(app)/components/invoice-pdf-preview/mobile-pdf-viewer.tsx b/src/app/(app)/components/invoice-pdf-preview/mobile-pdf-viewer.tsxindex b05c9e8..afdd73f 100644--- a/src/app/(app)/components/invoice-pdf-preview/mobile-pdf-viewer.tsx+++ b/src/app/(app)/components/invoice-pdf-preview/mobile-pdf-viewer.tsx@@ -65,7 +65,8 @@ export const MobileInvoicePDFViewer = ({<div className="text-center"><p className="text-red-600">Error generating PDF preview</p><p className="mx-6 mt-2 text-balance text-sm text-gray-600">- Something went wrong. Please try refreshing the page or using{" "}+ Something went wrong.+ <br /> Please try refreshing the page or using the{" "}<span className="font-bold">Chrome</span> browser. If theissue persists, please fill a bug report{" "}<adiff --git a/src/app/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-seller-buyer-info.tsx b/src/app/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-seller-buyer-info.tsxindex ce6f19c..01d8c28 100644--- a/src/app/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-seller-buyer-info.tsx+++ b/src/app/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-seller-buyer-info.tsx@@ -51,12 +51,14 @@ export function InvoiceSellerBuyerInfo({</Text></Text>)}- <Text style={styles.fontSize7}>- {t.seller.email}:{" "}- <Text style={[styles.boldText, styles.fontSize8]}>- {invoiceData?.seller.email}+ {invoiceData.seller.emailFieldIsVisible && (+ <Text style={styles.fontSize7}>+ {t.seller.email}:{" "}+ <Text style={[styles.boldText, styles.fontSize8]}>+ {invoiceData?.seller.email}+ </Text></Text>- </Text>+ )}</View></View>@@ -108,12 +110,14 @@ export function InvoiceSellerBuyerInfo({</Text></Text>)}- <Text style={styles.fontSize7}>- {t.buyer.email}:{" "}- <Text style={[styles.boldText, styles.fontSize8]}>- {invoiceData?.buyer.email}+ {invoiceData.buyer.emailFieldIsVisible && (+ <Text style={styles.fontSize7}>+ {t.buyer.email}:{" "}+ <Text style={[styles.boldText, styles.fontSize8]}>+ {invoiceData?.buyer.email}+ </Text></Text>- </Text>+ )}</View>{buyerNotesFieldIsVisible && invoiceData?.buyer.notes && (diff --git a/src/app/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-seller-buyer-info.tsx b/src/app/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-seller-buyer-info.tsxindex 73a543f..a971997 100644--- a/src/app/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-seller-buyer-info.tsx+++ b/src/app/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-seller-buyer-info.tsx@@ -28,9 +28,11 @@ export function StripeSellerBuyerInfo({<Text style={[styles.fontSize9, styles.mb3]}>{invoiceData.seller.address}</Text>- <Text style={[styles.fontSize9, styles.mb3]}>- {invoiceData.seller.email}- </Text>+ {invoiceData.seller.emailFieldIsVisible && (+ <Text style={[styles.fontSize9, styles.mb3]}>+ {invoiceData.seller.email}+ </Text>+ )}{invoiceData.seller.vatNoFieldIsVisible && (<Text style={[styles.fontSize9, styles.mb3]}>{invoiceData.seller.vatNoLabelText}: {invoiceData.seller.vatNo}@@ -65,9 +67,11 @@ export function StripeSellerBuyerInfo({<Text style={[styles.fontSize9, styles.mb3]}>{invoiceData.buyer.address}</Text>- <Text style={[styles.fontSize9, styles.mb3]}>- {invoiceData.buyer.email}- </Text>+ {invoiceData.buyer.emailFieldIsVisible && (+ <Text style={[styles.fontSize9, styles.mb3]}>+ {invoiceData.buyer.email}+ </Text>+ )}{invoiceData.buyer.vatNoFieldIsVisible && (<Text style={[styles.fontSize9, styles.mb3]}>diff --git a/src/app/(app)/error.tsx b/src/app/(app)/error.tsxindex 432da0f..f06bb99 100644--- a/src/app/(app)/error.tsx+++ b/src/app/(app)/error.tsx@@ -1,6 +1,17 @@"use client"; // Error boundaries must be Client Componentsimport { Button } from "@/components/ui/button";+import {+ AlertDialog,+ AlertDialogAction,+ AlertDialogCancel,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogHeader,+ AlertDialogTitle,+ AlertDialogTrigger,+} from "@/components/ui/alert-dialog";import { useEffect } from "react";import { toast } from "sonner";import { INITIAL_INVOICE_DATA } from "../constants";@@ -38,9 +49,13 @@ export default function Error({<div className="flex h-dvh flex-col items-center justify-center gap-4"><div className="flex flex-col items-center justify-center gap-4"><ErrorMessage>- Something went wrong. Please try refreshing the page or using{" "}- <span className="font-bold">Chrome</span> browser. If the issue- persists, please fill a bug report{" "}+ Something went wrong.+ <br /> Please try refreshing the page or using the Chrome browser.+ </ErrorMessage>+ <ErrorMessage>+ You can also try resetting your invoice data below and filling it in+ again. <br /> If the issue persists, try clearing your browser's+ local storage manually or fill a bug report{" "}<ahref={BUG_REPORT_URL}className="underline"@@ -63,46 +78,60 @@ export default function Error({>Try again</Button>- <Button- onClick={() => {- try {- // Clear the invoice data and start from scratch- localStorage.setItem(- PDF_DATA_LOCAL_STORAGE_KEY,- JSON.stringify(INITIAL_INVOICE_DATA),- );+ <AlertDialog>+ <AlertDialogTrigger asChild>+ <Button>Reset Invoice Data and Start From Scratch</Button>+ </AlertDialogTrigger>+ <AlertDialogContent>+ <AlertDialogHeader>+ <AlertDialogTitle>Are you sure?</AlertDialogTitle>+ <AlertDialogDescription>+ This will permanently reset your invoice data. You will need to+ fill it in again. This action cannot be undone.+ </AlertDialogDescription>+ </AlertDialogHeader>+ <AlertDialogFooter>+ <AlertDialogCancel>Cancel</AlertDialogCancel>+ <AlertDialogAction+ onClick={() => {+ try {+ localStorage.setItem(+ PDF_DATA_LOCAL_STORAGE_KEY,+ JSON.stringify(INITIAL_INVOICE_DATA),+ );- // Reset the invoice metadata to default- localStorage.setItem(- METADATA_LOCAL_STORAGE_KEY,- JSON.stringify(DEFAULT_METADATA),- );+ localStorage.setItem(+ METADATA_LOCAL_STORAGE_KEY,+ JSON.stringify(DEFAULT_METADATA),+ );- // Attempt to recover by trying to re-render the segment- reset();+ reset();- toast.success("Invoice data cleared", {- id: "app-error-toast-clear-invoice-data-success",- closeButton: true,- richColors: true,- });+ toast.success("Invoice data cleared", {+ id: "app-error-toast-clear-invoice-data-success",+ closeButton: true,+ richColors: true,+ });- umamiTrackEvent("error_button_start_from_scratch_clicked");- } catch (error) {- console.error(error);+ umamiTrackEvent("error_button_start_from_scratch_clicked");+ } catch (error) {+ console.error(error);- toast.error("Error clearing the invoice data", {- id: "app-error-toast-clear-invoice-data",- closeButton: true,- richColors: true,- });+ toast.error("Error clearing the invoice data", {+ id: "app-error-toast-clear-invoice-data",+ closeButton: true,+ richColors: true,+ });- Sentry.captureException(error);- }- }}- >- Reset Invoice Data and Start From Scratch- </Button>+ Sentry.captureException(error);+ }+ }}+ >+ Reset Invoice Data+ </AlertDialogAction>+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog></div></div>);diff --git a/src/app/(app)/page.client.tsx b/src/app/(app)/page.client.tsxindex 7ca64d9..dbd63b9 100644--- a/src/app/(app)/page.client.tsx+++ b/src/app/(app)/page.client.tsx@@ -106,6 +106,9 @@ export function AppPageClient({const [isInvoiceUrlCorrupted, setIsInvoiceUrlCorrupted] = useState(false);+ const isViewingSharedInvoice =+ searchParams.get("data") !== null && !isInvoiceUrlCorrupted;+const [invoiceFormHasErrors, setInvoiceFormHasErrors] = useState(false);// Refs to track original URL invoice data@@ -254,6 +257,11 @@ export function AppPageClient({const validatedDataFromURL = invoiceSchema.parse(updatedJson);+ console.log(+ "[useEffect] [initialize invoice data from ** URL **] validatedDataFromURL",+ validatedDataFromURL,+ );+// Override template from URL parameter if present for better UX// The ?template parameter provides a cleaner URL and better user experience// while ?data contains the actual invoice data including the template@@ -702,6 +710,7 @@ export function AppPageClient({}qrCodeDataUrl={qrCodeDataUrl}isMobile={isMobile}+ isSharedInvoice={isViewingSharedInvoice}/><div className="grid grid-cols-1 gap-4 lg:grid-cols-12"><InvoiceClientPagediff --git a/src/app/[locale]/error.tsx b/src/app/[locale]/error.tsxindex e7453e1..18cccc2 100644--- a/src/app/[locale]/error.tsx+++ b/src/app/[locale]/error.tsx@@ -30,8 +30,8 @@ export default function Error({ error, reset }: Props) {<div className="flex h-dvh flex-col items-center justify-center gap-4"><div className="flex flex-col items-center justify-center gap-4"><ErrorMessage>- Something went wrong. Please try to refresh the page or fill a bug- report{" "}+ Something went wrong.+ <br /> Please try to refresh the page or fill a bug report{" "}<ahref="https://pdfinvoicegenerator.userjot.com/board/bugs"className="underline"diff --git a/src/app/api/generate-invoice/render-pdf-on-server.tsx b/src/app/api/generate-invoice/render-pdf-on-server.tsxindex b488e4e..2970ffb 100644--- a/src/app/api/generate-invoice/render-pdf-on-server.tsx+++ b/src/app/api/generate-invoice/render-pdf-on-server.tsx@@ -99,6 +99,7 @@ export const ENGLISH_INVOICE_REAL_DATA = {vatNoFieldIsVisible: true,email: env.SELLER_EMAIL,+ emailFieldIsVisible: true,accountNumber: env.SELLER_ACCOUNT_NUMBER,accountNumberFieldIsVisible: true,@@ -116,6 +117,7 @@ export const ENGLISH_INVOICE_REAL_DATA = {vatNoFieldIsVisible: true,email: env.BUYER_EMAIL,+ emailFieldIsVisible: true,notesFieldIsVisible: true,},items: [diff --git a/src/app/constants/index.ts b/src/app/constants/index.tsindex 478037e..505210a 100644--- a/src/app/constants/index.ts+++ b/src/app/constants/index.ts@@ -35,6 +35,7 @@ export const DEFAULT_SELLER_DATA = {vatNoFieldIsVisible: true,email: "[email protected]",+ emailFieldIsVisible: true,accountNumber: "Seller account number",accountNumberFieldIsVisible: true,@@ -61,6 +62,7 @@ export const DEFAULT_BUYER_DATA = {vatNoFieldIsVisible: true,email: "[email protected]",+ emailFieldIsVisible: true,// field for additional notes about the buyer (not visible by default)notes: "",diff --git a/src/app/schema/index.ts b/src/app/schema/index.tsindex 998a95a..a26516c 100644--- a/src/app/schema/index.ts+++ b/src/app/schema/index.ts@@ -877,7 +877,14 @@ export const sellerSchema = z.object({),vatNoFieldIsVisible: z.boolean().default(true),- email: z.string().email("Invalid email address").trim(),+ email: z+ .string()+ .trim()+ .refine((val) => val === "" || z.string().email().safeParse(val).success, {+ message: "Invalid email address",+ })+ .optional(),+ emailFieldIsVisible: z.boolean().default(true),accountNumber: z.string()@@ -932,7 +939,14 @@ export const buyerSchema = z.object({),vatNoFieldIsVisible: z.boolean().default(true),- email: z.string().email("Invalid email address").trim(),+ email: z+ .string()+ .trim()+ .refine((val) => val === "" || z.string().email().safeParse(val).success, {+ message: "Invalid email address",+ })+ .optional(),+ emailFieldIsVisible: z.boolean().default(true),notes: z.string()diff --git a/src/components/buyer-dialog.tsx b/src/components/buyer-dialog.tsxindex 7739fa8..f2134dd 100644--- a/src/components/buyer-dialog.tsx+++ b/src/components/buyer-dialog.tsx@@ -64,6 +64,7 @@ export function BuyerDialog({vatNo: initialData?.vatNo ?? "",vatNoLabelText: initialData?.vatNoLabelText ?? "VAT no",email: initialData?.email ?? "",+ emailFieldIsVisible: initialData?.emailFieldIsVisible ?? true,vatNoFieldIsVisible: initialData?.vatNoFieldIsVisible ?? true,notes: initialData?.notes ?? "",notesFieldIsVisible: initialData?.notesFieldIsVisible ?? true,@@ -106,6 +107,7 @@ export function BuyerDialog({vatNo: "",vatNoLabelText: "VAT no",email: "",+ emailFieldIsVisible: true,vatNoFieldIsVisible: true,notes: "",notesFieldIsVisible: true,@@ -254,7 +256,7 @@ export function BuyerDialog({name="name"render={({ field }) => (<FormItem>- <FormLabel>Name</FormLabel>+ <FormLabel>Name (Required)</FormLabel><FormControl><Textarea{...field}@@ -272,7 +274,7 @@ export function BuyerDialog({name="address"render={({ field }) => (<FormItem>- <FormLabel>Address</FormLabel>+ <FormLabel>Address (Required)</FormLabel><FormControl><Textarea{...field}@@ -370,23 +372,54 @@ export function BuyerDialog({</div></fieldset>- <FormField- control={form.control}- name="email"- render={({ field }) => (- <FormItem>- <FormLabel>Email</FormLabel>- <FormControl>- <Input- {...field}- type="email"- placeholder="[email protected]"- />- </FormControl>- <FormMessage />- </FormItem>- )}- />+ {/* Email */}+ <div className="space-y-3 rounded-md border p-4">+ <FormField+ control={form.control}+ name="email"+ render={({ field }) => (+ <FormItem>+ <FormLabel className="mb-2 font-medium">Email</FormLabel>+ <FormControl>+ <Input+ {...field}+ type="email"+ placeholder="[email protected]"+ />+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />+ <FormField+ control={form.control}+ name="emailFieldIsVisible"+ render={({ field }) => (+ <FormItem>+ <div className="flex items-center gap-2">+ <FormControl>+ <Switch+ checked={field.value}+ onCheckedChange={field.onChange}+ id="emailFieldIsVisible"+ data-testid={`buyerEmailDialogFieldVisibilitySwitch`}+ aria-label={`Show the 'Email' field in the PDF`}+ />+ </FormControl>+ <CustomTooltip+ trigger={+ <Label htmlFor="emailFieldIsVisible">+ Show Buyer Email in PDF+ </Label>+ }+ content='Show the "Email" field in the PDF'+ className="z-[1000]"+ />+ </div>+ </FormItem>+ )}+ />+ </div>{/* Notes */}<div className="space-y-3 rounded-md border p-4">diff --git a/src/components/buyer-management.tsx b/src/components/buyer-management.tsxindex 609bd7a..121dd88 100644--- a/src/components/buyer-management.tsx+++ b/src/components/buyer-management.tsx@@ -280,21 +280,28 @@ export function BuyerManagement({(buyer) => buyer.id === selectedBuyerId,);+ const hasBuyers = buyersSelectOptions.length > 0;+return (<>- <div className="flex flex-col gap-2">- {buyersSelectOptions.length > 0 ? (- <div className="space-y-1">+ <div+ className={cn(+ "flex w-full flex-col gap-2",+ hasBuyers ? "rounded-md border p-4" : "mt-3",+ )}+ >+ {hasBuyers ? (+ <div className="w-full space-y-1"><div className="flex items-center gap-1"><Label htmlFor={buyerSelectId} className="">Select Buyer</Label></div>- <div className="flex gap-2">+ <div className="flex w-full gap-2"><SelectNativeid={buyerSelectId}className={cn(- "block h-8 max-w-[200px] text-[12px]",+ "block h-8 w-full text-[12px]",!selectedBuyerId && "italic text-gray-700",)}onChange={handleBuyerChange}@@ -325,10 +332,10 @@ export function BuyerManagement({setIsBuyerDialogOpen(true);}}}- className="h-8 px-2"+ className="size-8 px-2"><span className="sr-only">Edit buyer</span>- <Pencil className="h-3 w-3" />+ <Pencil className="size-3.5" /></Button>}content="Edit buyer"@@ -344,10 +351,10 @@ export function BuyerManagement({setIsDeleteDialogOpen(true);}}- className="h-8 px-2"+ className="size-8 px-2"><span className="sr-only">Delete buyer</span>- <Trash2 className="h-3 w-3" />+ <Trash2 className="size-3.5" /></Button>}content="Delete buyer"@@ -359,6 +366,7 @@ export function BuyerManagement({) : null}<CustomTooltip+ side="bottom"className={cn(!isLocalStorageAvailable && "bg-red-50")}trigger={<Buttondiff --git a/src/components/etc/error-message.tsx b/src/components/etc/error-message.tsxindex fee7fdf..0f2bd14 100644--- a/src/components/etc/error-message.tsx+++ b/src/components/etc/error-message.tsx@@ -1,3 +1,7 @@export function ErrorMessage({ children }: { children: React.ReactNode }) {- return <p className="text-center text-sm text-gray-600">{children}</p>;+ return (+ <p className="mx-5 max-w-2xl text-balance text-center text-sm text-gray-600">+ {children}+ </p>+ );}diff --git a/src/components/label-with-edit-icon.tsx b/src/components/label-with-edit-icon.tsxdeleted file mode 100644index 2c48814..0000000--- a/src/components/label-with-edit-icon.tsx+++ /dev/null@@ -1,56 +0,0 @@-import { Info } from "lucide-react";-import {- Popover,- PopoverContent,- PopoverTrigger,-} from "@/components/ui/popover";-import { Label } from "@/components/ui/label";-import { CustomTooltip } from "@/components/ui/tooltip";-import { useIsDesktop } from "@/hooks/use-media-query";--/**- * A component that displays a label with an edit icon and a tooltip.- */-export const LabelWithEditIcon = ({- htmlFor,- children,- content,-}: {- htmlFor: string;- children: React.ReactNode;- content: string;-}) => {- const isDesktop = useIsDesktop();-- return (- <div className="flex items-center gap-1">- <Label htmlFor={htmlFor} className="mb-1">- {children}- </Label>- {isDesktop ? (- <CustomTooltip- trigger={- <Info- className="mb-1 h-3.5 w-3.5 cursor-pointer text-gray-800"- data-testid="form-section-tooltip-info-icon-desktop"- />- }- content={content}- />- ) : (- // Mobile view- <Popover>- <PopoverTrigger asChild>- <Info- className="mb-1 h-3.5 w-3.5 cursor-pointer text-gray-800"- data-testid="form-section-tooltip-info-icon-mobile"- />- </PopoverTrigger>- <PopoverContent className="w-[200px] text-sm">- {content}- </PopoverContent>- </Popover>- )}- </div>- );-};diff --git a/src/components/seller-dialog.tsx b/src/components/seller-dialog.tsxindex 3719a6e..cea8973 100644--- a/src/components/seller-dialog.tsx+++ b/src/components/seller-dialog.tsx@@ -66,6 +66,7 @@ export function SellerDialog({vatNo: initialData?.vatNo ?? "",vatNoLabelText: initialData?.vatNoLabelText ?? "VAT no",email: initialData?.email ?? "",+ emailFieldIsVisible: initialData?.emailFieldIsVisible ?? true,accountNumber: initialData?.accountNumber ?? "",swiftBic: initialData?.swiftBic ?? "",vatNoFieldIsVisible: initialData?.vatNoFieldIsVisible ?? true,@@ -104,6 +105,7 @@ export function SellerDialog({vatNo: "",vatNoLabelText: "VAT no",email: "",+ emailFieldIsVisible: true,accountNumber: "",swiftBic: "",vatNoFieldIsVisible: true,@@ -262,7 +264,7 @@ export function SellerDialog({name="name"render={({ field }) => (<FormItem>- <FormLabel>Name</FormLabel>+ <FormLabel>Name (Required)</FormLabel><FormControl><Textarea{...field}@@ -280,7 +282,7 @@ export function SellerDialog({name="address"render={({ field }) => (<FormItem>- <FormLabel>Address</FormLabel>+ <FormLabel>Address (Required)</FormLabel><FormControl><Textarea{...field}@@ -376,23 +378,54 @@ export function SellerDialog({</div></fieldset>- <FormField- control={form.control}- name="email"- render={({ field }) => (- <FormItem>- <FormLabel>Email</FormLabel>- <FormControl>- <Input- {...field}- type="email"- placeholder="[email protected]"- />- </FormControl>- <FormMessage />- </FormItem>- )}- />+ {/* Email */}+ <div className="space-y-3 rounded-md border p-4">+ <FormField+ control={form.control}+ name="email"+ render={({ field }) => (+ <FormItem>+ <FormLabel className="mb-2 font-medium">Email</FormLabel>+ <FormControl>+ <Input+ {...field}+ type="email"+ placeholder="[email protected]"+ />+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />+ <FormField+ control={form.control}+ name="emailFieldIsVisible"+ render={({ field }) => (+ <FormItem>+ <div className="flex items-center gap-2">+ <FormControl>+ <Switch+ checked={field.value}+ onCheckedChange={field.onChange}+ id="emailFieldIsVisible"+ data-testid={`sellerEmailDialogFieldVisibilitySwitch`}+ aria-label={`Show the 'Email' field in the PDF`}+ />+ </FormControl>+ <CustomTooltip+ trigger={+ <Label htmlFor="emailFieldIsVisible">+ Show Seller Email in PDF+ </Label>+ }+ content='Show the "Email" field in the PDF'+ className="z-[1000]"+ />+ </div>+ </FormItem>+ )}+ />+ </div>{/* Account Number */}<div className="space-y-3 rounded-md border p-4">diff --git a/src/components/seller-management.tsx b/src/components/seller-management.tsxindex b75d816..241700b 100644--- a/src/components/seller-management.tsx+++ b/src/components/seller-management.tsx@@ -296,21 +296,28 @@ export function SellerManagement({(seller) => seller.id === selectedSellerId,);+ const hasSellers = sellersSelectOptions.length > 0;+return (<>- <div className="flex flex-col gap-2">- {sellersSelectOptions.length > 0 ? (- <div className="space-y-1">+ <div+ className={cn(+ "flex w-full flex-col gap-2",+ hasSellers ? "rounded-md border p-4" : "mt-3",+ )}+ >+ {hasSellers ? (+ <div className="w-full space-y-1"><div className="flex items-center gap-1"><Label htmlFor={sellerSelectId} className="">Select Seller</Label></div>- <div className="flex gap-2">+ <div className="flex w-full gap-2"><SelectNativeid={sellerSelectId}className={cn(- "block h-8 max-w-[200px] text-[12px]",+ "block h-8 w-full text-[12px]",!selectedSellerId && "italic text-gray-700",)}onChange={handleSellerChange}@@ -341,10 +348,10 @@ export function SellerManagement({setIsSellerDialogOpen(true);}}}- className="h-8 px-2"+ className="size-8 px-2"><span className="sr-only">Edit seller</span>- <Pencil className="h-3 w-3" />+ <Pencil className="size-3.5" /></Button>}content="Edit seller"@@ -360,10 +367,10 @@ export function SellerManagement({setIsDeleteDialogOpen(true);}}- className="h-8 px-2"+ className="size-8 px-2"><span className="sr-only">Delete seller</span>- <Trash2 className="h-3 w-3" />+ <Trash2 className="size-3.5" /></Button>}content="Delete seller"@@ -375,6 +382,7 @@ export function SellerManagement({) : null}<CustomTooltip+ side="bottom"className={cn(!isLocalStorageAvailable && "bg-red-50")}trigger={<Buttondiff --git a/src/components/ui/input.tsx b/src/components/ui/input.tsxindex 39e27fa..23470b8 100644--- a/src/components/ui/input.tsx+++ b/src/components/ui/input.tsx@@ -9,7 +9,7 @@ const Input = React.memo(type={type}autoComplete="off"className={cn(- "h-8 w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm text-slate-950 shadow-sm shadow-black/5 transition-shadow placeholder:text-slate-500/70 focus-visible:border-indigo-500 focus-visible:ring focus-visible:ring-indigo-200 focus-visible:ring-opacity-50 disabled:cursor-not-allowed disabled:opacity-50 dark:border-slate-800 dark:bg-slate-950 dark:text-slate-50 dark:placeholder:text-slate-400/70 dark:focus-visible:border-slate-300 dark:focus-visible:ring-slate-300/20 [&[aria-readonly=true]]:cursor-not-allowed [&[aria-readonly=true]]:bg-slate-50 [&[aria-readonly=true]]:opacity-50 [&[aria-readonly=true]]:dark:bg-slate-900",+ "h-8 w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm text-slate-950 shadow-sm shadow-black/5 transition-shadow placeholder:text-slate-500/70 focus-visible:border-indigo-500 focus-visible:ring focus-visible:ring-indigo-200 focus-visible:ring-opacity-50 disabled:cursor-not-allowed disabled:text-black disabled:opacity-55 dark:border-slate-800 dark:bg-slate-950 dark:text-slate-50 dark:placeholder:text-slate-400/70 dark:focus-visible:border-slate-300 dark:focus-visible:ring-slate-300/20 [&[aria-readonly=true]]:cursor-not-allowed [&[aria-readonly=true]]:bg-slate-50 [&[aria-readonly=true]]:opacity-50 [&[aria-readonly=true]]:dark:bg-slate-900",type === "date" && "w-auto",type === "search" &&"[&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none [&::-webkit-search-results-button]:appearance-none [&::-webkit-search-results-decoration]:appearance-none",diff --git a/src/components/ui/label.tsx b/src/components/ui/label.tsxindex a984897..86d3190 100644--- a/src/components/ui/label.tsx+++ b/src/components/ui/label.tsx@@ -12,7 +12,7 @@ const Label = React.memo(<labelref={ref}className={cn(- "block text-balance text-xs font-medium text-gray-900 peer-disabled:cursor-not-allowed peer-disabled:opacity-70 dark:text-slate-50",+ "block text-pretty text-xs font-medium text-gray-900 peer-disabled:cursor-not-allowed peer-disabled:opacity-70 dark:text-slate-50",className,)}{...props}diff --git a/src/components/ui/select-native.tsx b/src/components/ui/select-native.tsxindex 9b4959c..36302d3 100644--- a/src/components/ui/select-native.tsx+++ b/src/components/ui/select-native.tsx@@ -13,7 +13,7 @@ export interface SelectPropsNativeconst SelectNative = React.forwardRef<HTMLSelectElement, SelectPropsNative>(({ className, children, ...props }, ref) => {return (- <div className="relative">+ <div className="relative w-full"><selectclassName={cn("peer block w-full cursor-pointer appearance-none items-center rounded-md border border-gray-300 bg-white text-sm text-slate-950 shadow-sm shadow-black/5 transition-all hover:bg-slate-100/80 focus-visible:border-indigo-500 focus-visible:ring focus-visible:ring-indigo-200 focus-visible:ring-opacity-50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 has-[option[disabled]:checked]:text-slate-500 dark:border-slate-800 dark:bg-slate-950 dark:text-slate-50 dark:focus-visible:border-slate-300 dark:focus-visible:ring-slate-300/20 dark:has-[option[disabled]:checked]:text-slate-400",diff --git a/src/components/ui/textarea.tsx b/src/components/ui/textarea.tsxindex 9ad1bfa..42088c2 100644--- a/src/components/ui/textarea.tsx+++ b/src/components/ui/textarea.tsx@@ -9,7 +9,7 @@ const Textarea = React.forwardRef<return (<textareaclassName={cn(- "flex min-h-[80px] w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm text-slate-950 shadow-sm shadow-black/5 transition-shadow placeholder:text-slate-500/70 focus-visible:border-indigo-500 focus-visible:ring focus-visible:ring-indigo-200 focus-visible:ring-opacity-50 disabled:cursor-not-allowed disabled:opacity-50 dark:border-slate-800 dark:bg-slate-950 dark:text-slate-50 dark:placeholder:text-slate-400/70 dark:focus-visible:border-slate-300 dark:focus-visible:ring-slate-300/20 [&[aria-readonly=true]]:cursor-not-allowed [&[aria-readonly=true]]:bg-slate-50 [&[aria-readonly=true]]:opacity-50 [&[aria-readonly=true]]:dark:bg-slate-900",+ "flex min-h-[80px] w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm text-slate-950 shadow-sm shadow-black/5 transition-shadow placeholder:text-slate-500/70 focus-visible:border-indigo-500 focus-visible:ring focus-visible:ring-indigo-200 focus-visible:ring-opacity-50 disabled:cursor-not-allowed disabled:text-black disabled:opacity-55 dark:border-slate-800 dark:bg-slate-950 dark:text-slate-50 dark:placeholder:text-slate-400/70 dark:focus-visible:border-slate-300 dark:focus-visible:ring-slate-300/20 [&[aria-readonly=true]]:cursor-not-allowed [&[aria-readonly=true]]:bg-slate-50 [&[aria-readonly=true]]:opacity-50 [&[aria-readonly=true]]:dark:bg-slate-900","resize-none",className,)}diff --git a/src/utils/__tests__/data.ts b/src/utils/__tests__/data.tsindex 6d19120..9782e68 100644--- a/src/utils/__tests__/data.ts+++ b/src/utils/__tests__/data.ts@@ -13,6 +13,7 @@ const MOCK_SELLER_DATA = {vatNo: "VAT123456789",vatNoFieldIsVisible: true,email: "[email protected]",+ emailFieldIsVisible: true,accountNumber: "1234567890123456",accountNumberFieldIsVisible: true,swiftBic: "ABCDUS33XXX",@@ -29,6 +30,7 @@ const MOCK_BUYER_DATA = {vatNo: "VAT987654321",vatNoFieldIsVisible: true,email: "[email protected]",+ emailFieldIsVisible: true,notes: "Buyer notes",notesFieldIsVisible: true,vatNoLabelText: "VAT no",diff --git a/src/utils/url-compression.ts b/src/utils/url-compression.tsindex d217350..d5ee23c 100644--- a/src/utils/url-compression.ts+++ b/src/utils/url-compression.ts@@ -83,6 +83,7 @@ export const INVOICE_KEY_COMPRESSION_MAP = {vatNo: "C",vatNoFieldIsVisible: "D",email: "E",+ emailFieldIsVisible: "8",accountNumber: "F",accountNumberFieldIsVisible: "G",swiftBic: "H",