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

Merge Staging to Main #233

Merged
merged 175 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
175 commits
Select commit Hold shift + click to select a range
0a317a5
perf: skip loading state for button submission
jamesqquick Mar 6, 2024
5075e19
test: random comment
jamesqquick Mar 7, 2024
da4f1ca
test: random comment
jamesqquick Mar 7, 2024
fbeb0e7
test: adding sentry inp
jamesqquick Mar 8, 2024
4ce174b
test: adding sentry inp
jamesqquick Mar 8, 2024
b8f9304
Merge branch 'dev' of https://github.com/Learn-Build-Teach/deals-for-…
jamesqquick Mar 8, 2024
0e009fe
chore: pull from dev
jamesqquick Mar 11, 2024
920ddf4
feat: add template for pull requests
CBID2 Mar 11, 2024
d5ceec2
fix: revise template
CBID2 Mar 11, 2024
42b6fdc
fix: added public environment variable
jamesqquick Mar 13, 2024
b94f4c7
Merge pull request #63 from Learn-Build-Teach/fix_public_environment_…
jamesqquick Mar 13, 2024
deeabf1
fix: add loader to subscribe button
jamesqquick Mar 13, 2024
6e5de47
Merge pull request #64 from Learn-Build-Teach/fix_subscribe_button_lo…
jamesqquick Mar 13, 2024
0a74494
Merge pull request #61 from CBID2/adding-pull-request-template
jamesqquick Mar 13, 2024
c13fdda
docs: add a note about where commits should go
CBID2 Mar 13, 2024
705579d
add Return
jamesqquick Mar 13, 2024
dc1c307
Merge pull request #66 from CBID2/add-note-to-readme
jamesqquick Mar 13, 2024
671ea22
feat: added logic to use safeparse instead of parse
klae32 Mar 15, 2024
df2f9ce
feat: add aria-label to input
CBID2 Mar 15, 2024
5fadc14
fix: change aria-label
CBID2 Mar 15, 2024
28af073
feat: add alt text for footer icons
CBID2 Mar 15, 2024
c141eb1
Merge pull request #70 from CBID2/making-the-code-more-a11y-friendly
jamesqquick Mar 18, 2024
1ff83f0
docs: update README.md [skip ci]
allcontributors[bot] Mar 18, 2024
c2f7d52
docs: update .all-contributorsrc [skip ci]
allcontributors[bot] Mar 18, 2024
1a3efc9
Merge pull request #71 from Learn-Build-Teach/all-contributors/add-CBID2
jamesqquick Mar 18, 2024
c1f8b5f
Merge pull request #69 from Learn-Build-Teach/feat_add-error-checking…
jamesqquick Mar 18, 2024
b10e9bd
docs: update README.md [skip ci]
allcontributors[bot] Mar 18, 2024
8dc3183
docs: update .all-contributorsrc [skip ci]
allcontributors[bot] Mar 18, 2024
daeadac
Merge branch 'dev' into all-contributors/add-elliezub
CBID2 Mar 18, 2024
042a17c
feat: add back in the navbar
chris-nowicki Mar 19, 2024
1e7b2c3
feat: add back never miss a deal section
chris-nowicki Mar 19, 2024
bc26673
feat: add in separator with proper spacings
chris-nowicki Mar 19, 2024
5e854a4
Merge pull request #72 from Learn-Build-Teach/all-contributors/add-el…
jamesqquick Mar 19, 2024
1411ad8
Merge pull request #73 from Learn-Build-Teach/feat_addBackLandingPage…
jamesqquick Mar 19, 2024
03ee18d
fix: updated footer typescript type for alt property
jamesqquick Mar 19, 2024
3f54c70
fix: return string error from subscribe
jamesqquick Mar 19, 2024
830d7eb
Merge pull request #78 from Learn-Build-Teach/fix_footer_type_missing…
jamesqquick Mar 19, 2024
b533fc3
Merge pull request #79 from Learn-Build-Teach/fix_mismatch_return_error
jamesqquick Mar 19, 2024
f4cc709
chore: update meta description to current website header
ryandotfurrer Mar 20, 2024
3c6308a
docs: updated contributing.md
BryanF1nes Mar 20, 2024
0ec4e99
Merge pull request #82 from BryanF1nes/docs_contribution
jamesqquick Mar 20, 2024
63b88f2
refactor: split admin dashboard, manage deals, and manage subs to the…
ryandotfurrer Mar 21, 2024
8458af5
docs: add BryanF1nes as a contributor for doc (#87)
allcontributors[bot] Mar 21, 2024
73e2cb4
docs: updated and re-structured pull_request_template (#86)
BryanF1nes Mar 21, 2024
b173396
feat: migrating queries to prisma
jamesqquick Mar 21, 2024
0f2f1ed
feat: migrate db query code to Prisma
jamesqquick Mar 22, 2024
3d8032a
Merge branch 'dev' of https://github.com/Learn-Build-Teach/deals-for-…
jamesqquick Mar 22, 2024
ab4d254
feat: prisma update remove reference to xata_id
jamesqquick Mar 22, 2024
22c108e
fix: add in office equipment category and refactor adding plural (s) …
chris-nowicki Mar 22, 2024
ce8af99
fix: add ts-expect-error for Subscriber.tsx. Temp fix until we can i…
chris-nowicki Mar 22, 2024
e8fbc45
refactor: create layout and associated pages for /dashboard
ryandotfurrer Mar 23, 2024
4334968
refactor: remove props in Dashboard component as they are handeled by…
ryandotfurrer Mar 23, 2024
62812f9
refactor: rename components/dashboard/Dashboard to AdminNav and updat…
ryandotfurrer Mar 23, 2024
48f7599
style: add hover styles to SubscriberList for ease of use
ryandotfurrer Mar 23, 2024
ac71da1
Merge pull request #90 from Learn-Build-Teach/feat_migrate_to_prisma
jamesqquick Mar 24, 2024
ead72fb
chore: fix typo in Deal.tsx component export and remove import no lon…
ryandotfurrer Mar 24, 2024
b89351a
Merge branch 'dev' into rf-addNextLayoutsToAdminRoutes
jamesqquick Mar 25, 2024
2c2fc4e
Merge pull request #85 from ryandotfurrer/rf-addNextLayoutsToAdminRoutes
jamesqquick Mar 25, 2024
ebc8bd8
fix: add prisma generate to build command
jamesqquick Mar 25, 2024
321da0f
Merge pull request #94 from Learn-Build-Teach/fix_prisma_generate_dur…
jamesqquick Mar 25, 2024
67ec260
Update README.md (#93)
ryandotfurrer Mar 25, 2024
866e95a
docs(readme): added link to contribution guide
waseem-medhat Mar 25, 2024
3196c57
change px values to default tailwind values
elliezub Mar 26, 2024
43d46d0
Merge branch 'dev' into change-class-values
elliezub Mar 27, 2024
8daf6c6
docs: included a link to the figma file (#99)
BryanF1nes Mar 28, 2024
e85838f
Merge branch 'dev' into doc_contrib_guide_link
CBID2 Mar 28, 2024
32a0e0d
Merge branch 'Learn-Build-Teach:main' into change-class-values
elliezub Mar 28, 2024
32edc7a
Update Hero.tsx
elliezub Mar 28, 2024
cf1e869
Merge branch 'dev' into change-class-values
elliezub Mar 28, 2024
d8541f9
Merge pull request #98 from elliezub/change-class-values
jamesqquick Mar 28, 2024
6885a80
Merge pull request #97 from Learn-Build-Teach/doc_contrib_guide_link
jamesqquick Mar 28, 2024
00e0cd3
fix: removed unnecessary use client
jamesqquick Apr 2, 2024
69799f6
Merge pull request #102 from Learn-Build-Teach/fix_deals_list_on_server
jamesqquick Apr 2, 2024
f897973
#74 Feat multistep add deal form (#107)
chris-nowicki Apr 15, 2024
5151090
Feat: add t3 env (#108)
jamesqquick Apr 16, 2024
8b7c9ec
feat: Generated Xata Config and Types During Build (#110)
jamesqquick Apr 16, 2024
13bd728
fix: removed dotenv-cli
jamesqquick Apr 16, 2024
db6c13b
Add .nvmrc to help with local dev (#104)
mhuggins7278 Apr 16, 2024
378f296
fix: separate link button from text in subscription email (#109)
FatumaA Apr 16, 2024
6fa6068
Chore: Correct Confirmation Email (#112)
jamesqquick Apr 16, 2024
9d6bd3f
fix: added codegen package
jamesqquick Apr 17, 2024
618a03a
Fix broken build (#113)
jamesqquick May 6, 2024
6abc556
Docs xata onboarding (#114)
jamesqquick May 10, 2024
3e805eb
Feat update card design (#126)
jamesqquick May 16, 2024
6626392
feat: redesign of category options (#128)
jamesqquick May 16, 2024
3e5e69c
feat: Add Default Image for Deals (#134)
jamesqquick May 30, 2024
df20079
Feat: dynamic category routes (#131)
jamesqquick May 30, 2024
46a6723
Feature: remove redirect to preferences page (#139)
chris-nowicki Jun 4, 2024
03b8734
feat: deal route, design, and deal preview component
jamesqquick Jun 4, 2024
4c97089
Merge pull request #141 from Learn-Build-Teach/feat_dedicated_deal_page
chris-nowicki Jun 4, 2024
9a316ff
feat: display featured deals on home page
jamesqquick Jun 5, 2024
ba2de29
Merge pull request #142 from Learn-Build-Teach/feat_display_deals_hom…
chris-nowicki Jun 5, 2024
961ead6
feat: updated search design and organized search components (#143)
jamesqquick Jun 6, 2024
0d275e5
style: added styles for currently selected category
jamesqquick Jun 7, 2024
9545568
Merge Dev To Staging (#145)
jamesqquick Jun 7, 2024
2bea232
fix: handle error for too large file upload (#146)
jamesqquick Jun 7, 2024
2b8dd4d
Merge branch 'staging' into dev
jamesqquick Jun 7, 2024
1e6f4d3
Handle Image Upload Error (#147)
jamesqquick Jun 7, 2024
a703320
style: standard display for all deals and category dael pages
jamesqquick Jun 7, 2024
e69f401
Fix: no unique constraint coverImageId (#154)
jamesqquick Jun 7, 2024
8c1e2e1
chore: removed console logs
jamesqquick Jun 7, 2024
a433913
Fix: Remove ID From Subscriber (#155)
jamesqquick Jun 7, 2024
6c421e6
fix: remove subscriber id (#156)
jamesqquick Jun 7, 2024
e24f0bf
Merge pull request #144 from Learn-Build-Teach/feat_highlighted_category
chris-nowicki Jun 7, 2024
be66a6a
fix: convert description field to text (#158)
jamesqquick Jun 8, 2024
baa87ef
Merge branch 'staging' into dev
jamesqquick Jun 8, 2024
fe39818
Merge Dev to Staging (#159)
jamesqquick Jun 8, 2024
0594169
feat: create SearchedDeal component (#157)
ryandotfurrer Jun 9, 2024
37866b1
fix: removed prisma ids in lieu of xata_id
jamesqquick Jun 9, 2024
85ee3aa
feat: created deal image component (#161)
jamesqquick Jun 9, 2024
0b06110
Fix search record id (#162)
jamesqquick Jun 9, 2024
0802da3
chore: changed default px to px-2 (#167)
24HourDeveloper Jun 10, 2024
420031b
Feat image outlines (#166)
jamesqquick Jun 10, 2024
57e759a
Add plausible analytics (#169)
jamesqquick Jun 11, 2024
b350fa5
feat: two separate start and end dates (#171)
jamesqquick Jun 11, 2024
6f10b95
Fix: move sign in and sign up inside admin (#170)
ryandotfurrer Jun 11, 2024
5d39aea
feat: small design tweaks (#172)
jamesqquick Jun 11, 2024
0b8dfeb
fix: prisma schema to support null end date (#173)
jamesqquick Jun 11, 2024
7fb68d8
Merge Dev To Staging (#174)
jamesqquick Jun 11, 2024
f111f0c
chore: remove logs
jamesqquick Jun 11, 2024
a3f9039
feat: design tweaks
jamesqquick Jun 11, 2024
8502ec8
chore: merge from dev
jamesqquick Jun 11, 2024
5be5879
fix: update prisma schema for coupon percent to not have a default (#…
jamesqquick Jun 11, 2024
b051c70
Dev to Staging (#178)
jamesqquick Jun 11, 2024
0b1db2f
chore: removed log
jamesqquick Jun 11, 2024
8e638e7
fix(UI/UX): fixed several UX issues for MVP 1 (#184)
ryandotfurrer Jun 12, 2024
9b1594c
docs: updated environment variable example file with defaults
jamesqquick Jun 12, 2024
f6a2383
fix: add revalidate to deals pages (#185)
jamesqquick Jun 12, 2024
b114cab
Merge Dev to Staging
jamesqquick Jun 12, 2024
b21955d
Merge branch 'main' into staging
jamesqquick Jun 12, 2024
c3ff6da
docs: docs to fix image column generated by prisma
jamesqquick Jun 13, 2024
049302b
Update README.md
jamesqquick Jun 13, 2024
12dad74
docs: docs to fix image column generated by prisma
jamesqquick Jun 13, 2024
18a30b0
fix: accessibility of icons and add footer landmark (#192)
EmmaDawsonDev Jun 18, 2024
b558e8d
feat: add 16 x 9 image ratio requirement to form (#193)
jamesqquick Jun 18, 2024
ec896e7
feat: added a revalidate endpoint and env variable for validation se…
jamesqquick Jun 20, 2024
32b50cd
feat: revalidate_path_admin_options
jamesqquick Jun 21, 2024
4dc75ca
fix: don't revalidate deals route on delete
jamesqquick Jun 21, 2024
22df63b
feat: add og image to deals pages
jamesqquick Jun 21, 2024
237b9cb
Merge pull request #199 from Learn-Build-Teach/feat_og_image_deals_page
chris-nowicki Jun 23, 2024
f8310e3
Merge pull request #197 from Learn-Build-Teach/feat_revalidate_on_adm…
chris-nowicki Jun 23, 2024
d6efe78
Merge pull request #196 from Learn-Build-Teach/feat_add_revalidate_api
chris-nowicki Jun 23, 2024
a5b1541
docs: make getting started instructions clearer (#206)
EmmaDawsonDev Jun 26, 2024
757b0cb
Bug dont show outdated deals (#204)
klae32 Jul 3, 2024
e3f7b8d
feat: added disclaimer route and page with placeholder for text (#205)
klae32 Jul 4, 2024
0f7ab35
fix: updated the button color to be brighter (#211)
klae32 Jul 4, 2024
74aed6a
fix: add main landmark to pages (#210)
EmmaDawsonDev Jul 4, 2024
aa6622c
feat: added contributor rocks link on readme (#214)
jamesqquick Jul 4, 2024
b3b92f4
docs: clarify environment variables in example env file and readme (#…
jamesqquick Jul 5, 2024
1555bca
docs: moved setup to its own file and referenced it from readme and c…
jamesqquick Jul 5, 2024
9602835
Merge branch 'staging' into dev
jamesqquick Jul 5, 2024
d79b80c
Merge Dev to Staging (#217)
jamesqquick Jul 5, 2024
3f5552a
chore: pulled from main
jamesqquick Jul 5, 2024
338be31
fix: merge conflicts
jamesqquick Jul 5, 2024
0066bfa
fix: merge conflicts
jamesqquick Jul 5, 2024
874bc77
fix: extra validation on link submission
jamesqquick Jul 5, 2024
73e6fa2
feat: deal form validation - page submission, real-time input, final …
jamesqquick Jul 9, 2024
4b96fe9
Bug no link validation (#220)
jamesqquick Jul 9, 2024
b73af50
Bug filter unapproved deals in search (#219)
jamesqquick Jul 9, 2024
b429743
chore: merged from dev and fixed typescript error
jamesqquick Jul 9, 2024
99b069d
feat: added edit deal page
jamesqquick Jul 9, 2024
b821e74
Merge branch 'feat_form_error_messages' of https://github.com/Learn-B…
jamesqquick Jul 9, 2024
6fb20fc
Merge pull request #222 from Learn-Build-Teach/feat_form_error_messages
chris-nowicki Jul 10, 2024
ff99e9d
fix: update semantics of combobox (#225)
EmmaDawsonDev Jul 10, 2024
b347c9e
feat: added pending deals list and edit deal pages
jamesqquick Jul 10, 2024
7500d9a
Merge branch 'dev' of https://github.com/Learn-Build-Teach/deals-for-…
jamesqquick Jul 10, 2024
0658e4e
feat: simplified edit deal form submission and standardized on action…
jamesqquick Jul 10, 2024
35dee3b
Merge pull request #226 from Learn-Build-Teach/feat_admin_deal_edit
chris-nowicki Jul 10, 2024
0736b56
Merge Dev to Staging (#227)
jamesqquick Jul 11, 2024
d8d0b67
feat: added description field to input
jamesqquick Jul 12, 2024
887cefa
chore: pulled from main
jamesqquick Jul 12, 2024
36fa310
chore: pulled from dev
jamesqquick Jul 12, 2024
0b82c56
chore: pulled from dev
jamesqquick Jul 12, 2024
e0d6a9f
Merge From Dev (#232)
jamesqquick Jul 25, 2024
135050b
chore: pulled from main
jamesqquick Jul 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/app/deals/[id]/loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import LoadingPreview from '@/components/deals/loading/LoadingPreview'
import React from 'react'

export default function Loading() {
return <LoadingPreview />
}
31 changes: 19 additions & 12 deletions src/app/deals/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
import { notFound } from 'next/navigation'
import { getDealById } from '@/lib/queries'
import DealPreview from '@/components/DealPreview'
import { Metadata, ResolvingMetadata } from 'next'
import { getApprovedDeals, getDealById } from '@/lib/queries'
import { Metadata } from 'next'
import DealPreview from '@/components/deals/DealPreview'

export const revalidate = 120

type Props = {
params: { id: string }
searchParams: { [key: string]: string | string[] | undefined }
}

export async function generateMetadata(
{ params, searchParams }: Props,
parent: ResolvingMetadata
): Promise<Metadata> {
// read route params
const id = params.id
export const dynamicParams = true

// fetch data
export async function generateStaticParams() {
const deals = await getApprovedDeals()

return deals.map((deal) => ({
id: deal.xata_id,
}))
}

export async function generateMetadata({ params }: Props): Promise<Metadata> {
const deal = await getDealById(params.id)

if (!deal) {
Expand All @@ -35,10 +37,15 @@ export async function generateMetadata(
}
}

//sleep function
function sleep(ms: number) {
return new Promise((resolve) => setTimeout(resolve, ms))
}
export default async function DealPage({ params }: { params: { id: string } }) {
if (!params.id) {
//not found
notFound()
}

const deal = await getDealById(params.id)
if (!deal) {
notFound()
Expand Down
13 changes: 6 additions & 7 deletions src/app/deals/category/[category]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import { Category } from '@/types/Types'
import { getApprovedDealsByCategory } from '@/lib/queries'
import PageHeader from '@/components/PageHeader'
import DealsList from '@/components/deals/DealsList'
import ApprovedDealsByCategory from '@/components/deals/ApprovedDealsByCategory'
import { Suspense } from 'react'
import LoadingDealsList from '@/components/deals/loading/LoadingDealsList'

export const revalidate = 120

Expand All @@ -23,7 +26,6 @@ export default async function CategoryPage({
}
//TODO move logic for converting deals to capitalized and singular to a helper function
const category = categoryString as Category
const deals = await getApprovedDealsByCategory(category)
let capitalizedCategory = category
.split(' ')
.map((word) => word.charAt(0).toUpperCase() + word.toLowerCase().slice(1))
Expand All @@ -39,12 +41,9 @@ export default async function CategoryPage({
<div className="pb-10">
<CategoryOptions />
</div>
{deals.length === 0 && (
<div className="text-center text-xl text-gray-300">
No deals found for this category
</div>
)}
<DealsList deals={deals} />
<Suspense fallback={<LoadingDealsList count={3} />}>
<ApprovedDealsByCategory category={category} />
</Suspense>
</main>
)
}
15 changes: 6 additions & 9 deletions src/app/deals/page.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import CategoryOptions from '@/components/CategoryOptions'
import { getApprovedDeals } from '@/lib/queries'
import NeverMissADeal from '@/components/NeverMissADeal'
import PageHeader from '@/components/PageHeader'
import DealsList from '@/components/deals/DealsList'
import ApprovedDeals from '@/components/deals/ApprovedDeals'
import LoadingDealsList from '@/components/deals/loading/LoadingDealsList'
import { Suspense } from 'react'

export const revalidate = 120

export default async function DealsPage() {
const deals = await getApprovedDeals(20)
//TODO: handle error
return (
<main>
Expand All @@ -17,12 +17,9 @@ export default async function DealsPage() {
<div className="pb-10">
<CategoryOptions />
</div>
{deals.length === 0 && (
<div className="text-center text-xl text-gray-300">
No deals found for this category
</div>
)}
<DealsList deals={deals} />
<Suspense fallback={<LoadingDealsList count={3} />}>
<ApprovedDeals />
</Suspense>
<NeverMissADeal />
</main>
)
Expand Down
7 changes: 2 additions & 5 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
import FeaturedDealsSection from '@/components/deals/FeaturedDealsSection'
import DevGiveaways from '@/components/DevGiveaways'
import FeaturedDeals from '@/components/FeaturedDeals'
import Hero from '@/components/Hero'
import NeverMissADeal from '@/components/NeverMissADeal'
import Separator from '@/components/Separator'
import { getApprovedFeaturedDeals } from '@/lib/queries'

export const revalidate = 120

export default async function Home() {
const deals = await getApprovedFeaturedDeals()
return (
<main>
<Hero />

<FeaturedDeals deals={deals} />
<FeaturedDealsSection />
<Separator className="mb-20" />
<div className="mb-20">
<NeverMissADeal />
Expand Down
19 changes: 19 additions & 0 deletions src/components/IconButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react'

export default function IconButton({
handleClick,
children,
}: {
handleClick: () => void
children: React.ReactNode
}) {
return (
<button
type="button"
className="text-brand bg-surface-1 hover:bg-surface-2 flex h-10 w-10 items-center justify-center rounded-full text-xs transition-transform hover:-translate-y-0.5"
onClick={handleClick}
>
{children}
</button>
)
}
37 changes: 22 additions & 15 deletions src/components/Overlay.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client'

import { ReactNode } from 'react'
import { ReactNode, useEffect, useRef } from 'react'
import { FaTimes } from 'react-icons/fa'

const Overlay = ({
Expand All @@ -12,22 +12,29 @@ const Overlay = ({
onClose: () => void
children: ReactNode
}) => {
const dialogRef = useRef<HTMLDialogElement>(null)

useEffect(() => {
if (isOpen) {
dialogRef.current?.showModal()
} else {
dialogRef.current?.close()
}
})
return (
<div
className={`fixed inset-0 flex items-center justify-center p-10 ${
isOpen ? 'block' : 'hidden'
} z-50 bg-gray-950/[.80] `}
<dialog
ref={dialogRef}
className="hide-scrollbar fixed inset-0 h-[90vh] w-full max-w-4xl rounded-xl bg-gray-900 px-4 pt-16 shadow-lg backdrop:bg-gray-950/[.80] md:px-8 md:pt-16"
>
<div className="hide-scrollbar relative h-[90vh] w-full max-w-4xl overflow-y-scroll rounded-xl bg-gray-900 px-4 pt-16 shadow-lg md:px-8 md:pt-16">
<button
onClick={onClose}
className="fixed right-3 top-3 text-gray-400 transition-colors hover:text-white focus:outline-none"
>
<FaTimes className="h-10" />
</button>
{children}
</div>
</div>
<button
onClick={onClose}
className="fixed right-3 top-3 text-gray-400 transition-colors hover:text-white"
aria-label="Close"
>
<FaTimes className="h-10" />
</button>
{children}
</dialog>
)
}

Expand Down
9 changes: 9 additions & 0 deletions src/components/deals/ApprovedDeals.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { getApprovedDeals } from '@/lib/queries'
import React from 'react'
import DealsList from './DealsList'

export default async function ApprovedDeals() {
const deals = await getApprovedDeals(20)

return <DealsList deals={deals} />
}
14 changes: 14 additions & 0 deletions src/components/deals/ApprovedDealsByCategory.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { getApprovedDealsByCategory } from '@/lib/queries'
import React from 'react'
import DealsList from './DealsList'
import { Category } from '@/types/Types'

export default async function ApprovedDealsByCategory({
category,
}: {
category: Category
}) {
const deals = await getApprovedDealsByCategory(category)

return <DealsList deals={deals} />
}
11 changes: 1 addition & 10 deletions src/components/deals/DealCard.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
import Link from 'next/link'
import { FaBeer, FaVideo, FaBook, FaCog, FaCalendar } from 'react-icons/fa'
import { Category } from '@/types/Types'
import { Deal } from '@prisma/client'
import DealImage from './DealImage'

const categoryToIcon: { [key: string]: JSX.Element } = {
Misc: <FaBeer />,
Ebook: <FaBook />,
Video: <FaVideo />,
Tool: <FaCog />,
Conference: <FaCalendar />,
}

export default function DealCard({ deal }: { deal: Deal }) {
return (
<Link
Expand All @@ -24,7 +15,7 @@ export default function DealCard({ deal }: { deal: Deal }) {
coverImageURL={deal.coverImageURL}
category={deal.category as Category}
/>
<h2 className="text-lg font-semibold tracking-tight">{deal.name}</h2>
<h2 className="mt-1 text-lg font-semibold tracking-tight">{deal.name}</h2>
{deal.coupon && deal.couponPercent && (
<p className="-gap-y-1 absolute right-3 top-3 flex h-14 w-14 -rotate-12 flex-col items-center justify-center rounded-full bg-pale-gold text-black shadow-md">
<span className="text-md -mb-1 font-bold">{deal.couponPercent}%</span>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
import { Category } from '@/types/Types'
import React from 'react'
import {
FaBeer,
FaBook,
FaCalendar,
FaChair,
FaCog,
FaCompactDisc,
FaDeskpro,
FaDesktop,
FaMicrophone,
FaSchool,
FaTable,
FaTag,
FaVideo,
} from 'react-icons/fa'
import { twMerge } from 'tailwind-merge'

Expand Down
2 changes: 1 addition & 1 deletion src/components/deals/DealImage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Category } from '@/types/Types'
import { Deal } from '@prisma/client'
import React from 'react'
import DealGradientPlaceholder from '../DealGradientPlaceholder'
import DealGradientPlaceholder from './DealGradientPlaceholder'
import Image from 'next/image'

interface IDealImageProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { format } from 'date-fns'
import React from 'react'
import DealGradientPlaceholder from './DealGradientPlaceholder'
import { Category } from '@/types/Types'
import Image from 'next/image'
import ClickableCoupon from './ClickableCouponCode'
import DealImage from './deals/DealImage'
import DealImage from './DealImage'
import ClickableCoupon from '../ClickableCouponCode'

export default function DealPreview({
link,
Expand Down Expand Up @@ -35,8 +32,8 @@ export default function DealPreview({
category={category as Category}
/>
</div>
<div className="flex flex-col gap-y-1">
<span className="text-xl md:text-3xl">{name}</span>
<div className="flex flex-col gap-y-1">
<h1 className="text-xl md:text-3xl">{name}</h1>
<div className="mt-2 flex flex-wrap gap-2 text-sm md:mt-4 md:text-lg">
<span className="font-light text-white/70">Website:</span>
<a
Expand Down
3 changes: 3 additions & 0 deletions src/components/deals/DealsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ export default function DealsList({
}) {
return (
<div className="mx-auto py-10">
{deals.length === 0 && (
<div className="text-center text-xl text-gray-300">No deals found</div>
)}
{deals.length > 0 && (
<div className="mx-auto grid grid-cols-1 justify-items-center gap-x-4 gap-y-12 sm:grid-cols-2 lg:gap-x-12 xl:grid-cols-3">
<>
Expand Down
7 changes: 7 additions & 0 deletions src/components/deals/FeaturedDeals.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import DealsList from './DealsList'
import { getApprovedFeaturedDeals } from '@/lib/queries'

export default async function FeaturedDeals() {
const deals = await getApprovedFeaturedDeals()
return <DealsList deals={deals} />
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react'
import DealsList from './deals/DealsList'
import Link from 'next/link'
import { Deal } from '@prisma/client'
import FeaturedDeals from './FeaturedDeals'
import { Suspense } from 'react'
import LoadingDealsList from './loading/LoadingDealsList'

export default function FeaturedDeals({ deals }: { deals: Deal[] }) {
export default function FeaturedDealsSection() {
return (
<section className="py-20">
<div className="flex flex-col items-center gap-x-8 gap-y-4 pb-10 md:flex-row">
Expand All @@ -18,7 +18,9 @@ export default function FeaturedDeals({ deals }: { deals: Deal[] }) {
View all deals
</Link>
</div>
<DealsList deals={deals} />
<Suspense fallback={<LoadingDealsList count={3} />}>
<FeaturedDeals />
</Suspense>
</section>
)
}
5 changes: 5 additions & 0 deletions src/components/deals/loading/LoadingDealImage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default function LoadingDealImage() {
return (
<div className=" flex aspect-video w-full animate-pulse items-center justify-center rounded-xl border-4 border-slate-500 bg-gray-100"></div>
)
}
20 changes: 20 additions & 0 deletions src/components/deals/loading/LoadingDealsList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import LoadingDealImage from './LoadingDealImage'

export default function LoadingDealsList({ count }: { count: number }) {
const arr = Array.from(Array(count).keys())

return (
<div className="mx-auto py-10">
<div className="mx-auto grid grid-cols-1 justify-items-center gap-x-4 gap-y-12 sm:grid-cols-2 lg:gap-x-12 xl:grid-cols-3">
<>
{arr.map((num) => (
<div key={num} className="w-full">
<LoadingDealImage />
<div className="mt-1 h-[1.75rem]"></div>
</div>
))}
</>
</div>
</div>
)
}
Loading