Skip to content

[Orders v2] Add support for app / user avatar for transaction list#5998

Merged
kzuraw merged 4 commits intomainfrom
eng-773-orders-v2-avatar-1
Oct 24, 2025
Merged

[Orders v2] Add support for app / user avatar for transaction list#5998
kzuraw merged 4 commits intomainfrom
eng-773-orders-v2-avatar-1

Conversation

@kzuraw
Copy link
Copy Markdown
Contributor

@kzuraw kzuraw commented Oct 23, 2025

Scope of the change

This PR adds support for displaying app and user avatars in the Orders v2 refund list.

Changes

  • Updated MacawUI to v1.4.0 to access the latest avatar component features
  • Extended GraphQL fragments to fetch app brand logos (AppAvatar, OrderGrantedRefund) and user avatars
  • Enhanced UserAvatar component with a new scheme prop (defaults to "accent1") to support transparent backgrounds
  • Updated OrderRefundsViewModel to include creator information with avatar/logo data for both apps and users
  • Display avatars in RefundListItem using the transparent scheme for better visual integration
  • Fixed static asset import in Storybook to use default import pattern (following Vite best practices)
  • Added comprehensive test coverage for getCreator method with 8 test cases covering:
    • App creators with logos (full brand, null brand, null logo URL)
    • User creators with avatars (with avatar, without avatar, empty names)
    • Edge cases (null creators)

Implementation Details

The implementation uses the OrderRefundDisplay.creator field which contains:

  • initials: Generated from app name (first 2 chars) or user's name via getUserInitials()
  • logoUrl: App brand logo URL or user avatar URL

The RefundListItem component now displays:

  • App logo/icon with initials fallback when logo is unavailable
  • User avatar with initials fallback when avatar is unavailable
  • Empty box placeholder when no creator information is available

Testing

  • All unit tests pass (43 tests including 8 new tests for getCreator)
  • TypeScript type checking passes
  • Follows Arrange/Act/Assert pattern in tests

  • I confirm I added ripples for changes (see src/ripples) or my feature doesn't contain any user-facing changes
  • I used analytics "trackEvent" for important events

kzuraw and others added 2 commits October 23, 2025 10:26
Update all test fixtures and view models to handle the new required `brand`
property on AppAvatarFragment. The GraphQL schema was updated to include app
branding information, which caused TypeScript errors in test fixtures.

Changes:
- Add `brand: null` to all App test fixtures (6 files)
- Add `creator: null` to OrderRefundDisplay test helper
- Update OrderRefundsViewModel.getCreator() to handle nullable properties
- Fix type conversion in RefundListItem for logoUrl (null to undefined)

Fixes TypeScript strict mode errors in:
- src/extensions/fixtures.ts
- src/orders/components/OrderReturnPage/components/TransactionSubmitCard/fixtures.ts
- src/orders/fixtures.ts (2 locations)
- src/ordersV2/fixtures/OrderFixture.ts (2 locations)
- src/ordersV2/OrderRefunds/OrderRefundsViewModel.test.ts (4 locations)
- src/ordersV2/OrderRefunds/OrderRefundsViewModel.ts
- src/ordersV2/OrderRefunds/RefundListItem.tsx

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings October 23, 2025 08:28
@kzuraw kzuraw added the skip changeset Use if your changes doesn't need entry in changelog label Oct 23, 2025
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Oct 23, 2025

⚠️ No Changeset found

Latest commit: fccdcbe

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link
Copy Markdown

vercel Bot commented Oct 23, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
saleor-dashboard-storybook Ignored Ignored Preview Oct 23, 2025 0:46am

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for displaying app and user avatars in the transaction list for Orders v2. The implementation replaces a local UserAvatar component with a shared one and extends the data model to include creator information (initials and logo URL) for both apps and users.

Key Changes:

  • Updated GraphQL fragments to fetch app brand logos
  • Extended the OrderRefundDisplay type to include creator avatar data
  • Migrated from local UserAvatar component to shared @dashboard/components/UserAvatar

Reviewed Changes

Copilot reviewed 14 out of 18 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/ordersV2/storybook/OrderRefunds.stories.tsx Added creator mock data to all refund stories
src/ordersV2/fixtures/OrderFixture.ts Added brand: null to app fixtures
src/ordersV2/UserAvatar.tsx Removed local UserAvatar component (migrated to shared component)
src/ordersV2/OrderRefunds/RefundListItem.tsx Updated to use shared UserAvatar with creator data
src/ordersV2/OrderRefunds/OrderRefundsViewModel.ts Added getCreator method to extract avatar data from apps/users
src/ordersV2/OrderRefunds/OrderRefundsViewModel.test.ts Updated test fixtures with brand and creator fields
src/orders/fixtures.ts Added brand: null to app fixtures
src/orders/components/OrderReturnPage/components/TransactionSubmitCard/fixtures.ts Added brand: null to app fixture
src/graphql/hooks.generated.ts Generated GraphQL hooks with brand logo queries
src/fragments/orders.ts Added brand logo to order granted refunds fragment
src/fragments/apps.ts Added brand logo to app avatar fragment, removed TODO comment
src/extensions/fixtures.ts Added brand: null to app fixture
src/components/UserAvatar/UserAvatar.tsx Added scheme prop to support transparent avatar style
package.json Upgraded @saleor/macaw-ui-next from 1.3.5 to 1.4.0

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/ordersV2/storybook/OrderRefunds.stories.tsx Outdated
@github-actions
Copy link
Copy Markdown
Contributor

Differences Found

✅ No packages or licenses were added.

Summary

Expand
License Name Package Count Packages
0BSD 1
Packages
  • tslib
CC-BY-3.0 1
Packages
  • spdx-exceptions
MIT/X11 1
Packages
  • nub
MPL-1.1 1
Packages
  • harmony-reflect
MPL-2.0 1
Packages
  • dompurify
Public Domain 1
Packages
  • jsonify
Python-2.0 1
Packages
  • argparse
WTFPL 1
Packages
  • utf8-byte-length
<<missing>> 2
Packages
  • busboy
  • streamsearch
CC-BY-4.0 2
Packages
  • @saleor/macaw-ui
  • caniuse-lite
CC0-1.0 2
Packages
  • spdx-license-ids
  • type-fest
SEE LICENSE IN LICENSE 2
Packages
  • posthog-js
  • spawndamnit
BlueOak-1.0.0 3
Packages
  • jackspeak
  • package-json-from-dist
  • path-scurry
BSD-2-Clause 24
Packages
  • browser-process-hrtime
  • css-select
  • css-what
  • domelementtype
  • domhandler
  • domutils
  • dotenv
  • dotenv-expand
  • entities
  • escodegen
  • eslint-scope
  • espree
  • esprima
  • esrecurse
  • estraverse
  • esutils
  • normalize-package-data
  • nth-check
  • regjsparser
  • stringify-object
  • And 4 more...
BSD-3-Clause 43
Packages
  • @saleor/app-sdk
  • @sentry/cli
  • @sentry/cli-darwin
  • @sentry/cli-linux-arm
  • @sentry/cli-linux-arm64
  • @sentry/cli-linux-i686
  • @sentry/cli-linux-x64
  • @sentry/cli-win32-arm64
  • @sentry/cli-win32-i686
  • @sentry/cli-win32-x64
  • @sinonjs/commons
  • @sinonjs/fake-timers
  • abab
  • asn1js
  • babel-plugin-istanbul
  • chroma-js
  • dataloader
  • diff
  • esquery
  • exenv
  • And 23 more...
ISC 50
Packages
  • @isaacs/cliui
  • @istanbuljs/load-nyc-config
  • anymatch
  • boolbase
  • cli-width
  • cliui
  • electron-to-chromium
  • fastq
  • flatted
  • foreground-child
  • fs.realpath
  • get-caller-file
  • get-own-enumerable-property-symbols
  • glob
  • glob-parent
  • graceful-fs
  • hosted-git-info
  • inflight
  • inherits
  • ini
  • And 30 more...
Apache-2.0 57
Packages
  • @ampproject/remapping
  • @editorjs/editorjs
  • @eslint/config-array
  • @eslint/config-helpers
  • @eslint/core
  • @eslint/object-schema
  • @eslint/plugin-kit
  • @humanfs/core
  • @humanfs/node
  • @humanwhocodes/module-importer
  • @humanwhocodes/retry
  • @opentelemetry/api
  • @opentelemetry/semantic-conventions
  • @playwright/test
  • @pollyjs/adapter
  • @pollyjs/core
  • @pollyjs/persister
  • @pollyjs/utils
  • @swc/core
  • @swc/core-darwin-arm64
  • And 37 more...
MIT 1283
Packages
  • @adobe/css-tools
  • @apollo/client
  • @ardatan/relay-compiler
  • @ardatan/sync-fetch
  • @babel/code-frame
  • @babel/compat-data
  • @babel/core
  • @babel/generator
  • @babel/helper-annotate-as-pure
  • @babel/helper-compilation-targets
  • @babel/helper-create-class-features-plugin
  • @babel/helper-globals
  • @babel/helper-member-expression-to-functions
  • @babel/helper-module-imports
  • @babel/helper-module-transforms
  • @babel/helper-optimise-call-expression
  • @babel/helper-plugin-utils
  • @babel/helper-replace-supers
  • @babel/helper-skip-transparent-expression-wrappers
  • @babel/helper-string-parser
  • And 1263 more...

@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 23, 2025

Codecov Report

❌ Patch coverage is 84.21053% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 39.52%. Comparing base (a1eec49) to head (fccdcbe).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/ordersV2/OrderRefunds/RefundListItem.tsx 0.00% 2 Missing ⚠️
src/ordersV2/OrderRefunds/OrderRefundsViewModel.ts 93.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5998      +/-   ##
==========================================
+ Coverage   39.49%   39.52%   +0.02%     
==========================================
  Files        2429     2428       -1     
  Lines       39518    39532      +14     
  Branches     9037     9047      +10     
==========================================
+ Hits        15609    15624      +15     
+ Misses      22710    22709       -1     
  Partials     1199     1199              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

- Add comprehensive test coverage for getCreator method with 8 test cases covering app creators (with/without logos), user creators (with/without avatars), and edge cases (null values, empty names)
- Fix static asset import in OrderRefunds.stories.tsx to use default import instead of wildcard import, following Vite best practices and Copilot recommendation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@kzuraw kzuraw marked this pull request as ready for review October 23, 2025 11:36
@kzuraw kzuraw requested a review from a team as a code owner October 23, 2025 11:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 14 out of 18 changed files in this pull request and generated no new comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@kzuraw kzuraw merged commit ce21daf into main Oct 24, 2025
21 checks passed
@kzuraw kzuraw deleted the eng-773-orders-v2-avatar-1 branch October 24, 2025 06:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip changeset Use if your changes doesn't need entry in changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants