diff --git a/api/functions/nostr-events-extra-data/nostr-events-extra-data.js b/api/functions/nostr-events-extra-data/nostr-events-extra-data.js index 9a395aa..b1d00f5 100644 --- a/api/functions/nostr-events-extra-data/nostr-events-extra-data.js +++ b/api/functions/nostr-events-extra-data/nostr-events-extra-data.js @@ -23,12 +23,19 @@ const getEventsExtraData = async (req, res) => { select: { id: true, avatar: true, + avatar_rel: { + select: { + url: true, + } + }, name: true, } } } }); + comments.map(c => c.user.avatar = c.user.avatar_rel?.url ?? c.user.avatar) + return res .status(200) .json(comments) diff --git a/api/prisma/index.js b/api/prisma/index.js index 2013b99..1ad9482 100644 --- a/api/prisma/index.js +++ b/api/prisma/index.js @@ -1,7 +1,6 @@ -const { PrismaClient } = require('@prisma/client'); +const { PrismaClient } = require('@prisma/client/edge'); const createGlobalModule = require('../utils/createGlobalModule'); - const createPrismaClient = () => { console.log("New Prisma Client"); return new PrismaClient({ diff --git a/package-lock.json b/package-lock.json index 19b851c..e799708 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "@apollo/client": "^3.6.9", "@hookform/resolvers": "^2.8.8", "@noble/secp256k1": "^1.6.3", - "@prisma/client": "^3.12.0", + "@prisma/client": "^4.3.1", "@react-hookz/web": "^13.2.1", "@react-spring/web": "^9.4.4", "@reduxjs/toolkit": "^1.8.1", @@ -68,7 +68,6 @@ "nostr-tools": "^0.23.4", "passport": "^0.6.0", "passport-lnurl-auth": "^1.5.0", - "prisma": "^3.12.0", "qrcode.react": "^3.0.2", "react": "^18.0.0", "react-accessible-accordion": "^5.0.0", @@ -136,6 +135,7 @@ "msw": "^0.39.2", "netlify-cli": "^10.0.0", "postcss": "^8.4.12", + "prisma": "^4.3.1", "readable-stream": "^4.1.0", "serverless": "^3.22.0", "serverless-offline": "^8.7.0", @@ -5144,15 +5144,15 @@ } }, "node_modules/@prisma/client": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/@prisma/client/-/client-3.12.0.tgz", - "integrity": "sha512-4NEQjUcWja/NVBvfuDFscWSk1/rXg3+wj+TSkqXCb1tKlx/bsUE00rxsvOvGg7VZ6lw1JFpGkwjwmsOIc4zvQw==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@prisma/client/-/client-4.3.1.tgz", + "integrity": "sha512-FA0/d1VMJNWqzU7WVWTNWJ+lGOLR9JUBnF73GdIPAEVo/6dWk4gHx0EmgeU+SMv4MZoxgOeTBJF2azhg7x0hMw==", "hasInstallScript": true, "dependencies": { - "@prisma/engines-version": "3.12.0-37.22b822189f46ef0dc5c5b503368d1bee01213980" + "@prisma/engines-version": "4.3.0-32.c875e43600dfe042452e0b868f7a48b817b9640b" }, "engines": { - "node": ">=12.6" + "node": ">=14.17" }, "peerDependencies": { "prisma": "*" @@ -5164,15 +5164,16 @@ } }, "node_modules/@prisma/engines": { - "version": "3.12.0-37.22b822189f46ef0dc5c5b503368d1bee01213980", - "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-3.12.0-37.22b822189f46ef0dc5c5b503368d1bee01213980.tgz", - "integrity": "sha512-zULjkN8yhzS7B3yeEz4aIym4E2w1ChrV12i14pht3ePFufvsAvBSoZ+tuXMvfSoNTgBS5E4bolRzLbMmbwkkMQ==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-4.3.1.tgz", + "integrity": "sha512-4JF/uMaEDAPdcdZNOrnzE3BvrbGpjgV0FcPT3EVoi6I86fWkloqqxBt+KcK/+fIRR0Pxj66uGR9wVH8U1Y13JA==", + "devOptional": true, "hasInstallScript": true }, "node_modules/@prisma/engines-version": { - "version": "3.12.0-37.22b822189f46ef0dc5c5b503368d1bee01213980", - "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-3.12.0-37.22b822189f46ef0dc5c5b503368d1bee01213980.tgz", - "integrity": "sha512-o+jo8d7ZEiVpcpNWUDh3fj2uPQpBxl79XE9ih9nkogJbhw6P33274SHnqheedZ7PyvPIK/mvU8MLNYgetgXPYw==" + "version": "4.3.0-32.c875e43600dfe042452e0b868f7a48b817b9640b", + "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-4.3.0-32.c875e43600dfe042452e0b868f7a48b817b9640b.tgz", + "integrity": "sha512-8yWpXkQRmiSfsi2Wb/ZS5D3RFbeu/btL9Pm/gdF4phB0Lo5KGsDFMxFMgaD64mwED2nHc8ZaEJg/+4Jymb9Znw==" }, "node_modules/@protobufjs/aspromise": { "version": "1.1.2", @@ -61195,19 +61196,20 @@ } }, "node_modules/prisma": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/prisma/-/prisma-3.12.0.tgz", - "integrity": "sha512-ltCMZAx1i0i9xuPM692Srj8McC665h6E5RqJom999sjtVSccHSD8Z+HSdBN2183h9PJKvC5dapkn78dd0NWMBg==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/prisma/-/prisma-4.3.1.tgz", + "integrity": "sha512-90xo06wtqil76Xsi3mNpc4Js3SdDRR5g4qb9h+4VWY4Y8iImJY6xc3PX+C9xxTSt1lr0Q89A0MLkJjd8ax6KiQ==", + "devOptional": true, "hasInstallScript": true, "dependencies": { - "@prisma/engines": "3.12.0-37.22b822189f46ef0dc5c5b503368d1bee01213980" + "@prisma/engines": "4.3.1" }, "bin": { "prisma": "build/index.js", "prisma2": "build/index.js" }, "engines": { - "node": ">=12.6" + "node": ">=14.17" } }, "node_modules/prismjs": { @@ -74782,22 +74784,23 @@ "integrity": "sha512-9X2obfABZuDVLCgPK9aX0a/x4jaOEweTTWE2+9sr0Qqqevj2Uv5XorvusThmc9XGYpS9yI+fhh8RTafBtGposw==" }, "@prisma/client": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/@prisma/client/-/client-3.12.0.tgz", - "integrity": "sha512-4NEQjUcWja/NVBvfuDFscWSk1/rXg3+wj+TSkqXCb1tKlx/bsUE00rxsvOvGg7VZ6lw1JFpGkwjwmsOIc4zvQw==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@prisma/client/-/client-4.3.1.tgz", + "integrity": "sha512-FA0/d1VMJNWqzU7WVWTNWJ+lGOLR9JUBnF73GdIPAEVo/6dWk4gHx0EmgeU+SMv4MZoxgOeTBJF2azhg7x0hMw==", "requires": { - "@prisma/engines-version": "3.12.0-37.22b822189f46ef0dc5c5b503368d1bee01213980" + "@prisma/engines-version": "4.3.0-32.c875e43600dfe042452e0b868f7a48b817b9640b" } }, "@prisma/engines": { - "version": "3.12.0-37.22b822189f46ef0dc5c5b503368d1bee01213980", - "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-3.12.0-37.22b822189f46ef0dc5c5b503368d1bee01213980.tgz", - "integrity": "sha512-zULjkN8yhzS7B3yeEz4aIym4E2w1ChrV12i14pht3ePFufvsAvBSoZ+tuXMvfSoNTgBS5E4bolRzLbMmbwkkMQ==" + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-4.3.1.tgz", + "integrity": "sha512-4JF/uMaEDAPdcdZNOrnzE3BvrbGpjgV0FcPT3EVoi6I86fWkloqqxBt+KcK/+fIRR0Pxj66uGR9wVH8U1Y13JA==", + "devOptional": true }, "@prisma/engines-version": { - "version": "3.12.0-37.22b822189f46ef0dc5c5b503368d1bee01213980", - "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-3.12.0-37.22b822189f46ef0dc5c5b503368d1bee01213980.tgz", - "integrity": "sha512-o+jo8d7ZEiVpcpNWUDh3fj2uPQpBxl79XE9ih9nkogJbhw6P33274SHnqheedZ7PyvPIK/mvU8MLNYgetgXPYw==" + "version": "4.3.0-32.c875e43600dfe042452e0b868f7a48b817b9640b", + "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-4.3.0-32.c875e43600dfe042452e0b868f7a48b817b9640b.tgz", + "integrity": "sha512-8yWpXkQRmiSfsi2Wb/ZS5D3RFbeu/btL9Pm/gdF4phB0Lo5KGsDFMxFMgaD64mwED2nHc8ZaEJg/+4Jymb9Znw==" }, "@protobufjs/aspromise": { "version": "1.1.2", @@ -117804,11 +117807,12 @@ "dev": true }, "prisma": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/prisma/-/prisma-3.12.0.tgz", - "integrity": "sha512-ltCMZAx1i0i9xuPM692Srj8McC665h6E5RqJom999sjtVSccHSD8Z+HSdBN2183h9PJKvC5dapkn78dd0NWMBg==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/prisma/-/prisma-4.3.1.tgz", + "integrity": "sha512-90xo06wtqil76Xsi3mNpc4Js3SdDRR5g4qb9h+4VWY4Y8iImJY6xc3PX+C9xxTSt1lr0Q89A0MLkJjd8ax6KiQ==", + "devOptional": true, "requires": { - "@prisma/engines": "3.12.0-37.22b822189f46ef0dc5c5b503368d1bee01213980" + "@prisma/engines": "4.3.1" } }, "prismjs": { diff --git a/package.json b/package.json index a3a3b6b..4d9f086 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "@apollo/client": "^3.6.9", "@hookform/resolvers": "^2.8.8", "@noble/secp256k1": "^1.6.3", - "@prisma/client": "^3.12.0", + "@prisma/client": "^4.3.1", "@react-hookz/web": "^13.2.1", "@react-spring/web": "^9.4.4", "@reduxjs/toolkit": "^1.8.1", @@ -63,7 +63,6 @@ "nostr-tools": "^0.23.4", "passport": "^0.6.0", "passport-lnurl-auth": "^1.5.0", - "prisma": "^3.12.0", "qrcode.react": "^3.0.2", "react": "^18.0.0", "react-accessible-accordion": "^5.0.0", @@ -188,6 +187,7 @@ "msw": "^0.39.2", "netlify-cli": "^10.0.0", "postcss": "^8.4.12", + "prisma": "^4.3.1", "readable-stream": "^4.1.0", "serverless": "^3.22.0", "serverless-offline": "^8.7.0", diff --git a/prisma/migrations/20220920093026_add_contact_email_to_project/migration.sql b/prisma/migrations/20220920093026_add_contact_email_to_project/migration.sql new file mode 100644 index 0000000..9624cc6 --- /dev/null +++ b/prisma/migrations/20220920093026_add_contact_email_to_project/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "Project" ADD COLUMN "contact_email" TEXT; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index e66a5cd..ebf6482 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -1,6 +1,6 @@ datasource db { provider = "postgresql" - url = env("DATABASE_URL") + url = env("DATABASE_PROXY_URL") } generator client { @@ -137,6 +137,7 @@ model Project { github String? telegram String? slack String? + contact_email String? thumbnail_image String? thumbnail_image_id Int? @unique thumbnail_image_rel HostedImage? @relation("Project_Thumbnail", fields: [thumbnail_image_id], references: [id]) diff --git a/public/assets/icons/join-discord.svg b/public/assets/icons/join-discord.svg new file mode 100644 index 0000000..da52ce2 --- /dev/null +++ b/public/assets/icons/join-discord.svg @@ -0,0 +1,4 @@ + + + + diff --git a/public/assets/images/join-discord-card.jpg b/public/assets/images/join-discord-card.jpg new file mode 100644 index 0000000..f5eabe8 Binary files /dev/null and b/public/assets/images/join-discord-card.jpg differ diff --git a/public/index.html b/public/index.html index c2f94a6..460311e 100644 --- a/public/index.html +++ b/public/index.html @@ -41,6 +41,7 @@ content="%PUBLIC_URL%/assets/images/og-thumbnail.jpg" data-react-helmet="true" /> + diff --git a/src/Components/Navbar/NavDesktop.tsx b/src/Components/Navbar/NavDesktop.tsx index d752197..e45b46a 100644 --- a/src/Components/Navbar/NavDesktop.tsx +++ b/src/Components/Navbar/NavDesktop.tsx @@ -52,7 +52,12 @@ export default function NavDesktop() { Projects -
  • +
  • + + Events + +
  • + {/*
  • - {/* */} - ✍🏼 + ✍🏼

    @@ -121,7 +125,7 @@ export default function NavDesktop() {

    -
  • + */}
  • -
  • +
  • + toggleDrawerOpen(false)} + className='text-body4 font-bold hover:text-primary-600'> + Events + +
  • + {/*
  • + */}
  • -
    - -
    -
    - {bannerData.title} + +
    + +
    +
    + {bannerData.title} +
    - - -
    +
    -

    Hackathons 🏆

    +

    {sortByFilter ? sortByFilter : "All"} Events

    - {`Bolt.Fun Stories`} - + {`Bolt.Fun`} + diff --git a/src/features/Projects/pages/ExplorePage/Header/Header.tsx b/src/features/Projects/pages/ExplorePage/Header/Header.tsx index c56ba10..c289d1e 100644 --- a/src/features/Projects/pages/ExplorePage/Header/Header.tsx +++ b/src/features/Projects/pages/ExplorePage/Header/Header.tsx @@ -6,33 +6,24 @@ import CustomDot from "./CustomDot/CustomDot"; import useEmblaCarousel from 'embla-carousel-react' import { useCallback, useEffect, useState } from "react"; import { createRoute } from "src/utils/routing"; +import { IoLocationOutline } from "react-icons/io5"; export const bannerData = { title: <>

    Legends of Lightning ⚡️ Tournament

    -

    1st Oct - 31st Nov, 2022

    +

    12th Oct - 7th Dec, 2022

    +

    Online

    , - img: "https://i.ibb.co/bRY635n/wide.png", + img: "https://i.ibb.co/3S35g6T/wide.jpg", link: { content: "Register Now", - url: createRoute({ type: "tournament", id: 1, tab: 'overview' }), + url: createRoute({ type: "tournament", id: 1 }), }, } const headerLinks = [ - { - title: - <> -

    Legends of Lightning ⚡️ Tournament

    -

    1st Oct - 31st Nov, 2022

    - , - img: "https://i.ibb.co/bRY635n/wide.png", - link: { - content: "Register Now", - url: createRoute({ type: "tournament", id: 1, tab: 'overview' }), - }, - }, + bannerData, { title:

    Explore a fun directory of lightning web apps

    , img: Assets.Images_ExploreHeader1, @@ -76,22 +67,21 @@ export default function Header() {
    -
    +
    -
    +
    - {bannerData.title} + {headerLinks[0].title}
    - -
    - {/*
    +
    {headerLinks[1].link.content} -
    */} +
    diff --git a/src/features/Tournaments/pages/OverviewPage/OverviewPage.tsx b/src/features/Tournaments/pages/OverviewPage/OverviewPage.tsx index 3cc08c2..6ee2e70 100644 --- a/src/features/Tournaments/pages/OverviewPage/OverviewPage.tsx +++ b/src/features/Tournaments/pages/OverviewPage/OverviewPage.tsx @@ -19,7 +19,7 @@ export default function OverviewPage() {
    diff --git a/src/features/Tournaments/pages/OverviewPage/PrizesSection/PrizesSection.tsx b/src/features/Tournaments/pages/OverviewPage/PrizesSection/PrizesSection.tsx index cac98e9..d1d115e 100644 --- a/src/features/Tournaments/pages/OverviewPage/PrizesSection/PrizesSection.tsx +++ b/src/features/Tournaments/pages/OverviewPage/PrizesSection/PrizesSection.tsx @@ -1,4 +1,3 @@ -import React from 'react' import { Tournament } from 'src/graphql' import styles from './styles.module.scss' @@ -20,17 +19,31 @@ export default function PrizesSection({ prizes }: Props) {

    {track.title}

    {track.description}

    -
    +
    {/* One Prize */} {track.prizes.length === 1 &&
    -

    {track.prizes[0].title}

    -

    {track.prizes[0].amount}

    +

    {track.prizes[0].title}

    +

    {track.prizes[0].amount}

    } - {/* Four Prizez */} + + {/* Two Prizes */} + {track.prizes.length === 2 && +
    +
    +

    {track.prizes[0].title}

    +

    {track.prizes[0].amount}

    +
    +
    +

    {track.prizes[1].title}

    +

    {track.prizes[1].amount}

    +
    +
    + } + {/* Four Prizes */} {track.prizes.length === 4 && -
    +
    {track.prizes.map((prize, idx) =>

    {prize.title}

    {prize.amount}

    @@ -69,13 +82,18 @@ const data = { id: 1, title: "the legend", amount: "1 BTC" + }, + { + id: 1, + title: "Runners UP x2", + amount: "0.5 BTC" } ] }, { id: 2, - title: "Bitcoin Adoption Track", - description: "On-chain applications have been the bed rock of bitcoin’s explosive growth and adoption over the last decade. Slowly, steadily, and securely, bitcoin’s base layer always seeks to evolve and improve.", + title: "Global Adoption Track", + description: "This prize track is aimed at solving issues surrounding the global adoption of bitcoin - focusing on scalability, and product market fit. Makers can let their imaginations run wild with either lightning or on-chain technology, as well as driving adoption either via online or locally based solutions.", image: "https://s3-alpha-sig.figma.com/img/cb90/77b4/5ea853a671d0cb1c64bde10dd8955d39?Expires=1664755200&Signature=aXtIhKJg58wRTQlJIGWxpfCN2hxJx8L0~8Hu5aH8LKUVAYrxSV5Tvvxevx9xDnf-RpjTVfB6D7RKuVQjfIiftB4Ym80oOlW9tNzYUo991cJhdYnqaGzJ6Ht2kF7NHmxbiY5RUMYj8bGf2AF1A2a7wuW~DaqHyLQ0s2sszwH2EAv31QTH1DAOO97pQzQ5asas7qGjARWh45QEfw6F8e~6iq3UWHXtIcJ0HMJO4q3ONhsMkuC6XQNfAmWTRwKb3tPZ79oehWgDeyOMGQkRS0uaal~6fNkheEN5DuRBH2dbXtqB6va0PJCTB1l8P558HXhKQjHXRLPPReIci72jPuTzdA__&Key-Pair-Id=APKAINTVSUGEWH5XD5UA", prizes: [ { @@ -102,8 +120,8 @@ const data = { }, { id: 3, - title: "Building for Africa track", - description: "With ~1.4bn inhabitants, Africa is ripe for bitcoin adoption. In partnership with ABC 22, this track seeks to encourage makers to build solutions that are local to the African continent.", + title: "Building for Africa", + description: "With an estimated population of ~1.4bn inhabitants, Africa has poised itself as ripe for bitcoin adoption. In partnership with the African Bitcoin Conference 22, this track seeks to encourage makers to build solutions that solve local challenges & increase bitcoin adoption in Africa.", image: "https://s3-alpha-sig.figma.com/img/c306/f172/7ce7befa9414372e6d0ede739be46de8?Expires=1664755200&Signature=BBfOTJzk7Si7zs9dOBhTdIhoKCvUDxAr6Do0wCZaIq9PD2Jcfxu3ANbiogzihC5O2Rwz3sKsajsRCd8eSs8HGrHrQh89SfNIl0~MYjMz12yWpsc1vC5M5hmXH~VQzCTOWsSki9BimcpCu0IOWfJFjY-p0rlo8UFhdDe56DiRUOSW0pAm5UxTstzOew6X015xA3qQWwUIea2JAtlsI5RqMQMRB-QlaKFlQvYHBU6YzLUNTuTn4MfOd-1oZXKtDArubYnSrJb2rJAXqccxgsXceDl8jq8HXKwkBR95-sG3UDZB7q7qb1Nk3HlsDtirGNlOjLx~vDKpOuyIk5ufAkdJmQ__&Key-Pair-Id=APKAINTVSUGEWH5XD5UA", prizes: [ { diff --git a/src/features/Tournaments/pages/OverviewPage/PrizesSection/styles.module.scss b/src/features/Tournaments/pages/OverviewPage/PrizesSection/styles.module.scss index a43c236..d5d0645 100644 --- a/src/features/Tournaments/pages/OverviewPage/PrizesSection/styles.module.scss +++ b/src/features/Tournaments/pages/OverviewPage/PrizesSection/styles.module.scss @@ -11,7 +11,7 @@ @include gt-md { h4 { - -webkit-text-stroke: 0.06em black; + -webkit-text-stroke: calc(max(1.4px, 0.06em)) black; } } diff --git a/src/features/Tournaments/pages/OverviewPage/RegisterCard/RegisterCard.tsx b/src/features/Tournaments/pages/OverviewPage/RegisterCard/RegisterCard.tsx index 20e7d22..81408d3 100644 --- a/src/features/Tournaments/pages/OverviewPage/RegisterCard/RegisterCard.tsx +++ b/src/features/Tournaments/pages/OverviewPage/RegisterCard/RegisterCard.tsx @@ -47,11 +47,11 @@ export default function RegisterCard({ makers_count, start_date, avatars, isRegi return (
    - {makers_count > 2 &&

    + {makers_count > 2 &&

    {avatars.map((img, idx) =>

    )} + {makers_count} makers

    } - +
    @@ -79,10 +79,48 @@ export default function RegisterCard({ makers_count, start_date, avatars, isRegi

    - Sponsored by + In partnership with

    - Fulgur Ventures Logo +
    + {partners.map((p, idx) => )} +
    ) } + +const partners = [ + { + link: "https://fulgur.ventures/", + image: "https://i.ibb.co/9gZFQ4d/fulgur.webp", + }, + { + link: "https://breez.technology/", + image: "https://i.ibb.co/6stx8tC/breez.webp", + }, + { + link: "https://bitcoin.design/", + image: "https://i.ibb.co/cgY6zy2/bitcoin-design.jpg", + }, + { + link: "https://www.afrobitcoin.org/", + image: "https://i.ibb.co/qDZYrGz/Screenshot-2022-09-14-at-17-03-47.jpg", + }, + { + link: "https://2022.tabconf.com/", + image: "https://i.ibb.co/zFGVqvV/tab-conf.jpg", + }, + { + link: "https://adoptingbitcoin.org/2022/", + image: "https://i.ibb.co/HdvRbxQ/Screenshot-2022-09-14-at-17-06-33.jpg", + }, + { + link: "https://geyser.fund/", + image: "https://i.ibb.co/tp6L5bt/geyser.jpg", + }, + { + link: "https://opensats.org/", + image: "https://i.ibb.co/b5y29TL/open-sats.jpg", + }, +] + diff --git a/src/features/Tournaments/pages/TournamentDetailsPage/Header/Header.tsx b/src/features/Tournaments/pages/TournamentDetailsPage/Header/Header.tsx index f65733e..e26a315 100644 --- a/src/features/Tournaments/pages/TournamentDetailsPage/Header/Header.tsx +++ b/src/features/Tournaments/pages/TournamentDetailsPage/Header/Header.tsx @@ -3,6 +3,7 @@ import advancedFormat from 'dayjs/plugin/advancedFormat' import React from 'react' import { Helmet } from 'react-helmet' import { IoLocationOutline } from 'react-icons/io5' +import { getSpanDate } from 'src/utils/helperFunctions' import { useTournament } from '../TournamentDetailsContext' dayjs.extend(advancedFormat) @@ -24,7 +25,7 @@ export default function Header() {

    TOURNAMENT 🏆

    {tournamentDetails.title}

    -

    {`${dayjs(tournamentDetails.start_date).format('Do')} - ${dayjs(tournamentDetails.end_date).format('Do MMMM, YYYY')}`}

    +

    {getSpanDate(tournamentDetails.start_date, tournamentDetails.end_date)}

    {tournamentDetails.location}

    diff --git a/src/utils/helperFunctions.tsx b/src/utils/helperFunctions.tsx index 23a2e9c..69bf086 100644 --- a/src/utils/helperFunctions.tsx +++ b/src/utils/helperFunctions.tsx @@ -165,4 +165,20 @@ export async function lightningAddressToPR(address: string, amount_in_sat: numbe .then((prResponse) => { return prResponse.data.pr as string; }); -} \ No newline at end of file +} + +export const getSpanDate = (_date1: string, _date2: string) => { + const date1 = new Date(_date1); + const date2 = new Date(_date2); + + const isSameMonth = date1.getMonth() === date2.getMonth(); + if (!isSameMonth) + return `${dayjs(_date1).format('Do MMM')} - ${dayjs(_date2).format('Do MMM')}` + + const isSameDay = date1.getDay() === date2.getDay(); + if (!isSameDay) + return `${dayjs(_date1).format('Do')} - ${dayjs(_date2).format('Do MMM')}` + // Same Day + return `${dayjs(_date1).format('H:mm')} - ${dayjs(_date2).format('H:mm, Do MMM')}` + +} diff --git a/src/utils/routing/routes.ts b/src/utils/routing/routes.ts index 5cc4873..329bdfe 100644 --- a/src/utils/routing/routes.ts +++ b/src/utils/routing/routes.ts @@ -45,7 +45,7 @@ type RouteOptions = | { type: "tournament", id: string | number - tab: 'overview' | 'events' | 'makers' | 'projects' + tab?: 'overview' | 'events' | 'makers' | 'projects' } export function createRoute(options: RouteOptions) { @@ -80,7 +80,7 @@ export function createRoute(options: RouteOptions) { if (options.type === 'tournament') - return `/tournaments/${options.id}/${options.tab}` + return `/tournaments/${options.id}` + (options.tab ? `/${options.tab}` : "") if (options.type === 'edit-project') return `/projects/list-project` + (options.id ? `?id=${options.id}` : '')