Coder Social home page Coder Social logo

nextchris's Issues

Sweep: Can you help me to show the project listings on homepage

I want to show the dynamic content in #4 #5 #1 i already have the pages i setup lib/data.ts, and in last commit you created the pages for projects listings i want to show that in homepage can you change the code in releated files

This is the Homepage code

function PageHome() {
return (


{/* GLASSMOPHIN */}

  <div className="container relative space-y-24 mb-24 lg:space-y-28 lg:mb-28">
    {/* SECTION HERO */}
    <SectionHero className="pt-10 lg:pt-16 lg:pb-16" />

    {/* SECTION 1 */}
    <SectionSliderNewCategories categories={DEMO_CATS} />

    <SectionOurFeatures />

    <SectionGridFeaturePlaces cardType="card2" />

    <SectionHowItWork />

    <div className="relative py-16">
      <BackgroundSection className="bg-orange-50 dark:bg-black/20" />
      <SectionSliderNewCategories
        categories={DEMO_CATS_2}
        categoryCardType="card4"
        itemPerRow={4}
        heading="Suggestions for discovery"
        subHeading="Popular places to stay that Chisfis recommends for you"
        sliderStyle="style2"
      />
    </div>

    <SectionSubscribe2 />

    <div className="relative py-16">
      <BackgroundSection className="bg-orange-50 dark:bg-black dark:bg-opacity-20 " />
      <SectionGridAuthorBox />
    </div>

    <SectionGridCategoryBox />

    <div className="relative py-16">
      <BackgroundSection />
      <SectionBecomeAnAuthor />
    </div>

    <SectionSliderNewCategories
      heading="Explore by types of stays"
      subHeading="Explore houses based on 10 types of stays"
      categoryCardType="card5"
      itemPerRow={5}
    />

    <SectionVideos />

    <div className="relative py-16">
      <BackgroundSection />
      <SectionClientSay />
    </div>
  </div>
</main>

);
}

Checklist
  • Modify src/app/page.tsx67ea264 Edit
  • Running GitHub Actions for src/app/page.tsxEdit
  • Create src/app/(project-listings)/SectionGridFeaturePlaces.tsxb5e2c60 Edit
  • Running GitHub Actions for src/app/(project-listings)/SectionGridFeaturePlaces.tsxEdit

Sweep: can you please add more dynamic pages

Details

I want to show the dynamic content in #4 #5 #1 #i already have the pages i setup lib/data.ts, and in last commit you created the pages for projects listings i want to show that in homepage can you change the code in releated files

Branch

No response

Checklist
  • Modify src/app/page.tsx659c564 Edit
  • Running GitHub Actions for src/app/page.tsxEdit

Sweep: I want to use the api instead of Hardcoded static data

Your job is the use exactly this fetch method no serversideprops no staticpaths, no usestate, no use effect for this task because i want the simple server side rendering that's why i used direct fetch method it working amazing now your job is to add the project data in components and the property pages just map these fields below replace the old static content

This is my API Code
// page.tsx (Server Component)
import { fetchProjects, fetchProjectBySlug } from "@/app/lib/data";
import { project } from "@/data/types";
import type { Project } from "@/types/project";
import Image from "next/image";

export default async function MyPage() {
// Fetch data directly within the Server Component
const data = await fetchProjects();

return (


{data.map((project: project) => (

{/* Use project data here */}

{project.name}


{project.summary}

Developer: {project.developer}

Type: {project.buildingType}

Bedrooms: {project.bedrooms}

Units/Stories: {project.unitsStories}

Completion: {project.estimatedCompletion}

Status: {project.status}

Province: {project.province}

Images:

Images:

      <div>
        {project.images && project.images[1] && (
          <Image
            src={project.images[1].ImagePath}
            alt={project.images[1].ImageDescription}
            width={500}
            height={300}
          />
        )}
      </div>
      <h1>{project.developer}</h1>

      {/* ... */}
    </div>
  ))}
</main>

);
}

Project Slug Page

// app/projects/[slug]/page.tsx
import { project } from "@/types/project";
import { fetchProjects, fetchProjectBySlug } from "@/app/lib/data";
import Image from "next/image";
export async function generateStaticParams() {
const projects = await fetchProjects();

return projects.map((project) => ({
params: { slug: project.slug },
}));
}

export default async function Page({ params }: { params: any }) {
// Fetch data directly within the Server Component
const project = await fetchProjectBySlug(params.slug);

return (



{/* Use project data here */}

{project.name}


{project.summary}

{project.name}


{project.summary}

Developer: {project.developer}

Type: {project.buildingType}

Bedrooms: {project.bedrooms}

Units/Stories: {project.unitsStories}

Completion: {project.estimatedCompletion}

Status: {project.status}

Province: {project.province}

Images:

Images:

    <div>
      {project.images && project.images[1] && (
        <Image
          src={project.images[1].ImagePath}
          alt={project.images[1].ImageDescription}
          width={500}
          height={300}
        />
      )}
    </div>
    {/* ... */}
  </div>
</main>

);
}

// app/lib/data.ts (Server Component)
import { unstable_noStore as noStore } from 'next/cache';
import type { Project } from '@/types/project'; // Assuming you have a Project type defined

const BASE_URL = 'https://projectsapi-j1mi.onrender.com/projects'; // Replace with your actual API base URL

// Fetch all projects
export async function fetchProjects(): Promise<Project[]> {
noStore();
const res = await fetch(BASE_URL);
if (!res.ok) {
throw new Error('Failed to fetch projects');
}
return res.json();
}

// Fetch a single project by Slug
export async function fetchProjectBySlug(slug: string): Promise {
noStore();
const res = await fetch(${BASE_URL}/${slug});
if (!res.ok) {
throw new Error(Failed to fetch project with ID: ${slug});
}
return res.json();
}

// Generate static params for projects
export async function generateStaticParams() {
const projects = await fetchProjects();

          return projects.map((project: Project) => ({
                        params: { slug: project.slug },
          }));

}

// ... Add more functions as needed

Here is the Sample of Our Response for single Project

[
{
"_id": "842d135f-4c3a-46ad-952c-73d87ad538a3",
"address": "17 Baldwin Street,",
"name": "Prince George Landing",
"slug": "prince-george-landing",
"bedrooms": "1 - 3 Bedrooms",
"buildingType": "Condo & Townhouse",
"city_name": "Whitby,",
"developer": "Stockworth Developments",
"developer_info": "Stockworth Developments, Rosewater Developments, Whitby, ON",
"estimatedCompletion": "Preconstruction",
"images": [
{
"_id": "6617a04935efa29ef186028d",
"ImageName": "Prince George Landing Rendering",
"ImageDescription": "Exterior photo of Prince George Landing",
"ImagePath": "https://d2kcmk0r62r1qk.cloudfront.net/imageSponsors/xlarge/2017_03_29_10_43_24_stockworth_developments_prince_george_rendering.webp"
},
{
"_id": "6617a04935efa29ef186028e",
"ImageName": "Prince George Landing Rendering",
"ImageDescription": "Exterior photo of Prince George Landing",
"ImagePath": "https://d2kcmk0r62r1qk.cloudfront.net/imageSponsors/xlarge/2018_10_09_04_00_13_princegeorgelanding.com-686493590913612.webp"
},
{
"_id": "6617a04935efa29ef186028f",
"ImageName": "Prince George Landing Rendering",
"ImageDescription": "Exterior photo of Prince George Landing",
"ImagePath": "https://d2kcmk0r62r1qk.cloudfront.net/imageSponsors/xlarge/2018_10_09_04_00_13_princegeorgelanding.com-686486264150650.webp"
}
],
"incentives": "Not available",
"price": "Not available",
"province": "ON",
"sizeSqFt": "Not available",
"status": "Pending",
"street_name": "17 Baldwin Street,",
"summary": "Stockworth Developments acquired a site located on Baldwin Street and George Street in the Community of Brooklin, Town of Whitby, Ontario. The site will be a mixed use development consisting of a small retail component and a combination of luxury and stacked towns. Stockworth Developments and Rosewater Developments will co-develop and build the site out. Rich in history and culture, the community of Brooklin within the town of Whitby combines the charm of a small town with the amenities of a busy city. Backing onto a ravine, fronting onto Baldwin Street, featuring balconies and underground parking, Prince George Landing is where your life combines with nature. These townhomes and apartments are perfectly situated in the heart of Brooklin, the perfect community for families and couples alike. Between the schools, shopping, and countless other convenient amenities, Prince George Landing is without a doubt where your dreams will become reality.",
"unitsStories": "85 Units,",
"units": [
{
"_id": "6617a04935efa29ef1860290",
"br": 1,
"status": "Not Available",
"statusName": "Sold",
"colType": "Condos",
"unitType": "Unit",
"unitName": "312",
"ba": 1,
"sqft": 691,
"lotBalc": "",
"price": null,
"lastPrice": null,
"lastPriceWithValue": null,
"unitStyle": "Suite",
"url": "https://whitby-on/prince-george-landing/condo-unit--312",
"image": "https://d2kcmk0r62r1qk.cloudfront.net/imageFloorPlans/2019_02_01_03_04_53_building-a_1.png"
},

Checklist
  • Create src/app/lib/data.tsf1a8a6b Edit
  • Running GitHub Actions for src/app/lib/data.tsEdit
  • Modify src/app/(project-listings)/listing-project/page.tsx8ea916f Edit
  • Running GitHub Actions for src/app/(project-listings)/listing-project/page.tsxEdit
  • Modify src/app/page.tsx ! No changes made Edit
  • Running GitHub Actions for src/app/page.tsxEdit

Sweep: i want to create the new projects page in this project

Hello i want you to build the new listings page for projects like these src/app/(real-estate-listings) i have uploaded the json data file named #https://github.com/labi1240/realestatenextjs/blob/main/src/data/jsons/__projects.json __projects.json You can get the sample of data and use this data for creating the projects page. There is types page inside the data where you can write the types from my json file src/data/types.ts . You can use these types of card src/components/StayCard.tsx but you have to change the fields in it according to data and it is using nextjs app router 14 like you can create directory like this src/app/(real-estate-listings)/listing-real-estate-map

Checklist
  • Create src/app/(project-listings)/listing-project/page.tsx3b63cfd Edit
  • Running GitHub Actions for src/app/(project-listings)/listing-project/page.tsxEdit
  • Create src/app/(project-listings)/SectionGridHasMap.tsxEdit
  • Running GitHub Actions for src/app/(project-listings)/SectionGridHasMap.tsxEdit
  • Create src/app/(project-listings)/layout.tsxEdit
  • Running GitHub Actions for src/app/(project-listings)/layout.tsxEdit
  • Create src/components/ProjectCard.tsxEdit
  • Running GitHub Actions for src/components/ProjectCard.tsxEdit
  • Modify src/data/types.ts ! No changes made Edit
  • Running GitHub Actions for src/data/types.tsEdit
  • Modify src/data/listings.ts ! No changes made Edit
  • Running GitHub Actions for src/data/listings.tsEdit

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.