Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

itsjayway
Copy link
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 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

@Copilot 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);

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
Preview

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 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
Preview

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.

@MattIPv4
Copy link
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
Copy link
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
Member

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

@@ -53,6 +53,7 @@ const apiAmbassadorSchema = ambassadorSchema.extend({
key: z.string(),
title: z.string(),
}),
fact: z.string().optional(),
Copy link
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
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)?

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.

2 participants