-
Notifications
You must be signed in to change notification settings - Fork 31
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
Added shop details #1044
Merged
+135
−26
Merged
Added shop details #1044
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c01f604
Added shop details
BudzioT f6807de
Prettier the shop
BudzioT e0496ef
Removed customs for US filter
BudzioT 5815ce3
Forgot to prettier one change -_-
BudzioT d1b3400
Fixed item details
BudzioT ba8e1b8
Prettier
BudzioT 9f3e553
Fixed shop details stuff
BudzioT 10b04cc
Merge branch 'main' of https://github.com/hackclub/high-seas into sho…
BudzioT ba13684
Prettier
BudzioT File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,10 +10,12 @@ import { | |
CardTitle, | ||
} from '@/components/ui/card' | ||
import { Button } from '@/components/ui/button' | ||
import { useMemo } from 'react' | ||
import React, { useMemo, useState } from 'react' | ||
import { cantAffordWords, purchaseWords, sample } from '../../../../lib/flavor' | ||
import Icon from '@hackclub/icons' | ||
import { transcript } from '../../../../lib/transcript' | ||
import Modal from '@/components/ui/modal' | ||
import Image from 'next/image' | ||
const ActionArea = ({ item, filterIndex, affordable }) => { | ||
const buyWord = useMemo(() => sample(purchaseWords), [item.id]) | ||
const getYourRacksUp = useMemo(() => sample(cantAffordWords), [item.id]) | ||
|
@@ -47,6 +49,8 @@ export const ShopItemComponent = ({ | |
setFavouriteItems, | ||
favouriteItems, | ||
}) => { | ||
let [detailsModal, setDetailsModal] = useState(false) | ||
|
||
const cardHoverProps = { | ||
whileHover: { | ||
scale: 1.05, | ||
|
@@ -89,9 +93,85 @@ export const ShopItemComponent = ({ | |
}) | ||
} | ||
|
||
const linkIndex = Number(filterIndex) - 1 | ||
|
||
return ( | ||
<motion.div {...cardHoverProps}> | ||
<motion.div {...cardHoverProps} className="cursor-pointer"> | ||
<Modal isOpen={detailsModal} close={() => setDetailsModal(false)}> | ||
<div className="flex flex-col max-h-[60vh] overflow-y-auto px-2 mb-5"> | ||
<h2 className="text-3xl">{item.name}</h2> | ||
<h3 | ||
className="text-xl" | ||
dangerouslySetInnerHTML={{ __html: item.subtitle }} | ||
></h3> | ||
<img | ||
src={item.imageUrl} | ||
alt={item.name} | ||
className="max-w-sm mx-auto my-3" | ||
/> | ||
|
||
{item.description && ( | ||
<p | ||
className="my-5" | ||
dangerouslySetInnerHTML={{ __html: item.description }} | ||
></p> | ||
)} | ||
|
||
<Image | ||
src="/hr.svg" | ||
className="w-2/3 mx-auto my-3" | ||
alt="" | ||
width={461} | ||
height={11} | ||
/> | ||
|
||
{item.limited_qty && ( | ||
<i className="mt-3 text-amber-100"> | ||
This item is limited, buy it while you can! | ||
</i> | ||
)} | ||
|
||
{item.fulfillment_description && ( | ||
<p | ||
className="my-2 text-lg" | ||
dangerouslySetInnerHTML={{ __html: item.fulfillment_description }} | ||
></p> | ||
)} | ||
|
||
{item.links && linkIndex >= 0 && item.links[linkIndex] && ( | ||
<p> | ||
We will most likely order it from{' '} | ||
<a | ||
className="underline" | ||
target="_blank" | ||
href={item.links[Number(filterIndex) - 1]} | ||
> | ||
this link | ||
</a> | ||
</p> | ||
)} | ||
|
||
{item.customs_likely && linkIndex !== 0 && ( | ||
<p className="font-bold italic text-xl"> | ||
Customs may apply outside of US! | ||
</p> | ||
)} | ||
</div> | ||
|
||
<Button | ||
className="float-right mr-10" | ||
onClick={() => setDetailsModal(false)} | ||
> | ||
Close | ||
</Button> | ||
</Modal> | ||
|
||
<Card | ||
onClick={(e) => { | ||
if (e.target.tagName !== 'BUTTON' && e.target.tagName !== 'FORM') { | ||
setDetailsModal(true) | ||
} | ||
}} | ||
id={id} | ||
className="h-full flex flex-col overflow-hidden shadow-lg transition-shadow duration-300 hover:shadow-xl" | ||
> | ||
|
@@ -116,7 +196,7 @@ export const ShopItemComponent = ({ | |
height={20} | ||
className="mr-1" | ||
/> | ||
{localPrice} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you mean to remove this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed it earlier to |
||
{filterIndex == 1 ? item.priceUs : item.priceGlobal} | ||
</span> | ||
|
||
{item.minimumHoursEstimated && item.maximumHoursEstimated ? ( | ||
|
@@ -133,7 +213,9 @@ export const ShopItemComponent = ({ | |
<img | ||
src={item.imageUrl} | ||
alt={item.name} | ||
onClick={() => { | ||
onClick={(e) => { | ||
e.stopPropagation() | ||
setDetailsModal(false) | ||
let interaction = transcript('item.base', { | ||
name: item.name, | ||
price: localPrice, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the React import?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Webstorm playing tricks again... fixed