Include "Did you know?" when fact is present and show on 'back' of AmbassadorCard#332
Include "Did you know?" when fact is present and show on 'back' of AmbassadorCard#332itsjayway wants to merge 14 commits intoalveusgg:mainfrom
Conversation
There was a problem hiding this comment.
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
factfield. - 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
flippedis ambiguous—consider renaming toisFlippedfor 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" |
There was a problem hiding this comment.
The cursor prop on IconInfo isn’t a valid React prop. Consider moving this into the className (e.g. className="cursor-pointer").
| cursor="pointer" | |
| className="rounded-full text-alveus-green-400 outline-highlight transition-[outline] hover:outline-3 cursor-pointer" |
| <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, | ||
| )} | ||
| > |
There was a problem hiding this comment.
[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.
| <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}> |
|
👀 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! |
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>
|
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 |
|
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(), |
There was a problem hiding this comment.
Is the fact not already part of ambassadorSchema?
|
One other thought, I wonder if it'd be worth splitting |
|
👋 @itsjayway how're things going on this? Anything I can do to help get this landed? |
|
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. |
|
@itsjayway how're things going, any progress update on here? |
| {/* 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", |
There was a problem hiding this comment.
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
|
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. |
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:
Screen.Recording.2025-07-10.034824.mp4