Skip to content

Include "Did you know?" when fact is present and show on 'back' of AmbassadorCard#332

Open
itsjayway wants to merge 14 commits intoalveusgg:mainfrom
itsjayway:itsjayway/did-you-know-ambassador-cards
Open

Include "Did you know?" when fact is present and show on 'back' of AmbassadorCard#332
itsjayway wants to merge 14 commits intoalveusgg:mainfrom
itsjayway:itsjayway/did-you-know-ambassador-cards

Conversation

@itsjayway
Copy link
Copy Markdown
Contributor

Reference: #325

Hey all, I'm back! This is an MVP of implementation. It's currently missing the tailwind 'flip' animation as of the current commits and I'll continue toward delivering that in this PR.

If this is sufficient to proceed, I'm looking for feedback in:

  • "Did you know? ℹ️" placement on the 'front' of the card.
  • Card 'back' formatting
  • Implementation
Screen.Recording.2025-07-10.034824.mp4

Copilot AI review requested due to automatic review settings July 10, 2025 07:52
@itsjayway itsjayway requested a review from a team as a code owner July 10, 2025 07:52
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 introduces a “Did you know?” fact feature to the AmbassadorCard component, allowing users to flip the card to see an ambassador’s fun fact. Key changes include:

  • Extending the ambassador schema to include an optional fact field.
  • Adding state and callback (useState/useCallback) to flip between front and back views.
  • Conditionally rendering a “Did you know?” trigger on the front and displaying the fact on the back.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
src/hooks/useAmbassadors.tsx Added fact as an optional field in the Zod schema
src/components/AmbassadorCard.tsx Implemented flip state, UI for “Did you know?” and back-side layout
Comments suppressed due to low confidence (2)

src/components/AmbassadorCard.tsx:43

  • [nitpick] The state variable flipped is ambiguous—consider renaming to isFlipped for clarity.
  const [flipped, setFlipped] = useState(false);

src/components/AmbassadorCard.tsx:43

  • New flip logic and fact display should be covered by unit or integration tests to ensure correct behavior when toggling the card.
  const [flipped, setFlipped] = useState(false);

Comment thread src/components/AmbassadorCard.tsx Outdated
className="rounded-full text-alveus-green-400 outline-highlight transition-[outline] hover:outline-3"
onClick={flipCard}
aria-label="Flip card to see fact"
cursor="pointer"
Copy link

Copilot AI Jul 10, 2025

Choose a reason for hiding this comment

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

The cursor prop on IconInfo isn’t a valid React prop. Consider moving this into the className (e.g. className="cursor-pointer").

Suggested change
cursor="pointer"
className="rounded-full text-alveus-green-400 outline-highlight transition-[outline] hover:outline-3 cursor-pointer"

Copilot uses AI. Check for mistakes.
Comment thread src/components/AmbassadorCard.tsx Outdated
Comment thread src/components/AmbassadorCard.tsx Outdated
Comment on lines +363 to +368
<div
className={classes(
"relative flex max-h-full min-h-[min(28rem,100%)] w-80 max-w-full flex-col justify-start rounded-lg bg-alveus-green-900 align-top text-xs shadow-xl",
className,
)}
>
Copy link

Copilot AI Jul 10, 2025

Choose a reason for hiding this comment

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

[nitpick] The front and back sides share a lot of similar container markup. Consider extracting common layout or styling into a shared component to reduce duplication.

Suggested change
<div
className={classes(
"relative flex max-h-full min-h-[min(28rem,100%)] w-80 max-w-full flex-col justify-start rounded-lg bg-alveus-green-900 align-top text-xs shadow-xl",
className,
)}
>
<CardContainer className={className}>

Copilot uses AI. Check for mistakes.
Comment thread src/components/AmbassadorCard.tsx Outdated
@MattIPv4
Copy link
Copy Markdown
Member

MattIPv4 commented Jul 10, 2025

👀 Thank you for working on this! I think I agree with a lot of the feedback that copilot is giving.

Instead of having it be a heading with an icon that you need to clip, perhaps we could do a peeking/peeling corner that the user can click on to flip the card over? And perhaps when they hover on that corner we show a tooltip to give context on clicking to flip?

And I think quite important to this is an actual flip animation rather than just conditionally switching the content, though it sounds like you already plan to work on that!

itsjayway and others added 8 commits July 12, 2025 21:49
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@itsjayway
Copy link
Copy Markdown
Contributor Author

Currently the simplest way I could manage rendering the dogear. It should be possible to have the fold "bring more with it" via translate-x/y, but that would reveal the unclipped portion of the card.

Screen.Recording.2025-07-13.000131.mp4

@MattIPv4
Copy link
Copy Markdown
Member

That looks great -- I think with a shadow on that, and the tooltip, it should be just fine.

key: z.string(),
title: z.string(),
}),
fact: z.string().optional(),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is the fact not already part of ambassadorSchema?

@MattIPv4
Copy link
Copy Markdown
Member

One other thought, I wonder if it'd be worth splitting AmbassadorCard.tsx into ambassador/card-front.tsx + ambassador/card-back.tsx + ambassador/card.tsx (and AmbassadorButton.tsx could also move to ambassador/button.tsx)?

@MattIPv4
Copy link
Copy Markdown
Member

MattIPv4 commented Aug 2, 2025

👋 @itsjayway how're things going on this? Anything I can do to help get this landed?

@itsjayway
Copy link
Copy Markdown
Contributor Author

itsjayway commented Aug 4, 2025

hey @MattIPv4, got absolutely cooked at work the week following my commits here 😅 things should free up this week. I'll make an effort to progress/share blockers here, apologies again.

@MattIPv4
Copy link
Copy Markdown
Member

@itsjayway how're things going, any progress update on here?

Comment thread src/components/Dogear.tsx
{/* Credits to https://codepen.io/rachelslurs/pen/xxoPKLg */}
<div
className={classes(
"absolute top-0 right-0 w-0 border-13 border-solid border-t-transparent border-r-transparent border-b-alveus-green border-l-alveus-green transition-all duration-300 ease-in-out hover:scale-[1.6] sm:border-15 md:border-18 lg:border-20",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

magic numbers 😩 ensures consistent sizing across window widths. an alternative could be borderWidth: "clamp(13px, 2vw, 20px)", but it was not satisfactory for certain window widths regardless the preferred value

@itsjayway
Copy link
Copy Markdown
Contributor Author

thanks for your patience @MattIPv4, life's butt-kicking again but here is another iteration for an MVP. something annoying to note with the Dogear's current state: if the image is hovered and expanded, when hovering the Dogear, the image contracts, 'evading' the cursor.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants