From 49fe682a15f19ad767d7b8b55f69afe36c537bc8 Mon Sep 17 00:00:00 2001 From: Stian Date: Tue, 12 May 2026 17:05:33 +0200 Subject: [PATCH] Placeholders test --- src/app/helper/reports/page.tsx | 73 +++++++++++++++- src/app/helper/support/page.tsx | 115 ++++++++++++++++++++++++- src/app/helpers/page.tsx | 87 ++++++++++++++++--- src/lib/helper-area-preview-copy.ts | 110 +++++++++++++++++++++++ src/lib/helper-preview-placeholders.ts | 58 +++++++++++++ 5 files changed, 428 insertions(+), 15 deletions(-) create mode 100644 src/lib/helper-area-preview-copy.ts create mode 100644 src/lib/helper-preview-placeholders.ts diff --git a/src/app/helper/reports/page.tsx b/src/app/helper/reports/page.tsx index dd00929..d399901 100644 --- a/src/app/helper/reports/page.tsx +++ b/src/app/helper/reports/page.tsx @@ -11,6 +11,12 @@ import { useCurrentHelper } from "@/hooks/useCurrentHelper" import { useProjectSelection } from "@/contexts/project-context" import { Sidebar } from "@/components/layout/sidebar" import { Header } from "@/components/layout/header" +import { + MONTHLY_PREVIEW_STATS, + PAYOUT_PREVIEW_ROWS, + REPORTS_MONTHLY_PREVIEW_DISCLAIMER, + REPORTS_PAYOUTS_PREVIEW_DISCLAIMER, +} from "@/lib/helper-area-preview-copy" interface PayoutData { id: string @@ -89,6 +95,12 @@ export default function HelperReportsPage() { setSelectedRows(selectedRows.length === payouts.length ? [] : payouts.map((payout) => payout.id)) } + const showPayoutPreview = + !!projectId && + !!helperId && + !isLoading && + payouts.length === 0 + return (
@@ -217,6 +229,54 @@ export default function HelperReportsPage() { Loading payouts... + ) : showPayoutPreview ? ( + <> + + + {REPORTS_PAYOUTS_PREVIEW_DISCLAIMER} + + + {PAYOUT_PREVIEW_ROWS.map((payout) => ( + + + + + +
+ {payout.ticketId} + + Preview + +
+ + {payout.date} + {payout.ticketType} + {payout.amount} + + + {payout.status === "completed" ? "Completed" : "Pending"} + + + +
+ + +
+ + + ))} + ) : payouts.length === 0 ? ( @@ -296,8 +356,17 @@ export default function HelperReportsPage() { {/* Monthly Reports Tab Content */} {activeTab === "monthly" && ( -
-

Monthly reports content would go here

+
+

{REPORTS_MONTHLY_PREVIEW_DISCLAIMER}

+
+ {MONTHLY_PREVIEW_STATS.map((row) => ( +
+

Preview

+

{row.label}

+

{row.value}

+
+ ))} +
)} diff --git a/src/app/helper/support/page.tsx b/src/app/helper/support/page.tsx index f64e271..802a2ea 100644 --- a/src/app/helper/support/page.tsx +++ b/src/app/helper/support/page.tsx @@ -9,6 +9,11 @@ import { Avatar, AvatarFallback } from "@/components/ui/avatar" import { Card, CardContent } from "@/components/ui/card" import { Clock, Users, Plus, Sparkles } from "lucide-react" import { useMemo } from "react" +import { toast } from "sonner" +import { + SUPPORT_TICKET_PREVIEW_CARDS, + SUPPORT_TICKETS_PREVIEW_DISCLAIMER, +} from "@/lib/helper-area-preview-copy" import { useProjectSelection } from "@/contexts/project-context" import { useTicketsWithDetails } from "@/hooks/useTicketsWithDetails" import { useProjectPaymentSettings } from "@/hooks/useProject" @@ -111,6 +116,18 @@ export default function HelperSupportPage() { const todayFormatted = formatDuration(todayMinutes) + const showSupportTicketPreview = + !!projectId && + !ticketsLoading && + availableTickets.length === 0 && + activeTickets.length === 0 + + const previewRates = rates ?? { + startPrice: "USD 10.00", + first60: "USD 1.50/min", + after60: "USD 1.00/min", + } + return (
@@ -172,7 +189,103 @@ export default function HelperSupportPage() { {/* Available Tickets */}

Available Tickets

- {formattedAvailable.length === 0 ? ( + {formattedAvailable.length === 0 && showSupportTicketPreview ? ( +
+

+ {SUPPORT_TICKETS_PREVIEW_DISCLAIMER} +

+ {SUPPORT_TICKET_PREVIEW_CARDS.map((ticket) => ( + + +
+ + {ticket.avatar} + +
+
+
+

{ticket.title}

+ + Preview + + • {ticket.timestamp} +
+

{ticket.description}

+ +
+ {ticket.topics.length > 0 && ( +
+

Other topics

+
+ {ticket.topics.map((topic) => ( + + {topic} + + ))} +
+
+ )} + +
+

Type of help

+ + {ticket.helpType} + +
+ +
+

Rates

+
+
+

Start price

+

{previewRates.startPrice}

+
+
+

First 60 min

+

{previewRates.first60}

+
+
+

After 60 min

+

{previewRates.after60}

+
+
+
+
+
+ +
+ + +
+
+
+
+
+ ))} +
+ ) : formattedAvailable.length === 0 ? (

No available tickets right now.

) : ( formattedAvailable.map((ticket) => ( diff --git a/src/app/helpers/page.tsx b/src/app/helpers/page.tsx index b43f1a0..fcfd33f 100644 --- a/src/app/helpers/page.tsx +++ b/src/app/helpers/page.tsx @@ -19,6 +19,10 @@ import { useCreateProjectInvite, useListProjectInvites, useRevokeProjectInvite } import { useProjectSelection } from "@/contexts/project-context" import { useUser } from "@/contexts/user-context" import Link from "next/link" +import { + HELPER_LIST_PREVIEW_DISCLAIMER, + HELPER_PREVIEW_PLACEHOLDERS, +} from "@/lib/helper-preview-placeholders" const GithubIcon = ({ className }: { className?: string }) => ( 0 ? ( - filteredHelpers.map((helper, index) => ( + if (filteredHelpers.length > 0) { + return filteredHelpers.map((helper, index) => (
@@ -658,16 +662,75 @@ export default function HelpersPage() {
)) - ) : ( -
-

No helpers yet.

-

Add helpers by inviting them via email or sharing an invite link.

- -
- ) + } + const noRealHelpers = (helpersData?.length ?? 0) === 0 + if (noRealHelpers && projectId) { + return ( + <> +
+

+ {HELPER_LIST_PREVIEW_DISCLAIMER} +

+
+ {HELPER_PREVIEW_PLACEHOLDERS.map((h) => ( +
+
+
+ +
+
+
+ {h.initials} +
+
+ {h.name} + {h.involvement} +
+
+
+ + {h.githubHandle} +
+
+ + {mapCategoryToLabel[h.category]} + +
+
+ + Preview + + +
+
+
+ ))} +
+
+
+

No helpers yet.

+

Add helpers by inviting them via email or sharing an invite link.

+ +
+ + ) + } + return ( +
+

No helpers match your filters.

+

Try clearing search or switching category to see your team.

+
+ ) } return filteredRequests.length > 0 ? ( filteredRequests.map((request, index) => ( diff --git a/src/lib/helper-area-preview-copy.ts b/src/lib/helper-area-preview-copy.ts new file mode 100644 index 0000000..4d06952 --- /dev/null +++ b/src/lib/helper-area-preview-copy.ts @@ -0,0 +1,110 @@ +/** + * Shared copy and static preview data for helper Support / Reports empty states. + * Preview UI only; no API calls or DB writes. + */ + +export const SUPPORT_TICKETS_PREVIEW_DISCLAIMER = + "There are no real tickets in this project yet. The cards below are a preview of how available tickets will look." + +export const REPORTS_PAYOUTS_PREVIEW_DISCLAIMER = + "You have no payout records yet. The table below shows sample rows for layout preview only." + +export const REPORTS_MONTHLY_PREVIEW_DISCLAIMER = + "Monthly aggregates are not available yet. The figures below are placeholders for preview only." + +export type SupportTicketPreviewCard = { + id: string + title: string + customer: string + avatar: string + description: string + topics: string[] + helpType: string + timestamp: string +} + +export const SUPPORT_TICKET_PREVIEW_CARDS: SupportTicketPreviewCard[] = [ + { + id: "preview-support-1", + title: "Dashboard sidebar collapses on navigation", + customer: "Preview Customer", + avatar: "P", + description: + "When switching between Analytics and Settings, the sidebar sometimes collapses unexpectedly. Steps to reproduce are attached in the full ticket.", + topics: ["Bug", "UI"], + helpType: "default", + timestamp: "10.05.2026, 09:00", + }, + { + id: "preview-support-2", + title: "Question about webhook retry policy", + customer: "Preview Customer", + avatar: "P", + description: + "We need clarification on how many times failed webhooks are retried and whether exponential backoff applies.", + topics: ["Question", "API"], + helpType: "default", + timestamp: "09.05.2026, 14:30", + }, + { + id: "preview-support-3", + title: "Feature request: export tickets to CSV", + customer: "Preview Customer", + avatar: "P", + description: + "Support managers would like a one-click export of filtered tickets for weekly reporting.", + topics: ["General"], + helpType: "default", + timestamp: "08.05.2026, 11:15", + }, +] + +export type PayoutPreviewRow = { + id: string + ticketId: string + date: string + ticketType: string + amount: string + status: "pending" | "completed" +} + +export const PAYOUT_PREVIEW_ROWS: PayoutPreviewRow[] = [ + { + id: "preview-payout-1", + ticketId: "a1b2c3d", + date: "01/05/2026", + ticketType: "Bug", + amount: "USD 42.00", + status: "completed", + }, + { + id: "preview-payout-2", + ticketId: "e4f5g6h", + date: "28/04/2026", + ticketType: "Question", + amount: "USD 18.50", + status: "pending", + }, + { + id: "preview-payout-3", + ticketId: "i7j8k9l", + date: "15/04/2026", + ticketType: "General", + amount: "USD 120.00", + status: "completed", + }, + { + id: "preview-payout-4", + ticketId: "m0n1o2p", + date: "02/04/2026", + ticketType: "Bug", + amount: "USD 65.25", + status: "pending", + }, +] + +export const MONTHLY_PREVIEW_STATS: { label: string; value: string }[] = [ + { label: "Tickets closed (preview)", value: "—" }, + { label: "Hours logged (preview)", value: "—" }, + { label: "Earnings (preview)", value: "—" }, +] diff --git a/src/lib/helper-preview-placeholders.ts b/src/lib/helper-preview-placeholders.ts new file mode 100644 index 0000000..1cda3ac --- /dev/null +++ b/src/lib/helper-preview-placeholders.ts @@ -0,0 +1,58 @@ +/** + * Frontend-only preview rows for the helpers list empty state. + * No database writes; not shown when filters hide real helpers. + */ + +export const HELPER_LIST_PREVIEW_DISCLAIMER = + "You do not have any helpers yet. The rows below are a visual preview only—they are not real team members." + +export type HelperPreviewCategory = "core" | "extended" | "community" + +export type HelperPreviewPlaceholder = { + id: string + name: string + initials: string + githubHandle: string + category: HelperPreviewCategory + involvement: string + color: string +} + +export const HELPER_PREVIEW_PLACEHOLDERS: HelperPreviewPlaceholder[] = [ + { + id: "preview-1", + name: "Alex Rivera", + initials: "AR", + githubHandle: "arivera-demo", + category: "core", + involvement: "Primary on-call", + color: "#f4bccc", + }, + { + id: "preview-2", + name: "Jordan Lee", + initials: "JL", + githubHandle: "jlee-extended", + category: "extended", + involvement: "Occasional reviews", + color: "#d0f6bc", + }, + { + id: "preview-3", + name: "Sam Okonkwo", + initials: "SO", + githubHandle: "sam-community", + category: "community", + involvement: "Community triage", + color: "#bcedf6", + }, + { + id: "preview-4", + name: "Morgan Patel", + initials: "MP", + githubHandle: "mpatel-consult", + category: "extended", + involvement: "Consulting", + color: "#f6e6bc", + }, +]