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

Landing page's SeasonCountdownSection component #368

Merged
merged 22 commits into from
May 3, 2024

Conversation

kpyszkowski
Copy link
Contributor

Ref: #355

Goal:

To implement Landing page's SeasonCountdownSection component

Features:

  • Reusable CountdownTimer component with fancy digits animation
  • Scroll controlled parallax background animation with dynamic noise
  • Animated pulse ornament in Live tag element
image

Adjusted section's background, added additional theme spacing values,
adjusted Tag component theme, fixed potential memory leak in background
dynamic noise seed.
Copy link

netlify bot commented Apr 16, 2024

Deploy Preview for acre-dapp-testnet ready!

Name Link
🔨 Latest commit a4ba563
🔍 Latest deploy log https://app.netlify.com/sites/acre-dapp-testnet/deploys/661f976820d1c500093f6d82
😎 Deploy Preview https://deploy-preview-368--acre-dapp-testnet.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@kpyszkowski kpyszkowski self-assigned this Apr 16, 2024
dapp/src/pages/LandingPage/SeasonCountdownSection.tsx Outdated Show resolved Hide resolved
dapp/src/pages/LandingPage/SeasonCountdownSection.tsx Outdated Show resolved Hide resolved
dapp/src/pages/LandingPage/index.tsx Outdated Show resolved Hide resolved
dapp/src/theme/Tag.ts Show resolved Hide resolved
Copy link
Contributor

@ioay ioay left a comment

Choose a reason for hiding this comment

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

Please add information about the number of the closed task in PR description:
Closes: #368

@kpyszkowski
Copy link
Contributor Author

@ioay
Copy link
Contributor

ioay commented Apr 17, 2024

@ioay Ref: #368 (review) It's redundant, merging the referencing pull request also closes the referenced pull request.

I mean using a link to a task related to this PR (#368), not to an epic (#355) :)

@kpyszkowski
Copy link
Contributor Author

I mean using a link to a task related to this PR (#368), not to an epic (#355) :)

I don't see any problems. I indicated the issue #355 (not epic) as a reference to this PR.
I don't want to close the issue by merging this PR because there are many PRs yet to be merged in order to complete this issue. After all the issue will be closed. 🙂

@ioay
Copy link
Contributor

ioay commented Apr 17, 2024

I mean using a link to a task related to this PR (#368), not to an epic (#355) :)

I don't see any problems. I indicated the issue #355 (not epic) as a reference to this PR. I don't want to close the issue by merging this PR because there are many PRs yet to be merged in order to complete this issue. After all the issue will be closed. 🙂

Ahh, I assumed that every PR created refers to a subtask created in #355 :) In the future, let's try to create PR per task, and provide the division you used in separate commits 👍🏻

@ioay
Copy link
Contributor

ioay commented Apr 17, 2024

Screen.Recording.2024-04-17.at.18.52.16.mov

Let's update the cursor type to default on hover.

@kpyszkowski kpyszkowski changed the base branch from main to landing-page April 18, 2024 12:04
@kpyszkowski kpyszkowski force-pushed the landing-season-countdown-section branch from 7736be0 to e958c8e Compare April 18, 2024 12:09
@ioay
Copy link
Contributor

ioay commented Apr 22, 2024

Let's handle dates from the past and instead of displaying NaN values we should use 0:

Screenshot 2024-04-22 at 17 56 13

@kpyszkowski
Copy link
Contributor Author

Let's handle dates from the past and instead of displaying NaN values we should use 0

Ref commit: b876889

@ioay
Copy link
Contributor

ioay commented Apr 23, 2024

We should catch these glitches on window resize (useSize hook should be helpful):

Screen.Recording.2024-04-23.at.12.02.40.mov

@kpyszkowski
Copy link
Contributor Author

kpyszkowski commented Apr 23, 2024

We should catch these glitches on window resize (useSize hook should be helpful)

Resolved the issue. Used useSize hook provided by Chakra. Perhaps it should be considered to remove the hook you propose in favor of existing solution.
There is still a little glitch as a value changes (right edge of SVG updates with a slight delay). Not a blocker. Could be resolved in the future. Left todo comment.

Ref commit: 32db87b

@kpyszkowski kpyszkowski requested a review from ioay April 25, 2024 10:08
Copy link
Contributor

@r-czajkowski r-czajkowski left a comment

Choose a reason for hiding this comment

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

Left few non-blocking comments overall the code LGTM.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would consider moving the SeasonCountdownSection dir to the pages/LandingPages/components because it is rather not a shared component but specific for landing page.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ref commit: a26e6ea

Copy link
Contributor

@kkosiorowska kkosiorowska May 1, 2024

Choose a reason for hiding this comment

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

I agree that it should be in the pages/LandingPages directory but I am not convinced about nesting it in the components directory. More info here.

<Box
as="rect"
mixBlendMode="soft-light"
// TOOD: Investigate width update delay
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we going to address it in a separate PR? Or maybe it's already addressed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a barely noticeable issue. Most of ppl won't even notice.
I gave it a shot and it looks like we can't do much with it. It's browser specific and depends on how the browser (Chromium in Ledger Live's case) processes SVG transformations.
Let's leave it for possible future consideration.

Copy link
Member

Choose a reason for hiding this comment

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

If we want to spend more time on the investigation in the future let's create an issue and add it to the list at #154 EPIC.
If there is nothing more we can do let's live with it and remove the TODO.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@r-czajkowski
Copy link
Contributor

I still see NaN (on preview link https://deploy-preview-368--acre-dapp-testnet.netlify.app/)

obraz

Also, there is a weird scroll effect lot of space at the bottom. Not sure if this is intentional.

Nagranie.z.ekranu.2024-04-26.o.18.29.07.mov

There was a bug where the negative values returned by `useCountdown`
hook were parsed incorrectly. This commit simplifies the approach
leveraging `reduce` array method.

Also added new type definition - Tuple
@kpyszkowski
Copy link
Contributor Author

kpyszkowski commented Apr 29, 2024

@r-czajkowski

I still see NaN (on preview link https://deploy-preview-368--acre-dapp-testnet.netlify.app/)

There is an issue with preview deployment target branch resolution as discussed on weekly call.
The preview is stale. Please checkout on the branch locally in order to perform tests.

Nevertheless by deeper analysis of NaN values issue I discovered one more bug caused by the way the useCountdown is designed. When the timestamp is passed, time units returned by the hook are negative values instead of 0 (counter intuitive, perhaps bug of the hook ???).

I resolved it on the level of component. Perhaps we'd like to resolve it globally on the level of hook. Not sure if negative values is expected behaviour. As i said - counter intuitive to me.

Ref commit: 99ba8fb

Comment on lines +16 to +32
defaultProps: { variant: "outline" },
baseStyle: {
container: containerStyle,
},
variants: {
solid: {
container: {
borderWidth: 0,
},
},
outline: {
container: {
borderColor: "white",
borderWidth: 1,
},
},
},
Copy link
Contributor

Choose a reason for hiding this comment

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

I would like to avoid this approach. I feel that this makes the theme less readable. What do you think about it? Chakra does it similarly see here.

const multiStyleConfig = createMultiStyleConfigHelpers(parts.keys)

const baseStyleContainer = defineStyle({
  borderRadius: "full",
  w: "fit-content",
  bg: "gold.100",
  paddingX: 4,
  paddingY: 2.5,
  shadow: "none",
})

const baseStyle = multiStyleConfig.definePartsStyle({
  container: baseStyleContainer,
})

const variantSolid = multiStyleConfig.definePartsStyle({
  container: {
    borderWidth: 0,
  },
})

const variantOutline = multiStyleConfig.definePartsStyle({
  container: {
    borderColor: "white",
    borderWidth: 1,
  },
})

const variants = {
  solid: variantSolid,
  outline: variantOutline,
}

export const tagTheme = multiStyleConfig.defineMultiStyleConfig({
  defaultProps: { variant: "outline" },
  baseStyle,
  variants,
})

Comment on lines +24 to +26
<Heading fontSize="5xl" fontWeight="bold" mb={4}>
Season 1. Pre-launch staking
</Heading>
Copy link
Contributor

Choose a reason for hiding this comment

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

We would probably want to use an already prepared component for this. I know that style guide is not yet ready but I believe that it will make it easier for us to standardize later.

Suggested change
<Heading fontSize="5xl" fontWeight="bold" mb={4}>
Season 1. Pre-launch staking
</Heading>
<H3 fontWeight="bold" mb={4}>
Season 1. Pre-launch staking
</H3>

Comment on lines +27 to +30
<Text fontSize="lg" fontWeight="medium" mb={10}>
Season 1 users that stake bitcoin before Acre launches earn the <br />
highest rewards and first access to upcoming Seasons.
</Text>
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar situation as above.

Suggested change
<Text fontSize="lg" fontWeight="medium" mb={10}>
Season 1 users that stake bitcoin before Acre launches earn the <br />
highest rewards and first access to upcoming Seasons.
</Text>
<TextLg mb={10}>
Season 1 users that stake bitcoin before Acre launches earn the <br />
highest rewards and first access to upcoming Seasons.
</TextLg>

CountdownTimer,
} from "#/components/shared/SeasonCountdownSection"

const MOCK_SEASON_DUE_TIMESTAMP = new Date(2024, 3, 30).getTime() / 1000
Copy link
Contributor

Choose a reason for hiding this comment

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

We can do it later but just flagging. We would probably want to save this as an env variable. Then save this value in constants.

VITE_SEASON_START_DATE="2024-03-30"

Example solution for VITE_REFERRAL:

export const REFERRAL = import.meta.env.VITE_REFERRAL

Comment on lines -10 to 20
px={10}
px={16} // 40px + 24px
pb={10}
maxW="100.625rem"
maxW="87.25rem" // 1268px + 2 * (40px + 24px)
mx="auto"
>
<HeroSection />
<SeasonCountdownSection />
</Flex>
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't quite understand what's going on here. 😅 I don't quite understand why we set maxW.

Why can't we do it like this? 🤔

    <Flex flexDirection="column">
      <HeroSection />
      <SeasonCountdownSection />
    </Flex>

Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest to change the name of this directory. More information here. SeasonCountdownSection as a directory has no exports and likely will never export a component with this name. If we can let's use lowercasing directory names like this that are purely categorical.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we don't need to nest these components in the components directory. I have a feeling that this may cause some confusion. Please check this thread. I believe that if the LandingPage folder grows we will think about some refactoring on structure.

@nkuba nkuba mentioned this pull request May 3, 2024
Copy link
Contributor

@kkosiorowska kkosiorowska left a comment

Choose a reason for hiding this comment

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

I don't want to block this PR. Overall, it looks good. I left some comments/suggestions for improvements later. 🚀

@kkosiorowska kkosiorowska merged commit ce6e2f2 into landing-page May 3, 2024
20 checks passed
@kkosiorowska kkosiorowska deleted the landing-season-countdown-section branch May 3, 2024 07:13
kkosiorowska added a commit that referenced this pull request May 9, 2024
Closes: #363 

## Goal:
To implement Landing Page
This PR aggregates all component PRs to finally complete the
implementation of landing page

## Component PRs:
The list of PRs is given in the issue's description. Each component PR
merges to this PR.

- #357
- #358
- #364
- #368
- #369

## Designs:
<img width="1205" alt="image"
src="https://github.com/thesis/acre/assets/11503879/be6b6ed2-a808-483e-9daf-43d2c042cba4">
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.

5 participants