From b1413afc54ad657c53667cfc8f6ec1b44d2905f4 Mon Sep 17 00:00:00 2001 From: Ankit Date: Sat, 21 Dec 2024 13:42:18 +0530 Subject: [PATCH] revamed the contact page --- app/api/brackets/[id]/mockBrackets.js | 30 +++-- app/api/brackets/route.js | 101 ++++++++-------- app/api/games/route.js | 1 - app/bracket/create/page.js | 8 +- app/bracket/page.js | 27 +++-- app/contact/page.js | 80 +------------ app/games/page.js | 38 +++--- components/BracketForm.jsx | 117 +++++++++++------- components/Contatct/Contact-left.jsx | 46 +++++++ components/Contatct/Contact-right.jsx | 165 ++++++++++++++++++++++++++ components/Footer.jsx | 2 +- components/ui/select.jsx | 63 +++++----- lib/utils/index.js | 25 ++-- model/Bracket.js | 14 ++- package-lock.json | 44 ++++--- package.json | 13 +- public/contact.jpg | Bin 0 -> 103884 bytes 17 files changed, 481 insertions(+), 293 deletions(-) create mode 100644 components/Contatct/Contact-left.jsx create mode 100644 components/Contatct/Contact-right.jsx create mode 100644 public/contact.jpg diff --git a/app/api/brackets/[id]/mockBrackets.js b/app/api/brackets/[id]/mockBrackets.js index 0fc344a..ba2782c 100644 --- a/app/api/brackets/[id]/mockBrackets.js +++ b/app/api/brackets/[id]/mockBrackets.js @@ -81,22 +81,20 @@ export default { name: "Revenant Esports", }, ], - "stage": [ - { - "id": 0, - "tournament_id": 1, - "name": "Elimination stage", - "type": "single_elimination", - "settings": { - "grandFinal": "single", - "consolationFinal": false, - "matchesChildCount": 0, - "size": 16, - "seedOrdering": [ - "inner_outer" - ] - } - } + stage: [ + { + id: 0, + tournament_id: 1, + name: "Elimination stage", + type: "single_elimination", + settings: { + grandFinal: "single", + consolationFinal: false, + matchesChildCount: 0, + size: 16, + seedOrdering: ["inner_outer"], + }, + }, ], group: [ { diff --git a/app/api/brackets/route.js b/app/api/brackets/route.js index ad9d2de..d4eec57 100644 --- a/app/api/brackets/route.js +++ b/app/api/brackets/route.js @@ -1,71 +1,72 @@ - -import dbConnect from '../../../lib/dbConnect'; -import Bracket from '../../../model/Bracket'; -import { NextResponse } from 'next/server'; -import Tournament from '../../../model/Tournament'; -import { z } from 'zod'; +import dbConnect from "../../../lib/dbConnect"; +import Bracket from "../../../model/Bracket"; +import { NextResponse } from "next/server"; +import Tournament from "../../../model/Tournament"; +import { z } from "zod"; const bracketSchema = z.object({ - tournament_name: z.string().min(1), - format: z.enum(['single_elimination', 'double_elimination']), - consolationFinal: z.boolean().default(false), - grandFinalType: z.enum(['simple', 'double']), - teams: z.array(z.string().min(1)).min(4, "At least 4 teams are required") -}) + tournament_name: z.string().min(1), + format: z.enum(["single_elimination", "double_elimination"]), + consolationFinal: z.boolean().default(false), + grandFinalType: z.enum(["simple", "double"]), + teams: z.array(z.string().min(1)).min(4, "At least 4 teams are required"), +}); export async function POST(request) { try { await dbConnect(); - const body = await request.json(); - - const validation = bracketSchema.safeParse(body) + const body = await request.json(); - if (!validation.success) { - return NextResponse.json(validation.error.format(), { status: 400 }) - } + const validation = bracketSchema.safeParse(body); - console.log(validation.data) + if (!validation.success) { + return NextResponse.json(validation.error.format(), { status: 400 }); + } - return NextResponse.json(validation.data, { status: 201 }); + console.log(validation.data); - // const { tournament_id, consolationFinal, grandFinalType } = validation.data; + return NextResponse.json(validation.data, { status: 201 }); + // const { tournament_id, consolationFinal, grandFinalType } = validation.data; - // const tournament = await Tournament.findById(tournament_id); - // if (!tournament) { - // return NextResponse.json({ error: 'Tournament not found' }, { status: 404 }); - // } + // const tournament = await Tournament.findById(tournament_id); + // if (!tournament) { + // return NextResponse.json({ error: 'Tournament not found' }, { status: 404 }); + // } - // const bracketName = tournament.tournamentName; - // const registeredCount = tournament.teamsRegistered.length + // const bracketName = tournament.tournamentName; + // const registeredCount = tournament.teamsRegistered.length - // const newBracket = new Bracket({ - // bracketName, - // tournamentId: tournament_id, - // BracketNumber: registeredCount, - // consolationFinal, - // grandFinalType, - // }); + // const newBracket = new Bracket({ + // bracketName, + // tournamentId: tournament_id, + // BracketNumber: registeredCount, + // consolationFinal, + // grandFinalType, + // }); - // await newBracket.save(); + // await newBracket.save(); - // // Update the tournament with the new bracket - // await Tournament.findByIdAndUpdate(tournament_id, - // { $push: { brackets: newBracket._id } } - // ); + // // Update the tournament with the new bracket + // await Tournament.findByIdAndUpdate(tournament_id, + // { $push: { brackets: newBracket._id } } + // ); - // return NextResponse.json({ - // message: 'Bracket created and associated with tournament successfully', - // id: newBracket._id - // }, { status: 201 }); - } catch (error) { - console.error('Error creating bracket:', error); - return NextResponse.json({ - error: 'Internal Server Error', - details: error.message - }, { status: 500 }); - } + // return NextResponse.json({ + // message: 'Bracket created and associated with tournament successfully', + // id: newBracket._id + // }, { status: 201 }); + } catch (error) { + console.error("Error creating bracket:", error); + return NextResponse.json( + { + error: "Internal Server Error", + details: error.message, + }, + { status: 500 }, + ); + } } export async function GET() { diff --git a/app/api/games/route.js b/app/api/games/route.js index 6bf07c4..58cef80 100644 --- a/app/api/games/route.js +++ b/app/api/games/route.js @@ -22,4 +22,3 @@ export async function GET(req) { ); } } - diff --git a/app/bracket/create/page.js b/app/bracket/create/page.js index 450581c..806f0b5 100644 --- a/app/bracket/create/page.js +++ b/app/bracket/create/page.js @@ -1,8 +1,6 @@ -import React from 'react' -import BracketForm from '../../../components/BracketForm' +import React from "react"; +import BracketForm from "../../../components/BracketForm"; export default function Page() { - return ( - - ) + return ; } diff --git a/app/bracket/page.js b/app/bracket/page.js index 89ee16c..e70d4fd 100644 --- a/app/bracket/page.js +++ b/app/bracket/page.js @@ -1,20 +1,23 @@ import TournamentBracket from "../../components/TournamentBracket"; -import React from "react" +import React from "react"; import BracketList from "../../components/BracketList"; -import { buttonVariants } from "../../components/ui/button" +import { buttonVariants } from "../../components/ui/button"; import Link from "next/link"; const BracketPage = () => { - return ( -
-
- - Create a bracket - -
- -
- ); + return ( +
+
+ + Create a bracket + +
+ +
+ ); }; export default BracketPage; diff --git a/app/contact/page.js b/app/contact/page.js index d2f425d..0fe5dab 100644 --- a/app/contact/page.js +++ b/app/contact/page.js @@ -1,83 +1,13 @@ "use client"; -import { Card, CardContent } from "../../@/components/ui/card"; -import { Input } from "../../@/components/ui/input"; -import { Label } from "../../@/components/ui/label"; -import { Textarea } from "../../@/components/ui/textarea"; -import { Button } from "../../@/components/ui/button"; - -const contactdetails = [ - { - title: "Email", - content: "contact@sanityesports.live", - }, - { - title: "Phone", - content: "+1 (800) 123 XX21", - }, - { - title: "Support", - content: "support@sanityesports.live", - }, -]; +import ContactLeftComp from "../../components/Contatct/Contact-left"; +import ContactRightComp from "../../components/Contatct/Contact-right"; export default function ContactPage() { return ( -
-
-
-

- Contact us -

- -
- We are always looking for ways to improve our products and services. - Contact us and let us know how we can help you. -
-
- -
- {contactdetails.map((item, idx) => ( -
-

{item.title}

-

{item.content}

-
- ))} -
-
- -
- - -
-
- - - -
- -
- - - -
- -
- - -