Skip to content
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

Andy/store item page #94

Merged
merged 106 commits into from
Feb 18, 2024
Merged

Andy/store item page #94

merged 106 commits into from
Feb 18, 2024

Conversation

WishingWell13
Copy link
Contributor

@WishingWell13 WishingWell13 commented Nov 28, 2023

Info

Closes #56

Description

What changes did you make? List all distinct problems that this PR addresses. Explain any relevant
motivation or context.

Create the store item page at /store/item/[item-uuid] based on these figma designs (check the 'ready for dev' sections).

Requires #54.

Encompasses

  • Desktop layout for item page

To Do:

Changes

  • Designed Desktop item page under src\pages\store\item\[uuid].tsx

Type of Change

  • Bug Fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as
    expected)
  • Logistics Change (A change to a README, description, or dev workflow setup like
    linting/formatting)
  • Continuous Integration Change (Related to deployment steps or continuous integration
    workflows)
  • Other: (Fill In)

Testing

I have tested that my changes fully resolve the linked issue ...

  • locally on Desktop.
  • locally on mobile - use https://ngrok.io to get a copy on a mobile device
  • on the live deployment preview on Desktop.
  • on the live deployment preview on Mobile.
  • I have run and passed all new and existing Cypress tests. Add screenshots below.
image

Checklist

  • I have performed a self-review of my own code.
  • I have followed the style guidelines of this project.
  • I have documented my code's src/lib functions and commented hard to understand areas
    anywhere else.
  • My changes produce no new warnings.

Screenshots

Please include a screenshot of your Cypress testing suite passing successfully.
image

If you made any visual changes to the website, please include relevant screenshots below.
image

image

image

Copy link

vercel bot commented Nov 28, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
membership-portal-ui-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 17, 2024 10:04pm

Size toggle styling implemented

On selected text goes blue

On hover border goes blue
Made a temporary edit to the title of the page that displays the current size selected as testing
Got text color to change depending on if in stock or not (is currently hard coded, not synced to backend)

Button animation still exists, need to make it flat

Text changes based on if in stock or not

Still need to do styling for button if item is out of stock
Updated button theming to change based on if in stock or not

A size is now not selected by default, message requesting user to select a size added.
From last update, where made it possible for size to be undefined.
Price now displays. No discount display yet

TODO: Modify size buttons to be dynamic depending on how many options there are.
TODO: Might be a good idea to change the "add to cart" message depending on if you have reached lifetime limits
Copy link
Contributor

@alexzhang1618 alexzhang1618 left a comment

Choose a reason for hiding this comment

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

For variantless items, should this say Add to Cart instead of Select a Size? Or are we waiting for cart implementation to come through first?
Screenshot 2024-02-15 at 1 22 40 PM

Besides this, everything else LGTM

src/components/store/SizeSelector/index.tsx Outdated Show resolved Hide resolved
src/pages/store/item/[uuid].tsx Outdated Show resolved Hide resolved
Changed add to cart text to be always white

Fixed bug where optionless items would have "please select a size" as an option.
Copy link
Contributor

@alexzhang1618 alexzhang1618 left a comment

Choose a reason for hiding this comment

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

brilliant 🤩 good to merge after these two nits

src/components/store/CartOptionsGroup/index.tsx Outdated Show resolved Hide resolved
Also added comment for business logic behind maxCanBuy
@farisashai
Copy link
Member

This should not be a dropdown tbh because there's no reason to list every number when it can get arbitrarily large- it should be a numeric input field that provides an error message if the input is invalid. We should open a separate issue for this fix before merging this since it's not a quick change

image

@farisashai
Copy link
Member

From the perspective of not over complicating components and isolating a single purpose to each one, I think it would make a lot more sense for the Add to Cart button to never change its text. instead, there should be a Boolean prop passed in whether to disable (grey out) the action or not. The error should be explained on the page itself in the spot where it says "You can buy up to 1 of this item" because right now that text is misleading saying you can buy 1 but it's actually out of stock

image

@farisashai
Copy link
Member

For whatever reason, it seems like a lot of images that have been uploaded to the store historically have a transparent region in the png. We should account for this by adjusting the design in some way with a border or shadow to highlight the image in separation from the page

image

Copy link
Member

@farisashai farisashai left a comment

Choose a reason for hiding this comment

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

some quick tiny comments but everything seems good now - will approve after we have issues covering all of the earlier comments I mentioned

src/styles/pages/StoreItemPage.module.scss Outdated Show resolved Hide resolved
src/components/store/CartOptionsGroup/index.tsx Outdated Show resolved Hide resolved
src/pages/store/item/[uuid].tsx Show resolved Hide resolved
src/components/store/CartOptionsGroup/index.tsx Outdated Show resolved Hide resolved
@farisashai
Copy link
Member

I think we're all aware of this last point but we also need an issue for the add to cart button to open a modal that lets the user confirm adding the item to the actual cart, however Raymond decides to implement that

Copy link
Member

@farisashai farisashai left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@WishingWell13 WishingWell13 merged commit 29ac7c4 into main Feb 18, 2024
5 checks passed
@WishingWell13 WishingWell13 deleted the andy/StoreItemPage branch February 18, 2024 00:58
SheepTester added a commit that referenced this pull request Feb 20, 2024
* Rough outline of SizeSelector

* Created a file to represent the item page

* Edited config file to be nested under "Store" header

* Size Toggle V1, Styling Only

Size toggle styling implemented

On selected text goes blue

On hover border goes blue

* State of SizeToggle now passed up to the item page

Made a temporary edit to the title of the page that displays the current size selected as testing

* Updated styling of size selector to match Figma

https://www.figma.com/file/cgbeW6vrqgxW0i1vpbUn1C/Store-(Redesign-2023)?type=design&node-id=2028-16321&mode=design&t=nbIfHwdT8aeDdhsd-0

* Part 1 of AddCartButton styling

Got text color to change depending on if in stock or not (is currently hard coded, not synced to backend)

Button animation still exists, need to make it flat

Text changes based on if in stock or not

Still need to do styling for button if item is out of stock

* Out of Stock Button and "Please Select Size"

Updated button theming to change based on if in stock or not

A size is now not selected by default, message requesting user to select a size added.

* Fixed issue with AddCartButton props breaking

From last update, where made it possible for size to be undefined.

* Began formatting for item header and item page

* Store Component now linked to API, price added

Price now displays. No discount display yet

TODO: Modify size buttons to be dynamic depending on how many options there are.

* Size Selection Buttons Now Dynamically Generated

* Buy ability based on lifetime/monthly limits, added item picture

TODO: Might be a good idea to change the "add to cart" message depending on if you have reached lifetime limits

* Cleaned up some old comments

* Moved Navbar to top of page

* Resolved linting error (unused var)

* Update src/styles/pages/store/item.module.scss

Co-authored-by: Faris Ashai <[email protected]>

* Update src/styles/pages/store/item.module.scss

Co-authored-by: Faris Ashai <[email protected]>

* Update src/styles/pages/store/item.module.scss

Co-authored-by: Faris Ashai <[email protected]>

* Update src/lib/api/StoreAPI.ts

Co-authored-by: Faris Ashai <[email protected]>

* Resolved merge error with calendar

And API type error

* Minor package changes

* Fix package.json

* Make compatible with multiple store gallery images

No carousel yet, uses default photo as photo shown

* Moved item header to be above sizing buttons

* Centered the body of the item page.

* Fixed merge error by updating name of file path

* Update src/styles/pages/store/item.module.scss

Co-authored-by: Faris Ashai <[email protected]>

* Update src/pages/store/item/[uuid].tsx

Co-authored-by: Sean <[email protected]>

* Update src/pages/store/item/[uuid].tsx

Co-authored-by: Sean <[email protected]>

* Update src/pages/store/item/[uuid].tsx

Co-authored-by: Sean <[email protected]>

* Update .vscode/settings.json

Co-authored-by: Faris Ashai <[email protected]>

* Update src/styles/pages/store/item.module.scss

Co-authored-by: Faris Ashai <[email protected]>

* Update src/components/store/AddCartButton/index.tsx

Co-authored-by: Faris Ashai <[email protected]>

* Addressed PR comments, Add to Cart button behavior edit

Updated Add to Cart button to also say "remove from cart"

Quantity Selector now disappear if you can't add to cart or size is not selected.

Add to Cart button disappear if a size is not selected.

Removed various comments

Removed useEffect

* Updated diamond component in Item Header

Diamond component displays cost

* Add To Cart button disappears when UserPurchaseLimit reached

* AddCartButton maxCanBuy saftey checks and styling

Added an option for 0 quantity if user has reached purchase limit

* Renamed styling files, AddToCart Button Behavior Change

Add To Cart button now displays when user has reached purchase limit, but is greyed out and cannot be clicked

* Added border back to disabled AddToCart Button

* Added border back to cart button, cleaned up unused vars

* Hid toggle when maxCanBuy = 1

Also lifted quantity of items up to uuid.tsx

* Removed unused comments

* Removed eslint disable lines

* Removed title attribute from buy button

#94 (comment)

* Removed trailing spaces from button text

#94 (comment)

* Hide price when size is not selected

Also removed mounted checks from `SizeSelector`

importing only types from UUID

* Added back other types accidently deleted from last commit

* Delete blue-diamond.svg

* Basic mobile formatting implemented

Still need to sync it with Figma

* Add edit buttons to store page

* Copy event edit page for store item edit page

* item details form

* Set item collection, preview store as member

* Add create buttons to storefront page

* Collection edit page

* API for creating/deleting store item photos/options

* Fix making changes to collections

* Fixed image clipping issue, reduced image gap on mobile

* Removed vertical scrollbar from mobile view

Used scrollbar hide, may need to look into why is actually overflowing later.

* Removed unnecessary CSS

* item options table

* Add multiple options

* fix type error

* Rename store/collections.module.scss to be consistent with other changes in PR

* Fix duplicate `getCollection` definitions

* Make API .d.ts files normal TypeScript files so it actually reports errors

* Upload photos

* Enforce limits

* PermissionService.allUserTypes is no longer a function

* Make edit and create button components and add them to collection page

* Add edit button to item page, show 404 when item/collection DNE

* Show hidden/archived icons

* Make the edit forms look nicer

* Fixed a linting error with the options dropdown

* Shrunk some UI items for mobile version of site

* Set upper limit on quantity of items can buy

* Deleted unnecessary comments

* Update src/components/store/SizeSelector/index.tsx

Co-authored-by: Sean <[email protected]>

* Fixed various linting errors, removed comments

Also updated gaps

* Decreased font size of dropdown text

* fix item cards' edit button

* Overengineered Draggable component

* drag handle design adjustments

* Some input validation

* Save preview as member option in cookie rather than URL

* My JavaScript is too future for Vercel 😔

* Make design look more acceptable on mobile

* New styling changes to adjust spacing

IN PROGRESS

* Locked width of description and fixed line breaks

Also adjusted title/paragraph sizes and weight

Also centered the webpage

* Title now properly wraps with very long titles

Also deleted some unused styling classes

Also adjusted one column width threshold.

* Made padding a little bigger for right column

Also fixed bug where price would cause an extra gap in object header, even when not visible

* Removed in stock / out of stock messages

Also bumped the "add to cart" button up a little bit

* @media now uses the media breakpoint variables

* Renamed variables and adjusted white space behavior

* Update src/components/store/AddCartButton/index.tsx

Co-authored-by: Faris Ashai <[email protected]>

* Update src/components/store/AddCartButton/style.module.scss

Co-authored-by: Sean <[email protected]>

* Fixed some gap inconsistencies

* Update settings.json

* Update settings.json

* Made SizeSelector title change based on metadata

* Fixed bug where add to cart button no longer worked

Was due to comparison for current option not being properly updated with new system (needed a `.value`)

Also made image container always square.

* Condensed imports in `uuid`, removed "Remove from Cart" text

Note that clicking "Add to Cart" again removes item from cart.

* Fuss with store component imports to avoid dependency cycles

* Flatten profile/edit.module.scss

* Replace all `condition && jsx` with `condition ? jsx : null` to conform with style guide

Per #124 (comment)

* Update placeholder text for name; fix going back after creating item going to create page

The collection/item title placeholder text has been made more relevant

After creating an item, it redirects you to the edit page so when you click back, it doesn't go to an empty create item form anymore. Same with collection

* Restructure details form component files

* Quantity -> Quantity available in table, redirect to public page after creating item/collection, fix admin buttons on mobile

* Before attempting to remove currOption

I think I can collapse it into selectedOption

* rename cookie type PREVIEW -> USER_PREVIEW_ENABLED

* Made the "please select an option" text to show key value

So instead of always saying "size" or "option" it will show "color" if the options are colors

* Add discount and out of stock to item card

* canManageStore -> storeAdminVisible

* Update src/components/store/AddCartButton/style.module.scss

Co-authored-by: Sean <[email protected]>

* Refactor store api stuff to manager, options table to component

* Changed AddCartButton to CartOptionsGroup

Also various small bug fixes from PR

- Made the options `input` tags not selectable

- Removed unecessary CSS

* Removed unnecessary properties, simplified CSS

* Refactor all managers to use `reportError`

* Change Manage Store Merchandise button to View Merch Store when preview is checked

* Debugging cookie desync issue

* how about collection page

* Change service worker strategy to network first

This fixes the admin preview store as member cookie being out of sync, but it also means slower page loads for the user

* Require that monthlyLimit <= lifetimeLimit

* Minor code quality adjustments from store item PR

* Fix store slider scrollbars in Chrome 121+

* Only disable caching for store pages

Also change `withAccessType` to use an options object so it's more clear what the parameters do

* Handle showing error toasts in Cropper

* export scss variable to default collection color

* minor nitfixes

* Move `reportError` out of admin store manager to make error handling more clear

* make spacing of code look more consistent

* Revert back to global NetworkFirst, remove `disableCaching`

---------

Co-authored-by: Andrew Smithwick <[email protected]>
Co-authored-by: Faris Ashai <[email protected]>
Co-authored-by: Alex Zhang <[email protected]>
@SheepTester SheepTester mentioned this pull request Feb 21, 2024
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create Store Item Page
4 participants