@sigit / nord / commits / 7d2bdcb

update

Seto Elkahfi committed Jun 6, 2025 at 14:34 UTC 7d2bdcb84e0478d1cf8c41538632a81903e307e8
4 files changed +51 -30
app/layout.tsx
+3
index cabcba2..1226c2e 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -41,6 +41,9 @@ export default function RootLayout({ </Link> .{"\n "} </p> + <p className="text-center text-gray-500 mb-8"> + Text to book +47 6494 0131 + </p> <main className="pt-6">{children}</main> </body> </html>
components/ai-review-summary.tsx
+8
index b57ee2f..421d40b 100644 --- a/components/ai-review-summary.tsx +++ b/components/ai-review-summary.tsx @@ -28,6 +28,14 @@ export async function AIReviewSummary({ product }: { product: Product }) { <span className="text-sm ml-4 text-gray-500 dark:text-gray-400"> {numberWithOneDecimal(averageRating)} out of 5 </span> + <a + href="https://maps.app.goo.gl/f4irVqGC9KGHzRDP9" + target="_blank" + rel="noopener noreferrer" + className="ml-6 underline text-xs text-blue-600" + > + Google page + </a> </div> </CardHeader> <CardContent className="p-0 grid gap-4">
components/reviews.tsx
+25 -8
index f09abc2..492157b 100644 --- a/components/reviews.tsx +++ b/components/reviews.tsx @@ -1,14 +1,17 @@ import { AvatarImage, AvatarFallback, Avatar } from "@/components/ui/avatar"; import { Product, Review as ReviewType } from "@/lib/types"; -import ms from "ms"; import { FiveStarRating } from "./five-star-rating"; import { AIReviewSummary } from "./ai-review-summary"; export async function Reviews({ product }: { product: Product }) { + // Sort reviews by date descending (newest first) + const sortedReviews = [...product.reviews].sort( + (a, b) => new Date(b.date).getTime() - new Date(a.date).getTime() + ); return ( <div className="mx-auto px-4 md:px-6 max-w-2xl grid gap-12"> <AIReviewSummary product={product} /> - {product.reviews.map((review) => ( + {sortedReviews.map((review) => ( <div key={review.review}> <Review key={review.review} review={review} /> </div> @@ -52,10 +55,24 @@ export function Review({ review }: { review: ReviewType }) { * You probably want to wrap the parent element of this component with `suppressHydrationWarning` */ const timeAgo = (date: Date, suffix = true) => { - if (Date.now() - date.getTime() < 1000) { - return "Just now"; - } - return `${ms(Date.now() - date.getTime(), { long: true })}${ - suffix ? " ago" : "" - }`; + const now = new Date(); + const seconds = Math.floor((now.getTime() - date.getTime()) / 1000); + + if (seconds < 60) return "Just now"; + const minutes = Math.floor(seconds / 60); + if (minutes < 60) + return `${minutes} minute${ + minutes !== 1 ? "s" : "" + }${suffix ? " ago" : ""}`; + const hours = Math.floor(minutes / 60); + if (hours < 24) + return `${hours} hour${hours !== 1 ? "s" : ""}${suffix ? " ago" : ""}`; + const days = Math.floor(hours / 24); + if (days < 30) + return `${days} day${days !== 1 ? "s" : ""}${suffix ? " ago" : ""}`; + const months = Math.floor(days / 30); + if (months < 12) + return `${months} month${months !== 1 ? "s" : ""}${suffix ? " ago" : ""}`; + const years = Math.floor(months / 12); + return `${years} year${years !== 1 ? "s" : ""}${suffix ? " ago" : ""}`; };
lib/sample-data.ts
+15 -22
index c6c83bd..fa651ac 100644 --- a/lib/sample-data.ts +++ b/lib/sample-data.ts @@ -15,38 +15,31 @@ export const sampleProductsReviews: Record<string, Product> = { reviews: [ { review: - "Absolutely love the Hagersten Street Cut! Installation was a breeze, thanks to the clear instructions and videos. It navigates my complex yard with ease, even the steep parts. Plus, it's so quiet, I barely notice it's working. Truly a game-changer for lawn care.", - authorName: "Jake P.", - date: "2024-02-15", + "Fantastic barber! Got a sharp haircut and beard trim. The staff are friendly and really listen to what you want. The shop is clean and has a great vibe. Highly recommend if you're in Hagersten.", + authorName: "Erik S.", + date: "2024-05-15", stars: 5, }, { review: - "The Hagersten Street Cut has been a solid addition to my garden tools. It handles the lawn autonomously, freeing up my weekends. The app control is intuitive, though I wish the Bluetooth range was better. Overall, a reliable lawn mower that does its job well.", - authorName: "Marianne L.", - date: "2024-01-28", - stars: 4, - }, - { - review: - "I had high hopes for the Hagersten Street Cut, but it's been a mixed bag. The setup was more complicated than expected, and it occasionally misses spots on the lawn. It's quiet and the safety features are reassuring, but I expected more precision for the price.", - authorName: "Alexa R.", - date: "2023-12-20", - stars: 3, + "Very professional service and attention to detail. I appreciated the advice on styling and products. Will definitely come back next month.", + authorName: "Anna L.", + date: "2024-04-28", + stars: 5, }, { review: - "The Hagersten Street Cut is decent. It mows the lawn autonomously, which is convenient. However, the setup took some effort, and the app could be more stable. It's nice to have, but I'm not sure it's worth the investment for smaller yards.", - authorName: "Gary W.", - date: "2024-02-05", - stars: 3, + "Walked in without an appointment and was seen quickly. The barber was skilled and friendly. Prices are reasonable for Stockholm. Great local spot!", + authorName: "Jonas M.", + date: "2025-04-10", + stars: 4, }, { review: - "Overall, the Hagersten Street Cut is a good buy. It handles most of my lawn well, including the slope. The silent operation is a huge plus. Just wish the battery life was longer, as it doesn't always finish in one go. Still, it's much better than manual mowing.", - authorName: "Bethany E.", - date: "2024-01-19", - stars: 4, + "My son and I both got haircuts here. The barber was patient and did a great job with my son's hair. Convenient location in Hagersten.", + authorName: "Maria P.", + date: "2025-03-20", + stars: 5, }, ], },